Skip to content

Instantly share code, notes, and snippets.

View notapatch's full-sized avatar

Julian Richard Wigley notapatch

View GitHub Profile
@notapatch
notapatch / script.md
Created January 31, 2022 11:21
Rails code generation flags I use

Scaffold

rails g scaffold Post title description
--no-test-framework --no-helper --no-assets --no-controller-specs --no-view-specs  --no-jbuilder

Controller

rails g controller home
@notapatch
notapatch / gist:8565634c81e2535d9ab3dbe3d9a7e256
Created November 12, 2019 17:02
rake db:setup_planner output
```
[WARN] table 'Permission' doesn't exist. Did you run the migration? Ignoring rolify config.
I, [2019-11-12T16:37:25.498358 #74224] INFO -- : Migrating to CreateMembers (20131017221407)
== 20131017221407 CreateMembers: migrating ====================================
-- create_table(:members)
W, [2019-11-12T16:37:25.501252 #74224] WARN -- : DEPRECATION WARNING: `#timestamps` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /Users/richard/Documents/code/projects/planner/db/migrate/20131017221407_create_members.rb:10)
-> 0.0067s
== 20131017221407 CreateMembers: migrated (0.0073s) ===========================
@notapatch
notapatch / troubleshoot.txt
Last active April 13, 2019 16:22
bcs.io server up
Is link up up?
sudo ethtool [interface] | grep 'Link detected'
- expect to see yes
Is interface up?
sudo ifconfig [interface] | grep 'inet addr'
Is DNS working?
nslookup [server name]
@notapatch
notapatch / test_helper.rb
Last active October 15, 2016 11:13
Minitest - running tests for rack and javascript.
Minitest/Database_cleaner/ Minitest::Around
require 'minitest/around'
require 'database_cleaner'
DatabaseCleaner.strategy = :deletion <===? should it always be deletion?
class Capybara::Rails::TestCase
around do |test|
if metadata[:js]
@notapatch
notapatch / 0_reuse_code.js
Created October 15, 2016 11: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
@notapatch
notapatch / favicon html
Created January 29, 2013 15:05
Favicon are a pain - here is a good attempt at rationalising them. http://www.jonathantneal.com/blog/understand-the-favicon/
<link rel="apple-touch-icon" href="path/to/touchicon.png">
<link rel="icon" href="path/to/favicon.png">
<!--[if IE]><link rel="shortcut icon" href="path/to/favicon.ico"><![endif]-->
<!-- or, set /favicon.ico for IE10 win -->
<meta name="msapplication-TileColor" content="#D83434">
<meta name="msapplication-TileImage" content="path/to/tileicon.png">
<a href="tel:+441213232122">KBHair: 0121-323-2122</a>
@notapatch
notapatch / CSS
Last active December 11, 2015 21:29
Text in the middle of an underline
h2 { width:100%; text-align:center; border-bottom: 1px solid #000; line-height:0.1em; margin:10px 0 20px; }
h2 span { background:#fff; padding:0 10px; }
@notapatch
notapatch / rails_adding_datetime_toURL.erb
Last active October 15, 2016 11:33
Passing a DateTime Parameter into a controller action
Adding datetime parameter to a URL
<%= link_to 'This Week', appointments_path(begin: DateTime.now.beginning_of_week) %>
Testing for the parameter
- if params.has_key?(:begin)
Parsing the parameter
- Time.parse(params[:begin])
@notapatch
notapatch / configsensitive_information.yml
Created October 10, 2012 22:17
Loading application specific environmental variables
GMAIL_USERNAME: [email protected]
GMAIL_PASSWORD: my_secret_password