Skip to content

Instantly share code, notes, and snippets.

View FerPerales's full-sized avatar
🎯
Focusing

Fernando Perales FerPerales

🎯
Focusing
View GitHub Profile
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/
$('.modal')
.on('shown', function(){
$('body').css({overflow: 'hidden'});
})
.on('hidden', function(){
$('body').css({overflow: ''});
});
@FerPerales
FerPerales / nginx.conf
Last active August 29, 2015 14:08 — forked from billie66/nginx.conf
# This file should be placed on the directory of ~/blog/config
upstream unicorn {
server unix:/tmp/unicorn.todo.socket fail_timeout=0;
}
server {
listen 80 default;
#server_name example.com;
root /home/username/blog/public;
require 'securerandom'
require 'em-http-request'
require 'pry-nav'
require 'json'
require 'faye/websocket'
require 'eventmachine'
require 'rest_client'
class WTV
def initialize(my_id, my_token)
wehfoiwehfwef
@FerPerales
FerPerales / db.rake
Last active August 29, 2015 14:23 — forked from tehpeh/db.rake
namespace :db do
namespace :enable do
desc "enable hstore extension"
task :hstore => [:environment, :load_config] do
ActiveRecord::Base.connection.execute('CREATE EXTENSION IF NOT EXISTS hstore;')
end
end
Rake::Task['db:schema:load'].enhance ['db:enable:hstore']
end
@FerPerales
FerPerales / prime.py
Created July 14, 2012 18:43
Primer numbers
def primos(limite):
primos = []
for elemento in range(2,limite):
encontrado = False
for primo in primos:
if elemento % primo == 0 and elemento is not primo:
encontrado = True
break
if not encontrado:
primos.append(elemento)
@FerPerales
FerPerales / zenExamples
Created August 30, 2012 02:31
Some Zen coding examples
Basic commands:
html:5
Creates a HTML5 template
@FerPerales
FerPerales / gist:3612623
Created September 3, 2012 19:26
Zen code for practice #6
This zen:
html:5>h1+(fieldset>(p>label+input)*2)+(fieldset>(label+(p>input)*4)+(p>label+input)*2)+(fieldset>(p>label+input)*4+(label+select>option*2))
Generates this:
<!DOCTYPE HTML>
<html lang="en-US">
@FerPerales
FerPerales / gist:3777473
Created September 24, 2012 18:26
Software Gurú
public class Operaciones {
/**
* @param args
*/
public static void main(String[] args) {
char operacion = args[0].charAt(0);
int valor = Integer.parseInt(args[1]);
suma(valor, operacion);
}