Skip to content

Instantly share code, notes, and snippets.

View philip13's full-sized avatar
👷
open2work

Felipe Cuevas philip13

👷
open2work
View GitHub Profile
@philip13
philip13 / rspec_model_testing_template.rb
Created October 27, 2022 03:34 — forked from SabretWoW/rspec_model_testing_template.rb
Rails Rspec model testing skeleton & cheat sheet using rspec-rails, shoulda-matchers, shoulda-callbacks, and factory_girl_rails. Pretty much a brain dump of examples of what you can (should?) test in a model. Pick & choose what you like, and please let me know if there are any errors or new/changed features out there. Reddit comment thread: http…
# This is a skeleton for testing models including examples of validations, callbacks,
# scopes, instance & class methods, associations, and more.
# Pick and choose what you want, as all models don't NEED to be tested at this depth.
#
# I'm always eager to hear new tips & suggestions as I'm still new to testing,
# so if you have any, please share!
#
# @kyletcarlson
#
# This skeleton also assumes you're using the following gems:
@philip13
philip13 / gist:991dd2be3a2a64c730858beb8a0fd6e3
Created May 3, 2021 01:10
Garmin connect, remove column4 and convert main column to 12
const pageContent = document.getElementsByClassName('page-content');
const chidls = pageContent[0].childNodes;
for (let i = 0; i < chidls.length; i++) {
if (chidls[i].className === 'span4') {
let toRemove = chidls[7];
toRemove.parentNode.removeChild(toRemove);
}
if (chidls[i].className === 'span8') {
let element = chidls[i];
@philip13
philip13 / CONDITIONAL_ASSIGNMENT
Created April 17, 2015 18:32
Ruby basic: CONDITIONAL ASSIGNMENT-The operator? ||=
a += b same as a = a + b
a -= b same as a = a - b
a *= b same as a = a * b
a ||= b same as a = a || b