Skip to content

Instantly share code, notes, and snippets.

Amitesh Kumar Amitesh

Block or report user

Report or block Amitesh

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
Amitesh / question_render.js
Created Apr 20, 2015
View question_render.js
* Module for QHash Application
* @author : Amitesh Kumar
window.QHash = window.QHash || {};
( function ( QHash ) {
* Answer Model
Amitesh / click-toggle.js
Created May 6, 2015
Click Toggle jQuery Plugin
View click-toggle.js
(function($) {
$.fn.clickToggle = function(func1, func2) {
var funcs = [func1, func2];'toggleclicked', 0); {
var data = $(this).data();
var tc = data.toggleclicked;
$.proxy(funcs[tc], this)();
data.toggleclicked = (tc + 1) % 2;
Amitesh / color-console-messages.js
Last active Aug 29, 2015
Color console messages in chrome and firefox
View color-console-messages.js
console.log('%cHello world', 'font-size:100px;color:#fff;text-shadow:0 1px 0 #ccc,0 2px 0 #c9c9c9,0 3px 0 #bbb,0 4px 0 #b9b9b9,0 5px 0 #aaa,0 6px 1px rgba(0,0,0,.1),0 0 5px rgba(0,0,0,.1),0 1px 3px rgba(0,0,0,.3),0 3px 5px rgba(0,0,0,.2),0 5px 10px rgba(0,0,0,.25),0 10px 10px rgba(0,0,0,.2),0 20px 20px rgba(0,0,0,.15);');
Amitesh / table.css
Last active Aug 29, 2015
Table Sorting, Filtering - Fixed the empty cell filtering issue
View table.css
/* Striping */
tr.alternate {
/* Sorting */
th.table-sortable {
background-position:center left;
Amitesh / gist:1022715
Created Jun 13, 2011
Get hash of a model object
View gist:1022715
# For Ruby on Rails
# It will give hash of given model object
# Another way to get hash of a model object
For MultiJson issue use
Amitesh / gist:1024607
Created Jun 14, 2011
request forgery protection in Rails
View gist:1024607
# While using curl post call then disable request forgery protection
# For get method call, It skips the check
# Reference :
class XyzController < ApplicationController
skip_before_filter :verify_authenticity_token, :only => [:update]
before_filter :authenticate_user!, :only => [:update, :index]
Amitesh / gist:1037742
Created Jun 21, 2011
Resources/Likns to create Rails 3 Engine
View gist:1037742
Amitesh / gist:1039620
Created Jun 22, 2011 — forked from arnabc/gitosis-repo-creation
Gitosis repo creation ( it assumes that you have a working gitosis repository in a central server and have the permission to create new repositories)
View gist:1039620
Add repo in local gitosis-admin/gitosis.conf
~$ mkdir your_repo_name
~$ cd your_repo_name
~$ git init
~$ git remote add origin git@YOUR_SERVER_HOSTNAME:your_repo_name.git
# do some work, git add and commit files
~$ git add .
~$ git commit -m 'Your Message'
Amitesh / gist:1046278
Created Jun 25, 2011
Set the simple-navigation file path of a Rails Engine app to auto load path of Rails 3 Main App
View gist:1046278
require "rails"
require 'simple-navigation'
module MyEngine
class Engine < Rails::Engine
#Give the absolute path of file
#config.autoload_paths << File.expand_path("../../../config/navigations", __FILE__)
SimpleNavigation.config_file_path = File.expand_path("../../../config/navigations", __FILE__)
Amitesh /
Created Jul 13, 2011
Reset Mysql root password
Reset Mysql root password
$ sudo stop mysql
$ sudo start mysql
$ mysql -u root
mysql> SET PASSWORD FOR root@'localhost' = PASSWORD('a_real_pwd');
mysql> exit
try : mysql -uroot -p
You can’t perform that action at this time.