Skip to content

Instantly share code, notes, and snippets.

View ravidsrk's full-sized avatar
🎯
Focusing

Ravindra Kumar ravidsrk

🎯
Focusing
View GitHub Profile
@ravidsrk
ravidsrk / file.php
Created January 28, 2012 15:38
PHP Date difference in Days
<?php
function dateDiff($start, $end) {
$start_ts = strtotime($start);
$end_ts = strtotime($end);
$diff = $end_ts - $start_ts;
return round($diff / 86400);
}
@ravidsrk
ravidsrk / rbenv-install-system-wide.sh
Created January 31, 2012 09:17
rbenv install and system wide install on Ubuntu 10.04 LTS.
# Update, upgrade and install development tools:
apt-get update
apt-get -y upgrade
apt-get -y install build-essential
apt-get -y install git-core
# Install rbenv
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv
# Add rbenv to the path:
@ravidsrk
ravidsrk / 0-readme.md
Created February 4, 2012 04:14 — forked from burke/0-readme.md
ruby-1.9.3-p0 cumulative performance patch.

Patched ruby 1.9.3-p0 for 30% faster rails boot

What is?

This script installs a patched version of ruby 1.9.3-p0 with patches to make ruby-debug work again (#47) and boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84).

Huge thanks to funny-falcon for the performance patches.

For those folks not already hanging out in #documentcloud... here's the log of this afternoon's Ember/Backbone politics discussion.
12:21 PM <wycats> jashkenas: hey
12:21 PM <wycats> jashkenas: I'm sorry
12:21 PM <wycats> how would you like me to describe backbone?
12:21 PM <wycats> let's work this out for once and for all :)
12:21 PM <wycats> I'm definitely not intentionally saying incorrect things about backbone
12:22 PM • knowtheory gets out popcorn
12:24 PM <jashkenas> don't worry about it too much -- I'm just not terribly pleased with backbone being continued to be used as the strawman...
12:24 PM <wycats> jashkenas: I am worried about it a lot
@ravidsrk
ravidsrk / bootstrap-plugins.txt
Created February 8, 2012 06:02 — forked from mklabs/bootstrap-plugins.txt
h5bp + twitter bootstrap integration
bootstrap-tooltip.js
bootstrap-popover.js
bootstrap-alert.js
bootstrap-button.js
bootstrap-carousel.js
bootstrap-collapse.js
bootstrap-dropdown.js
bootstrap-modal.js
bootstrap-scrollspy.js
bootstrap-tab.js
module Sass::Script::Functions
def user_color
sass_user_color = Sass::Script::String.new(options[:custom][:user].color, :string)
assert_type sass_user_color, :String
Sass::Script::String.new("##{sass_user_color.value}")
end
end
@ravidsrk
ravidsrk / documentReady.js
Created February 23, 2012 17:15 — forked from addyosmani/documentReady.js
documentReady
/*
* documentReady.js - a cross-browser jQuery core based DOMContentLoaded solution
* Released under an MIT license
* Portions: jQuery project, Diego Perini, Lucent M.
* This version: Addy Osmani, 2012
*/
/*
* Usage:
documentReady(function(){
@ravidsrk
ravidsrk / LICENSE.txt
Created February 23, 2012 17:27 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@ravidsrk
ravidsrk / config.ru
Created March 1, 2012 17:01
Rails Lightweight Stack. Most of this is detailed on Crafting Rails Applications - http://pragprog.com/book/jvrails/crafting-rails-applications
# Run this file with `RAILS_ENV=production rackup -p 3000 -s thin`
# Be sure to have rails and thin installed.
require "rubygems"
# We are not loading Active Record, nor the Assets Pipeline, etc.
# This could also be in your Gemfile.
gem "actionpack", "~> 3.2"
gem "railties", "~> 3.2"
require "rails"
@ravidsrk
ravidsrk / cash-register-types.coffee
Created March 8, 2012 04:16 — forked from mythz/cash-register-types.coffee
Cash Register classes in CoffeeScript and Javascript
class Dish
constructor: (rawDescription="") ->
[all, @title, @price] = @parseRawDescription rawDescription
@price = new Money @price
parseRawDescription: (rawDescription) ->
pattern = ///
([^$]+) #Title
(\$\d+\.\d+) #Price
///