Skip to content

Instantly share code, notes, and snippets.

View eliotsykes's full-sized avatar

Eliot Sykes eliotsykes

View GitHub Profile
@eliotsykes
eliotsykes / configurable-authentication-route-mixin.js
Created July 28, 2015 14:34
Ember Simple Auth Configurable Authentication Route Mixin
// For use with the Ember Simple Auth Addon. This is one way to default to
// using authentication required routes. For a preferred solution see:
// https://github.com/simplabs/ember-simple-auth/wiki/Recipe:-Defaulting-to-Authentication-Required-Routes
import Ember from 'ember';
import AuthConfig from 'simple-auth/configuration';
export default Ember.Mixin.create({
// The more secure default is to need authentication for all routes. Do not
// change this value in this file. Only change needsAuthentication in the
# File: spec/support/login_helper.rb
module LoginHelper
def login(user)
visit new_user_session_path
fill_in 'Email', with: user.email
fill_in 'Password', with: user.password
click_button 'Log in'
expect(page).to have_content('Signed in successfully')
@eliotsykes
eliotsykes / _what-is-markrundown.md
Last active August 29, 2015 14:24
Markrundown Sample

NOTE Markrundown now has a working draft implementation to be used with gitbook. See https://github.com/eliotsykes/gitbook-plugin-markrundown

Markrundown can be used to write a technical book that is a step-by-step guide to coding an application.

Markrundown allows you to write the book and the code for the book's example codebase in markdown.

Markrundown is intended for books that need to be regularly updated and rely on having an associated codebase that is stored in a git repo that the reader uses as a reference.

If the book is updated, markrundown will rebuild the book and the book's associated codebase git repo. Each new version of the book is tied to one new version of a git repo. This new git repo has no history from previous versions of the book. The git repo is built entirely from scratch at the same time the book is built from markdown into its output format.

@eliotsykes
eliotsykes / application.scss
Created July 1, 2015 15:17
application.scss July 1st 2015
/*
* This is a manifest file that'll be compiled into application.css, which will include all the files
* listed below.
*
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
*
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
* compiled file so the styles you add here take precedence over styles defined in any styles
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
$ bin/rake routes | grep devise
Prefix Verb URI Pattern Controller#Action
new_user_session GET /users/sign_in(.:format) devise/sessions#new
user_session POST /users/sign_in(.:format) devise/sessions#create
destroy_user_session DELETE /users/sign_out(.:format) devise/sessions#destroy
user_password POST /users/password(.:format) devise/passwords#create
@eliotsykes
eliotsykes / rails_release_history.md
Last active August 29, 2015 14:22
History of Rails Releases (major.minor versions)
Version Release Date
5.0.0 Sometime 2016?
4.2.0 Dec 20, 2014
4.1.0 Apr 8, 2014
4.0.0 Jun 25, 2013
3.2.0 Jan 20, 2012
3.1.0 Aug 31, 2011
3.0.0 Aug 29, 2010
2.3.2 Mar 15, 2009
@eliotsykes
eliotsykes / rails_new_help_output.md
Last active June 11, 2025 16:20
"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
@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 / 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 / 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>';