Skip to content

Instantly share code, notes, and snippets.

avinasha / css_transformer.rb
Created Jul 29, 2011
A Sanitize gem transformer which sanitizes any CSS in a HTML document.
View css_transformer.rb
check_css = lambda { |env|
node = env[:node]
node_name = env[:node_name]
# Don't continue if this node is already whitelisted or is not an element.
return if env[:is_whitelisted] || !node.element?
parent = node.parent
return unless node_name == 'style' || node['style']
if node_name == 'style'
unless good_css? node.content
avinasha /
Created Aug 16, 2011 — forked from blaix/
Programming Achievements: How to Level Up as a Developer

Programming Achievements: How to Level Up as a Developer

  1. Select a particular experience to pursue.
  2. Pursue that experience to completion. (Achievement unlocked!)
  3. Reflect on that experience. Really soak it in. Maybe a blog post would be in order?
  4. Return to Step 1, this time selecting a new experience.

This gist is a fork of the gist from this blog post.

avinasha /
Created Aug 16, 2011 — forked from catwell/
Programming Achievements: How to Level Up as a Developer
View cucumber_external_resque_worker.rb
class CucumberExternalResqueWorker
COUNTER_KEY = "cucumber:counter"
class << self
attr_accessor :pid, :startup_timeout
def start
# Call from a Cucumber support file so it is run on startup
return unless Rails.env.cucumber?
View supportbee_form.html
Add the following code block with the correct options to embed SupportBee in any website
<script src="" type="text/javascript"></script>
var sb_form = SupportBee.Form.initialize({
company: 'techfolder',
height: '400px',
base_domain: '',
position: 'bottom'
avinasha / Gemfile
Created Jul 18, 2012
Platform dependent gems
View Gemfile
group :production, :test, :cucumber, :staging do
gem 'rb-inotify', :require => false
group :test, :development, :cucumber do
gem 'rb-fsevent', :require => false
View simple_billing_methods.rb
def active?
not (expired? or exceeds_ticket_volume?)
def expired?
expiry <
avinasha / _config.yml
Created Aug 29, 2012
Deploying Jekyll Bootstrap using Capistrano
View _config.yml
JB :
version : 0.2.13
provider: custom
View elasticsearch.rake
# Run with: rake environment elasticsearch:reindex
# Begins by creating the index using tire:import command
# This will create the "official" index name, e.g. "person" each time.
# Then we rename it to, e.g. "person20121001" and alias "person" to it.
namespace :elasticsearch do
desc "re-index elasticsearch"
task :reindex => :environment do
klasses = [Ticket]
avinasha /
Created Aug 13, 2013
Learning Functional Programming; How can I use in ruby?


lambda calculus

  • Alonso Church
  • Formalization of computation.
  • Similar to Turing machine

implementation of lambda calculus on von Neumann computer is LISP

FP is a sub set of what lambda calculus says