Skip to content

Instantly share code, notes, and snippets.

View arnklint's full-sized avatar
😀
writing status

Jonas Arnklint arnklint

😀
writing status
View GitHub Profile
This plugin for Merb and Rails provides a simple and extremely flexible way to upload files.
ORM Support: ActiveRecord, DataMapper, Sequel, MongoMapper
Storage Support: S3, MongoDB's GridFS, filesystem...
Oh yeah and works with RMagick, ImageScience, MiniMagic
http://github.com/jnicklas/carrierwave/
sys: require("sys")
require.paths.unshift "/Users/jonahfox/src/mongoose"
mongoose: require('mongoose').Mongoose
mongoose.model 'User', {
properties: ['nick', 'pass', 'email', 'updated_at']
indexes: [[{ nick: 1 }, {unique: true}]]
setters: {}
exports.I18n =
en:
title: "Free YouTube video download"
navi:
home: "Home"
howto: "Tutorial"
blog: "Blog"
termsofuse: "Terms of Use"
support: "Support"
imprint: "Imprint"
Processing PagesController#menu_items (for 94.255.239.201 at 2011-03-28 16:14:48) [GET]
Parameters: {"website_id"=>"56", "language"=>"se", "id"=>"1109", "div_id"=>"menu"}
Page Load (0.1ms) SELECT * FROM `pages` WHERE (`pages`.`id` = 0) AND (deleted = 0)
User Load (0.1ms) SELECT * FROM `users` WHERE (`users`.`id` = 15)
TranslatedPageAttribute Load (0.1ms) SELECT * FROM `translated_page_attributes` WHERE (`translated_page_attributes`.`language_short_code` = 'se' AND `translated_page_attributes`.`attribute_name` = 'title') AND (`translated_page_attributes`.page_id = 1105) LIMIT 1
Page Load (0.1ms) SELECT * FROM `pages` WHERE (`pages`.`id` = 1109) AND (deleted = 0)
Page Load (1.9ms) SELECT * FROM `pages` WHERE (`pages`.parent_id = 1105) AND (deleted = 0) ORDER BY position asc
Menu Load (1.8ms) SELECT * FROM `menus` WHERE (`menus`.`look_id` = 140 AND `menus`.`for_html_id` = 'menu') LIMIT 1
Rendered pages/_menu_page (6.4ms)
Page Load (2.0ms) SELECT * FROM `pages` WHERE (website_id =
require 'test_helper'
require 'minitest/autorun'
class MiniTest::Spec
include ActiveSupport::Testing::SetupAndTeardown
include ActiveRecord::TestFixtures
alias :method_name :__name__ if defined? :__name__
self.fixture_path = File.join(Rails.root, 'test', 'fixtures')
end
@arnklint
arnklint / watchr.rb
Created May 23, 2011 09:25 — forked from ccollins/watchr.rb
watchr - cucumber, rspec
require 'growl'
require 'open3'
ENV["WATCHR"] = "1"
$spec_cmd = "env RSPEC_COLOR=true spec --drb --colour --format nested"
$cuke_cmd = "cucumber --color --drb --require features/step_definitions --require features/support"
$pass = File.join(File.expand_path(File.dirname(__FILE__)), '.watchr_images', 'pass.png')
$fail = File.join(File.expand_path(File.dirname(__FILE__)), '.watchr_images', 'fail.png')
$pending = File.join(File.expand_path(File.dirname(__FILE__)), '.watchr_images', 'pending.png')
@arnklint
arnklint / authentication.rb
Created May 24, 2011 08:43 — forked from jnunemaker/authentication.rb
a starting point for authentication with mongomapper and rails
# include this in application controller
module Authentication
protected
# Inclusion hook to make #current_user and #signed_in?
# available as ActionView helper methods.
def self.included(base)
base.send :helper_method, :current_user, :signed_in?, :authorized? if base.respond_to? :helper_method
end
# Returns true or false if the user is signed in.
@arnklint
arnklint / gist:1122573
Created August 3, 2011 13:01 — forked from ches/gist:718234
Very simple taggable behavior for Mongoid
# Basic tagging system for mongoid documents.
# jpemberthy 2010
#
# class User
# include Mongoid::Document
# include Mongoid::Document::Taggable
# end
#
# @user = User.new(:name => "Bobby")
# @user.tag_list = "awesome, slick, hefty"
@arnklint
arnklint / exception_mailer.rb
Created August 4, 2011 09:06 — forked from TomV/exception_mailer.rb
Simple Sinatra extension to catch exceptions and do some notifiyin (not working yet.)
require 'sinatra/base'
module Sinatra
# module to catch Sinatra errors and send a email
module ExceptionMailer
def initialize(app)
@app = app
# set parameters here..
yield self if block_given?
end
@arnklint
arnklint / person_test.rb
Created September 13, 2011 23:32 — forked from tenderlove/person_test.rb
Use minitest/spec with Rails 3
require 'test_helper'
require 'minitest/autorun'
class MiniTest::Spec
include ActiveSupport::Testing::SetupAndTeardown
include ActiveRecord::TestFixtures
alias :method_name :__name__ if defined? :__name__
self.fixture_path = File.join(Rails.root, 'test', 'fixtures')
end