Skip to content

Instantly share code, notes, and snippets.

View utkarshkukreti's full-sized avatar

Utkarsh Kukreti utkarshkukreti

View GitHub Profile
@timcheadle
timcheadle / nivo-slider.css
Created June 3, 2011 14:15
Nivo Slider Image Advance on Click
.slider {
cursor: pointer;
}
.nivo-directionNav a {
position:absolute;
top:45%;
z-index:9;
cursor:pointer;
display: none;
require 'benchmark'
class Simple
attr_accessor :next
end
def current_mem
`ps -o "%mem rss" -p #{$$}`.split("\n").last.split(/\s+/)[1..-1]
end
@kn0ll
kn0ll / bookmarklet.js
Created June 11, 2011 04:31
advanced bookmarklet template
javascript:(function() {
if(!window.your_bookmarklet) {
var doc = document,
js = doc.createElement('script');
js.type = 'text/javascript';
js.src = 'loader.js';
js.async = true;
pry(RubyVM::InstructionSequence):2> ls -m
[:allocate, :compile, :compile_file, :compile_option, :compile_option=, :disasm, :disassemble, :new, :superclass, :yaml_tag_subclasses?]
pry(RubyVM::InstructionSequence):2> compile("puts 'hello'")
=> <RubyVM::InstructionSequence:<compiled>@<compiled>>
pry(RubyVM::InstructionSequence):2> compile("puts 'hello'g")
<compiled>:1: syntax error, unexpected tIDENTIFIER, expecting $end
puts 'hello'g
^
SyntaxError: compile error
from (pry):7:in `compile'
@mrrooijen
mrrooijen / deploy.rb
Created June 26, 2011 02:37
Capistrano with Foreman Capfile
# encoding: utf-8
$:.unshift(File.expand_path('./lib', ENV['rvm_path']))
require 'rvm/capistrano'
set :application, "hirefireapp"
set :repository, "git@codeplane.com:meskyanichi/myapp.git"
set :branch, "develop"
set :rvm_ruby_string, "1.9.2"
@gesteves
gesteves / gist:1051628
Created June 28, 2011 17:13
Google Apps script to export Google Talk chat logs to a Google Docs spreadsheet
/*
Quick instructions:
1. Go to Google Docs and open a new spreadsheet.
2. Go to Tools > Script editor...
3. Delete everything, paste this code in the script editor, and save it.
4. Go back to the spreadsheet, Tools > Script manager...
5. Select getChats, and press the "run" button.
6. It'll ask for a bunch of authorizations. Grant them.
7. When it says "now you can run the script", repeat step 5.
@leegao
leegao / Rationale.md
Created July 9, 2011 02:30
JIT for dummies: JIT compiling RPN in python

If you don't care about the explanation, scroll down to find the code, it's 50 some odd lines and written by someone who doesn't know any better. You have been warned.

What it does

This is a very simple proof of concept jitting RPN calculator implemented in python. Basically, it takes the source code, tokenizes it via whitespace, and asks itself one simple question: am I looking at a number or not?

First, let's talk about the underlying program flow. Pretend that you are a shoe connoisseur with a tiny desk. You may only have two individual shoes on that desk at any one time, but should you ever purchase a new one or get harassed by an unruly shoe salesman without realizing that you have the power to say no (or even maybe?), you can always sweep aside one of the two shoes on the desk (the one on the right, because you're a lefty and you feel that the left side is always superior) onto the messy floor, put the other shoe on the right hand side, and then place your newly acquired shoe in

@zliuva
zliuva / gist:1084476
Last active July 31, 2023 21:32
A minimal Mach-o x64 executable for OS X
; A minimal Mach-o x64 executable for OS X (also see below Mountain Lion version)
;
; $ nasm -f bin -o tiny_hello tiny_hello.s
; $ chmod +x tiny_hello
; $ ./tiny_hello
; Hello World!
; $
; c.f.
; http://osxbook.com/blog/2009/03/15/crafting-a-tiny-mach-o-executable/ ( the original tiny mach-o executable )
@coop
coop / Deploy
Created August 2, 2011 22:55
Deploy to S3 - Asset Pipeline, S3 and Heroku
namespace :deploy do
desc "Deploy to Heroku"
task :heroku do
Rake::Task["deploy:precompile_assets_and_upload_to_s3"].invoke
Rake::Task["deploy:push_heroku"].invoke
end
desc "Precompile assets and upload to s3"
task :precompile_assets_and_upload_to_s3 do
storage = Fog::Storage.new :provider => 'AWS', :aws_access_key_id => "123", :aws_secret_access_key => "123"
@fogus
fogus / about.md
Created August 11, 2011 00:28 — forked from jasonrudolph/about.md
Programming Achievements: How to Level Up as a Developer