Skip to content

Instantly share code, notes, and snippets.

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

Hemanth HM hemanth

🐜
🧘‍♂️
View GitHub Profile
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 / 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 }
@hemanth
hemanth / ebooks.md
Created July 8, 2012 12:02 — forked from roidrage/ebooks.md
Self-published and awesome
@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 / 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 / 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 / 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

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 / KnockoutSessionLinks.md
Created July 12, 2012 08:56 — forked from endeepak/KnockoutSessionLinks.md
Knockout Session Links
@hemanth
hemanth / gist:3098203
Created July 12, 2012 13:48 — forked from rmurphey/gist:3086328
What's wrong with Netmag's "Optimize your JavaScript" post

What's wrong with Netmag's "Optimize your JavaScript" post

Update: The original post on Netmag has been updated since this was written.

I tweeted earlier that this should be retracted. Generally, these performance-related articles are essentially little more than linkbait -- there are perhaps an infinite number of things you should do to improve a page's performance before worrying about the purported perf hit of multiplication vs. division -- but this post went further than most in this genre: it offered patently inaccurate and misleading advice.

Here are a few examples, assembled by some people who actually know what they're talking about (largely Rick Waldron and Ben Alman, with some help from myself and several others from the place that shall be unnamed).

Things that are just plain wrong