Skip to content

Instantly share code, notes, and snippets.

View imathis's full-sized avatar
🍽️
Hungry for biscuits.

Brandon Mathis imathis

🍽️
Hungry for biscuits.
View GitHub Profile
@imathis
imathis / gist_tag.rb
Created June 15, 2011 17:58 — forked from chrisjacob/gist_tag.rb
A Liquid tag for Jekyll sites that allows embedding Gists and showing code for non-JavaScript enabled browsers and readers.
require 'cgi'
require 'digest/md5'
require 'net/https'
require 'uri'
module Jekyll
class GistTag < Liquid::Tag
def initialize(tag_name, text, token)
super
@text = text
@imathis
imathis / tweetbot-mute-regex.md
Created June 27, 2012 19:45
Tweetbot can use regular expressions to mute tweets in your timeline and mentions.

Hashtag abuse

Three or more hashtags.

#[^#]+#[^#]+#

Long hashtags (15+ characters): #hashtagpunchline

@imathis
imathis / set-game.js
Created April 8, 2016 15:34
Some simple javascript to power a game of Set.
var Deck = {
reset: function() {
this.size = 0
this.cards = []
while(this.size < 81) {
this.cards.push(Card.new(this.size))
this.size += 1
}
this.shuffle()
@imathis
imathis / gist:1104557
Created July 25, 2011 16:49
FIX for Lion's posix_spawn_ext.bundle: [BUG] Segmentation fault

The segfault problem with posix_spawn is indeed caused by Lion's compiler being LLVM and not GCC by default. However, when I installed RVM, the notes suggested that on Lion you need to add export CC=/usr/bin/gcc-4.2 to your shell startup file (.bashrc or .zshrc as appropriate). I did that, but it seems that's what caused problems: while ruby 1.9.2 needs you to use GCC to install it, using the same compiler for the gems apparently causes breakage.

First, you need to install XCode 4.x, which is now a free (though hefty!) download from the Mac App Store. Without that, you have no gcc, so you won't get anywhere ;-)

Next, what you need to do is clear out your rvm ruby and the associated gems (make sure you are cd'd into your octopress repository then do:

rvm remove ruby-1.9.2 --gems --archive

which will clear everything out so that you can start from scratch. Obviously, if you have other stuff you've installed for other purposes using RVM, be careful with this. If you previously had the export CC li

@imathis
imathis / keybase.md
Created October 22, 2018 21:02
Keybase Proof

Keybase proof

I hereby claim:

  • I am imathis on github.
  • I am imathis (https://keybase.io/imathis) on keybase.
  • I have a public key ASDv6UKdWP1IsKjvk0pJega3CqiUZw9fA6nGz22Vgh9ORAo

To claim this, I am signing this object:

@imathis
imathis / Open-Safari-URL-in-Chrome.scpt
Created March 14, 2011 19:37
Open Safari's foremost url in Google Chrome (useful for flash resistance)
(*
Opens current url of foremost safari window in Google Chrome.
Useful for flash resisters who prefer the Safari browser
Store in ~/Library/Scripts/Applications/Safari
Can be invoked via Launchbar, and other launchers.
*)
tell application "Safari"
activate
@imathis
imathis / clone.rb
Created August 17, 2015 03:10
Clone all repositories under a user or organization
#!/usr/bin/ruby
require 'open-uri'
require 'json'
user = 'imathis'
repos = open("https://api.github.com/users/#{user}/repos") { |f|
JSON.parse(f.readlines.join)
}
@imathis
imathis / Guardfile
Last active December 19, 2015 11:19
Guard-Jekyll-Plus is a fancy Guard script for managing "smart" Jekyll builds. Changes in the source directory to non-template files will trigger a simple filesystem copy (or delete) to the destination directory. Changes to template files (configured by file extension) will trigger a Jekyll build.
require 'guards/guard-jekyll-plus.rb'
# Sample guard
guard :jekyll do
watch /^source/
watch '_config.yml'
end
@imathis
imathis / gist:5887081
Last active December 19, 2015 02:59
More readable coffeescript conditionals
# This is part of a simple javascript router I'm writing.
# When a link is clicked, the router checks to see if the url should trigger a route callback
# Here I demonstrate a way to improve long conditional statements with coffeescript and underscore.js
# Before: Concise but hard to read, hard to comment and hard to modify.
routeUrl: (url)->
return false if url is window.location.pathname || url.match /^http|^#/ || url.match /\.(png|gif|je?pg|pdf)$/i
url