Skip to content

Instantly share code, notes, and snippets.

View hemanth's full-sized avatar
🐜
🧘‍♂️

Hemanth HM hemanth

🐜
🧘‍♂️
View GitHub Profile
@hemanth
hemanth / KnockoutSessionLinks.md
Created July 12, 2012 08:56 — forked from endeepak/KnockoutSessionLinks.md
Knockout Session Links

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

@hemanth
hemanth / hn_email.rb
Created July 10, 2012 05:04 — forked from jessex/hn_email.rb
Hacker News to Email
#!/usr/local/bin/ruby -rubygems
require 'open-uri'
require 'json'
require 'pony'
class Headline
def initialize(title, title_url, points,
comments, comments_url, time, time_units)
@title = title
@hemanth
hemanth / linkedin_parse.rb
Created July 10, 2012 05:03 — forked from tomdepplito/linkedin_parse.rb
Linkedin Parsing Example
require 'oauth'
require 'launchy'
require 'nokogiri'
class User
def authenticate(consumer_key, consumer_secret, site)
consumer = OAuth::Consumer.new(consumer_key, consumer_secret, site)
request_token = consumer.get_request_token
puts "Authorize Follower and then paste in the PIN:"
@hemanth
hemanth / gist:3070694
Created July 8, 2012 12:22
Creating a shared Python virtual environment

Creating a shared Python virtual environment

Install virtualenv/virtualwrapper:

sudo easy_install pip
sudo pip install virtualenvwrapper

Create a venv for libs you want to reuse in other venvs:

@hemanth
hemanth / gist:3070671
Created July 8, 2012 12:09 — forked from tomohiro/gist:1234076
Start Ruby project

Start Ruby project

Plain project

$ mkdir awesome_project
@hemanth
hemanth / ebooks.md
Created July 8, 2012 12:02 — forked from roidrage/ebooks.md
Self-published and awesome
@hemanth
hemanth / spark.rb
Created July 8, 2012 11:51 — forked from jcromartie/spark.rb
Sparklines in Ruby
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
# prints a sparkline in the terminal using the supplied list of numbers
# examples:
# spark.rb 10 20 30 100 90 80
# spark.rb 1 2 0.4 0.1 1.3 0.7
@ticks = %w[▁ ▂ ▃ ▄ ▅ ▆ ▇]
values = ARGV.map { |x| x.to_f }
var http = require('http'),
router = new require('routes').Router();
// route response function
var test = function(req, res, params, splats) {
// everything is undefined here... wtf?
console.log(req);
console.log(res);
console.log(params);
console.log(splats);
@hemanth
hemanth / angryorigin.py
Created July 8, 2012 08:16
Angry Origin - because cross origin requests are for wimps
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from SocketServer import ThreadingMixIn
import threading
import requests
class Handler(BaseHTTPRequestHandler):
def __init__(self, request, client_address, server):
print "Init!"
self.protocol_version = 'HTTP/1.1'
BaseHTTPRequestHandler.__init__(self, request, client_address, server) #http://www.mlsite.net/blog/?p=80