This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'pathname' | |
# files and extensions to process | |
FILES = %w[ capfile Capfile Dockerfile Gemfile Gemfile.devtools Gemfile.lock Guardfile CHANGELOG LICENSE Manifest README README.rdoc README_FOR_APP RUNNING_UNIT_TESTS Rakefile RUBY-STYLE SPECS TODO USAGE Vagrantfile .autotest .gitattributes .gitignore .htaccess .rspec .rcov .rvmrc .travis.yml .vimrc ].freeze | |
EXTENSIONS = %w[ builder cabal cgi coffee conf css deface deploy erb example fcgi feature handlebars haml hs htc htm html jinja js json key markdown md opts pem php rabl rake ratom rb rcsv rdf rdoc reek rhtml rip rjs rpdf ru rxml sake sass scss sh sls smil sql svg thor txt vcf xml yml ].freeze | |
paths = ARGV.flat_map(&Pathname.method(:glob)) | |
paths.each do |path_in| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
development: | |
adapter: master_slave | |
master: | |
adapter: mysql | |
database: master | |
host: master_server | |
slave: | |
adapter: mysql | |
database: slave | |
host: localhost |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NOTE: this is a code spike, and the following code will probably | |
# not make it into dm-core in it's current form. I wanted to see if it | |
# were possible to use a topographical sort to ensure parents were | |
# saved before children, before/after filters were fired in the correct | |
# order, and foreign keys set before children are saved, but after parents | |
# are saved. | |
# The hooks should fire in the following order: | |
# https://gist.github.com/6666d2818b14296a28ab |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby -Ku | |
# $LOAD_PATH.unshift '/Users/dankubb/Programming/ruby/open-source/veritas/lib' | |
# $LOAD_PATH.unshift '/Users/dankubb/Programming/ruby/open-source/veritas-optimizer/lib' | |
require 'veritas' | |
require 'veritas-optimizer' | |
require 'graphviz' | |
include Veritas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby -Ku | |
# encoding: utf-8 | |
# The idea with this code spike is to parse some code that has YARD | |
# documentation, and then wrap the methods at runtime to ensure that | |
# they match the behavior specified in the docs. | |
# | |
# This code will test the input, output and exceptions for every | |
# documented method. It will also test the provided block's input |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine on | |
RewriteLogLevel 2 | |
RewriteLog /var/www/sites/camino_surf/logs/rewrite.log | |
RewriteCond %{HTTP_HOST} !www.caminosurf.com$ [NC] | |
RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-]+).caminosurf.com [NC] | |
# first try to find it in branch dir based on subdomain | |
# ...and if found stop and be happy: | |
RewriteCond /var/www/sites/camino_surf/public/%{REQUEST_FILENAME} -f |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'set' | |
require 'tsort' | |
module DataMapper | |
class Query | |
class Graph | |
include TSort | |
def initialize | |
@graph = Hash.new { |graph, target| graph[target] = Set.new } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module DataMapper | |
module Model | |
module Relationship | |
alias :has_without_polymorphism :has | |
# Defines a 1:n or 1:1 relationship. | |
# | |
# = Options | |
# :as => Symbol defines this relationship as polymorphic | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# | |
# The most important aspect of the new Property API is that | |
# property inheritance should not be used to instruct | |
# adapters how to persist data. It means, for example, that | |
# you should not use Integer as the base class for your custom | |
# property just because it is persisted as an integer. Right now | |
# Enum inherits from Integer because it is stored as an integer. | |
# It is a mistake, because a value of Enum property can be either | |
# a string or a symbol, not integer. The fact that it is persisted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Because I can't figure out how the fuck to get SQL out of datamapper itself | |
class PGEngine < Arel::Visitors::PostgreSQL | |
attr_accessor :engine | |
def initialize(engine) | |
super | |
self.engine = engine | |
end | |
def connection_pool |
OlderNewer