Gazay's incomplete Minimalistic Language.
By Alexey Gaziev.
Smallest and incomplete language for big but simple config files. It should be so simple that you can write fast parser for it in few LOC and without heavy dependencies.
androidbuilder@aa3718480a89:~/android-haskell-activity$ arm-linux-androideabi-cabal build --verbose=3 | |
Using internal setup method with build-type Simple and args: | |
["build","--verbose=3","--builddir=dist","--jobs=8","--with-gcc=/home/androidbuilder/.ghc/android-14/arm-linux-androideabi-4.8/bin/arm-linux-androideabi-gcc","--with-ghc=/home/androidbuilder/.ghc/android-14/arm-linux-androideabi-4.8/bin/arm-unknown-linux-androideabi-ghc","--with-ghc-pkg=/home/androidbuilder/.ghc/android-14/arm-linux-androideabi-4.8/bin/arm-unknown-linux-androideabi-ghc-pkg","--with-hsc2hs=/home/androidbuilder/.ghc/android-14/arm-linux-androideabi-4.8/bin/arm-unknown-linux-androideabi-hsc2hs","--with-ld=/home/androidbuilder/.ghc/android-14/arm-linux-androideabi-4.8/bin/arm-linux-androideabi-ld","--with-strip=/home/androidbuilder/.ghc/android-14/arm-linux-androideabi-4.8/bin/arm-linux-androideabi-strip","--hsc2hs-option=--cross-compile"] | |
("/home/androidbuilder/.ghc/android-14/arm-linux-androideabi-4.8/bin/arm-linux-androideabi-gcc",[" |
androidbuilder@cf12994d95a0:~/foreign-jni$ arm-linux-androideabi-cabal install | |
Resolving dependencies... | |
Downloading text-1.2.0.4... | |
Downloading transformers-0.4.2.0... | |
Configuring text-1.2.0.4... | |
Configuring transformers-0.4.2.0... | |
Failed to install text-1.2.0.4 | |
Build log ( /home/androidbuilder/.ghc/android-14/arm-linux-androideabi-4.8/.cabal/logs/text-1.2.0.4.log ): | |
[1 of 1] Compiling Main ( /tmp/text-1.2.0.4-59/text-1.2.0.4/dist/setup/setup.hs, /tmp/text-1.2.0.4-59/text-1.2.0.4/dist/setup/Main.o ) | |
Linking /tmp/text-1.2.0.4-59/text-1.2.0.4/dist/setup/setup ... |
import System.Random (newStdGen, randomR) | |
import Gimlh | |
import Data.List.Split (splitOn) | |
import Data.List (intercalate) | |
import Control.Monad.State | |
main = putStrLn $ runFaker $ do | |
n <- name | |
return $ unwords ["Hello", "my", "name", "is", n] |
"require 'spec_helper'\n\ndescribe 't34' do\n let(:target) {\n\"class X\n def test_method(arg1)\n end\nend # X\"\n }\n\n let(:target2) {\n\"class X\n def test_method(xxx, arg2)\n end\nend # X\"\n }\n\n let(:source) {\n\"class X\n def test_method(arg1, arg2)\n end\nend\"\n }\n\n let(:rewriter) {\n T34::Rewriter.new source\n }\n\n it 'finds methods' do\n expect(rewriter.methods(:test_method)).to be_kind_of Array\n end\n\n it 'finds method nodes' do\n expect(rewriter.methods(:test_method).map(&:class).compact).to eq [T34::Rewriter::API::MethodNode]\n end\n\n it 'manipulates methods' do\n res = rewriter.methods(:test_method) do |method_node|\n method_node.args = method_node.args[0...-1]\n end\n expect(res[0].args.size).to eq 1\n end\n\n it 'manipulates arguments by name' do\n res = rewriter.methods(:test_method) do |method_node|\n method_node.args = method_node.args.select { |it| it.name != 'arg2' }\n end\n expect(res[0].args.size).to eq 1\n expect(rewr |
require 'fileutils' | |
class Helper | |
attr_accessor :dir, :temp_dir | |
attr_reader :template_path, :original_dir | |
def initialize(dir = nil) | |
@template_path = File.expand_path('../../app_template', __FILE__) | |
@original_dir = FileUtils.pwd |
#!/usr/bin/env ruby | |
client_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'proxy')) | |
$LOAD_PATH.unshift(client_dir) unless $LOAD_PATH.include?(client_dir) | |
require 'client' | |
# Get parameters and start the server | |
if ARGV.size == 2 | |
port, proxy = ARGV | |
port = port.to_i |
# Based on https://gist.github.com/74107 by # Copyright (C) 2009 Torsten Becker <[email protected]> | |
# | |
# Rewrited by gazay | |
require 'socket' | |
require 'uri' | |
class Proxy | |
attr_accessor :socket |
# implementation of Range#=== in 1.8.7 - it was the same method as Range#include?: | |
<<-EOS | |
static VALUE | |
range_include(range, val) | |
VALUE range, val; | |
{ | |
VALUE beg, end; | |
beg = rb_ivar_get(range, id_beg); | |
end = rb_ivar_get(range, id_end); |
#!/usr/bin/env ruby | |
require 'epath' | |
bom = "\xEF\xBB\xBF".force_encoding('binary') | |
Path.glob('**/*.rb') do |file| | |
next if file.binread(3) == bom | |
previous = file.binread | |
file.write bom + previous | |
end |