Skip to content

Instantly share code, notes, and snippets.

View vicentereig's full-sized avatar
🐢

Vicente Reig Rincón de Arellano vicentereig

🐢
View GitHub Profile
@bradt
bradt / setup-dnsmasq-os-x-lion
Created March 11, 2012 20:23
Setting up dnsmasq for Local Web Development Testing on any Device
# Setting up dnsmasq for Local Web Development Testing on any Device
Please note, these instructions are for OS X Lion.
First, you need to get the IP address of your machine on your local network. In OS X, the easiest place to find this is in System Preferences > Network. If you're using DHCP on your local network, you will want to make sure your computer requests the same IP address when it renews it's IP address lease. I recommend configuring the DCHP Reservation settings on your router to accomplish this. Otherwise, you can specify a manual address in your network settings:
1. Go to *System Preferences > Network*
1. Click *Advanced...*
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@jgv
jgv / gist:2430270
Created April 20, 2012 16:55 — forked from marcel/gist:2100703
giftube – Generates an animated gif from a YouTube url.
#!/usr/bin/env ruby
# giftube – Generates an animated gif from a YouTube url.
#
# Usage:
#
# giftube [youtube url] [minute:second] [duration]
#
# ex.
#
class ActionDispatch::Routing::Mapper
def draw(routes_name)
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb")))
end
end
BCX::Application.routes.draw do
draw :api
draw :account
draw :session
@hmcfletch
hmcfletch / AFRailsHTTPClient.h
Created May 1, 2012 18:42
AFRailsHTTPClient
//
// AFRailsHTTPClient.h
// TopHatter
//
// Created by Leslie Fletcher on 1/30/12.
// Copyright (c) 2012 Blippy. All rights reserved.
//
#import "AFHTTPClient.h"
@maccman
maccman / juggernaut.rb
Created June 26, 2012 02:49
Sinatra Server Side Event streaming.
# Usage: redis-cli publish message hello
require 'sinatra'
require 'redis'
conns = []
get '/' do
erb :index
end
@maccman
maccman / juggernaut_channels.rb
Created June 26, 2012 04:56
Sinatra Server Side Event streaming with private channels.
# Usage: redis-cli publish message.achannel hello
require 'sinatra'
require 'redis'
conns = Hash.new {|h, k| h[k] = [] }
Thread.abort_on_exception = true
get '/' do
@rlivsey
rlivsey / pdf_generator.rb
Created June 28, 2012 10:22
HTML -> PDF with JRuby and Flying Saucer
require 'java'
require 'flying_saucer'
java_import org.xhtmlrenderer.pdf.ITextRenderer
class PDFGenerator
def self.generate(html)
new(html).generate
end
@danielwaterworth
danielwaterworth / article.md
Created August 9, 2012 07:48
How much of your codebase is only understood by one person?

How much of your codebase is only understood by one person?

Have you seen this question before? If you're a programmer then you're likely to have. It's a question that is strongly related the concept of a bus factor; the minimum number of people that understand any part of a system. This question annoys me though, because by asking it you are assuming that the system in question is so complicated and ill documented that at least parts of it can only be understood by the people that created it or those who that knowledge was shared with.

Why is this the norm? Why is it that we accept complexity? Edsger Dijkstra famously said "Simplicity is prerequisite for reliability" and I don't anyone who would disagree. When we accept complexity by not striving for simplicity, we accept unreliability and bugs.

@fcurella
fcurella / psql.py
Created August 27, 2012 16:22
postgres PubSub vs Redis
#!/usr/bin/env python
import select
import time
import psycopg2
import psycopg2.extensions
import sys
def get_cursor():
conn = psycopg2.connect("dbname=pgpubsub")