Skip to content

Instantly share code, notes, and snippets.

View PelagicDev's full-sized avatar

Jordan Godwin PelagicDev

  • CompanyCam
  • Wilmington, NC
  • 15:21 (UTC -04:00)
  • X @PelagicDev
View GitHub Profile
import React, { useState, useEffect, useCallback } from 'react'
export const IDLE = 'IDLE'
export const LOADING = 'LOADING'
export const SUCCESS = 'SUCCESS'
export const ERROR = 'ERROR'
export function useAsyncData(fetchFn, deps) {
const stableFetchFn = useCallback(fetchFn, deps)
const [{ state, data, error }, setState] = useState({ state: IDLE })
@PelagicDev
PelagicDev / heroku-db-reset.md
Last active March 3, 2017 19:32
Reset Wildfire-staging App (Heroku)

RESET & RE-SEED HEROKU DATABASE (wildfire-staging):

  1. From the terminal, run: heroku pg:reset -a wildfire-staging & confirm the app name wildfire-staging
  2. From Postico’s SQL editor, run: CREATE EXTENSION postgis;
  3. Back to terminal, run: heroku run rails db:setup_heroku -a wildfire-staging
  4. The terminal should output “Heroku App Ready!” when it’s finished.

Keybase proof

I hereby claim:

  • I am PelagicDev on github.
  • I am jgodwin (https://keybase.io/jgodwin) on keybase.
  • I have a public key whose fingerprint is 4C81 6BBB 5B4E 1BEC 3B8C 5067 29B3 F2D7 D116 0571

To claim this, I am signing this object:

@PelagicDev
PelagicDev / .gitlab-ci.yml
Created January 17, 2017 15:21 — forked from benphelps/.gitlab-ci.yml
A test / deploy setup I use
image: benphelps/docker-ruby-phantomjs:latest
Testing:
services:
- postgres:latest
variables:
POSTGRES_DB: test
POSTGRES_HOST: postgres
POSTGRES_USER: testuser
POSTGRES_PASS: testuser
environment: test
@PelagicDev
PelagicDev / .env
Created January 17, 2017 14:51 — forked from benphelps/.env
Cloud66 Basic Postgres
POSTGRES_USER=phelps
POSTGRES_PASS=phelps
POSTGRES_HOST=localhost
@PelagicDev
PelagicDev / interchange_helper.rb
Created December 29, 2016 21:20 — forked from flexbox/interchange_helper.rb
[ruby on rails] - Image helper for retina display with foundation interchange
module ApplicationHelper
def retina_image_tag(default_name, options={})
retina_name = default_name.gsub(%r{\.\w+$}, '@2x\0')
retina_image_tag(default_name, options.merge('data-interchange' => "[#{asset_path(retina_name)}, (retina)]"))
end
end
@PelagicDev
PelagicDev / controller.rb
Created December 12, 2016 20:36
Rails Form & Service Objects using PSQL `:daterange`
class TournamentsController < ApplicationController
# GET /tournaments/new
def new
@form = TournamentSubmissionForm.new
end
# POST /tournaments
def create
@form = TournamentSubmissionForm.from_params(params)
@PelagicDev
PelagicDev / puma.service
Created November 19, 2016 03:22 — forked from arteezy/puma.service
Manage Puma with systemd on Ubuntu 16.04 and rbenv
[Unit]
Description=Puma Rails Server
After=network.target
[Service]
Type=simple
User=deploy
WorkingDirectory=/home/deploy/app/current
ExecStart=/home/deploy/.rbenv/bin/rbenv exec bundle exec puma -C /home/deploy/app/shared/config/puma.rb
ExecStop=/home/deploy/.rbenv/bin/rbenv exec bundle exec pumactl -S /home/deploy/app/shared/tmp/pids/puma.state stop
@PelagicDev
PelagicDev / puma_systemd_setup.md
Last active February 25, 2023 20:53
Ubuntu Rails & Puma Server setup
@PelagicDev
PelagicDev / ubunut_16_04_server_setup.md
Last active June 25, 2017 03:01 — forked from jtadeulopes/server.md
Server setup with ubuntu, nginx and puma for rails app.

Update and upgrade the system

sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade && sudo apt-get autoremove
sudo reboot

Configure timezone