Skip to content

Instantly share code, notes, and snippets.

View dmitriy-kiriyenko's full-sized avatar

Dmitriy Kiriyenko dmitriy-kiriyenko

View GitHub Profile

CoffeeScript Project Structure

One of the great benefits of picking up on Coffee on the 16th of this month, two days ago, has been that the onerous task of establishing a development enviornment was simplified by simply copying the CoffeeScript project structure.

Starting on the 16th, and starting with getting Vows to work for testing and Expresso to work for coverage of JavaScript, I created beautiful literate programming articles using docco which gave me an incredible sense of accomplishment. I created an Node.js executable, created an npm installation,

@stephencelis
stephencelis / redcarpet.rb
Created August 29, 2011 05:54
Redcarpet (Markdown) template handler for Rails 3.1.
# config/initializers/redcarpet.rb
class ActionView::Template
class Redcarpet < Handler
include Handlers::Compilable
def compile template
::Redcarpet.new(template.source).to_html.inspect
end
end
@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.

@ivanacostarubio
ivanacostarubio / software_abstractions.txt
Created May 22, 2012 23:23
Build the right software abstractions.
"Pick the right ones, and programming will flow naturally from design;
modules will have small and simple interfaces; and new functionality will
more likely fit in without extensive reorganization.
Pick the wrong ones, and programming will be a series of nasty surprises:
interfaces will become baroque and clumsy as they are forced to accommodate
unanticipated interactions, and even the simplest of changes will be hard to make."
MIT Professor Daniel Jackson
require 'RMagick'
require 'capybara'
require 'launchy'
module Capybara::Recording
def start_recording
system "rm -f tmp/*"
end
def save_recording
@alvir
alvir / signum.rb
Created October 2, 2013 06:42
Magic signum
def self.percent_by_prices(previous_price, current_price)
return 0 if previous_price.nil? || previous_price.zero?
res = (((current_price.to_f/previous_price.to_f) - 1) * 100).round
res = self.signum(current_price - previous_price) if res.zero?
res
end
def self.signum(number)
case
when number > 0