Skip to content

Instantly share code, notes, and snippets.

Avatar

Andrew Stelmach Yorkshireman

View GitHub Profile
@Yorkshireman
Yorkshireman / _hello_world.slim
Last active Oct 10, 2020
slim partials in Sinatra
View _hello_world.slim
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`).
@Yorkshireman
Yorkshireman / circle.yml
Created Jun 29, 2016
Installing Chrome on Circle CI machine (Ubuntu 14.04)
View circle.yml
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 / Gemfile
Last active Jun 16, 2016
Basic Sinatra starter Gemfile
View Gemfile
source 'https://rubygems.org'
ruby '2.3.1'
gem 'sinatra'
group :development, :test do
gem 'byebug'
end
@Yorkshireman
Yorkshireman / team.rb
Last active May 30, 2016
Neat Class.all pattern
View team.rb
class Team
TEAMS = []
attr_reader :name
def initialize(params)
@name = params[:team][:name]
TEAMS << self
end
def self.all
View gist:8d886dbfde6b2c1afc6af9141daa5e64

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 / users.rb
Created Feb 1, 2016
PadrinoBlog users controller pre-refactor
View users.rb
PadrinoBlog::App.controllers :users do
get :new do
@user = User.new
render 'users/new'
end
post :create do
user = User.new(params[:user])
@Yorkshireman
Yorkshireman / Gemfile
Last active Jan 27, 2016
spec_helper and Gemfile from a Padrino app. This successfully runs RSpec/Capybara Unit/Feature tests.
View Gemfile
source 'https://rubygems.org'
# Padrino supports Ruby version 1.9 and later
ruby '2.3.0'
# Project requirements
gem 'rake'
# Component requirements
gem 'bcrypt'
You can’t perform that action at this time.