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
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
exports.I18n =
en:
title: "Free YouTube video download"
navi:
home: "Home"
howto: "Tutorial"
blog: "Blog"
termsofuse: "Terms of Use"
support: "Support"
imprint: "Imprint"
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: {}
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/
# configure these defaults based on Your needs :
JS_FILES_DIR = 'public/javascripts' # the javascripts base directory
EXCLUDED_JS_FILES = %W{ cache/* test/* } # excluded from compilation
OUT_FILE_JS_EXT_PREFIX = ".min" # override with `rake ... OUT_EXT=_pack`
COMPILER_JAR = "lib/jars/build/compiler.jar" # adjust the jar path !
# only required if running under JRuby - will compile multiple files
# faster as it does not need to run system `java -jar ...` commands.
COMPILER_MAIN_CLASS = "com.google.javascript.jscomp.CommandLineRunner"
# This is an incomplete implementation.
module MongoMapper
module NestedAttributes
def self.included(base)
base.extend(ClassMethods)
base.send :include, InstanceMethods
end
module ClassMethods
def accepts_nested_attributes_for(*attr_names)
require 'pp'
require 'rubygems'
require 'mongo_mapper'
MongoMapper.database = 'testing'
class Rating
include MongoMapper::EmbeddedDocument
key :user_id, ObjectId
@arnklint
arnklint / harmony.rb
Created December 27, 2009 18:00 — forked from jnunemaker/harmony.rb
Configuration
module Harmony
# Allows accessing config variables from harmony.yml like so:
# Harmony[:domain] => harmonyapp.com
def self.[](key)
unless @config
raw_config = File.read(RAILS_ROOT + "/config/harmony.yml")
@config = YAML.load(raw_config)[RAILS_ENV].symbolize_keys
end
@config[key]
end
# mongo_template.rb
# fork of Ben Scofield's Rails MongoMapper Template (http://gist.github.com/181842)
#
# To use:
# rails project_name -m http://gist.github.com/raw/248940/c31e540b1b68236697fe8c0f32e6b83a39978797/Rails%20MongoMapper%20Template.rb
# remove unneeded defaults
run "rm public/index.html"
run "rm public/images/rails.png"
run "rm public/javascripts/controls.js"
#
# bash completion support for core Git.
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/).
# Distributed under the GNU General Public License, version 2.0.
#
# The contained completion routines provide support for completing:
#
# *) local and remote branch names