Skip to content

Instantly share code, notes, and snippets.

from kivy.app import App
from kivy.lang import Builder
from kivy.uix.widget import Widget
from kivy.core.image import Image
from kivy.properties import ObjectProperty
Builder.load_string("""
<BackgroundTest>:
canvas:
@jmaicher
jmaicher / geofix
Created March 11, 2013 09:07
Simple tcl script for sending geo locations to the android emulator via telnet. Usage: geofix lng lat [port]
#!/usr/bin/expect
log_user 0 # supress output
switch -regexp [llength $argv] {
[0,1] {
puts "Usage: geofix lng lat \[port\]"
exit
}
3 { set port [lindex $argv 2] }
@jmaicher
jmaicher / Unit.java
Created December 11, 2012 10:06
Unit testing anonymous inner classes as event listener
public class Unit {
public Unit(EventDispatcher dispatcher) {
dispatcher.addHandler(MyEvent.class, new IEventHandler() {
public void onEvent(MyEvent event) {
// some behavior
}
});
if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="white"; fi
PROMPT='%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[blue]%}%B%c/%b%{$reset_color%} $(git_prompt_info)$(svn_prompt_info)%(!.#.») '
RPROMPT='[%*]'
# git prompt styling
ZSH_THEME_GIT_PROMPT_PREFIX="[git:%{$fg_bold[white]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX=""
ZSH_THEME_GIT_PROMPT_CLEAN="%{$reset_color%}] "
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}⚡%{$reset_color%}] "
$(function() {
var socket = io.connect('/speaker');
socket.on('connect', function() {
// send session to server
socket.emit('join', { session_id: session.get('id') });
socket.on('join.success', function(data) {
$(document).on('deck.change', slideChange);
});
var socket = io.connect('/global');
socket.on('server-news', function(data) {
console.log(data.i);
socket.emit('client-news', { i: data.i + 1 });
});
@jmaicher
jmaicher / gist:3089218
Created July 11, 2012 09:15
Quicksort in Haskell with intensional defined lists
quicksort [] = []
quicksort (x:xs) =
quicksort [ y | y <- xs, y < x ] ++
[x] ++
quicksort [ y | y <- xs, y >= x ]
@=~
~p maximum_input_line_length = infinity
~O~<Test.gla~>~{
Ident: C_IDENTIFIER
~}
~O~<Test.con~>~{
Test: foo bar.
bar: '-'+.
@jmaicher
jmaicher / fixtures.js.erb
Created May 3, 2012 13:51
JavaScript fixtures with rails and require.js
define([
'underscore'
], function(_) {
var Fixtures = (function() {
var _timezones;
_timezones = <%= ActiveSupport::TimeZone::zones_map.to_json %>;
return {
@jmaicher
jmaicher / gist:2049779
Created March 16, 2012 12:02
Streama (Specification of Activities)
# Is it possible with the current streama DSL to explicitly say that the verb is not the identifier?
activity :created_event do
actor :user, :cache => [:username, :slug]
verb :post
object :event, :cache => [:name, :acronym, :slug]
end
# The combination of actor, verb, object (and target) has implicit and unique representation of the activity
# => maybe the identifier can be ommitted?
activity do