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
#!/usr/bin/env bash | |
# Author: Wayne E. Seguin (wayneeseguin@gmail.com) | |
# | |
# I like the sound of 'work_on', however you can name this | |
# function anything that makes it easier for you to think. | |
# | |
work_on () | |
{ | |
# We are expecting project name to be the first parameter |
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
(function(){ | |
var button_id = "download" | |
// include this code in your page | |
// you must have jQuery installed | |
// you must have a link element with an id of "download" | |
// this is limited to only one chart on the page (the first) | |
function encode_as_link(){ | |
// Add some critical information |
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
class MigrateTaggings < ActiveRecord::Migration | |
def up | |
change_table :taggings do |t| | |
t.references :tagger, :polymorphic => true | |
t.string :context, :limit => 128 | |
t.index [:taggable_id, :taggable_type, :context] | |
end | |
ActsAsTaggableOn::Tagging.all.each {|t| t.update_attribute :context, 'tags'} | |
end |
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
# Oh, if only this were possible. I know it is not in JS, but still would be cool | |
z = 'a key' | |
x = | |
"#{z}" : 1 |
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
#!/usr/bin/env ruby | |
# Script to load GPS and CO2 data and normalize the data | |
# the position data in a file "run.xml" | |
# pollution in a file "pollution.txt" | |
require 'nokogiri' | |
require 'fastercsv' | |
require 'active_support' |
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
# thank you http://www.mysqlperformanceblog.com/2008/02/04/finding-out-largest-tables-on-mysql-server/ | |
SELECT CONCAT(table_schema, '.', table_name), | |
CONCAT(ROUND(table_rows / 1000000, 2), 'M') rows, | |
CONCAT(ROUND(data_length / ( 1024 * 1024 * 1024 ), 2), 'G') DATA, | |
CONCAT(ROUND(index_length / ( 1024 * 1024 * 1024 ), 2), 'G') idx, | |
CONCAT(ROUND(( data_length + index_length ) / ( 1024 * 1024 * 1024 ), 2), 'G') total_size, | |
ROUND(index_length / data_length, 2) idxfrac | |
FROM information_schema.TABLES | |
ORDER BY data_length + index_length DESC | |
LIMIT 10; |
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
(function(){ | |
/* | |
flex-image: javascript for image replacement based on screen size | |
by John Weir http://famedriver.com | |
Usage, where `*` will be replaced by the image size. | |
<img data-src='/path-to-image/image-*.jpg' data-sizes='320:480,481:960' class='flex-image'/> | |
Thanks to Aurélien Delogu & Molt for the inspiration -> https://github.com/pyrsmk/molt |
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
package main | |
import ( | |
eventsource "github.com/antage/eventsource/http" | |
redis "github.com/vmihailenco/redis" | |
"log" | |
"net/http" | |
) | |
func haltOnErr(err error){ |
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
// just a sketch to put away for now | |
// these are weeding functions | |
// the goal is to remove lables on a graph that are too close together (ie weed out overlapping labels) | |
function weed(array, x, y){ | |
var f = array[0] | |
, l = array[array.length -1] | |
, ex = d3.extent(array, function(d){ return d.y }) | |
, hiLo = array.filter(function(d){ return d.y == ex[0] || d.y == ex[1]}); | |
return _.uniq([f,l].concat(hiLo)); |
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
$('article').attr('class','current').css({position: 'relative', margin: 10, padding: '20px',top: 0, left: 0, height: 'auto', width: 'auto'}), $('#help').remove(), document.removeEventListener('keydown', handleBodyKeyDown), $('h2').css({position:'static'}) |
OlderNewer