This article is now published on my website: Prefer Subshells for Context.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery.placeholder = function() { | |
$('[placeholder]').focus(function() { | |
var input = $(this); | |
if (input.hasClass('placeholder')) { | |
input.val(''); | |
input.removeClass('placeholder'); | |
} | |
}).blur(function() { | |
var input = $(this); | |
if (input.val() === '') { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* The code below should be included in a separate file using IE conditional comments | |
as it causes errors in IE8(+?) */ | |
/** | |
* DD_belatedPNG: Adds IE6 support: PNG images for CSS background-image and HTML <IMG/>. | |
* Author: Drew Diller | |
* Email: drew.diller@gmail.com | |
* URL: http://www.dillerdesign.com/experiment/DD_belatedPNG/ | |
* Version: 0.0.8a | |
* Licensed under the MIT License: http://dillerdesign.com/experiment/DD_belatedPNG/#license |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ಠ_ಠ | |
( ͡° ͜ʖ ͡°) | |
¯\_(ツ)_/¯ | |
(╯°□°)╯︵ ┻━┻ | |
http://www.fileformat.info/convert/text/upside-down.htm | |
WRTTN http://wrttn.me/30dbfd/ | |
Unicode Emoticons |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This library was developed by Will Honey. | |
It is licensed under the GPLv3 Open Source License | |
This library requires the underscore library found at http://documentcloud.github.com/underscore/ | |
This library requires the underscore string library found at http://edtsech.github.com/underscore.string/ | |
This library requires the support of localStorage. Updates could be easily made to change that. | |
*/ | |
/* jslint adsafe: false, devel: true, regexp: true, browser: true, vars: true, nomen: true, maxerr: 50, indent: 4 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
YOU'LL BE ABLE TO PERFORM A CROSS DOMAIN REQUEST IF YOUR APP IS CERTIFIED OR PRIVILEDGED. | |
FOR MORE INFO CHECK THE PERMISSIONS MATRIX: https://docs.google.com/spreadsheet/ccc?key=0Akyz_Bqjgf5pdENVekxYRjBTX0dCXzItMnRyUU1RQ0E#gid=0 | |
First you'll need to setup the permission for doing the cross domain request on your application manifest. | |
Go to your app manifest, to the permissions section and add the following: | |
"systemXHR": {} | |
The BBC has a server-side image service which provides developers with multiple sized versions of any image they request. It works in a similar fashion to http://placehold.it/ but it also handles the image ratios returned (where as placehold.it doesn't).
The original BBC News process (and my re-working of the script) follows roughly these steps...
- Create new instance of ImageEnhancer
- Change any
div
s within the page (which have a class ofdelayed-image-load
) into a transparent GIF using a Base64 encoded string.- We set the
width
&height
HTML attributes of the image to the required size - We know what size the image needs to be because each
div
has customdata-attr
set server-side to the size of the image - We then set a class of
image-replace
onto each newly created transparent image
- We set the
- We use a 250ms
setTimeout
to unblock the UI thread and which calls a functionresizeImages
which enhances theimage-replace
images so their source is now set to a URL whe
Timers provided by systemd can be used as cronjob replacements. More at man systemd.timer
.
Suppose we want to periodically trigger cleanup tasks for a baz
utility. We 'll create a baz-cleanup.service
which will
be triggered by a baz-cleanup.timer
.
Create a minimal service at /etc/systemd/system/baz-cleanup.service
: