From 5a9dcd767bb997f96e082bb69343ddf044646de0 Mon Sep 17 00:00:00 2001 From: Artem Sapegin Date: Sun, 23 Jun 2013 10:01:58 +0400 Subject: [PATCH 1/5] Colors for iTerm. --- color/Readme.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/color/Readme.md b/color/Readme.md index 8d9e844..0848ee1 100644 --- a/color/Readme.md +++ b/color/Readme.md @@ -3,3 +3,22 @@ ![Terminal.app](https://raw.github.com/sapegin/dotfiles/master/color/squirrelsong_terminal.png) Inspired by [Earthsong](https://github.com/daylerees/colour-schemes/blob/master/README.md#earthsong) Sublime Text scheme by [Dayle Rees](https://github.com/daylerees). + +## Colors + +### iTerm + +* Black: 98/65/28 +* Red: 191/60/36 +* Green: 53/161/41 +* Yellow: 164/111/0 +* Blue: 61/103/201 +* Magenta: 198/58/167 +* Cyan: 41/132/138 +* White: 183/147/119 +* Foreground: 132/113/92 +* Background: 35/28/22 +* Bold: 255/255/255 +* Selection: 16/13/8 +* Selected Text: 191/175/147 +* \ No newline at end of file From fec4993f188d0706af7debc8a4346e1b8d617e49 Mon Sep 17 00:00:00 2001 From: Artem Sapegin Date: Sun, 23 Jun 2013 10:03:17 +0400 Subject: [PATCH 2/5] Update Sublime config. --- sublime/User/Default (OSX).sublime-keymap | 29 +------------------ sublime/User/Package Control.sublime-settings | 2 ++ sublime/User/Preferences.sublime-settings | 1 + 3 files changed, 4 insertions(+), 28 deletions(-) diff --git a/sublime/User/Default (OSX).sublime-keymap b/sublime/User/Default (OSX).sublime-keymap index ae24a24..16a326c 100644 --- a/sublime/User/Default (OSX).sublime-keymap +++ b/sublime/User/Default (OSX).sublime-keymap @@ -5,32 +5,5 @@ { "keys": ["super+shift+v"], "command": "paste" }, { "keys": ["f3"], "command": "find_next" }, { "keys": ["super+r"], "command": "show_panel", "args": {"panel": "replace"} }, - { "keys": ["super+g"], "command": "show_overlay", "args": {"overlay": "goto", "text": ":"} }, - - // Wrap with quotes and brackets without autopairing (auto_match_enabled=false) - { "keys": ["\""], "command": "insert_snippet", "args": {"contents": "\"${0:$SELECTION}\""}, "context": - [ - { "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true } - ] - }, - { "keys": ["'"], "command": "insert_snippet", "args": {"contents": "'${0:$SELECTION}'"}, "context": - [ - { "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true } - ] - }, - { "keys": ["("], "command": "insert_snippet", "args": {"contents": "(${0:$SELECTION})"}, "context": - [ - { "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true } - ] - }, - { "keys": ["["], "command": "insert_snippet", "args": {"contents": "[${0:$SELECTION}]"}, "context": - [ - { "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true } - ] - }, - { "keys": ["{"], "command": "insert_snippet", "args": {"contents": "{${0:$SELECTION}}"}, "context": - [ - { "key": "selection_empty", "operator": "equal", "operand": false, "match_all": true } - ] - } + { "keys": ["super+g"], "command": "show_overlay", "args": {"overlay": "goto", "text": ":"} } ] \ No newline at end of file diff --git a/sublime/User/Package Control.sublime-settings b/sublime/User/Package Control.sublime-settings index 38ceb40..2984707 100644 --- a/sublime/User/Package Control.sublime-settings +++ b/sublime/User/Package Control.sublime-settings @@ -12,6 +12,8 @@ "Handlebars", "Hayaku - tools for writing CSS faster", "Inc-Dec-Value", + "JavaScript Refactor", + "Koken", "MarkdownEditing", "Package Control", "Stylus", diff --git a/sublime/User/Preferences.sublime-settings b/sublime/User/Preferences.sublime-settings index 9da6c26..24c87f5 100644 --- a/sublime/User/Preferences.sublime-settings +++ b/sublime/User/Preferences.sublime-settings @@ -1,6 +1,7 @@ { "auto_complete_delay": 1000, "auto_match_enabled": false, + "caret_style": "phase", "color_scheme": "Packages/User/Tomorrow.tmTheme", "create_window_at_startup": false, "default_line_ending": "unix", From e99bd23a821550b814b665c64460b3d8e6b34bdd Mon Sep 17 00:00:00 2001 From: Artem Sapegin Date: Sun, 23 Jun 2013 10:03:36 +0400 Subject: [PATCH 3/5] New script: httpcompression. --- bin/httpcompression | 128 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100755 bin/httpcompression diff --git a/bin/httpcompression b/bin/httpcompression new file mode 100755 index 0000000..59586b4 --- /dev/null +++ b/bin/httpcompression @@ -0,0 +1,128 @@ +#!/usr/bin/env bash + +# Test if HTTP compression (RFC 2616 + SDCH) is enabled for a given URL +# https://github.com/mathiasbynens/dotfiles/blob/master/bin/httpcompression + +declare -r hUA="Mozilla/5.0 Gecko" +declare -r hAE="Accept-Encoding: gzip, deflate, sdch" +declare -r maxConTime=15 +declare -r maxTime=30 + +declare availDicts="" dict="" dictClientID="" dicts="" headers="" i="" \ + indent="" url="" encoding="" urlHeaders="" + +headers="$( curl --connect-timeout $maxConTime \ + -A "$hUA" `# Send a fake UA string for sites + # that sniff it instead of using + # the Accept-Encoding header` \ + -D - `# Get response headers` \ + -H "$hAE" \ + -L `# If the page was moved to a different + # location, redo the request` \ + -m $maxTime \ + -s `# Don\'t show the progress meter` \ + -S `# Show error messages` \ + -o /dev/null `# Ignore content` \ + "$1" )" \ +&& ( \ + + url="$1" + + # Iterate over the headers of all redirects + while [ -n "$headers" ]; do + + # Get headers for the "current" URL + urlHeaders="$( printf "%s" "$headers" | + sed -n '1,/^HTTP/p' )" + + # Remove the headers for the "current" URL + headers="${headers/"$urlHeaders"/}" + + # ---------------------------------------------------------------------- + # | SDCH | + # ---------------------------------------------------------------------- + + # SDCH Specification: + # - www.blogs.zeenor.com/wp-content/uploads/2011/01/Shared_Dictionary_Compression_over_HTTP.pdf + + # Check if the server advertised any dictionaries + dicts="$( printf "%s" "$urlHeaders" | + grep -i 'Get-Dictionary:' | + cut -d':' -f2 | + sed s/,/\ /g )" + + if [ -n "$dicts" ]; then + + availDicts="" + dict="" + + for i in $dicts; do + + # Check If the dictionary location is specified as a path, + # and if so, construct it's URL from the host name of the + # referrer URL + [[ "$i" != http* ]] \ + && dict="$(printf "$url" | + sed -En 's/([^/]*\/\/)?([^/]*)\/?.*/\1\2/p')" + + dict="$dict$i" + + # Request the dictionaries from the server and + # construct the `Avail-Dictionary` header value + # + # [ The user agent identifier for a dictionary is defined + # as the URL-safe base64 encoding (as described in RFC + # 3548, section 4 [RFC3548]) of the first 48 bits (bits + # 0..47) of the dictionary's SHA-256 digest ] + # + dictClientID="$( curl --connect-timeout $maxConTime \ + -A "$hUA" -LsS -m $maxTime "$dict" | + openssl dgst -sha256 -binary | + openssl base64 | + cut -c 1-8 | + sed -e 's/\+/-/' -e 's/\//_/' )" + + [ -n $availDicts ] && availDicts="$adics,$dictClientID" \ + || availDicts="$dictClientID" + + done + + # Redo the request (advertising the available dictionaries) + # and replace the old resulted headers with the new ones + urlHeaders="$( curl --connect-timeout $maxConTime \ + -A "$hUA" -D - -H "$hAE" \ + -H "Avail-Dictionary: $availDicts" \ + -m $maxTime -o /dev/null -sS "$1" )" + fi + + # ---------------------------------------------------------------------- + + # Get the content encoding header values + encoding="$( printf "%s" "$urlHeaders" | + grep -i 'Content-Encoding:' | + cut -d' ' -f2 | + tr "\r" "," | + tr -d "\n" | + sed 's/,$//' )" + + [ -n "$encoding" ] && encoding="[$encoding]" + + # Print the output for the "current" URL + if [ "$url" != "$1" ]; then + printf "%s\n" "$indent$url $encoding" + indent=" "$indent + else + printf "\n%s\n" " $1 $encoding" + indent=" ↳" + fi + + # Get the next URL value + url="$( printf "%s" "$urlHeaders" | + grep -i 'Location' | + sed -e 's/Location://' | + tr -d '\r' )" + + done + printf "\n" + +) || printf "" From 43eded7ffafd7c8f1cc7c0c47e5d4687b17536ed Mon Sep 17 00:00:00 2001 From: Artem Sapegin Date: Tue, 2 Jul 2013 00:21:21 +0400 Subject: [PATCH 4/5] Release: bower.json, Gruntfile.coffee. --- bin/release | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/release b/bin/release index c3cbcdd..fe6c718 100755 --- a/bin/release +++ b/bin/release @@ -32,7 +32,7 @@ fi # Read existing versions jq_ver=$(find . -maxdepth 1 -name "*.jquery.json" | xargs cat | jq -r ".version") -cmpnt_ver=$(find . -maxdepth 1 -name "component.json" | xargs cat | jq -r ".version") +cmpnt_ver=$(find . -maxdepth 1 -name "bower.json" | xargs cat | jq -r ".version") pkg_ver=$(find . -maxdepth 1 -name "package.json" | xargs cat | jq -r ".version") # Non npm package @@ -47,7 +47,7 @@ current_ver= # Validate current versions and determine new version if [ "$1" == "major" ] || [ "$1" == "minor" ] || [ "$1" == "patch" ]; then - dont_match="Versions in *.jquery.json, component.json and package.json don’t match." + dont_match="Versions in *.jquery.json, bower.json and package.json don’t match." if [ -n "$jq_ver" ] && [ "$current_ver" != "$jq_ver" ]; then error $dont_match; fi if [ -n "$cmpnt_ver" ] && [ "$current_ver" != "$cmpnt_ver" ]; then error $dont_match; fi if [ -n "$pkg_ver" ] && [ "$current_ver" != "$pkg_ver" ]; then error $dont_match; fi @@ -62,9 +62,9 @@ fi header "Releasing v$new_ver..." -# Update component.json +# Update bower.json if [ -n "$cmpnt_ver" ]; then - sed -i '' "s^$current_ver^$new_ver^" component.json + sed -i '' "s^$current_ver^$new_ver^" bower.json fi # Update package.json @@ -78,7 +78,7 @@ if [ -n "$jq_ver" ]; then fi # Build files -[ -f Gruntfile.js ] && grunt build +[ -f Gruntfile.js ] || [ -f Gruntfile.coffee ] && grunt build if [ -f src/Gruntfile.js ]; then pushd src grunt build From 77adeaf75a353f89c7890804be4c7d28d38e5c49 Mon Sep 17 00:00:00 2001 From: Artem Sapegin Date: Tue, 2 Jul 2013 00:21:32 +0400 Subject: [PATCH 5/5] Sublime: update settings. --- sublime/User/Preferences.sublime-settings | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sublime/User/Preferences.sublime-settings b/sublime/User/Preferences.sublime-settings index 24c87f5..f5d9c37 100644 --- a/sublime/User/Preferences.sublime-settings +++ b/sublime/User/Preferences.sublime-settings @@ -10,7 +10,7 @@ "drag_text": true, "fallback_encoding": "Cyrillic (Windows 1251)", "font_face": "Consolas", - "font_size": 15, + "font_size": 15.0, "hayaku_CSS_colors_case": "lowercase", "hayaku_CSS_numbers_leading_zero": false, "hayaku_CSS_syntax_autoguess":