- Use less for paging, but still provide ack's nice colored output and per-file grouping, by adding this to .ackrc:
--pager=less -r -E
- inheritance patterns: prototypal/classical/pseudo-classical/hacked-classical/functional
- class frameworks:
- client frameworks:
- Sammy http://sammyjs.org
- sproutcore http://www.sproutcore.com/
- loaders
- loadrunner https://github.com/danwrong/loadrunner
- yepnope http://yepnopejs.com/
- LAB.js http://labjs.com/
- head.js http://headjs.com/
- YUI loader
- testing
- QUnit http://docs.jquery.com/Qunit
- YUI 3 test http://developer.yahoo.com/yui/3/test/
- Cross-browser log util https://gist.github.com/922988
- reference http://bonsaiden.github.com/JavaScript-Garden/
- Docs
- JSDoc
- YUI doc
- utils: http://jsonselect.org/
- Closure linter: http://code.google.com/closure/utilities/
- find element w/ focus:
document.activeElement
- "JavaScript language advanced Tips & Tricks": http://code.google.com/p/jslibs/wiki/JavascriptTips#language_advanced_Tips_&_Tricks
- Essential JavaScript Patterns: http://addyosmani.com/resources/essentialjsdesignpatterns/book
- JS learning tool: https://github.com/liammclennan/JavaScript-Koans
- JS learning tool: http://www.codecademy.com/
- Recommended JS book: JavaScript: The Good Parts
- Skeleton "A Beautiful Boilerplate for Responsive, Mobile-Friendly Development": http://getskeleton.com/
- CSS lint: https://github.com/stubbornella/csslint
- Sprite generator: http://spritegen.website-performance.org/
- Full page background (can be used w/ background-color): http://css-tricks.com/perfect-full-page-background-image/
- border-radius generator http://border-radius.com/
- gradient generator: http://www.colorzilla.com/gradient-editor/
- color picker: http://www.w3schools.com/tags/ref_colorpicker.asp
- double.class selector is supported in all browsers back to IE7 http://css-tricks.com/multiple-class-id-selectors/
- CSS2 spec http://www.w3.org/TR/CSS2
- Less http://lesscss.org/
- CSS hacks: http://mathiasbynens.be/notes/safe-css-hacks#safe-css-hacks
- use css box-sizing to constrain padding inside parent element: http://css-tricks.com/box-sizing/
- prefer no border on first element of list over last element, as first-child is css2, but last-child is css3
- Dive into html5: http://diveintohtml5.org/
- html5rocks documentation: http://www.html5rocks.com/en/
- Rails docs w/ nice search: http://www.railsbrain.com/
- gdb
- Use "debugger" keyword in script to launch gbd
- Set autolist to see context:
set autolist
- HTML/CSS sanitizer https://github.com/rgrove/sanitize/
- Run spec w/ -c option for satisfying red/green output
- Use rake to rebuild db:
rake db:rebuild
- Show all rake tasks:
rake -T
- Install gems w/ rake:
rake gems:install
- Show rake stack trace on error:
rake <task> --trace
- Build gem:
gem build <path to gemspec>
- Create rvm environment (ruby vm + gems) for ruby v1.8.7:
rvm install 1.8.7
rvm gemset create <gemset name>
- Show all rvm environments:
rvm list
- Show all rvm gemsets:
rvm list gemsets
- Select an rvm environment:
rvm use <rvm name>@<gemset name>
- Use .rvmrc to tell rvm which gemset to use on a per-directory basis
- List gems w/ details:
gem list -d
- Install gem w/o docs:
gem install <gem name> --no-rdoc --no-ri
, e.g.,gem install rails --version 2.3.8 --no-rdoc --no-ri
- Generate rails migration timestamp:
ruby -e "p Time.new.strftime('%Y%m%d%H%M%S')"
- Magic variable to last result:
_
, egx = 2 * 2; y = _
- Use
script/console
to load rails app in irb
-
show databases:
\l
-
show tables:
\d
-
connect to database:
\c dbname
-
15 practical commands http://www.thegeekstuff.com/2009/04/15-practical-postgresql-database-adminstration-commands/
- Programming Pig: http://ofps.oreilly.com/titles/9781449302641/index.html
- Yahoo Pig tutorial: http://developer.yahoo.com/hadoop/tutorial/pigtutorial.html
- Yahoo Pig intro: http://developer.yahoo.com/hadoop/tutorial/module6.html#pig
- Launch grunt:
pig
- Use console.debug to get line number and file name in Firebug output: http://getfirebug.com/logging
- Use "debugger" keyword to launch Firebug debugger at that point in the code
- Command + Option + J opens javascript console (helpful when console is undocked from window)
- Cmd + shift + delete opens clear cache/cookies dialog
- To disable cache, click gear icon in lower right of dev tools, and check the "disable cache" checkbox
- Google I/O preso on dev tools http://www.youtube.com/watch?v=N8SS-rUEZPg
- Press ? in developer tools to see keyboard shortcuts
- Cmd + alt + E opens clear cache dialog
-
GetBundles bundle manager: http://solutions.treypiepmeier.com/2009/02/25/installing-getbundles-on-a-fresh-copy-of-textmate/
-
find by file name: command + T; type first letter of each part of file name eg "ttto" matches "this_that_the.other"
-
format html: select all --> option + command + left-square-bracket
-
type "js" in AckMates Options input box to limit search to .js files
-
scope AckMate search by only opening subset of project
-
TextMate Basics Tutorial: http://projects.serenity.de/textmate/tutorials/basics/
-
Strip whitespace on save: http://blogobaggins.com/2009/03/31/waging-war-on-whitespace.html
-
Highlight whitespace:
- Go to Bundle Editor => Language => Ruby
- Add this pattern in your patterns block for your language:
{ name = 'invalid.brittspace'; match = '\s+$'; }
- Go to Textmate => Preferences => Fonts & Colors
- Add Element
- Name this element Brittspace
- Set scope selector: invalid.brittspace
-
Run ctrl + shift + V to lint ruby in Textmate
-
JSHint bundle: https://github.com/rondevera/jslintmate
-
Toggle btwn file editor and project drawer: ctrl + tab
- Vim key bindings: http://plugins.intellij.net/plugin/?ruby&id=164
- Jump to previous edit point:
#
- Edit text in paired delimiter:
c i {delimiter}
- Select text to next character:
v f {character}
- Select text to previous character:
v <shift> f {character}
- Run shell command:
:!{command}
- Create branch
- In general, branch from master
- Create a new branch that tracks a remote branch: # from github docs
git checkout -b foo_branch
git push -u origin foo_branch
- Create remote tracking branch:
git checkout -tb origin/foo_branch
- Delete remote branch:
git branch -rd origin/foo_branch
- Keep in sync with master:
- Pull method
git checkout master
git fetch
git pull origin master
git checkout <yourbranch>
git merge master
- No-local-master method
- One time, delete local master branch to avoid ever checking into master:
git branch -d master
- update all branch references (some ppl run this as a cron job):
git fetch origin
- Merge in master:
git merge origin/master
- One time, delete local master branch to avoid ever checking into master:
- Pull method
- Resolve merge conflicts
- fix issue
git add .
git commit
- save commit w/o message
- Use .gitignore to avoid checking in files unnecessary for the project
- Checkout individual file from external branch. The -- helps git avoid confusion by separating branch from paths). Also useful for git reset --hard on a single file. Note: this does not merge, ie history is lost:
git checkout <external branch> -- <path to file>
- Diff w/ stash:
git diff stash@{0}
- Diff two branches:
git diff <branch 1>..<branch 2>
, e.g.,git diff master..head
- See branch details:
git branch -vv
- Only show your commits:
git diff master..head --no-merges
- Use gui to only show your commits:
git difftool master..head --no-merges
- Run git stat against two branches:
git diff --name-status master..head
- Unstage a single file:
git reset HEAD <file>
- View a single file in a given commit:
git show <commit>:<path>
- Reset a single file to a given commit:
git reset <commit>:<path>
- GitX gui; handy for live editing staged changes
- Determine if branch exists on remote repo:
git log <repo name>/<branch name>
- Mac host, Windows vm network set up:
- Set Virtual Machine > Network Adapter to NAT
- Get host machine IP via ifconfig (under en0)
- In windows, edit C:\Windows\System32\drivers\etc\hosts to point localhost at the host machine IP
- How to get the ip address of the vm:
- launch vmware
- launch os in vmware
- run
cmd
(windows) to get terminal - run
ipconfig
to get the ip address of the machine
- Gas Mask /etc/hosts manager http://www.apple.com/downloads/macosx/development_tools/gasmask.html
- 1Password (+Dropbox) for password management
- Skitch for screenshots
- cmd + K to clear terminal
- copy pwd to clipboard: pwd | pbcopy
- cmd + click on file name in header to see folder nesting
- cmd + alt + escape to open force quit dialog
- Enable screen locking:
- launch Keychain Viewer
- open preferences
- Check "Show Status in Menu Bar"
- Click lock icon in menu bar and select "Lock Screen"
- Shift + Volume/Brightness to change volume/brightness silently
- Options + Volume/Brightness to change volume/brightness incrementally
- Increase Terminal responsiveness:
sudo rm -rf /private/var/log/asl/*.asl
See http://superuser.com/questions/31403/how-can-i-speed-up-terminal-app-or-iterm-on-mac-osx
- Show 3 lines of context w/ grep:
grep -a3 action
, eggem list -d | grep -a3 action
- Re-use the last argument in bash:
!$
, egmkdir /foo/bar/baz; cd !$
- dig can help w/ DNS debugging:
dig example.com
- find file fancy_file.js in current directory:
find . -type f -name 'fancy_file.js'
- Typodermic http://typodermicfonts.com/pages/shop
- Lanyrd uses http://fontdeck.com/
- Sanitize all input from end-users to reduce XSS and DB corruption risks
- Sanitize all content sourced from end-users prior to display to reduce stored XSS risk
- Validate all actions affecting privated data to reduce risks to session-fixation
- Use dynamic config for secure settings
- Enumerate all 3rd-party assets hosted on example.com
- Build kill switch into features, so we can turn off compromised product w/o waiting for fix; works well w/ fail-to-zero pattern
- 2011 CWE/SANS Top 25 Most Dangerous Software Errors: http://cwe.mitre.org/top25/index.html
- Web Page Test (recommended by SPDY developer) http://www.webpagetest.org/
- Boomerang http://yahoo.github.com/boomerang/doc/
- JavaScript performance playground: http://jsperf.com/
- YSLow
- Plug two keyboards into macbook pro for super easy pair programming
- Maintain wiki page for each proj and link to it in code comments
- Maintain run book for all services
- Establish code conventions to avoid style-related arguments
- Strip trailing whitespace, which clutters diffs
- Use spaces instead of tabs where applicable for consistent formatting across editors
- Nice git-based flow:
- each feature has corresponding branch, wiki, throttle key, shortcut url, tracking ticket, reviewboard, etc
- Docs
- file-level comment block at the top of files
- module description in a readme file in the module directory
- project description in a readme file in the project root
- cookbook in howto file in project root
- Name variables to be passed into function to match the function arg names
- Hudson for CI http://hudson-ci.org/
- Algorithms for Interviews: http://www.algorithmsforinterviews.com/
- Fail to zero: a service designed for throttling down to zero eg a web app that guarantees at least a static page
- ? help menu: the '?' key command launches help menu eg gmail github twitter
- Using tilde for home, ie '/~' instead of '/home'. See paper.li and linkedin
- Typewithme for live code editing http://typewith.me/
- Collabedit for live code editing http://collabedit.com/ w/ syntax highlighting
- Ask combo of:
- high-level explanatory skills, eg (~5):
- useful tools
- describe your most recent project and sketch the organization on the whiteboard
- what are you looking forward to in CSS3? HTML5? Some other lang?
- nitty-gritty (~15), eg:
- change the binding of this element in a jQuery callback
- target CSS for certain browsers
- demonstrate two approaches for inheritance in JS
- calculate the complexity of a given block of code
- integration, eg (~25):
- implement a simple button click handler
- implement a router in JS or Ruby
- implement a mocking tool for JS testing
- high-level explanatory skills, eg (~5):
- Check for dogmatism, eg "Is there any other way of doing this?", "What do you think about using another language?", etc
- Check for debugging awareness, eg "Can you see any problems w/ this approach?"
- Check for performance awareness, eg "Suppose you had to run this operation thousands of times. What are some issues you might run into, and how would you address them?"
- MongoHQ uses Stashboard http://www.stashboard.org/
- Many use Watch Mouse http://www.watchmouse.com/en/
- twitter counter
- isfollowing
- tweetstats
- favestar