text:
<?xml version="1.0" encoding="iso-8859-1"?>
<chapter id="win32">
<title>Running GHC on Win32 systems</title>

<sect1 id="ghc-windows">
<title>
Starting GHC on Windows platforms</title>

<para>
The installer that installs GHC on Win32 also sets up the file-suffix associations
for ".hs" and ".lhs" files so that double-clicking them starts <command>ghci</command>.
</para>
<para>
Be aware of that <command>ghc</command> and <command>ghci</command> do
require filenames containing spaces to be escaped using quotes:
<programlisting>
  c:\ghc\bin\ghci "c:\\Program Files\\Haskell\\Project.hs"
</programlisting>
If the quotes are left off in the above command, <command>ghci</command> will
interpret the filename as two, "c:\\Program" and "Files\\Haskell\\Project.hs".
</para>

<!-- not clear whether there are current editions of Win32 OSes that
     doesn't do this by default.

<para> Solution: don't use "Open With...", avoid spaces in file names,
or fiddle with the appropriate registry setting:
<programlisting>
  HKEY_CLASSES_ROOT\Unknown\shell\openas\command
</programlisting>
Notice how the "%1" argument is quoted (or not).
</para>
<para> This problem doesn't occur when double-clicking.
</para>
-->

</sect1>

<sect1 id="ghci-windows">
<title>Running GHCi on Windows</title>

  <para>We recommend running GHCi in a standard Windows console:
  select the <literal>GHCi</literal> option from the start menu item
  added by the GHC installer, or use
  <literal>Start->Run->cmd</literal> to get a Windows console and
  invoke <literal>ghci</literal> from there (as long as it's in your
  <literal>PATH</literal>).</para>

  <para>If you run GHCi in a Cygwin or MSYS shell, then the Control-C
  behaviour is adversely affected.  In one of these environments you
  should use the <literal>ghcii.sh</literal> script to start GHCi,
  otherwise when you hit Control-C you'll be returned to the shell
  prompt but the GHCi process will still be running.  However, even
  using the <literal>ghcii.sh</literal> script, if you hit Control-C
  then the GHCi process will be killed immediately, rather than
  letting you interrupt a running program inside GHCi as it should.
  This problem is caused by the fact that the Cygwin and MSYS shell
  environments don't pass Control-C events to non-Cygwin child
  processes, because in order to do that there needs to be a Windows
  console.</para>

  <para>There's an exception: you can use a Cygwin shell if the
  <literal>CYGWIN</literal> environment variable does
  <emphasis>not</emphasis> contain <literal>tty</literal>.  In this
  mode, the Cygwin shell behaves like a Windows console shell and
  console events are propagated to child processes.  Note that the
  <literal>CYGWIN</literal> environment variable must be set
  <emphasis>before</emphasis> starting the Cygwin shell; changing it
  afterwards has no effect on the shell.</para>

  <para>This problem doesn't just affect GHCi, it affects any
  GHC-compiled program that wants to catch console events.  See the
  <ulink
  url="&libraryBaseLocation;/GHC-ConsoleHandler.html">GHC.ConsoleHandler</ulink>
  module.</para>
</sect1>

<sect1 id="terminal-interaction">
<title>
Interacting with the terminal</title>

<para>By default GHC builds applications that open a console window when they start.
If you want to build a GUI-only application, with no console window, use the flag
<literal>-optl-mwindows</literal> in the link step.
</para>

<para>       <emphasis>Warning:</emphasis> Windows GUI-only programs have no
        stdin, stdout or stderr so using the ordinary Haskell
        input/output functions will cause your program to fail with an
        IO exception, such as:
<screen>
      Fail: <stdout>: hPutChar: failed (Bad file descriptor)
</screen>
        However using Debug.Trace.trace is alright because it uses
        Windows debugging output support rather than stderr.</para>

<para>For some reason, Mingw ships with the <literal>readline</literal> library,
but not with the <literal>readline</literal> headers. As a result, GHC (like Hugs) does not
use <literal>readline</literal> for interactive input on Windows.
You can get a close simulation by using an emacs shell buffer!
</para>

</sect1>

<sect1 id="library-differences">
<title>
Differences in library behaviour </title>

<para>
Some of the standard Haskell libraries behave slightly differently on Windows.

<itemizedlist>
<listitem> <para>
On Windows, the '<literal>^Z</literal>' character is interpreted as an
end-of-file character, so if you read a file containing this character
the file will appear to end just before it. To avoid this,
use <literal>IOExts.openFileEx</literal> to open a file in binary
(untranslated) mode or change an already opened file handle into
binary mode using <literal>IOExts.hSetBinaryMode</literal>. The
<literal>IOExts</literal> module is part of the
<literal>lang</literal> package.
</para>
</listitem>
</itemizedlist>
</para>
</sect1>

<sect1 id="ghci-cygwin">
<title>
Using GHC (and other GHC-compiled executables) with cygwin</title>

