Skip to content

Instantly share code, notes, and snippets.

View saranyan's full-sized avatar

Saranyan saranyan

View GitHub Profile
@saranyan
saranyan / README.md
Created July 24, 2012 19:38 — forked from chrisjacob/README.md
How to: GitHub Pages "gh-pages" branch for User & Organization Pages

GitHub Pages "Normal" Setup for User & Organization Pages

Let’s say your GitHub username is “alice”. If you create a GitHub repository named alice.github.com, commit a file named index.html into the master branch, and push it to GitHub, then this file will be automatically published to http://alice.github.com/... The same works for organizations.

Read more here: http://pages.github.com/

However... the downside of this is that anyone that forks this repo won't get it as a GitHub Pages repo when they are working on it... because they have a different GitHub "username" (or "organisation name").

So the trick is to not use a master branch as the documentation tells you... rather, use a gh-pages branch, as you would for your other "Project Pages".

@saranyan
saranyan / Default (Linux).sublime-keymap
Created August 22, 2012 00:29 — forked from coldnebo/Default (Linux).sublime-keymap
simple scripts to prettify your xml and json in sublime text 2
[
{ "keys": ["ctrl+shift+x"], "command": "tidy_xml" },
{ "keys": ["ctrl+shift+j"], "command": "prettify_json" }
]
@saranyan
saranyan / will_paginate_array.rb
Created September 13, 2012 16:17
Extend will paginate for all arrays on your rails project
# config/initializers/will_paginate_array.rb
require 'will_paginate/collection'
Array.class_eval do
attr_reader :total_pages
def paginate(options = {})
raise ArgumentError, "parameter hash expected (got #{options.inspect})" unless Hash === options
WillPaginate::Collection.create(
options[:page] || 1,
@saranyan
saranyan / bootstrap.jade
Created November 13, 2012 17:53 — forked from BenHall/bootstrap.jade
Twitter Bootstrap in Jade
script(src='/javascripts/jquery-1.7.min.js')
link(rel='stylesheet', href='/stylesheets/bootstrap.min.css')
link(rel='stylesheet', href='/stylesheets/bootstrap-overrides.css')
When starting a project that includes refinerycms-blog:
$ rake refinery:override view=refinery/pages/*
$ rake refinery:override view=layouts/*
$ rake refinery:override view=refinery/blog/shared/*
$ rake refinery:override view=refinery/blog/posts/*
$ rake refinery:override view=refinery/*
$ rake refinery:override controller=refinery/blog/*
$ rake refinery:override controller=refinery/*
@saranyan
saranyan / embedgist.js
Last active December 14, 2015 22:09 — forked from soemarko/theme.html
$(document).ready(function() {
$('.gist').each(function(i) {
writeCapture.html(this, '<script src="'+$(this).text()+'.js"></script>');
});
});
# A Ruby implementation of
# the Viterbi algorithm based on the hidden Markov model (HMM)
#
# An original Python code: a Wikipedia page "Viterbi algorithm" at
# http://en.wikipedia.org/wiki/Viterbi_algorithm
#
# Author: MISHIMA, Hiroyuki
#
require 'pp'
# install dependencies
sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y cmake
sudo apt-get install -y libgtk2.0-dev
sudo apt-get install -y pkg-config
sudo apt-get install -y python-numpy python-dev
sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install -y libjpeg-dev libpng-dev libtiff-dev libjasper-dev
var base64map = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
// Global Crypto object
var Crypto = exports.Crypto = {};
// Crypto utilities
var util = Crypto.util = {
// Bit-wise rotate left
rotl: function (n, b) {