Public Gists by trotter

Gravatar
Wed Nov 11 14:37:15 -0800 2009
1
2
3
# usage: ruby convert-html-to-json.rb PATH_TO_FILE
 
require 'rubygems'
Gravatar
Thu Aug 06 10:27:13 -0700 2009
1
2
3
class Hash
  def ref_with_destructuring(*args)
    ret = args.map { |a| ref_without_destructuring(a) }
Gravatar
Fri Jul 10 12:43:56 -0700 2009
1
2
3
    # Convert the Cookie to its string representation.
    def to_s
      buf = ""
Gravatar
Tue Jun 02 15:41:22 -0700 2009
1
{"status": "available", "uploadedAt": "2009-06-02T22:40:01Z", "title": "Bear copy 1.wmv", "uid": "7a9ed2bb1e18e7c0f5", "formats": {"thumbnail": {"encodingProgress": 0, "status": "encoding", "format": "thumbnail", "playerUrl": null, "estimatedEncodingTime": 4.2, "embedCode": null, "streamingUrl": null, "downloadUrl": "http://www.motionbox.com/thumbnails/8/b/f/7/90201697-8bf7929986a4f987-thumb.sic/thumb00000.jpg", "height": null, "progressiveUrl": "http://www.motionbox.com/thumbnails/8/b/f/7/90201697-8bf7929986a4f987-thumb.sic/thumb00000.jpg", "duration": 0, "width": null}, "poster": {"encodingProgress": 0, "status": "encoding", "format": "poster", "playerUrl": null, "estimatedEncodingTime": 4.2, "embedCode": null, "streamingUrl": null, "downloadUrl": null, "height": null, "progressiveUrl": null, "duration": null, "width": null}, "flv": {"encodingProgress": 0, "status": "encoding", "format": "flv", "playerUrl": "http://www.motionbox.com/videos/7a9ed2bb1e18e7c0f5?type=advanced", "estimatedEncodingTime": 16.2, "embedCode": "\u003Cembed src=\"http://www.motionbox.com/external/player/id253D7a9ed2bb1e18e7c0f5\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer\" width=\"425\" height=\"460\"\u003E\u003C/embed\u003E", "streamingUrl": null, "downloadUrl": null, "height": null, "progressiveUrl": null, "duration": null, "width": null}, "sd": {"encodingProgress": 0, "status": "encoding", "format": "sd", "playerUrl": "http://www.motionbox.com/videos/7a9ed2bb1e18e7c0f5?type=sd", "estimatedEncodingTime": 19.8, "embedCode": "\u003Cobject\n classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" \n codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0\" \n width=\"416\" \n height=\"234\" \n id=\"mbox_player_7a9ed2bb1e18e7c0f5\"\u003E\n \u003Cparam name=\"movie\" value=\"http://player.motionbox.com/VideoPlayer.swf?\" /\u003E\n \u003Cparam name=\"allowScriptAccess\" value=\"always\" /\u003E\n \u003Cparam name=\"allowFullscreen\" value=
Gravatar
Tue Jun 02 15:39:27 -0700 2009
1
{"status": "available", "uploadedAt": "2009-06-02T22:38:50Z", "title": "Bear copy.wmv", "uid": "7a9ed2bb1e1beecaf5", "formats": {"thumbnail": {"encodingProgress": 0, "status": "encoding", "format": "thumbnail", "playerUrl": null, "estimatedEncodingTime": 4.2, "embedCode": null, "streamingUrl": null, "downloadUrl": "http://www.motionbox.com/thumbnails/d/1/3/a/90201537-d13a3099581d94d5-thumb.sic/thumb00000.jpg", "height": null, "progressiveUrl": "http://www.motionbox.com/thumbnails/d/1/3/a/90201537-d13a3099581d94d5-thumb.sic/thumb00000.jpg", "duration": 0, "width": null}, "poster": {"encodingProgress": 0, "status": "encoding", "format": "poster", "playerUrl": null, "estimatedEncodingTime": 4.2, "embedCode": null, "streamingUrl": null, "downloadUrl": null, "height": null, "progressiveUrl": null, "duration": null, "width": null}, "flv": {"encodingProgress": 0, "status": "encoding", "format": "flv", "playerUrl": "http://www.motionbox.com/videos/7a9ed2bb1e1beecaf5?type=advanced", "estimatedEncodingTime": 16.2, "embedCode": "\u003Cembed src=\"http://www.motionbox.com/external/player/id253D7a9ed2bb1e1beecaf5\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer\" width=\"425\" height=\"460\"\u003E\u003C/embed\u003E", "streamingUrl": null, "downloadUrl": null, "height": null, "progressiveUrl": null, "duration": null, "width": null}, "sd": {"encodingProgress": 0, "status": "encoding", "format": "sd", "playerUrl": "http://www.motionbox.com/videos/7a9ed2bb1e1beecaf5?type=sd", "estimatedEncodingTime": 19.8, "embedCode": "\u003Cobject\n classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" \n codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0\" \n width=\"416\" \n height=\"234\" \n id=\"mbox_player_7a9ed2bb1e1beecaf5\"\u003E\n \u003Cparam name=\"movie\" value=\"http://player.motionbox.com/VideoPlayer.swf?\" /\u003E\n \u003Cparam name=\"allowScriptAccess\" value=\"always\" /\u003E\n \u003Cparam name=\"allowFullscreen\" value=\"true\" /\u003E\n \u003Cparam value=\"video_uid=7a9ed2bb1e1beecaf5\u0026security_token=prod3.03d34d8f373b9d52\u0026type=sd\" name=\"flashvars\" /\u003E\n \u003C!--[if !IE]\u003E--\u003E\n \u003Cobject \n width=\"416\" \n height=\"234\" \n name=\"progressive_player\" \n allowscriptaccess=\"always\" \n allowfullscreen=\"true\" \n data=\"http://player.motionbox.com/VideoPlayer.swf?\" \n type=\"application/x-shockwave-flash\"\n flashvars=\"video_uid=7a9ed2bb1e1beecaf5\u0026security_token=prod3.03d34d8f373b9d52\u0026type=sd\"\n \u003E\n \u003C!--\u003C![endif]--\u003E\n \u003Ch2\u003ETo watch the video, you'll first need to \u003Ca href=\"http://www.adobe.com/go/getflashplayer\"\u003Einstall the flash player\u003C/a\u003E.\u003C/h2\u003E\n \u003C!--[if !IE]\u003E--\u003E\n \u003C/object\u003E'\n \u003C!--\u003C![endif]--\u003E\n\u003C/object\u003E\n", "streamingUrl": null, "downloadUrl": null, "height": null, "progressiveUrl": null, "duration": null, "width": null}}, "description": null, "securityToken": "prod3.03d34d8f373b9d52", "privacy": "all_contacts", "userUid": "0a94d6b8161de3c687", "folders": []}
Gravatar
Tue Jun 02 15:37:09 -0700 2009
1
{"status": "available", "uploadedAt": "2009-06-02T22:35:33Z", "title": "Butterfly copy.wmv", "uid": "7a9ed2bb1e1ae1c4f5", "formats": {"thumbnail": {"encodingProgress": 0, "status": "encoding", "format": "thumbnail", "playerUrl": null, "estimatedEncodingTime": 2.8, "embedCode": null, "streamingUrl": null, "downloadUrl": "http://www.motionbox.com/thumbnails/2/8/0/4/90201097-2804699ad9eaf582-thumb.sic/thumb00000.jpg", "height": null, "progressiveUrl": "http://www.motionbox.com/thumbnails/2/8/0/4/90201097-2804699ad9eaf582-thumb.sic/thumb00000.jpg", "duration": 0, "width": null}, "poster": {"encodingProgress": 0, "status": "encoding", "format": "poster", "playerUrl": null, "estimatedEncodingTime": 2.8, "embedCode": null, "streamingUrl": null, "downloadUrl": null, "height": null, "progressiveUrl": null, "duration": null, "width": null}, "flv": {"encodingProgress": 0, "status": "encoding", "format": "flv", "playerUrl": "http://www.motionbox.com/videos/7a9ed2bb1e1ae1c4f5?type=advanced", "estimatedEncodingTime": 10.8, "embedCode": "\u003Cembed src=\"http://www.motionbox.com/external/player/id253D7a9ed2bb1e1ae1c4f5\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer\" width=\"425\" height=\"460\"\u003E\u003C/embed\u003E", "streamingUrl": null, "downloadUrl": null, "height": null, "progressiveUrl": null, "duration": null, "width": null}, "sd": {"encodingProgress": 0, "status": "encoding", "format": "sd", "playerUrl": "http://www.motionbox.com/videos/7a9ed2bb1e1ae1c4f5?type=sd", "estimatedEncodingTime": 13.2, "embedCode": "\u003Cobject\n classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" \n codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0\" \n width=\"416\" \n height=\"234\" \n id=\"mbox_player_7a9ed2bb1e1ae1c4f5\"\u003E\n \u003Cparam name=\"movie\" value=\"http://player.motionbox.com/VideoPlayer.swf?\" /\u003E\n \u003Cparam name=\"allowScriptAccess\" value=\"always\" /\u003E\n \u003Cparam name=\"allowFullscreen\" val
Gravatar
Wed Feb 18 16:16:10 -0800 2009
1
2
3
require 'rubygems'
require 'fastercsv'
require 'ruby-debug'
Gravatar
Thu Feb 12 15:35:15 -0800 2009
1
2
3
module Spec
  module Mocks
    module ArgumentMatchers
Gravatar
Fri Sep 05 16:19:46 -0700 2008
1
2
3
CmdUtils.CreateCommand({
    name: "mbox-login",
    homepage: "http://www.motionbox.com",
Gravatar
Wed Sep 03 13:29:36 -0700 2008
1
2
3
# Setup ssh-agent
SSH_ENV=$HOME/.ssh/environment
 
gist: 7066 Rename all but the partials
Gravatar
Mon Aug 25 05:19:54 -0700 2008
1
for file in $(find app/views -name *.haml); do ruby -e "new_file = ARGV[0].sub('.haml', '.html.haml'); unless ARGV[0] =~ %r[/_]; %x[git mv #{ARGV[0]} #{new_file}]; end" $file; done
Gravatar
Fri Aug 22 07:23:31 -0700 2008
1
2
3
      # * <tt>:case_sensitive</tt> - Looks for an exact match. Ignored by non-text columns (+false+ by default).
      # * <tt>:allow_nil</tt> - If set to true, skips this validation if the attribute is +nil+ (default is +false+).
      # * <tt>:allow_blank</tt> - If set to true, skips this validation if the attribute is blank (default is +false+).
gist: 4073 my .profile
Gravatar
Tue Aug 05 07:17:02 -0700 2008
1
2
3
source ~/Source/git-1.5.6.2/contrib/completion/git-completion.bash
 
export PATH=~/bin:~/Projects/utility-scripts:/usr/local/bin:/usr/local/sbin:$PATH:/usr/local/mysql/bin:/opt/local/bin:/opt/local/sbin:~/Projects/jruby-1.1RC3/bin:~/Source/MzScheme\ v352/bin:$EC2_HOME/bin
gist: 4070 my .gitconfig
Gravatar
Tue Aug 05 07:00:21 -0700 2008
1
2
3
[user]
  name = Trotter Cashion
  email = cashion@gmail.com