TLDR: Use for...of instead of forEach() in asynchronous code.
For legacy browsers, use for(...;...;...) or [].reduce()
To execute the promises in parallel, use Promise.all([].map(...))
| function api( url) { | |
| var key = 'clCache' + url.replace(/^https?\:\/\//i, ""); | |
| var local; | |
| //this line uses underscores.js! | |
| if ( ! _.isString( local ) || "null" == local ) { | |
| return $.get( url ).then( function ( r ) { | |
| r = self.addPrefixes( r, prefix ); | |
| localStorage.setItem( key, JSON.stringify( r ) ); | |
| return r; |
| /******************************************************************************* | |
| * Description: | |
| * | |
| * Gulp file to push changes to remote servers (eg: staging/production) | |
| * | |
| * Usage: | |
| * | |
| * gulp deploy --target | |
| * | |
| * Examples: |
| <?php | |
| /** | |
| * "Friendlier, Safer WordPress Admin Areas" | |
| * Presented by Cliff Seal at WordCamp Atlanta 2015 and Asheville 2016 | |
| * Slides: http://www.slideshare.net/cliffseal/wp-admin | |
| * | |
| * Plugin Name: A Better Admin Experience | |
| * Plugin URI: http://evermoresites.com | |
| * Description: Cleans up and sanitizes the WordPress admin area | |
| * Version: 1.0 |
| // ---- | |
| // Sass (v3.4.12) | |
| // Compass (v1.0.3) | |
| // ---- | |
| $baseSize: 16px; | |
| $convertBase: $baseSize; | |
| html { | |
| font-size: percentage($baseSize / 16px); |
| // List of modules used. | |
| var gulp = require('gulp'), | |
| bump = require('gulp-bump'), // Generates new version. | |
| argv = require('yargs') | |
| .default('release', 'patch') | |
| .argv, // CLI parser. | |
| fs = require('fs'), // Used by bump. | |
| semver = require('semver'), // Used by bump. | |
| git = require('gulp-git'), // Git wrapper. | |
| jshint = require('gulp-jshint'), // Lints JS. |
| #!/bin/bash | |
| # | |
| # This script configures WordPress file permissions based on recommendations | |
| # from http://codex.wordpress.org/Hardening_WordPress#File_permissions | |
| # | |
| # Author: Michael Conigliaro | |
| # | |
| WP_OWNER=changeme # <-- wordpress owner | |
| WP_GROUP=changeme # <-- wordpress group | |
| WP_ROOT=/home/changeme # <-- wordpress root directory |
| <?xml version="1.0" encoding="UTF-8" ?> | |
| <rss version="2.0" | |
| xmlns:excerpt="http://wordpress.org/export/1.2/excerpt/" | |
| xmlns:content="http://purl.org/rss/1.0/modules/content/" | |
| xmlns:wfw="http://wellformedweb.org/CommentAPI/" | |
| xmlns:dc="http://purl.org/dc/elements/1.1/" | |
| xmlns:wp="http://wordpress.org/export/1.2/" | |
| > |
| #!/bin/bash | |
| for file in `find .` | |
| do | |
| EXTENSION="${file##*.}" | |
| if [ "$EXTENSION" == "php" ] || [ "$EXTENSION" == "phtml" ] | |
| then | |
| RESULTS=`php -l $file` |
| <?php | |
| namespace Treffynnon; | |
| /** | |
| * A PHP class to access a PHP array via dot notation | |
| * (Agavi http://www.agavi.org was the inspiration). | |
| * | |
| * This was hacked in to an existing codebase hence the | |
| * global config array variable. |