Skip to content

Instantly share code, notes, and snippets.

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

Hemanth HM hemanth

🐜
🧘‍♂️
View GitHub Profile
@hemanth
hemanth / one-liners.md
Created June 28, 2012 14:38 — forked from KL-7/one-liners.md
Ruby one-liners

One-liners

Reverse every line:

Input file:

$ cat foo
qwe
123

bar

@hemanth
hemanth / gist:3027037
Created July 1, 2012 05:56 — forked from Gregg/gist:968534
Code School Screencasting Framework

Screencasting Framework

The following document is a written account of the Code School screencasting framework. It should be used as a reference of the accompanying screencast on the topic.

Why you should care about screencasting?

You're probably aren't going to take the time to read this document if you're not interested, but there are a lot of nice side effects caused by learning how to create quality screencasts.

  1. Communicating more effectively - At Envy Labs we produce screencasts for our clients all the time. Whether it's demoing a new feature or for a presentation for an invester, they're often much more effective and pleasent than a phone call or screen sharing.
$(function () {
var article_root = $("article");
var search_api = "https://www.googleapis.com/customsearch/v1element";
var apikey = "AIzaSyCVAXiUzRYsML1Pv6RwSG1gunmMikTzQqY";
var cseid = "004387629570218579707:w1sg4iph0mc";
var query = location.hash.match(/^\#q=([^&]+)/)[1];
document.title = "'" + query + "' の検索結果 - 開発な日々";
var result_url = [search_api, "?key=", apikey, "&rsz=large&num=8&cx=", cseid, "&q=", encodeURI(query), "&callback=?"].join("");
$("input[name='q']").val(query);
$.getJSON(result_url, function (data) {
@hemanth
hemanth / gist:3027168
Created July 1, 2012 06:35 — forked from jurka/gist:3027104
Installing supervisor under ubuntu
#run as sudo
apt-get install python-setuptools curl
easy_install supervior
curl https://raw.github.com/gist/176149/88d0d68c4af22a7474ad1d011659ea2d27e35b8d/supervisord.sh > /etc/init.d/supervisord
#to run it
chmod +x /etc/init.d/supervisord
#adding to autostart
@hemanth
hemanth / ebooks.md
Created July 1, 2012 10:27 — forked from roidrage/ebooks.md
Self-published and awesome
@hemanth
hemanth / command.sh
Created July 2, 2012 13:10 — forked from felixge/command.sh
Bash stuff for fighting a weak DOS attack
# Here a few bash one-liners that helped me analyze / fight a weak DOS attack against debuggable.com. Mostly for future reference.
# The attacker was opening lots of tcp connections without sending data, I believe it's called a SYN flood, see: http://tools.ietf.org/html/rfc4987#section-3.2
# Step 0: Check what is going on at port 80
$ netstat -tan | grep ':80 ' | awk '{print $6}' | sort | uniq -c
# Step 1: Increase the number of available fds
$ ulimit -n 32000
# Step 2: Restart your webserver, for me:
@hemanth
hemanth / lismo2vcf.rb
Created July 2, 2012 16:51 — forked from takuya/lismo2vcf.rb
Lismoのアドレス帳をVCFに変換する ref: http://qiita.com/items/a0c921fbef3f94bbbe24
require 'rubygems'
require 'kconv'
require 'csv'
require 'vpim'
$KCODE='u'
#Authors:: takuya_1st
#Copyright:: @takuya_1st
#License:: GPL
class CSV
## CSVファイルを読み込んで一行目を見出し行として、全部をハッシュに読み込む
@hemanth
hemanth / reqUrl.js
Created July 2, 2012 17:06
A function I made that wraps the node http.request function to make it a little more friendly. In my case I am using it for API route testing.
// module dependencies
var http = require('http'),
url = require('url');
/**
* UrlReq - Wraps the http.request function making it nice for unit testing APIs.
*
* @param {string} reqUrl The required url in any form
* @param {object} options An options object (this is optional)
@hemanth
hemanth / gist:3037886
Created July 3, 2012 05:28
Incorrect ES5 fallbacks

Incorrect ES5 fallbacks

Over the weekend I implemented a few Array methods in plain JavaScript to avoid recently patched Rhino bugs. That got my thinking about ES5 fallback implementations in various JavaScript libs/frameworks/transpilers. I decided to compile a not-so-complete list of ES5 related discrepancies found in many of them. Differences in native vs. fallback implementations create cross-browser inconsistencies and increase the chance of usage errors. I hope this post will raise awareness of just how hard it is to follow spec (during my research I found a few issues in my own projects too). All library developers should to take a closer look at their code and make the small changes needed to follow the specification (especially if your code forks for native methods).

Common Issues

Most implementations suffer from the following