Skip to content

Instantly share code, notes, and snippets.

View vishaltelangre's full-sized avatar

Vishal Telangre vishaltelangre

View GitHub Profile
@tcr
tcr / gist:4446743
Last active December 10, 2015 14:19
List a user's Github repos using Rem.
// npm install rem read
var rem = require('rem')
, read = require('read');
var github = rem.connect('github.com', 3.0)
read({ prompt: 'Username: '}, function (err, username) {
github('users', username, 'repos').get(function (err, repos) {
console.log(repos);
});
@jakeonrails
jakeonrails / Ruby Notepad Bookmarklet
Created January 29, 2013 18:08
This bookmarklet gives you a code editor in your browser with a single click.
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
@vishaltelangre
vishaltelangre / rails_installation_on_ubuntu.sh
Last active December 13, 2015 18:08
Installs Ruby on Rails on Ubuntu (for lazy people like me) + Zsh (w/ oh-my-zsh) + Sublime Text 2
sudo apt-get update &&
sudo apt-get install build-essential git-core curl zsh &&
sudo chsh -s /bin/zsh &&
curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh &&
curl -L get.rvm.io | bash -s stable &&
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"' | \
tee -a ~/.zshrc ~/.bashrc &&
. ~/.zshrc && . ~/.bashrc &&
sudo apt-get install build-essential openssl libreadline6 libreadline6-dev fortune \
curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 \
@artagnon
artagnon / claytext.rb
Created February 17, 2013 17:06
A part of claytext.rb from artagnon/clayoven
def process!(body)
htmlescape_rules = {
"&" => "&amp;",
"\"" => "&quot;",
"'" => "&#39;",
"<" => "&lt;",
">" => "&gt;"
}.freeze
paragraph_types = [:plain, :emailquote, :codeblock, :header, :footer]
@SlexAxton
SlexAxton / .zshrc
Last active June 6, 2025 19:18
My gif workflow
gifify() {
if [[ -n "$1" ]]; then
if [[ $2 == '--good' ]]; then
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif
rm out-static*.png
else
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
fi
else
@vishaltelangre
vishaltelangre / auto_install_sublime_packages.markdown
Last active May 24, 2021 15:15
[Automate Packages Installation in Sublime Text 2] -- Automatically install Sublime Text 2 packages (some necessary ones, w/o fucking crap ones which makes sublime alike hell!)
  • To install packages, every time pressing ' ctrl+shift+pPackage Control: Install Package is very cumbersome task... right?

  • After fresh installation of ST2, open it and ctrl+` and hit enter after pasting below line [(1)][1]:

  import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print('Please restart Sublime Text to finish installation')
  • Restart ST2.

  • Open terminal, and navigate to Sublime's dir under your home folder by below command and create file w/ name Package Control.sublime-settings there in:

@tcr
tcr / gist:5108489
Created March 7, 2013 14:42
Testing Twitter official API keys
// npm install rem read
var rem = require('rem')
, fs = require('fs')
, read = require('read');
var tw = rem.connect('twitter.com', '1.1')
, oauth = rem.oauth(tw);
// Add whichever API keys you want to test here.
// Including the iPhone/Android apps, these keys are configured as "desktop"
@nightire
nightire / Changes in Rails 4_1.md
Last active September 28, 2025 09:55
拥抱 Rails 4 —— 详述 Rails 4 的新变化

Routes

小心地使用 Match(Rails 3 已实现)

Rails 3 提供了 match 方法供我们自定义 routes,然而我们要小心使用它以避免“跨站脚本攻击”(XSS Attack)。比如像这样的 routes:

注:(r3 代表 Rails 3,r4 代表 Rails 4)

# routes.rb
@h3h
h3h / 0-resume-template.md
Last active July 28, 2016 13:07
Ideal Resume Format for a Software Engineer

https://github.com/[yourname]

Ambition

[Describe ambitions: type of work, attributes of team, what you want to learn & teach]

Experience

[in reverse chronological order, list at most 5 positions or 10 years back, whichever is fewer]

# $("form:not([data-remote])").preventDoubleSubmit()
# http://henrik.nyh.se/2008/07/jquery-double-submission/
$ = jQuery
$.fn.preventDoubleSubmit = ->
ESC_KEYCODE = 27
form = this[0]
# Unprevent on ESC.