Skip to content

Instantly share code, notes, and snippets.

View mr-rock's full-sized avatar

Javier Cicchelli mr-rock

View GitHub Profile
@mr-rock
mr-rock / sinatra_jquery_test.rb
Created October 9, 2009 11:40
An example of Sinatra working with Ajaxified JQuery based on some pieces of code published by Rafael George on the Sinatra Google Group.
require 'sinatra'
require 'dm-core'
require 'haml'
DataMapper.setup(:default, 'sqlite3::memory:')
class Message
include DataMapper::Resource
property :id, Serial
@mr-rock
mr-rock / first_example.rb
Created October 9, 2009 12:08
Examples for the Cookie-based Sessions in Sinatra published by RubyLearning.com blog on Sep 30, 2009.
require 'rubygems'
require 'sinatra'
enable :sessions
get '/' do
session["value"] ||= "Hello world!"
"The cookie you've created contains the value: #{session["value"]}"
end
@mr-rock
mr-rock / Gitosis on Snow Leopard Server
Created December 27, 2009 15:53
This is the steps I followed in order to install Gitosis on my Snow Leopard Server.
These are the things I did in order to have Gitosis installed and working on my Snow Leopard Server:
1. Install Git.
I use the installer for OS X provided by Google Code (http://git-osx-installer.googlecode.com/files/git-1.6.5.7-intel-leopard.dmg).
2. Install Gitosis
I got the Gitosis from the eagain.net server and I installed using Python bundled with Snow Leopard.
$ git clone git://eagain.net/gitosis.git
$ cd gitosis && python setup.py install
@mr-rock
mr-rock / gist:364144
Created April 12, 2010 23:54
This is the steps I followed in order to install PostgreSQL server on my Snow Leopard Server.
We couldn’t find that file to show.
- (void)scan {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
ALAssetsGroupType sources = ALAssetsGroupLibrary | ALAssetsGroupSavedPhotos;
NSMutableArray *tags = [[NSMutableArray alloc] init];
ALAssetsGroupEnumerationResultsBlock assetsEnumerator = ^(ALAsset *result, NSUInteger index, BOOL *stop){
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
if (result) {
if ([[result valueForProperty:ALAssetPropertyType] isEqual:ALAssetTypePhoto]) {