This file contains hidden or 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 'open3' | |
require 'colorize' | |
unless Dir.exists?('.git') | |
puts 'No .git directory'.red | |
exit | |
end |
This file contains hidden or 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
// simple templateing | |
String.prototype.template = function() { | |
var formatted = this, arg; | |
var args = typeof(arguments[0]) === 'object' ? arguments[0] : arguments; | |
for(arg in args) { | |
formatted = formatted.replace("{" + arg + "}", args[arg]); | |
} | |
return formatted; | |
}; |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Sortable test Dino</title> | |
</head> | |
<body> | |
<style> | |
ul { margin:0; padding:0; width:200px; float:left; margin-right:50px; } | |
ul li { border:1px solid #ccc; background-color:#eee; margin-bottom:10px; padding:10px; } |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Native drag drop</title> | |
</head> | |
<body> | |
<style media="screen"> | |
div.elms .item { width:100px; border:1px solid #ddd; background:#eee; padding:5px; margin-bottom:5px; } | |
div.targets { margin-top:100px; } |
This file contains hidden or 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
# html = render.tag 'head', -> | |
# [ | |
# @h1 class:'test', -> @tag('small', 'product') + 'Dux' | |
# @div -> | |
# [2,4,6,7].map (el) => | |
# @li el | |
# @tag '.bla.blo', 'div.bla' | |
# @tag '#bla.klass', 'div id bla' | |
# ] |
This file contains hidden or 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
class Runner | |
@threads = {} | |
def self.spawn(name, ttl=1) | |
@threads[name] = {} | |
Thread.new do | |
while @threads[name] | |
yield(@threads[name]) | |
sleep ttl | |
end |
This file contains hidden or 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 './scripts/lib/auto_migrate.rb' | |
db_config = YAML.load_file('./config/database.yml')[ENV['RACK_ENV'] || 'development'] | |
AutoMigrate.connect(db_config) | |
require './config/schema.rb' | |
This file contains hidden or 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 'benchmark' | |
require 'haml' | |
require 'tilt' | |
Tilt.register Haml::Engine, 'haml' | |
class Template | |
attr_reader :response, :locals |
This file contains hidden or 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
output | |
validate | |
before save BASE | |
before save MODEL | |
after_save MODEL |
This file contains hidden or 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 Annotations | |
def annotations(meth=nil) | |
return @__annotations__[meth] if meth | |
@__annotations__ | |
end | |
private | |
def method_added(m) | |
(@__annotations__ ||= {})[m] = @__last_annotation__ if @__last_annotation__ |