Multi-series bar chart rendered using React and D3.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// jQuery Polling Plugin | |
// http://www.buntin.org/2008/sep/23/jquery-polling-plugin/ | |
(function($) { | |
$.fn.poll = function(options){ | |
var $this = $(this); | |
// extend our default options with those provided | |
var opts = $.extend({}, $.fn.poll.defaults, options); | |
setInterval(update, opts.interval); | |
// method used to update element html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// Draw a progress bar at the current cursor position. | |
/// Be careful not to Console.WriteLine or anything whilst using this to show progress! | |
/// </summary> | |
/// <param name="progress">The position of the bar</param> | |
/// <param name="total">The amount it counts</param> | |
private static void DrawTextProgressBar(int progress, int total) | |
{ | |
//draw empty progress bar | |
Console.CursorLeft = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
(while(true); do \ | |
(mysql -e 'show innodb status \G' | grep undo\ log\ entries ; sleep 1 ; \ | |
mysql -e 'show innodb status \G' | grep undo\ log\ entries ) | \ | |
egrep '[0-9][0-9][0-9][0-9]' |awk '{print $10;}' ; done ) | \ | |
perl -e '$t = ROWS_IN_TABLE; while(1) { \ | |
$n ++; $nn; $a = <>; $b = <>; $nn += ($b-$a); \ | |
printf "Rate: %d, avg: %d, %0.3f%% complete, done in %d sec\n", \ | |
$b-$a, $nn/$n, ($b/$t)*100, ($t-$b)/($nn/$n); }'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://prototyp.ical.ly/index.php/2007/03/01/javascript-design-patterns-1-the-singleton/ | |
// http://books.google.co.uk/books?id=za3vlnlWxb0C&printsec=frontcover&source=gbs_navlinks_s#v=onepage&q=singleton&f=false | |
var mySingleton = function() | |
{ | |
/* private attributes */ | |
var _created = new Date(); | |
/* private methods */ | |
var _calculateAge = function() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://www.makemacwork.com/disable-automatic-updates.htm | |
for USER in `ls -1 /Users | \ | |
sed -e '/Shared/d' -e '/Deleted Users/d' -e '/.localized/d'`; \ | |
do \ | |
sudo -u $USER softwareupdate --schedule off; \ | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* ## Merging mixin views in backbone.js ## | |
* | |
* really just more a test for tumblr gistr | |
*/ | |
/** | |
* Merge the mixin (a Backbone.View) into another Backbone.View. Automatically merge events, defaults, and call the parent initializer. | |
**/ | |
function mergeMixin(view, mixin) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>React + D3</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore.js"></script> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/react/0.8.0/react.js"></script> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/react/0.8.0/JSXTransformer.js"></script> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/d3/3.3.13/d3.js"></script> |
Multi-series line chart rendered using React and D3.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*global module:false*/ | |
module.exports = function(grunt) { | |
grunt.initConfig({ | |
react: { | |
jsx: { | |
files: [ | |
{ | |
expand: true, | |
cwd: 'public/js', |
OlderNewer