Skip to content

Instantly share code, notes, and snippets.

View FerPerales's full-sized avatar
🎯
Focusing

Fernando Perales FerPerales

🎯
Focusing
View GitHub Profile
$('.modal')
.on('shown', function(){
$('body').css({overflow: 'hidden'});
})
.on('hidden', function(){
$('body').css({overflow: ''});
});
require "github_api"
user = ''
token = ''
github = Github.new oauth_token: token
coderwall_orgs = []
github.orgs.list.each do |org|
coderwall_orgs << org.login if org.login =~ /^coderwall/
@FerPerales
FerPerales / parser.rb
Created December 18, 2013 23:32
Parser for zipcodes
file = File.open 'zip_codes.csv', 'r'
content = file.read
lines = content.split '>"'
output = ''
lines.each do |l|
begin
values = l.split ',"'
coordinates = values[1].
delete!("<Polygon><outerBoundaryIs><LinearRing><coordinates>").
@FerPerales
FerPerales / gist:7242506
Created October 31, 2013 00:12
Default browser in Lubuntu
sudo update-alternatives --config x-www-browser
@FerPerales
FerPerales / pre-push.sh
Last active December 18, 2015 11:19
pre-push
#!/bin/sh
# This pre-push hook will run 'rake' command to check if your test
# suite passes by looking for ', 0 failures' in the 'rake' output
# If found, will return exit and the git push command will continue
# Make sure you remove the .sh extension and put the hook into your
# .git/hooks directory in your project
# --------------------------------------------------------------------
rand_port(){
port=$(( 1000+( $(od -An -N2 -i /dev/random) )%(1023+1) ))
while :
do
(echo >/dev/tcp/localhost/$port) &>/dev/null && port=$(( 1000+( $(od -An -N2 -i /dev/random) )%(1023+1) )) || break
done
echo "$port"
}
phpmin(){
@FerPerales
FerPerales / pre-commit.sh
Last active October 27, 2016 14:27
A git hook to help you avoid adding to you commit information you don't want (i.e. debugging statement)
# This script verifies if a list of "undesired" words are presented in the files you are intented to commit such console
# output, debugging information or keys/tokens/passwords
# Based on the git hook created by Mark Story
# http://mark-story.com/posts/view/using-git-commit-hooks-to-prevent-stupid-mistakes
# Instructions:
# Put this file into your .git/hooks folder and remove the .sh extension
@FerPerales
FerPerales / examples.rb
Last active December 15, 2015 23:48
Compilation: some programs made during the RoR training at Crowd Interactive
Djisktra: https://gist.github.com/FerPerales/10e032e8db71b6918676
CLasses and metaprogramming: https://gist.github.com/FerPerales/4584a82ed5c6beea1900
Recorder: https://gist.github.com/FerPerales/91032e5b539b2c1a8bb5
Temperature: https://gist.github.com/FerPerales/48da2857202dc7343158
Demo store: https://github.com/FerPerales/demo-store
@FerPerales
FerPerales / lxde-rc.xml
Created March 8, 2013 21:30
A key shortcut to turn off the monitor
<!-- turn off screen keybidding -->
<keybind key="XF86Launch1">
<action name="Execute">
<command>xset dpms force off</command>
</action>
</keybind>
<!-- end turn off screen keybidding -->
# A small script to install hstore module in Ubuntu
# Dependencies:
#
# * Please make sure you have installed postgres-contrib package
#
# How to customize this script:
#
# * Modify the path (you may require to change the postresql version)
# * If you are not using the default postgresql username and password,
# * change it (default username is postgres and no password)