Skip to content

Instantly share code, notes, and snippets.

View kaiquewdev's full-sized avatar

Kaique Silva kaiquewdev

View GitHub Profile
@kaiquewdev
kaiquewdev / gist:1108556
Created July 27, 2011 02:52
Ruby Style Guide
Original Source: https://github.com/chneukirchen/styleguide
= Christian Neukirchen's Ruby Style Guide
You may not like all rules presented here, but they work very well for
me and have helped producing high quality code. Everyone is free to
code however they want, write and follow their own style guides, but
when you contribute to my code, please follow these rules:
@kaiquewdev
kaiquewdev / LICENSE.txt
Created September 29, 2011 13:41 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@kaiquewdev
kaiquewdev / gist:1662621
Created January 23, 2012 11:25 — forked from remy/gist:350433
Storage polyfill
if (typeof window.localStorage == 'undefined' || typeof window.sessionStorage == 'undefined') (function () {
var Storage = function (type) {
function createCookie(name, value, days) {
var date, expires;
if (days) {
date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
expires = "; expires="+date.toGMTString();
@kaiquewdev
kaiquewdev / gist:2655801
Created May 10, 2012 20:49 — forked from wesbos/gist:1476820
PhantomJS Screenshot
var page = new WebPage(),
address, output, size;
address = "http://www.metachunk.com/";
width = 1024; height = 600;
output = "./screenshots/wat-"+width+"X"+height+".png";
page.viewportSize = { width: width, height: height };
if (phantom.args.length === 3 && phantom.args[1].substr(-4) === ".pdf") {
@kaiquewdev
kaiquewdev / drag.js
Created May 23, 2012 13:19 — forked from mattheworiordan/drag.js
Drag and drop example for Titanium
var circle = Titanium.UI.createView({
height:200,
width:200,
borderRadius:50,
backgroundColor:'#336699',
top:10,
left:50
});
currentWindow.add(circle);
@kaiquewdev
kaiquewdev / gist:3895206
Created October 15, 2012 20:29 — forked from diogobaeder/gist:3891068
Carta contra PL de regulamentação da profissão de Analista de Sistemas
Caro Senador Wellington Dias,
Viemos por meio deste abaixo-assinado manifestar nosso repúdio ao PLS - PROJETO DE LEI DO SENADO, Nº 607 de 2007, que busca regulamentar a profissão de Analista de
Sistemas no Brasil.
O principal motivo desta manifestação dá-se ao fato de a profissão não oferecer, inerentemente a ela, riscos à sociedade ou à condição humana - diferentemente da profissão
de médico cirurgião, que pode causar a morte de um paciente, ou de engenheiro civil, cujo mal projeto pode fazer com que uma construção desmorone e tire vidas, ou de um
advogado, que por não ser conhecedor das leis que fundamentam nosso país resultando no encarceramento de um cidadão inocente. Ao contrário destas profissões, são raras as
ocasiões em que a profissão de Analista de Sistemas tem influência crítica sobre a saúde humana ou o bem-estar social; Um dos melhores exemplos do baixo risco que a
profissão tem sobre a sociedade é o crescimento exponencial do mercado de soluções de Internet, onde é raro encontrar uma situação

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
/*! normalize.css 2012-02-07T12:37 UTC - http://github.com/necolas/normalize.css */article,aside,details,figcaption,figure,footer,header,hgroup,nav,section,summary{display:block}audio,canvas,video{display:inline-block;*display:inline;*zoom:1}audio:not([controls]){display:none}[hidden]{display:none}html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}html,button,input,select,textarea{font-family:sans-serif}body{margin:0}a:focus{outline:thin dotted}a:hover,a:active{outline:0}h1{font-size:2em;margin:.67em 0}h2{font-size:1.5em;margin:.83em 0}h3{font-size:1.17em;margin:1em 0}h4{font-size:1em;margin:1.33em 0}h5{font-size:.83em;margin:1.67em 0}h6{font-size:.75em;margin:2.33em 0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}blockquote{margin:1em 40px}dfn{font-style:italic}mark{background:#ff0;color:#000}p,pre{margin:1em 0}pre,code,kbd,samp{font-family:monospace,serif;_font-family:'courier new',monospace;font-size:1em}pre{white-space:pre;white-space:pre-wrap;word-wrap:break-word
Strophe.addConnectionPlugin("xdomainrequest", {
init: function () {
if (window.XDomainRequest) {
Strophe.debug("using XdomainRequest for IE");
// override the send method to fire readystate 2
if (typeof XDomainRequest.prototype.oldsend == 'undefined') {
XDomainRequest.prototype.oldsend = XDomainRequest.prototype.send;
XDomainRequest.prototype.send = function() {
XDomainRequest.prototype.oldsend.apply(this, arguments);

Why declaring globals is better than exporting

The module pattern

During the past several years the way of managing javascript dependencies evolved bringing some advanced solutions. One of the concepts which became very popular today, is a module pattern. The beginning of this article explains the idea pretty well. This concept was then reused in many modern dependency-management solutions, and was finally suggested as a specification of AMD API, the most known implementation of which is probably the RequireJS.

Exporting feature, the problems of which are discussed in this text, is part of the module pattern. Strictly speaking, the module pattern itself has no relation to the dependency resolution, it is rather designed for managing and storing the data in a special way. But it naturally integrates as a base for the dependency management libraries.