Skip to content

Instantly share code, notes, and snippets.

@felipeochoa
felipeochoa / el-reportero.js
Created April 5, 2017 23:08
JSON reporter for jest
const fs = require("fs");
const path = require("path");
const mkdirp = require("mkdirp");
// when use use fit, jasmine never calls suiteStarted / suiteDone, so make a fake one to use
const fakeFocusedSuite = {
id: 'focused',
description: 'focused specs',
fullName: 'focused specs'
};

Keybase proof

I hereby claim:

  • I am felipeochoa on github.
  • I am fovc (https://keybase.io/fovc) on keybase.
  • I have a public key whose fingerprint is 6AEE AC8F 9B16 8B71 430C 16A6 EA6F 759A D809 0E61

To claim this, I am signing this object:

@felipeochoa
felipeochoa / react-context-as-dynamic-scope.jsx
Created November 13, 2016 09:15
Testing the overriding of parent context in children
/**
* Children can override parent's context, which means context is a form of dynamic scoping.
* Tested at: https://jsfiddle.net/79e293az/
* https://cdnjs.cloudflare.com/ajax/libs/react/15.3.2/react.js
* https://cdnjs.cloudflare.com/ajax/libs/react/15.3.2/react-dom.js
*/
class Parent extends React.PureComponent {
getChildContext() {
/* When using a PureComponent, changes to the store will still trigger re-renders of the children
*
* Tested with https://jsfiddle.net/poqf128w/4/
*
* https://cdnjs.cloudflare.com/ajax/libs/react/15.3.2/react.js
* https://cdnjs.cloudflare.com/ajax/libs/react/15.3.2/react-dom.js
* https://cdnjs.cloudflare.com/ajax/libs/redux/3.6.0/redux.js
* https://cdnjs.cloudflare.com/ajax/libs/react-redux/4.4.5/react-redux.js
*/
const names = [
(defun fov-list-packages-and-versions ()
"Returns a list of all installed packages and their versions"
(mapcar
(lambda (pkg)
`(,pkg ,(package-desc-version
(cadr (assq pkg package-alist)))))
package-activated-list))
;; Unfortunately the following function does not work
;; if the specific versions you need aren't the latest
// ==UserScript==
// @name Check Netflix availability from you IMDB watchlist
// @namespace https://github.com/felipeochoa
// @description Filter your IMDB watchlist based on Netflix availability
// @author https://github.com/felipeochoa
// @include http://www.imdb.com/user/*/watchlist
// @include http://www.imdb.com/user/*/watchlist?*
// @include https://www.imdb.com/user/*/watchlist
// @include https://www.imdb.com/user/*/watchlist?*
// @version 1.0
#!/usr/bin/env python3
"""
Used to fetch cover art. Based heavily on obeythepenguin's
`Cover Fetcher' (http://coverfetcher.sourceforge.net/)
obeythepenguin AT users.sourceforge.net, but attempting to
provide a CLI interface.
"""
import argparse
@felipeochoa
felipeochoa / xltoken.py
Last active August 29, 2015 14:23
A regular expression to tokenize excel formulae
import re
TOKEN_RE = re.compile(r"""
(?P<scientific>[1-9](?:\.[0-9]+)?[Ee][+-]?[1-9][0-9]*)|
(?P<string>"(?:[^"]*"")*[^"]*"(?!"))|
(?P<link>'(?:[^']*'')*[^']*'(?!'))|
(?P<sq_bracket>\[[^]]*\])|
(?P<error>\#NULL!|\#DIV/0!|\#VALUE!|\#REF!|\#NAME?|\#NUM!|\#N/A)|
(?P<wspace>\ +)|
(?P<operator>[-+*/^&=%]|>=|<=|<>|>(?!=)|<(?![=>]))|