Skip to content

Instantly share code, notes, and snippets.

@willwhitney
willwhitney / gist:e08a90c78d552ab9a4a8
Created April 30, 2015 15:49
Diff of unnecessarily brutal changes to get DC-IGN working without GPU
diff --git a/config.lua b/config.lua
index c1b1cb2..93c6984 100644
--- a/config.lua
+++ b/config.lua
@@ -1,6 +1,6 @@
require 'modules/prequire'
require 'modules/UnPooling'
-cunn_mod = prequire('cunn')
+-- cunn_mod = prequire('cunn')
--Global variables for config
@willwhitney
willwhitney / dirty.js
Last active August 29, 2015 14:26
a dirty private method
publicMethods = ['bark']
class Dog {
constructor() {
_secret = new Dog();
_.forOwn(this, (value, key) => {
if (_.isFunction(value)) {
if (_.contains(publicMethods, key)) {
express = require 'express'
lessMiddleware = require 'less-middleware'
moment = require 'moment'
content = require './content-manager'
app = express()
app.configure ->
app.set 'views', __dirname + '/views'
app.set 'view engine', 'jade'
app.use("/styles", lessMiddleware({ src: __dirname + '/styles'}))
@willwhitney
willwhitney / audobox-feedback-menu-demo.java
Last active December 20, 2015 17:28
A snippet demonstrating how to add Audobox Feedback to your app's menu.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
menu.add(
Menu.NONE, // Not part of a group
1990, // ID for the menu item (arbitrary, must match the case below)
Menu.NONE, // Order (set higher than other items to be lower in menu)
"Send feedback"); // Title for the menu item
return true;
}
@willwhitney
willwhitney / audobox-setup.java
Last active December 20, 2015 21:38
All the code it takes to get feedback with Audobox!
Audobox.createFeedbackDialog(this)
.withApiKey(your_api_key)
.show();
@willwhitney
willwhitney / audobox-permissions.xml
Created August 16, 2013 18:43
Permissions Audobox needs to run.
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE"/>
@willwhitney
willwhitney / actionbar_style.xml
Created September 18, 2013 23:23
android tab style
<style name="retroTabStyle" parent="@android:style/Widget.Holo.ActionBar.TabView">
<item name="android:showDividers">none</item>
<item name="android:measureWithLargestChild">true</item>
<item name="android:background">@drawable/tabs_background_selector</item>
<item name="android:gravity">center</item>
<item name="android:layout_weight">1</item>
</style>
<style name="retroTabBar" parent="@android:style/Widget.Holo.ActionBar.TabBar">
<item name="android:showDividers">middle</item>
@willwhitney
willwhitney / api.md
Last active February 12, 2016 18:45
Hydrogen Language Plugin API

Hydrogen Language Plugin API

Registering Your Provider

When your package is activated, a function called "myProviderFunctionName" in your package's main file [1] will be run, and it should return a Language Provider object as specified below.

[1] Your main file is specified by the "main" field of your package.json.

"providedServices": {
@willwhitney
willwhitney / propublica_per_capita.js
Last active May 13, 2016 04:19
Getting per-state per capita usage numbers from https://projects.propublica.org/checkup with jank javascript.
/*
To use me, go to one of the individual drug pages from propublica (e.g. https://projects.propublica.org/checkup/drugs/1726),
open the console (press ⌘-⌥-J on Mac),
paste in this script and hit Enter.
A new column should appear in your table.
This is very much hacked together in the console, so... no guarantees it will work next week.
*/
states = [[1, "California", 39144818],
Traceback (most recent call last):
File "/home/wwhitney/anaconda3/lib/python3.6/multiprocessing/process.py", line 249, in _bootstrap
self.run()
File "/home/wwhitney/anaconda3/lib/python3.6/multiprocessing/process.py", line 93, in run
self._target(*self._args, **self._kwargs)
File "/home/wwhitney/anaconda3/lib/python3.6/multiprocessing/pool.py", line 108, in worker
task = get()
File "/home/wwhitney/anaconda3/lib/python3.6/multiprocessing/queues.py", line 345, in get
return _ForkingPickler.loads(res)
File "/home/wwhitney/anaconda3/lib/python3.6/site-packages/torch/multiprocessing/reductions.py", line 86, in rebuild_storage_filename