Skip to content

Instantly share code, notes, and snippets.

View joebandenburg's full-sized avatar

Joe Bandenburg joebandenburg

  • Waterloo, Canada
  • 13:11 (UTC -04:00)
View GitHub Profile
@joebandenburg
joebandenburg / AppNav.js
Created July 24, 2015 08:46
Dockable LeftNav
class AppNav extends React.Component {
componentWillReceiveProps(nextProps) {
if (this.props.fixed !== nextProps.fixed) {
if (nextProps.fixed) {
this.refs.nav.open();
} else {
this.refs.nav.close();
}
}
}
@joebandenburg
joebandenburg / colorr.js
Created February 25, 2015 14:15
Random CSS colour generator
var hashCode = function(str) {
var hash = 0;
var i = 0;
var chr = 0;
var len = 0;
if (str.length === 0) {
return hash;
}
for (i = 0, len = str.length; i < len; i++) {
chr = str.charCodeAt(i);
@joebandenburg
joebandenburg / proto1.js
Last active August 29, 2015 14:13
Bunch of API prototypes
function receiveMessage(from, message, type) {
var session = axolotl.getSession(from);
// session could be in some sort of uninitalised state here - yuck!
if (type === "PreKeyWhisperMessage") {
return session.decryptPreKeyMessage(message);
} else if (type === "WhisperMessage") {
return session.decryptMessage(message);
}
}
@joebandenburg
joebandenburg / gist:f278ec617a296bd14d20
Created November 29, 2014 12:19
Handy Arma commands
# Turn grass off
setTerrainGrid 50;
# Disable fatigue
player enableFatigue false;