Skip to content

Instantly share code, notes, and snippets.

View jbeard4's full-sized avatar

Jacob Beard jbeard4

View GitHub Profile
function getObj(){
//create a new object with a property and method, and return it
//the goal will be to call the method from java
return {
x : 1,
getX : function(){
return this.x;
}
};
}
@jbeard4
jbeard4 / pomodoro.sh
Created June 3, 2012 22:05
Implements the pomodoro technique in bash. Should work on most versions of Ubuntu >= 10.04
#decide on the task to be done
#set the pomodoro (timer) to 25 minutes
#work on the task until the timer rings; record with an x
#take a short break (5 minutes)
#every four "pomodoros" take a longer break (15-20 minutes)
n(){
notify-send "$1"
espeak -v en "$1" &
}
@jbeard4
jbeard4 / jscript-dot-net-fail.js
Created June 18, 2012 13:27
This illustrates how JScript.NET fails to extend intrinsic object prototypes.
//jscript.net does not support extending intrinsic object prototypes
Object.prototype.foo = 1;
var x = {};
print("Object.prototype.foo -",Object.prototype.foo); //should print 1. in jscript.net: undefined
print("x.foo - ",x.foo); //same
Object.prototype["foo"] = 1;
@jbeard4
jbeard4 / bumblebee.conf
Created August 4, 2012 18:34
Changes to /etc/bumblebee/bumblebee.conf
Driver=nvidia
PMMethod=bbswitch
@jbeard4
jbeard4 / second-monitor.sh
Created August 4, 2012 18:36
Enables the nVidia card, and outputs to the external monitor. ^C disables the monitor.
xrandr --output LVDS1 --auto --output VIRTUAL --mode 1920x1080 --left-of LVDS1
optirun screenclone -d :8 -x 1
xrandr --output VIRTUAL --off
@jbeard4
jbeard4 / gnome-session-xmonad
Created August 4, 2012 18:37
This starts xmonad under Unity 2D
#! /bin/sh
xmonad &
xcompmgr &
exec gnome-session --session xmonad "$@"
@jbeard4
jbeard4 / README.md
Created October 3, 2012 01:22 — forked from mbostock/.block
Epicyclic Gearing

From Wikipedia: Epicyclic gearing or planetary gearing is a gear system consisting of one or more outer gears, or planet gears, revolving about a central, or sun gear. … Epicyclic gearing systems also incorporate the use of an outer ring gear or annulus, which meshes with the planet gears.

Built with D3.js.

@jbeard4
jbeard4 / normalizeInitialStates.xsl
Created November 12, 2012 17:08
Normalize Initial States
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:s="http://www.w3.org/2005/07/scxml"
xmlns="http://www.w3.org/2005/07/scxml"
version="1.0">
<xsl:output method="xml"/>
<!-- identity transform -->
<xsl:template match="@*|node()">
<xsl:copy>
@jbeard4
jbeard4 / gist:4195449
Created December 3, 2012 14:49
SCXML with an explicit notion of timeout events
<scxml>
<state id="a">
<transition target="b" cc:timeout="1s"/>
</state>
<state id="b"/>
</scxml>
@jbeard4
jbeard4 / scxml_join_example.xml
Last active April 13, 2018 01:24
To emulate a "join" transition in SCXML, you can use a single "default transition" (a transition without a trigger) originating from the parallel state, and use a cond attribute with "In()" predicates for each parallel substate you wish you join. You can find the definition of a join transition in the following paper: http://citeseerx.ist.psu.ed…
<scxml>
<parallel id="P">
<state id="A">
<state id="A-start">
<transition target="A-done" event="t"/>
</state>
<state id="A-done"/>
</state>
<state id="B">
<state id="B-start">