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 / pinpass.txt
Created July 24, 2014 16:55
PinPass template for 1Password
Copy this table in 'Secure Notes' and obtain perfect result on 1Password
-------------------------------------------
| | A | B | C | D | E | F | G | H | I | J |
-------------------------------------------
| 1 | 00 | 00 | 00 | 00 | 00 | 00 | 00 | 00 | 00 | 00 |
-------------------------------------------
| 2 | 00 | 00 | 00 | 00 | 00 | 00 | 00 | 00 | 00 | 00 |
-------------------------------------------
| 3 | 00 | 00 | 00 | 00 | 00 | 00 | 00 | 00 | 00 | 00 |
get '/blog*' do
begin
path = params[:splat][0]
source_url = URI.parse('http://asdf.tumblr.com' + path.gsub(/ /, '+'))
source_content_type = ''
source_body = open(source_url) do |f|
source_content_type = f.content_type
f.read
end
# The upstream server doesn't need a prefix! no need for wss:// or http:// because nginx will upgrade to http1.1 in the config below
upstream yeomanserver {
server localhost:3000;
}
server {
listen 443;
server_name legionofevil.org;
root html;
// 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); }
@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();
@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 / gist:4532176
Created January 14, 2013 18:30
socket.io config for production
io.configure('production', function(){
console.log("Running Socket.io in production mode");
io.enable('browser client minification'); // send minified client
io.enable('browser client etag'); // apply etag caching logic based on version number
io.enable('browser client gzip'); // gzip the file
io.set('log level', 1); // reduce logging
io.set('transports', [ // enable all transports (optional if you want flashsocket)
'websocket'
, 'flashsocket'
, 'htmlfile'
@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:3895646
Created October 15, 2012 21:29
tunnel SSH for port 8080 HTTP
ssh -D 8080 -f -C -q -N myuser@myserver.com
@gabamnml
gabamnml / gist:3452170
Created August 24, 2012 15:46
Add heroku ssh key
heroku keys:add ~/.ssh/id_rsa.pub