Skip to content

Instantly share code, notes, and snippets.

Stephen Benner SteveBenner

View GitHub Profile
@SteveBenner
SteveBenner / README-Template.md
Created Jul 28, 2017 — forked from PurpleBooth/README-Template.md
A template to make good README.md
View README-Template.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@SteveBenner
SteveBenner / _color-palette.slim
Created Oct 29, 2015
Slim partial - renders a color palette on your web page to aid in graphic design
View _color-palette.slim
/ This is a humble web design tool inspired by the eyedropper functionality in Google Chrome's
color picker interface (part of the dev tools panel) which allows one to choose any pixel of
the current web page to set as a color property's value. Though hugely convenient for visual
design, color selection being limited to the context of the page leaves much to be desired.
/ This partial solves the limitation by affixing an unobtrusive panel to your page to act as
a makeshift color palette to use in conjunction with the eyedropper. The panel is populated
with small squares representing a list of colors passed into the partial via local. Viola!
/ @local [Array<String>] colors List of values valid for `background-color` CSS property
@SteveBenner
SteveBenner / dl-tatw.rb
Created May 17, 2015
Web scraper that downloads archived episodes of 'Trance Around The World' podcast
View dl-tatw.rb
#!/usr/bin/env ruby
#
# This is a web scraper which downloads mp3 files from the TATW web archives.
#
# Usage: run this script and pass it an episode range to download via arguments
#
# Dependencies: requires 'aria2' to be installed (uses the CLI tool 'aria2c')
#
require 'pathname'
require 'colorize' # Use of this gem is optional; it makes the output prettier
@SteveBenner
SteveBenner / gh-starred.rb
Created Mar 15, 2015
Produce a Markdown file enumerating the starred repos of a GitHub user (with HTML links) using the Unicorn API gem
View gh-starred.rb
# The 'github_api' gem is implicility assumed to have been loaded at this point...
# Configuration data is passed to Github::Client#new as a Hash whose keys are Symbols
CONFIG_DATA = {
user: 'github-username',
login: 'github-login-email@host.com',
oauth_token: 'personal-access-token' # one of many valid authentication methods (see the gem docs for more)
}
# Data is returned from the API as a Github::ResponseWrapper object
View pry-cheatsheet.md

Pry Cheat Sheet

Youtube Tutorial (2013)

Command Line

  • pry -r ./config/app_init_file.rb -- load your app into a pry session (look at the file loaded by config.ru)
  • pry -r ./config/environment.rb -- load your rails into a pry session

Debugger

@SteveBenner
SteveBenner / flatdoc.slim
Last active Oct 5, 2016
Slim template for Flatdoc
View flatdoc.slim
/ This is a Slim recreation of the Flatdoc example template provided here:
/ https://raw.githubusercontent.com/rstacruz/flatdoc/gh-pages/templates/template.html
/
/ Flatdoc is a simple way to generate a documentation page from Markdown
/ More info is available on their website: http://ricostacruz.com/flatdoc/
/
/ The main alterations noticeable in this version of the template are:
/ - Emphasis is placed on using variables and interpolation often, key advantages of Slim
/ - The GitHub button links have been replaced with a Web Component version, which I
find to be superior to using an iFrame. Just uncomment the original code to revert.
@SteveBenner
SteveBenner / regexes.md
Last active Aug 29, 2015
Useful Regular Expressions I’ve come up with
View regexes.md

Regular Expressions

Text coloring / highlighting

I use the following regexes with [iTerm2][iterm]'s ['trigger' feature][it1] to create some basic syntax highlighting.

(?<=- )([A-Z][A-Z ]+:)+ Colorize CONSTANTS Magenta
(?<=- )(:|")\w*"?(?= =>) Colorize :keys => / "keys" => Yellow
^([^=]*)(?==) Colorize ENV_VARS Cyan
(?<=[^=])= Colorize the = separator Dark Grey

View common.loading.css
body.loading:after {
/* with no content, nothing is rendered */
content: "";
position: fixed;
/* element stretched to cover during rotation an aspect ratio up to 1/10 */
top: -500%;
left: -500%;
right: -500%;
bottom: -500%;
z-index: 9999;
View _coderwall-badges.slim
/ This partial allows you to render the Coderwall badges of specified user
/
ruby:
username = 'your-coderwall-username'
orientation = 'horizontal' # can be 'vertical' or 'horizontal'
/ Place the following tags in the HEAD section of your web page (omit jQuery if already present, of course)
link href="http://coderwall.com/stylesheets/jquery.coderwall.css" media="all" rel="stylesheet" type="text/css"
script src="https://code.jquery.com/jquery-2.1.1.min.js"
script src="http://coderwall.com/javascripts/jquery.coderwall.js"
@SteveBenner
SteveBenner / macfix4-disable-crash-reporter.rb
Created Oct 12, 2014
Mac fix - Disable CrashReporter and prevent it from launching
View macfix4-disable-crash-reporter.rb
#!/usr/bin/env ruby
#
# Mac fix 4 - Disable CrashReporter
#
# CrashReporter is a daemon that monitors for crashes and generates a report (duh) when they occur.
# If an application (such as Finder) become stuck in an infinite crash loop, then sometimes it's
# desirable to just turn off CrashReporter entirely, as it will continually generate processes in
# the background which spew errors and logs, resulting in massive overhead to your system resources.
#
# DIAGNOSING:
You can’t perform that action at this time.