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
var convertedHTML = htmlString; | |
// event-handler for app | |
convertedHTML = htmlString.replace(/<a href="((http|https)[^"]+)"[^>]*>(.*?)<\/a>/gmi, '<a href="$1" onclick="Ti.App.fireEvent(\'app:webViewClick\', {link: \'$1\'}); return false;">$3</a>'); | |
// mailto special | |
convertedHTML = convertedHTML.replace(/<a href="mailto:([^"]+)"[^>]*>(.*?)<\/a>/gmi, '<a href="mailto:$1" onclick="Ti.App.fireEvent(\'app:webViewClick\', {linkType: \'email\', link: \'$1\'}); return false;">$2</a>'); |
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
// npm install --save-dev gulp merge-stream | |
var gulp = require('gulp'); | |
var merge = require('merge-stream'); | |
gulp.task('test', function() { | |
var bootstrap = gulp.src('bootstrap/js/*.js') | |
.pipe(gulp.dest('public/bootstrap')); | |
var jquery = gulp.src('jquery.cookie/jquery.cookie.js') |
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
{ | |
"desktop" : { | |
"src" : [ | |
"dev/desktop/js/**/*.js", | |
"!dev/desktop/js/vendor/**" | |
], | |
"dest" : "build/desktop/js" | |
}, | |
"mobile" : { | |
"src" : [ |
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
/* | |
By default, tasks run with maximum concurrency -- e.g. it launches all the tasks at once and waits for nothing. If you want to create a series where tasks run in a particular order, you need to do two things: | |
give it a hint to tell it when the task is done, | |
and give it a hint that a task depends on completion of another. | |
For these examples, let's presume you have two tasks, "one" and "two" that you specifically want to run in this order: | |
In task "one" you add a hint to tell it when the task is done. Either take in a callback and call it when you're done or return a promise or stream that the engine should wait to resolve or end respectively. | |
In task "two" you add a hint telling the engine that it depends on completion of the first task. |
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
/* | |
If you have a set of folders, and wish to perform a set of tasks on each, for instance... | |
/scripts | |
/scripts/jquery/*.js | |
/scripts/angularjs/*.js | |
...and want to end up with... | |
/scripts | |
/scripts/jquery.min.js |
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
// With gulp-watch: | |
var gulp = require('gulp'); | |
var sass = require('gulp-sass'); | |
var watch = require('gulp-watch'); | |
gulp.task('default', function() { | |
return gulp.src('sass/*.scss') | |
.pipe(watch()) | |
.pipe(sass()) |
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
// npm install --save-dev gulp gulp-if gulp-uglify minimist | |
var gulp = require('gulp'); | |
var gulpif = require('gulp-if'); | |
var uglify = require('gulp-uglify'); | |
var minimist = require('minimist'); | |
var knownOptions = { | |
string: 'env', |
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
// Files are passed through the whole pipe chain on every run by default. By using gulp-changed only changed files will be passed through. This can speed up consecutive runs considerably. | |
// npm install --save-dev gulp gulp-changed gulp-jscs gulp-uglify | |
var gulp = require('gulp'); | |
var changed = require('gulp-changed'); | |
var jscs = require('gulp-jscs'); | |
var uglify = require('gulp-uglify'); | |
// we define some constants here so they can be reused |
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
// Outputting both a minified and non-minified version of your combined JavaScript files can be achieved by using gulp-rename and piping to dest twice (once before minifying and once after minifying): | |
'use strict'; | |
var gulp = require('gulp'); | |
var rename = require('gulp-rename'); | |
var uglify = require('gulp-uglify'); | |
var DEST = 'build/'; |
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
cd /Applications | |
xattr -d com.apple.quarantine APPNAME # e.g. Xcode6-Beta7.app |