Models | Examples |
---|---|
Display ads | Yahoo! |
Search ads |
'use strict'; | |
var path = require('path'); | |
var lrSnippet = require('grunt-contrib-livereload/lib/utils').livereloadSnippet; | |
var folderMount = function folderMount(connect, point) { | |
return connect.static(path.resolve(point)); | |
}; | |
module.exports = function(grunt) { |
#!/bin/bash | |
# git-cleanup-repo | |
# | |
# Author: Rob Miller <[email protected]> | |
# Adapted from the original by Yorick Sijsling | |
git checkout master &> /dev/null | |
# Make sure we're working with the most up-to-date version of master. | |
git fetch |
<ifmodule mod_deflate.c> | |
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript | |
</ifmodule> |
$(document).on('click', 'a[href*="#"]', function(e) { | |
var $anchor = $(this), | |
hash = $anchor.attr('href'), | |
url = hash.substr(0, hash.indexOf('#')); | |
hash = hash.substr(hash.indexOf('#')); | |
// if it is just the hash, we should reset it to body, which will make it scroll to the top of the page. | |
if(hash == '#') hash = 'body'; | |
// check if we have an url, and if it is on the current page and the element exists |
--- | |
data: [ | |
[ "apple", "red", "round" ], | |
[ "banana", "yellow", "long" ], | |
[ "potato", "brown", "bumpy" ] | |
] | |
--- | |
<h1>Hello</h1> |
# Description: | |
# Needing a drink. Fast. | |
# | |
# Commands: | |
# hubot alcohol - fetch a drink | |
# hubot ALCOHOL - fetch three drinks | |
# hubot ALCOHOL! - fetch a random number of drinks | |
module.exports = (robot) -> | |
robot.respond /(alcohol|ALCOHOL)(!)?$/i, (msg) -> |
If you must nest functions in a way that requires access to multiple this', alias outer this to something meaningful - describe the value it's holding. Treat this as the invisible first argument.
In general though, avoiding the situation (nested functions and frivolous use of this
) will frequently produce clearer results.
I was accidentally included in a discussion on how to best name this
in nested functions in JavaScript. +1's were given to this suggestion of using _this
.
Giving style advice on naming nested this
without a meaningful context isn't too helpful in my opinion. Examples below have been altered to have at least some context, although a completely contrived and stupid one.
/** | |
* Implements hook_preprocess_page(). | |
*/ | |
function NAME_preprocess_html(&$vars) { | |
if (arg(0) == "colorbox") { | |
// disable the Toolbar when we're in a colorbox popup | |
unset($vars['page']['page_top']['toolbar']); | |
} | |
} |
I asked the following on Twitter the other day:
Thoughts, anyone? "Seems like there are a million ways to do retina sprites with Compass. What's the best way? #sass #compass" tweet
Specifically, what I wanted to do was to reference an icon once, like so:
.selector { @include the-sprite('once');