Skip to content

Instantly share code, notes, and snippets.


Jamie Lawrence ideasasylum

View GitHub Profile
ideasasylum / copy_markdown_from_trello.js
Created Aug 10, 2015
Copies a Trello board to the Clipboard as Markdown
View copy_markdown_from_trello.js
// originally found in a comment on:
var s = [];
s.push("# " + jQuery(".board-header").children()[0].innerText);
jQuery(".list:has(.list-header-name)").each(function() {
s.push("\n## " + jQuery(this).find(".list-header-name")[0].innerText + "\n");
jQuery(this).find(".list-card-title").each(function() {
s.push("* " + this.innerText);
ideasasylum / translate_amazon.js
Last active Jul 30, 2020
Translate Amazon service names into plain English (see
View translate_amazon.js
// ==UserScript==
// @name Translate Amazon
// @namespace http://your.homepage/
// @version 0.1
// @description Translate the Amazon service names into plain English. See
// @author @ideasasylum
// @match https://**
// @grant none
// ==/UserScript==
ideasasylum / wercker.yml
Created Jan 15, 2016
wercker.yml file for a Hugo site with s3 deployment
View wercker.yml
box: debian
- arjen/hugo-build:
version: "0.15"
theme: "rw-theme"
View navbar.html
<div class="top-bar">
<div class="top-bar-left">
<ul class="menu align-right">
<li class='menu-text'><a href="{{ .Site.BaseURL }}">{{ .Site.Title }}</a></li>
<div class="top-bar-right">
<ul class="menu">
{{ $currentNode := . }}
ideasasylum / translate_aws.js
Created May 6, 2016
A Chrome UserScript to replace AWS names with sensible stuff
View translate_aws.js
// ==UserScript==
// @name Translate Amazon
// @namespace
// @version 0.1
// @description Translate the Amazon service names into plain English. See
// @author @ideasasylum
// @match https://**
// @grant none
// ==/UserScript==
ideasasylum / previously_dirty.rb
Created May 10, 2016
Dirty state tracking for previous changes
View previously_dirty.rb
module PreviouslyDirty
extend ActiveSupport::Concern
include ActiveModel::AttributeMethods
included do
attribute_method_suffix '_previously_changed?', '_previously_was'
# Handle <tt>*_previously_changed?</tt> for +method_missing+.
def attribute_previously_changed?(attr, options = {}) #:nodoc:

Keybase proof

I hereby claim:

  • I am ideasasylum on github.
  • I am ideasasylum ( on keybase.
  • I have a public key whose fingerprint is ED31 FE9E E32F 0D88 27FB CB25 A4DF 38FA A95D 637D

To claim this, I am signing this object:

ideasasylum / upgrade.rake
Created Mar 21, 2018
Stupid rake task to randomly pick one outdated gem
View upgrade.rake
require 'open3'
require 'rainbow'
desc "Upgrade gems"
namespace :upgrade do
desc "Find a random gem to update"
task :bingo => :environment do
cmd = 'bundle outdated'
stdout, stderr, status = Open3.capture3(cmd)
ideasasylum / active_record_dependancy_graph.rb
Last active Feb 27, 2021
Check if an ActiveRecord model can be destroyed, and in what order the association should be deleted
View active_record_dependancy_graph.rb
class ActiveRecordDependancyGraph
include TSort
attr_reader :graph
def initialize root_model
@graph = {}
@model = root_model
fetch_children @model
ideasasylum / character_frequency.rb
Created Jan 17, 2022
Counts the frequency of characters in an AR collection
View character_frequency.rb
class CharacterFrequency
include Enumerable
# Take an AR collection and a block to extract the attribute value
def initialize collection, &block
@collection = collection
@block = block
def print