Skip to content

Instantly share code, notes, and snippets.

View nertzy's full-sized avatar
🏠

Grant Hutchins nertzy

🏠
View GitHub Profile
javascript:(function()%7Bwindow.location.href%3D'https%3A%2F%2F12ft.io%2F'%2Bwindow.location.href%3B%7D)()
// Core assets
let coreAssets = [];
// On install, cache core assets
self.addEventListener('install', function (event) {
// Cache core assets
event.waitUntil(caches.open('app').then(function (cache) {
for (let asset of coreAssets) {
cache.add(new Request(asset));
@merlinmann
merlinmann / wisdom.md
Last active April 28, 2025 20:57
Merlin's Wisdom Project (Draft)

Merlin's Wisdom Project

Or: “Everybody likes being given a glass of water.”

By Merlin Mann.

It's only advice for you because it had to be advice for me.

@avdi
avdi / draw.sh
Last active July 5, 2021 19:02
Pick a random file using Bash (on a mac)
#!/bin/bash
if [[ $# -lt 1 ]]; then
echo "Usage: $0 somedir/*.jpg"
exit 1
fi
files=($*)
let "i = $RANDOM % ${#files[*]}"
pick=${files[$i]}
echo "Draw: $pick"
open $pick
@stecman
stecman / AutoCrop.lua
Last active January 4, 2025 17:48
Lightroom plugin to calculate image crops using OpenCV
-- LR imports
local LrApplication = import("LrApplication")
local LrApplicationView = import("LrApplicationView")
local LrBinding = import("LrBinding")
local LrDevelopController = import("LrDevelopController")
local LrDialogs = import("LrDialogs")
local LrExportSession = import("LrExportSession")
local LrFileUtils = import("LrFileUtils")
local LrFunctionContext = import("LrFunctionContext")
local LrLogger = import("LrLogger")
@charly
charly / document.rb
Last active January 16, 2018 17:44
How to join associated models of a PgSearch Document to apply dynamic filter
class PgSearch::Document
belongs_to :article, -> {where("searchable_type = 'Article'")},
foreign_key: 'searchable_id'
belongs_to :info, -> {where("searchable_type = 'Info'")},
foreign_key: 'searchable_id'
end
@searched = PgSearch.multisearch(@query).
with_pg_search_highlight.
@Jason-Rev
Jason-Rev / url-parse.d.ts
Created June 6, 2016 15:00
Typings for npm url-parse
declare module 'url-parse' {
interface Query {
[index: string]: string;
}
interface QueryParser {
(query: string): any;
}
interface ParsedUrl {
@gonzedge
gonzedge / README.md
Last active September 30, 2015 14:29
Put your git author in your git-svn commit messages (works great with `git pair`!)

This script will set up a hook to insert your git author information into the body of Subversion commit messages.

To set it up, cd into your favorite git-svn repository and run the following command:

bash < <( curl -s -L https://gist.githubusercontent.com/gonzedge/8447840ed0e5710eb228/raw/set-up-git-svn-hooks.sh )

Enjoy!

@michaelabon
michaelabon / Instructions.md
Last active August 29, 2015 14:23
Projections for React and Rails (for Vim and others)
  1. Add this as config/projections.json in your Rails app.
  2. Upgrade to the latest copy of pivotalcommon/vim-config by running:
~/.vim/bin/update

<3 <3 Grant for this.

I long for the day of JSON comments.

@nertzy
nertzy / callgrind_profiler.rb
Last active August 29, 2015 14:20
CallgrindProfiler
require 'jruby/profiler'
require 'jruby/profiler/callgrind_printer'
module CallgrindProfiler
def callgrind
unless JRuby.runtime.instance_config.is_profiling?
STDERR.puts 'Profiling not enabled, re-run with `ruby --profile.api`'
return
end