Skip to content

Instantly share code, notes, and snippets.

View MarkVillacampa's full-sized avatar
:octocat:
just setting up my gthb

Mark Villacampa MarkVillacampa

:octocat:
just setting up my gthb
View GitHub Profile
@mdippery
mdippery / book.m
Created October 28, 2010 18:11
An example of using @dynamic properties in Objective-C
#import <Foundation/Foundation.h>
@interface Book : NSObject
{
NSMutableDictionary *data;
}
@property (retain) NSString *title;
@property (retain) NSString *author;
@end
@stuartcarnie
stuartcarnie / main.m
Created March 4, 2011 19:59
Demonstrates we can now support limited JIT compilation on recent versions of iOS (assuming Apple approves entitlements at some future point)
//
// main.m
// ProtectTest
// Demonstrates newer versions of iOS now support PROT_EXEC pages, for just-in-time compilation.
//
// Must be compiled with Thumb disabled
//
// Created by Stuart Carnie on 3/4/11.
// Copyright 2011 Manomio LLC. All rights reserved.
//
@alloy
alloy / FTAccessibleActionSheet.m
Created May 3, 2011 13:28
A UIActionSheet subclass that customizes the accessibility labels of the options in the sheet.
// Copyright (c) 2011 Eloy Durán <eloy@fngtps.com>
// Available under the MIT license: http://www.opensource.org/licenses/mit-license.php
#import <objc/message.h>
@interface FTAccessibleActionSheet : UIActionSheet
- (void)copyAccessibilityMetadataFrom:(NSString *)title toControl:(UIView *)control;
@end
@implementation FTAccessibleActionSheet
@pigoz
pigoz / ruby_sql_to_csv.rb
Created May 31, 2011 13:04
Ruby SQL to CSV exporter
require "rubygems"
begin
require 'sequel'
rescue LoadError
puts "Please run gem install sequel"
exit!
end
DB = Sequel.connect(:adapter => 'mysql2',
:host => '127.0.0.1',
@fajrif
fajrif / rvm_cheatsheet
Created June 14, 2011 14:11
RVM cheatsheet
RVM home page: http://rvm.beginrescueend.com
Install RVM
------------
See http://rvm.beginrescueend.com/rvm/install/
bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
Install rvm for all users
@loranger
loranger / userscript.js
Created September 27, 2011 10:43
Trello badge userscript for FluidApp
// ==UserScript==
// @name Fluid Dock Badge for Trello
// @namespace http://fluidapp.com
// @description Display a dock badge for the Trello Dashboard with the number of new notifications
// @include *.trello.com
// @author Laurent Goussard
// ==/UserScript==
if (!window.fluid) {
return;
}
@alskipp
alskipp / macruby_fiber.rb
Created January 5, 2012 14:05
Macruby Fibers using GCD (transfer method implemented, 'double resume' error needs implementing)
class FiberError < StandardError; end
class Fiber
attr_accessor :name
def initialize &block
raise ArgumentError, 'new Fiber requires a block' unless block_given?
@block = block
@yield_sem = Dispatch::Semaphore.new(0)
@resume_sem = Dispatch::Semaphore.new(0)
@jimbojsb
jimbojsb / gist:1630790
Created January 18, 2012 03:52
Code highlighting for Keynote presentations

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

@noonat
noonat / gist:1649543
Created January 20, 2012 21:02
Rake Quick Reference
# Rake Quick Reference
# by Greg Houston
# http://ghouston.blogspot.com/2008/07/rake-quick-reference.html
# -----------------------------------------------------------------------------
# Running Rake
# -----------------------------------------------------------------------------
# running rake from the command-line:
# rake --help
class ActionDispatch::Routing::Mapper
def draw(routes_name)
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb")))
end
end
BCX::Application.routes.draw do
draw :api
draw :account
draw :session