Skip to content

Instantly share code, notes, and snippets.

View funkytaco's full-sized avatar

Luis Gonzalez funkytaco

View GitHub Profile
@funkytaco
funkytaco / docker-compose.yml
Created April 11, 2018 22:48 — forked from slipo/docker-compose.yml
Super simple docker compose file giving you a private NEO network and neon-wallet-db ... see comments.
version: '3'
services:
neon-wallet-db:
container_name: "neon-wallet-db"
image: slipoh/neon-wallet-db:latest
environment:
- MONGOURL=mongodb:27017
- MONGOPASS=neo
- MONGOUSER=gas
- MONGOAPP=test
import axios from 'axios'
function api(user, pass) {
return axios.create({
'X-User':user,
'X-Password':pass
})
}
import axios from 'axios'
function api(user, pass) {
return axios.create({
'X-User':user,
'X-Password':pass
})
}
@funkytaco
funkytaco / test.sh
Created September 23, 2017 07:16 — forked from mikeclarke/test.sh
Simple bash script that uses Docker to build a test container, run tests inside the container, tag successful builds, and clean up after itself.
#!/bin/bash
sudo docker build -t $JOB_NAME/$BUILD_NUMBER .
DB_NAME="/$JOB_NAME-$BUILD_NUMBER-db"
DB_CONTAINER=$(sudo docker run -d -name $DB_NAME <private repository URL>/database-schema)
sudo docker run -link $DB_NAME:db -t $JOB_NAME/$BUILD_NUMBER nosetests
sudo docker tag $JOB_NAME/$BUILD_NUMBER <private repository URL>/${JOB_NAME}-master
sudo docker push <private repository URL>/${JOB_NAME}-master >/dev/null
sudo docker kill ...
sudo docker rm ...
sudo docker rmi ...
@funkytaco
funkytaco / uri.js
Created July 20, 2017 10:14 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
#!/usr/bin/env node
/*
Use the Yahoo Finance CSV API to do some basic market research calculations.
- Background: http://greenido.wordpress.com/2009/12/22/yahoo-finance-hidden-api/
- Example URL: http://finance.yahoo.com/d/quotes.csv?s=GOOG+FB+AAPL&f=snj1pr
s: Symbol
n: Name
j1: Market Capitalization (in billions)
p: Price-per-share (at previous close)
#!/usr/bin/env node
/*
Use the Yahoo Finance CSV API to do some basic market research calculations.
- Background: http://greenido.wordpress.com/2009/12/22/yahoo-finance-hidden-api/
- Example URL: http://finance.yahoo.com/d/quotes.csv?s=GOOG+FB+AAPL&f=snj1pr
s: Symbol
n: Name
j1: Market Capitalization (in billions)
p: Price-per-share (at previous close)
@funkytaco
funkytaco / post.md
Created November 30, 2016 22:59 — forked from simonexmachina/post.md
JavaScript and Object Models

JavaScript and Object Models

A "choose your own adventure" story

JavaScript is has both object-oriented and functional heritage, thanks to its two parents: Scheme and Self.

It provides first class functions and makes it simple to compose these function objects into bundles of awesome. Even though I'm an OO "true believer" at heart, I find myself composing my code using functional concepts, and use the OO approach where there's a clear benefit or where I feel that it's the best way to communicate the interface.

Object-oriented software design is by no means the only way to do software design, but it's been an immensely successful model for a very long time now, and provides a clear and well-understood mental model for thinking and communicating about software. Lots of good ideas like encapsulation, delegation, traits and composition fit well into OO design.

@funkytaco
funkytaco / valueInspector.jsx
Created September 23, 2016 00:55 — forked from luggage66/valueInspector.jsx
CFDump-like output for JS objects
import React, { Component } from 'react';
import './valueInspector.less';
import Immutable from 'immutable';
export default class ValueInspector extends Component
{
render() {
let referenceTracker = new CircularReferenceTracker();
let path = Immutable.List();
@funkytaco
funkytaco / candy_calculator.py
Created July 17, 2016 19:26
Pokemon: GO Candy/Evolution Calculator
def main():
while True:
try:
pokemon = int(input("How many Pokemon do you have? "))
if pokemon >= 0:
break
raise ValueError
except ValueError:
print("Invalid number")