Skip to content

Instantly share code, notes, and snippets.

View caseycrites's full-sized avatar

Casey W Crites caseycrites

  • San Francisco, CA
View GitHub Profile
@caseycrites
caseycrites / role.json
Last active January 4, 2016 21:19
Installing the latest available node.js binary for arm on raspberry-pi via chef with the cookbook installed using the command `knife cookbook site install nodejs -o cookbooks`
"override_attributes": {
"nodejs": {
"install_method": "binary",
"version": "0.10.22",
"checksum_linux_arm-pi": "8a167e036e34e80627891d9ddc22dbd2306d39441f318d42104dcf6e704703a1"
}
}
Something.prototype.aFunction = function() {
var _this = this
this.collection.forEach(_this.bFunction)
this.collection.forEach(function(item) {
_this.bFunction(item)
})
}
Something.prototype.bFunction = function(item) {
public static final Map<String, String> STATIC_MAP;
static {
Map<String, String> someMap = new HashMap<String, String>();
someMap.put("hey", "you");
someMap.put("what's", "up");
STATIC_MAP = Collections.unmodifiableMap(someMap);
}
Set<String> someSet = new HashSet<String, String>(Arrays.asList("1", "2", "3"));
public static final Map<String, String> STATIC_MAP;
static {
Map<String, String> someMap = new HashMap<String, String>();
someMap.put("hey", "you");
someMap.put("what's", "up");
STATIC_MAP = Collections.unmodifiableMap(someMap);
}
Set<String> someSet = new HashSet<String, String>(Arrays.asList("1", "2", "3"));
# attributes/default.rb
passtools = default["passtools-backend"]
passtools.what = 'what the fuck'
default["passtools-backend"].huh = 'heyo'
# recipes/default.rb
passtools = node["passtools-backend"]
node["passtools-backend"].huh # works
passtools.what # attribute what not defined
@caseycrites
caseycrites / kill-fitbit.sh
Created January 28, 2013 19:56
Kill the fitbitd daemon.
#!/bin/sh
ps ax | grep fitbitd | grep -v 'grep' | awk '{ print $1 }' | xargs sudo kill -9
@caseycrites
caseycrites / broncos_fan_email.txt
Last active December 10, 2015 14:48
Finding out how to pay my Broncos fan friend his fantasy football winnings.
Hey hillman, hope everything is going caldwell. I knowshon you're bizzy as a miller, but
was wondering how to peyton you for your near champ-ionship. Also, super stokley to have
you be a fantasy base-ball prater this year. Hopefully you don't get upset and colquitt
after my team hits too many upper deckers against you or some other dreesen. Anyway, tell
those Nootsen cladys and Elway hello.
- Brock Osweiler
"Elvis has left the building!"
package com.urbanairship.util;
import android.util.SparseArray;
public class SparseStringArray extends SparseArray<String> {
public SparseStringArray() {
this(10);
}
/**
* Returns an index for which {@link #valueAt} would return the
* specified key, or a negative number if no keys map to the
* specified value.
* Beware that this is a linear search, unlike lookups by key,
* and that multiple keys can map to the same value and this will
* find only one of them.
*/
public int indexOfValue(E value) {
if (mGarbage) {
@caseycrites
caseycrites / AsyncTest.Java
Created July 10, 2012 15:52
Properly test async Android code
/*
I've been writing tests for Android code that uses Handlers to communicate with background threads.
I couldn't get my callbacks to be called back to.
I got angry.
I finally found the solution...after way too much looking.
Here it is.
*/
package com.caseycrites.android.testexample