Skip to content

Instantly share code, notes, and snippets.

View r00k's full-sized avatar
💭
Working on Tuple (https://tuple.app)

Ben Orenstein r00k

💭
Working on Tuple (https://tuple.app)
View GitHub Profile
require 'rbconfig'
require 'find'
require 'ftools'
include Config
# this was adapted from rdoc's install.rb by ways of Log4r
$sitedir = CONFIG["sitelibdir"]
unless $sitedir
# Returns just the numbers from the phase attribute
def display_phase
case phase
when /(\d).*(\d)/
$1 + ' / ' + $2
when /(\d)/
$1
when nil
''
else
require File.dirname(__FILE__) + '/../test_helper'
class ApplicationLevelTest < ActionController::TestCase
# This class holds tests for application-level components: layouts, application_controller elements, etc
class GoogleAnalyticsController < ApplicationController
def any_action
end
end
def authenticate
return true if Rails.env.test?
success = authenticate_or_request_with_http_digest do |user|
ADMIN_CREDENTIALS[user]
end
# We have to explicitly check if success is true here because
# auth_or_req_w_http_digest returns a string on authorization
# failure (?!)
session[:admin] ||= success
end
# Show SQL in console
if ENV.include?('RAILS_ENV') && !Object.const_defined?('RAILS_DEFAULT_LOGGER')
require 'logger'
RAILS_DEFAULT_LOGGER = Logger.new(STDOUT)
end
[user]
name = Ben Orenstein
email = ben.orenstein@gmail.com
[alias]
co = checkout
[color]
diff = auto
status = auto
NoMethodError in DecksController#update
undefined method `original_filename' for "07 Sweet Pea.m4a":String
RAILS_ROOT: /home/rob/code/flashcards
Application Trace | Framework Trace | Full Trace
app/models/card_sound.rb:5:in `file='
app/models/card.rb:13:in `sound_file='
app/models/deck.rb:10:in `card_attributes='
ben@town ~/code $ time git clone git://github.com/rails/rails.git
(...)
real 0m27.800s
user 0m21.590s
sys 0m2.590s
--------------------
def squish(str)
str = str.split('')
str.inject(str[0]) do |acc, char|
acc << char unless acc.split('').last.downcase == char.downcase
acc
end
end
puts squish("AQAaaBbbbbccCcc")
puts squish("ZzzzzXxxxyYY")
#!/usr/bin/ruby
require 'rubygems'
require 'open-uri'
FILE_NAME = '/home/beno/projects/training_checker/seats_left.txt'
previous_seats_left = File.open(FILE_NAME).read
doc = open('https://training.thoughtbot.com/courses/12-vim-for-rubyists/registrations/new').read