Skip to content

Instantly share code, notes, and snippets.

@SteveBenner
SteveBenner / .bowerrc.yml
Created August 15, 2014 07:20
Bower - configuration file
# Bower configuration
#
# Official docs at: http://bower.io/docs/config/
# Last updated at: 2014-08-14
#
# Config is obtained by merging the following, in given order:
# - CLI args via -config
# - Environment variables
# - Local .bowerrc located in the current working directory
# - All .bowerrc files upwards the directory tree
@SteveBenner
SteveBenner / nuke-ruby.bash
Created July 17, 2014 13:35
When there is just too much Ruby in yo OS
# Nuke Ruby!
rm -rf ~/.gem
rm -rf ~/.rubies
# Prerequisites for Mac OSX installation
#
# Make sure Xcode or the command line tools are installed
# This one's up to you: https://github.com/kennethreitz/osx-gcc-installer#readme
#
# Install Homebrew if not installed
@SteveBenner
SteveBenner / git-helpers.bash
Last active November 30, 2016 06:02
Bash functions for managing Git
#
# FUNCTIONS
#
# Test the first argument of a command for a git host identifier (aliases configured in ssh-config)
is_git_host() {
case "$1" in
'gh') host='github-personal'
user='SteveBenner'
true ;;
@SteveBenner
SteveBenner / fname_incr.rb
Created May 6, 2014 03:26
Function which returns a given filename or the incremented version thereof
def fname_incr(fname)
!File.exists?(fname) ?
fname :
/([0-9]+)\./.match(fname) ?
fname_incr(fname.sub(/([0-9]+)/) { |m| (m.to_i+1).to_s }) :
fname_incr(fname.sub(/[^\.]*/) { |m| m+'1' })
end
@SteveBenner
SteveBenner / unbrew.rb
Last active January 3, 2024 01:44
Homebrew uninstall script
#!/usr/bin/env ruby
#
# CLI tool for locating and removing a Homebrew installation
# http://brew.sh/
#
# Copyright (C) 2014 Stephen C. Benner
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
@SteveBenner
SteveBenner / shortcuttr.rb
Last active August 29, 2015 14:00
Simple script that generates executable shortcuts from the command line
#!/usr/bin/env ruby
#
# Shortcuttr - generates executable shortcuts
#
require 'fileutils'
SCRIPT = File.join ENV['HOME'], 'github/ruby-scripts/system/bin', ARGV.first.to_s
File.open SCRIPT, 'w', 0755 do |f|
f.puts '#!/usr/bin/bash'
f.puts '# This executable shortcut was generated by Stephen Benner, a truly lazy programmer'
@SteveBenner
SteveBenner / brewfix1-osxfuse.rb
Last active April 4, 2022 22:47 — forked from yiufung/truecrypt_fix.bash
Homebrew fix - unexpected files and libs from ‘osxfuse'
#!/usr/bin/env ruby
#
# Homebrew fix 1 - osxfuse dylibs
#
# original solutions: https://gist.github.com/aaronzirbes/3239033
# https://gist.github.com/trinitronx/5437061
#
# Fixes the following:
#
# > Warning: Unbrewed dylibs were found in /usr/local/lib.
@SteveBenner
SteveBenner / ghost-upgrade.rake
Last active August 29, 2015 13:59
Rake - upgrade a Ghost blog installation
require 'bundler'
require 'fileutils'
Bundler.require
GHOST_DIR = ENV['GHOST_HOME'] || '<your_ghost_folder>'
THEME = 'casper'
namespace :blog do
desc 'Upgrades Ghost using given file'
@SteveBenner
SteveBenner / _disqus.slim
Last active August 29, 2015 13:59 — forked from voigt/disqus.js
Slim partial - Disqus comments widget
/ Integrate Disqus comments into your site with this widget (adheres to official API and config spec)
/
/ @see https://help.disqus.com/customer/portal/articles/1104788-web-integration Official web integration docs
/ @see https://help.disqus.com/customer/portal/articles/472098-javascript-configuration-variables Configuration docs
/
/ @local [Hash{Symbol => String}] disqus Key/value pairs corresponding to the Disqus JS configuration variables
/ @option disqus [String] shortname Unique identifier for your forum website registered on Disqus.com (REQUIRED)
/ @option disqus [String] identifier A String or Integer value which identifies the current web page thread
/ @option disqus [String] title Title of the current page; defaults to value of HTML `title` element
/ @option disqus [String] url URL of the current page; defaults to `window.location.href`
@SteveBenner
SteveBenner / github-readme-markdown-styles.sass
Last active August 29, 2015 13:59
Github Readme SASS styles
// Github markdown styles
$h1-grey: #dddddd
$h2-grey: #eeeeee
$header-black: #333333
// placeholders
%hover-link
background: url(data:image/png) no-repeat 10px center
text-decoration: none