This file contains hidden or 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
// app.js | |
NoBug = true; | |
// test/bug-test.js | |
buster.testCase('Buster', { | |
'should not be buggy': function() { | |
assert(NoBug); | |
} | |
}); |
This file contains hidden or 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 Parser | |
def force; self end | |
def |(other) | |
DisjunctiveParser.new(self, other) | |
end | |
def >>(other) | |
SequentialParser.new(self, other) | |
end |
This file contains hidden or 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
def valid_ruby?(str) | |
catch(:valid) { | |
eval("BEGIN{throw :valid,true};#{str}") | |
} | |
rescue SyntaxError | |
false | |
end | |
p valid_ruby?("123") | |
p valid_ruby?("'") |
This file contains hidden or 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 ruby | |
require 'benchmark' | |
def bitmask | |
2 ** 32 - 1 | |
end | |
def bitmask_with_assignment | |
overshoot = 2 ** 32 | |
overshoot - 1 |
This file contains hidden or 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
require 'camping' | |
Camping.goes :Ex | |
module Ex | |
use Rack::MethodOverride | |
end | |
module Ex::Helpers | |
SUPPORTED = %w[get post] |
This file contains hidden or 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
if defined?(Foo::THIS) && Foo::THIS == $0 | |
p 'foo is executing' | |
end | |
This file contains hidden or 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
require 'camping' | |
require 'camping/session' | |
require 'rack/csrf' | |
Camping.goes :E | |
module E | |
use Rack::Csrf | |
include Camping::Session | |
end |
This file contains hidden or 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
diff --git a/lib/Mojo/Base.pm b/lib/Mojo/Base.pm | |
index 0fabd9a..19f5f87 100644 | |
--- a/lib/Mojo/Base.pm | |
+++ b/lib/Mojo/Base.pm | |
@@ -8,6 +8,7 @@ require feature if $] >= 5.010; | |
# No imports because we get subclassed, a lot! | |
require Carp; | |
+require Scalar::Util; | |
This file contains hidden or 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
require 'camping' | |
Camping.goes :Async | |
module Async | |
def service(*a) | |
return super unless respond_to?(:async?) | |
EM.next_tick do | |
send(@method, *a) |
This file contains hidden or 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 Base; end | |
class Controller < Base | |
@@hello = :controller | |
end | |
class Base | |
@@hello = :base | |
end |