Skip to content

Instantly share code, notes, and snippets.

View midned's full-sized avatar
🏠
Working from home

Álvaro C midned

🏠
Working from home
  • Vitech
  • Montevideo
View GitHub Profile
<?php
$resolver = new Illuminate\Database\ConnectionResolver;
$resolver->setDefaultConnection('default');
$factory = new Illuminate\Database\Connectors\ConnectionFactory;
$connection = $factory->make(array(
'host' => 'localhost',
@midned
midned / gist:4310271
Created December 16, 2012 17:54
My way to convert decimal to hexadecimal and vice versa in Ruby
class Fixnum
def to_hex
self.to_s 16
end
end
class String
def to_i_from_hex
self.to_i 16
end
@midned
midned / gist:3784611
Created September 25, 2012 21:37
Gravatar in Coffeescript
Gravy =
"HTTP_URL": "http://www.gravatar.com/avatar/"
"HTTPS_URL": "https://secure.gravatar.com/avatar/"
valid: (email) ->
/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i.test email
to: (email, size, https) ->