Skip to content

Instantly share code, notes, and snippets.

View greatghoul's full-sized avatar
🏠
Working from home

greatghoul greatghoul

🏠
Working from home
View GitHub Profile
version: '2'
services:
postgres:
image: postgres
environment:
POSTGRES_PASSWORD: temp1234
ports:
- 5432:5432
volumes:
- db_data:/var/lib/postgresql
@greatghoul
greatghoul / jobs.rb
Created August 4, 2017 03:06
RSpec: Execute jobs triggered in specific methods.
# spec/support/jobs.rb
ActiveJob::Base.queue_adapter = :test
module PerformJobsSupport
def perform_jobs_on(klass, *method_names)
klass.class_eval do
include ActiveJob::TestHelper
method_names.each do |method_name|
alias_method "origin_#{method_name}", method_name
@greatghoul
greatghoul / TODAY service
Created June 19, 2017 14:47 — forked from ace-dent/TODAY service
Insert today's date in Mac OS X. Add as a Service via Automator using AppleScript, to create a Shortcut.
on run
# TODAY - Returns today's date!
# Create your own Service, to avoid 3rd Party software (WordService, etc.)
# In Automator:
# > Service receives 'no input' in 'any application'
# > Output replaces selected text
# Add Shortcut (e.g. Ctrl+Cmd+T - it's hard to find a free shortcut!):
# > Preferences > Keyboard > Keyboard Shortcuts > Services
# When setting up Keyboard Shortcut, *exit* the target app before testing. (It seems shortcuts are only refreshed when app is launched)
# Adjust 'Short' Date format
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style>
table { text-align: center; }
.name { display: inline-block; width: 60px; background-color: #ccc; height: 16px;}
</style>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style>
table { text-align: center; }
.name { display: inline-block; width: 60px; background-color: #ccc; height: 16px;}
</style>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style>
table { text-align: center; }
.name { display: inline-block; width: 60px; background-color: #ccc; height: 16px;}
</style>
@greatghoul
greatghoul / basecamp-todo-number.user.js
Created May 12, 2017 03:13
Basecamp Todo Auto Number
// ==UserScript==
// @name Basecamp Todo Auto Number
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Prefix todo's title with an autoincrement number by shortcut Cmd+click
// @author You
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js
// @match https://3.basecamp.com/*
// ==/UserScript==
@greatghoul
greatghoul / content1.js
Last active May 6, 2023 00:32
chrome extension message passing example
chrome.runtime.onMessage.addListener(
function(message, sender, sendResponse) {
console.log(`${message} in content1`)
sendResponse(`${message} from content1`)
// setTimeout(() => {
// sendResponse(`${message} from content1`)
// }, 2000)
//
// return true
}
@greatghoul
greatghoul / pingall.sh
Created November 14, 2016 02:57
Ping multiple hosts and sort result by avg duration
#script to ping multiple websites
#add websites you want to ping to the websites.txt file
#the output will be saved into results.txt
websitesFile=websites.txt
websiteList=$(cat $websitesFile |tr "\n" " ")
websites=($websiteList)
timeOut=1
outputFile=results.txt