Skip to content

Instantly share code, notes, and snippets.

View eliotsykes's full-sized avatar

Eliot Sykes eliotsykes

View GitHub Profile
@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
$ 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 / 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 / current-route-query-params-ember-component.js
Last active August 15, 2024 15:15
How to get the current route, queryParams, etc. in an Ember component
// Examples
// Yes, "router.router" twice - this assumes that the router is being injected
// into the component. Otherwise lookup 'router:main'
// One of these will be of interest, figure out which one you want:
this.get('router.router.state');
this.get('router.router.state.params');
this.get('container').lookup('controller:application').currentPath;
@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:
@eliotsykes
eliotsykes / api_controller.rb
Last active October 30, 2015 18:40
Avoid cookies in Rails 4.2 API Controller
class Api::ApiController < ActionController::Base
protect_from_forgery with: :null_session
def self.disable_turbolinks_cookies
skip_before_action :set_request_method_cookie
end
disable_turbolinks_cookies
end
@eliotsykes
eliotsykes / git-aware-bash-prompt.md
Last active May 30, 2025 08:07
Git Aware Bash Prompt