I have a Rails app with two models that are associated:
class Person < ApplicationRecord
has_many :pets
has_many :toys
end
Cheat sheet extracted from https://www.youtube.com/watch?v=2zmUSoVMyRU by That JS Dude.
If you pass any of the CSS selectors to $(<identifier>)
you get the first element.
> $('a')
source "https://rubygems.org" | |
git_source(:github) { |repo| "https://github.com/#{repo}.git" } | |
ruby "2.7.6" | |
# Authorization framework for Ruby/Rails application | |
# [https://github.com/palkan/action_policy] | |
gem "action_policy", "~> 0.6.4" | |
# Action Policy integration for GraphQL-Ruby |
# Shared collection of (mostly Arel) class-level helpers for working with advanced | |
# SQL selections. | |
# | |
# Source: https://github.com/ManifoldScholar/manifold/blob/84625d40af628646453668be028dabc2aa249516/api/app/models/concerns/arel_helpers.rb#L313 | |
# | |
# Required rubygem: 'dux' | |
# | |
# rubocop:disable Style/CharacterLiteral | |
# rubocop:disable Style/StringLiterals | |
# @see https://www.postgresql.org/docs/9.5/static/functions-json.html JSON functions and operators in PostgreSQL |
const url = document.URL; | |
class ReviewToggle { | |
insertButton() { | |
const parentElement = document.querySelector(".pr-review-tools"); | |
let button = document.querySelector('#boost-toggle-checkboxes'); | |
if (!button) { | |
button = document.createElement("button"); | |
button.id = "boost-toggle-checkboxes"; | |
} |
US_STATES = { | |
'AK' => { name: 'Alaska', location_id: 21132 }, | |
'AL' => { name: 'Alabama', location_id: 21133 }, | |
'AR' => { name: 'Arkansas', location_id: 21135 }, | |
'AS' => { name: 'American Samoa', location_id: 2016 }, | |
'AZ' => { name: 'Arizona', location_id: 21136 }, | |
'CA' => { name: 'California', location_id: 21137 }, | |
'CO' => { name: 'Colorado', location_id: 21138 }, | |
'CT' => { name: 'Connecticut', location_id: 21139 }, | |
'DC' => { name: 'District of Columbia', location_id: 21140 }, |
// Copyright (c) 2006 Damien Miller <djm@mindrot.org> | |
// | |
// Permission to use, copy, modify, and distribute this software for any | |
// purpose with or without fee is hereby granted, provided that the above | |
// copyright notice and this permission notice appear in all copies. | |
// | |
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
// ====== [UTILS] ====== | |
//function for generating "random" id of objects in DB | |
function S4() { | |
return (((1+Math.random())*0x10000)|0).toString(16).substring(1); | |
} | |
function guid() { | |
return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4()); | |
} |
name: CI | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
env: | |
RAILS_ENV: test |
### Keybase proof | |
I hereby claim: | |
* I am coderberry on github. | |
* I am coderberry (https://keybase.io/coderberry) on keybase. | |
* I have a public key ASDxOxY4XXIxGp-zouupDGuL3A-bGhziJZ3e6STSnBQaVwo | |
To claim this, I am signing this object: |