Skip to content

Instantly share code, notes, and snippets.

View Yorkshireman's full-sized avatar
😮

Andrew Stelmach Yorkshireman

😮
View GitHub Profile
@Yorkshireman
Yorkshireman / Gemfile
Last active January 27, 2016 00:11
spec_helper and Gemfile from a Padrino app. This successfully runs RSpec/Capybara Unit/Feature tests.
source 'https://rubygems.org'
# Padrino supports Ruby version 1.9 and later
ruby '2.3.0'
# Project requirements
gem 'rake'
# Component requirements
gem 'bcrypt'
@Yorkshireman
Yorkshireman / users.rb
Created February 1, 2016 00:46
PadrinoBlog users controller pre-refactor
PadrinoBlog::App.controllers :users do
get :new do
@user = User.new
render 'users/new'
end
post :create do
user = User.new(params[:user])

Terminal

Ctrl + a Go to the beginning of the line.
Ctrl + e Go to the end of the line.

Terminal & Browser

Command + Shift + { or } Select tab on the left or right.
Command + Shift + { or } Select tab on the left or right.
Command + Shift + T Re-open a tab that you've just closed.
Command + T Open a new tab.

@Yorkshireman
Yorkshireman / team.rb
Last active May 30, 2016 18:50
Neat Class.all pattern
class Team
TEAMS = []
attr_reader :name
def initialize(params)
@name = params[:team][:name]
TEAMS << self
end
def self.all
@Yorkshireman
Yorkshireman / Gemfile
Last active June 16, 2016 11:26
Basic Sinatra starter Gemfile
source 'https://rubygems.org'
ruby '2.3.1'
gem 'sinatra'
group :development, :test do
gem 'byebug'
end
@Yorkshireman
Yorkshireman / circle.yml
Created June 29, 2016 15:37
Installing Chrome on Circle CI machine (Ubuntu 14.04)
dependencies:
pre:
- sudo apt-get install libxss1 libappindicator1 libindicator7
- wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
- sudo dpkg -i ./google-chrome*.deb
- sudo apt-get install -f
@Yorkshireman
Yorkshireman / _hello_world.slim
Last active May 6, 2021 15:39
slim partials in Sinatra
h1 Hello, World! Hello #{name}!
/ I initially had only `.render({}, locals)`, which meant that the partials didn't
/ have access to any helper methods contained inside `OtherHelperMethods` (but `home.slim` did).
/ Passing `self` into `.render`, as the first argument, fixes that (if you're curious
/ about that, look up the `Tilt::Template #render` documentation.
/ With this PartialsHelper, passing locals is optional, as is specifying a different
/ path to the partial (relative to `settings.views`).