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 / 0_usage.scss
Created April 13, 2012 16:19 — forked from chriseppstein/0_usage.scss
This is code that runs using Sass 3.2 prerelease and something like this will be in compass soon.
@include keyframes(appear-and-roundify) {
0% { opacity: 0; @include border-radius(2px); }
100% { opacity: 1; @include border-radius(10px); }
}
@ravidsrk
ravidsrk / uri.js
Created April 23, 2012 18:39 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@ravidsrk
ravidsrk / tree.md
Created April 24, 2012 04:07 — forked from hrldcpr/tree.md
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@ravidsrk
ravidsrk / .htaccess
Created April 27, 2012 18:02 — forked from bunnymatic/.htaccess
javascript regex tester
Options -Indexes
@ravidsrk
ravidsrk / jasmine-spies-tutorial.js
Created May 9, 2012 10:39
Example Code for understanding the functionality of Jasmine's Spies
define( "spec/pages/setup.test.spec", [],
function() {
describe( 'spy testing', function() {
// the function to spy on
var enemy = function(){};
//method that the function will do
@ravidsrk
ravidsrk / backbone-tutorial.js
Created May 10, 2012 18:43 — forked from jacob414/backbone-tutorial.js
Minimal example of data handling in Backbone.js
/* Scaled-down Backbone.js demonstration
* By Jacob Oscarson (http://twitter.com/jacob414), 2010
* MIT Licenced, see http://www.opensource.org/licenses/mit-license.php */
$(function() {
window.ulog = function(msg) { $('#log').append($('<div>'+msg+'</div>')); }
// Faking a little bit of Backbone.sync functionallity
Backbone.sync = function(method, model, succeeded) {
ulog('<strong>'+method + ":</strong> " + model.get('label'));
if(typeof model.cid != 'undefined') {
@ravidsrk
ravidsrk / bashrc.sh
Created May 15, 2012 04:39
make git prompt more useful
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[0;34m\]"
LIGHT_RED="\[\033[1;31m\]"
LIGHT_GREEN="\[\033[1;32m\]"
WHITE="\[\033[1;37m\]"
LIGHT_GRAY="\[\033[0;37m\]"
COLOR_NONE="\[\e[0m\]"
@ravidsrk
ravidsrk / app.js
Created June 2, 2012 15:25 — forked from dawsontoth/app.js
CSS Injection on External Websites using Appcelerator Titanium
// create our web view
var win = Ti.UI.createWindow({ backgroundColor: "#fff" });
var web = Ti.UI.createWebView({ url: "http://chicago.craigslist.org/" });
// inject our css when the web view finishes loading (because we need to inject into the head element)
web.addEventListener('load', function () {
// first, specify the CSS file that we should load
var cssFileName = 'styles.css';
// read in the contents
var cssFromFile = Ti.Filesystem.getFile(cssFileName);
@ravidsrk
ravidsrk / gist:2906674
Created June 10, 2012 17:19 — forked from ywatai/gist:1964983
Octpress on github pages: setup
% rbenv install 1.9.2-p290
% rbenv rehash
% git clone https://github.com/imathis/octopress.git
% cd octopress
% rbenv local 1.9.2-p290
% ruby -v
% gem install bundler
% bundle install
@ravidsrk
ravidsrk / gist:3081784
Created July 10, 2012 07:23 — forked from paullewis/gist:1982121
Mergesort in JavaScript
/**
* An implementation for Mergesort. Less efficient
* than Quicksort. Again, you'd just use Array.sort
* but if you found yourself unable to use that
* there's always this option.
*
* Tests with:
*
* var array = [];
* for(var i = 0; i < 20; i++) {