Skip to content

Instantly share code, notes, and snippets.

👨‍💻

Pedro Baptista Afonso pedrombafonso

👨‍💻
  • London, United Kingdom
Block or report user

Report or block pedrombafonso

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pedrombafonso
pedrombafonso / .eslintrc
Created May 22, 2016 — forked from cletusw/.eslintrc
ESLint Reset - A starter .eslintrc file that resets all rules to off and includes a description of what each rule does. From here, enable the rules that you care about by changing the 0 to a 1 or 2. 1 means warning (will not affect exit code) and 2 means error (will affect exit code).
View .eslintrc
{
// http://eslint.org/docs/rules/
"ecmaFeatures": {
"binaryLiterals": false, // enable binary literals
"blockBindings": false, // enable let and const (aka block bindings)
"defaultParams": false, // enable default function parameters
"forOf": false, // enable for-of loops
"generators": false, // enable generators
"objectLiteralComputedProperties": false, // enable computed object literal property names
@pedrombafonso
pedrombafonso / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@pedrombafonso
pedrombafonso / liveclicker.js
Created Dec 13, 2014
LiveClicker Video - Random code helpers for liveclicker
View liveclicker.js
// checks play time
var checkTimeInterval = 500;
setInterval(function detectVideoPlay() {
try {
var player = $('embed', $el)[0];
if (player.getSettings().playTime > Number($el.data('duration'))) {
pause(element);
}
} catch(e) { }
}, checkTimeInterval);
@pedrombafonso
pedrombafonso / ge.tmux
Created Apr 22, 2014
tmux config for launching development tools
View ge.tmux
#!/bin/bash
shopt -s expand_aliases
source ~/.bash_profile;
PROJ_ROOT='~/dev/minuscode/dev/gitescrow/proj'
cd $PROJ_ROOT;
gco develop;
@pedrombafonso
pedrombafonso / statistics-distributions.js
Last active Jan 4, 2016 — forked from benrasmusen/statistics-distributions.js
Statistics distributions module for node.js
View statistics-distributions.js
/*
* NAME
*
* statistics-distributions.js - JavaScript library for calculating
* critical values and upper probabilities of common statistical
* distributions
*
* SYNOPSIS
*
*
@pedrombafonso
pedrombafonso / quick_sort.js
Created May 29, 2013
Quick sort Sorts JSON complex type arrays by property
View quick_sort.js
function partition ( list, prop, begin, end, pivot ) {
var piv = list[pivot];
swap (list, pivot, end-1 );
var store = begin;
var ix;
for ( ix = begin; ix < end - 1; ++ix ) {
if ( list[ix][prop] <= piv[prop] ) {
swap (list, store, ix );
++store;
}
@pedrombafonso
pedrombafonso / cleanObject.js
Last active Dec 16, 2015
Cleans JSON objects by removing undesired properties and promoting nested objects (set parent = child) recursively.
View cleanObject.js
/*
@function cleanObject - Cleans javascript objects recursively (removes and promotes [parent = child] properties)
@param {Object} obj - Object to be clean
@param {Array} toRemove - array composed by the property names to be removed
@param {Array} toPromote - array composed by the property names to be promoted to the parent's value
*/
function cleanObject(dirtyObj, toRemove, toPromote) {
var obj = JSON.parse(JSON.stringify(dirtyObj));
var itemsObj;
var o;
You can’t perform that action at this time.