Skip to content

Instantly share code, notes, and snippets.

View danielfone's full-sized avatar

Daniel Fone danielfone

View GitHub Profile
@danielfone
danielfone / devowelr.rb
Last active December 20, 2015 11:09
1. Download `devowelr.rb` 2. Make sure you can run it from the terminal `ruby ./devowelr.rb` 3. Make sure the result on the first run looks something like the first run below 4. Write code and run the tests until you get as many as possible green :)
#!/usr/bin/env ruby
#
# Write a method that takes in a string and returns it
# with all the vowels removed
#
def devowel(string)
# Write code here...
end
=ERROR REPORT==== 2-Sep-2013::12:55:32 ===
Yaws process died: {{badrecord,headers},
[{yaws,outh_serialize,0},
{yaws_server,deliver_accumulated,4},
{yaws_server,finish_up_dyn_file,2},
{yaws_server,aloop,4},
{yaws_server,acceptor0,2},
{proc_lib,init_p_do_apply,3}]}
development: &development
adapter: postgresql
database: my-database
test: &test
adapter: postgresql
database: my-database-test
production: *development
@danielfone
danielfone / gist:7438461
Last active December 28, 2015 03:58
Spec times vs Rails initialisation times
# ruby 1.9.3
# rails (3.2.15)
$ time rspec spec/lib/label_as_csv_spec.rb
..........................
Finished in 0.38397 seconds
26 examples, 0 failures
Randomized with seed 17361
--- clockingit-tmp.ls.text 2013-11-17 19:22:58.000000000 -0600
+++ clockingit.ls.text 2013-11-17 19:23:10.000000000 -0600
@@ -1,4 +1,10 @@
. drwxr-xr-x loopy/loopy
+./store drwxrwxrwx cit/cit
+./store/avatars drwxrwxrwx cit/cit
+./store/avatars/9416 drwxrwxrwx cit/cit
+./store/logos drwxrwxrwx cit/cit
+./store/logos/9416 drwxrwxrwx cit/cit
+./store/9416 drwxrwxrwx cit/cit
URL_MATCH = Oniguruma::ORegexp.new %q{(?i)(?<=\s|^)((?:https?://|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))}
@danielfone
danielfone / exist.rb
Created April 1, 2014 07:31
Memoized exist matcher
module RSpec
module Matchers
module BuiltIn
# @api private
# Provides the implementation for `exist`.
# Not intended to be instantiated directly.
class Exist < BaseMatcher
def initialize(*expected)
@expected = expected
end
#!/bin/bash
source .config
# Setup up master repo
# git clone --bare $TMP_REPO $MASTER_REPO
sudo -u git git daemon \
--verbose \
--enable=receive-pack \
//
//-- Create a subscriber
//
// POST /api/my-brand/subscribers
{
"subscriber": {
"name": "Test Subscriber",
"email": "[email protected]",
"subscribe": [
'my-list-1',
@danielfone
danielfone / nested.rb
Last active August 29, 2015 14:02
Iterate over multiple arrays
x_coords = [...]
y_coords = [...]
x_coords.each do |x|
y_coords.each do |y|
do_point x, y
end
end