Skip to content

Instantly share code, notes, and snippets.

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

Matheus Carmo matheuslc

🏠
Working from home
View GitHub Profile

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
//addEventListener polyfill 1.0 / Eirik Backer / MIT Licence
(function(win, doc){
if(win.addEventListener)return; //No need to polyfill
function docHijack(p){var old = doc[p];doc[p] = function(v){return addListen(old(v))}}
function addEvent(on, fn, self){
return (self = this).attachEvent('on' + on, function(e){
var e = e || win.event;
e.preventDefault = e.preventDefault || function(){e.returnValue = false}
e.stopPropagation = e.stopPropagation || function(){e.cancelBubble = true}
@matheuslc
matheuslc / .ccscomb.json
Created May 5, 2014 12:39
A CCSComb Sublime plugin template
{
"always-semicolon": true,
"block-indent": 4,
"colon-space": true,
"color-case": "lower",
"color-shorthand": true,
"combinator-space": true,
"element-case": "lower",
"eof-newline": true,
"leading-zero": false,
@matheuslc
matheuslc / smacss.md
Created May 20, 2014 14:33
A SMACSS guide

Categorias

Base

Define como objetos serão vistos por padrão. Um exemplo de base é um CSS Reset.

Layout

Blocos de seções de páginas, por exemplo, um header, um footer, um artigo e etc.

#BrazilJS 2014

Talks: Slides & Links

Day Talk Speaker Links
1 Why ServiceWorker may be the next big thing Renato Mangini TBP
1 Frontend at Scale - The Tumblr Story Chris Miller TBP
1 Intro to GFX: Raw WebGL Nick Desaulniers Slides
@matheuslc
matheuslc / has.js
Created August 29, 2014 17:23
A value have in array
var arr = ['foo', 'bar'];
Array.prototype.has = function(value) {
return this.indexOf(value) >= 0;
}
arr.has('foo'); // true
arr.has('bar'); // true
arr.has('baz'); // false
;(function(window, document, jQuery) {
/** Table sort
* @description Sort items
*/
/** Insertion Sort Data Structure
* @description Sort numbers
* @param items {array} Array with integers
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
@matheuslc
matheuslc / análisedeframeworks.md
Last active November 18, 2015 10:13
Análise de frameworks CSS [BETA]

Análise de Frameworks CSS

Tabela Comparativa

Framework Arquitetura de CSS Pré-processador Componentes Suporte (browsers) Suporte (comunidade) Curva de aprendizado Velocidade de desenvolvimento Qualidade de código Documentação Dependências Tamanho
Twitter Bootstrap OOCSS LESS/Sass Muitos IE8+ Excelente Média Excelente Ótima 8/10 jQuery 255kb
Zurb Foundation OOCSS Sass Muitos+ IE9+ Ótima Média Excelente Excelente 9/10 jQuery 174kb
Yahoo Purecss SMACSS - Poucos IE8+ Ótima Baixa Boa Execelente 9/10 - 74kb
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://npmjs.org/install.sh | sh