Skip to content

Instantly share code, notes, and snippets.

View tashian's full-sized avatar

Carl Tashian tashian

View GitHub Profile

Keybase proof

I hereby claim:

  • I am tashian on github.
  • I am tashian (https://keybase.io/tashian) on keybase.
  • I have a public key whose fingerprint is DD93 39A1 C227 402D C24C 8F4E 9F41 8220 49B0 66A2

To claim this, I am signing this object:

@tashian
tashian / gist:8c699ce59d8f6c059714
Created May 16, 2014 22:08
redis_cacheable module: leverage RedisObjects in models
# lib/redis_cacheable.rb
module RedisCacheable
def self.included(base)
base.send(:include, Redis::Objects)
base.extend ClassMethods
end
module ClassMethods
@tashian
tashian / retention.js.coffee
Created August 11, 2015 16:51
Retention chart generator for Keen.io
# KeenIO stuff
#
CsvStringify = require 'csv-stringify'
Keen = require './keen_client.js.coffee'
Q = require 'q'
_ = require 'underscore'
moment = require 'moment-timezone'
class Retention
constructor: (@keenClient, @steps, @period = 'weeks') ->
@tashian
tashian / keen_client.js.coffee
Created August 11, 2015 17:25
A node-based HTTP API query buffer for Keen.io
KeenIO = require 'keen-js'
Q = require 'q'
class KeenClient
constructor: ->
@client = new KeenIO(
projectId: process.env.KEEN_PROJECT_ID
readKey: process.env.KEEN_READ_KEY
)
@started = false
> F = function() {}
function () {}
> F.prototype = new String("hello")
"hello"
> f = new F()
function () {}
> f.length
0
(why isn't this 5?)
@tashian
tashian / gist:2992588
Created June 26, 2012 01:34
show/hide/toggle elements - generalized JS
# General event handler for showing, hiding, and toggling elements.
#
# Usage: <a href="x" data-show="#my_form">
# If #my_form exists, we'll call show() on it.
# Otherwise, we'll follow the link to x.

Thoughts on improving Web Audio

Background: I'm working on a project that uses Web Audio API and synthesized sound. This is my first time using Web Audio API and I've struggled to find good sounds. Wishing the current libraries were more accessible to, for example, a game developer who would like to be able to select from a palette of interesting sounds.

With the benefit of an outsider's eye on web audio, I see four issues with synth libs right now:

  1. they aren't opinionated enough. not enough presets, simulations, or good-sounding defaults
  2. documentation is often not playable or tweakable (seems critical for a music lib)
  3. no easy way to twist some knobs and generate sound snippits (JSON?) that I can use in my program
  4. the syntax for many of the libraries feels clunky to me
@tashian
tashian / circle.yml
Last active August 24, 2017 07:47
Rails/Heroku CircleCI deploy script
checkout:
post:
- git submodule sync
- git submodule update --init # use submodules
deployment:
production:
branch: production
commands:
- ./bin/heroku_deploy.sh yerdle:
timeout: 300
@tashian
tashian / badsort.py
Last active July 1, 2018 23:19
Bad algorithms #1: bad sort!
import random
def badsort(l):
done = False
loops = 0
while not done:
loops += 1
random.shuffle(l)
done = True
for i in range(len(l)-1):
@tashian
tashian / README.md
Last active December 4, 2020 17:52
Just-in-time label printing on the Zebra ZP450 using node.js + Easypost + Pusher + cups

This is the script we use at yerdle to print labels from our Rails backend to our Zebra ZP450 printer.

the Zebra

See this blog post for the whole story.