Skip to content

Instantly share code, notes, and snippets.

View libbyschuknight's full-sized avatar
🏡
Working remotely

Libby Schumacher-Knight libbyschuknight

🏡
Working remotely
View GitHub Profile

let!() & before block

Asked this in Ruby NZ Slack channel

Hey people! Hope the week is going well. I have a quesiton about RSpec (@jonrowe). I've been discussing with colleagues the use of let vs let! . I lean towards trying not to use let! and instead using let's if needed and then evaluating it in a before block. I feel I have ended up having this preference because of some pain with tests in the past where strange things seemed to be happening and we realised it was due to the use of a let! (I can't remember anything specific about this though) and also these tweets around that time were brought to my attention - https://twitter.com/penelope_zone/status/767850685329203200

RSpec advice: don't use let! use let and evaluate it in a before.

@libbyschuknight
libbyschuknight / tabs.py
Created June 25, 2020 08:26
simple script for opening a new tab and running a command
#!/usr/bin/env python3.7
import iterm2
# This script was created with the "basic" environment which does not support adding dependencies
# with pip.
async def main(connection):
# Your code goes here. Here's a bit of example code that adds a tab to the current window:
app = await iterm2.async_get_app(connection)
window = app.current_terminal_window
@libbyschuknight
libbyschuknight / npm-install-3-delete-node-mod-and-lock.bash
Last active April 22, 2019 07:30
react for beginners first npm install / npm start errors
npm i
npm WARN deprecated [email protected]: Way too old
npm WARN deprecated [email protected]: core-js@<2.6.5 is no longer maintained. Please, upgrade to core-js@3 or at least to actual version of core-js@2.
npm WARN deprecated [email protected]: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated [email protected]: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated [email protected]: CircularJSON is in maintenance only, flatted is its successor.
npm WARN deprecated [email protected]: Please upgrade to kleur@3 or migrate to 'ansi-colors' if you prefer the old syntax. Visit <https://github.com/lukeed/kleur/releases/tag/v3.0.0\> for migration path(s).
npm WARN deprecated [email protected]: This version has been deprec
<!--this -->
.compoistion>(img.composition__photo.composition__photo--p1)*3
<!-- will make this -->
<div class="compoistion">
<img src="" alt="" class="composition__photo composition__photo--p1">
<img src="" alt="" class="composition__photo composition__photo--p1">
@libbyschuknight
libbyschuknight / attribute.css
Created March 21, 2019 04:44
CSS attribute value
/* from https://css-tricks.com/almanac/selectors/a/attribute/ */
[data-value] {
/* Attribute exists */
}
[data-value="foo"] {
/* Attribute has this exact value */
}
sudo npm install node-sass --save-dev
> [email protected] install /Users/SchuKnight/code/learning/udemy/advanced-sass-css/natours-site/node_modules/node-sass
> node scripts/install.js
Unable to save binary /Users/SchuKnight/code/learning/udemy/advanced-sass-css/natours-site/node_modules/node-sass/vendor/darwin-x64-67 : { Error: EACCES: permission denied, mkdir '/Users/SchuKnight/code/learning/udemy/advanced-sass-css/natours-site/node_modules/node-sass/vendor'
at Object.mkdirSync (fs.js:773:3)
at sync (/Users/SchuKnight/code/learning/udemy/advanced-sass-css/natours-site/node_modules/mkdirp/index.js:71:13)
at Function.sync (/Users/SchuKnight/code/learning/udemy/advanced-sass-css/natours-site/node_modules/mkdirp/index.js:77:24)
at checkAndDownloadBinary (/Users/SchuKnight/code/learning/udemy/advanced-sass-css/natours-site/node_modules/node-sass/scripts/install.js:114:11)
describe Person do
describe ".in_region" do
it "returns people in the named region" do
region = create(:region, name: "expected")
other_region = create(:region, name: "other")
in_region = create(:location, region: region)
in_other_region = create(:location, region: other_region)
create(:person, location: in_region, name: "in-expected-region-one")
create(:person, location: in_region, name: "in-expected-region-two")
create(:person, location: in_other_region, name: "in-other-region")
describe Location do
describe ".in_region" do
it "returns locations in the named region" do
region = create(:region, name: "expected")
other_region = create(:region, name: "other")
create(:location, region: region, name: "in-expected-region-one")
create(:location, region: region, name: "in-expected-region-two")
create(:location, region: other_region, name: "in-other-region")
@libbyschuknight
libbyschuknight / service_object_spec.rb
Created January 12, 2018 01:34
testing initialize or not
RSpec.describe CreateInvoice, type: :service do
describe "#initialize" do
context "when CreateInvoice is instantiated " do
fixtures :users
let(:user) { users(:customer_with_read) }
let(:valid_params) do
{
"invoice_date(3i)" => "13",