Skip to content

Instantly share code, notes, and snippets.

View vijedi's full-sized avatar

Tejus Parikh vijedi

View GitHub Profile
@vijedi
vijedi / additions_to_table_for.rb
Created October 11, 2012 02:54
Additions to table_for
table_for users, {:sortable => true, :class => 'index_table'} do
...
end
@vijedi
vijedi / active_admin_sorting_tables.rb
Created October 11, 2012 02:52
Active Admin Sorting Tables
content do
order = case(params[:order])
when 'user_email_desc'
'email DESC'
when 'user_email_asc'
'email ASC'
else
nil
end
@vijedi
vijedi / adding_moved_files_to_git.sh
Created May 26, 2012 17:24
Adding moved files to git
git add <subdir_name>
git add -u
git commit -m "adding <subdir_name>"
@vijedi
vijedi / fetch_git_changes.sh
Created May 26, 2012 15:10
Fetching All Repo Changes
git remote add <remote_name> </path/to/existing/repo>
git fetch <remote_name>
git merge <remote_name>/master
@vijedi
vijedi / create_repo.sh
Created May 26, 2012 15:05
Create a Git Repo
mkdir monolithic_repo
cd monolithic_repo
git init .
@vijedi
vijedi / csrf_token.js
Created February 8, 2012 13:21
Correct CSRF Token
$("body").bind("ajaxSend", function(elm, xhr, s){
if (s.type == "POST" || type == "DELETE" || type == "PUT") {
xhr.setRequestHeader('X-CSRF-Token', Common.CSRF_TOKEN);
}
});
@vijedi
vijedi / csrf.js
Created February 8, 2012 13:08
CSRF Token: The Wrong way.
$("body").bind("ajaxSend", function(elm, xhr, s){
if (s.type == "POST") {
xhr.setRequestHeader('X-CSRF-Token', Common.CSRF_TOKEN);
}
});
@vijedi
vijedi / spring_aop_classes_with_qualifiers.java
Created January 6, 2012 02:08
Spring AOP Classes with Qualifiers
@Transactional
@Service("dc")
class DependencyClass implements IDependencyClass {
}
@Transactional
@Service("dca")
class DependencyClassAlternate implements IDependencyClass {
@vijedi
vijedi / spring_aop_class_example_two_classes.java
Created January 6, 2012 02:04
Spring AOP Class Example With Two Classes
@Transactional
@Service
class DependencyClass implements IDependencyClass {
}
@Transactional
@Service
class DependencyClassAlternate implements IDependencyClass {
@vijedi
vijedi / spring_aop_class_example.java
Created January 6, 2012 01:44
Spring AOP Class Example
@Transactional
@Service
class DependencyClass implements IDependencyClass {
}
class MainClass {
@Autowired
private IDependencyClass insert;
}