Skip to content

Instantly share code, notes, and snippets.

@clyfe
clyfe / Git quickie.sh
Created October 19, 2010 18:33
Shows common git commands
#########################
### Set a remote repo ###
#########################
# via ssh
> mkdir projectdir.git
> cd projectdir.git
> git init --bare
or use http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way
@clyfe
clyfe / as_orm_agnostic.rb
Created October 30, 2010 08:20
active scaffold orm api
module ActiveRecord
class BaseWithoutTable < Base
self.abstract_class = true
# def create_or_update
# errors.empty?
# end
# def initialize(attributes = nil)
# super
@clyfe
clyfe / rackup.ru
Created November 1, 2010 08:07
rackup dav4rack above session middleware
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
WEBDAV_MOUNT_PATH = '/webdav'
app = Rack::Builder.new {
map WEBDAV_MOUNT_PATH + '/' do
run DAV4Rack::Handler.new(
:root => Rails.root.to_s,
@clyfe
clyfe / rackup.ru
Created November 1, 2010 08:12
rackup dav4rack custom stack
# This file is used by Rack-based servers to start the application.
require ::File.expand_path('../config/environment', __FILE__)
use ActionDispatch::Static
use Rack::Lock
use ActiveSupport::Cache::Strategy::LocalCache
use Rack::Runtime
use Rails::Rack::Logger
use ActionDispatch::ShowExceptions
@clyfe
clyfe / tody.rb
Created November 4, 2010 08:54
sample sinatra app
require 'rubygems'
require 'sinatra'
get '/' do
haml :index
end
enable :inline_templates
enable :run
http://craftyjs.com/
http://easeljs.com/
http://gamejs.org/
https://github.com/biilly/doodle-js
https://github.com/fairfieldt/xcjs
https://github.com/batiste/sprite.js
https://github.com/mrdoob/three.js
https://github.com/ysimonson/canvas.js
https://github.com/davebalmer/jo
@clyfe
clyfe / JS Game engines
Created December 21, 2010 09:52
JS Game engines and more
###########
### MVC ###
###########
https://github.com/documentcloud/backbone
https://github.com/paulca/eyeballs.js
https://github.com/ahe/choco
https://github.com/maccman/superapp
http://www.sproutcore.com/
http://javascriptmvc.com/
@clyfe
clyfe / cancan_bridge.rb
Created February 10, 2011 16:21
AS CanCan bridge
# Plugs into AS authorization
require 'active_support/concern'
require 'active_scaffold/bridges/bridge'
module ActiveScaffold
module CancanBridge
module Core
extend ActiveSupport::Concern
class Campaign < ActiveRecord::Base
has_many :subscriptions
has_many :territories, :through => :subscriptions
...
def self.authorized_for?(options = {})
return true if options[:column].present?
super(options)
end
# config/initializers/as_i92.rb
# ========================================================================
# resolution for https://github.com/vhochstein/active_scaffold/issues/92 #
# currently monkeypatching the bug, to be deleted on official fix #
# ========================================================================
module ActiveScaffold::Actions
module Update
protected