Skip to content

Instantly share code, notes, and snippets.

Avatar

Stephen Benner SteveBenner

View GitHub Profile
@SteveBenner
SteveBenner / sass-convert-dir.rb
Created Mar 23, 2014
Recursively convert a directory of SASS files from one syntax to the alternate one
View sass-convert-dir.rb
DIR = '<project-root>'
files = Dir.glob("#{DIR}/**/*.scss")
files.each { |f| `sass-convert #{f} #{f.sub(/\.scss/, '.sass')}` unless File.exist?(f.sub(/\.scss/, '.sass')) }
# one-liner for CLI use
# ruby -e "Dir.glob('<project-root>/**/*.scss').each { |f| `sass-convert #{f} #{f.sub(/\.scss/, '.sass')}` unless File.exist?(f.sub(/\.scss/, '.sass')) }"
View github-readme-markdown-styles.sass
// 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
@SteveBenner
SteveBenner / _disqus.slim
Last active Aug 29, 2015 — forked from voigt/disqus.js
Slim partial - Disqus comments widget
View _disqus.slim
/ 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 / ghost-upgrade.rake
Last active Aug 29, 2015
Rake - upgrade a Ghost blog installation
View ghost-upgrade.rake
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 / shortcuttr.rb
Last active Aug 29, 2015
Simple script that generates executable shortcuts from the command line
View shortcuttr.rb
#!/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 / fname_incr.rb
Created May 6, 2014
Function which returns a given filename or the incremented version thereof
View fname_incr.rb
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 / nuke-ruby.bash
Created Jul 17, 2014
When there is just too much Ruby in yo OS
View nuke-ruby.bash
# 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 / .bowerrc.yml
Created Aug 15, 2014
Bower - configuration file
View .bowerrc.yml
# 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 / _google-analytics.slim
Created Sep 26, 2014
Slim partial - Google analytics
View _google-analytics.slim
/ Official Google Analytics tracking code (updated 2014-10-23)
/
/ @option [String] google_analytics_key GA key in a format similar to: 'UA-XXXXXXXX-X'
/
- if google_analytics_key
javascript:
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
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;
You can’t perform that action at this time.