Skip to content

Instantly share code, notes, and snippets.

View kneath's full-sized avatar
🌲
Growing soil

Kyle Aster kneath

🌲
Growing soil
View GitHub Profile
@kneath
kneath / gist:210487
Created October 14, 2009 23:20 — forked from pedro/gist:210485
describe 'Bacon and Mocha sucks together' do
it "sucks when you have a spec using only mocha, not bacon, to assert something" do
str = 'a'
str.expects(:size)
str.size
end
end
# this raises Bacon::Error: empty specification
# after spending 20 minutes trying to fix I decided to just add
gisting is broken
/Users/kneath/Projects/github/main_site/public/javascripts/admin/date.js:191: WARNING - Parse error. type annotation incompatible with other annotations
* @type String
^
/Users/kneath/Projects/github/main_site/public/javascripts/admin/date.js:211: WARNING - Parse error. type annotation incompatible with other annotations
* @type String
^
/Users/kneath/Projects/github/main_site/public/javascripts/admin/datePicker.js:21: WARNING - Parse error. type annotation incompatible with other annotations
* @type jQuery
@kneath
kneath / _README.md
Created November 18, 2009 21:42 — forked from defunkt/bundle.rake
Intelligent asset bundling for Rails (GitHub's asset bundling)

GitHub Javascript Strategy

Unless otherwise necessary (such as mobile development), the GitHub javascript codebase is based off jQuery. You can safely assume it will be included on every page.

File naming

  • All jquery plugins should be prefixed with jquery, such as jquery.facebox
  • All github-specific jquery plugins should be prefixed with jquery.github. Like jquery.github.repo_list.js
  • All page-specific files (that only run on ONE page) should be prefixed with page. page.billing.js
public/javascripts
|-- README.md
|-- admin
| |-- date.js
| `-- datePicker.js
|-- common
| |-- application.js
| |-- jquery.facebox.js
| `-- jquery.relatize_date.js
|-- dev
This is the first file in the series. Woo!
@kneath
kneath / ._what.md
Created December 4, 2009 18:23
Badass git pull alias (up) to show commit log that just got pulled in addition to changes

Badass git pull alternative

Add this little snippet to your ~/.gitconfig and it amps up your git pull by means of git up

  1. Adds in a list of the commits you're pulling down
  2. Auto-prunes remote branches
  3. Defaults to pull --rebase - gets rid of unnecessary merge commits. If you don't know what rebase does, this is probably safe for you. If you know what rebase does, you should know where this will not be safe for you.

Scott Chacon and Ryan Tomayko basically figured out how to do this and I am stealing all of the credit.

// HTML escapes `string`
var patterns = [[/&/g, "&amp;"], [/</g, "&lt;"], [/>/g, "&gt;"], [/"/g, "&quot;"]]
for(pattern in patterns)
string = string.replace(pattern[0], pattern[1]);
// for the line obsessed
for([[/&/g, "&amp;"], [/</g, "&lt;"], [/>/g, "&gt;"], [/"/g, "&quot;"]] in patterns); string = string.replace(pattern[0], pattern[1]);
Leopard Machine (2Ghz Core Duo):
ruby 1.8.6 (2008-08-11 patchlevel 287) [universal-darwin9.0]
$ time ruby -rubygems -e ''
real 0m1.493s
user 0m0.214s
sys 0m0.076s

Kyle's Guide

Just a placeholder for now, move along. Going to add what I consider vital design & development practices for use somewhere else in more complete form.

I am writing this down so I remember it. I have been writing HTML & CSS since somewhere around 1998, and much of what I have ingrained in my brain is outdated (body{ text-align:center; } anyone?). I need to rid this of my brain, and this is the only way I know how.