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 / jquip.js
Created March 8, 2012 04:20 — forked from mythz/jquip.js
JQuery in parts - a leaner, faster, more modular jQuery
/*
* Smaller, Lighter, Faster, modular jQuery - include only the parts you want, strip the rest!
* inc. 80/20 useful parts of jQuery (rest should be plugins), small enough to drop-in as source.
*
* 7-8x Faster DOM traversal for <= IE7. (i.e. where there's no querySelector)
* Query Limitations:
* Requires an Id (i.e. #) or Tag Name (e.g. INPUT) in each child selector.
*
* Valid Examples:
* - TBODY TD.c1 INPUT
@ravidsrk
ravidsrk / xhr.js
Created March 8, 2012 04:20 — forked from mythz/xhr.js
Standalone jQuery-like Ajax Client
//Adds $.xhr and jQuery-like $.ajax methods to the prescribed namespace.
//Inspired from David Flanagans excellent cross-platform utils http://www.davidflanagan.com/javascript5/display.php?n=20-1&f=20/01.js
//Includes underscore.js _.each and _.extend methods
//modified to behave like jQuery's $.ajax(), not complete.
(function($) {
var win=window, xhrs = [
function () { return new XMLHttpRequest(); },
function () { return new ActiveXObject("Microsoft.XMLHTTP"); },
function () { return new ActiveXObject("MSXML2.XMLHTTP.3.0"); },
function () { return new ActiveXObject("MSXML2.XMLHTTP"); }
@ravidsrk
ravidsrk / xhr.js
Created March 8, 2012 04:20 — forked from mythz/xhr.js
Standalone jQuery-like Ajax Client
//Adds $.xhr and jQuery-like $.ajax methods to the prescribed namespace.
//Inspired from David Flanagans excellent cross-platform utils http://www.davidflanagan.com/javascript5/display.php?n=20-1&f=20/01.js
//Includes underscore.js _.each and _.extend methods
//modified to behave like jQuery's $.ajax(), not complete.
(function($) {
var win=window, xhrs = [
function () { return new XMLHttpRequest(); },
function () { return new ActiveXObject("Microsoft.XMLHTTP"); },
function () { return new ActiveXObject("MSXML2.XMLHTTP.3.0"); },
function () { return new ActiveXObject("MSXML2.XMLHTTP"); }
@ravidsrk
ravidsrk / cash-register-mixin.coffee
Created March 8, 2012 04:23 — forked from mythz/cash-register-mixin.coffee
Rewriting Peep Code app.coffee example
# CoffeeScript With Mixins
$ ->
template = _.templateFor '#meal-template'
meal = new Meal
_.focusOn '#entry'
_.onSumbitOf '#entry_form', ->
meal.add new Dish _.valOf '#entry'
_.setHtmlOf 'ul#meal', template meal.toJSON()
@ravidsrk
ravidsrk / Gemfile
Created March 22, 2012 17:49 — forked from mbleigh/Gemfile
Non-Rails Rackup with Sprockets, Compass, and Twitter Bootstrap
source "https://rubygems.org"
gem 'sprockets'
gem 'sprockets-sass'
gem 'sass'
gem 'compass'
gem 'bootstrap-sass'
@ravidsrk
ravidsrk / gitback.rb
Created March 22, 2012 19:09 — forked from addyosmani/gitback.rb
A little Ruby script for backing up *all* of the repos on your GitHub account with a single command
#gitback 0.1
#usage: sudo ruby gitback.rb
#credits: walter white, minor changes: addy osmani
#!/usr/bin/env ruby
# dependencies
require "yaml"
require "open-uri"
time = Time.new
@ravidsrk
ravidsrk / Readme.md
Created March 29, 2012 12:29
vim documentation
@ravidsrk
ravidsrk / srshti_vim.md
Created March 29, 2012 12:58 — forked from jasim/srshti_vim.md
Shortcuts for VimGet

#Basic Stuff#

##Movements##

  • Goto next word w
  • Goto previous word b
  • Select inner word viw
  • Select the inner block - vi{
  • Go to closing or opening tag - %
@ravidsrk
ravidsrk / hack.sh
Created March 31, 2012 19:47 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
require 'minitest/autorun'
###
# Test to demonstrate TCO in Ruby. Tested in 1.9.2+
class TestTCO < MiniTest::Unit::TestCase
code = <<-eocode
class Facts
def fact_helper(n, res)
if n == 1
res