I hereby claim:
- I am timmehs on github.
- I am timmehs (https://keybase.io/timmehs) on keybase.
- I have a public key ASCx_zvT31T57WPJENDyE5R_qEyiGyfV-Nz30UOIFKoz5Qo
To claim this, I am signing this object:
| include HTTParty | |
| # The kicker here was I needed to turn the 'body' of the request into a JSON string, | |
| # I had assumed HTTParty would JSONify any PORO passed in. WRONG! | |
| opts = { | |
| headers: { | |
| 'Authorization' => "key=#{ENV['FIREBASE_API_KEY'}", | |
| 'Content-Type' => 'application/json' | |
| }, | |
| body: { |
I hereby claim:
To claim this, I am signing this object:
| // combineReducers.js | |
| function combineReducers(reducers) { | |
| return function(state, action) { | |
| return Object.entries(reducers).reduce((state, [subtree, reducer]) => { | |
| return state.update(subtree, reducer(action)) | |
| }, state) | |
| } | |
| } | |
| // reducers.js |
| /** | |
| * Given many arrays of ObjectIDs, return a unique list | |
| * | |
| * @params objectIDs {Array<ObjectID>} | |
| * @returns | |
| */ | |
| module.exports = function dedupeIDs(objectIDs) { | |
| const ids = {} | |
| objectIDs.forEach(_id => (ids[_id.toString()] = _id)) | |
| return Object.values(ids) |
| # Automatically run tests on file changes. Resolves rails app/ and lib/ files with their corresponding specs, | |
| # following normal rspec directory conventions. | |
| # To use: | |
| # - download this file somewhere (like <app root>/bin/) | |
| # - gem install filewatcher | |
| # - run `bin/guard_lite` | |
| #!/usr/bin/env ruby | |
| require 'filewatcher' |
ngrok http 3000ngrok-host script above to bin/ directory (drop the .rb, its just there for gist syntax highlighting.chmod +x bin/ngrok-hostbin/ngrok-hostThe script queries the local ngrok instance for available tunnels, grabs the https host name, and starts rails with that hostname configured for url helpers and the like.
Everything I found for optimizing pg text search performance via pg tsvector column suggested adding a postgres trigger, as described here
https://thoughtbot.com/blog/optimizing-full-text-search-with-postgres-tsvector-columns-and-triggers
class AddTsvectorColumns < ActiveRecord::Migration
def up
add_column :products, :tsv, :tsvector
add_index :products, :tsv, using: "gin"