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
// Data stored in DOM Session Storage (on supported browsers). | |
// create the SessionObject with a unique key name, then put data | |
// in to the data property. It will be JSONified to and fro automatically | |
// between page loads. | |
var SessionObject = function(key) { | |
this.data = null; | |
this.key = key; | |
this.store = window.sessionStorage; | |
if (this.store[this.key]) | |
{ |
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
<?php | |
/* | |
For Drupal, when using the IMCE file manager. | |
Decorates selected text fields with an "Upload/choose file" link next to them | |
that opens up the IMCE editor. $ids contains the array. | |
If I knew more about Drupal this would probably be a lot neater and require | |
less in-page Javascript. |
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 uk.co.halfninja.math; | |
/** | |
* Quaternions are data structures built from unicorn horns. | |
* | |
* I nabbed this implementation from The Internet. | |
*/ | |
public final class Quaternion { | |
private double x; | |
private double y; |
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
LOCAL_PATH := $(call my-dir) | |
include $(CLEAR_VARS) | |
LOCAL_MODULE := videokit | |
FFMPEG_LIBS := $(shell find ffmpeg -name '*.a') | |
LOCAL_CFLAGS += -Iffmpeg | |
LOCAL_LDLIBS += -llog $(FFMPEG_LIBS) | |
LOCAL_SRC_FILES := jni_interface.c | |
include $(BUILD_SHARED_LIBRARY) |
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
%w(so like totally whatever whatever? um uh yeah stuff dude shit but no cos).each do |word| | |
instance_eval %{def #{word}(w=nil); w; end} | |
end | |
# now you can code like this: | |
so like x = 3 and shit | |
um yeah so puts x or whatever? | |
yeah but no but yeah but no cos x = 3 or whatever |
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
// extend your class with JavaImports to expose these types | |
trait JavaImports { | |
type JBoolean = java.lang.Boolean | |
type JList[V] = java.util.List[V] | |
type JMap[K,V] = java.util.Map[K,V] | |
type JSet[V] = java.util.Set[V] | |
// Add more types as desired | |
} | |
// or import JavaImports._ |
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 | |
function usage() { | |
echo "Usage: deepgrep search-term file-pattern" | |
} | |
if [[ "$1" == "" || "$2" == "" ]]; then | |
usage | |
exit 1 | |
fi |
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
/* | |
* A selection of illustrative lines that describe a bit about how Scala does things | |
* and various parts of the language and/or library that you might find useful often. | |
*/ | |
// val is similar to a final variable in Java - it can't be reassigned | |
val filename = "log.txt" | |
// var can be changed | |
var filename = "log.txt" |
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 | |
## Encode a file to an MP4 that my TV can play. | |
## Assumes SD card is inserted at /media/NO_NAME, | |
## and Handbrake CLI is installed (apt-get install handbrake-cli). | |
## See "HandBrakeCLI -z" for list of presets. | |
SDCARD=/media/NO_NAME | |
HANDBRAKE_PRESET=Normal | |
function die() { | |
echo "$@" 1>&2 |
OlderNewer