Skip to content

Instantly share code, notes, and snippets.

Avatar

Dotan J. Nahum jondot

View GitHub Profile
@jondot
jondot / reducer.js
Created Oct 29, 2015
A ReducerStore
View reducer.js
class ReducerStore {
static handler(store=new Store, action){
var fn = store[action.type]
if(fn){
return fn(action)
} else {
return store
}
}
View gist:6405909
Total Notifications": {
source: "http://localhost:4567/",
refresh_interval: 4000,
GaugeLabel: {
parent: "#hero-one",
title: "Notifications Served",
type: "max"
}
},
View README.md

Debugging & Profiling Node.js

This is a maintained listing of all the different ways to debug and profile Node.js applications. If there is something missing or an improvement, post a comment! :)

Interactive Stack Traces with traceGL - Shareware

  1. Guide here
View gist:5004412
App.Group = Ember.Object.extend()
App.Tile = Ember.Object.extend()
App.Surface = Ember.Object.extend()
App.Surface.reopenClass
find: (id)->
App.Surface.create {
groups: [
App.Group.create {
View Assetfile
require 'rake-pipeline-web-filters'
output "public"
class Rake::Pipeline::DSL::PipelineDSL
def production?
ENV['RAKEP_MODE'] == 'production'
end
end
View gist:4183355

Tracking Your Business

You've built (or are maintaining) a product which has many services over different machines at the backend, all orchestrating together to implement one or more business processes. How are you tracking this system?

In general: how can we provide visibility for linear-pipeline distributed systems where a series of processing stages are arranged in succession to perform a specific business function over a data stream (i.e. transaction), and across several machines?

A simple, somewhat crude, example for cross-systems transaction would be an order preparation system in real life, let's say in an electronics factory. During such a workflow, an order entering the processing pipeline goes through each stage defined by the manufacturing floor manager - "planning, provisioning, packing, shipping".

Taking this a bit closer to the Web, we can easily see instances of such transactions, even if we are not always aware we've implemented them that way. A background job is a pipeline, or a transa

View gist:4169817
require 'net/ssh'
Net::SSH.start('localhost', 'jondot', :password => 'foobar') do |ssh|
result = ssh.exec!('ls -l')
puts result
end
View puppy.rb
module MyLibrary
# nasty static variable
BigBallOfMud = { :woofed => 0 }
end
class Puppy
def woof!
puts "woof!"
# for book keeping
MyLibrary::BigBallOfMud[:woofed] += 1
View gist:3486823
Could not send message: send: name or service not known
org/jruby/ext/socket/RubyUDPSocket.java:317:in `send'
/home/jondot/.rbenv/versions/jruby-1.7.0-preview1/lib/ruby/gems/shared/gems/gelf-1.3.2/lib/gelf/ruby_sender.rb:16:in `send_datagrams'
org/jruby/RubyArray.java:1611:in `each'
/home/jondot/.rbenv/versions/jruby-1.7.0-preview1/lib/ruby/gems/shared/gems/gelf-1.3.2/lib/gelf/ruby_sender.rb:15:in `send_datagrams'
/home/jondot/.rbenv/versions/jruby-1.7.0-preview1/lib/ruby/gems/shared/gems/gelf-1.3.2/lib/gelf/notifier.rb:143:in `notify_with_level!'
/home/jondot/.rbenv/versions/jruby-1.7.0-preview1/lib/ruby/gems/shared/gems/gelf-1.3.2/lib/gelf/notifier.rb:118:in `notify!'
/home/jondot/.rbenv/versions/jruby-1.7.0-preview1/lib/ruby/gems/shared/gems/log4r-gelf-0.9.0/lib/log4r-gelf/gelf_outputter.rb:99:in `canonical_log'
/home/jondot/.rbenv/versions/jruby-1.7.0-preview1/lib/ruby/gems/shared/gems/log4r-1.1.10/lib/log4r/outputter/outputter.rb:130:in `synch'
/home/jondot/.rbenv/versions/jruby-1.7.0-preview1/lib/ruby/1
View gist:3327136
require 'sinatra'
require 'eventmachine'
require 'em-http-request'
require 'thin'
get '/' do
r = EventMachine::HttpRequest.new('http://google.com').get
r.callback do