This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns demo | |
(:require [clojure.core.async :as a :refer [go | |
go-loop | |
chan | |
>! | |
<! | |
close]])) | |
(defn int-producer | |
"Return a channel containing the integers from 0 to n. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env escript | |
-define(dbg(X), io:format("DEBUG: ~p~n", [X])). | |
-record(args, {primitives = [], | |
patha = [], | |
pathz = [], | |
unrecognized = [], | |
verbose = false, | |
help = false}). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
start = Time.now | |
puts "Starting to read file ..." | |
num = 0 | |
File.open(ARGV[0]) do |f| | |
f.each { |l| num += l.split.length } | |
end | |
puts "The number of tokens is: #{num}." | |
puts "It took #{(Time.now - start) * 1000} ms" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# tags without a newline after them | |
# 1a) currently legal: | |
@hello Feature: foo | |
@goodbye Scenario: bar | |
Given baz | |
# 1b) proposed: | |
@hello | |
Feature: foo | |
@goodbye |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config.ru | |
require 'appengine-rack' | |
AppEngine::Rack.configure_app( | |
:application => 'testapp', | |
:version => 2) | |
require 'testapp.rb' | |
run Sinatra::Application | |
# testapp.rb | |
require 'rubygems' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# It's difficult to decide what is invalid Gherkin, so I made this gist to try and figure it out | |
# Empty feature | |
Feature: | |
# Feature with GWT in desc | |
Feature: Suspicious | |
Given this is bad form | |
Whenever I do this | |
Then you should be suspicious because |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb(main):001:0> require 'cucumber' | |
=> true | |
irb(main):002:0> sm = Cucumber::StepMother.new | |
=> #<Cucumber::StepMother:0x1192ca0 @programming_languages=[], @adverbs=["Given", "When", "Then", "And", "But"], @unsupported_programming_languages=[], @language_map={}> | |
irb(main):003:0> sm.load_code_files("./cuke_steps.rb") | |
D, [2009-09-16T17:09:05.531395 #8769] DEBUG -- : Code: | |
D, [2009-09-16T17:09:05.535501 #8769] DEBUG -- : * ./cuke_steps.rb | |
D, [2009-09-16T17:09:05.535807 #8769] DEBUG -- : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This will work | |
x = nil | |
a = lambda { | |
if x.nil? | |
"x is nil, as it should be" | |
else | |
"somehow x = #{x}" | |
end | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CommandParser | |
%%{ | |
machine wire_command_parser; | |
action parse_error { | |
@sess.parse_error | |
} | |
action command { | |
command = data[0..p].pack("c*") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
msassak@xanthippe:~/Work/gherkin(benchmarks) $ rake bench:tt | |
(in /Users/msassak/Work/gherkin) | |
grep Feature /Users/msassak/Work/gherkin/tasks/bench/generated/* | wc -l | |
1999 | |
grep Scenario /Users/msassak/Work/gherkin/tasks/bench/generated/* | wc -l | |
10095 | |
grep Given /Users/msassak/Work/gherkin/tasks/bench/generated/* | wc -l | |
60722 | |
user system total real | |
183.780000 0.590000 184.370000 (185.416678) |
OlderNewer