Skip to content

Instantly share code, notes, and snippets.

View DylanFM's full-sized avatar

Dylan Fogarty-MacDonald DylanFM

View GitHub Profile
Gems included by the bundle:
* abstract (1.0.0)
* actionmailer (3.0.0)
* actionpack (3.0.0)
* activemodel (3.0.0)
* activerecord (3.0.0)
* activeresource (3.0.0)
* activesupport (3.0.0)
* addressable (2.2.0)
* arel (1.0.1)
# require 'cucumber/rspec/doubles'
# The code below is copied from the above file
# It wasn't working, but this does for some reason
require 'rspec/core'
RSpec.configuration.configure_mock_framework
World(RSpec::Core::MockFrameworkAdapter)
Before do
RSpec::Mocks::setup(self)
cucumber master: cucumber examples/rspec_doubles/features/mocking.feature
Using the default profile...
F--F
Failing Scenarios:
cucumber examples/rspec_doubles/features/mocking.feature:5 # Scenario: Mock a transmogrifier
1 scenario (1 failed)
2 steps (2 skipped)
0m0.002s
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'
}
function check_git_changes {
var=`git status 2> /dev/null | sed -e '/(working directory clean)$/!d' | wc -l`
if [ $var -ne 1 ]; then
tput setaf 1 # red
else
tput setaf 2 # green
fi
@@ -170,7 +170,8 @@
filteredSelector: 'tbody > tr',
afterRender: null,
beforeRender: null,
- activateOnSetup: true
+ activateOnSetup: true,
+ siblings: true
};
function setup () {
<!doctype html>
<html lang="en">
<head>
<title>Test for jQuery clone bug</title>
</head>
<body>
<section>
<p>Here is a little paragraph.</p>
</section>
@DylanFM
DylanFM / jquery.paginate.coffee
Created February 28, 2011 04:26
Works with will_paginate. Requires innerShiv http://jdbartlett.github.com/innershiv/
$.fn.extend
paginate: (opts) ->
# If we are working on elements
if this.length
this.each ->
defaults =
pagination: '.pagination'
itemPlural: 'things'
@DylanFM
DylanFM / gist:1002288
Created June 1, 2011 13:28 — forked from sabman/gist:1002167
Greggpollack Last night in Berlin
@DylanFM
DylanFM / embed_videos.coffee
Created June 9, 2011 00:52
On Surftourist.com we've had some people putting in a vimeo or youtube link in their descriptions. We want to support video properly, but this is a quick attempt at addressing the solution for the meantime.
# Search for video urls within an element and embed them if possible
embedVideos = (el) ->
el = $ el
if el.length
el.each ->
section = $ @
matches = section.html().match /http:\/\/(www\.)?(youtube|vimeo)\.com\/[^\s<]*/gmi
if matches?.length
# Vimeo or Youtube?
for match in matches
@DylanFM
DylanFM / ST.maps.coffee
Created June 30, 2011 14:50
First foray into asynch JS loading, this is a little snippet of the Surftourist maps code
class ST.maps.Map
constructor: (el, title, opts) ->
@el = $(el)
@opts = $.extend true, {}, @defaults, opts
if @el.length
@title = title
@markers = []
# Load Google maps if it's not present