dsisnero dsisnero

View IKEA graphgist
1 2 3 4 5 6 7 8 9 10
= IKEA GraphGist =
 
This gist is to complement the http://blog.bruggen.com/2013/09/ikea-wardrobes-and-graphs-perfect-fit.html[more elaborate blogpost] that I wrote about using http://neo4j.org[neo4j] to model the partlist and the assembly process of two IKEA wardrobes.
 
First, we will create a part of the graph using this model:
 
image::https://lh4.googleusercontent.com/7XxUuCjnFtDhO-JAI5Ia6tcYZkQoMfcv_1pNE0mTA2cx76vIySrBU0z0tnykAPvqsMrZZD-cca3Q7ca-ERI0f5sDsGAUCEJTIx7wt15mxKhFEXeYFrZD_vEGJQ[]
 
[source,cypher]
----
View network_management.adoc

Neo4j is often used to model complex graphs in Network Management scenarios. This is a pseudo setup for a network management graph and some sample queries.

CREATE
	(ogd:Repeater {name:"Ogden", locid : "ogd", factype: "rcl"}),
	(qtj:Repeater {name:"Brigham City",locid: "qtj",factype: "rcl"}),
	(qli:Repeater {name:"Promotory",locid: "qli",factype: "rcl"}),
View GraphGist-syntax.adoc

You create a GraphGist by creating a GitHub Gist in AsciiDoc and enter the URL to it in the form on this page. Alternatively, you can put an AsciiDoc document in Dropbox and enter the public URL in the form.

This GraphGist shows the basics of using AsciiDoc syntax and a few additions for GraphGists. The additions are entered as comments on their own line. They are: //console for a query console; //hide, //setup and //output to configure a query; //graph and //table to visualize queries and show a result table.

Click on the Page Source button in the menu to see the source for this GraphGist.

View gist:5515142
1 2 3 4 5 6 7 8 9 10
module Functional
 
module_function
 
def unary
->(a,*b){ a}
end
def binary
->(a,b,*c){ [a,b]}
View open_to_path
1 2 3 4 5
def my_open(filename)
filename = filename.to_path if filename.respond_to?(:to_path)
filename = filename.to_str
# ...
end
View test.rb
1 2 3 4 5 6 7 8 9
def async_fetch(url)
f = Fiber.current
http = EventMachine::HttpRequest.new(url).get :timeout => 10
 
http.callback { f.resume(http) }
http.errback { f.resume(http) }
 
return Fiber.yield
end
View gist:906649
1 2 3 4 5 6 7 8 9 10
require 'pathname'
require 'fileutils'
require 'set'
 
base = Pathname('/newdir/obsolete')
old_dirs = Set.new
 
Pathname.glob('dir/*/obsolete/*').each do |pn|
dir, file = pn.split
customer = dir.parent.basename
View app_builder.rb
1 2 3 4 5 6 7 8 9 10
class AppBuilder < Rails::AppBuilder
#include Thor::Actions
#include Thor::Shell
 
@@versions = %w( 1.4.2 1.4.1 1.4.0 1.3.2 1.3.1 1.3.0 1.2.6 )
 
def test
append_test_gems
rspec
View ScratchPad.rb
1 2 3 4 5 6 7 8 9 10
include 'dm-is-list'
 
class Node
include DataMapper::Resource
 
property :id, Serial
# other properties...
 
has n, :parts
end
View gist:399097
1 2 3 4 5 6 7 8 9
#!/usr/bin/env ruby -Ku
 
require 'rubygems'
require 'dm-core'
require 'dm-sweatshop'
require 'bacon'
 
#DataMapper::Logger.new($stdout, :debug)
DataMapper.setup(:default, 'sqlite3::memory:')
Something went wrong with that request. Please try again.