$ heroku run console --app MY_APP --no-tty < import_remote_csv.rb
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
# frozen_string_literal: true | |
require 'bundler/inline' | |
gemfile do | |
source 'https://rubygems.org' | |
gem 'json', require: true | |
end | |
class Hash |
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
require 'sidekiq/api' | |
# 1. Clear retry set | |
Sidekiq::RetrySet.new.clear | |
# 2. Clear scheduled jobs | |
Sidekiq::ScheduledSet.new.clear |
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 RecursiveQuery { | |
static async findByPk(props) { | |
const { pk, evaluatedKey = null, data = [], keys = null } = props; | |
const queryProps = { | |
IndexName: "GSI_INDEX_NAME", | |
KeyConditionExpression: "pk = :pk", | |
ExpressionAttributeValues: { ":pk": pk }, | |
ExclusiveStartKey: evaluatedKey, | |
}; |
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
[alias] | |
psh = push origin HEAD | |
cm = checkout master | |
co = checkout | |
cb = checkout -b | |
amend = commit -a --amend | |
ahead = "!sh -c 'echo branch is $(git fetch origin --quiet && git rev-list --count origin/master..HEAD) commits ahead, $(git fetch origin --quiet && git rev-list --count HEAD..origin/master) commits behind master'" | |
ci = commit | |
st = status -sb |
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
# 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: |
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
export default function Csv() {} | |
Csv.parse = function(data) {} | |
Csv.compose = function(data) { | |
let values = [] | |
let header = Object.keys(data[0]) | |
let csv = header.join(',') | |
// each object values |
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
on run {input, parameters} | |
set paths to "" | |
repeat with i from 1 to length of input | |
set cur to item i of input | |
set paths to paths & " " & quote & POSIX path of cur & quote | |
end repeat | |
set cmd to "vim -p" & paths | |
tell application "iTerm" | |
set created to false | |
if not (exists current window) then |
NewerOlder