Skip to content

Instantly share code, notes, and snippets.

Avatar

Alan Pierce alangpierce

  • Benchling
  • San Francisco, CA
View GitHub Profile
@alangpierce
alangpierce / keep_refreshing_token.sh
Created May 12, 2014
BigQuery token refresh scripts for KA dev environment
View keep_refreshing_token.sh
#!/bin/sh
while [ 1 ]
do
./refresh_bigquery_token.sh
sleep 10
done
@alangpierce
alangpierce / GraphGenerator.java
Last active Aug 29, 2015
Java class that walks the Dagger dependencies in the KA code and generates a .dot file to use for a visual representation.
View GraphGenerator.java
package org.khanacademy.android.graphgen;
import org.khanacademy.android.dependencies.components.ApplicationComponent;
import dagger.Component;
import dagger.Provides;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
@alangpierce
alangpierce / decaffeinate.py
Last active Aug 6, 2016
Benchling decaffeinate wrapper script
View decaffeinate.py
#!/usr/bin/env python
import argparse
from collections import Counter, namedtuple
import json
import os
import subprocess
import sys
import textwrap
import urllib
import webbrowser
@alangpierce
alangpierce / rd-to-create-element.js
Created Aug 31, 2016
Benchling jscodeshift script to convert code to use React.createElement
View rd-to-create-element.js
/**
* jscodeshift script to convert our way of creating React elements in CoffeeScript to
* React.createElement. The create-element-to-jsx script then converts the result to JSX.
*
* For example, this code:
* rd.div(myProps, child1, child2)
*
* becomes:
* React.createElement('div', myProps, child1, child2)
*
@alangpierce
alangpierce / BigBingo
Last active Jan 11, 2017
BigBingo (as of early July 2014)
View BigBingo
Snapshot of Khan Academy's BigBingo A/B testing framework and related code.
Here's a basic overview:
-summarize.py is the most interesting file. It contains all stages of the
summarize task, as well as the publish and archive steps that happen at the
end.
-bq_pipelines.py contains lots of useful pipelines for interacting with
BigQuery. QueryToTableBatchPipeline can run many simultaneous queries, and will
properly handle all batching and retry logic.
-config.py is where all experiment configuraiton lives. For this Gist, I
@alangpierce
alangpierce / all-soak-examples.txt
Created Jul 23, 2017
Instances of soak operations in the Atom codebase
View all-soak-examples.txt
Example from repos/atom/atom/spec/atom-environment-spec.coffee:
637 |
638 | afterEach ->
> 639 | subscription?.dispose()
| ^^^^^^^^^^^^^^^^^^^^^
640 |
641 | it "invokes onUpdateAvailable listeners", ->
Example from repos/atom/atom/spec/atom-reporter.coffee:
@alangpierce
alangpierce / assign-soak-examples.txt
Created Jul 24, 2017
Examples of soaked assignments in CoffeeScript
View assign-soak-examples.txt
Example from repos/atom/atom/src/main-process/spawner.coffee:
29 | spawnedProcess.on 'close', (code, signal) ->
30 | error ?= new Error("Command failed: #{signal ? code}") if code isnt 0
> 31 | error?.code ?= code
| ^^^^^^^^^^^
32 | error?.stdout ?= stdout
33 | callback?(error, stdout)
Example from repos/atom/atom/src/main-process/spawner.coffee:
View giraffes.coffee
class Giraffe
if ENABLE_LOUD_GIRAFFES
roar: ->
return 'ROAR!!!'
else
roar: ->
return 'roar...'
View giraffes.js
class Giraffe {
if (ENABLE_LOUD_GIRAFFES) {
roar() { // <- Unexpected token, expected ; (3:11)
return 'ROAR!!!';
}
} else {
roar() {
return 'roar...';
}
}
View markers.coffee
colors = (marker.color for marker in getMarkers())