Skip to content

Instantly share code, notes, and snippets.

View mainej's full-sized avatar

Jacob Maine mainej

  • Scarlet
  • Seattle, WA, USA
View GitHub Profile
# by bryan helmkamp with slight modification by chris wanstrath
# from http://www.brynary.com/2008/8/3/our-git-deployment-workflow
# I DO NOT RECOMMEND USING THIS WORKFLOW - IT DESTROYS HISTORY! - jesse andrews
module GitCommands
extend self
def diff_staging
`git fetch`
class SignUpPage
def initialize
current_path.should == sign_up_path
end
def with_email(email)
fill_in "Login", :with => email
end
def with_password(password, confirmation = password)
@mainej
mainej / post_repository.rb
Created April 23, 2012 05:21
anemic controllers, thin models, fat domain
class PostRepository
def self.update(id, post_updates, editor)
post = find(id)
raise SecurityTransgression unless can_edit?(post, editor)
post.update_attributes!(post_updates)
post
end
def self.find(id)
Post.find(id)
@mainej
mainej / update_reports.sh
Created December 30, 2014 06:59
Re-generate license_finder reports in rake task or pre-commit hook
#!/bin/bash
HTML_REPORT=doc/dependencies.html
STATUS_REPORT=doc/dependencies.csv
checksum_before=$(md5 -q < $STATUS_REPORT)
checksum_after=$(license_finder report --format csv --columns approved name version licenses | tee $STATUS_REPORT | md5 -q)
# # Alternatively
# CHECKSUM_FILE=doc/dependencies_status.md5
@mainej
mainej / license_report.rb
Last active October 7, 2020 16:35
Custom ERB `license_finder` report
#!/usr/bin/env ruby
require 'license_finder'
# See lib/license_finder/core.rb for more configuration options.
# A quiet logger is required when running reports...
lf = LicenseFinder::Core.new(logger: { quiet: true })
# Example ERB template: lib/license_finder/reports/templates/html_report.erb
template = Pathname.new("path/to/your/template.erb")
@mainej
mainej / extract_license_data.rb
Last active October 7, 2020 16:35
How to extract detailed data from license_finder. Beware of caveats.
#!/usr/bin/env ruby
require 'license_finder'
# See lib/license_finder/core.rb for more configuration options.
# A quiet logger is required when running reports...
lf = LicenseFinder::Core.new(logger: { quiet: true })
# Groups of packages
lf.acknowledged # All (non-ignored) packages license_finder is tracking

Keybase proof

I hereby claim:

  • I am mainej on github.
  • I am jmaine (https://keybase.io/jmaine) on keybase.
  • I have a public key ASDRyJwjgJPN9jP7MI5MwXJ2u9MMaEROnAzXGP0FVXbhMQo

To claim this, I am signing this object:

@mainej
mainej / views.cljs
Created October 25, 2021 05:21
Example of `glimt.multi-state`
(ns test-glimt.views
(:require
[reagent.core :as r]
[re-frame.core :as re-frame]
[glimt.multi-state :as http]
[ajax.json :as ajax]
[day8.re-frame.http-fx]
))
;; once, at app load