For HTTP headers it's quite straightforward: draft-nottingham-http-link-header defines this.
Link: <http://example.com/>; rel="previous"; titile="Previous chapter"
| #!/bin/sh | |
| # Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the | |
| # CREATE block and create them in separate commands _after_ all the INSERTs. | |
| # Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk. | |
| # The mysqldump file is traversed only once. | |
| # Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite | |
| # Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite |
| #!/bin/bash | |
| # This file is for iTerm2 users. | |
| # | |
| # Put this file in /usr/local/bin/iterm-cmd-click-emacsclient | |
| # | |
| # You'll need to do the following at command line... | |
| # $ defaults write com.googlecode.iterm2 SemanticHistoryHandler /usr/local/bin/iterm-cmd-click-emacsclient | |
| emacsclient -e "(find-file \"$1\")" "(goto-line $2)" |
| // Ever needed to escape '\n' as '\\n'? This function does that for any character, | |
| // using hex and/or Unicode escape sequences (whichever are shortest). | |
| // Demo: http://mothereff.in/js-escapes | |
| function unicodeEscape(str) { | |
| return str.replace(/[\s\S]/g, function(character) { | |
| var escape = character.charCodeAt().toString(16), | |
| longhand = escape.length > 2; | |
| return '\\' + (longhand ? 'u' : 'x') + ('0000' + escape).slice(longhand ? -4 : -2); | |
| }); | |
| } |
For HTTP headers it's quite straightforward: draft-nottingham-http-link-header defines this.
Link: <http://example.com/>; rel="previous"; titile="Previous chapter"
These examples are type 3 RESTful API requests and responses. The JSON-HAL specification is used to implement HATEOAS.
Some of the examples are based on my work as architect of the RESTful API at http://www.hautelook.com. All proprietary information has been removed.
| 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" |
| { | |
| //Turn on tab completing over hitting enter | |
| "auto_complete_commit_on_tab": true, | |
| //Auto indenting on new line within block | |
| "auto_indent": true, | |
| //Mine is Solarized Dark | |
| "color_scheme": "Your theme of choice", |
| { | |
| "auto_complete": true, | |
| "auto_complete_commit_on_tab": false, | |
| "auto_complete_delay": 50, | |
| "auto_complete_selector": "source - comment", | |
| "auto_complete_size_limit": 4194304, | |
| "auto_complete_triggers": | |
| [ | |
| { | |
| "characters": "<", |
| # Thanks to @samsonjs for the cleaned up version: | |
| # https://gist.github.com/samsonjs/4076746 | |
| PREFIX=$HOME | |
| VERSION=1.2.3 | |
| # Install Protocol Buffers | |
| wget http://protobuf.googlecode.com/files/protobuf-2.4.1.tar.bz2 | |
| tar -xf protobuf-2.4.1.tar.bz2 | |
| cd protobuf-2.4.1 |