Skip to content

Instantly share code, notes, and snippets.

View jlong's full-sized avatar
🚀

John W. Long jlong

🚀
View GitHub Profile
@jlong
jlong / config.ru
Created June 23, 2011 19:42
Simple Rack App
class HelloWorld
def call(env)
[200, {"Content-Type" => "text/plain"}, ["Hello world!"]]
end
end
run HelloWorld.new
@jlong
jlong / config.ru
Created June 23, 2011 19:56
Directory Index w/ Rack
# The project root directory
$root = ::File.dirname(__FILE__)
# Common Rack Middleware
use Rack::ShowStatus # Nice looking 404s and other messages
use Rack::ShowExceptions # Nice looking errors
#
# From Rack::DirectoryIndex:
# https://github.com/craigmarksmith/rack-directory-index/
@jlong
jlong / three-column.scss
Created June 24, 2011 22:51
3-column grid trick with nth-child clearing for variable height elements
section.three-column-grid {
clear: both;
width: 960px;
@include clearfix;
> section {
float: left;
padding: 0 10px;
width: 300px;
@jlong
jlong / .bash_profile
Created June 30, 2011 18:50
Drop in .bash_profile to always remember the working directory between sessions
# Remember the current directory
if [ `type -t cd` == builtin ]; then
cd ()
{
builtin cd "$@"
pwd > ~/.working-directory
}
else
# Alias the cd function (needed if you run RVM)
eval "$(echo "__cd_without_cwd()"; declare -f cd | tail -n +2)"
@jlong
jlong / _colors.scss
Created July 2, 2011 02:13
Named colors in Scss
// Palette
$black: #333;
$jet-black: #000;
$gray: #888;
$dark-gray: #555;
$burnt-orange: #c56210;
$orange: #d56000;
$bright-orange: #ff943c;
@jlong
jlong / gist:1078567
Created July 12, 2011 18:09
Serve Error

serve at /Users/jlong/.rvm/gems/ruby-1.9.2-p0@serve/bundler/gems/serve-c2741b08ab4b did not have a valid gemspec.
This prevents bundler from installing bins or native extensions, but that may not affect its functionality.
The validation message from Rubygems was:
[“lib/serve/templates/Gemfile”, “lib/serve/templates/README.markdown”, “lib/serve/templates/_layout.html.erb”, “lib/serve/templates/application.scss”, “lib/serve/templates/compass.config”, “lib/serve/templates/config.ru”, “lib/serve/templates/gitignore”, “lib/serve/templates/hello.html.erb”, “lib/serve/templates/index.redirect”, “lib/serve/templates/view_helpers.rb”] are not files

# This should be in view_helpers.rb:
def logged_in?
boolean_param(:logged_in)
end
# my template code
<% unless logged_in? %>
<script type="text/javascript" charset="utf-8">
alert('done')
# My homebrew formula for compiling Vim for the console with support
# for 256 colors + ruby, etc.
#
# To install, drop /usr/local/Library/Formulas/ and execute:
#
# brew install -f vim
require 'formula'
class Vim < Formula
@jlong
jlong / _menu.sass
Created October 13, 2011 20:19
New UserVoice Menu
#application-menu
font-size: 13px
font-weight: 100
padding-right: 0.35em
+text-shadow(rgba(black, 0.75) 0 1px 0)
.menubar
float: right
height: $header-height - 1px
@jlong
jlong / dabblet.css
Created February 15, 2012 17:36
Untitled
.button {
-moz-appearance: none;
-webkit-appearance: none;
appearance: none;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
-o-border-radius: 4px;
-ms-border-radius: 4px;
-khtml-border-radius: 4px;
border-radius: 4px;