Skip to content

Instantly share code, notes, and snippets.

View ericyoung's full-sized avatar

Eric Young ericyoung

View GitHub Profile
@ericyoung
ericyoung / readme.txt
Created March 22, 2020 03:09
Jekyll + Netlify
1. When enabling netlify identity and git-gateway, you can assign roles to the user, and even use roles as a store, such as "company:Bill Young Productions."
2. To protect a page, create a layout (_layouts/protected/admin.html) that inherits from default layout and protect the layout like this:
---
layout: page
role: admin
---
<script type="text/javascript">
var allowed = user.app_metadata.roles.includes(page.role);
if(!allowed) window.location.replace("/denied");
@ericyoung
ericyoung / wsl-git-workaround.txt
Last active February 11, 2020 06:57
WSL git issue workaround
# rbenv
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev lib
cd
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@ericyoung
ericyoung / rails_snippets.rb
Created March 20, 2015 01:11
Rails snippets
_
@ericyoung
ericyoung / 0_reuse_code.js
Last active August 29, 2015 14:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@ericyoung
ericyoung / spec_helper.rb
Created September 12, 2011 23:09 — forked from ryanb/spec_helper.rb
Focus on specific specs in RSpec
# add this to your spec helper
RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
config.filter_run :focus => true
config.run_all_when_everything_filtered = true
end
# and then use the :focus tag in your specs
it "does something awesome", :focus do
@ericyoung
ericyoung / wait_until.rb
Created September 2, 2011 06:44 — forked from metaskills/wait_until.rb
Never sleep() using Capybara!
# Have you ever had to sleep() in Capybara-WebKit to wait for AJAX and/or CSS animations?
describe 'Modal' do
should 'display login errors' do
visit root_path
click_link 'My HomeMarks'
within '#login_area' do
fill_in 'email', with: 'will@not.work'
fill_in 'password', with: 'test'
@ericyoung
ericyoung / flash
Created July 25, 2010 19:28
flash styling and partial for rails 3
**** css ****
p.flash {
font-family: "Trebuchet MS", arial, sans-serif;
font-size: 14px;
padding: 10px;
}
p.notice {
border:1px solid #BFD6FF;
color: #3774DF;