Skip to content

Instantly share code, notes, and snippets.

View lastobelus's full-sized avatar

Michael Johnston lastobelus

View GitHub Profile

Graphing Widget

The graphing widget shows graphs using the Rickshaw graphing library. The names of data fields should be (vaguely) familiar if you've used Rickshaw before.

It's recommended that you replace the /assets/javascripts/rickshaw.min.js from your dashboard with the latest from here.

Supported HTML data fields

<html>
<head>
<script type="text/javascript">
</script>
</head>
<body id="output"></body>
</html>
<html>
<head>
</head>
<body>
<h1>Output</h1>
<div id="output"></div>
<script type="text/javascript">
</script>
</body>
</html>
<html>
<head>
<script>
// Inline javascript
</script>
<script src=“external_javascript.js”></script>
</head>
<body>
function bob(){
console.groupCollapsed("in bob");
console.log("calling mary");
mary();
console.log("back in bob");
console.groupEnd();
}
function mary() {
console.group("in mary");
@lastobelus
lastobelus / while-for-bench.js
Last active January 21, 2016 03:48
Quick and dirty benchmarks of for vs negative while loop in javascript
var i = 100000;
var myArray = [];
while(i--) myArray[i] = i;
myArray[0];
console.log("------- for loop always evaluating length-------")
var forResult = 0; console.time("for"); for(var i=0; i < myArray.length; i++) { forResult += myArray[i] }; console.log("forResult: %i", forResult); console.timeEnd("for");
console.log("------- for loop with length in var-------")
var forResult2 = 0; console.time("for2"); for(var i=0, len = myArray.length; i < len; i++) { forResult2 += myArray[i] }; console.log("forResult2: %i", forResult2); console.timeEnd("for2");
var outerFunction = function(){
if(true){
var x = 5;
//console.log(y); //line 1, ReferenceError: y not defined
}
var nestedFunction = function() {
if(true){
@lastobelus
lastobelus / -
Created November 24, 2016 04:51
Date/Time Summary
11/23/16 11:48 PM Delivered: [email protected][email protected] 'Purchase order for Shirt Goods from Teesforthepeople.com'
{
"tags": [
"goods-request",
"provider-request"
],
"envelope": {
"transport": "smtp",
function glone {
gh_url=${1:-`pbpaste`}
repo_name=$(basename $gh_url | sed -e 's/\.git//')
co_dir=${HOME}/github/${repo_name}
if [ -d $co_dir ]; then
cd $co_dir && git pull origin master
else
git clone "${gh_url}" "${co_dir}" && cd "${co_dir}"
fi