This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Script to be run on new project setup. Run with `bin/setup`. Does the following: | |
# | |
# * Installs ENV and key files from 1Password (does not overwrite existing) | |
# * Runs bundle install, yarn install | |
# * Sets project environment to 'staging' | |
downloadFile() { | |
if [ -e $1 ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// wrapper around axios for ajax functionality | |
// sets globals when fetching content to help with Rspec wait_for_ajax | |
// adapted from: https://gist.github.com/sheharyarn/7f43ef98c5363a34652e60259370d2cb | |
import axios from 'axios' | |
export const request = (options) => { | |
const onSuccess = (response) => { | |
popAjax() | |
window.current_ajax_request = null // for rspec wait_for_ajax |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.pokemons { | |
display: grid; | |
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); | |
grid-column-gap: 1em; | |
grid-row-gap: 1em; | |
max-width: 700px; | |
margin: 0 auto; | |
} | |
.poke { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def attach_file(url) | |
with_downloaded_file(url) do |file| | |
my_model.attach(io: file, filename: "filename.jpg") | |
end | |
end | |
# this example requires the 'httparty' gem | |
def with_downloaded_file(url) | |
file = Tempfile.new | |
file.binmode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 2 | |
jobs: | |
build: | |
docker: | |
- image: circleci/node:10.11.0 | |
steps: | |
- checkout | |
- restore_cache: | |
key: dependency-cache-{{ checksum "yarn.lock" }} | |
- run: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { times, upperFirst } from 'lodash'; | |
type GeneratorFnOptions = { | |
sequence: number; | |
}; | |
type GeneratorFn<T> = (opts: GeneratorFnOptions) => T; | |
type GeneratorsMap = { | |
[key: string]: GeneratorFn<any>; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# spec/rails_helper.rb | |
require_relative 'support/webpack_test_helper.rb' | |
# ... | |
config.before(:suite) do | |
# Compile webpack if necessary. | |
# Only runs if checksum of JS files has changed | |
WebpackTestHelper.compile_webpack_assets | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// requires following dependencies: yarn add s3 dotenv | |
var s3 = require('s3'); | |
require('dotenv').config() | |
var client = s3.createClient({ | |
s3Options: { | |
accessKeyId: process.env.AWS_ACCESS_KEY_ID, | |
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY, | |
}, | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BillingPeriod | |
attr_reader :start, :end | |
def initialize(start_dt, end_dt) | |
@start = start | |
@end = end_dt | |
end | |
# the bill day can always be determined from any given period | |
# eg: if bill day is 1-28, the start and end will both always be on 28 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create an app in the Google API console and paste ID and secret here | |
GOOGLE_CLIENT_ID=xxxxx | |
GOOGLE_CLIENT_SECRET=xxxxx |
NewerOlder