Skip to content

Instantly share code, notes, and snippets.

View emerleite's full-sized avatar

Emerson Macedo emerleite

View GitHub Profile
@emerleite
emerleite / method_missing.js
Last active August 26, 2015 13:52 — forked from hagino3000/method_missing.js
__noSuchMethod__ for Chrome
/**
* Enable route to __noSuchMethod__ when unknown method calling.
*
* @param {Object} obj Target object.
* @return {Object}
*/
function enableMethodMissing(obj) {
var functionHandler = createBaseHandler({});
functionHandler.get = function(receiver, name) {
@emerleite
emerleite / 0_reuse_code.js
Created July 15, 2014 14:42
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative"
REGIOES_BRASILEIRAS = {
'Norte' => [
['Acre', 'AC'],
['Amapá','AP'],
['Amazonas', 'AM'],
['Pará', 'PA'],
['Rondônia', 'RO'],
['Roraima', 'RR'],
['Tocantins', 'TO']
],
class BlackHoleStore
def clear; end
def logger
Rails.logger
end
def fetch( *args )
yield
end
var sys = require('sys');
sys.puts("Top level");
sys.puts(" this === GLOBAL: " + (this === GLOBAL)); // false
sys.puts(" this === exports: " + (this === exports)); // true
var x = "1"; // local variable
sys.puts(" x === GLOBAL.x: " + (x === GLOBAL.x)); // false
require.paths.unshift 'express/lib'
require 'express'
http: require 'express/http'
get '/', ->
this.contentType 'html'
this.respond 200, '''
<html>
<head><title>NodeJs Example</title></head>
<body>
By Klaus Wuestefeld
1) Torne-se excelente.
Seja realmente bom em alguma coisa. Não fique só choramingando ou
querendo progredir às custas dos outros. Não pense q pq vc sentou 4
anos numa faculdade ouvindo um professor falar sobre software q vc
sabe alguma coisa. Jogador de futebol não aprende a jogar bola tendo
aula. Ele pratica. Instrumentistas geniais nao aprendem a tocar tendo
aula. Eles praticam. Pratique. Chegue em casa depois do trabalho e da
@emerleite
emerleite / tmux-copy-mode-osx.md
Last active September 8, 2015 19:16 — forked from brendanhay/tmux-copy-mode-osx.md
Tmux, copy-mode, and OSX shenanigans.

Copy, with line wrapping!

If you've been trying to copy/paste text from a multi-pane tmux session with the mouse, you've probably been pretty pissed at the blissful ignorance a terminal application has of the rodent in your hand.

The alternative, which is quote-unqoute native copy/pasting using copy-mode takes a bit to get used to. So this is one solution for copying and pasting lines from a session with correct line wrapping behaviour, albeit keyboard only.

Disclaimer

Since copy-mode has similar concepts of marks, regions, and temp buffers to Emacs .. you'll probably find it straight forward if you're familar with Emacsen. For people using vi-mode in tmux, the same still applies but obviously the default key bindings will differ alot from what I show below.

//Parser string differences: http://stackoverflow.com/questions/3085937/safari-js-cannot-parse-yyyy-mm-dd-date-format
var EODateParser = (function(Date,undefined) {
var pad = function(s) {
return (s.toString().length === 1) ? "0" + s: s;
};
var checkerValue = function(target, func, value) {
if (typeof value !== "undefined") {
target[func](value);