Skip to content

Instantly share code, notes, and snippets.

@geoquant
geoquant / machine.js
Created May 18, 2021 16:53
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@geoquant
geoquant / advanced-react-notes.md
Created September 10, 2019 17:43 — forked from indiesquidge/advanced-react-notes.md
Personal notes while working through Advanced React: https://courses.reacttraining.com/p/advanced-react

Advanced React by React Training

Personal notes while working through Advanced React: https://courses.reacttraining.com/p/advanced-react

Granted this is a contrived example, but it's still something I took notice to: in those "Advanced React" videos I've been watching, Ryan Florence codes very slowly, and does not make one quick change and jump back to the browser to see what changed.

He stops and thinks. He asks himself (or the viewer) questions. He wonders what

@geoquant
geoquant / slim-redux.js
Created March 8, 2019 17:17 — forked from gaearon/slim-redux.js
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-)
function mapValues(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
result[key] = fn(obj[key], key);
return result;
}, {});
}
function pick(obj, fn) {
return Object.keys(obj).reduce((result, key) => {
if (fn(obj[key])) {
@geoquant
geoquant / tweet_dumper.py
Last active August 26, 2015 17:19 — forked from yanofsky/LICENSE
A script to download all of a user's tweets into a csv
#!/usr/bin/env python
# encoding: utf-8
import tweepy #https://github.com/tweepy/tweepy
import csv
#Twitter API credentials
consumer_key = ""
consumer_secret = ""
access_key = ""
@geoquant
geoquant / scala-irc
Last active August 29, 2015 14:27 — forked from ymasory/scala-irc
List of all Scala-related IRC channels.
Please help compile a list of all Scala-related IRC rooms.
All of these channels are on Freenode.
#akka | concurrency & distribution framework
#argonaut | json library
#fp-in-scala | the book Functional Programming in Scala
#geotrellis | geoprocessing library
#indyscala | regional scala group
#json4s | json library
@geoquant
geoquant / sbtmkdirs.sh
Last active August 29, 2015 14:13 — forked from alvinj/sbtmkdirs.sh
#!/bin/bash
#------------------------------------------------------------------------------
# Name: sbtmkdirs
# Purpose: Create an SBT project directory structure with a few simple options.
# Author: Alvin Alexander, http://alvinalexander.com
# Info: http://alvinalexander.com/sbtmkdirs
# License: Creative Commons Attribution-ShareAlike 2.5 Generic
# http://creativecommons.org/licenses/by-sa/2.5/
#------------------------------------------------------------------------------
@geoquant
geoquant / gist:4137676
Created November 23, 2012 23:15
Percentile Ranking Function
# Function to calculate percentrank with a certain interval "gap"
# Input: "scoreVec" is a vector of scores
# "gap" is any speceficied interval
# output: vector of percentrank
percentrank<-function(scoreVec,gap)
{
scoreVec<-as.vector(scoreVec)
prank<-NULL
for(i in 1:length(scoreVec))
@geoquant
geoquant / 200day.R
Created July 15, 2012 22:46
backtesting in R
library(quantmod)
library(PerformanceAnalytics)
library(TTR)
###############################################################
### User Input ################################################
###############################################################
getSymbols("SPY", from = "1900-01-01", to="2012-06-01")
close <- SPY$SPY.Close
#!/bin/sh
### Make a directory to work from
mkdir -p ~/dev/R-libs
cd ~/dev/R-libs
### Check out source trees
svn co svn://svn.r-forge.r-project.org/svnroot/zoo/pkg/zoo
svn co svn://svn.r-forge.r-project.org/svnroot/xts/pkg/xts
svn co svn://svn.r-forge.r-project.org/svnroot/ttr/pkg ttr