Skip to content

Instantly share code, notes, and snippets.

View aphexddb's full-sized avatar
💭
We are all made of stars

Gardiner Allen aphexddb

💭
We are all made of stars
View GitHub Profile
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@aphexddb
aphexddb / Rails API Design.md
Last active December 17, 2015 19:58
Creating a flexible, modern API in Rails 3

This is a guide to creating a basic API in Rails for consumption by Ember.js or your favorite framework. Key areas are support of CORS requests and Jbuilder for creating a self-documenting API.

Add these gems to your Gemfile

gem 'rack-cors', :require => 'rack/cors'

gem 'jbuilder'

@aphexddb
aphexddb / factory_girl_spec.rb
Last active December 18, 2015 03:09
To make sure that your models are valid you can automatically test all of your factories with the following code
require 'spec_helper'
describe 'validate FactoryGirl factories' do
FactoryGirl.factories.each do |factory|
context "with factory for :#{factory.name}" do
subject { FactoryGirl.build(factory.name) }
it "is valid" do
is_valid = subject.valid?
is_valid.should be_true, subject.errors.full_messages.join(',')
@aphexddb
aphexddb / .wakeup
Last active May 14, 2023 05:10
OSX sleepwatcher script to take a photo on wakeup and upload to dropbox
#!/bin/bash
#
# Mac camera auto upload script
#
#####################################################
# Generate filename based on date stamp
FILE_SRC=/tmp/$(date +%m%d%y%H%M%S).jpg;
DROPBOX_FOLDER=macbook
DROPBOX_UPLOADER=/Users/<username>/Dropbox-Uploader/dropbox_uploader.sh

Time Machine on any network share

Time Machine setup for OSX Mavricks on a shared file server (Linux, windows, etc.)

  1. Find out the machine name of your Mac

     $ hostname
    

    It should be something like: yourname-mbp

@aphexddb
aphexddb / chef_cookie_jar
Created June 9, 2014 20:35
Chef recipe snippet that adds a cookie to the cookie jar. This allows remote_file to use Basic Auth URL's
@aphexddb
aphexddb / docker_install_rbenv_ruby.txt
Created June 27, 2014 17:19
Ruby with rbenv in Docker
# install ruby
ENV RUBY_VERSION jruby-1.7.8
ENV RBENV_VERSION $RUBY_VERSION
ENV CONFIGURE_OPTS --disable-install-doc
RUN curl https://raw.githubusercontent.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash
ENV PATH $HOME/.rbenv/bin:$PATH
ENV PATH $HOME/.rbenv/shims:$PATH
RUN rbenv install $RUBY_VERSION
RUN rbenv global $RUBY_VERSION
@aphexddb
aphexddb / README.md
Last active August 29, 2015 14:09
Jison grammar for recipe ingredients

This is a recipe ingredient parser. Strings like:

2 cups whole pecans (8 ounces), toasted and chopped into small pieces

Should end up as:

{
  units: 2,
  unit: 'cups',

item: 'whole pecans (8 ounces)',

Keybase proof

I hereby claim:

  • I am aphexddb on github.
  • I am aphexddb (https://keybase.io/aphexddb) on keybase.
  • I have a public key ASC4uW8vZwPcf8V2Yp6ip19LC2AJpW7Dyq0ix17hH4t5XQo

To claim this, I am signing this object: