Skip to content

Instantly share code, notes, and snippets.

View gnclmorais's full-sized avatar
🐙
Growing a beard

Gonçalo Morais gnclmorais

🐙
Growing a beard
View GitHub Profile
@Couto
Couto / restore_console.js
Created March 6, 2014 18:04
Little bookmarklet to restore the console on those websites that disable it (netflix)
javascript:(function () {
var iframe = document.createElement("iframe"),
console;
iframe.src = "about:blank";
iframe.style.display = "none";
document.body.appendChild(iframe);
console = (iframe.contentWindow || iframe.contentDocument).console;
iframe.parentNode.removeChild(iframe);
@magalhini
magalhini / development.md
Last active August 29, 2015 14:09
Web Development: Articles & Resources
@heartcode
heartcode / scroll-window-to.js
Created February 11, 2012 23:23
Scrolls the window to the required position (Please note that this snippet works best with top scrolling just for now)
/*
* Scrolls the window to the required position using animation with custom easing.
* The required position can be set with the 1st argument ('position');
* The fineness of the animation can be customized by using the 'speed' (2nd) argument, which ranges between 0.1 (very fine) and 1 (instant jump).
* Usage #1:
* scrollWindowTo(0, 0.2); // -> Scrolls the page to the top with a fine animation
* Usage #2:
* scrollWindowTo(100, 1); // -> Makes the page jump to 100px
*/
var scrollWindowTo = (function(){
@Couto
Couto / walk.js
Created April 17, 2012 19:22
Walk along an array of asynchronous functions
/**
* walk
* small function to walk along an array of functions
* each function walked gets an extra argument
* that argument is a function that should be called
* to notify the walk function to step to the next function
* the arguments given at call time are passed to the next function
*
* @function
* @param {Array} fns Array of functions
@Couto
Couto / namespace.js
Created May 10, 2012 14:21
Small & Recursive Namespace function
function namespace (ns) {
var parts = ns.split('.'),
root = window || this;
return (function walk (obj) {
if (!root[obj]) { root[obj] = {}; }
root = root[obj];
if (parts.length) { walk(parts.shift()); }
return root;
}(parts.shift()));
@tomschlick
tomschlick / gist:3984898
Created October 31, 2012 05:02
Sublime Text 2 Keybindings to Resize Split Panes
[
{
"keys": ["super+alt+left"],
"command": "set_layout",
"args":
{
"cols": [0.0, 0.33, 1.0],
"rows": [0.0, 1.0],
"cells": [[0, 0, 1, 1], [1, 0, 2, 1]]
}
/**
* __series
* Given an array of functions, it will call every function,
* once at a time, sequentially.
* Every function will have a trigger function as its last argument,
* that should be called when the function is done.
* If arguments are given to this trigger function, those will be passed
* to the next function.
*
* @example
@Couto
Couto / SSL_cert_creation.sh
Last active January 2, 2016 02:39
Create random SSL certificates for use in development.
# Generate SSL Certificate for dev
export DOMAIN="example.dev"
export PASSPHRASE=$(head -c 500 /dev/urandom | tr -dc a-z0-9A-Z | head -c 128; echo)
export SUBJ="
C=PT
ST=Aveiro
O=Example Organization
localityName=Aveiro
commonName=$DOMAIN
@Couto
Couto / globalVariables.js
Last active June 6, 2016 15:47
Small snippet to detect global variables.
(function (global) {
'use strict';
var globals = [];
var iframe = document.createElement('iframe');
var cleanWindow;
iframe.src = 'about:blank';
iframe.style.display = 'none';
document.body.appendChild(iframe);