This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Module for QHash Application | |
* @author : Amitesh Kumar | |
* | |
*/ | |
window.QHash = window.QHash || {}; | |
( function ( QHash ) { | |
/** | |
* Answer Model |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($) { | |
$.fn.clickToggle = function(func1, func2) { | |
var funcs = [func1, func2]; | |
this.data('toggleclicked', 0); | |
this.click(function() { | |
var data = $(this).data(); | |
var tc = data.toggleclicked; | |
$.proxy(funcs[tc], this)(); | |
data.toggleclicked = (tc + 1) % 2; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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);'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Striping */ | |
tr.alternate { | |
background-color:#ffffcc; | |
} | |
/* Sorting */ | |
th.table-sortable { | |
cursor:pointer; | |
background-position:center left; | |
background-repeat:no-repeat; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# For Ruby on Rails | |
# It will give hash of given model object | |
model_obj.serializable_hash | |
# Another way to get hash of a model object | |
ActiveSupport::JSON.decode(model_obj.to_json) | |
For MultiJson issue use | |
https://github.com/intridea/multi_json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# While using curl post call then disable request forgery protection | |
# For get method call, It skips the check | |
# Reference : http://api.rubyonrails.org/classes/ActionController/RequestForgeryProtection.html | |
class XyzController < ApplicationController | |
skip_before_filter :verify_authenticity_token, :only => [:update] | |
before_filter :authenticate_user!, :only => [:update, :index] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://github.com/elricstorm/baby_dove | |
https://github.com/drhenner/ror_ecommerce | |
http://ror-e.com/info/videos/5 | |
http://edgeapi.rubyonrails.org/classes/Rails/Engine.html | |
https://github.com/krschacht/rails_3_engine_demo/tree/master/app | |
https://github.com/jrwest/authr3 | |
https://github.com/mankind/Rails-3-engine-stub/wiki/How-to-building-a-rails-3-engine-and--set-up-test--with-rspec | |
https://github.com/technicalpickles/jeweler | |
http://www.themodestrubyist.com/2010/03/05/rails-3-plugins---part-2---writing-an-engine/ | |
https://gist.github.com/af7e572c2dc973add221#file_3_plugin.rdoc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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__) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
bye | |
try : mysql -uroot -p |
OlderNewer