Skip to content

Instantly share code, notes, and snippets.

View wrburgess's full-sized avatar
:shipit:
Shippin'

Randy Burgess wrburgess

:shipit:
Shippin'
View GitHub Profile
@wrburgess
wrburgess / clear-sidekiq-jobs.sh
Created January 22, 2020 04:45 — forked from wbotelhos/clear-sidekiq-jobs.sh
Clear Sidekiq Jobs
require 'sidekiq/api'
# 1. Clear retry set
Sidekiq::RetrySet.new.clear
# 2. Clear scheduled jobs
Sidekiq::ScheduledSet.new.clear
import Vue from 'vue'
import Vuex from 'vuex'
import firebase from 'firebase'
import router from '@/router'
Vue.use(Vuex)
export const store = new Vuex.Store({
state: {
appTitle: 'My Awesome App',
import Vue from 'vue'
import Vuex from 'vuex'
import firebase from 'firebase'
import router from '@/router'
Vue.use(Vuex)
export const store = new Vuex.Store({
state: {
appTitle: 'My Awesome App',
@wrburgess
wrburgess / *rail_static_assets_on_heroku_cedar.md
Created December 10, 2016 21:14 — forked from bensheldon/*rail_static_assets_on_heroku_cedar.md
Serving Rails Static Assets on Heroku using a CDN with gzip and cache control

Optimizing Rails Static Assets on Heroku Cedar

Serving Rails static assets is hard, especially on Heroku Cedar where Heroku forces Rails to serve static assets itself (which isn't particularly performant nor worth your dyno-dollar)---this is different than Heroku Bamboo which used Varnish and is no more. To make the best of the situation, I highly recomend:

  1. Using the Heroku-Deflater gem which will selectively gzips assets (it gzips text-based files; and excludes images or binary files, which can actually be bigger when gzipped)

  2. Configure your production environment to set cache-control headers and get out of denial about how static assets are being served on Heroku Cedar

  3. Use AWS Cloudfront (or a CDN of your choosing) to serve the assets. Cloudfront is great because you can use the same Distribution

@wrburgess
wrburgess / heroku_pg_db_reset.md
Last active November 30, 2018 02:52 — forked from zulhfreelancer/heroku_pg_db_reset.md
How to reset PG Database on Heroku?

How to reset PG Database on Heroku?

  • Step 1: heroku restart
  • Step 2: heroku pg:reset DATABASE (no need to change the DATABASE)
  • Step 3: heroku run rake db:migrate
  • Step 4: heroku run rake db:seed (if you have seed)

One liner

heroku restart; heroku pg:reset DATABASE --confirm APP-NAME; heroku run rake db:migrate

@wrburgess
wrburgess / counter.function.js
Created April 14, 2018 22:47 — forked from saintplay/counter.function.js
Add counter for Firestore Collection
// functions/income/counter.function.js
'use strict'
const functions = require('firebase-functions')
const admin = require('firebase-admin')
// Prevent firebase from initializing twice
try { admin.initializeApp(functions.config().firebase) } catch (e) {}
@wrburgess
wrburgess / Rails State Select
Created January 19, 2018 19:36 — forked from christo16/Rails State Select
Create a select list for US states in Rails
<%= select(:address, :state, [
['Select a State', 'None'],
['Alabama', 'AL'],
['Alaska', 'AK'],
['Arizona', 'AZ'],
['Arkansas', 'AR'],
['California', 'CA'],
['Colorado', 'CO'],
['Connecticut', 'CT'],
['Delaware', 'DE'],
@wrburgess
wrburgess / config.rb
Created December 26, 2017 05:43 — forked from bouchard/config.rb
Podcast XML/Builder Template for Middleman
page '/podcast.xml', layout: false
# Methods defined in the helpers block are available in templates
helpers do
def podcast_source_path(article)
"source/audio/#{article.data.file}"
end
end
@wrburgess
wrburgess / request.rb
Created July 28, 2017 19:48 — forked from nesquena/request.rb
Rails Request Logging
Rails.logger.info "REQUEST INSPECTOR"
Rails.logger.info " [REQUEST_URI] #{request.headers['REQUEST_URI'].inspect}"
Rails.logger.info " [RAW_POST]: #{request.raw_post.inspect}"
Rails.logger.info " [PARAMS]: #{request.params.inspect}"
Rails.logger.info " [HTTP_AUTHORIZATION] #{request.headers['HTTP_AUTHORIZATION'].inspect}"
Rails.logger.info " [CONTENT_TYPE]: #{request.headers['CONTENT_TYPE'].inspect}"
Rails.logger.info " [HTTP_ACCEPT] #{request.headers['HTTP_ACCEPT'].inspect}"
Rails.logger.info " [HTTP_HOST] #{request.headers['HTTP_HOST'].inspect}"
Rails.logger.info " [HTTP_USER_AGENT] #{request.headers['HTTP_USER_AGENT'].inspect}"
@wrburgess
wrburgess / sidekiq
Created July 27, 2017 17:58 — forked from neilmarion/sidekiq
sidekiq clear counter
Sidekiq.redis {|c| c.del('stat:processed') }
and to reset failed jobs:
Sidekiq.redis {|c| c.del('stat:failed') }
bundle exec sidekiq -q high,5 default
RAILS_ENV=production bundle exec sidekiq -d -L /home/deployer/apps/collector/shared/sidekiq.log -q high,5 default