Skip to content

Instantly share code, notes, and snippets.

View oirodolfo's full-sized avatar
🏳️‍🌈

Rod Kisten (Costa) oirodolfo

🏳️‍🌈
View GitHub Profile
@oirodolfo
oirodolfo / 1.js
Created July 5, 2016 18:00 — forked from mxriverlynn/1.js
when "this" attacks with ES6 arrow functions
FileSchema.method("getDownloadUrl", (cb) => {
var options = {
Bucket: "watchmecode-net",
Key: this.name // <= "this" right here, points at the wrong thing!!!
};
var s3 = new AWS.S3();
s3.getSignedUrl("getObject", options, cb);
})
@oirodolfo
oirodolfo / 2-front-end-tips-to-keep-in-mind.md
Created October 4, 2016 14:30 — forked from nepsilon/2-front-end-tips-to-keep-in-mind.md
2 front-end tips to keep in mind — First published in fullweb.io issue #68

2 front-end tips to keep in mind

1. Stop using .innerHTML = ''; when removing children to a DOM element.

On modern browsers it seems to be about 400× (!!) slower than this DOM-friendly method:

while (el.firstChild)
    el.removeChild(el.firstChild);
@oirodolfo
oirodolfo / request.js
Created November 21, 2016 16:29 — forked from wouterbulten/request.js
Wrapper for fetch
import 'whatwg-fetch';
/**
* Requests a URL, returning a promise
*
* @param {string} url The URL we want to request
* @param {object} [options] The options we want to pass to "fetch"
*
* @return {object} An object containing either "data" or "err"
*/
@oirodolfo
oirodolfo / incept-minikube.sh
Created March 14, 2017 21:18 — forked from osowski/incept-minikube.sh
Install Minikube, Kubectl, and Virtualbox on Ubuntu
#Installing VirtualBox
echo "Installing VirtualBox........................"
sudo apt-get install virtualbox
#Installing kubectl https://kubernetes.io/docs/getting-started-guides/kubectl/
echo "Installing kubectl..........................."
wget https://storage.googleapis.com/kubernetes-release/release/v1.4.4/bin/linux/amd64/kubectl
chmod +x kubectl
sudo mv kubectl /usr/local/bin/kubectl
@oirodolfo
oirodolfo / I0lO-0.py
Created June 1, 2017 02:34 — forked from anonymous/I0lO-0.py
null created by anonymous - https://repl.it/I0lO/0
from collections import defaultdict
D=defaultdict(list)
def addedge(a,b):
D[a].append(b)
D[b].append(a)
addedge(1,2)
addedge(2,3)
@oirodolfo
oirodolfo / bfs.clj
Created June 4, 2017 01:14 — forked from luxbock/bfs.clj
Clojure Zipper Breadth First Search
(defn breadth-first-search [z]
(letfn [(zip-children [loc]
(when-let [first-child (zip/down loc)]
(take-while (comp not nil?)
(iterate zip/right first-child))))])
(loop [ret []
queue (conj clojure.lang.PersistentQueue/EMPTY z)]
(if (seq queue)
(let [[node children] ((juxt zip/node zip-children) (peek queue))]
(recur (conj ret node) (into (pop queue) children)))
@oirodolfo
oirodolfo / createElement.js
Created September 1, 2017 16:53 — forked from MoOx/createElement.js
A tiny helper for document.createElement.
module.exports = function(options) {
var el
, a
, i
if (!options.tagName) {
el = document.createDocumentFragment()
}
else {
el = document.createElement(options.tagName)
if (options.className) {
@oirodolfo
oirodolfo / bash-cheatsheet.sh
Created September 3, 2017 20:48 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@oirodolfo
oirodolfo / redux-fetch-interceptors.js
Created September 5, 2017 08:12 — forked from jaysoo/redux-fetch-interceptors.js
Redux + fetch interceptors
/*
* WARNING: Mutates the fetchContext argument (by default the window or global context).
*
* A crude way to intercept fetch responses, and dispatch actions as needed. Using this
* for more global app concerns, where I may want to dispatch actions depending on the response
* status or body. e.g. When seeing a 401, dispatch a logout action.
*
* In most cases, I'd recommend using a middlware as shown in redux's real-world example.
* (https://github.com/reactjs/redux/blob/master/examples/real-world/middleware/api.js)
*
@oirodolfo
oirodolfo / 0_reuse_code.js
Created September 5, 2017 09:02
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console