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
module.exports = function ( grunt ) { | |
/** | |
* Load required Grunt tasks. These are installed based on the versions listed | |
* in `package.json` when you do `npm install` in this directory. | |
*/ | |
grunt.loadNpmTasks('grunt-contrib-watch'); | |
grunt.loadNpmTasks('grunt-exec'); |
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 fs = require('fs'); | |
var file = __dirname + '/test.json'; | |
//Async read file | |
fs.readFile(file, 'utf8', function (err, data) { | |
if (err) { | |
console.log('Error: ' + err); | |
return; | |
} |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 usageInBytes = (encodeURI(JSON.stringify(localStorage)).split(/%..|./).length - 1); | |
var usageInKbytes = (encodeURI(JSON.stringify(localStorage)).split(/%..|./).length - 1)/1024; |
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 Q = require('q'); | |
function printNumber(n) { | |
return Q.fcall(function () { | |
console.log("Number: ", n); | |
return n; | |
}); | |
} | |
function printNumbers(numbers) { |
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
app.filter("testf", function($timeout) { | |
var data = null; // DATA RECEIVED ASYNCHRONOUSLY AND CACHED HERE | |
var invoked = false | |
function realFilter(value) { // REAL FILTER LOGIC | |
return ...; | |
} | |
return function(value) { // FILTER WRAPPER TO COPE WITH ASYNCHRONICITY | |
if( data === null ) { | |
if (!invoked){ |
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
function upload(imageURI, fileName) { | |
var deferred = $.Deferred(), | |
ft = new FileTransfer(), | |
options = new FileUploadOptions(); | |
options.fileKey = "file"; | |
options.fileName = fileName; | |
options.mimeType = "image/jpeg"; | |
options.chunkedMode = false; | |
options.params = { |
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
const fs = require("fs"), | |
url = require("url"), | |
path = require("path"), | |
https = require('https'); | |
var server = https.createServer({ | |
key: fs.readFileSync('server.key'), | |
cert: fs.readFileSync('server.crt') | |
}); |
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
#!/usr/bin/env node | |
//this hook installs all your plugins | |
// add your plugins to this list--either | |
// the identifier, the filesystem location | |
// or the URL | |
var pluginlist = [ | |
'https://github.com/cogitor/PhoneGap-OrientationLock.git', | |
'org.apache.cordova.camera', |
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
#!bash | |
# | |
# bash/zsh completion support for core Git. | |
# | |
# Copyright (C) 2006,2007 Shawn O. Pearce <[email protected]> | |
# Conceptually based on gitcompletion (http://gitweb.hawaga.org.uk/). | |
# Distributed under the GNU General Public License, version 2.0. | |
# | |
# The contained completion routines provide support for completing: | |
# |
OlderNewer