Skip to content

Instantly share code, notes, and snippets.

View gabamnml's full-sized avatar
:electron:
Focusing

Gabriel Aramburu gabamnml

:electron:
Focusing
View GitHub Profile
@gabamnml
gabamnml / eval.rb
Created June 18, 2012 21:53
interactive shell for ruby
#!/usr/local/bin/ruby
#######################################################
#
# Ruby interactive input/eval loop
# Written by matz (matz@netlab.co.jp)
# Modified by Mark Slagell (slagell@ruby-lang.org)
# with suggestions for improvement from Dave Thomas
# (Dave@Thomases.com)
#
@gabamnml
gabamnml / regx.rb
Created June 19, 2012 05:06
test regular expressions in ruby
st = "\033[7m"
en = "\033[m"
while TRUE
print "str> "
STDOUT.flush
str = gets
break
if not str
str.chop!
print "pat> "
@gabamnml
gabamnml / tmux-cheatsheet.markdown
Created October 7, 2015 22:09 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@gabamnml
gabamnml / gist:3392147
Created August 19, 2012 04:43
Surf in the terminal
Go to the end of the line: ctrl+e
Go to the beginning of the line: ctrl+a
Move by one letters at a time: ctrl+f (ctrl+b to go backwards)
Move by word alt+f (alt+b to go backwards)
Delete words: alt+d (remember that you need to be in the beginning of the word)
@gabamnml
gabamnml / gist:3452170
Created August 24, 2012 15:46
Add heroku ssh key
heroku keys:add ~/.ssh/id_rsa.pub
@gabamnml
gabamnml / init.lua
Created October 18, 2015 05:59
Hammerspon script to change 'default' profile with custom for USB Keyboard using Karabiner App
local usbWatcher = nil
function usbDeviceCallback(data)
if (data["productName"] == "USB Keyboard") then
if (data["eventType"] == "added") then
hs.execute('/Applications/Karabiner.app/Contents/Library/bin/karabiner select 1')
elseif (data["eventType"] == "removed") then
hs.execute('/Applications/Karabiner.app/Contents/Library/bin/karabiner select 0')
end
end
@gabamnml
gabamnml / metatager.js
Created December 20, 2012 20:38
Add meta tag with javascript
var yourTag=document.createElement('meta');
window.getSelection ? yourTag.name='name' : yourTag.Name='name'
yourTag.content='content';
document.getElementsByTagName('head')[0].appendChild(yourTag);
@gabamnml
gabamnml / gist:4626160
Created January 24, 2013 18:32
Prevent close windows with confirm
onbeforeunload = function(e){
if(confirm('Are you nuts? Do you really want to leave me?')){
return 'OK, Good Bye then';
}
else {
e = e || event;
if(e.preventDefault){e.preventDefault();}
e.returnValue = false;
return 'I said, "Are you nuts? Do you really want to leave me?"';
}
@gabamnml
gabamnml / robinhood.js
Last active December 14, 2015 16:39
Real time dump mongo
var sys = require('sys') var exec = require('child_process').exec; function puts(error, stdout, stderr) { sys.puts(stdout) } function run () { console.log("Le quita a los ricos"); exec("mongodump --host 127.0.0.1 --port 27017 --db namedb --username username --password strongpass --out /mongodump", puts); setTimeout(function () { postinmongo(); }, 10000); } function postinmongo() { console.log("Le da a los pobres"); exec("mongorestore mongodump"); setTimeout(function () { run(); }, 3000); } run();
// UTF8 Module
//
// Cleaner and modularized utf-8 encoding and decoding library for javascript.
//
// copyright: MIT
// author: Nijiko Yonskai, @nijikokun, nijikokun@gmail.com
(function (name, definition, context, dependencies) {
if (typeof context['module'] !== 'undefined' && context['module']['exports']) { if (dependencies && context['require']) { for (var i = 0; i < dependencies.length; i++) context[dependencies[i]] = context['require'](dependencies[i]); } context['module']['exports'] = definition.apply(context); }
else if (typeof context['define'] !== 'undefined' && context['define'] === 'function' && context['define']['amd']) { define(name, (dependencies || []), definition); }
else { context[name] = definition.apply(context); }