Skip to content

Instantly share code, notes, and snippets.

View robbieferrero's full-sized avatar

Robbie Ferrero robbieferrero

View GitHub Profile
@robbieferrero
robbieferrero / index.html
Created July 9, 2018 03:18
The div that look different in every browser
<div></div>
@robbieferrero
robbieferrero / test.c
Created May 24, 2018 16:33
unique words in C
#include <assert.h>
#include <ctype.h>
#include <stdio.h>
#include <string.h>
enum { MAX_WORDS = 64, MAX_WORD_LEN = 20 };
int main(void)
{
char words[MAX_WORDS][MAX_WORD_LEN];
<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
<opml version="1.0">
<head>
<title>Pocket Casts Feeds</title>
</head>
<body>
<outline text="feeds">
<outline type="rss" text="JavaScript Jabber Only" xmlUrl="https://feeds.feedwrench.com/js-jabber.rss" />
<outline type="rss" text="The Moth" xmlUrl="http://feeds.feedburner.com/themothpodcast" />
<outline type="rss" text="Bullseye with Jesse Thorn" xmlUrl="https://www.npr.org/rss/podcast.php?id=510309" />
@robbieferrero
robbieferrero / Untitled-1
Created December 17, 2017 04:34
getStyleValue
/**
*
* @param el Element
* @param CSS property in hyphen case
* @param pseudo pseudo selector (optional)
*/
function getStyleValue(el, property, pseudo) {
// convert hyphen-case to camelCase
const elStyle = el.style[property.replace(/(\-[a-z])/g, $1 => $1.toUpperCase().replace('-',''))];
return ((elStyle !== '' && !pseudo)
@robbieferrero
robbieferrero / deepFlatten.js
Last active December 4, 2017 19:18
Deep Flatten
/**
* A utility function to flatten an array, nested to any depth.
* @param {Array} initialArray
*
*/
function deepFlatten(initialArray) {
return initialArray.reduce((acc, v) => {
return acc.concat(Array.isArray(v) ? deepFlatten(v) : v);
}, []);
}
@robbieferrero
robbieferrero / slowtractor.js
Last active March 18, 2017 19:22
make protractor slow
var origFn = browser.driver.controlFlow().execute;
browser.driver.controlFlow().execute = function() {
var args = arguments;
// queue 100ms wait
origFn.call(browser.driver.controlFlow(), function() {
return protractor.promise.delayed(100);
});
@robbieferrero
robbieferrero / gist:3b3373b00eb5f4a09e7e
Created December 19, 2014 19:13
javascript is fun
[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]](([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+
@robbieferrero
robbieferrero / gist:ddb338178fb489b83bf7
Created July 9, 2014 05:34
sublime text console.log
{ "keys": ["super+alt+l"],
"command": "insert_snippet",
"args": {
"contents": "console.log(${1:}$SELECTION);${0}"
}, "context":
[
{ "key": "selector", "operator": "equal", "operand": "source.js", "match_all": true }
]
},

Keybase proof

I hereby claim:

  • I am robbieferrero on github.
  • I am robbieferrero (https://keybase.io/robbieferrero) on keybase.
  • I have a public key whose fingerprint is 26B9 05CB 2200 63ED E084 EBDA D557 D0C3 C2AA 4A27

To claim this, I am signing this object:

@robbieferrero
robbieferrero / gist:cd240c48f00b609e4c1c
Last active August 29, 2015 14:02
better console.log
['log', 'warn'].forEach(function(method) {
var old = console[method];
console[method] = function() {
var stack = (new Error()).stack.split(/\n/);
// Chrome includes a single "Error" line, FF doesn't.
if (stack[0].indexOf('Error') === 0) {
stack = stack.slice(1);
}
var args = [].slice.apply(arguments).concat([stack[1].trim()]);
return old.apply(console, args);