Skip to content

Instantly share code, notes, and snippets.

View micahbrich's full-sized avatar

Micah Rich micahbrich

View GitHub Profile
@micahbrich
micahbrich / gist:1118613
Created August 1, 2011 17:44
Submission Dates markup
<strong>August 1<sup>st</sup></strong> through <strong>October 1<sup>st</sup></strong>
@micahbrich
micahbrich / cloner.rb
Created July 3, 2011 17:38 — forked from cowboy/clone_fast.rb
League Cloner
# /usr/bin/env ruby
puts <<-EOF
LEAGUE CLONER via The League of Moveable Type
====================================================
EOF
@micahbrich
micahbrich / PaddedTextFieldCell.rb
Created June 16, 2011 05:35
Awesome Text Fields in MacRuby
class PaddedTextFieldCell < NSTextFieldCell
def drawingRectForBounds(cellFrame)
super
result = cellFrame
padding_left = (result.size.width / 16).round # to make sure text is clear
padding_top = (result.size.height / 4).round
result.origin.x += padding_left
result.origin.y += padding_top
@micahbrich
micahbrich / flac-to-mp3.rb
Created May 21, 2011 23:40
Batch convert flac to mp3, with metadata, using ffmpeg
Dir.glob("*.flac").each do |f|
flac = "./#{f.gsub(' ', '\ ')}"
mp3 = "./#{f.gsub(' ', '\ ').chomp('.flac')}.mp3"
system("ffmpeg -i #{flac} -map_meta_data #{mp3}:#{flac} #{mp3}")
end
{block:Post1}
<div class="featured">
{/block:Post1}
your post type blocks...
{block:Post1}
</div>
{/block:Post1}

Typekit Font Events

Web fonts may be the best thing to happen to web design in years, but that doesn't mean there aren't some tricky issues to overcome. One of the most annoying things is dealing with what's become known as the FOUT or 'Flash of Unstyled Text'. It's what happens in some browsers while waiting for fonts to download.

Typekit is introducing Font Events to put you back in control when using web

@micahbrich
micahbrich / error on heroku db:pull
Created November 25, 2009 15:22
error on heroku db:pull
Auto-detected local database: mysql://root@127.0.0.1/agoodportfolio_development?encoding=utf8
Receiving schema
Receiving data
6 tables, 4,650 records
groups: 100% |==========================================| Time: 00:00:01
schema_migrat: 100% |==========================================| Time: 00:00:00
/Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/adapters/mysql.rb:147:in `query': MySQL server has gone away (Mysql::Error)
from /Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/adapters/mysql.rb:147:in `transaction'
from /Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/connection_pool.rb:108:in `hold'
from /Library/Ruby/Gems/1.8/gems/sequel-3.0.0/lib/sequel/database.rb:461:in `synchronize'
@micahbrich
micahbrich / generate_and_deploy_assets.rb
Created November 16, 2009 15:25 — forked from aeden/generate_and_deploy_assets.rb
capistrano recipe for moving public files to s3
desc "Generate and deploy assets"
task :deploy_assets, :roles => :app do
# get the previous timestamp
old_timestamp = File.read("config/deploy_timestamp").to_i rescue 0
# generate timestamp into config/deploy_timestamp
timestamp = Time.now.to_i
File.open("config/deploy_timestamp", 'w') do |f|
f.write(timestamp)
end
@micahbrich
micahbrich / codemirror.js
Created October 29, 2009 21:23
this junk is doing nothing at all
<script src="javascripts/codemirror/js/codemirror.js" type="text/javascript"></script>
<script type="text/javascript">
var textarea = document.getElementById('user_about');
var editor = CodeMirror.fromTextArea(textarea, {
content: textarea.value,
parserfile: ["parsexml.js", "parsecss.js", "tokenizejavascript.js", "parsejavascript.js", "parsehtmlmixed.js"],
stylesheet: ["javascripts/codemirror/css/xmlcolors.css", "javascripts/codemirror/css/jscolors.css", "javascripts/codemirror/css/csscolors.css"],
path: "javascripts/codemirror/js/",
lineNumbers: true,
@micahbrich
micahbrich / amgleft.js
Created August 16, 2009 17:39
anthony's imageswapping js
function swapPhoto(photoSRC,theCaption,theLink) {
var displayedImage = document.getElementById("thephoto");
var displayedCaption = document.getElementById("caption");
// to make the link go to a new window, i just added 'target="_blank"' to both links below.
// target is just an attribute of the a tag in html
//
// however, i added a conditional to the image & link replacers.
// it says that if there is no third variable, there won't be any links. it's written as follows: