Skip to content

Instantly share code, notes, and snippets.

View leobetosouza's full-sized avatar

Leonardo Alberto Souza leobetosouza

View GitHub Profile
@leobetosouza
leobetosouza / Date.prototype.diff.js
Created April 27, 2012 02:56 — forked from netojoaobatista/Date.prototype.diff.js
Returns the difference between two Date objects.
Object.defineProperty(Date.prototype,"diff",{
writable: false, configurable: false, enumerable: true,
/**
* Returns the difference between two Date objects.
* @param {Date} The date to compare to.
* @return {Object}
* @throws {TypeError}
*/
value: function(date) {
@leobetosouza
leobetosouza / gist:2856498
Created June 2, 2012 04:00
JavaScript Design Patterns Hangout
Links, livros, artigos e etc comentados durante o Hangout 'JavaScript e Design Patterns': http://youtu.be/FkED71eM7s8
@leobetosouza
leobetosouza / gist:2886667
Created June 7, 2012 04:52
Hangout sobre padrões de arquitetura
http://lostechies.com/derickbailey/2012/06/04/anders-hejlsberg-is-right-you-cannot-maintain-large-programs-in-javascript/
http://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod
http://www.objectmentor.com/resources/articles/srp.pdf
REP - The Release Reuse Equivalency Principle - The granule of reuse is the granule of release.
João Batista Neto 23:07
https://live.gnome.org/Boxes
João Batista Neto tornou este hangout público.
Flávio Ferreira 23:08
Toca o Barco galera
que eu to OFF cam
to só acompanhando o Audio
@leobetosouza
leobetosouza / gist:3111872
Created July 14, 2012 15:49
Foca no código!
/*globals module:true,test:true,ok:true,equal:true,strictEqual:true,deepEqual:true*/
module( 'Ambiente' );
test( 'jQuery', function() {
ok( jQuery, 'jQuery existe' );
equal( typeof( jQuery ), 'function', 'jQuery como função' );
strictEqual( jQuery, $, 'jQuery === $' );
});
@leobetosouza
leobetosouza / gist:5169581
Created March 15, 2013 12:34
lynx homebrew report
leobetosouza:~ leobetosouza$ HOMEBREW_MAKE_JOBS=1 VERBOSE=1 brew install lynx
==> Downloading http://lynx.isc.org/release/lynx2.8.7.tar.bz2
Already downloaded: /Library/Caches/Homebrew/lynx-2.8.7.tar.bz2
tar xf /Library/Caches/Homebrew/lynx-2.8.7.tar.bz2
==> ./configure --disable-debug --disable-dependency-tracking --prefix=/usr/local/Cellar/lynx/2.8.7 --mandir=/usr/local/Cellar/lynx/2.8.7/share/man --disable-echo --with-zlib --with-bzlib --with-ssl --enable-ipv6
./configure --disable-debug --disable-dependency-tracking --prefix=/usr/local/Cellar/lynx/2.8.7 --mandir=/usr/local/Cellar/lynx/2.8.7/share/man --disable-echo --with-zlib --with-bzlib --with-ssl --enable-ipv6
checking build system type... i386-apple-darwin10.8.0
checking host system type... i386-apple-darwin10.8.0
checking target system type... i386-apple-darwin10.8.0
Configuring for darwin10.8.0
@leobetosouza
leobetosouza / listas.cpp
Created December 21, 2013 14:23
Programas que controlam uma pilhas, listas e matrizes feitos na faculdade em algum ponto de 2006 quando eu pensava que sabia C. Saca a formatação e identação zoada desse troço xD
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
/****************************************************
******* DECLARAÇAO DAS ESTRUTURAS UTILIZADAS *******
****************************************************/
struct Elista3A {
int elem;
@leobetosouza
leobetosouza / gist:1f02a6062c41a380f24b
Last active August 29, 2015 14:20
WIP. Uma regex para validar números de telefones brasileiros levando em consideração um número de DDD válido e o nono digito que só é habilitado para celulares de alguns DDDs. Ainda imperfeita.
(\((11|12|13|14|15|16|17|18|19|21|22|24|27|28|91|92|93|94|95|96|97|98|99)\)\s(9[1-9][0-9]{3}\-[0-9]{4})|[2-9][0-9]{3}\-[0-9]{4})|(\((31|32|33|34|35|37|38|41|42|43|44|45|46|47|48|49|51|53|54|55|61|62|63|64|65|66|67|68|69|71|73|74|75|77|79|81|82|83|84|85|86|87|88|89)\)\s[2-9][0-9]{3}\-[0-9]{4})
Verifying that +leobetosouza is my blockchain ID. https://onename.com/leobetosouza
@leobetosouza
leobetosouza / roman.js
Created August 11, 2016 04:52
Convert any number between 1 and 3999 to roman using JS
var mapa =[
[1000, { capital : 'M', condition : gt, transform : repeat }],
[900, { capital :'CM', condition : gt, transform : difference }],
[500, { capital : 'D', condition : gt, transform : difference }],
[400, { capital : 'CD', condition : gt, transform : difference }],
[100, { capital : 'C', condition : gt, transform : repeat }],
[90, { capital : 'XC', condition : gt, transform : difference }],
[50, { capital : 'L', condition : gt, transform : difference }],
[40, { capital : 'XL', condition : gt, transform : difference }],
[10, { capital : 'X', condition : gt, transform : repeat }],