Skip to content

Instantly share code, notes, and snippets.

View netbe's full-sized avatar

François Benaiteau netbe

View GitHub Profile
@mrrooijen
mrrooijen / Capistrano-Deployment-Recipe.rb
Created July 29, 2009 09:34
a "base" Capistrano Rails Deployment Recipe. Use it to deploy your Rails application. It is also easily expandable. So feel free to grab this Recipe and add your own tasks/customization!
# Guide
# Configure the essential configurations below and do the following:
#
# Repository Creation:
# cap deploy:repository:create
# git add .
# git commit -am "initial commit"
# git push origin master
#
# Initial Deployment:
@kch
kch / yaml-to-plist.rb
Created August 4, 2010 14:50
Writes ruby object structures to plists. When called directly, takes a YAML file.
#!/usr/bin/env ruby
# encoding: UTF-8
require 'yaml'
require 'rexml/document'
class PlistWriter
PLIST_STUB_DOC = %q[
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"></plist>]
@hatfinch
hatfinch / CGAffineTransformFromRectToRect.m
Created August 17, 2011 09:54
CGAffineTransformFromRectToRect (not working)
CGAffineTransform CGAffineTransformFromRectToRect(CGRect fromRect, CGRect toRect)
{
CGSize scale = CGSizeMake(toRect.size.width / fromRect.size.width, toRect.size.height / fromRect.size.height);
CGRect scaledFromRect = CGRectMake(fromRect.origin.x * scale.width, fromRect.origin.y * scale.height,
fromRect.size.width * scale.width, fromRect.size.height * scale.height);
CGSize translation = CGSizeMake(fromRect.origin.x - scaledFromRect.origin.x, fromRect.origin.y - scaledFromRect.origin.y);
return CGAffineTransformMake(scale.width, 0.0, 0.0, scale.height, translation.width, translation.height);
}
@abury
abury / complex_iOS_build_script.sh
Created November 29, 2011 11:44
An extended iOS build Script showing a range of functions
#!/bin/sh
# Extended iOS Build Script
# Written by Aron Bury, 29/11/2011
#==== Script Params =====
# App params
appname="AwesomeApp"
target_name="$appname"
sdk="iphoneos"
@olivierlacan
olivierlacan / .pryrc
Created January 5, 2012 01:16 — forked from renz45/.pryrc
Pry configuraton
# switch default editor for pry to sublime text
Pry.config.editor = "sublime"
# format prompt to be <Rails version>@<ruby version>(<object>)>
Pry.config.prompt = proc do |obj, level, _|
prompt = "\e[1;30m"
prompt << "#{Rails.version} @ " if defined?(Rails)
prompt << "#{RUBY_VERSION}"
"#{prompt} (#{obj})>\e[0m"
end
@kylefox
kylefox / color.m
Created January 27, 2012 17:45
Generate a random color (UIColor) in Objective-C
/*
Distributed under The MIT License:
http://opensource.org/licenses/mit-license.php
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
@gnepud
gnepud / test_helper.rb
Created April 6, 2012 08:57 — forked from sethbro/test_helper.rb
MiniTest::Spec with Rails 3.2 setup
ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require 'minitest/autorun'
require 'minitest/pride'
require 'capybara/rails'
class MiniTest::Spec
include ActiveSupport::Testing::SetupAndTeardown
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
@falkorichter
falkorichter / NotificationSetter.h
Created May 3, 2012 16:02
Anonymous Notification sythesization and setter
#define CUSTOM_NSNOTIFICATION_SETTER(setterMethodName,ivarName,_ivarName)\
\
@synthesize ivarName = _ivarName; \
\
- (void)setterMethodName:(id)ivarName{ \
if (_ivarName != ivarName) { \
if (_ivarName != nil) { \
[[NSNotificationCenter defaultCenter] removeObserver:_ivarName]; \
} \
_ivarName = ivarName; \
@netbe
netbe / template.sublime-project
Created June 19, 2012 18:37
sublime 2 text project template (exclude directories)
{
"folders":
[
{
"path": ".",
"folder_exclude_patterns": ["log", "script", "tmp", "doc", "coverage"],
"file_exclude_patterns": ["*bak", "*~"]
}
],