Skip to content

Instantly share code, notes, and snippets.

View fabiancarlos's full-sized avatar
🚀
Go!

Fabian Carlos fabiancarlos

🚀
Go!
View GitHub Profile
@fabiancarlos
fabiancarlos / css3_tricks.css
Created October 27, 2012 22:56
CSS3 Tricks and Tricks
/* 'Pulando na tela' */
@keyframes jump-bitch {
from {
-transform: scale(1.1);
z-index: 9999;
}
to {
@fabiancarlos
fabiancarlos / git_ex_custom.md
Created October 26, 2012 02:32
Git Essential Customization

Ativar coloração do que interessa

git config --global color.branch auto
git config --global color.diff auto
git config --global color.interactive auto
git config --global color.status auto

tudo colorido

@fabiancarlos
fabiancarlos / espresso_libre.css
Created October 17, 2012 00:55 — forked from mreinhardt/espresso_libre.css
Espresso Libre CSS translation for Chrome Inspector
/*
Espresso Libre by Mike Reinhardt 2011
based on Espresso Libre - by zolli -
http://www.eclipsecolorthemes.org/?view=theme&id=45
Inspired by Ben Truyman's IR_Black translation
and Darcy Clarke's blog post:
http://darcyclarke.me/design/skin-your-chrome-inspector/
*/
@fabiancarlos
fabiancarlos / schofinkelize.js
Created October 7, 2012 21:18
Currying Examples
function Schonfinkelize(fn){
var slice = Array.prototype.slice;
var stored_args = slice.call(arguments, 1);
return function (){
var new_args = slice.call(arguments);
var args = stored_args.concat(new_args);
@fabiancarlos
fabiancarlos / clean_string_file.php
Created August 31, 2012 23:11
Limpa Strings para arquivos
<?php
public function clean_string($string){
// troca palavras com acentos
$string = strtr($string, "áàãâéêíóôõúüçÁÀÃÂÉÊÍÓÔÕÚÜÇ ", "aaaaeeiooouucAAAAEEIOOOUUC_");
// converte para caixa baixa
$string = strtolower($string);
SET @_mediaGlobal := (SELECT AVG(valor) FROM produto ORDER BY valor);
SET @dp := (SELECT (STDDEV(valor)/2) as dp FROM produto ORDER BY valor);
select (@_mediaGlobal - @dp) as min, (@_mediaGlobal + @dp) as max, @dp, @_mediaGlobal, AVG(valor) as mediaReal from produto where valor >= (@_mediaGlobal - @dp) and valor <= (@_mediaGlobal + @dp) order by valor;
@fabiancarlos
fabiancarlos / percentil.sql
Created August 28, 2012 22:37
Percentil mysql
select floor(20/100*(count(*))) as min, floor(80/100*(count(*))) as max
from produto
order by valor
limit min, max;
select min, max
from (SELECT valor, floor(20/100*(count(*))) as min, floor(80/100*(count(*))) as max FROM produto group by fornecedor_id) produto
order by valor
limit 0, 4;
@fabiancarlos
fabiancarlos / estados_cidades.sql
Created August 23, 2012 20:38
triggerPopulaCidade.js
--
-- Estrutura da tabela `estados`
--
CREATE TABLE IF NOT EXISTS `estados` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nome` varchar(60) DEFAULT NULL,
`sigla` varchar(5) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='<double-click to overwrite multiple objects>' AUTO_INCREMENT=28 ;
@fabiancarlos
fabiancarlos / gist:3408185
Created August 20, 2012 21:46
camel_case.js
function toCamelCase(str) {
return str.replace(/(?:^\w|[A-Z]|\b\w)/g, function(letter, index) {
return index == 0 ? letter.toUpperCase() : letter.toLowerCase();
}).replace(/\s+/g, ' ');
}
@fabiancarlos
fabiancarlos / for_utf8.php
Created August 6, 2012 01:27
Force charset utf8
<?php
mysql_connect("$hostname_config", "$username_config", "$password_config") or die(mysql_error());
$db = mysql_select_db("$database_config") or die(mysql_error());
mysql_query("SET NAMES 'utf8'");
mysql_query('SET character_set_connection=utf8');
mysql_query('SET character_set_client=utf8');
mysql_query('SET character_set_results=utf8');