Skip to content

Instantly share code, notes, and snippets.

View cbilgili's full-sized avatar

Canbey Bilgili cbilgili

  • Istanbul
View GitHub Profile
# Filter payment methods in Spree depending on the shipping name,
# use the following snippet within your activation method to
# make it work:
#
# CheckoutsController.class_eval { include FilterPaymentMethods }
#
# The magic happens within the InstanceMethods module, change the
# regexp to fit your needs.
#
# Kai Krakow, http://github.com/kakra
@cbilgili
cbilgili / gist:7098731
Created October 22, 2013 11:06
rspec spec --format nested. rspec testi formatlı ekrana yazdırmak
rspec spec --format nested.
@cbilgili
cbilgili / gist:6683405
Last active December 23, 2015 19:29
terminal file copy scp
local to remote
scp -i ~/.ssh/supernomads.pem supernomads.com.crt ubuntu@54.229.19.140:~/.
~/.ssh klasöründeyken
rsync -avL --progress -e "ssh -i ./supernomads.pem" ~/Downloads/kibo_image/* ubuntu@54.72.111.93:/tmp/.
rsync -rave "ssh -i ./supernomads.pem" ~/Downloads/kibo_image/* ubuntu@54.72.111.93:/tmp/.
remote to local
scp -r user@your.server.example.com:/path/to/foo /home/user/Desktop/
@cbilgili
cbilgili / gist:5943844
Last active December 19, 2015 10:58
Ubuntu apache2 restart
sunucu restart
sudo /etc/init.d/apache2 restart
domain
cd /etc/apache2/sites-available/
sudo a2dissite default
sudo a2ensite xxxxx.com
@cbilgili
cbilgili / gist:5813063
Created June 19, 2013 09:44
Ruby string merge sprintf
You can use sprintf-like formatting to inject values into the string. For that the string must include placeholders. Put your arguments into an array and use on of these ways: (For more info look at the documentation for Kernel::sprintf.)
fmt = 'The %s %s the %s'
res = fmt % [animal, action, other_animal] # using %-operator
res = sprintf(fmt, animal, action, other_animal) # call Kernel.sprintf
You can even explicitly specify the argument number and shuffle them around:
'The %3$s %2$s the %1$s' % ['cat', 'eats', 'mouse']
Or specify the argument using hash keys:
@cbilgili
cbilgili / gist:4584855
Created January 21, 2013 09:33
How to turn off the iMac display
How to turn off the iMac display
CONTROL + SHIFT + EJECT