How do you compare date/times in RSpec?
If you do this
expect(Time.now.to_i).to eq Time.new(2014, 4, 2).to_i
#!/usr/bin/env ruby | |
# if limiting to one chapter, ./audiobook.rb 05 | |
LIMIT = (ARGV[0] =~ /\A[0-9][0-9]\Z/) ? ARGV[0] : false | |
BASE = Dir.pwd + '/' | |
NUMS = BASE + 'ChapterNums/' | |
DRUM = BASE + 'DrumFills/' | |
GUIT = BASE + 'GuitarChords/' | |
URLS = BASE + 'URLs/' |
#!/usr/bin/env ruby | |
# encoding: utf-8 | |
require 'bundler' | |
Bundler.setup(:default) | |
require 'active_record' | |
require 'minitest/autorun' | |
require 'logger' |
module I18n | |
module Backend | |
class Simple | |
module Implementation | |
alias_method :lookup_orig, :lookup | |
# Give ability to check I18n looked up keys in lazy mode by setting env var I18N_DEBUG to true | |
# | |
def lookup(locale, key, scope = [], options = {}) | |
puts "I18N keys: #{I18n.normalize_keys(locale, key, scope, options[:separator])}" if ENV['I18N_DEBUG'] |
// helper to find Brave in User Agent string | |
function isBraveAgent(userAgentResponse) { | |
var isBraveIndex = ~userAgentResponse.indexOf('Brave') | |
if (isBraveIndex < 0) { | |
return true | |
} | |
return false | |
} | |
// Function from Javarome |
This allows you to use the following video streaming services outside of the US from your Mac without having to use a proxy or VPN, so no big bandwidth issues:
#login | |
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d ' {"user":{"email":"<email>","password":"<passwd>"}}' http://localhost:3000/api/v1/sign_in.json | |
#logout | |
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X DELETE http://localhost:3000/api/v1/sign_out.json?auth_token=<token> |
# Allows you to build a Hash in a fashion very similar to Builder. Example: | |
# Fork of https://gist.github.com/360506 by BrentD with some enhancements | |
# | |
# HashBuilder.build! do |h| | |
# h.name "Nilesh" | |
# h.skill "Ruby" | |
# h.skill "Rails" # multiple calls of the same method will collect the values in an array | |
# h.location "Udaipur, India" do # If a block is given, first argument will be set as value for :name | |
# h.location do | |
# h.longitude 24.57 |
class SecretController < ApplicationController | |
before_filter :authenticate_user! | |
def show | |
end | |
end |