Skip to content

Instantly share code, notes, and snippets.

Avatar

Tristan Wietsma tristanwietsma

  • Chicago, Illinois
View GitHub Profile
@tristanwietsma
tristanwietsma / .block
Created Oct 6, 2017 — forked from mbostock/.block
Brush & Zoom
View .block
license: gpl-3.0
View gist:bc611463e0131f067f7e5633d0120ac0
quant=> \d+ regsho
Table "public.regsho"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+--------+-----------+----------+--------------+-------------
Symbol | text | | extended | |
Date | text | | extended | |
ShortVolume | bigint | | plain | |
TotalVolume | bigint | | plain | |
Indexes:
"ix_regsho_Date" btree ("Date")
@tristanwietsma
tristanwietsma / ch1.md
Last active May 17, 2019
Scala for the Impatient
View ch1.md

Exercise 1

scala> 3.
%   +   >    >>>            isInstanceOf   toDouble   toLong     unary_+   |
&   -   >=   ^              toByte         toFloat    toShort    unary_-
*   /   >>   asInstanceOf   toChar         toInt      toString   unary_~

Exercise 2

View README
# Jest Example
This is directly from the jest website.
## Requirements
- node
- npm
## Install
@tristanwietsma
tristanwietsma / hist.go
Created Oct 1, 2014
Golang image histogram (taken from Go site)
View hist.go
package main
import (
"flag"
"fmt"
"image"
_ "image/gif"
_ "image/jpeg"
_ "image/png"
"log"
@tristanwietsma
tristanwietsma / term2gif.sh
Created Aug 27, 2014
Record terminal session to GIF
View term2gif.sh
#!/bin/bash
TIMING=$1
SCRIPT=$2
W=$WINDOWID
rm -rf /tmp/script-replay-gifs/
mkdir /tmp/script-replay-gifs/
t=$(mktemp)
View app.js
/*
** Client side - /public/src/app.js
*/
var myApp = {
// Collections
Collections: {
list: Backbone.Collection.extend()
},
// Views
View app.coffee
class LazyCollection extends Backbone.Collection
indexQuerystring: 'index'
index: 1
lastLength: 0
fetch: (options) ->
options or= {}
if options.reset
@index = 1
@lastLength = 0
else
View polar.rb
require 'pp'
require 'socket'
module BluetoothPolarHrm
AF_BLUETOOTH=31 # these are correct for the Linux Bluez stack
BTPROTO_RFCOMM=3
class << self
def connect_bt address_str,channel=1
bytes=address_str.split(/:/).map {|x| x.to_i(16) }
s=Socket.new(AF_BLUETOOTH, :STREAM, BTPROTO_RFCOMM)
@tristanwietsma
tristanwietsma / mockery.py
Created Jul 8, 2014
Mocking Boto with Moto
View mockery.py
import boto
from moto import mock_s3
from model import MyModel
@mock_s3
def test_save_study():
conn = boto.connect_s3()
conn.create_bucket('mybucket')