Skip to content

Instantly share code, notes, and snippets.

View jlong's full-sized avatar
🚀

John W. Long jlong

🚀
View GitHub Profile
@jlong
jlong / columns.sass
Created December 17, 2010 06:28
Two, three, and four column layout mixins for Sass (requires Compass).
=two-column($width, $gutter)
$colwidth: ($width - $gutter) / 2
+clearfix
margin-left: -($gutter / 2)
margin-right: -($gutter / 2)
.column_1, .column_2
float: left
padding-left: $gutter / 2
padding-right: $gutter / 2
width: $colwidth
#\ -p 4000
gem 'activesupport'
gem 'serve'
require 'serve'
require 'serve/rack'
# The project root directory
root = ::File.dirname(__FILE__)
@jlong
jlong / rainbow.html
Created May 27, 2011 22:10
Double Rainbow with Sass and Compass (requires a modern browser like Safari or Chrome). See also: http://www.flickr.com/photos/johnwlong2000/5766405202
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title></title>
<link rel="stylesheet" href="/stylesheets/rainbow.css" />
</head>
<body>
<div class="rainbow"></div>
<div class="rainbow"></div>
@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 / .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