Skip to content

Instantly share code, notes, and snippets.

View danmcclain's full-sized avatar

Dan McClain danmcclain

View GitHub Profile
import MyObject from '../page-objects/my-object';
test('my arbitrary test', function(assert) {
new MyObject(assert)
.clickSomeNav('Projects')
.assertCurrentRoute('projects.index')
.clickNewProjectButton()
.assertCurrentRoute('projects.new')
.fillInTitle('My new project')
.fillInDescription('desc')
@danmcclain
danmcclain / application.controller.js
Last active September 30, 2015 23:15
New Twiddle
import Ember from 'ember';
export default Ember.Controller.extend({
body: '<a href="/foo">foo</a> <a href="http://google.com">Google</a>'
});
import Resolver from 'ember/resolver';
export default Resolver.extend({
moduleNameLookupPatterns: Ember.computed(function(){
var superValue = this._super.apply(this, arguments);
superValue.unshiftObject(this.somethingThatIsAwesome);
return superValue;
}),
defp _check(%{message: message, sha: sha}, config_file) do
tag_regex = ~r/^\[(?<tag>\w+)( (?<subtag>\w+))?]/
tags = config_file["tags"]
case Regex.named_captures(tag_regex, message) do
%{"tag" => tag, "subtag" => subtag} ->
if tags == nil do
%{status: :pass, sha: sha, message: message}
else
valid_tags = tags
|> Map.keys
#!/bin/bash
# Encode a WAV to a finalized podcast MP3 with metadata, in the current directory
# Requires lame
# With Homebrew on Mac OS X: brew install lame
SHOW_AUTHOR="Dan McClain & Robert Jackson"
EPISODE_NUMBER=12
EPISODE_TITLE="Ember WeekendLand"
test "Creating a session with a GitHub code" do
use_cassette "successful_sign_in" do
response = conn(:post, "/api/v1/session", %{ "authorizationCode" => "dan", "format" => "json", "provider" => "github-oauth2" })
|> DoorApi.Endpoint.call([])
assert response.status == 201
assert Voorhees.matches_schema?(response.resp_body, [user: [:username, :id]])
assert Voorhees.matches_payload?(response.resp_body, %{user: %{ username: "danmcclain" } })
current_session_request = conn(:get, "/api/v1/session")
@danmcclain
danmcclain / gist:78b5182de8493b21b462
Created May 6, 2015 13:07
Ember Validations: Controller/Component
import Ember from 'ember';
import EmberValidations from 'ember-validations';
const { Controller, computed } = Ember;
const { alias } = computed;
export default Controller.extend(EmberValidations, {
contact: alias('model'),
validations: {
'contact.email': {
@danmcclain
danmcclain / gist:a1f26ce4b4dcccca0705
Created April 23, 2015 13:15
Elixir Pi Explosion
➜ elixir git:(master) make test
==> elixir (compile)
==> elixir (eunit)
All 198 tests passed.
==> elixir (exunit)
..........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
➜ ~ dpkg -s elixir
Package: elixir
Status: install ok installed
Priority: optional
Section: contrib
Installed-Size: 3798
Maintainer: Erlang Solutions <[email protected]>
Architecture: amd64
Version: 1.0.3-2
Depends: erlang-base (>= 1:17.0) | erlang-base-hipe (>= 1:17.0) | esl-erlang (>= 1:17.0), erlang-crypto (>= 1:17.0) | esl-erlang (>= 1:17.0), erlang-inets (>= 1:17.0) | esl-erlang (>= 1:17.0), erlang-ssl (>= 1:17.0) | esl-erlang (>= 1:17.0), erlang-syntax-tools (>= 1:17.0) | esl-erlang (>= 1:17.0)
description "argyle"
setuid argyle
setgid www-data
start on runlevel [2345]
stop on runlevel [016]
env HOME=/home/argyle
export HOME