Skip to content

Instantly share code, notes, and snippets.

Water, earth and air.

Dmitry Polushkin dmitry

Water, earth and air.
View GitHub Profile
hugs / LICENSE
Created Feb 15, 2010
The Node.js "Hello World" web server ported to CoffeeScript
I, Jason Huggins, the author of the work "CoffeeScript Web Server" (2010), irrevocably renounce
all current and future legal rights to the work in any medium whatsoever.
I stand behind the merit of the work, but disclaim all liability for it under law.
I encourage you, the audience, to share, copy, distribute, perform, remix, mash up, interpret,
excerpt, translate, and otherwise enjoy and use the work as you will.
I request that you acknowledge my authorship.
View gist:361416
class BaseTask
def self.perform(*args)
class SomeTask < BaseTask
def self.perform(*args)
# do some stuff
njvitto / deploy.rake
Created Apr 11, 2010 — forked from RSpace/deploy.rake
Rakefile to deploy and rollback to Heroku in two different environments (staging and production) for the same app
View deploy.rake
#Deploy and rollback on Heroku in staging and production
task :deploy_staging => ['deploy:set_staging_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
task :deploy_production => ['deploy:set_production_app', 'deploy:push', 'deploy:restart', 'deploy:tag']
namespace :deploy do
task :staging_migrations => [:set_staging_app, :push, :off, :migrate, :restart, :on, :tag]
task :staging_rollback => [:set_staging_app, :off, :push_previous, :restart, :on]
View gist:480277
#encoding: utf-8
require 'mechanize'
class MechanizeEncodingHook
def call(params)
return if params[:response].nil? || params[:response_body].nil?
response = params[:response]
content_type = response['Content-Type']
View Fancy File Inputs.js
var SITE = SITE || {};
SITE.fileInputs = function() {
var $this = $(this),
$val = $this.val(),
valArray = $val.split('\\'),
newVal = valArray[valArray.length-1],
$button = $this.siblings('.button'),
$fakeFile = $this.siblings('.file-holder');
if(newVal !== '') {
shripadk / gist:652819
Created Oct 29, 2010
Express authentication using Redis for session store and Couchdb for database (in coffeescript!)
View gist:652819
Module dependencies
require.paths.unshift "#{__dirname}/lib/support/express-csrf/"
require.paths.unshift "#{__dirname}/lib/support/node_hash/lib/"
express = require 'express'
app = module.exports = express.createServer()
RedisStore = require 'connect-redis'
nragaz / rails.history.js
Created Jan 16, 2011
Add callbacks to remote links in Rails to manage browser history using pageState and replaceState
View rails.history.js
function historySupport() {
return !!(window.history && window.history.pushState !== undefined);
function pushPageState(state, title, href) {
if (historySupport()) {
history.pushState(state, title, href);
yuya-takeyama / binarytree.rb
Created Feb 5, 2011
Binary Tree implemented in Ruby.
View binarytree.rb
module BinaryTree
class Node
attr_reader :word, :count, :left, :right
include Enumerable
def initialize(word)
@word, @count = word, 1
nu7hatch / app.rb
Created Apr 21, 2011
OmniAuth login in popup
View app.rb
require 'rubygems'
require 'sinatra'
require 'omniauth/oauth'
set :sessions, true
set :layout, true
use OmniAuth::Builder do
provider :twitter, 'key', 'secret'
jamiew / eventmachine url expansion tests.rb
Created May 13, 2011
Noodling with different ways of expanding short URLs in bulk
View eventmachine url expansion tests.rb
require 'rubygems'
require 'benchmark'
require 'pp'
require 'mechanize'
require 'eventmachine'
require 'em-http-request'
def syncronous(urls)
agent =
expanded_urls ={|url|