Skip to content

Instantly share code, notes, and snippets.

View eliotsykes's full-sized avatar

Eliot Sykes eliotsykes

View GitHub Profile
@eliotsykes
eliotsykes / windows_cheatsheet.md
Last active August 29, 2015 14:06
Where to run what on Windows?

Git Bash

Use Git Bash in Windows for:

  • subl commands (e.g. subl ., subl myfile.rb) to open files with Sublime Text
  • git commands (e.g. git add ., git commit -m "message" README.md, git push heroku master)
  • vagrant commands (cd ~/dev-rails-box first)
  • open commands

Vagrant VM

@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 / turbolinks-2.4.0.js
Created November 30, 2014 23:34
turbolinks.js compiled version 2.4.0
@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 / 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 / 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
@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.

# 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 / 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
@eliotsykes
eliotsykes / ranges_and_arrays.rb
Created September 27, 2015 15:21
Ranges & Arrays
fruits = ['apples', 'bananas', 'coconuts', 'dates', 'elderberry']
# Array[ ] accepts an integer to lookup by index, this is what we
# do most of the time when we work with arrays:
fruits[0] #=> 'apples'
fruits[2] #=> 'coconuts'
fruits[4] #=> 'elderberry'
# Array[ ] accepts negative integers too. These get special treatment. They
# count backwards from the end of the array: