Skip to content

Instantly share code, notes, and snippets.

View kristianmandrup's full-sized avatar

Kristian Mandrup kristianmandrup

  • Freelancer
  • Copenhagen
View GitHub Profile
# Proposal for a Simulated::Transactions API, "A Simulated Transaction Log and Rollback API"
# The example shows how this common API could be used for Mongo DB and Mongoid, both transactionless persistence stores?
# This API could be used in testing frameworks such as rspec, test-unit, cucumber and the like
# in order to ensure running a test doesn't have side effects, even in the context of a transactionless persistence store
class DocA
include MongoMapper::Document
# include specific Simulated::Transactions model
----
# To make it possible to switch Model between persistence solutions, fx from Active Record to Mongoid and back
MODEL:
Person: &Person
_inherits: Being # polymorphic or mongoid
name: string(index:required) # index
age: integer(numeric) # short = num
_associations:
one_belonging: *User
many_belonging: *Post
Obsolete projects:
Cucumber-rails3-patched, Rspec-rails3-gen, Rails3-generator-gem-generator (use Gskelgen instead!), Trace-util-adv, Txt-file-mutator
Hobo-dryml-logging, Hobo-dryml-uncovered, trace-hobo, advanced-trace-util, Hobo DRYML extensions
Gems that work: Thor, Paperclip, Thortask_generator, Require-magic, Cucumber-rails, Rspec-rails, Formtastic
Gems that mostly work:
Translate routes - not sure how to fix the Routes segments stuff!
Gems to be tested: Rails, GSkelgen
Use thor tasks as thor-wrapper to build set of development scripts!
Use octopi API to access github!
TODO for May 2010
===================
Require-me
----------
Works now, but needs a cleanup and refactoring of the code into more files and modules etc.
Remove redundancy! Do it using existing test-suite!
Ruby code Query and Manipulation Language (RQML)
----------
Ruby Rails stack
----------------
Use cases
---------
Authentication and Authorization
- Devise (User only)
- Cancan (roles and permissions)
# Rails thor Gemfile action helpers
# Cleans up a Gemfile by inserting missing newlines between gem statements
# Fixes old 'bug', where gem statements would be inserted into Gemfile without newlines
# ==== Examples
#
# cleanup_gemfile
def cleanup_gemfile
# add newline between each gem statement in Gemfile
gsub_file 'Gemfile', /('|")gem/, "\1\ngem"
From https://mongohq.com/pricing
Free MongoDB hosting
"museo-sans-1","museo-sans-2",Tahoma,Arial,sans-serif;
CSS rules on Nokogiri nodes
module Nokogiri
module XML
module NodeCssExt
attr_accessor :rules
attr_accessor :styles
# merge rules by specificity
def merge_rules!
Ruby Query and Manipulation Language
---
Finally the DSL is getting pretty stable. Latest ideas in the TODO of ruby_traverser ;)