View deleteEmptyTrees.js
'use strict';
var walk = require('walkdir');
var fs = require('fs');
var path = require('path');
var extfs = require('extfs');
var deleteEmptyPath = function deleteEmptyPath(delPath, cb) {
extfs.isEmpty(delPath, function (isEmpty) {
if (isEmpty) {
View Thinking-points.md

(You should be able to clone this gist and run node example[x].js for each JS file here to do the exercises).

  • What do you think will happen when you execute example1.js?
  • What happens if you comment out line 12 and run example1.js? Why?
  • What do think will happen when you execute example2.js? Did it work as you expected?
  • What would happen if you added a new line to the end of example3.js and console.log(mySecretValue);? Why?
  • What type is secretKeeper on line 12 of example4.js? How did it get assigned?
  • What code does secretKeeper() execute when it is invoked on line 13 of example4.js? What does it return and how?
  • What type is secret as of line 13 of example4.js?
  • What will log to the console in line 14 of example5.js? Line 15?
View gulp-strip-scripts.js
/* global Buffer, console */
/**
* Strip inline <script> elements and push each
* <script> tag's contents to `file.scripts`
* (Array; each element is the contents of a script element)
*/
'use strict';
var through = require('through2');
var gutil = require('gulp-util');
var cheerio = require('cheerio');
View gulp-template-through2.js
var through = require('through2');
var gutil = require('gulp-util');
// Anything in this scope will execute once on `require`
module.exports = function thisIsMyGulpPlugin() {
// Do some stuff here if you want
// Anything at this scope level will execute once per
// task-level stream (i.e. every time a task is invoked
// and the stream piped through this plugin)
View _button-group.scss
body {
margin: 2em;
}
.button {
background-color: #007dc6;
border-radius: 0.25em;
box-sizing: border-box;
color: #fff;
display: inline-block;
View pxToEm.js
$.fn.toEm = function(settings){
settings = jQuery.extend({
scope: 'body',
asNumber: false
}, settings);
var that = parseInt(this[0],10),
inEms,
scopeTest = jQuery('<div style="display: none; font-size: 1em; margin: 0; padding:0; height: auto; line-height: 1; border:0;">&nbsp;</div>').appendTo(settings.scope),
scopeVal = scopeTest.height();
scopeTest.remove();
View drupal.mdown

Hokay, please keep in mind I know nothing about Drupal 8, so much of what I comment on here may well be problems that are already being addressed or have been solved therein. AGAIN: If I make a poopoo face at something that has been rectified in D8, please don't be terribly irritated at me!

I am a longtime D6 dev, and have been working in D7 for the past few months, as well.

Core issues as I see them in terms of the mobile Web and the pan-device Web as a whole:

  • Controllers need to be separated from template/view layers in so much as is possible. There is still too much munging between page callbacks/action and the rendered response. I think this is sort of part of what render arrays aim to ease in D7, but render arrays are complex and abysmally documented. I have asked around and no one can find true documentation on them. They're far too convoluted to figure out on one's own unless one has a lot of time, which I sadly do not.
  • Let me clarify: I believe in the kind of idea that a render array repr
View oof.js
var Swiper = function(el) {
var startX, startY, lastX, lastY;
var minswipe;
var init=function(el) {
Swiper.minswipe = 50;
el.bind('touchstart', function(event) {
Swiper.startX = event.originalEvent.targetTouches[0].screenX;
Swiper.startY = event.originalEvent.targetTouches[0].screenY;
$(this).bind('touchmove', function(event) {
Swiper.lastX = event.originalEvent.targetTouches[0].screenX;
View swiper.js
var Swiper = function(el) {
var startX, startY, lastX, lastY;
var minswipe;
var init=function(el) {
Swiper.minswipe = 50;
el.bind('touchstart', function(event) {
Swiper.startX = event.originalEvent.targetTouches[0].screenX;
Swiper.startY = event.originalEvent.targetTouches[0].screenY;
$(this).bind('touchmove', function(event) {
Swiper.lastX = event.originalEvent.targetTouches[0].screenX;
View index.php
<!DOCTYPE html>
<html manifest="manifest.appcache.php">
<head>
<title>AppCache Demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0rc1/jquery.mobile-1.0rc1.min.css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="http://code.jquery.com/mobile/1.0rc1/jquery.mobile-1.0rc1.min.js"></script>