<sect2>
<title>Background</title> <para>The cygwin tools aim to provide a
unix-style API on top of the windows libraries, to facilitate ports of
unix software to windows. To this end, they introduce a unix-style
directory hierarchy under some root directory (typically
<filename>/</filename> is <filename>C:\cygwin\</filename>). Moreover,
everything built against the cygwin API (including the cygwin tools
and programs compiled with cygwin's ghc) will see / as the root of
their file system, happily pretending to work in a typical unix
environment, and finding things like <filename>/bin</filename> and <filename>/usr/include</filename> without
ever explicitly bothering with their actual location on the windows
system (probably <filename>C:\cygwin\bin</filename> and <filename>C:\cygwin\usr\include</filename>).
</para>
</sect2>

<sect2><title>The problem</title>
<para>GHC, by default, no longer depends on cygwin, but is a native
windows program. It is built using mingw, and it uses mingw's ghc
while compiling your Haskell sources (even if you call it from
cygwin's bash), but what matters here is that - just like any other
normal windows program - neither GHC nor the executables it produces
are aware of cygwin's pretended unix hierarchy. GHC will happily
accept either '/' or '\' as path separators, but it won't know where
to find <filename>/home/joe/Main.hs</filename> or <filename>/bin/bash</filename>
or the like. This causes all
kinds of fun when GHC is used from within cygwin's bash, or in
make-sessions running under cygwin.
</para>
</sect2>

<sect2><title>Things to do</title>
<itemizedlist>
<listitem>
<para> Don't use absolute paths in make, configure & co if there is any chance
  that those might be passed to GHC (or to GHC-compiled programs). Relative
  paths are fine because cygwin tools are happy with them and GHC accepts
  '/' as path-separator. And relative paths don't depend on where cygwin's
  root directory is located, or on which partition or network drive your source
  tree happens to reside, as long as you 'cd' there first.
</para></listitem>

<listitem>
<para> If you have to use absolute paths (beware of the innocent-looking
  <literal>ROOT=`pwd`</literal> in makefile hierarchies or configure scripts), cygwin provides
  a tool called <command>cygpath</command> that can convert cygwin's unix-style paths to their
  actual windows-style counterparts. Many cygwin tools actually accept
  absolute windows-style paths (remember, though, that you either need
  to escape '\' or convert '\' to '/'), so you should be fine just using those
  everywhere. If you need to use tools that do some kind of path-mangling
  that depends on unix-style paths (one fun example is trying to interpret ':'
  as a separator in path lists..), you can still try to convert paths using
  <command>cygpath</command> just before they are passed to GHC and friends.
</para></listitem>

<listitem>
<para> If you don't have <command>cygpath</command>, you probably don't have cygwin and hence
  no problems with it... unless you want to write one build process for several
  platforms. Again, relative paths are your friend, but if you have to use
  absolute paths, and don't want to use different tools on different platforms,
  you can simply write a short Haskell program to print the current directory
   (thanks to George Russell for this idea): compiled with GHC, this will give
  you the view of the file system that GHC depends on (which will differ
  depending on whether GHC is compiled with cygwin's gcc or mingw's
  gcc or on a real unix system..) - that little program can also deal with
  escaping '\' in paths. Apart from the banner and the startup time,
  something like this would also do:
<programlisting>
  $ echo "Directory.getCurrentDirectory >>= putStrLn . init . tail . show " | ghci
</programlisting>
</para></listitem>
</itemizedlist>
</sect2>
</sect1>

<sect1 id="win32-dlls">
<title>Building and using Win32 DLLs
</title>

<para>
<indexterm><primary>Dynamic link libraries, Win32</primary></indexterm>
<indexterm><primary>DLLs, Win32</primary></indexterm>
On Win32 platforms, the compiler is capable of both producing and using
dynamic link libraries (DLLs) containing ghc-compiled code. This
section shows you how to make use of this facility.
</para>

<para>
There are two distinct ways in which DLLs can be used:
<itemizedlist>
  <listitem>
    <para>
      You can turn each Haskell package into a DLL, so that multiple
      Haskell executables using the same packages can share the DLL files.
      (As opposed to linking the libraries statically, which in effect
      creates a new copy of the RTS and all libraries for each executable
      produced.)
    </para>
    <para>
      That is the same as the dynamic linking on other platforms, and it
      is described in <xref linkend="using-shared-libs"/>.
    </para>
  </listitem>
  <listitem>
    <para>
      You can package up a complete Haskell program as a DLL, to be called
      by some external (usually non-Haskell) program. This is usually used
      to implement plugins and the like, and is described below.
    </para>
  </listitem>
</itemizedlist>
</para>

<!--
<para>
Until recently, <command>strip</command> didn't work reliably on DLLs, so you
should test your version with care, or make sure you have the latest
binutils. Unfortunately, we don't know exactly which version of binutils
cured the problem (it was supposedly fixed some years ago).
</para>

<sect2 id="win32-dlls-link">
<title>Linking with DLLs</title>

<para>
The default on Win32 platforms is to link applications in such a way
that the executables will use the Prelude and system libraries DLLs,
rather than contain (large chunks of) them. This is transparent at the
command-line, so
</para>

<para>
<screen>
sh$ cat main.hs
module Main where
main = putStrLn "hello, world!"
sh$ ghc -o main main.hs
ghc: module version changed to 1; reason: no old .hi file
sh$ strip main.exe
sh$ ls -l main.exe
-rwxr-xr-x   1 544      everyone     4608 May  3 17:11 main.exe*
sh$ ./main
hello, world!
sh$
</screen>
</para>

<para>
will give you a binary as before, but the <filename>main.exe</filename>
generated will use the Prelude and RTS DLLs instead of linking them in
statically.
</para>

<para>
4K for a <literal>"hello, world"</literal> application—not bad, huh? :-)
</para>

</sect2>

<sect2 id="win32-dlls-linking-static">
<title>Not linking with DLLs
<indexterm><primary>-static option (Win32)</primary></indexterm></title>

<para>
If you want to build an executable that doesn't depend on any
ghc-compiled DLLs, use the <option>-static</option> option to link in
the code statically.
</para>

<para>
Notice that you cannot mix code that has been compiled with
<option>-static</option> and not, so you have to use the <option>-static</option>
option on all the Haskell modules that make up your application.
</para>

</sect2>
-->

<sect2 id="win32-dlls-create">
<title>Creating a DLL</title>

<para>
<indexterm><primary>Creating a Win32 DLL</primary></indexterm>
<indexterm><primary>-shared</primary></indexterm>
Sealing up your Haskell library inside a DLL is straightforward;
compile up the object files that make up the library, and then build
the DLL by issuing a command of the form:
</para>

<para>
<screen>
ghc -shared -o foo.dll bar.o baz.o wibble.a -lfooble
</screen>
</para>

<para>
By feeding the ghc compiler driver the option <option>-shared</option>, it
will build a DLL rather than produce an executable. The DLL will
consist of all the object files and archives given on the command
line.
</para>

<!--
<para>
To create a `static' DLL, i.e. one that does not depend on the GHC DLLs,
use the <option>-static</option> when compiling up your Haskell code and
building the DLL.
</para>
-->

<para>
A couple of things to notice:
</para>

<para>

<itemizedlist>
<!--
<listitem>
<para>
Since DLLs correspond to packages (see <xref linkend="packages"/>) you need
to use <option>-package-name dll-name</option> when compiling modules that
belong to a DLL if you're going to call them from Haskell. Otherwise, Haskell
code that calls entry points in that DLL will do so incorrectly, and crash.
For similar reasons, you can only compile a single module tree into a DLL,
as <function>startupHaskell</function> needs to be able to call its
initialisation function, and only takes one such argument (see <xref
linkend="win32-dlls-foreign"/>). Hence the modules
you compile into a DLL must have a common root.
</para>
</listitem>
-->

<listitem>
<para>
By default, the entry points of all the object files will be exported from
the DLL when using <option>-shared</option>. Should you want to constrain
this, you can specify the <emphasis>module definition file</emphasis> to use
on the command line as follows:

<screen>
ghc -shared -o .... MyDef.def
</screen>

See Microsoft documentation for details, but a module definition file
simply lists what entry points you want to export. Here's one that's
suitable when building a Haskell COM server DLL:

<programlisting>
EXPORTS
 DllCanUnloadNow     = DllCanUnloadNow@0
 DllGetClassObject   = DllGetClassObject@12
 DllRegisterServer   = DllRegisterServer@0
 DllUnregisterServer = DllUnregisterServer@0
</programlisting>
</para>
</listitem>

<listitem>
<para>
In addition to creating a DLL, the <option>-shared</option> option also
creates an import library. The import library name is derived from the
name of the DLL, as follows:

<programlisting>
DLL: HScool.dll  ==> import lib: libHScool.dll.a
</programlisting>

The naming scheme may look a bit weird, but it has the purpose of allowing
the co-existence of import libraries with ordinary static libraries (e.g.,
<filename>libHSfoo.a</filename> and
<filename>libHSfoo.dll.a</filename>.

Additionally, when the compiler driver is linking in non-static mode, it
will rewrite occurrence of <option>-lHSfoo</option> on the command line to
<option>-lHSfoo.dll</option>. By doing this for you, switching from
non-static to static linking is simply a question of adding
<option>-static</option> to your command line.

</para>
</listitem>
</itemizedlist>
</para>

</sect2>

<sect2 id="win32-dlls-foreign">
<title>Making DLLs to be called from other languages</title>

<para>
  This section describes how to create DLLs to be called from other languages,
  such as Visual Basic or C++. This is a special case of
  <xref linkend="ffi-library" />; we'll deal with the DLL-specific issues that
  arise below. Here's an example:
</para>
<para>
  Use foreign export declarations to export the Haskell functions you want to
  call from the outside. For example:
</para>
<programlisting>
-- Adder.hs
{-# LANGUAGE ForeignFunctionInterface #-}
module Adder where

adder :: Int -> Int -> IO Int  -- gratuitous use of IO
adder x y = return (x+y)

foreign export stdcall adder :: Int -> Int -> IO Int
</programlisting>
<para>
  Add some helper code that starts up and shuts down the Haskell RTS:
</para>
<programlisting>
// StartEnd.c
#include <Rts.h>

void HsStart()
{
   int argc = 1;
   char* argv[] = {"ghcDll", NULL}; // argv must end with NULL

   // Initialize Haskell runtime
   char** args = argv;
   hs_init(&argc, &args);
}

void HsEnd()
{
   hs_exit();
}
</programlisting>
<para>
  Here, <literal>Adder</literal> is the name of the root module in the module
  tree (as mentioned above, there must be a single root module, and hence a
  single module tree in the DLL). Compile everything up:
</para>
<screen>
ghc -c Adder.hs
ghc -c StartEnd.c
ghc -shared -o Adder.dll Adder.o Adder_stub.o StartEnd.o
</screen>
<para>
  Now the file <filename>Adder.dll</filename> can be used from other
  programming languages. Before calling any functions in Adder it is necessary
  to call <literal>HsStart</literal>, and at the very end call
  <literal>HsEnd</literal>.
</para>
<para>
  <emphasis>Warning:</emphasis> It may appear tempting to use
  <literal>DllMain</literal> to call
  <literal>hs_init</literal>/<literal>hs_exit</literal>, but this won't work
  (particularly if you compile with <literal>-threaded</literal>). There are
  severe restrictions on which actions can be performed during
  <literal>DllMain</literal>, and <literal>hs_init</literal> violates these
  restrictions, which can lead to your dll freezing during startup (see
  <ulink url="http://hackage.haskell.org/trac/ghc/ticket/3605">bug
  #3605</ulink>).
</para>

<sect3 id="win32-dlls-vba">
<title>Using from VBA</title>

<para>
  An example of using <filename>Adder.dll</filename> from VBA is:
</para>
<programlisting>
Private Declare Function Adder Lib "Adder.dll" Alias "adder@8" _
      (ByVal x As Long, ByVal y As Long) As Long

Private Declare Sub HsStart Lib "Adder.dll" ()
Private Declare Sub HsEnd Lib "Adder.dll" ()

Private Sub Document_Close()
HsEnd
End Sub

Private Sub Document_Open()
HsStart
End Sub

Public Sub Test()
MsgBox "12 + 5 = " & Adder(12, 5)
End Sub
</programlisting>
<para>
  This example uses the
  <literal>Document_Open</literal>/<literal>Close</literal> functions of
  Microsoft Word, but provided <literal>HsStart</literal> is called before the
  first function, and <literal>HsEnd</literal> after the last, then it will
  work fine.
</para>
</sect3>

<sect3 id="win32-dlls-c++">
<title>Using from C++</title>

<para>
  An example of using <filename>Adder.dll</filename> from C++ is:
</para>

<programlisting>
// Tester.cpp
#include "HsFFI.h"
#include "Adder_stub.h"
#include <stdio.h>

extern "C" {
    void HsStart();
    void HsEnd();
}

int main()
{
    HsStart();
    // can now safely call functions from the DLL
    printf("12 + 5 = %i\n", adder(12,5))    ;
    HsEnd();
    return 0;
}
</programlisting>
<para>
  This can be compiled and run with:
</para>
<screen>
$ ghc -o tester Tester.cpp Adder.dll.a
$ tester
12 + 5 = 17
</screen>

</sect3>

</sect2>

</sect1>
</chapter>

<!-- Emacs stuff:
     ;;; Local Variables: ***
     ;;; sgml-parent-document: ("users_guide.xml" "book" "chapter") ***
     ;;; End: ***
 -->

redpajama_set_name: RedPajamaGithub


text:
package script.groovy.annotation;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target(value = {ElementType.TYPE})
@Retention(value = RetentionPolicy.RUNTIME)
@Documented
public @interface TimerTask {
	public long period();
	public String key();
}


text:
require "spec_helper"

describe RegistrantGroupTypePolicy do
  subject { described_class }

  let(:super_admin) { FactoryBot.create(:super_admin_user) }

  let(:event_director) { FactoryBot.create(:user) }
  let(:other_event_director) { FactoryBot.create(:user) }
  let(:event) { FactoryBot.create(:event) }

  before do
    event_director.add_role(:director, event)
    other_event_director.add_role(:director, FactoryBot.create(:event))
  end

  let(:registrant_group_type) { FactoryBot.create(:registrant_group_type, source_element: event) }

  permissions :new?, :show?, :index? do
    it "super_admin can access" do
      expect(subject).to permit(super_admin, registrant_group_type)
    end

    it "either director can access" do
      expect(subject).to permit(event_director, registrant_group_type)
      expect(subject).to permit(other_event_director, registrant_group_type)
    end
  end

  permissions :create?, :destroy?, :edit?, :update? do
    it "allows event-director" do
      expect(subject).to permit(event_director, registrant_group_type)
    end

    it "does not allow different-event director" do
      expect(subject).not_to permit(other_event_director, registrant_group_type)
    end
  end
end


text:
/**
 * define file extensions and their associated 'content' mime type
 * to be served back to the client
**/

var  mimes = {
	'js':'application/javascript',
	'html':'text/html',
	'png':'image/png',
	'jpg':'image/jpeg',
	'jpeg':'image/jpeg',
	'css':'text/css',
	'ico':'image/x-ico',
	'txt':'text/plain',
	'gif':'image/gif'
};

module.exports = mimes;


text:
package com.example.just.asynctaskapplication.ui;

import android.os.Handler;
import android.os.Looper;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class MyAsyncTask {

    private static final int MAX_THREADS = 4;
    private final ExecutorService executorService;
    private final Handler handler;

    public MyAsyncTask() {
        this.executorService = Executors.newFixedThreadPool(MAX_THREADS);
        this.handler = new Handler(Looper.getMainLooper());
    }

    public <Params, Progress, Result> void execute(final ITask<Params, Progress, Result> task, final Params params, final IProgressCallback<Progress> progressCallback, final IResultCallback<Result> resultCallback) {
        executorService.execute(new Runnable() {

            @Override
            public void run() {
                try {
                    final Result result = task.doInBackground(params, new IProgressCallback<Progress>() {

                        @Override
                        public void onProgressUpdate(final Progress progress) {
                            handler.post(new Runnable() {

                                @Override
                                public void run() {
                                    progressCallback.onProgressUpdate(progress);
                                }
                            });
                        }
                    });
                    handler.post(new Runnable() {

                        @Override
                        public void run() {
                            resultCallback.onSuccess(result);
                        }
                    });
                } catch (final Exception e) {
                    handler.post(new Runnable() {

                        @Override
                        public void run() {
                            resultCallback.onError(e);
                        }
                    });
                }
            }
        });
    }
}


text:
require_relative 'base'
require 'pj'
require 'active_support/core_ext/kernel/reporting'

module RoCmd
  class Rails < Base
    usg :rst_sv

    def rst_sv(*args, &blk)
      _, opts = args.clone.ro_opts
      port = opts[:port] || 3000
      kill_port port

      pid_file = Pj.cur_tmp("pids/sv.pid")
      RoFile.rm pid_file

      new_args = ["sv", format_opts(*args, &blk)].flatten
      load_bin_rails(*new_args)
    end

    def format_opts(*args, &blk)
      args, opts = args.ro_opts
      new_options = opts.map do |k, v|
        ["--#{k}", "#{v}"]
      end.flatten
      [args, new_options]
    end

    usg :migrate

    def migrate(*args, &blk)
      rake "db:migrate", "--trace"
      #@deprecated it will occur hang
      # rake "test:prepare --trace"
    end

    def new_migration(cmd)
      if ro_opts[:force]
        zeus "g migration #{cmd} --force"
      else
        zeus "g migration #{cmd}"
      end

      if block_given?
        yield
      end

      migrate
    end

    def type(type_sc)
      type_map[:"#{type_sc}"] ||= type_sc
    end

    def add_to_tab(tab, column_name, type)
      new_migration("add_#{column_name}_to_#{tab} #{column_name}:#{type}")
    end

    def rm_from_tab(tab, column_name)
      new_migration("rm_#{column_name}_from_#{tab} #{column_name}")
    end

    def type_map
      @type_map ||= {
          s: 'string',
          t: 'text',
          i: "integer",
          dt: 'datetime'
      }
    end

    def handle_column_types(tab, opts, &blk)
      unless opts.have_val?
        raise RoErr::NoVal.new("opts", "please use column_name:column_type_sc or column_name:column_type when you change tab or col. i.e.`ro rails_generate add_column posts title:s`")
      end

      opts.each do |column_sym, type_sc|
        type = type(type_sc)
        column_name = column_sym.to_s
        yield tab, column_name, type
      end
    end

    usg :change_col

    def change_col(tab, *columns)
      ms_tab_given(tab) do
        args, opts = columns.ro_opts

        handle_column_types(tab, opts) do |tab, column_name, type|

          migrate_name = "change_column_#{column_name}_from_#{tab}"

          new_migration(migrate_name) do
            file = find_latest_migration(match: migrate_name)

            ctn = "change_column :#{tab}, :#{column_name}, :#{type}"
            ::RoFile.append(file, ctn, below: %r{def\schange})
          end
        end
      end
    end

    def find_latest_migration(*args, &blk)
      args, opts = args.ro_opts(*args, &blk)

      fs = Pj.cur_db("migrate/**").sort_by do |f|
        ::RoFile.new(f).mtime
      end

      if opts[:match]
        fs = fs.select do |f|
          f.match(%r{#{opts[:match]}})
        end
      end

      fs.last
    end

    def cnn(*args, &blk)
      ActiveRecord::Base.connection
    end

    def ms_tab_given(tab, *args, &blk)

      tab = tab.to_s
      tab_name = tab
      unless cnn.table_exists?(tab_name)
        raise RoErr::NotFound.new("Could not find tab #{tab}")
      end

      if block_given?
        yield
      end
    end

    usg :drop_tab

    def drop_tab(*tabs)
      tabs.each do |table|
        Out.status("dropping", "#{table}")

        zeus "g migration drop_table_#{table}"
      end
    end

    def rails(*args, &blk)
      # ro_rails = init_ro_rails
      unrequire_rails_cmds
      args.flatten!
      reset_argv(*args, &blk)

      begin
        load Pj.cur_bin("rails")
      rescue Exception => e
        unless e.is_a?(SystemExit)
          raise e
        end
      end
      # r, w = IO.pipe
      # pid = fork do
      #   $stdout.reopen(w)
      #   begin
      #     load Pj.cur_bin("rails")
      #   rescue Exception => e
      #     e
      #   end
      # end
      #
      # ::Process.wait2 pid
      # w.close
      # out = r.read
      # puts out
    end

    def load_bin_rails(*given_args, &blk)
      silence_warnings do
        # Sets $VERBOSE to +true+ for the duration of the block and back to its
        # original value afterwards.
        rails(*given_args, &blk)
      end
    end

    def unrequire_rails_cmds(*args, &blk)
      $LOADED_FEATURES.dup.grep(%r{rails/cmd}) do |loaded_file|
        if loaded_file.match(%r{rails/cmd/commands_tasks})
          next
        else
          $LOADED_FEATURES.delete_if do |e|
            e == loaded_file
          end
        end
      end
    end

    def ii_ro_rails
      ro_rails = lambda do
        if ENV['ro_stage'] == 'test'
          RoRspec.rt("bin/ro_rails")
        else
          Pj.cur_bin("ro_rails")
        end
      end.call

      unless File.exist? ro_rails
        ctn = <<-CONTENT

#!/usr/bin/env ruby
APP_PATH = File.expand_path('../../conf/application', __FILE__)
require_relative '../conf/boot'

load 'rails/cmd.rb'

        CONTENT
        RoFile.write(ro_rails, ctn)
      end
      ro_rails
    end

    usg :rm_col

    def rm_col(tab, *cols)
      ms_tab_given(tab) do
        cols.each do |col|
          Out.status("rm", "#{col} from #{tab}")
          rm_from_tab(tab, col)
        end
      end
    end

    usg :add_col

    def add_col(tab, *args, &blk)
      ms_tab_given(tab) do
        args, opts = args.ro_opts

        handle_column_types(tab, opts) do |tab, column_name, type|
          Out.status("adding", "#{column_name} to #{tab}")

          add_to_tab(tab, column_name, type)
        end
      end
    end

    usg :controller

    def controller(*args, &blk)
      keep_old_routes do
        args.flatten!
        args, opts = args.ro_opts

        name = args.shift
        meths = args
        attrs = attrs(opts)

        if ctrlr_exist?(name)
          Out.out "#{Pj.cur_app("controllers", "#{name}_controller.rb")} is exist"
        else
          zeus "g controller #{name} #{meths.join(" ")} #{attrs.join(" ")}"
        end
        idea "app/controllers/#{name}_controller.rb"
        RoFile.rm_dir("spec/helpers")
      end
    end

    def ctrlr_exist?(name, *args, &blk)
      File.exist?(Pj.cur_app("controllers", "#{name}_controller.rb"))
    end

    def attrs(opts, *args, &blk)
      opts.map do |k, v|
        "#{k.to_s}:#{type(v)}"
      end
    end

    usg :model

    def model(name, *args, &blk)
      keep_old_routes do
        args, opts = args.ro_opts

        attrs = attrs(opts)

        Out.status("generating", "model #{name}")

        if ro_opts[:force]
          zeus "g model #{name} #{attrs.join(" ")} -f"
        else
          zeus "g model #{name} #{attrs.join(" ")}"
        end

        migrate
      end
    end

    # rails add routes is very stupid, so manually add route by self is better

    def keep_old_routes(*args, &blk)
      routes_file = Pj.cur_rt("conf/routes.rb")
      old_routes_ctn = RoFile.read routes_file
      yield
      RoFile.write(routes_file, old_routes_ctn)
    end

    usg :destroy_model

    def destroy_model(*args, &blk)
      adp = args.dup
      destroy_generator("model", *args, &blk)
      name = adp.shift
      tab_name = name.to_s.suffix("s")
      if cnn.table_exists? :"#{tab_name}"
        cnn.drop_tab :"#{tab_name}"
      end
    end

    def cnn(*args, &blk)
      ActiveRecord::Base.connection
    end

    usg :destroy_generator

    def destroy_generator(generator, kw)
      cur_pj("app/#{generator}s") do |file|
        basename = File.basename(file).gsub(%r{\.\w+$}, "")
        result = basename.gsub(%r{_controller}, "")

        if result == kw
          Out.status("destroying", "#{generator} #{result}")

          zeus "d", generator, result
        end
      end
    end

    usg :destroy_migrations

    def destroy_migrations(*kws)
      Pj.cur_rt('db/migrate/**').each do |file|
        if file.match(%r{#{kws.join('.*')}})
          ::RoFile.rm_file file
        end
      end
    end

    usg :dm

    def dm(*args, &blk)
      destory_migrations(*args, &blk)
    end

    usg :add_idx

    def add_idx(tab, col)
      args, opts = args.ro_opts

      new_migration "add_index_with_#{col}_to_#{tab}" do
        change_latest_migration("add_index :#{tab}, :#{col}")
      end
    end

    def zeus(*args, &blk)
      if zeus_is_running?
        args = ['zeus', args].flatten
        sh(args.join(" "))
      else
        args = args.map do |e|
          e.split(" ")
        end
        rails(*args, &blk)
      end
    end

    usg :rm_idx

    def rm_idx(tab, col)
      opts.each do |col_sym, type_sc|
        col, type = col_type(col_sym, type_sc)
        zeus "g rm_index_with_#{col}_from_#{tab}"

        change_latest_migration("rm_index :#{tab}, :#{col}")
      end
    end

    def change_latest_migration(smth)
      migration = latest_migration
      gsub_file migration, %r{def\schange}, "def change\n#{smth}"
    end

    def latest_migration
      Dir[File.join(Dir.pwd, 'db/migrate/**')].sort_by do |file|
        test(?M, file)
      end.last
    end
  end
end


text:
require 'atpay/payment'
module ATPAY
  class << self
   attr_accessor :username
   attr_accessor :password
   attr_accessor :host
  end
  def self.configure(&block)
    yield(self)
  end
end


text:
/**
 * Created by Mihail on 4/23/2017.
 */
import React, { Component } from 'react'

import Header from '../components/common/Header'

class App extends Component {

  render() {
    return (
      <div className="container-fluid text-center">
        <Header />
        {this.props.children}
      </div>
    )
  }
}

export default App


text:
<?php

/**
 * Pre-requisites:
 *
 * Prior to running this script, you must setup the following environment variables:
 * - RAX_USERNAME: Your Rackspace Cloud Account Username, and
 * - RAX_API_KEY:  Your Rackspace Cloud Account API Key
 *
 * - There exists a server named 'my_server' and you know its ID. Run
 * create_server.php if you need to create one first.
 * - There exists a volume name 'my_volume' and you know its ID. Run
 * create_volume.php if you need to create one first.
 */

require __DIR__ . '/../../vendor/autoload.php';

use OpenCloud\Rackspace;

// 1. Instantiate a Rackspace client.
$client = new Rackspace(Rackspace::US_IDENTITY_ENDPOINT, array(
    'username' => getenv('RAX_USERNAME'),
    'apiKey'   => getenv('RAX_API_KEY')
));

// 2. Crete Compute and Volume service objects
$region = 'ORD';

$volumeService  = $client->volumeService(null, $region);
$computeService = $client->computeService(null, $region);

// 3. Get your volume
$volumeId = '{volumeId}';
$myVolume = $volumeService->volume($volumeId);

// 4. Get your server
$serverId = '{serverId}';
$myServer = $computeService->server($serverId);

// 5. Attach

// Specifying null will auto-assign the block. You also can be specific - '/dev/xvdb'
$mountPoint = null;
$myServer->attachVolume($myVolume, $mountPoint);


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
    Copyright 2010 Google Inc.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

         http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <include layout="@layout/colorstrip"/>

    <LinearLayout style="@style/TitleBar">
        <ImageButton style="@style/TitleBarAction"
            android:contentDescription="@string/description_home"
            android:src="@drawable/ic_title_home"
            android:onClick="onHomeClick" />

        <ImageView style="@style/TitleBarSeparator" />
        <TextView style="@style/TitleBarText" />

        <ImageView style="@style/TitleBarSeparator" />
        <ImageButton style="@style/TitleBarAction"
            android:contentDescription="@string/description_search"
            android:src="@drawable/ic_title_search"
            android:onClick="onSearchClick" />
    </LinearLayout>

    <view
        class="com.underhilllabs.dccsched.ui.ScheduleActivity$FlingableTabHost"
        android:id="@android:id/tabhost"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_marginTop="5dip">
        <LinearLayout
            android:orientation="vertical"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">
            <TabWidget
                android:id="@android:id/tabs"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:background="@null"
                android:layout_marginLeft="-2dp"
                android:layout_marginRight="-2dp" />
            <FrameLayout
                android:id="@android:id/tabcontent"
                android:layout_width="fill_parent"
                android:layout_height="0dip"
                android:layout_weight="1">
            </FrameLayout>
        </LinearLayout>
    </view>

</LinearLayout>


text:
async function refreshTextInput(elementId, dataUri) {
  try {
    const element = await refreshString(elementId, 'value', dataUri);
    element.disabled = false;
  } catch {
  }
}


text:
export * from './id';
export * from './color-sets';
export * from './sort';
export * from './throttle';
export * from './color-utils';
export * from './visibility-observer';
export * from './types';
//# sourceMappingURL=index.js.map


text:
package org.simpledrive.activities;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.TextView;

import org.simpledrive.R;

public class PasswordScreen extends AppCompatActivity {
    // General
    private boolean repeat = false;
    private int step = 0;
    private String firstPassphrase = "";
    private String label = "passphrase";
    private String title = "Unlock";

    // Interface
    private TextView passphrase;
    private TextView error;
    private TextView tvTitle;
    private Button confirm;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_passwordscreen);

        passphrase = (TextView) findViewById(R.id.passphrase);
        error = (TextView) findViewById(R.id.error);
        tvTitle = (TextView) findViewById(R.id.title);
        confirm = (Button) findViewById(R.id.confirm);

        Bundle extras = getIntent().getExtras();
        if (extras != null) {
            showError(extras.getString("error", ""));
            repeat = extras.getBoolean("repeat", false);
            label = extras.getString("label", "passphrase");
            title = extras.getString("title", "Unlock");
        }

        updateDisplay();
    }

    private void showError(String e) {
        error.setText(e);
    }

    private void updateDisplay() {
        tvTitle.setText(title);
        if (repeat) {
            String t = (step == 0) ? "Set" : "Repeat";
            passphrase.setHint(t + " " + label);
            confirm.setText(t);
        }
        else {
            passphrase.setHint("Enter " + label);
            confirm.setText(R.string.unlock);
        }
        passphrase.setText("");
    }

    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.confirm:
                // Repeat required
                if (repeat && step == 0) {
                    firstPassphrase = passphrase.getText().toString();
                    step++;
                    updateDisplay();
                }
                // Passphrases don't match
                else if (repeat && step == 1 &&
                        !passphrase.getText().toString().equals(firstPassphrase))
                {
                    showError("Passphrases don't match");
                    firstPassphrase = "";
                    step = 0;
                    updateDisplay();
                }
                // Return passphrase
                else {
                    Intent i = new Intent();
                    i.putExtra("passphrase", passphrase.getText().toString());
                    setResult(RESULT_OK, i);
                    finish();
                }
                break;
        }
    }
}


text:
from __future__ import print_function
from w3lib.url import is_url
from pyrake.command import pyrakeCommand
from pyrake.http import Request
from pyrake.item import BaseItem
from pyrake.utils import display
from pyrake.utils.conf import arglist_to_dict
from pyrake.utils.spider import iterate_spider_output, create_spider_for_request
from pyrake.exceptions import UsageError
from pyrake import log

class Command(pyrakeCommand):

    requires_project = True

    spider = None
    items = {}
    requests = {}

    first_response = None

    def syntax(self):
        return "[options] <url>"

    def short_desc(self):
        return "Parse URL (using its spider) and print the results"

    def add_options(self, parser):
        pyrakeCommand.add_options(self, parser)
        parser.add_option("--spider", dest="spider", default=None, \
            help="use this spider without looking for one")
        parser.add_option("-a", dest="spargs", action="append", default=[], metavar="NAME=VALUE", \
            help="set spider argument (may be repeated)")
        parser.add_option("--pipelines", action="store_true", \
            help="process items through pipelines")
        parser.add_option("--nolinks", dest="nolinks", action="store_true", \
            help="don't show links to follow (extracted requests)")
        parser.add_option("--noitems", dest="noitems", action="store_true", \
            help="don't show scraped items")
        parser.add_option("--nocolour", dest="nocolour", action="store_true", \
            help="avoid using pygments to colorize the output")
        parser.add_option("-r", "--rules", dest="rules", action="store_true", \
            help="use CrawlSpider rules to discover the callback")
        parser.add_option("-c", "--callback", dest="callback", \
            help="use this callback for parsing, instead looking for a callback")
        parser.add_option("-d", "--depth", dest="depth", type="int", default=1, \
            help="maximum depth for parsing requests [default: %default]")
        parser.add_option("-v", "--verbose", dest="verbose", action="store_true", \
            help="print each depth level one by one")

    @property
    def max_level(self):
        levels = self.items.keys() + self.requests.keys()
        if levels: return max(levels)
        else: return 0

    def add_items(self, lvl, new_items):
        old_items = self.items.get(lvl, [])
        self.items[lvl] = old_items + new_items

    def add_requests(self, lvl, new_reqs):
        old_reqs = self.requests.get(lvl, [])
        self.requests[lvl] = old_reqs + new_reqs

    def print_items(self, lvl=None, colour=True):
        if lvl is None:
            items = [item for lst in self.items.values() for item in lst]
        else:
            items = self.items.get(lvl, [])

        print("# Scraped Items ", "-"*60)
        display.pprint([dict(x) for x in items], colorize=colour)

    def print_requests(self, lvl=None, colour=True):
        if lvl is None:
            levels = self.requests.keys()
            if levels:
                requests = self.requests[max(levels)]
            else:
                requests = []
        else:
            requests = self.requests.get(lvl, [])

        print("# Requests ", "-"*65)
        display.pprint(requests, colorize=colour)

    def print_results(self, opts):
        colour = not opts.nocolour

        if opts.verbose:
            for level in xrange(1, self.max_level+1):
                print('\n>>> DEPTH LEVEL: %s <<<' % level)
                if not opts.noitems:
                    self.print_items(level, colour)
                if not opts.nolinks:
                    self.print_requests(level, colour)
        else:
            print('\n>>> STATUS DEPTH LEVEL %s <<<' % self.max_level)
            if not opts.noitems:
                self.print_items(colour=colour)
            if not opts.nolinks:
                self.print_requests(colour=colour)

    def run_callback(self, response, cb):
        items, requests = [], []

        for x in iterate_spider_output(cb(response)):
            if isinstance(x, BaseItem):
                items.append(x)
            elif isinstance(x, Request):
                requests.append(x)
        return items, requests

    def get_callback_from_rules(self, response):
        if getattr(self.spider, 'rules', None):
            for rule in self.spider.rules:
                if rule.link_extractor.matches(response.url) and rule.callback:
                    return rule.callback
        else:
            log.msg(format='No CrawlSpider rules found in spider %(spider)r, '
                           'please specify a callback to use for parsing',
                    level=log.ERROR, spider=self.spider.name)

    def set_spider(self, url, opts):
        if opts.spider:
            try:
                self.spider = self.pcrawler.spiders.create(opts.spider, **opts.spargs)
            except KeyError:
                log.msg(format='Unable to find spider: %(spider)s',
                        level=log.ERROR, spider=opts.spider)
        else:
            self.spider = create_spider_for_request(self.pcrawler.spiders, Request(url), **opts.spargs)
            if not self.spider:
                log.msg(format='Unable to find spider for: %(url)s',
                        level=log.ERROR, url=url)

    def start_parsing(self, url, opts):
        request = Request(url, opts.callback)
        request = self.prepare_request(request, opts)

        self.pcrawler.crawl(self.spider, [request])
        self.crawler_process.start()

        if not self.first_response:
            log.msg(format='No response downloaded for: %(request)s',
                    level=log.ERROR, request=request)

    def prepare_request(self, request, opts):
        def callback(response):
            # memorize first request
            if not self.first_response:
                self.first_response = response

            # determine real callback
            cb = response.meta['_callback']
            if not cb:
                if opts.rules and self.first_response == response:
                    cb = self.get_callback_from_rules(response)
                else:
                    cb = 'parse'

            if not callable(cb):
                cb_method = getattr(self.spider, cb, None)
                if callable(cb_method):
                    cb = cb_method
                else:
                    log.msg(format='Cannot find callback %(callback)r in spider: %(spider)s',
                            callback=callback, spider=self.spider.name, level=log.ERROR)
                    return

            # parse items and requests
            depth = response.meta['_depth']

            items, requests = self.run_callback(response, cb)
            if opts.pipelines:
                itemproc = self.pcrawler.engine.scraper.itemproc
                for item in items:
                    itemproc.process_item(item, self.spider)
            self.add_items(depth, items)
            self.add_requests(depth, requests)

            if depth < opts.depth:
                for req in requests:
                    req.meta['_depth'] = depth + 1
                    req.meta['_callback'] = req.callback
                    req.callback = callback
                return requests

        request.meta['_depth'] = 1
        request.meta['_callback'] = request.callback
        request.callback = callback
        return request

    def process_options(self, args, opts):
        pyrakeCommand.process_options(self, args, opts)
        try:
            opts.spargs = arglist_to_dict(opts.spargs)
        except ValueError:
            raise UsageError("Invalid -a value, use -a NAME=VALUE", print_help=False)

    def run(self, args, opts):
        # parse arguments
        if not len(args) == 1 or not is_url(args[0]):
            raise UsageError()
        else:
            url = args[0]

        # prepare spider
        self.pcrawler = self.crawler_process.create_crawler()
        self.set_spider(url, opts)

        if self.spider and opts.depth > 0:
            self.start_parsing(url, opts)
            self.print_results(opts)


text:
About
=====
This is simple php5.3 route lib.

[![Build Status](https://api.travis-ci.org/mitallast/php-http-router.png)](https://travis-ci.org/mitallast/php-http-router)

Example of use
===============

You cat manually configure router by adding route rule objects:

```php
<?php
$router = new Http\Router;
$router->addRoute(new Http\RouteRule("<c:\w+>/?", "<c>/index")); // [<pattern>, <route>]
$router->addRoute(new Http\RouteRule("product/<product_id:\d+>", "product/show"));
```
or use simple array config

```php
<?php
$router = Http\Router::fromArray(array(
    // [ <pattern string> , <route string>]
    array("<c:\w+>/?", "<c>/index"),
    array("product/<product_id:\d+>", "product/show"),
));
```

Example of found route for url:

```php
<?php
echo $router->matchUrl("shop"); # puts "shop/index"
echo $router->matchUrl("shop/about"); # puts "shop/about"
echo $router->matchUrl("product/1234"), $_GET['product_id'] # puts "product/show", 1234
```

Example of generate url:

```php
<?php
echo $router->createUrl("shop/index"); # puts "/shop"
echo $router->createUrl("shop/about"); # puts "/shop/about"
echo $router->createUrl("product/show",array("product_id"=>1234)); # puts "/product/1234"
```

Benchmark tests:
Initialize  25000 rules at 1.066055 sec, per 1 rule 0.00004264220237731934 sec
Serialize   25000 rules at 0.142269 sec, per 1 rule 0.00000569076538085938 sec
Unserialize 25000 rules at 0.524110 sec, per 1 rule 0.00002096440315246582 sec
Create      60000 urls  at 1.118229 sec, per 1 call 0.00001863714853922526 sec
Found       60000 urls  at 1.036814 sec, per 1 call 0.00001728023290634155 sec

As variant, you can use serialization and caching for speedup your application, or
use features like xchache API for save in persistent storage without serialization.


text:
package com.typesafe.sbt
package packager
package debian

import sbt._
import linux.LinuxPackageMapping

/** DEB packaging specifc build targets. */
trait DebianKeys {
  // Metadata keys
  val debianSection = SettingKey[String]("debian-section", "The section category for this deb file.")
  val debianPriority = SettingKey[String]("debian-priority")
  val debianPackageConflicts =
    SettingKey[Seq[String]]("debian-package-conflicts", "Packages that conflict with the currently packaged one.")
  val debianPackageDependencies =
    SettingKey[Seq[String]]("debian-package-dependencies", "Packages that this debian package depends on.")
  val debianPackageProvides =
    SettingKey[Seq[String]]("debian-package-provides", "Packages that are provided by the currently packaged one.")
  val debianPackageRecommends = SettingKey[Seq[String]](
    "debian-package-recommends",
    "Packages recommended to use with the currently packaged one."
  )
  val debianPackageInfo =
    SettingKey[PackageInfo]("debian-package-info", "Information (name, version, etc.) about a debian package.")
  val debianPackageMetadata =
    SettingKey[PackageMetaData]("debian-package-metadata", "Meta data used when constructing a debian package.")
  val debianChangelog = SettingKey[Option[File]]("debian-changelog", "The changelog for this deb file")
  // Package building

  val debianControlFile = TaskKey[File]("debian-control-file", "Makes the debian package control file.")

  @deprecated("Use generic maintainerScript task instead", "1.0.3")
  val debianMaintainerScripts =
    TaskKey[Seq[(File, String)]]("debian-maintainer-scripts", "Makes the debian maintainer scripts.")
  val debianConffilesFile = TaskKey[File]("debian-conffiles-file", "Makes the debian package conffiles file.")
  val debianUpstartFile = TaskKey[File]("debian-upstart-file", "Makes the upstart file for this debian package.")
  val debianLinksfile =
    TaskKey[File]("debian-links-file", "Makes the debian package links file.")
  val debianMD5sumsFile = TaskKey[File]("debian-md5sums-file", "Makes the debian package md5sums file.")
  val debianZippedMappings =
    TaskKey[Seq[LinuxPackageMapping]]("debian-zipped-mappings", "Files that need to be gzipped when they hit debian.")
  val debianCombinedMappings =
    TaskKey[Seq[LinuxPackageMapping]]("debian-combined-mappings", "All the mappings of files for the final package.")
  val debianExplodedPackage = TaskKey[File]("debian-exploded-package", "makes an exploded debian package")
  val lintian = TaskKey[Unit]("lintian", "runs the debian lintian tool on the current package.")
  val debianSign = TaskKey[File]("debian-sign", "runs the dpkg-sig command to sign the generated deb file.")
  val debianSignRole =
    SettingKey[String]("debian-sign-role", "The role to use when signing a debian file (defaults to 'builder').")
  val genChanges = TaskKey[File]("gen-changes", "runs the dpkg-genchanges command to generate the .changes file.")

  // Debian control scripts
  val debianControlScriptsDirectory = SettingKey[File](
    "debian-control-scripts-directory",
    "Directory where all debian control scripts reside. Default is 'src/debian/DEBIAN'"
  )
  @deprecated("Use generic maintainerScript task instead", "1.0.3")
  val debianMakePreinstScript =
    TaskKey[Option[File]]("makePreinstScript", "Creates or discovers the preinst script used by this project")
  @deprecated("Use generic maintainerScript task instead", "1.0.3")
  val debianMakePrermScript =
    TaskKey[Option[File]]("makePrermScript", "Creates or discovers the prerm script used by this project")
  @deprecated("Use generic maintainerScript task instead", "1.0.3")
  val debianMakePostinstScript =
    TaskKey[Option[File]]("makePostInstScript", "Creates or discovers the postinst script used by this project")
  @deprecated("Use generic maintainerScript task instead", "1.0.3")
  val debianMakePostrmScript =
    TaskKey[Option[File]]("makePostrmScript", "Creates or discovers the postrm script used by this project")
  val debianMakeChownReplacements = TaskKey[(String, String)](
    "debianMakeChownReplacements",
    "Creates the chown commands for correct own files and directories"
  )

  val debianPackageInstallSize = TaskKey[Long]("debian-installed-size")

  val debianNativeBuildOptions =
    SettingKey[Seq[String]]("debian-native-build-options", "Options passed to dpkg-deb, e.g. compression level")
}


text:
$ = require("atom").$
Backbone = require("backbone")
Backbone.$ = $
_ = require("underscore")
joint = require("jointjs")
V = require("./vectorizer")
g = require("./geometry")

module.exports = joint.dia.Paper = Backbone.View.extend({

    options: {

        width: 800,
        height: 600,
        gridSize: 50,
        perpendicularLinks: false,
        elementView: joint.dia.ElementView,
        linkView: joint.dia.LinkView,
        snapLinks: false, // false, true, { radius: value }

        // Defines what link model is added to the graph after an user clicks on an active magnet.
        // Value could be the Backbone.model or a function returning the Backbone.model
        // defaultLink: function(elementView, magnet) { return condition ? new customLink1() : new customLink2() }
        defaultLink: new joint.dia.Link,

        // Check whether to add a new link to the graph when user clicks on an a magnet.
        validateMagnet: function(cellView, magnet) {
            return magnet.getAttribute('magnet') !== 'passive';
        },

        // Check whether to allow or disallow the link connection while an arrowhead end (source/target)
        // being changed.
        validateConnection: function(cellViewS, magnetS, cellViewT, magnetT, end, linkView) {
            return (end === 'target' ? cellViewT : cellViewS) instanceof joint.dia.ElementView;
        }
    },

    events: {

        'mousedown': 'pointerdown',
        'dblclick': 'mousedblclick',
        'click': 'mouseclick',
        'touchstart': 'pointerdown',
        'mousemove': 'pointermove',
        'touchmove': 'pointermove'
    },

    initialize: function() {

        _.bindAll(this, 'addCell', 'sortCells', 'resetCells', 'pointerup');

        this.svg = V('svg').node;
        this.viewport = V('g').node;

        // Append `<defs>` element to the SVG document. This is useful for filters and gradients.
        V(this.svg).append(V('defs').node);

        V(this.viewport).attr({ 'class': 'viewport' });

        V(this.svg).append(this.viewport);

        this.$el.append(this.svg);

        this.setDimensions();

	this.listenTo(this.model, 'add', this.addCell);
	this.listenTo(this.model, 'reset', this.resetCells);
	this.listenTo(this.model, 'sort', this.sortCells);

	$(document).on('mouseup touchend', this.pointerup);

        // Hold the value when mouse has been moved: when mouse moved, no click event will be triggered.
        this._mousemoved = false;
    },

    remove: function() {

	$(document).off('mouseup touchend', this.pointerup);

	Backbone.View.prototype.remove.call(this);
    },

    setDimensions: function(width, height) {

        if (width) this.options.width = width;
        if (height) this.options.height = height;

        V(this.svg).attr('width', this.options.width);
        V(this.svg).attr('height', this.options.height);

	this.trigger('resize');
    },

    // Expand/shrink the paper to fit the content. Snap the width/height to the grid
    // defined in `gridWidth`, `gridHeight`. `padding` adds to the resulting width/height of the paper.
    fitToContent: function(gridWidth, gridHeight, padding) {

	gridWidth = gridWidth || 1;
	gridHeight = gridHeight || 1;
        padding = padding || 0;

	// Calculate the paper size to accomodate all the graph's elements.
	var bbox = V(this.viewport).bbox(true, this.svg);

	var calcWidth = Math.ceil((bbox.width + bbox.x) / gridWidth) * gridWidth;
	var calcHeight = Math.ceil((bbox.height + bbox.y) / gridHeight) * gridHeight;

        calcWidth += padding;
        calcHeight += padding;

	// Change the dimensions only if there is a size discrepency
	if (calcWidth != this.options.width || calcHeight != this.options.height) {
	    this.setDimensions(calcWidth || this.options.width , calcHeight || this.options.height);
	}
    },

    getContentBBox: function() {

        var crect = this.viewport.getBoundingClientRect();

        // Using Screen CTM was the only way to get the real viewport bounding box working in both
        // Google Chrome and Firefox.
        var ctm = this.viewport.getScreenCTM();

        var bbox = g.rect(Math.abs(crect.left - ctm.e), Math.abs(crect.top - ctm.f), crect.width, crect.height);

        return bbox;
    },

    createViewForModel: function(cell) {

        var view;

        var type = cell.get('type');
        var module = type.split('.')[0];
        var entity = type.split('.')[1];

        // If there is a special view defined for this model, use that one instead of the default `elementView`/`linkView`.
        if (joint.shapes[module] && joint.shapes[module][entity + 'View']) {

            view = new joint.shapes[module][entity + 'View']({ model: cell, interactive: this.options.interactive });

        } else if (cell instanceof joint.dia.Element) {

            view = new this.options.elementView({ model: cell, interactive: this.options.interactive });

        } else {

            view = new this.options.linkView({ model: cell, interactive: this.options.interactive });
        }

        return view;
    },

    addCell: function(cell) {

        var view = this.createViewForModel(cell);

        V(this.viewport).append(view.el);
        view.paper = this;
        view.render();

        // This is the only way to prevent image dragging in Firefox that works.
        // Setting -moz-user-select: none, draggable="false" attribute or user-drag: none didn't help.
        $(view.el).find('image').on('dragstart', function() { return false; });
    },

    resetCells: function(cellsCollection) {

        $(this.viewport).empty();

        var cells = cellsCollection.models.slice();

        // Make sure links are always added AFTER elements.
        // They wouldn't find their sources/targets in the DOM otherwise.
        cells.sort(function(a, b) { return a instanceof joint.dia.Link ? 1 : -1; });

        _.each(cells, this.addCell, this);

        // Sort the cells in the DOM manually as we might have changed the order they
        // were added to the DOM (see above).
        this.sortCells();
    },

    sortCells: function() {

        // Run insertion sort algorithm in order to efficiently sort DOM elements according to their
        // associated model `z` attribute.

        var $cells = $(this.viewport).children('[model-id]');
        var cells = this.model.get('cells');

        this.sortElements($cells, function(a, b) {

            var cellA = cells.get($(a).attr('model-id'));
            var cellB = cells.get($(b).attr('model-id'));

            return (cellA.get('z') || 0) > (cellB.get('z') || 0) ? 1 : -1;
        });
    },

    // Highly inspired by the jquery.sortElements plugin by Padolsey.
    // See http://james.padolsey.com/javascript/sorting-elements-with-jquery/.
    sortElements: function(elements, comparator) {

        var $elements = $(elements);

        var placements = $elements.map(function() {

            var sortElement = this;
            var parentNode = sortElement.parentNode;

            // Since the element itself will change position, we have
            // to have some way of storing it's original position in
            // the DOM. The easiest way is to have a 'flag' node:
            var nextSibling = parentNode.insertBefore(
                document.createTextNode(''),
                sortElement.nextSibling
            );

            return function() {

                if (parentNode === this) {
                    throw new Error(
                        "You can't sort elements if any one is a descendant of another."
                    );
                }

                // Insert before flag:
                parentNode.insertBefore(this, nextSibling);
                // Remove flag:
                parentNode.removeChild(nextSibling);

            };
        });

        return Array.prototype.sort.call($elements, comparator).each(function(i) {
            placements[i].call(this);
        });
    },

    scale: function(sx, sy, ox, oy) {

        if (!ox) {

            ox = 0;
            oy = 0;
        }

        // Remove previous transform so that the new scale is not affected by previous scales, especially
        // the old translate() does not affect the new translate if an origin is specified.
        V(this.viewport).attr('transform', '');

        // TODO: V.scale() doesn't support setting scale origin. #Fix
        if (ox || oy) {
            V(this.viewport).translate(-ox * (sx - 1), -oy * (sy - 1));
        }

        V(this.viewport).scale(sx, sy);

	this.trigger('scale', ox, oy);

        return this;
    },

    rotate: function(deg, ox, oy) {

        // If the origin is not set explicitely, rotate around the center. Note that
        // we must use the plain bounding box (`this.el.getBBox()` instead of the one that gives us
        // the real bounding box (`bbox()`) including transformations).
        if (_.isUndefined(ox)) {

            var bbox = this.viewport.getBBox();
            ox = bbox.width/2;
            oy = bbox.height/2;
        }

        V(this.viewport).rotate(deg, ox, oy);
    },

    // Find the first view climbing up the DOM tree starting at element `el`. Note that `el` can also
    // be a selector or a jQuery object.
    findView: function(el) {

        var $el = this.$(el);

        if ($el.length === 0 || $el[0] === this.el) {

            return undefined;
        }

        if ($el.data('view')) {

            return $el.data('view');
        }

        return this.findView($el.parent());
    },

    // Find a view for a model `cell`. `cell` can also be a string representing a model `id`.
    findViewByModel: function(cell) {

        var id = _.isString(cell) ? cell : cell.id;

        var $view = this.$('[model-id="' + id + '"]');
        if ($view.length) {

            return $view.data('view');
        }
        return undefined;
    },

    // Find all views at given point
    findViewsFromPoint: function(p) {

	p = g.point(p);

        var views = _.map(this.model.getElements(), this.findViewByModel);

	return _.filter(views, function(view) {
	    return g.rect(V(view.el).bbox(false, this.viewport)).containsPoint(p);
	}, this);
    },

    // Find all views in given area
    findViewsInArea: function(r) {

	r = g.rect(r);

        var views = _.map(this.model.getElements(), this.findViewByModel);

	return _.filter(views, function(view) {
	    return r.intersect(g.rect(V(view.el).bbox(false, this.viewport)));
	}, this);
    },

    getModelById: function(id) {

        return this.model.getCell(id);
    },

    snapToGrid: function(p) {

        // Convert global coordinates to the local ones of the `viewport`. Otherwise,
        // improper transformation would be applied when the viewport gets transformed (scaled/rotated).
        var localPoint = V(this.viewport).toLocalPoint(p.x, p.y);

        return {
            x: g.snapToGrid(localPoint.x, this.options.gridSize),
            y: g.snapToGrid(localPoint.y, this.options.gridSize)
        };
    },

    getDefaultLink: function(cellView, magnet) {

        return _.isFunction(this.options.defaultLink)
        // default link is a function producing link model
            ? this.options.defaultLink.call(this, cellView, magnet)
        // default link is the Backbone model
            : this.options.defaultLink.clone();
    },

    // Interaction.
    // ------------

    mousedblclick: function(evt) {

        evt.preventDefault();
        evt = joint.util.normalizeEvent(evt);

        var view = this.findView(evt.target);
        var localPoint = this.snapToGrid({ x: evt.clientX, y: evt.clientY });

        if (view) {

            view.pointerdblclick(evt, localPoint.x, localPoint.y);

        } else {

            this.trigger('blank:pointerdblclick', evt, localPoint.x, localPoint.y);
        }
    },

    mouseclick: function(evt) {

        // Trigger event when mouse not moved.
        if (!this._mousemoved) {

            evt.preventDefault();
            evt = joint.util.normalizeEvent(evt);

            var view = this.findView(evt.target);
            var localPoint = this.snapToGrid({ x: evt.clientX, y: evt.clientY });

            if (view) {

                view.pointerclick(evt, localPoint.x, localPoint.y);

            } else {

                this.trigger('blank:pointerclick', evt, localPoint.x, localPoint.y);
            }
        }

        this._mousemoved = false;
    },

    pointerdown: function(evt) {

        evt.preventDefault();
        evt = joint.util.normalizeEvent(evt);

        var view = this.findView(evt.target);

        var localPoint = this.snapToGrid({ x: evt.clientX, y: evt.clientY });

        if (view) {

            this.sourceView = view;

            view.pointerdown(evt, localPoint.x, localPoint.y);

        } else {

            this.trigger('blank:pointerdown', evt, localPoint.x, localPoint.y);
        }
    },

    pointermove: function(evt) {

        evt.preventDefault();
        evt = joint.util.normalizeEvent(evt);

        if (this.sourceView) {

            // Mouse moved.
            this._mousemoved = true;

            var localPoint = this.snapToGrid({ x: evt.clientX, y: evt.clientY });

            this.sourceView.pointermove(evt, localPoint.x, localPoint.y);
        }
    },

    pointerup: function(evt) {

        evt = joint.util.normalizeEvent(evt);

        var localPoint = this.snapToGrid({ x: evt.clientX, y: evt.clientY });

        if (this.sourceView) {

            this.sourceView.pointerup(evt, localPoint.x, localPoint.y);

            //"delete sourceView" occasionally throws an error in chrome (illegal access exception)
	    this.sourceView = null;

        } else {

            this.trigger('blank:pointerup', evt, localPoint.x, localPoint.y);
        }
    }
});


text:
// Generated from C:/Development/coherence-sql/src/main/resources\SqlGrammar.g4 by ANTLR 4.7
package pl.mwojciechowski.coherence.sql.antlr;
import org.antlr.v4.runtime.tree.AbstractParseTreeVisitor;

/**
 * This class provides an empty implementation of {@link SqlGrammarVisitor},
 * which can be extended to create a visitor which only needs to handle a subset
 * of the available methods.
 *
 * @param <T> The return type of the visit operation. Use {@link Void} for
 * operations with no return type.
 */
public class SqlGrammarBaseVisitor<T> extends AbstractParseTreeVisitor<T> implements SqlGrammarVisitor<T> {
    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitSqlClauses(SqlGrammarParser.SqlClausesContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitSqlClause(SqlGrammarParser.SqlClauseContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitDmlClause(SqlGrammarParser.DmlClauseContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitSelectStatement(SqlGrammarParser.SelectStatementContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitUnaryOperatorExpression(SqlGrammarParser.UnaryOperatorExpressionContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitPrimitiveExpression(SqlGrammarParser.PrimitiveExpressionContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitCaseExpression(SqlGrammarParser.CaseExpressionContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitFunctionCallExpression(SqlGrammarParser.FunctionCallExpressionContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitColumnRefExpression(SqlGrammarParser.ColumnRefExpressionContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitBracketExpression(SqlGrammarParser.BracketExpressionContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitSubqueryExpression(SqlGrammarParser.SubqueryExpressionContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitBinaryOperatorExpression(SqlGrammarParser.BinaryOperatorExpressionContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitConstantExpression(SqlGrammarParser.ConstantExpressionContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitSubquery(SqlGrammarParser.SubqueryContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitSearchCondition(SqlGrammarParser.SearchConditionContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitSearchConditionAnd(SqlGrammarParser.SearchConditionAndContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitSearchConditionNot(SqlGrammarParser.SearchConditionNotContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitPredicate(SqlGrammarParser.PredicateContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitQueryExpression(SqlGrammarParser.QueryExpressionContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitUnion(SqlGrammarParser.UnionContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitQuerySpecification(SqlGrammarParser.QuerySpecificationContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitOrderByClause(SqlGrammarParser.OrderByClauseContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitOrderByExpression(SqlGrammarParser.OrderByExpressionContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitGroupByItem(SqlGrammarParser.GroupByItemContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitOptionClause(SqlGrammarParser.OptionClauseContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitOption(SqlGrammarParser.OptionContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitSelectList(SqlGrammarParser.SelectListContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitSelectListElem(SqlGrammarParser.SelectListElemContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitTableSources(SqlGrammarParser.TableSourcesContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitTableSource(SqlGrammarParser.TableSourceContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitTableSourceItemJoined(SqlGrammarParser.TableSourceItemJoinedContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitTableSourceItem(SqlGrammarParser.TableSourceItemContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitChangeTable(SqlGrammarParser.ChangeTableContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitJoinPart(SqlGrammarParser.JoinPartContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitTableNameWithHint(SqlGrammarParser.TableNameWithHintContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitDerivedTable(SqlGrammarParser.DerivedTableContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitFunctionCall(SqlGrammarParser.FunctionCallContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitSwitchSection(SqlGrammarParser.SwitchSectionContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitSwitchSearchConditionSection(SqlGrammarParser.SwitchSearchConditionSectionContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitAsTableAlias(SqlGrammarParser.AsTableAliasContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitTableAlias(SqlGrammarParser.TableAliasContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitColumnAliasList(SqlGrammarParser.ColumnAliasListContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitColumnAlias(SqlGrammarParser.ColumnAliasContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitExpressionList(SqlGrammarParser.ExpressionListContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitAggregateWindowedFunction(SqlGrammarParser.AggregateWindowedFunctionContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitAllDistinctExpression(SqlGrammarParser.AllDistinctExpressionContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitTableName(SqlGrammarParser.TableNameContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitFuncProcName(SqlGrammarParser.FuncProcNameContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitFullColumnName(SqlGrammarParser.FullColumnNameContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitNullNotnull(SqlGrammarParser.NullNotnullContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitScalarFunctionName(SqlGrammarParser.ScalarFunctionNameContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitDataType(SqlGrammarParser.DataTypeContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitConstant(SqlGrammarParser.ConstantContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitSign(SqlGrammarParser.SignContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitComplexId(SqlGrammarParser.ComplexIdContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitId(SqlGrammarParser.IdContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitSimpleId(SqlGrammarParser.SimpleIdContext ctx) {
        return visitChildren(ctx);
    }

    /**
     * {@inheritDoc}
     *

     *
The default implementation returns the result of calling
     * {@link #visitChildren} on {@code ctx}.

     */
    @Override
    public T visitComparisonOperator(SqlGrammarParser.ComparisonOperatorContext ctx) {
        return visitChildren(ctx);
    }
}


text:
describe 'v1 jobs', auth_helpers: true, api_version: :v1, set_app: true do
  let(:user) { FactoryBot.create(:user) }
  let(:repo) { Repository.by_slug('svenfuchs/minimal').first }
  let(:job)  { repo.builds.first.matrix.first }
  let(:log)  { %({"job_id": #{job.id}, "content": "content"}) }

  let(:log_url) { "#{Travis.config[:logs_api][:url]}/logs/#{job.id}?by=job_id&source=api" }
  before { stub_request(:get, log_url).to_return(status: 200, body: log) }
  before { Job.update_all(state: :started) }

  # TODO
  # post '/jobs/:id/cancel'
  # post '/jobs/:id/restart'
  # patch '/jobs/:id/log'

  describe 'in public mode, with a private repo', mode: :public, repo: :private do
    describe 'GET /jobs' do
      it(:with_permission)    { should auth status: [200, 307], type: :json, empty: false }
      it(:without_permission) { should auth status: [200, 307], type: :json, empty: true }
      it(:invalid_token)      { should auth status: 403 }
      it(:unauthenticated)    { should auth status: 401 }
    end

    describe 'GET /jobs/%{job.id}' do
      it(:with_permission)    { should auth status: 200, type: :json, empty: false }
      it(:without_permission) { should auth status: 404 }
      it(:invalid_token)      { should auth status: 403 }
      it(:unauthenticated)    { should auth status: 401 }
    end

    describe 'GET /jobs/%{job.id}/log' do
      it(:with_permission)    { should auth status: [200, 307], type: :text, empty: false }
      it(:without_permission) { should auth status: 404 }
      it(:invalid_token)      { should auth status: 403 }
      it(:unauthenticated)    { should auth status: 401 }
    end
  end

  describe 'in public mode, with a public repo', mode: :public, repo: :public do
    describe 'GET /jobs' do
      it(:with_permission)    { should auth status: [200, 307], type: :json, empty: false }
      it(:without_permission) { should auth status: [200, 307], type: :json, empty: true  }
      it(:invalid_token)      { should auth status: 403 }
      it(:unauthenticated)    { should auth status: 401 }
    end

    describe 'GET /jobs/%{job.id}' do
      it(:with_permission)    { should auth status: 200, type: :json, empty: false }
      it(:without_permission) { should auth status: 200, type: :json, empty: false }
      it(:invalid_token)      { should auth status: 403 }
      it(:unauthenticated)    { should auth status: 401 }
    end

    describe 'GET /jobs/%{job.id}/log' do
      it(:with_permission)    { should auth status: [200, 307], type: :text, empty: false }
      it(:without_permission) { should auth status: [200, 307], type: :text, empty: false }
      it(:invalid_token)      { should auth status: 403 }
      it(:unauthenticated)    { should auth status: 401 }
    end
  end

  describe 'in private mode, with a public repo', mode: :private, repo: :public do
    describe 'GET /jobs' do
      it(:with_permission)    { should auth status: [200, 307], type: :json, empty: false }
      it(:without_permission) { should auth status: [200, 307], type: :json, empty: true }
      it(:invalid_token)      { should auth status: 403 }
      it(:unauthenticated)    { should auth status: 401 }
    end

    describe 'GET /jobs/%{job.id}' do
      it(:with_permission)    { should auth status: 200, type: :json, empty: false }
      it(:without_permission) { should auth status: 404 }
      it(:invalid_token)      { should auth status: 403 }
      it(:unauthenticated)    { should auth status: 401 }
    end

    describe 'GET /jobs/%{job.id}/log' do
      it(:with_permission)    { should auth status: [200, 307], type: :text, empty: false }
      it(:without_permission) { should auth status: 404 }
      it(:invalid_token)      { should auth status: 403 }
      it(:unauthenticated)    { should auth status: 401 }
    end
  end

  # +----------------------------------------------------+
  # |                                                    |
  # |   !!! THE ORIGINAL BEHAVIOUR ... DON'T TOUCH !!!   |
  # |                                                    |
  # +----------------------------------------------------+

  describe 'in private mode, with a private repo', mode: :private, repo: :private do
    describe 'GET /jobs' do
      it(:with_permission)    { should auth status: 200, type: :json, empty: false }
      it(:without_permission) { should auth status: 200, type: :json, empty: true }
      it(:invalid_token)      { should auth status: 403 }
      it(:unauthenticated)    { should auth status: 401 }
    end

    describe 'GET /jobs/%{job.id}' do
      it(:with_permission)    { should auth status: 200, type: :json, empty: false }
      it(:without_permission) { should auth status: 404 }
      it(:invalid_token)      { should auth status: 403 }
      it(:unauthenticated)    { should auth status: 401 }
    end

    describe 'GET /jobs/%{job.id}/log' do
      it(:with_permission)    { should auth status: [200, 307], type: :text, empty: false }
      it(:without_permission) { should auth status: 404 }
      it(:invalid_token)      { should auth status: 403 }
      it(:unauthenticated)    { should auth status: 401 }
    end
  end

  describe 'in org mode, with a public repo', mode: :org, repo: :public do
    describe 'GET /jobs' do
      it(:with_permission)    { should auth status: 200, type: :json, empty: false }
      it(:without_permission) { should auth status: 200, type: :json, empty: false }
      it(:invalid_token)      { should auth status: 403 }
      it(:unauthenticated)    { should auth status: 200, type: :json, empty: false }
    end

    describe 'GET /jobs/%{job.id}' do
      it(:with_permission)    { should auth status: 200, type: :json, empty: false }
      it(:without_permission) { should auth status: 200, type: :json, empty: false }
      it(:invalid_token)      { should auth status: 403 }
      it(:unauthenticated)    { should auth status: 200, type: :json, empty: false }
    end

    describe 'GET /jobs/%{job.id}/log' do
      it(:with_permission)    { should auth status: [200, 307], type: :text, empty: false }
      it(:without_permission) { should auth status: [200, 307], type: :text, empty: false }
      it(:invalid_token)      { should auth status: 403 }
      it(:unauthenticated)    { should auth status: [200, 307], type: :text, empty: false }
    end
  end
end


text:
#pragma once

#ifdef __cplusplus
extern "C" {
#endif

#include <sys/types.h>
#include <stdint.h>

#define S2N_SSLv2 20
#define S2N_SSLv3 30
#define S2N_TLS10 31
#define S2N_TLS11 32
#define S2N_TLS12 33

extern __thread int s2n_errno;

struct s2n_config;

extern int s2n_init(void);
extern int s2n_cleanup(void);
extern struct s2n_config *s2n_config_new(void);
extern int s2n_config_free(struct s2n_config *config);
extern int s2n_config_free_dhparams(struct s2n_config *config);
extern int s2n_config_free_cert_chain_and_key(struct s2n_config *config);
extern const char *s2n_strerror(int error, const char *lang);

extern int s2n_config_add_cert_chain_and_key(struct s2n_config *config, char *cert_chain_pem, char *private_key_pem);
extern int s2n_config_add_cert_chain_and_key_with_status(struct s2n_config *config,
        char *cert_chain_pem, char *private_key_pem, const uint8_t *status, uint32_t length);
extern int s2n_config_add_dhparams(struct s2n_config *config, char *dhparams_pem);
extern int s2n_config_set_key_exchange_preferences(struct s2n_config *config, const char *preferences);
extern int s2n_config_set_cipher_preferences(struct s2n_config *config, const char *version);
extern int s2n_config_set_protocol_preferences(struct s2n_config *config, const char * const *protocols, int protocol_count);
typedef enum { S2N_STATUS_REQUEST_NONE = 0, S2N_STATUS_REQUEST_OCSP = 1 } s2n_status_request_type;
extern int s2n_config_set_status_request_type(struct s2n_config *config, s2n_status_request_type type);

struct s2n_connection;
typedef enum { S2N_SERVER, S2N_CLIENT } s2n_mode;
extern struct s2n_connection *s2n_connection_new(s2n_mode mode);
extern int s2n_connection_set_config(struct s2n_connection *conn, struct s2n_config *config);

extern int s2n_connection_set_fd(struct s2n_connection *conn, int readfd);
extern int s2n_connection_set_read_fd(struct s2n_connection *conn, int readfd);
extern int s2n_connection_set_write_fd(struct s2n_connection *conn, int readfd);

typedef enum { S2N_BUILT_IN_BLINDING, S2N_SELF_SERVICE_BLINDING } s2n_blinding;
extern int s2n_connection_set_blinding(struct s2n_connection *conn, s2n_blinding blinding);
extern int64_t s2n_connection_get_delay(struct s2n_connection *conn);

extern int s2n_set_server_name(struct s2n_connection *conn, const char *server_name);
extern const char *s2n_get_server_name(struct s2n_connection *conn);
extern const char *s2n_get_application_protocol(struct s2n_connection *conn);
extern const uint8_t *s2n_connection_get_ocsp_response(struct s2n_connection *conn, uint32_t *length);

typedef enum { S2N_NOT_BLOCKED = 0, S2N_BLOCKED_ON_READ, S2N_BLOCKED_ON_WRITE } s2n_blocked_status;
extern int s2n_negotiate(struct s2n_connection *conn, s2n_blocked_status *blocked);
extern ssize_t s2n_send(struct s2n_connection *conn, void *buf, ssize_t size, s2n_blocked_status *blocked);
extern ssize_t s2n_recv(struct s2n_connection *conn,  void *buf, ssize_t size, s2n_blocked_status *blocked);

extern int s2n_connection_wipe(struct s2n_connection *conn);
extern int s2n_connection_free(struct s2n_connection *conn);
extern int s2n_shutdown(struct s2n_connection *conn, s2n_blocked_status *blocked);

extern uint64_t s2n_connection_get_wire_bytes_in(struct s2n_connection *conn);
extern uint64_t s2n_connection_get_wire_bytes_out(struct s2n_connection *conn);
extern int s2n_connection_get_client_protocol_version(struct s2n_connection *conn);
extern int s2n_connection_get_server_protocol_version(struct s2n_connection *conn);
extern int s2n_connection_get_actual_protocol_version(struct s2n_connection *conn);
extern int s2n_connection_get_client_hello_version(struct s2n_connection *conn);
extern const char *s2n_connection_get_cipher(struct s2n_connection *conn);
extern int s2n_connection_get_alert(struct s2n_connection *conn);

#ifdef __cplusplus
}
#endif


text:
<?php

/*
 * This file is part of the overtrue/wechat.
 *
 * (c) overtrue <i@overtrue.me>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace EasyWeChat\Kernel\Messages;

/**
 * Class Article.
 */
class Article extends Message
{
    /**
     * @var string
     */
    protected $type = 'mpnews';

    /**
     * Properties.
     *
     * @var array
     */
    protected $properties = [
        'thumb_media_id',
        'author',
        'title',
        'content',
        'digest',
        'source_url',
        'show_cover',
    ];

    /**
     * Aliases of attribute.
     *
     * @var array
     */
    protected $jsonAliases = [
        'content_source_url' => 'source_url',
        'show_cover_pic' => 'show_cover',
    ];

    /**
     * @var array
     */
    protected $required = [
        'thumb_media_id',
        'title',
        'content',
        'show_cover',
    ];
}


text:
import resolve from 'rollup-plugin-node-resolve'
import {uglify} from 'rollup-plugin-uglify'

// npm run build -> {production} is true
// npm run dev -> {production} is false
const production = !process.env.ROLLUP_WATCH

export default {
  experimentalCodeSplitting: true,
  input: {
    app: './src/app/main.js',
    worker: './src/worker/main.js'
  },
  output: {
    dir: './public/js',
    format: 'es',
    sourcemap: true
  },
  plugins: [
    resolve()/*, // tells Rollup how to find node_modules
    production && uglify() // FIXME: minify, but only in production
                           // FIXME: need minifier plugin with ES6+ syntax
*/]
}


text:
sap.ui.define([
		'jquery.sap.global',
		'sap/ui/core/mvc/Controller',
		'sap/ui/model/json/JSONModel'
	], function(jQuery, Controller, JSONModel) {
	"use strict";

	var CController = Controller.extend("sap.m.sample.ObjectNumber.C", {

		onInit : function (evt) {
			// set explored app's demo model on this sample
			var oModel = new JSONModel(jQuery.sap.getModulePath("sap.ui.demo.mock", "/products.json"));
			this.getView().setModel(oModel);
		}
	});

	return CController;

});


text:
namespace DatabaseSynchronizer.Migrations
{
    using System.Data.Entity.Migrations;
    using System.Data.Entity.Migrations.Infrastructure;
    using System.Resources;

    public sealed partial class Initial : IMigrationMetadata
    {
        private readonly ResourceManager Resources = new ResourceManager(typeof(Initial));

        string IMigrationMetadata.Id
        {
            get { return "201506280800275_Initial"; }
        }

        string IMigrationMetadata.Source
        {
            get { return null; }
        }

        string IMigrationMetadata.Target
        {
            get { return Resources.GetString("Target"); }
        }
    }
}