Skip to content

Instantly share code, notes, and snippets.

View ChuckJHardy's full-sized avatar

Chuck J Hardy ChuckJHardy

View GitHub Profile
@ChuckJHardy
ChuckJHardy / example_activejob.rb
Last active March 3, 2024 20:10
Example ActiveJob with RSpec Tests
class MyJob < ActiveJob::Base
queue_as :urgent
rescue_from(NoResultsError) do
retry_job wait: 5.minutes, queue: :default
end
def perform(*args)
MyService.call(*args)
end
@ChuckJHardy
ChuckJHardy / digital_ocean_setup.md
Last active October 27, 2023 17:51
DigitalOcean Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3 Setup Instructions

DigitalOcean Ubuntu 14.04 x64 + Rails 4 + Nginx + Unicorn + PostgreSQL + Capistrano 3

SSH into Root

$ ssh root@123.123.123.123

Change Root Password

@ChuckJHardy
ChuckJHardy / app.rake
Created May 29, 2011 12:34
Rake Task for Database Population
------------ From Rake Task
namespace :app do
# Checks and ensures task is not run in production.
task :ensure_development_environment => :environment do
if Rails.env.production?
raise "\nI'm sorry, I can't do that.\n(You're asking me to drop your production database.)"
end
end
@ChuckJHardy
ChuckJHardy / gource.md
Last active August 12, 2022 00:22
Gource Recording for Git

Install Gource

brew install gource

Convert Quicktime Movie to Animated Gif

ffmpeg -i in.mov -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > out.gif

Record Gource

@ChuckJHardy
ChuckJHardy / Readme.md
Last active October 22, 2021 23:03
ZeroMQ + Node.js + Socket.io + UI for sending message from Ruby to a Javascript UI running on Node.js

Install the following requirements:

brew info zeromq
npm install zmq
npm install socket.io
gem install ffi-rzmq

Within the app directory run the following commands in different panes.

ruby worker.rb

@ChuckJHardy
ChuckJHardy / run.js
Created September 28, 2013 16:19
Express Server for ZeroMQ, Socket.io and Angular.js
'use strict';
var express = require('express'),
app = express(),
http = require('http'),
server = http.createServer(app),
path = require('path'),
io = require('socket.io').listen(server),
fs = require('fs'),
zmq = require('zmq'),
@ChuckJHardy
ChuckJHardy / localStorageMock.ts
Created March 22, 2019 22:23
Typescript LocalStorage Mock
const localStorageMock = (() => {
let store: IDict = {};
return {
getItem(key: any) {
return store[key] || null;
},
setItem(key: any, value: any) {
store[key] = value.toString();
},
### Keybase proof
I hereby claim:
* I am chuckjhardy on github.
* I am chuckjhardy (https://keybase.io/chuckjhardy) on keybase.
* I have a public key ASDN6G-JWLU8Pn-F7HdCOeMj2z0URHrG3PbkQYifsUV5wAo
To claim this, I am signing this object:
@ChuckJHardy
ChuckJHardy / gist:d4a96885ea6f141ba34658a9ca145522
Created November 11, 2017 18:14
Verifying my Blockstack ID is secured with the address 1L2WKTJbQV4da4RwRmaSRAx114K8M6Uzg5 https://explorer.blockstack.org/address/1L2WKTJbQV4da4RwRmaSRAx114K8M6Uzg5
Verifying my Blockstack ID is secured with the address 1L2WKTJbQV4da4RwRmaSRAx114K8M6Uzg5 https://explorer.blockstack.org/address/1L2WKTJbQV4da4RwRmaSRAx114K8M6Uzg5
# Queue / Workers
gem "sidekiq"
gem "sidekiq-statistic"
gem "sidekiq-failures"
gem "clockwork", git: "https://github.com/Rykian/clockwork.git"