(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| $.ajaxPrefilter(function(options, originalOptions, jqXHR){ | |
| if(!options.ajaxCache) { | |
| return; | |
| } | |
| var cacheOptions = options.ajaxCache; | |
| var timeToLive = cacheOptions.timeToLive || 1000 * 60 * 60, //1hour | |
| cacheKey = cacheOptions.cacheKey || options.type + options.url, | |
| cached = JSON.parse(localStorage.getItem(cacheKey)); |
| //Primitive Type Comparison | |
| var a = 1; | |
| var b = 1; | |
| var c = a; | |
| console.log(a == b); //true | |
| console.log(a === b); //true | |
| console.log(a == c); //true | |
| console.log(a === c); //true |
| /** | |
| * Prefilter for caching ajax calls - adapted from | |
| * https://github.com/paulirish/jquery-ajax-localstorage-cache, made to work with jqXHR Deferred Promises. | |
| * See also $.ajaxTransport. | |
| * New parameters available on the ajax call: | |
| * localCache : true, // required if we want to use the cache functionality | |
| * cacheTTL : 1, // in hours. Optional | |
| * cacheKey : 'post', // optional | |
| * isCacheValid : function // optional - return true for valid, false for invalid | |
| * @method $.ajaxPrefilter |
| /** | |
| * Adds a Check All Option to a group of Checkboxes in Drupal jQuery Plugin | |
| * | |
| * To make this work you need pass to this function, a div that is a decendent | |
| of a form and an ancestor of multiple checkboxes. It is specifically tuned to | |
| drupal, but can be used for any html by setting the options. Here's and | |
| example, where .form-item-list is fapi element of type checkboxes. | |
| * | |
| * @code | |
| * $('#my-form .form-item-list').drupalCheckAll(); |
| #!/bin/bash | |
| # usage: drupal-quick-dump user host database | |
| USER="$1" | |
| HOST="$2" | |
| DB="$3" | |
| DATE=`date +%Y%m%d` | |
| # Get User Password | |
| echo "Please provide the password for ${USER} on db ${DB} hosted at ${HOST}:" |
| <?php | |
| /** | |
| * @file | |
| * local.settings.php (Drupal 6.x) | |
| * | |
| * This settings file is intended to contain settings specific to a local | |
| * development environment, by overriding options set in settings.php. | |
| * | |
| * Include this file from your regular settings.php by including this at the | |
| * bottom: |
| var getCache = (function() { | |
| var supportsLocalStorage = 'localStorage' in window; | |
| // both functions return a promise, so no matter which function | |
| // gets called inside getCache, you get the same API. | |
| function getJSON(key) { | |
| return jQuery.getJSON(key).then(function(data) { | |
| localStorage.setItem(key, JSON.stringify(data)); | |
| }).promise(); | |
| } |
| <?php | |
| /** | |
| * This is free and unencumbered software released into the public domain. | |
| * | |
| * Anyone is free to copy, modify, publish, use, compile, sell, or | |
| * distribute this software, either in source code form or as a compiled | |
| * binary, for any purpose, commercial or non-commercial, and by any | |
| * means. | |
| * |
| <?php | |
| mb_internal_encoding("UTF-8"); | |
| $desc = <<<TEXT | |
| <p>Lines of text SHOULD NOT be longer than 75 octets, (och hör på den) excluding the line break. Long content lines SHOULD be split into a multiple line representations using a line "folding" technique.</p> | |
| That is, a long line can be split between any two characters by inserting a CRLF | |
| immediately followed by a single linear white space character (i.e., | |
| SPACE, <b>US-ASCII</b> decimal 32 or HTAB, US-ASCII decimal 9). Any sequence | |
| of CRLF followed immediately by a single linear white space character | |
| is ignored (i.e., removed) when processing the content type. |