Skip to content

Instantly share code, notes, and snippets.

View trodrigues's full-sized avatar
😸
:3

Tiago Rodrigues trodrigues

😸
:3
View GitHub Profile
@trodrigues
trodrigues / kill_test_servers.sh
Created May 7, 2012 20:33
kill script for phantom, buster, selenium
#!/bin/bash
# just call with ./kill_test_servers.sh buster-server|selenium|phantom
function get_buster_server_pid(){
echo `ps aux|grep buster-server|grep node|awk '{ print $2 }'`
}
function get_selenium_server_pid(){
echo `ps aux|grep selenium|grep java|awk '{ print $2 }'`
}
% curl https://registry.npmjs.org/promised-io/0.3.2
curl: (60) SSL certificate problem, verify that the CA cert is OK. Details:
error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed
More details here: http://curl.haxx.se/docs/sslcerts.html
curl performs SSL certificate verification by default, using a "bundle"
of Certificate Authority (CA) public keys (CA certs). If the default
bundle file isn't adequate, you can specify an alternate file
using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
@trodrigues
trodrigues / gist:2989617
Created June 25, 2012 16:32
flat hunting in london
Para quartos:
http://www.gumtree.com/
http://uk.easyroommate.com/
http://www.spareroom.co.uk/
Cuidado com os scams no gumtree, ha bastantes.
Para casas:
http://rightmove.co.uk
http://www.moveflat.com/
@trodrigues
trodrigues / gist:3654769
Created September 6, 2012 10:55 — forked from jneves/gist:3654732
Greasemonkey script
// ==UserScript==
// @name Hootsuite promoted tweets never more
// @namespace http://localhost
// @description Remove hootsuite promoted tweets
// @include https://hootsuite.com/dashboard*
// @version 1
// ==/UserScript==
function addCss(cssString) {
var head = document.getElementsByTagName('head')[0];
@trodrigues
trodrigues / build utils
Created September 21, 2012 09:28
bash functions
uglify(){
./node_modules/uglify-js/bin/uglifyjs $1 > $2
if [ $? != 0 ] ; then
exit 1
fi
}
build_js(){
./node_modules/requirejs/bin/r.js -o $1 $rjsopt
es=$?
@trodrigues
trodrigues / gist:3878515
Created October 12, 2012 10:05
hidden classes
function Point(x, y) {
this.x = x;
this.y = y;
}
Point.prototype.addZ = function(val){
this.z = val;
};
var p1 = new Point(11, 22);
@trodrigues
trodrigues / gist:3952530
Created October 25, 2012 13:25
crazy var reference behavior on Android 2.3.6
function func(firstarg){
console.log(firstarg); // on Chrome it's defined, on Android 2.3.6 browser it's defined
var args = Array.prototype.splice.call(arguments, 0, arguments.length);
console.log(arguments[0]); // on Chrome it's undefined, on Android 2.3.6 browser it's undefined
console.log(firstarg); // on Chrome it's defined, on Android 2.3.6 browser it's *undefined*
}
func("hello");
function getProperty(){
for(var i in obj){
if(obj.hasOwnProperty(i)){
return i;
}
}
}
@trodrigues
trodrigues / gist:4223742
Created December 6, 2012 11:08
testing AMD modules and mocking dependencies with buster.js and sinon
define(['dependency'], function(dependency){
buster.testCase('some test', {
setUp: function(done){
var self = this;
this.someStub = sinon.stub(dependency, 'method');
require(['moduleToTest'], function(ModuleToTest){
self.instance = new ModuleToTest();
});
@trodrigues
trodrigues / diacriticsmap
Last active March 29, 2016 19:43
Diacritics in the OSX British/US keyboard (for Portuguese users or any other users of languages with diacritics)http://en.wikipedia.org/wiki/Diacritic
Mac OSX keyboard layout switching is a pain.
Using a keyboard layout different than the one actually printed on
your keys is also weird. The following keyboard shortcuts allow you
to create the various diacritics used in languages like Portuguese
on the British/US layout of a Mac keyboard.
Alt+e -> ´ Examples: é ó á
Alt+i -> ^ Examples: â ê
Alt+c -> ç