Skip to content

Instantly share code, notes, and snippets.

View jlong's full-sized avatar
🚀

John W. Long jlong

🚀
View GitHub Profile
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@jlong
jlong / jquery.autogrow.js
Last active February 27, 2020 08:39
Autogrow Textareas in jQuery
/*
* jquery.autogrow.js
*
* A plugin written for UserVoice that makes it easy to create textareas
* that automatically resize to fit their contents.
*
* Based on Scott Moonen's original code for Prototype.js:
*
* <http://scottmoonen.com/2008/07/08/unobtrusive-javascript-expandable-textareas/>
*
@jlong
jlong / dabblet.css
Created February 15, 2012 17:37
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;
@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;
@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
# 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
# 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')
@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

@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 / .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)"