This file contains 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 RestClientHelpers | |
def bad_request_error(json_body) | |
request = double(:request, redirection_history: nil) | |
net_http_res = double(:response, to_hash: {}, code: 400) | |
response = RestClient::Response.create(json_body.to_json, net_http_res, request) | |
RestClient::BadRequest.new response, 400 | |
end | |
end | |
RSpec.configure do |c| |
This file contains 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
import Controller from '@ember/controller'; | |
export default class ApplicationController extends Controller { | |
appName = 'Ember Twiddle'; | |
} |
This file contains 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"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scaleable=no"> | |
<title>Example Report</title> | |
</head> | |
<body> | |
<div class="page-header"> | |
<h1>Example Report</h1> |
This file contains 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 Bag | |
def initialize | |
@contents = Hash.new(0) | |
end | |
def put_in(names, amount) | |
@contents[[names].flatten] += amount | |
end | |
def take_out(name, amount) |
This file contains 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/bash | |
# usage: cd <directory full of JPGs> && make_timelapse | |
mkdir ./captures | |
COUNTER=0; | |
for i in `find . -name '*.JPG'` ; | |
do | |
#Write the filename to be friendly with ffmpeg's odd filename input | |
FILENAME=`printf '%04d.jpg' $COUNTER` | |
cp $i ./captures/$FILENAME |
This file contains 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 LogCalls | |
def self.extended(b) | |
b.class_eval do | |
(b.methods - Object.methods).each do |m| | |
define_method "#{m.to_s.gsub(/[\?\!=]/, '')}_with_logging#{m.to_s[/[\?\!=]/]}" do |*args| | |
puts m | |
send "#{m.to_s.gsub(/[\?\!=]/, '')}_without_logging#{m.to_s[/[\?\!=]/]}", *args | |
end | |
alias_method_chain m.to_sym, :logging | |
end |
This file contains 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
env: | |
- RUN_TESTS=cucumber | |
- RUN_TESTS=rspec_testunit |
This file contains 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 | |
# Backs up the mounted EBS RAID storage used by Couchbase of an EC2 instance using the Scalarium API. | |
# | |
# Before running the snapshot it stops Couchbase disk writes and then freezes the file system. | |
# File system must be XFS. | |
# | |
# Usage: Backup.new(<scalarium api token>, <mount point for ebs raid>, <name of couchbase bucket to back up>).start (must be run on the EC2 instance). | |
require 'rest_client' |
This file contains 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
# take one of the wifi cards from the bar and fill in the blanks | |
# this wil log you into the hotel wifi without having to type in the username/password every time | |
curl -XPOST -d "username=<username>&password=<password>&operator=homerun.telia.com" https://login.homerun.telia.com/sd/login |
This file contains 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
# encoding: utf-8 | |
require_relative 'type' | |
require 'yaml' | |
30.times {puts} | |
sleep 2 | |
command '"That was: #{event.name} #{Location.current} #{Date.today.year}"', "=> That was: Railsgirls Berlin 2012" |
NewerOlder