Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block phatmann

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
phatmann /
Last active Dec 12, 2016 — forked from znseaman/
Pitchfork's 1001 Albums You Must Hear Before You Die
  • Sinatra, Frank – In the Wee Small Hours
  • Presley, Elvis – Elvis Presley (1956)
  • Louvin Brothers – Tragic Songs of Life
  • Prima, Louis – Wildest
  • Domino, Fats – This is Fats
  • Ellington, Duke – At Newport (1956)
  • Sinatra, Frank – Songs for Swingin’ Lovers!
  • Crickets – Chirping…
phatmann / BackgroundTask.swift
Created Apr 15, 2015
Encapsulate iOS background tasks in a Swift class
View BackgroundTask.swift
class BackgroundTask {
private let application: UIApplication
private var identifier = UIBackgroundTaskInvalid
init(application: UIApplication) {
self.application = application
class func run(application: UIApplication, handler: (BackgroundTask) -> ()) {
// NOTE: The handler must call end() when it is done
phatmann / ImageAttachment
Created Mar 22, 2015
NSTextAttachment that scales and aligns image
View ImageAttachment
// Created by Tony Mann on 3/22/15.
// Copyright (c) 2015 7Actions. All rights reserved.
// Adapted from
import UIKit
class ImageAttachment: NSTextAttachment {
var verticalOffset: CGFloat = 0.0
View LiveTweet-timeLinks-option.diff
View dm-rejects-blank-string-for-integer-fields.rb
require 'rubygems'
gem 'dm-core', '0.10.1'
require 'dm-core', :debug)
DataMapper.setup(:default, "mysql://localhost/ts_test")
class Sample
include DataMapper::Resource
property :id, Serial
View dm-query-build-err.rb
require 'rubygems'
gem 'dm-core'
require 'dm-core', :debug)
DataMapper.setup(:default, "mysql://localhost/YOUR_TEST_DB")
class CrawledPage
include DataMapper::Resource
property :id, Serial
View merb-helpers_patch.rb
######## broken version #########
# update_unbound_check_box handles :checked properly, but radio does not get the same treatment
def update_unbound_controls(attrs, type)
case type
when "checkbox"
when "file"
@multipart = true
View dm-associations-will-not-save.rb
#!/usr/bin/env ruby
require 'rubygems'
gem 'dm-core', '~>0.9.9'
require 'dm-core', :debug)
DataMapper.setup(:default, 'sqlite3::memory:')
View select_country.rb
def select_country(opts = {})
opts[:collection] = countries.sort {|a,b| a[1] <=> b[1]}
opts[:selected] ||= 'US'
select opts
def countries
"AF" => "Afghanistan",
"AL" => "Albania",
View resource_controller.rb
class ResourceController < Application
@@page_size = nil
def index
def show
display get_resource
You can’t perform that action at this time.