Skip to content

Instantly share code, notes, and snippets.

View gecugamo's full-sized avatar

Gary Cuga-Moylan gecugamo

View GitHub Profile
bin/tapioca dsl
Loading Rails application... Tapioca attempted to load the Rails application after encountering a `config/application.rb` file, but it failed. If your application uses Rails please ensure it can be loaded correctly before generating RBIs.
uninitialized constant Rails::Command::Base
Did you mean? Base64
Continuing RBI generation without loading the Rails application.
Done
2023-09-05T17:36:08.682Z pid=23999 tid=qsf INFO: Sidekiq 7.0.7 connecting to Redis with options {:size=>5, :pool_name=>"internal", :url=>"redis://localhost:6380/0"}
Traceback (most recent call last):
89: from bin/tapioca:29:in `<main>'
88: from bin/tapioca:29:in `load'
@gecugamo
gecugamo / angular-local-ssl.md
Created June 15, 2023 17:13
Running Angular Application Locally with SSL

Install mkcert

  • Run brew update
  • Run brew install mkcert
  • Run mkcert -install

Create a cert for localhost

  • Run mkcert localhost

Run ng serve with ssl

  • Run npm run start -- --ssl --ssl-cert ./localhost.pem --ssl-key ./localhost-key.pem or ng serve --ssl --ssl-cert ./localhost.pem --ssl-key ./localhost-key.pem
@gecugamo
gecugamo / babel.config.js
Created January 9, 2023 18:54
Ex Babel Config
module.exports = function(api) {
var validEnv = ['development', 'test', 'production']
var currentEnv = api.env()
var isDevelopmentEnv = api.env('development')
var isProductionEnv = api.env('production')
var isTestEnv = api.env('test')
if (!validEnv.includes(currentEnv)) {
throw new Error(
'Please specify a valid `NODE_ENV` or ' +
@gecugamo
gecugamo / kin-address-autocomplete.dist.js
Created November 7, 2022 23:20
kin-address-autocomplete.dist.js
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
debugger;
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var KinAddressAutocomplete_1;
import { html, LitElement } from 'lit';
import { customElement, property, query, queryAll, state } from 'lit/decorators.js';
@gecugamo
gecugamo / input.scss
Created September 26, 2022 15:14
Generated by SassMeister.com.
$sizes: 'xs', 'sm', 'md', 'lg';
@each $size in $sizes {
@for $i from 1 through 12 {
$width: 100% / 12 * $i;
.col-#{$size}-#{$i} {
max-width: $width;
flex-basis: $width;
}

TypeScript + JSDoc

​ With TypeScript, a lot of information can be gleaned from TypeScript itself, either through explicit types or inferred types. So when we use TypeScript along with JSDoc, we could end up duplicating our documentation in some cases. When using JSDoc, we advise you to leave the documentation of types to TypeScript, but still utilize JSDoc to add descriptions. ​

Examples

When using JavaScript, we would use JSDoc to document the type, name (for @param), and description for @param and @returns. ​

/**
 * Divides one number by the other
@gecugamo
gecugamo / click-lead-dev-notes.md
Last active September 30, 2021 20:01
Click Lead Landing Page Dev Notes

Links

Current Implementation

  • User browsing on third-party site
  • Click link that plops them on welcome.kin.com/landing and contains query params provider, lead_id, click_id
  • If click_lead doesn't exist in db, 500 error
  • If we have address data and it's from the proper location, send to /quote/about-you
  • If we don't have enough info, send to /start
@gecugamo
gecugamo / react-vs-angular-at-kin.md
Last active July 14, 2021 17:24
React vs Angular at Kin

React vs Angular at Kin

Disclaimer: Some of this is anecdotal or opionion based - take with a grain of salt.

Category Notes Edge
Documentation Documentation looks to be very good for both, but because Angular comes with more out of the box, more concepts are covered in official Angular docs. Angular
Resources (tutorials, training courses, stackoverflow) Both frameworks are popular and have been around for a long time. Tie
SSR and SSG Next.js (React SSR framework - which plays very nicely with TinaCMS) and Gatsby.js (React SSG framework) are by far more popular than Angular Universal (Angular SSR framework) and Scully.js (Angular SSG framework) React
Learnability and Grokability Angular is infamous for being overly complex, while React is reknown for being simple and straightforward React
Release Cadence Angular strives for a major releases every 6 months. React has no set cadence - they try to minimize number of major releases. React
@gecugamo
gecugamo / unique.js
Last active February 13, 2020 15:42
JS Unique with Recursion (es6)
// unique.js
const unique = (array, newArray = [], index = 0) => {
if (index === array.length) return newArray;
if (!newArray.includes(array[index])) newArray.push(array[index]);
index += 1;
return unique(array, newArray, index);
}
export default unique;
@gecugamo
gecugamo / unique.js
Last active February 13, 2020 15:31
JS Unique with Recursion (es5)
function unique(array, newArray, index) {
if (index === array.length) return newArray;
if (newArray.indexOf(array[index]) === -1) newArray.push(array[index]);
index += 1;
return unique(array, newArray, index);
}
// unique([1, 2, 2, 3, 4, 5, 5], [], 0);
// [1, 2, 3, 4, 5]