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
CmdUtils.CreateCommand({ | |
name: "github-auth", | |
icon: "http://gist.github.com/favicon.ico", | |
author: {name: "Mike Green", email: "mike.is.green@gmail.com", url: "http://mikedamage.github.com"}, | |
description: "Saves your Github login and API token in Firefox's keychain. Needed to create new Gists via Ubiquity.", | |
takes: {"username api-token": noun_arb_text}, | |
preview: function(pblock) { pblock.innerHTML = this.description; }, | |
execute: function(userToken) { | |
var data = userToken.text.split(' '); | |
var user = data[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
// Create a new Github Gist from selection | |
CmdUtils.CreateCommand({ | |
name: "gist", | |
icon: "http://gist.github.com/favicon.ico", | |
author: {name: "Mike Green", email: "mike.is.green@gmail.com", url: "http://mikedamage.github.com"}, | |
description: "Creates a new Github Gist from the currently selected text. IMPORTANT: You must give Firefox your Github API token by running github-auth before using this command.", | |
takes: {"username": noun_arb_text}, | |
preview: function(pblock, user) { | |
var template = "<b>New gist by ${user}:</b><p><code>${gist}</code></p>"; | |
var selection = CmdUtils.getSelection(); |
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
production: | |
adapter: dbslayer | |
host: localhost | |
port: 9090 |
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
require 'net/http' | |
require 'uri' | |
require 'time' | |
class Time | |
def self.gcalschema(tzid) # We may not be handling Time Zones in the best way... | |
tzid =~ /(\d\d\d\d)(\d\d)(\d\d)T(\d\d)(\d\d)(\d\d)Z/ ? # yyyymmddThhmmss | |
# Strange, sometimes it's 4 hours ahead, sometimes 4 hours behind. Need to figure out the timezone piece of ical. | |
# Time.xmlschema("#{$1}-#{$2}-#{$3}T#{$4}:#{$5}:#{$6}") - 4*60*60 : | |
Time.xmlschema("#{$1}-#{$2}-#{$3}T#{$4}:#{$5}:#{$6}") : |
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 | |
# | |
# = Geektool RSS Script | |
# | |
# AUTHOR:: Mike Green | |
# EMAIL:: mike.is.green@gmail.com | |
# URL:: http://mikedamage.github.com | |
# LICENSE:: GNU GPL | |
# | |
# == Summary |
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/ruby | |
# | |
# = Time Machine Log Inspector | |
# | |
# by Mike Green <mike.is.green@gmail.com> | |
# created on 2009-02-10 | |
# | |
# == Summary | |
# Meant to be run as a launchd task everytime system.log is modified. | |
# It scans the latest line of system.log for specific patterns related to Time Machine |
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
use Rack::ShowExceptions | |
use Rack::CommonLogger | |
require 'rack/request' | |
require 'rack/response' | |
module Rack | |
class App | |
def call(env) | |
req = Request.new(env) |
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
/** | |
* | |
* Base64 encode / decode | |
* http://www.webtoolkit.info/ | |
* | |
**/ | |
var Base64 = { | |
// private property |
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
// Get the day of the year as an integer (1..366) | |
var today = new Date(); | |
var first = new Date(today.getFullYear(), 0, 1); | |
var theDay = Math.round(((today - first) / 1000 / 60 / 60 / 24) + .5, 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
// Get day of year by modifying the Date() prototype | |
Date.prototype.getDOY = function() { | |
var onejan = new Date(this.getFullYear(),0,1); | |
return Math.ceil((this - onejan) / 86400000); | |
} |