Skip to content

Instantly share code, notes, and snippets.

View hellopatrick's full-sized avatar
💭
🦊

Patrick Rogers hellopatrick

💭
🦊
View GitHub Profile
@hellopatrick
hellopatrick / a-brief-history.md
Last active August 5, 2017 12:30
A Brief History of GIF Brewery's Algorithm Options.

In the beginning, there were GIFs created simply using Apple's CoreGraphics library. This was called the "None" algorithm.

None

None

Then, eventually, dithering was discovered, but not fully understood.

Pre-3.3.1 Ordered

3.3 Ordered

@hellopatrick
hellopatrick / gist:2596209
Created May 4, 2012 16:57
RubyMotion Queue Pointer?
queue = Dispatch::Queue.new "com.helloresolven.booth.queue"
output.setSampleBufferDelegate self, queue:queue
yields...
2012-05-04 12:53:14.275 booth[91714:10703] *** Terminating app due to uncaught exception 'TypeError', reason: 'capture_view_controller.rb:44:in `setup_session': expected instance of Pointer, got `com.helloresolven.booth.queue' (Dispatch::Queue) (TypeError)
from capture_view_controller.rb:9:in `viewDidLoad'
queue = Dispatch::Queue.new "com.helloresolven.booth.queue"
ptr = Pointer.new(:object)
@hellopatrick
hellopatrick / securing_rails_updates.md
Created March 5, 2012 20:12 — forked from peternixey/securing_rails_updates.md
How Homakov hacked GitHub and how to protect your application

##How Homakov hacked GitHub and the line of code that could have prevented it


Please note: THIS ARTICLE IS NOT WRITTEN BY THE GITHUB TEAM or in any way associated with them. It's simply hosted as a Gist because the markdown formatting is excellent and far clearer than anything I could manage on my personal Tumblr at peternixey.com.

If you'd like to follow me on twitter my handle is @peternixey


@hellopatrick
hellopatrick / GRMustache.podspec
Created February 25, 2012 20:05
GRMustache.podspec
Pod::Spec.new do |s|
s.name = 'GRMustache'
s.version = '1.11.2'
s.license = 'MIT'
s.summary = 'Objective-C implementation of the {{ mustache }} template engine, for both MacOS Cocoa and iOS. '
s.homepage = 'https://github.com/groue/GRMustache'
s.author = { 'Gwendal Roué' => '' }
s.source = { :git => 'https://github.com/groue/GRMustache.git', :tag => '1.11.2' }
@hellopatrick
hellopatrick / JRSwizzle.podspec
Created February 25, 2012 18:44
JRSwizzle.podspec
Pod::Spec.new do |spec|
spec.name = 'JRSwizzle'
spec.version = '1.0'
spec.source = { :git => 'git://github.com/rentzsch/jrswizzle.git', :commit => '57f9d1bf7b' }
spec.source_files = 'JRSwizzle.{h,m}'
spec.clean_paths = 'JRSwizzleTest'
end
@hellopatrick
hellopatrick / gist:1711925
Created January 31, 2012 18:06
Color Table
//
// HRAppDelegate.m
// ColorTableTest
//
// Created by Patrick Rogers on 1/17/12.
// Copyright (c) 2012 Hello Resolven. All rights reserved.
//
#import "HRAppDelegate.h"
set :rails_env, :production
set :unicorn_binary, "/usr/bin/unicorn"
set :unicorn_config, "#{current_path}/config/unicorn.rb"
set :unicorn_pid, "#{current_path}/tmp/pids/unicorn.pid"
namespace :deploy do
task :start, :roles => :app, :except => { :no_release => true } do
run "cd #{current_path} && #{try_sudo} #{unicorn_binary} -c #{unicorn_config} -E #{rails_env} -D"
end
task :stop, :roles => :app, :except => { :no_release => true } do
set :rails_env, :production
set :unicorn_binary, "/usr/bin/unicorn"
set :unicorn_config, "#{current_path}/config/unicorn.rb"
set :unicorn_pid, "#{current_path}/tmp/pids/unicorn.pid"
namespace :deploy do
task :start, :roles => :app, :except => { :no_release => true } do
run "cd #{current_path} && #{try_sudo} #{unicorn_binary} -c #{unicorn_config} -E #{rails_env} -D"
end
task :stop, :roles => :app, :except => { :no_release => true } do
@hellopatrick
hellopatrick / attr_indexed.rb
Created November 17, 2011 19:18
Indexed KVO-Compliance & MacRuby
class Object
def self.attr_indexed var, custom_methods = {}
key = var.to_s
capitalized_key = key.capitalize[0] + key[1..-1]
methods = {
:size => lambda { instance_variable_get("@#{var}").size },
:at => lambda { |idx| instance_variable_get("@#{var}")[idx] },
:insert => lambda { |obj, idx| instance_variable_get("@#{var}").insert(idx, obj) },
:delete_at => lambda { |idx| instance_variable_get("@#{var}").delete_at(idx) }