Skip to content

Instantly share code, notes, and snippets.

@arkiver
arkiver / git_filter_branch_change_author_email
Created May 18, 2013 16:22
Snippet to change git author name and email (In case you commit using your work credentials)
git filter-branch --env-filter '
an="$GIT_AUTHOR_NAME"
am="$GIT_AUTHOR_EMAIL"
cn="$GIT_COMMITTER_NAME"
cm="$GIT_COMMITTER_EMAIL"
if [ "$GIT_COMMITTER_EMAIL" = "[email protected]" ]
then
cn="Akshay Khole"
@arkiver
arkiver / regex_indian_simple_mobile_number
Last active December 14, 2015 09:09
Regex for JS validation of Indian mobile number (without country code prefixed)
/^[0]?[789]\d{9}$/
Matches
09878767656
or
9878767656
or
7898987656
@arkiver
arkiver / spec_helper.rb
Created January 22, 2013 10:24
spec_helper
require 'rubygems'
require 'simplecov'
SimpleCov.start 'rails'
require 'spork'
#uncomment the following line to use spork with the debugger
#require 'spork/ext/ruby-debug'
Spork.prefork do
# Loading more in this block will cause your tests to run faster. However,
@arkiver
arkiver / zsh_aliases
Created January 18, 2013 05:37
Some of my aliases in zsh
# my aliases
alias gprod="git pull --rebase origin dev"
alias gpp="git pull --rebase origin dev && git push origin dev"
alias st="git status"
# datamapper
alias rda="rake db:autoupgrade"
@arkiver
arkiver / FizzBuzz.rb
Created November 1, 2012 10:48
fizz buzz in ruby
#!/usr/bin/ENV ruby1.9.3
i = 0
100.times do
i += 1
if i%5 == 0 && i%3 ==0 then
print "fizz buzz"
elsif i%3 == 0 then
print "fizz"
elsif i%5 == 0 then
print "buzz"
@arkiver
arkiver / gist:3877732
Created October 12, 2012 07:08
haml mode emacs
Contents of .emacs file:
(add-to-list 'load-path "~/.emacs.d/haml-mode")
(require 'haml-mode)
Cloned
git://github.com/nex3/haml-mode.git
@arkiver
arkiver / gist:3811114
Created October 1, 2012 11:39
radial background image
td.center_main_table{
background-color: rgb(152, 215, 43);
background-image: -webkit-radial-gradient(50% 25%, 1140px 1040px, rgba(255, 255, 255, 255) 0%, rgb(200, 215, 36) 38%);
background-image: -ms-radial-gradient(50% 25%, 1140px 1040px, rgba(255, 255, 255, 255) 0%, rgb(200, 215, 36) 38%);
background-image: -o-radial-gradient(50% 25%, 1140px 1040px, rgba(255, 255, 255, 255) 0%, rgb(200, 215, 36) 38%);
background-image: radial-gradient(50% 25%, 1140px 1040px, rgba(255, 255, 255, 255) 0%, rgb(200, 215, 36) 38%);
background-image: -moz-radial-gradient(50% 25%, 1140px 1040px, rgba(255, 255, 255, 255) 0%, rgb(200, 215, 36) 38%);
background: -moz-radial-gradient(50% 25% , ellipse closest-side, #FFFFFF, #C8D724 120%) repeat scroll 0 0 #C8D724;
background-image: url('http://www.olacabs.com/img/campaigns/back_gradient.jpg')
}
@arkiver
arkiver / gist:3808133
Created September 30, 2012 18:52
emailer radial gradient
.center_container{
background-image: -webkit-radial-gradient(50% 25%, 1140px 1040px, rgba(255, 255, 255, 255) 0%, rgb(152, 215, 43) 38%);
background-image: -ms-radial-gradient(50% 25%, 1140px 1040px, rgba(255, 255, 255, 255) 0%, rgb(152, 215, 43) 38%);
background-image: -o-radial-gradient(50% 25%, 1140px 1040px, rgba(255, 255, 255, 255) 0%, rgb(152, 215, 43) 38%);
background-image: radial-gradient(50% 25%, 1140px 1040px, rgba(255, 255, 255, 255) 0%, rgb(152, 215, 43) 38%);
background-image: -moz-radial-gradient(50% 25%, 1140px 1040px, rgba(255, 255, 255, 255) 0%, rgb(152, 215, 43) 38%);
}
@arkiver
arkiver / oeprator_precedence.txt
Created September 23, 2012 03:06
Operator precedence in ruby (learning ruby)
[19] pry(main)> x = true
=> true
[20] pry(main)> y = false
=> false
[21] pry(main)> z = nil
=> nil
[22] pry(main)> z = x or y
=> true
[23] pry(main)> z
=> true
@arkiver
arkiver / capybara cheat sheet
Created September 10, 2012 11:24 — forked from zhengjia/capybara cheat sheet
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')