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 'aws-sdk' | |
require 'json' | |
require 'digest' | |
['AWS_REGION', 'AWS_ACCESS_KEY_ID', 'AWS_SECRET_ACCESS_KEY'].each { |key| | |
next if ENV[key] | |
puts "ENV key '#{key}' not defined (AwsS3)" | |
exit | |
} |
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 'geocoder' | |
point = [48.1293696,11.5783119] | |
puts Geocoder::Calculations.bounding_box point, 100, :unit=>:km |
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
# Add your own tasks in files placed in lib/tasks ending in .rake, | |
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. | |
require File.expand_path('../config/application', __FILE__) | |
Webapp::Application.load_tasks | |
### Custom | |
Rake::Task["default"].clear |
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__ |
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
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
#!/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
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
# 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
<!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; } |