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
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
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 }
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"
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)
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


cribbed from

Templates to remind you of the options and formatting for the different types of objects you might want to document using YARD.


# Namespace for classes and modules that handle serving documentation over HTTP
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:


start new with session name:

tmux new -s myname
rgreenjr / postgres_queries_and_commands.sql
Last active Oct 17, 2019
Useful PostgreSQL Queries and Commands
View postgres_queries_and_commands.sql
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
View gist:4353170
# basic pfctl control
# ==
# Related:
# Last update: Tue Dec 28, 2004
# ==
# Note:
# this document is only provided as a basic overview
# for some common pfctl commands and is by no means
# a replacement for the pfctl and pf manual pages.
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"
You can’t perform that action at this time.