Skip to content

Instantly share code, notes, and snippets.

View eliotsykes's full-sized avatar

Eliot Sykes eliotsykes

View GitHub Profile
@eliotsykes
eliotsykes / code_example.md
Last active October 24, 2015 14:52
Markdown code block example using backticks

Triple backticks are used to open and close code blocks. The triple backticks need to be on their own line:

puts "hello world"

And here is another, separate code block. Triple backticks open and close it:

puts "line 1"
require 'rails_helper'
RSpec.describe TodosController, :type => :controller do
describe "GET #index" do
#describe "POST #create" do
#describe "GET #show" do
#describe "PATCH #update" do (or PUT #update)
#describe "DELETE #destroy" do
#describe "GET #new" do
@eliotsykes
eliotsykes / rails-dev-box-postgresql-HOWTO.md
Last active August 29, 2015 14:07
How to setup rails-dev-box & PostgreSQL

SSH to the vagrant OS command line.

Terminal $> vagrant ssh

Login to postgres database as vagrant user with the psql client:

vagrant@rails-dev-box: psql -U vagrant postgres
@eliotsykes
eliotsykes / capybara_finder_options_cheatsheet.md
Last active February 18, 2016 15:57
Capybara Finder Options Cheatsheet

Capybara Options Hash (options) for all, find:

  • text (String, Regexp) — Only find elements which contain this text or match this regexp
  • visible (Boolean, Symbol) — Only find elements with the specified visibility:
    • true - only finds visible elements.
    • false - finds invisible and visible elements.
    • :all - same as false; finds visible and invisible elements.
    • :hidden - only finds invisible elements.
    • :visible - same as true; only finds visible elements.
  • count (Integer) — Exact number of matches that are expected to be found
@eliotsykes
eliotsykes / turbolinks-2.4.0.js
Created November 30, 2014 23:34
turbolinks.js compiled version 2.4.0
@eliotsykes
eliotsykes / Gemfile
Created December 22, 2014 10:29
Gemfile Ruby Version from .ruby-version file
source 'https://rubygems.org'
def ruby_version
version_file = ".ruby-version"
version_override = (File.exist?(version_file) && File.read(version_file).strip)
default_version = "2.1.5"
version_override || default_version
end
ruby ruby_version
@eliotsykes
eliotsykes / todo.js
Last active January 28, 2020 04:32
JSON API with jQuery AJAX and Rails
// Wrap in anonymous function to avoid adding variables to global scope needlessly.
(function($) { // $ is jQuery
function addTodoToDOM(data) { // 'data' is object built from response JSON
// id will be needed when adding delete functionality dynamically.
// var todoId = data.todo.id;
// Add HTML for new todo to document
var tableRow = '<tr><td>' + data.todo.description + '</td></tr>';
@eliotsykes
eliotsykes / server__mocks__todos.js
Last active August 29, 2015 14:14
Ember.js Server Mock with id sequence and req.body JSON
// Generated originally with `ember g http-mock todos`,
// then customized so JSON body parsing is available.
module.exports = function(app) {
var express = require('express');
var todosRouter = express.Router();
// Install body-parser: `npm install --save-dev body-parser`
// Body parser needed so req.body is
// available to router endpoints as JS object.
@eliotsykes
eliotsykes / camfix .bashrc
Last active August 1, 2021 02:06
camfix - Terminal command to fix Mac OS X built-in webcam
#!/bin/bash
# Add to your .bashrc on Mac OSX, then run camfix in Terminal
# if the Mac's built-in camera stops working.
# Thanks to: http://osxdaily.com/2013/12/27/fix-there-is-no-connected-camera-error-mac/
alias camfix='sudo killall VDCAssistant; sudo killall AppleCameraAssistant'
@eliotsykes
eliotsykes / rails_new_help_output.md
Last active March 31, 2024 17:09
"rails new" options explained

Run rails new --help to view all of the options you can pass to rails new:

$ bin/rails new --help
Usage:
  rails new APP_PATH [options]

Options:
  -r, [--ruby=PATH]                                      # Path to the Ruby binary of your choice
                                                         # Default: /Users/eliot/.rbenv/versions/2.2.0/bin/ruby