Skip to content

Instantly share code, notes, and snippets.

View bradphelan's full-sized avatar

Brad Phelan bradphelan

View GitHub Profile
@bradphelan
bradphelan / gist:1031029
Created June 17, 2011 07:39
Rails On Fire Error
1) Selenium Tests The logging in process signs in a valid user
Failure/Error: visit '/users/sign_in'
Selenium::WebDriver::Error::WebDriverError:
Could not find Firefox binary (os=linux). Make sure Firefox is installed or set the path manually with Selenium::WebDriver::Firefox::Binary.path=
# ./spec/integration/log_spec.rb:26:in `block (3 levels) in <top (required)>'
@bradphelan
bradphelan / model_binding.js
Created July 25, 2011 04:49
Model Binding Code
var MyView;
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
}, __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, __slice = Array.prototype.slice;
MyView = (function() {
@bradphelan
bradphelan / gist:1109441
Created July 27, 2011 14:15
rails_admin error trace
Started GET "/admin" for 127.0.0.1 at 2011-07-27 16:22:39 +0200
Processing by Admin::DashboardController#index as HTML
Completed in 0ms
Started GET "/users/sign_in" for 127.0.0.1 at 2011-07-27 16:22:39 +0200
Processing by Devise::SessionsController#new as HTML
Rendered /Users/bradphelan/.rvm/gems/ruby-1.9.2-p180@mysugrapp/bundler/gems/devise-97659a1193ac/app/views/devise/shared/_links.erb (0.4ms)
@bradphelan
bradphelan / gist:1699774
Created January 29, 2012 17:39
formtastic zurb
@import "compass/typography/lists/bullets"
@import "compass/reset/utilities"
@import "foundation"
form
li.input
label
background-color: none
background: none
li.button
require 'acceptance/acceptance_helper'
feature "Add comment to event", :js => true do
background do
@password = "xxxxxx"
@owner = Factory :registered_user, :password => @password
@guest = Factory :registered_user, :password => @password
@event = Factory :event, :owner => @owner
@event.invite @guest.email
@bradphelan
bradphelan / gist:2251335
Created March 30, 2012 12:57
URI.regexp generated regular expression
/
([a-zA-Z][-+.a-zA-Z\d]*): (?# 1: scheme)
(?:
((?:[-_.!~*'()a-zA-Z\d;?:@&=+$,]|%[a-fA-F\d]{2})(?:[-_.!~*'()a-zA-Z\d;\/?:@&=+$,\[\]]|%[a-fA-F\d]{2})*) (?# 2: opaque)
|
(?:(?:
\/\/(?:
(?:(?:((?:[-_.!~*'()a-zA-Z\d;:&=+$,]|%[a-fA-F\d]{2})*)@)? (?# 3: userinfo)
(?:((?:(?:(?:[a-zA-Z\d](?:[-a-zA-Z\d]*[a-zA-Z\d])?)\.)*(?:[a-zA-Z](?:[-a-zA-Z\d]*[a-zA-Z\d])?)\.?|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|\[(?:(?:[a-fA-F\d]{1,4}:)*(?:[a-fA-F\d]{1,4}|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|(?:(?:[a-fA-F\d]{1,4}:)*[a-fA-F\d]{1,4})?::(?:(?:[a-fA-F\d]{1,4}:)*(?:[a-fA-F\d]{1,4}|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}))?)\]))(?::(\d*))?))? (?# 4: host, 5: port)
|
@bradphelan
bradphelan / gist:3047816
Created July 4, 2012 15:06 — forked from anonymous/gist:2996643
Front-end programmer positions
We're a Chinese company building an enterprise collaboration product. Our founding team includes Chinese, Spanish and American entrepreneurs with more than 15 years of experience in China, managing more than 500 people and a track record of several successful exits.
We're headquartered in Shanghai, with offices in Beijing, Hong Kong, Singapore and Taiwan.
We're on stealth mode, with a fully-built first version of our product, and some big names as paying clients.
We are looking for 2 front-end programmers to give us a hand with our web and mobile apps.
These are the technologies that we use:
@bradphelan
bradphelan / Maybe.cs
Created November 5, 2012 09:23
Maybe
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace FunctionalExtensions
{
#region Maybe
@bradphelan
bradphelan / maybetest.cs
Created November 5, 2012 10:09
Maybe tests
[Microsoft.VisualStudio.TestTools.UnitTesting.TestMethod]
public void TestNullToMaybe()
{
A a = null;
Maybe<A> ma = a.ToMaybe();
None<A> na = ma as None<A>;
na.Should().NotBe(null);
@bradphelan
bradphelan / Maybe.cs
Created December 11, 2012 11:19
Maybe<T> Implementation in C#
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Reactive.Linq;
namespace FunctionalExtensions
{