Skip to content

Instantly share code, notes, and snippets.

@stevenh512
stevenh512 / stripcolor
Created March 30, 2012 02:22
Strip color codes from Rails logs
#!/bin/sh
# Strip color codes from Rails logs
# Examples:
# stripcolor test.log > test.log.nocolor # Save a copy of the log without color
# stripcolor test.log | gist # Gist the log
# stripcolor test.log | pbcopy # Copy the log to the clipboard in OSX
# stripcolor test.log | xclip -selection clipboard # Copy log to clipboard in Linux
cat "$@" | sed -r "s/\x1B\[([0-9]{1,3}((;[0-9]{1,3})*)?)?[m|K]//g"
@stevenh512
stevenh512 / gitconfig-git
Created June 11, 2012 10:51
URL rewriting in .gitconfig
# Use git and git+ssh instead of https
[url "git://github.com/"]
insteadOf = https://github.com/
[url "git@github.com:"]
pushInsteadOf = "git://github.com/"
[url "git@github.com:"]
pushInsteadOf = "https://github.com/"
@stevenh512
stevenh512 / .gitignore
Created May 22, 2012 21:23
GitHub Authorizations API for command line apps using Octokit
Gemfile.lock
@stevenh512
stevenh512 / gist:bae3d5174c26536cab38
Created October 28, 2015 06:12 — forked from hayderimran7/gist:d2e40534016f7f07da44
Solve docker issue "Error mounting devices cgroup: mountpoint for devices not found" on ubuntu
I faced this issue when running docker with btrfs. I finally found this link https://www.debian-administration.org/article/696/A_brief_introduction_to_using_docker and solution was at A3.
so perform following as sudo :
> sudo -i
> echo "cgroup /sys/fs/cgroup cgroup defaults 0 0" >> /etc/fstab
> mount /sys/fs/cgroup
now run docker daemon:
@stevenh512
stevenh512 / controller_spec.rb
Created October 27, 2015 19:42 — forked from tonycoco/controller_spec.rb
The Greatest Hits of Rspec Testing: Volume 1
require "spec_helper"
describe ExampleController do
context "GET #index" do
let(:resources) { FactoryGirl.create_list(:resource) }
before do
get :index
end
@stevenh512
stevenh512 / config.rb
Created May 23, 2012 08:29 — forked from nrrrdcore/frontage.css
Outlined Type Effect with CSS Text-Shadowing
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "stylesheets"
sass_dir = "sass"
images_dir = "images"
javascripts_dir = "javascripts"
# You can select your preferred output style here (can be overridden via the command line):
@stevenh512
stevenh512 / border.html
Created May 20, 2012 00:08
Another take on faded/gradient borders
<html>
<head>
<title>Gradient borders</title>
<link rel="stylesheet" href="stylesheets/screen.css" type="text/css" />
</head>
<body>
<div class="border-container">
<div>
<h1>Ohai!</h1>
</div>
@stevenh512
stevenh512 / border.css
Created May 19, 2012 10:47 — forked from nrrrdcore/border.css
Faded/Gradient Borders in Pure CSS
.border-container {
width: 28%; /* border will be on the left on this container */
float: right;
overflow: hidden; /* only needed if floating container */
min-height: 600px; /* static height if you want your container to be taller than its content */
-moz-box-shadow: inset 15px 0 5px -16px rgba(0,0,0,.1), -1px 0 0 #FFF;
-webkit-box-shadow: inset 15px 0 5px -16px rgba(0,0,0,.1), -1px 0 0 #FFF;
box-shadow: inset 15px 0 5px -16px rgba(0,0,0,.1), -1px 0 0 #FFF;
border-width: 0 0 0 1px;
-webkit-border-image:
@stevenh512
stevenh512 / bended-shadow.css
Created May 19, 2012 07:09 — forked from nrrrdcore/bending-shadow.css
Simple Bended-Shadow CSS: Create the Bended Photo Effect without writing a million divs.
.bended-shadow {
position: relative;
width: 500px;
margin: 200px auto;
}
.bended-shadow::before, .bended-shadow::after {
content: '';
position: absolute;
width: 60%;
@stevenh512
stevenh512 / apple-shadow.css
Created May 18, 2012 22:16 — forked from nrrrdcore/apple-shadow.css
Bending Shadows Backwards: Apple.com's Container CSS Sorcery
.shadow-stuff {
-moz-border-radius: 0% 0% 100% 100% / 0% 0% 8px 8px;
-webkit-border-radius: 0% 0% 100% 100% / 0% 0% 8px 8px;
border-radius: 0% 0% 100% 100% / 0% 0% 8px 8px;
-moz-box-shadow: rgba(0,0,0,.30) 0 2px 3px;
-webkit-box-shadow: rgba(0,0,0,.30) 0 2px 3px;
box-shadow: rgba(0,0,0,.30) 0 2px 3px;
}
.container {