Skip to content

Instantly share code, notes, and snippets.

View alexsandro-xpt's full-sized avatar

Alexsandro Souza Pereira alexsandro-xpt

View GitHub Profile
@paulirish
paulirish / gist:366184
Created April 14, 2010 18:59
html5 geolocation with fallback.
// geo-location shim
// currentely only serves lat/long
// depends on jQuery
// doublecheck the ClientLocation results because it may returning null results
;(function(geolocation){
if (geolocation) return;

Sass/Less Comparison

In this document I am using Sass's SCSS syntax. You can choose to use the indented syntax in sass, if you prefer it, it has no functional differences from the SCSS syntax.

For Less, I'm using the JavaScript version because this is what they suggest on the website. The ruby version may be different.

Variables

@xxxObiWan
xxxObiWan / Smarty.tmLanguage
Created January 30, 2012 21:38
Sublime Text 2 - syntax highlight for Latte
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>fileTypes</key>
<array/>
<key>foldingStartMarker</key>
<!-- /------Folding for latte: Start commands -->
<string>(&lt;(?i:(head|table|tr|div|style|script|ul|ol|form|dl))\b.*?&gt;|\{\{?(if|foreach|capture|literal|php|section|strip|block|form)|\{\s*$)</string>
@thulstrup
thulstrup / compass-retina-sprites.scss
Created March 20, 2012 19:18
Using Compass to generate normal and retina sprite maps
$sprites: sprite-map("sprites/*.png");
$sprites-retina: sprite-map("sprites-retina/*.png");
@mixin sprite-background($name) {
background-image: sprite-url($sprites);
background-position: sprite-position($sprites, $name);
background-repeat: no-repeat;
display: block;
height: image-height(sprite-file($sprites, $name));
width: image-width(sprite-file($sprites, $name));
regex=/^([1-9][0-9] +|\([1-9][0-9]\) *)[1-9]\d{2,4}[ .-]?\d{4}$/;
strings=[
/* Só numéricos com espaços que casam */
'11 9990000',
'11 99990000',
'11 999990000',
'11 999 0000',
'11 9999 0000',
'11 99999 0000',
@ldaniel
ldaniel / _aviso.md
Created May 16, 2012 12:18
Crítica à comunidade .NET

Aviso importante

"Às vezes, um charuto é apenas um charuto."

Não almejamos mais seguidores no Twitter, leitores para o blog ou amigos no Facebook. Somos, assumidamente (e com discreto orgulho), pessoas pouco sociáveis. Sim, esta crítica é, nesse caso, apenas uma crítica.

@leandronet e @mantov

@vquaiato
vquaiato / gist:2782117
Created May 24, 2012 15:07
Map/Reduce no MongoDB

###Collections Salas{_id} Reservas{_id, sala_id, data}

###Preciso contar as reservas de cada sala por uma data:

map = function () {
    emit(this.sala_id, [1]);
}
@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.
@alganet
alganet / todo.php
Created June 23, 2012 00:49
A very small PHP todo list that saves to the database in 32 lines
<?php
//The actual implementation is just this file. Others are usage and tests.
class TodoList extends ArrayObject
{
const CREATE = 'CREATE TABLE IF NOT EXISTS tasks (name VARCHAR(32) PRIMARY KEY, status INT)';
const SELECT = 'SELECT * FROM tasks';
const INSERT = 'INSERT INTO tasks VALUES (?,?)';
const UPDATE = 'UPDATE tasks SET status = ? WHERE name = ?';
@alexsandro-xpt
alexsandro-xpt / gist:3058488
Created July 6, 2012 06:50 — forked from millermedeiros/gist:3057782
Links sobre otimização de performance (WPO)