Skip to content

Instantly share code, notes, and snippets.

View jameslafa's full-sized avatar

James Lafa jameslafa

View GitHub Profile
jesstelford /
Last active January 10, 2024 20:08
Read SHAPE UP by basecamp on a Kindle / reMarkable / eReader

Read Shape Up by basecamp on a kindle / reMarkable / eReader

Basecamp's new book Shape Up is now available online ( to read page-by-page.

There is a .pdf version, but that's not the best format for Kindle / other eReaders. Instead, we can convert the page-by-page into an eReader friendly format.

Part 1: Convert to a single page

NOTE: This has only been tested on Chrome

tamouse / clear_sidekiq_queue.rake
Created July 28, 2014 20:07
Clearing out sidekiq queues
class SidekiqUtil
def self.queues { |name| }
def self.clear_all
self.queues.each { |q| q.clear }
shrwnsan / sc-dl-min.js
Last active August 29, 2015 13:55 — forked from duncanbeevers/sc-dl-min.js
Bookmarklet which creates download links on *any* Soundcloud page. Full credit goes to @duncanbeevers, with contributions from @markpiro and @haroldSanchezb -- Last tested on Soundcloud site: 4 Feb 2013 Successful :-)
!function(a){var b,c,d,e=$(".sound"),f=require("config").get("client_id");require("lib/connect").getAuthToken();var i,j,k,l,m,h=require("lib/helpers/conversion-helper");for(b=e.length-1;b>=0;b--){c=$(e[b]);var n=""+(c.find(".soundTitle__title").attr("href")||a.location.pathname);k={url:n,client_id:f},m=function(a){return function(b){var c={client_id:f};l=require("lib/url").stringify({query:c},b.stream_url+".mp3"),d=$(a.find(".sound__soundActions .sc-button-group")[0]),j=d.find(".sc-button:first")[0].className.match(/sc-button-((?:small)|(?:medium))/)[1],i=$('<a class="sc-button sc-button-download sc-button-icon sc-button-responsive">Download</a>').attr({title:"Download this sound ("+h.bytesToMB(b.original_content_size)+")",href:l,download:a.find(".soundTitle__title").first().text()+".mp3"}).addClass("sc-button-"+j),0==a.find(".sc-button-download").length&&d.append(i)}}(c),$.getJSON("",k).success(m)}}(window);
lelandbatey /
Last active February 25, 2024 13:47
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!


This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"


mwhite /
Last active April 22, 2024 09:22
The Ultimate Git Alias Setup

The Ultimate Git Alias Setup

If you use git on the command-line, you'll eventually find yourself wanting aliases for your most commonly-used commands. It's incredibly useful to be able to explore your repos with only a few keystrokes that eventually get hardcoded into muscle memory.

Some people don't add aliases because they don't want to have to adjust to not having them on a remote server. Personally, I find that having aliases doesn't mean I that forget the underlying commands, and aliases provide such a massive improvement to my workflow that it would be crazy not to have them.

The simplest way to add an alias for a specific git command is to use a standard bash alias.

# .bashrc
yrezgui / filesize-filter.js
Created May 26, 2013 18:22
This is a custom filter to show a bytes filesize in better way.
// add the filter to your application module
angular.module('myApp', ['filters']);
* Filesize Filter
* @Param length, default is 0
* @return string
angular.module('filters', [])
.filter('Filesize', function () {
richard-flosi /
Created September 26, 2012 16:55
Bottle with Cross-origin resource sharing (CORS)
Example of setting up CORS with
from bottle import Bottle, request, response, run
app = Bottle()
def enable_cors():
kinopyo / gist:2224867
Created March 28, 2012 08:52
Check whether a Paperclip attachment exists

Check whether a Paperclip attachment exists

Don’t simply test for the presence of the magic Paperclip attribute, it will return a paperclip Attachment object and thus always be true:

- if # always true
  = image_tag(
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Clicking links and buttons=
click_link('Link Text')
click('Link Text') # Click either a link or a button
click('Button Value')