Skip to content

Instantly share code, notes, and snippets.

View jbeard4's full-sized avatar

Jacob Beard jbeard4

View GitHub Profile
@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 / bumblebee.conf
Created August 4, 2012 18:34
Changes to /etc/bumblebee/bumblebee.conf
Driver=nvidia
PMMethod=bbswitch
@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 / 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" &
}
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;
}
};
}
import org.mozilla.javascript.Scriptable;
import org.mozilla.javascript.Function;
import org.mozilla.javascript.Context;
import org.mozilla.javascript.ScriptableObject;
import test.Reduced;
class TestReduced {
public static void main(String[] args){
Reduced reduced = new Reduced();

Javascript and prototypal inheritance

curl -s https://raw.github.com/gist/2467484/oop.js | node

@jbeard4
jbeard4 / initial-state.xml
Created February 23, 2012 14:45
simple initial scxml
<?xml version="1.0" encoding="UTF-8"?>
<scxml
xmlns="http://www.w3.org/2005/07/scxml"
version="1.0">
<initial>
<transition target="a"/>
</initial>
<state id="a"></state>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" id="facebook" class=" no_js">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-language" content="en" />
<script type="text/javascript">
//<![CDATA[
CavalryLogger=false;window._is_quickling_index=""; window._script_path = "\/authorize.php";window._EagleEyeSeed="cmm4";__rm = {};
//]]>
@jbeard4
jbeard4 / gist:853759
Created March 3, 2011 22:29
revised scxml step algorithm patch
From 5aaf3c0a528f9863b19c7a1d99ae8a48fbc8ce64 Mon Sep 17 00:00:00 2001
From: jbeard4 <[email protected]>
Date: Thu, 3 Mar 2011 14:24:31 -0800
Subject: [PATCH]
---
gistfile1.py | 29 +++++++++++++++++++++++++----
1 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/gistfile1.py b/gistfile1.py