⌘T | go to file |
⌘⌃P | go to project |
⌘R | go to methods |
⌃G | go to line |
⌘KB | toggle side bar |
⌘⇧P | command prompt |
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); | |
} |
/* | |
* 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 |
/** | |
* 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; |
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); |
<?php | |
/** | |
* Convert a multi-dimensional array into a single-dimensional array. | |
* @author Sean Cannon, LitmusBox.com | [email protected] | |
* @param array $array The multi-dimensional array. | |
* @return array | |
*/ | |
function array_flatten($array) { | |
if (!is_array($array)) { |
var express = require("express"); | |
var app = express(); | |
app.get('/', function (req, res) { | |
res.send("This is the '/' route in ep_app"); | |
}); | |
module.exports = app; |
var html = twig({ ref: "user-profile" }).render({ | |
list: ["a", "b", "c"] | |
}); |
⇐ back to the gist-blog at jrw.fi
Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.
I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.
This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso