Skip to content

Instantly share code, notes, and snippets.

View bakkdoor's full-sized avatar

Christopher Bertels bakkdoor

View GitHub Profile
find . -type f -exec grep -nH -e "selector" {} /dev/null \;
./parser/ext/lexer.lex:55:selector ({letter}|[_&*])({letter}|{digit}|{special_under})*":"
./parser/ext/lexer.lex:148:{selector} {
./parser/ext/parser.y:88:%type <object> selector
./parser/ext/parser.y:262:selector: SELECTOR {
./parser/ext/parser.y:348:method_arg: selector identifier {
./parser/ext/parser.y:364:method_arg_default: selector identifier LPAREN space exp space RPAREN {
./parser/ext/parser.y:469:send_args: selector arg_exp {
./parser/ext/parser.y:472: | selector space arg_exp {
./parser/ext/parser.y:475: | send_args selector arg_exp {
def with_tmp_fs: block {
tmp_path_names = []
block arity times: |i| {
path = "/tmp/tmp_path_#{i}"
tmp_path_names << path
Directory create: path
}
block call: tmp_path_names
tmp_path_names each: |p| {
Directory delete!: p
it: "should return an instance of the apropriate MatchData class" when: {
def create_tuple: num {
(num, num * num) # create a Tuple
}
match create_tuple: 10 -> {
case Tuple -> |md, x, y|
md class should == (Tuple MatchData)
x should == 10
@bakkdoor
bakkdoor / cascading.tuple.TupleEntryIterator.hasNext() backtrace
Created January 14, 2011 00:42
backtrace of calling cascading.tuple.TupleEntryIterator.hasNext() after it has returned false
cascading.pipe.OperatorException: [ddc15846-4ba7-4f3a-ad0...][sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)] operator Every failed executing buffer: CascalogBufferExecutor[decl:'?follower-ids']
at cascading.pipe.Every$EveryBufferHandler.operate(Every.java:542)
at cascading.flow.stack.EveryBufferReducerStackElement.collect(EveryBufferReducerStackElement.java:89)
at cascading.flow.stack.GroupReducerStackElement.operateGroup(GroupReducerStackElement.java:74)
at cascading.flow.stack.GroupReducerStackElement.collect(GroupReducerStackElement.java:58)
at cascading.flow.stack.FlowReducerStack.reduce(FlowReducerStack.java:169)
at cascading.flow.FlowReducer.reduce(FlowReducer.java:75)
at org.apache.hadoop.mapred.ReduceTask.runOldReducer(ReduceTask.java:463)
at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:411)
at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:215)
=============== :"loop:" ===============
Arguments: 1 required, 1 total
Locals: 1: block
Stack size: 3
Lines to IP: 12: -1..-1, 9: 0..1, 11: 2..3, 12: 4..7
0000: create_block #<Rubinius::CompiledMethod loop: file=lib/object.fy>
0002: create_block #<Rubinius::CompiledMethod loop: file=lib/object.fy>
0004: send_stack :"while_true:", 1
def mytimes(block)
times(&block)
end
@bakkdoor
bakkdoor / bytecode for times:
Created January 9, 2011 02:43
implementation of Fixnum#times:
============== :"times:" ===============
Arguments: 1 required, 1 total
Locals: 1: block
Stack size: 3
Lines to IP: 22: -1..0, 21: 1..2, 22: 3..7
0000: push_self
0001: push_local 0 # block
0003: allow_private
0004: send_stack_with_block :times, 0
@bakkdoor
bakkdoor / Rakefile.diff
Created January 9, 2011 01:46
Change Rakefile to compile all files at once with fancy-written compiler and use rbx -Xint option
diff --git a/Rakefile b/Rakefile
index 2782ca9..b4cc318 100644
--- a/Rakefile
+++ b/Rakefile
@@ -89,7 +89,7 @@ namespace :compiler do
task :compile => file(boot_parser_e) do
say "Compiling fancy using stable compiler."
- cmd = ['rbx', load_rb]
+ cmd = ['rbx -Xint', load_rb]
@bakkdoor
bakkdoor / blocks.fy
Created January 9, 2011 01:04
Output of running blocks.fy - I cut out a big part that isn't interesting to the problem (due to output size). See below.
# Fancy source code for the output below:
i = 0
loop: { # endless loop, same as: while: { true } do: { ... }
"-------> " ++ i println
2 times: {
"yo" println
}
i = i + 1
}
@bakkdoor
bakkdoor / thrift-mode.el
Created January 8, 2011 02:56
Simple thrift mode (taken from https://github.com/kragen/stevej-emacs/blob/master/thrift-mode/thrift.el) and adjusted to highlight self-defined types, unions & namespaces nicely.
(require 'font-lock)
(defvar thrift-mode-hook nil)
(add-to-list 'auto-mode-alist '("\\.thrift\\'" . thrift-mode))
(defvar thrift-indent-level 2
"Defines 2 spaces for thrift indentation.")
;; syntax coloring