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
// one global css object | |
// | |
var css; | |
(function(){ | |
css = function(){ | |
// static data | |
// | |
this.data = |
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
http_path = "/" # Root of project when deployed | |
css_dir = "public/stylesheets" | |
sass_dir = "public/stylesheets/sass" | |
images_dir = "images" | |
javascripts_dir = "javascripts" | |
relative_assets = true |
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
var child_process = require('child_process'), | |
sys = require('sys'), | |
net = require('net'), | |
netBinding = process.binding('net'); | |
var fd = netBinding.socket('tcp4'); | |
netBinding.bind(fd, 8080); | |
netBinding.listen(fd, 128); | |
for (var i = 0; i < 4; i++) { |
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 'rubygems' | |
require 'sinatra' | |
require 'redis' | |
# To use, simply start your Redis server and boot this | |
# example app with: | |
# ruby example_note_keeping_app.rb | |
# | |
# Point your browser to http://localhost:4567 and enjoy! | |
# |
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 'rubygems' | |
require 'sinatra' | |
get '/' do | |
"hello world" | |
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
require "rubygems" | |
require "gratr" | |
require "gratr/dot" | |
# 1 -> 2 -> 3 | |
# |-> 6 -> |-> 4 -> 5 -> 2 | |
# 2 -> 4 -> 5 | |
dg = GRATR::Digraph[1,2, 2,3, 2,4, 4,5, 6,4, 1,6] |
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 "rubygems" | |
require 'mq' | |
EM.run { | |
amq = MQ.new | |
EM.add_periodic_timer(1) { amq.queue("noises").publish("moo") } | |
} |
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 "rubygems" | |
require "json" | |
class Schema | |
attr_accessor :hsh | |
def initialize(h={}) | |
@hsh = {} | |
case h | |
when Hash | |
h.each {|k,v| self[k] = v} |
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
-module(web_utils). | |
-include ("beehive.hrl"). | |
-include ("http.hrl"). | |
-compile (export_all). | |
% Private | |
convert_to_struct(RawData) -> | |
lists:map(fun({BinKey, BinVal}) -> | |
Key = misc_utils:to_atom(BinKey), | |
Val = misc_utils:to_list(BinVal), |
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
# sinatra/thin based proxy | |
require 'rubygems' | |
require 'sinatra' | |
require 'nokogiri' | |
require 'open-uri' | |
require 'redis' | |
require 'digest/md5' | |
$KCODE = 'u' if RUBY_VERSION < '1.9' | |
before do |