Discover gists
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
s = Time.now | |
e = s + 100.days | |
i = s | |
dates = [] | |
dates << s | |
while i < e | |
i += 1.week | |
dates << i | |
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
#!/usr/bin/env ruby | |
require 'tempfile' | |
require 'rubygems' | |
require 'mojombo-grit' | |
include Grit | |
PATH_TO_DIFFMERGE = "/usr/bin/diffmerge" |
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
print "Hello, perl world!\n"; | |
0; | |
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
{ scopeName = 'source.ruby'; | |
comment = ' | |
TODO: unresolved issues | |
text: | |
"p << end | |
print me! | |
end" | |
symptoms: | |
not recognized as a heredoc |
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
BLOWIN UP YOUR SPOT |
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
def foo | |
puts 'hello world' | |
end | |
foo |
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
require 'benchmark' | |
puts Benchmark.measure { | |
(2..100).select { |n| '_' * n !~ /\A(__+)\1+\z/ } | |
} | |
puts ">_<X" | |
puts ">_<X" | |
puts ">_<X" | |
puts ">_<X" |
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
Block apply := method(target, args, | |
args = if(args isNil, list(), args) | |
target = if(target isNil, scope, target) | |
self setScope(target) | |
self performWithArgList("call", args) | |
) | |
Block bind := method( | |
args := call message argsEvaluatedIn(call sender) | |
target := args at(0) | |
args = args slice(1) |
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
// Boost DFS example on an undirected graph. | |
#include <boost/graph/adjacency_list.hpp> | |
#include <boost/graph/depth_first_search.hpp> | |
#include <iostream> | |
using namespace std; | |
typedef boost::adjacency_list<boost::listS, boost::vecS, boost::undirectedS> MyGraph; | |
typedef boost::graph_traits<MyGraph>::vertex_descriptor MyVertex; | |
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
begin | |
require 'rubygems' | |
require 'readline/history/restore/auto_save' | |
Readline::History::Restore::AutoSave.scriptname | |
#require 'active_support' | |
rescue Exception | |
end | |
module Kernel | |
def r(arg) |