This is just a personal script to help me remember all the steps required to setup a new osx machine in their correct order. I do not advise you to follow this guide if you don't know what you're doing.
module.exports = function(grunt) { | |
grunt.registerTask('buildapp', function(dir) { | |
var done = this.async(); | |
grunt.log.writeln('processing ' + dir); | |
grunt.util.spawn({ | |
grunt: true, | |
args:['jshint', 'build', 'test', 'deploy'], |
sites | |
|__ ms.dev | |
| |__ content | |
| |__ index.php | |
| |__ wp => ../../wordpress/stable | |
| |__ wp-config.php | |
|__ one.dev | |
| |__ content | |
| |__ index.php | |
| |__ wp => ../../wordpress/stable |
<?php | |
$path = str_replace( $_SERVER['DOCUMENT_ROOT'], '', dirname( $_SERVER['SCRIPT_FILENAME'] ) ); | |
$path_parts = explode( '/', $path ); | |
while ( count( $path_parts ) > 0 ) { | |
$path = $_SERVER['DOCUMENT_ROOT'] . implode( '/', $path_parts ) . '/wp-config.php'; | |
if ( file_exists( $path ) ) { | |
include( $path ); | |
break; | |
} else { | |
array_pop( $path_parts ); |
[2013-08-09 19:40:52] WP.INFO: Started GET /download/ for 192.168.50.1 at 2013-08-09 19:40:52 [] [] | |
[2013-08-09 19:40:52] WP.INFO: SQL Query: SELECT option_value FROM wp_options WHERE option_name = 'stylesheet_root' LIMIT 1 [] [] | |
[2013-08-09 19:40:52] WP.INFO: SQL Query: SELECT * FROM wp_users WHERE user_login = 'admin' [] [] | |
[2013-08-09 19:40:52] WP.INFO: SQL Query: SELECT user_id, meta_key, meta_value FROM wp_usermeta WHERE user_id IN (1) [] [] | |
[2013-08-09 19:40:52] WP.INFO: SQL Query: SELECT option_value FROM wp_options WHERE option_name = 'widget_pages' LIMIT 1 [] [] | |
[2013-08-09 19:40:52] WP.INFO: SQL Query: SELECT option_value FROM wp_options WHERE option_name = 'widget_calendar' LIMIT 1 [] [] | |
[2013-08-09 19:40:52] WP.INFO: SQL Query: SELECT option_value FROM wp_options WHERE option_name = 'widget_tag_cloud' LIMIT 1 [] [] | |
[2013-08-09 19:40:52] WP.INFO: SQL Query: SELECT option_value FROM wp_options WHERE option_name = 'widget_nav_menu' LIMIT 1 [] [] | |
[2013-08-09 19:40:52] WP.INFO: SQL Quer |
/* | |
* A vim insert mode foot pedal | |
*/ | |
#include <Bounce.h> | |
int ledPin = 11; | |
int footPedalPin = 9; | |
// 10 = debounce time in ms |
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
<?php | |
/** | |
* Return the ID of the uploaded attachment of a given type | |
* | |
* @since 2.5.0 | |
* | |
* @param int $id The uploaded attachment ID | |
*/ | |
echo apply_filters("async_upload_{$type}", $id); |
THIS REPO HAS MOVED! It has graduated to a dedicated GitHub project: https://github.com/x-team/vassh
The big pain of doing vagrant ssh
is that it doesn’t drop you into the corresponding working directory in the Vagrant guest’s synced_folder, so you have to cd
to the dir and then run whatever you needed to do (e.g. wp core update
). This is the problem that vassh
solves: it will make sure you start out in the corresponding directory. So if you’re in your WordPress project on your host machine, all you need to do is:
$ vassh wp core update
There’s also a wrapper called vasshin
which will shell you into Vagrant at the current directory, with a prompt for entering commands. This gets you colors and interactive TTY. You can also pass commands as arguments to vasshin
to have them executed right away in the colorized TTY (with some additional Vagrant .bash_login
echoes and SSH connection close):
'use strict' | |
path = require 'path' | |
parse = require('url').parse; | |
module.exports = (grunt) -> | |
grunt.initConfig | |
qunit: | |
all: ['tests/**/*.html'] | |
clean: |