module.exports = function(grunt) { | |
'use strict'; | |
var TEMP_HAR_RESOURCE = '.har.tmp'; | |
var exec = require('child_process').exec, | |
YSLOW = require('yslow').YSLOW, | |
doc = require('jsdom').jsdom(), | |
util = grunt.utils || grunt.util, |
[color] | |
ui = always | |
[color "branch"] | |
current = yellow reverse | |
local = yellow | |
remote = green | |
[color "diff"] | |
meta = yellow bold | |
frag = magenta bold | |
old = red bold |
function tabname { | |
printf "\e]1;$1\a" | |
} | |
if [ x`type -t cd` == "xfunction" ]; then | |
# previously wrapped cd | |
eval $(type cd | grep -v 'cd is a function' | sed 's/^cd/original_cd/' | sed 's/^}/;}/' ) | |
else | |
# builtin | |
eval "original_cd() { builtin cd \$*; }" |
This year marks the first year that we are doing full scale rendering of our SPA application on our mobile.walmart.com Node.js tier, which has provided a number of challenges that are very different from the mostly IO-bound load of our prior #nodebf.
The infrastructure outlined for last year is the same but our Home, Item and a few other pages are prerendered on the server using fruit-loops and hula-hoop to execute an optimized version of our client-side JavaScript and provide a SEO and first-load friendly version of the site.
To support the additional CPU load concerns as peak, which we hope will be unfounded or mitigated by our work, we have also taken a variety of steps to increase cache lifetimes of the pages that are being served in this manner. In order of their impact:
RED="\[\033[0;31m\]" | |
YELLOW="\[\033[0;33m\]" | |
GREEN="\[\033[0;32m\]" | |
BLUE="\[\033[0;34m\]" | |
LIGHT_RED="\[\033[1;31m\]" | |
LIGHT_GREEN="\[\033[1;32m\]" | |
WHITE="\[\033[1;37m\]" | |
LIGHT_GRAY="\[\033[0;37m\]" | |
COLOR_NONE="\[\e[0m\]" |
<!-- standard viewport tag to set the viewport to the device's width | |
, Android 2.3 devices need this so 100% width works properly and | |
doesn't allow children to blow up the viewport width--> | |
<meta name="viewport" id="vp" content="initial-scale=1.0,user-scalable=no,maximum-scale=1,width=device-width" /> | |
<!-- width=device-width causes the iPhone 5 to letterbox the app, so | |
we want to exclude it for iPhone 5 to allow full screen apps --> | |
<meta name="viewport" id="vp" content="initial-scale=1.0,user-scalable=no,maximum-scale=1" media="(device-height: 568px)" /> | |
<!-- provide the splash screens for iPhone 5 and previous --> | |
<link href="assets/splashs/splash_1096.png" rel="apple-touch-startup-image" media="(device-height: 568px)"> | |
<link href="assets/splashs/splash_iphone_2x.png" rel="apple-touch-startup-image" sizes="640x960" media="(device-height: 480px)"> |
#!/bin/sh | |
CMD="$1" | |
RATE="$2" | |
DELAY="$3" | |
if [ "$RATE" = "" ] ; then | |
RATE=500 | |
fi | |
if [ "$DELAY" = "" ] ; then |
# bash alias | |
alias subl='/Applications/Sublime\ Text\ 2.app/Contents/SharedSupport/bin/subl' | |
# bash function, usage: $ st -p [projectname] -opt2 -opt3 | |
function st() { | |
if [ -n "$1" -a -n "$2" ]; then # if more than one argument | |
if [ "$1" = "-p" -o "$1" = "--project" ]; then # if arg1 is -p or --project | |
local projectfile="$2" | |
[[ $projectfile != *.sublime-project ]] && projectfile="$2.sublime-project" # detect if arg2 already includes the ext | |
if [ -e $projectfile ]; then # does project file exist? |
// Fetch the template HTML from the DOM, hand it over to `Underscore.template`, | |
// assign some variables, and set up a `partial` method. | |
var template = $("#tmpl-main-section").html(), | |
compiledTemplate = _.template( template, { | |
models: aCollectionOfThings, | |
// See template examples below on usage. It's all very complex. | |
partial: function( partialName, variables ) { | |
return _.template( | |
$( "#tmpl-" + partialName ).html(), |