Skip to content

Instantly share code, notes, and snippets.

View pangloss's full-sized avatar
😃

Darrick Wiebe pangloss

😃
View GitHub Profile
@pangloss
pangloss / pacer_loop_test.rb
Created July 20, 2011 16:49 — forked from pdlug/pacer_loop_test.rb
Pacer loop test
require 'bundler/setup'
require 'pacer'
graph = Pacer.tg
c1 = graph.create_vertex(name: 'Concept 1')
c2 = graph.create_vertex(name: 'Concept 2')
c2a = graph.create_vertex(name: 'Concept 2a')
@pangloss
pangloss / pacer_loop_test.rb
Created July 20, 2011 22:24 — forked from pdlug/pacer_loop_test.rb
Pacer loop test
require 'bundler/setup'
require 'pacer'
require 'pacer-neo4j'
#graph = Pacer.tg
graph = Pacer.neo4j('/tmp/test-neo4j')
c1 = graph.create_vertex(name: 'Concept 1')
c2 = graph.create_vertex(name: 'Concept 2')
// Allows you to specify events on the data tied to the view in the same way
// that you can specify dom events:
//
// dataEvents: {
// instanceName: {
// 'change:name': 'mothed',
// delete: 'otherMethod'
// }, ...
// }
registerDataEvents: function(unbind) {
@pangloss
pangloss / gist:1166251
Created August 23, 2011 19:31
This doesn't work...is it possible?
JavaClass.java_send :new, [java.lang.String[]], [].to_java(:string)
@pangloss
pangloss / gist:1168902
Created August 24, 2011 19:08
Pacer 0.8.1 using Rexster
dw:jruby-1.6.3:~/dev/graph $ gem install pacer-rexster
Fetching: pacer-rexster-1.0.0-jruby.gem (100%)
Successfully installed pacer-rexster-1.0.0-java
1 gem installed
Building YARD (yri) index for pacer-rexster-1.0.0-java...
dw:jruby-1.6.3:~/dev/graph $ pry
pry(main)> require 'pacer-rexster'
=> true
pry(main)> g = Pacer.rexster 'http://localhost:8182/gratefulgraph'
=> #<RexsterGraph>
# setup:
def setup_graph
g = Pacer.tg
person = g.create_vertex type: 'person'
print '.'
1000.times { g.create_vertex type: 'person' }
print '.'
g.v.each { |v| v.add_edges_to :friend, g.v.random(rand(100)) }
print '.'
1000.times { g.create_vertex :type => 'product' }
@pangloss
pangloss / monkeypatch.rb
Created December 22, 2011 05:48
To show how many levels deep instance variable inspection goes
[33] pry(main)> { a: { b: { c: '' } } }
1 2 3{
:a => {
:b => {
:c => ""
}
}
}
[34] pry(main)> ModelClass
2 4 6 8 8 10 11 9 10 8 6 10 8 12 11 13 13 18 21 23 23 26 28 30 29 28 30 29 28 30 29 28 26 28 30 26 28 30 26 26 28 30 28 30 30 26 25 27 29 28 25 27 29 27 30 32 34 33 32 34 33 32 32 32 34 33 32 34 33 32 34 33 32 34 33 30 33 32 33 32 30 32 34 32 34 32 34 32 34 32 34 32 34 29 31 33 32 31 33 32 31 31 31 33 32 31 33 32 31 33 32 31 33 32 29 32 31 32 31 29 31 33 31 33 31 33 31 33 31 33 31 33 27 30 32 34 35 33 34 32 34 33 32 34 33 32 34 33 32 34 33 32 34 33 30 32 33 34 30 30 32 34 32 34 32 34 32 34 32 34 29 31 33 34 32 33 31 33 32 31 33 32 31 33 32 31 33 32 31 33 32 29 31 32 33 29 29 31 33 31 33 31 33 31 33 31 33 27 30 32 34 35 33 34 30 32 33 34 30 29 31 33 34 32 33 29 31 32 33 29 27 30 32 34 35 33 34 32 34 35 33 34 30 32 33 34 32 33 34 30 29 31 33 34 32 33 31 33 34 32 33 29 31 32 33 31 32 33 29 27 30 29 27 30 32 34 35 33 34 32 34 35 33 34 30 32 33 34 32 33 34 30 29 31 33 34 32
@pangloss
pangloss / index.html
Created March 4, 2012 02:35 — forked from bunkat/index.html
Swimlane Chart using d3.js
<html>
<head>
<title>Swimlane using d3.js</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.v2.js"></script>
<script type="text/javascript" src="randomData.js"></script>
<style>
.chart {
shape-rendering: crispEdges;
}
@pangloss
pangloss / enumerable_pipe.rb
Created March 18, 2012 17:10
JRuby dci branch bug repro
class EnumerablePipe
def initialize(obj)
obj.to_enum
end
end
@pangloss
pangloss / counter.rb
Created April 9, 2012 09:36
Worker pool does not limit the number of workers created
require 'celluloid'
class Counter
include Celluloid::Worker
def count
len = rand(1000)
Celluloid::Actor[:min].result len
len
end