| ⌘T | go to file |
| ⌘⌃P | go to project |
| ⌘R | go to methods |
| ⌃G | go to line |
| ⌘KB | toggle side bar |
| ⌘⇧P | command prompt |
This file contains hidden or 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
| window.requestFileSystem(LocalFileSystem.TEMPORARY, 0, gotFS, fail); | |
| function fail(error) { | |
| console.log(error) | |
| } | |
| function gotFS(fileSystem) { | |
| fileSystem.root.getDirectory("data", {create: true, exclusive: false}, gotDir, fail); | |
| } |
This file contains hidden or 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
| /* | |
| * adds "remove" event triggered when a DOMNode is removed, | |
| * allowing to register DOM elements to be removed when a | |
| * given other element is removed from dom. | |
| * | |
| * (last tested with jQuery 1.4.4) | |
| */ | |
| (function($,undefined){ | |
| // register node to be removed when the base node is removed |
This file contains hidden or 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
| /** | |
| * Prepare the App Folder | |
| */ | |
| (function(){ | |
| window.appRootDirName = ".myapp"; | |
| document.addEventListener("deviceready", onDeviceReady, false); | |
| function onDeviceReady() { | |
| console.log("device is ready"); | |
| window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem; |
This file contains hidden or 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
| <?php | |
| /** | |
| * Convert a multi-dimensional array into a single-dimensional array. | |
| * @author Sean Cannon, LitmusBox.com | seanc@litmusbox.com | |
| * @param array $array The multi-dimensional array. | |
| * @return array | |
| */ | |
| function array_flatten($array) { | |
| if (!is_array($array)) { |
This file contains hidden or 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 fileTransfer = new FileTransfer(); | |
| fileTransfer.onprogress = function(result){ | |
| var percent = result.loaded / result.total * 100; | |
| percent = Math.round(percent); | |
| console.log('Downloaded: ' + percent + '%'); | |
| }; | |
| fileTransfer.download(remoteFile, localPath, successCallback, errorCallback); |
This file contains hidden or 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 getOSInfo(){ | |
| var userOS; | |
| var userOSver; | |
| var ua = navigator.userAgent; | |
| var uaindex; | |
| // determine OS | |
| if ( ua.match(/iPad/i) || ua.match(/iPhone/i) ){ | |
| userOS = 'iOS'; | |
| uaindex = ua.indexOf( 'OS ' ); |
This file contains hidden or 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
| angular.module("starter").controller('userController', [ '$rootScope', '$cordovaSQLite' | |
| function( $rootScope, $cordovaSQLite ) { | |
| // Opening the database | |
| $rootScope.db = $cordovaSQLite.openDB({ name: "databaseName.db" }); | |
| // Create tabel if not existing | |
| $cordovaSQLite.execute($rootScope.db, | |
| "CREATE TABLE IF NOT EXISTS user_tabel (id integer primary key, user_name text, email text)", | |
| [ "john", "john@who.com" ]).then(function(res) { |
This file contains hidden or 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
| jQuery.download = function(url, data, method){ | |
| //url and data options required | |
| if( url && data ){ | |
| //data can be string of parameters or array/object | |
| data = typeof data == 'string' ? data : jQuery.param(data); | |
| //split params into form inputs | |
| var inputs = ''; | |
| jQuery.each(data.split('&'), function(){ | |
| var pair = this.split('='); | |
| inputs+='<input type="hidden" name="'+ pair[0] +'" value="'+ pair[1] +'" />'; |
This file contains hidden or 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 (!console) { | |
| var console = {}, | |
| func = function () { return false; }; | |
| console.log = func; | |
| console.info = func; | |
| console.warn = func; | |
| console.error = func; |
OlderNewer