Skip to content

Instantly share code, notes, and snippets.

nhm tanveer hossain khan (hasan) we4tech

Block or report user

Report or block we4tech

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
mvidaurre / fibo_tail_recursion.rb
Created Apr 17, 2014
Calculate the nth Fibonacci number, f(n). Using invariants for
View fibo_tail_recursion.rb
# Calculate the nth Fibonacci number, f(n). Using invariants
def fibo_tr(n, acc1, acc2)
if n == 0
elsif n < 2
return fibo_tr(n - 1, acc2, acc2 + acc1)
reidmorrison / collection.rb
Last active Sep 28, 2015
Mongo Reconnect logic for Connection Failures. Deprecated, moved to:
View collection.rb
# NOTE: This gist is now deprecated and has been moved into a gem:
require 'mongo/collection'
module Mongo
class Collection
alias_method :find_one_original, :find_one
def find_one(*args)
dqminh / applause_formatter.rb
Last active Dec 18, 2015
rspec formatter that applause you when your tests pass
View applause_formatter.rb
require "rspec/core/formatters/progress_formatter"
class ApplauseFormatter < RSpec::Core::Formatters::ProgressFormatter
def initialize(output)
unless File.exists? "/tmp/applause.mp3"
p "Downloading applause for awesomeness"
system "wget -O /tmp/applause.mp3"
mrrooijen / deploy.rb
Created Jun 26, 2011
Capistrano with Foreman Capfile
View deploy.rb
# encoding: utf-8
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require 'rvm/capistrano'
set :application, "hirefireapp"
set :repository, ""
set :branch, "develop"
set :rvm_ruby_string, "1.9.2"
lox /
Last active May 15, 2016
Grout - A golang based routing front proxy


Grout is an HTTP-based front proxy that delegates portions of a url path space to other web applications. This allows for a web application to be composed of a collection of micro-services.

Beyond routing based on url, language or ip-based region, Grout provides downstream services with a unique per-request X-Grout-Id and a per-session X-Grout-Session header for simple cross-service sessions.


Presently is composed of 2-3 different web applications. Varnish sits in front of these web applications and dispatches requests to the appropriate backend based on some complicated regular expressions and a large chunk of complicated VCL.

wxmn / embedded_documents.rb
Created Nov 6, 2010
Examples of Atomic Operations on Embedded Documents in MongoMapper
View embedded_documents.rb
#Stories are embedded docs in a Feed
class Feed
include MongoMapper::Document
many :stories
class Story
include MongoMapper::EmbeddedDocument
key :title, String
surjikal /
Last active Mar 24, 2017
Prediction IO Install Notes on Ubuntu Precise (12.04)
clay-whitley /
Last active Apr 5, 2017
km-export-processor Documentation

km-export-processor gem

The purpose of this gem is to consume the JSON that KISSmetrics exports to an S3 bucket, and transform it in a variety of useful ways.

The core features are:

  • JSON compiler : Aggregates all KISSmetrics JSON files in a directory, into a single (nonstandard) file.
  • JSON to JSON converter : Converts a nonstandard JSON file into standard format.
  • JSON to CSV converter : Converts a nonstandard JSON file into a CSV file, where each row is an event/property/alias.
  • Reimporter : Takes a nonstandard JSON file, and an API key, and sends the data in the JSON file to the product using the KMTS gem.
5v3n / spec_helper.rb
Created Apr 13, 2011
in order to make spork reload routes & any rb file in the app folder:
View spec_helper.rb
Spork.each_run do
load "#{Rails.root}/config/routes.rb"
Dir["#{Rails.root}/app/**/*.rb"].each { |f| load f }
hisea / nginx
Created Jan 1, 2012
ubuntu passenger nginx init.d script
View nginx
sudo cp nginx /etc/init.d/
sudo update-rc.d nginx defaults
sudo chmod +x /etc/init.d/nginx
/etc/init.d/nginx start
You can’t perform that action at this time.