Skip to content

Instantly share code, notes, and snippets.

View aostrega's full-sized avatar

Artur Ostrega aostrega

View GitHub Profile
@aostrega
aostrega / database.yml
Created June 17, 2015 23:19
Simple sqlite3 database.yml
common: &common
adapter: sqlite3
encoding: unicode
pool: 5
development:
<<: *common
database: db/development.db
# Warning: The database defined as "test" will be erased and
@aostrega
aostrega / README.txt
Last active August 29, 2015 14:02
Requiring MRI stdlib in Opal
Run `rackup` then visit http://localhost:9292/stuff.js.
@aostrega
aostrega / gist:11225999
Created April 23, 2014 17:53
Alternative approach to super-overridable dynamic methods in http://thepugautomatic.com/2013/07/dsom/
class SomeORM
module DynamicAttributes; end
include DynamicAttributes
def self.attributes(*names)
names.each do |name|
DynamicAttributes.module_eval do
define_method(name) do
# Stuff
end
@aostrega
aostrega / gist:9501428
Created March 12, 2014 05:33
Proposed solution to Opal issue #440
/* Generated by Opal 0.6.0 */
(function(ಠopal) {
var self = ಠopal.top, ಠscope = ಠopal, nil = ಠopal.nil, ಠbreaker = ಠopal.breaker, ಠslice = ಠopal.slice, ಠklass = ಠopal.klass, user = nil;
ಠopal.add_stubs(['ಠattr_accessor', 'ಠ==', 'ಠnew', 'ಠputs', 'ಠadmin?']);
(function(ಠbase, ಠsuper) {
function ಠUser(){};
var self = ಠUser = ಠklass(ಠbase, ಠsuper, 'User', ಠUser);
var def = self._proto, ಠscope = self._scope;
@aostrega
aostrega / gist:8796243
Created February 4, 2014 02:04
Lightweight Ruby templates w/ format strings
template = "Hello #{noun}!"
properties = { noun: "World" }
puts template % properties