This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:jessie | |
ENV DEBIAN_FRONTEND=noninteractive | |
RUN apt-get update \ | |
&& apt-get install -y x11-apps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package edrd | |
import java.util.WeakHashMap | |
import java.util.logging.Logger | |
import kotlin.random.Random | |
import kotlin.reflect.KClass | |
import kotlin.reflect.KProperty | |
import kotlin.system.measureTimeMillis | |
class Logging { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.UUID | |
import kotlin.reflect.KProperty | |
/** | |
* Returns a UUID that's always the same for the given property. | |
* | |
* Sample usage: | |
* | |
* val someId by FixedUUID // --> UUID.nameUUIDFromBytes("someId".toByteArray()) | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Configuration() { | |
private val allowedValueTypes = listOf(String::class, Int::class) | |
private val values = HashMap<String, Any>() | |
class InvalidArgumentError(override val message: String) : Exception(message) | |
fun set(name: String, value: Any) { | |
if (notAllowedValueType(value)) { | |
throw InvalidArgumentError("Type is ${value::class.simpleName}") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add a binding.pry call to the place to be inspected | |
binding.pry | |
# Check caller stack, keeping only application code | |
caller.grep_v(/\.rbenv/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typeset -A strExpansions=( | |
"rs" "rails server" | |
"rc" "rails console" | |
"be" "bundle exec" | |
"bi" "bundle install" | |
"gs" "git status" | |
"gl" "git log" | |
"gd" "git diff" | |
"gdh" "git diff HEAD" | |
"gpl" "git pull" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Usage: ./live ruby script.rb | |
configFile=$(mktemp) | |
cat > $configFile <<END | |
$2 { | |
prep +onchange: $1 @mods | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var notesOn = []; | |
function isNotePlaying(event) { | |
for (var i = 0; i < notesOn.length; i++) { | |
if (notesOn[i] && notesOn[i].pitch == event.pitch) { | |
return i; | |
} | |
} | |
return false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int THRESHOLD = 200; | |
void setup() { | |
Serial.begin(115200); | |
} | |
void loop() { | |
int lastValue = 0; | |
int sensorValue = analogRead(A0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
clear | |
ruby app.rb |
NewerOlder