Skip to content

Instantly share code, notes, and snippets.

@remear
remear / stuff.m
Created September 10, 2010 22:36
[NSEvent addGlobalMonitorForEventsMatchingMask:NSKeyDownMask handler:^(NSEvent *event) {
NSLog(@"hi");
}];
/* RESET */
html,body,div,ul,ol,li,dl,dt,dd,h1,h2,h3,h4,h5,h6,pre,form,p,blockquote,fieldset,input { margin: 0; padding: 0; }
h1,h2,h3,h4,h5,h6,pre,code,address,caption,cite,code,em,strong,th { font-size: 1em; font-weight: normal; font-style: normal; }
ul,ol { list-style: none; }
fieldset,img { border: none; }
caption,th { text-align: left; }
table { border-collapse: collapse; border-spacing: 0; }
/* LAYOUT */
.clear { clear:both; }
∴ rails server
Usage:
rails new APP_PATH [options]
Options:
-m, [--template=TEMPLATE] # Path to an application template (can be a filesystem path or URL)
-b, [--builder=BUILDER] # Path to an application builder (can be a filesystem path or URL)
-r, [--ruby=PATH] # Path to the Ruby binary of your choice
# Default: /Users/millsb/.rvm/rubies/ruby-1.8.7-head/bin/ruby
[--edge] # Setup the application with Gemfile pointing to Rails repository
source :gemcutter
gem 'rails', '3.0.0.rc'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
#gem 'sqlite3-ruby', :require => 'sqlite3'
# Use unicorn as the web server
server {
server_name myhost.com;
listen 80;
error_log /var/log/myhost.com-error.log;
access_log /var/log/myhost.com-access.log;
location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /WebServer/Documents/myhost$fastcgi_script_name;
def self.find_by_username_or_email(login)
find_by_email(login) || find_by_login(login)
end
# Layout
<div id="toolbar">
<ul id="breadcrumbs" style="width:400px; float:left">
<li id="home"><%= link_to '&nbsp;', root_url %></li>
<%= yield :breadcrumbs %>
</ul>
<ul id="actions" style="width:300px; text-align:right; float:right">
<%= yield :actions %>
</ul>
source 'http://rubygems.org'
gem 'capistrano'
gem 'mysql'
gem 'rails', '3.0.0.beta4'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
# To use debugger
# gem 'ruby-debug'
git clone git://github.com/remear/xcodegitconfig.git
cd xcodegitconfig
sudo ruby InstallXcodeProjectGitSettings.rb
- (BOOL)insertNewObject
{
// Create a new instance of the entity managed by the fetched results controller.
NSManagedObjectContext *context = [fetchedResultsController managedObjectContext];
NSEntityDescription *entity = [[fetchedResultsController fetchRequest] entity];
NSManagedObject *newManagedObject = [NSEntityDescription insertNewObjectForEntityForName:[entity name] inManagedObjectContext:context];
// If appropriate, configure the new managed object.
NSLog(@"%@", currentID);
[newManagedObject setValue:[currentID stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] forKey:@"id"];