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
time_select = (time_str) -> | |
time_str = time_str.match /(\d+):(\d+)/ | |
if (time_str) | |
[h, m] = time_str[1..2] | |
hour_options = for hour in [0...24] | |
hour_s = if hour < 10 then "0#{hour}" else hour | |
"<option #{if hour == h then 'selected' else ''}>#{hour_s}</option>" # TODO Coffee == -> === macht wahrscheinlich stress | |
minute_options = for minute in [0...60] | |
minute_s = if minute < 10 then "0#{minute}" else minute | |
"<option #{if minute == m then 'selected' else ''}>#{minute_s}</option>" |
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
sdasdas |
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 'set' | |
class Monitor | |
@@max_procs = 3 | |
def initialize(worker_class) | |
@worker = worker_class.new | |
@interrupted = false | |
@threads = [] |
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 PolylineEncoder | |
# Encode an rgeo exterior ring/interior ring, | |
# anything with an attribute points, containing an array | |
# of object with x and y float attributes | |
def self.encode(ring) | |
encoded = "" | |
px = 0 | |
py = 0 | |
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 'rubygems' unless defined? Gem # rubygems is only needed in 1.8 | |
def unbundled_require(gem) | |
loaded = false | |
if defined?(::Bundler) | |
Gem.path.each do |gems_path| | |
gem_path = Dir.glob("#{gems_path}/gems/#{gem}*").last |
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
#!/bin/sh | |
curl -LO http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem | |
curl -LO http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem | |
gem install linecache19-0.5.13.gem | |
gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=$HOME/.rvm/rubies/ruby-1.9.3-p0-falcon/include/ruby-1.9.1/ruby-1.9.3-p0/ | |
rm linecache19-0.5.13.gem | |
rm ruby-debug-base19-0.11.26.gem |
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
RSpec::Matchers.define :have_content_type do |content_type| | |
CONTENT_HEADER_MATCHER = /^(.*?)(?:; charset=(.*))?$/ | |
chain :with_charset do |charset| | |
@charset = charset | |
end | |
match do |response| | |
_, content, charset = *content_type_header.match(CONTENT_HEADER_MATCHER).to_a |
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 'rubygems' | |
require 'spork' | |
def start_simplecov | |
require 'simplecov' | |
SimpleCov.start 'rails' unless ENV["SKIP_COV"] | |
end | |
def spork? | |
defined?(Spork) && Spork.using_spork? |
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
<? | |
function imgly_pics($username = '', $num = 4, $linked = true, $size = 75, $margin = 5, $border = 0, $bordercolor = '#FFFFFF') { | |
$file = @file_get_contents("http://img.ly/images/".$username.".rss"); | |
preg_match_all('/<link>http:\/\/img.ly\/(\w+)<\/link>/i', $file, $matches); | |
$imageids = $matches[1]; | |
for($i = 0; $i < $num; ++$i) { | |
$imageid = $imageids[$i]; |
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
#----------------------------------------------------------------------------------------------- | |
# config/application.rb | |
#----------------------------------------------------------------------------------------------- | |
require File.expand_path('../boot', __FILE__) | |
require 'rails/all' | |
Bundler.require(:default, Rails.env) if defined?(Bundler) | |
# Bring in the Railtie that will set Rails' various logger variables to | |
# instances of Logging::Logger instead of Rails' built-in ActiveSupport::BufferedLogger. |