Skip to content

Instantly share code, notes, and snippets.

View vishaltelangre's full-sized avatar

Vishal Telangre vishaltelangre

View GitHub Profile
@artagnon
artagnon / claytext.rb
Created February 17, 2013 17:06
A part of claytext.rb from artagnon/clayoven
def process!(body)
htmlescape_rules = {
"&" => "&",
"\"" => """,
"'" => "'",
"<" => "&lt;",
">" => "&gt;"
}.freeze
paragraph_types = [:plain, :emailquote, :codeblock, :header, :footer]
@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 \
@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>
@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);
});
# See http://m.onkey.org/running-rails-performance-tests-on-real-data
# fixed to work with Rails 3.2.8
# START : HAX HAX HAX
# Load Rails environment in 'test' mode
RAILS_ENV = "test"
require File.expand_path('../../config/environment', __FILE__)
# Re-establish db connection for 'performance' mode
silence_warnings { RAILS_ENV = "performance" }
@paulirish
paulirish / gist:4158604
Created November 28, 2012 02:08
Learn JavaScript concepts with recent DevTools features

Learn JavaScript concepts with the Chrome DevTools

Authored by Peter Rybin , Chrome DevTools team

In this short guide we'll review some new Chrome DevTools features for "function scope" and "internal properties" by exploring some base JavaScript language concepts.

Closures

Let's start with closures – one of the most famous things in JS. A closure is a function, that uses variables from outside. See an example:

@arvearve
arvearve / gist:4158578
Created November 28, 2012 02:01
Mathematics: What do grad students in math do all day?

Mathematics: What do grad students in math do all day?

by Yasha Berchenko-Kogan

A lot of math grad school is reading books and papers and trying to understand what's going on. The difficulty is that reading math is not like reading a mystery thriller, and it's not even like reading a history book or a New York Times article.

The main issue is that, by the time you get to the frontiers of math, the words to describe the concepts don't really exist yet. Communicating these ideas is a bit like trying to explain a vacuum cleaner to someone who has never seen one, except you're only allowed to use words that are four letters long or shorter.

What can you say?

@Foredoomed
Foredoomed / Leiningen.sublime-build
Created November 18, 2012 04:31
Leiningen.sublime-build
# Copy the following and place it a file called Leiningen.sublime-build in the Sublime user packages folder (~/.config/sublime-text-2/Packages/User on Linux).
# Select this as the build system for the project using Tools/Build System/Leiningen.
# You can then bring up the Sublime Command Palette (ctrl+shift+P on Windows/Linux) and issue any of the commands # (build, documentation, clean, run, test, etc). By default, build is bound to ctrl+b and run to ctrl+shift+b.
{
"cmd": ["lein", "compile", ":all"],
"working_dir": "$project_path",
"variants": [
{ "cmd": ["lein", "marg", "-m", "-d", "docs"],
@tcr
tcr / summary.md
Created October 25, 2012 15:56
How do you use a different DNS entry per domain name in OS X?

Use /etc/resolver. For instance, to change the DNS servers for irc.freenode.net, create the file

/etc/resolver/irc.freenode.net

And set its contents to

nameserver 8.8.8.8

nameserver 8.8.4.4

@seratch
seratch / config.yml
Created October 25, 2012 09:37
AWS SQS Example
access_key_id: xxx
secret_access_key: yyy