Do whatever you want with this code. I offer it without expectation or warranty. No need to credit me in your project or source code. A digital high five would be nice, but is not required.
var oldThis = this; | |
// If the Ti object were definied in JS like this... | |
var Ti = { | |
UI: { | |
createView: function(args) { | |
return new Ti.UI.View(args); | |
}, | |
View: function(args) { | |
if (!(this instanceof arguments.callee)) { |
(The command examples assume OS X).
Just about everything that happens when you enter scons
is for Android. So anything you can do to speed up the Android part of our build will be useful.
-
Android NDK r7 can use ccache. We get huge improvements in build time with it. So install it (if you have HomeBrew,
brew install ccache
) then set a shell variableNDK_CCACHE
to point to it. I.e., for me, having installed it withbrew
, it would beexport NDK_CCACHE=/usr/local/bin/ccache
. -
NDK can also parallelize while compiling. Set a shell variable
NUM_CPUS
to (according to Opie) 2x the number of cores in your machine. A quick way to get the # cores on your machine in OS X issystem_profiler | grep "Number Of Cores"
in terminal. I have 2 cores, so my shell var setting isexport NUM_CPUS=4
.
find-up() { | |
local path=$(pwd) | |
while [[ "$path" != "" && ! -e "$path/$1" ]]; do | |
path=${path%/*} | |
done | |
if [ "$path" != "" ] | |
then | |
echo "$path" | |
fi | |
} |
{ | |
"globals": [ | |
"Ti": false, | |
"Titanium": false, | |
"Alloy": false, | |
"describe": false, | |
"it": false, | |
"before": false, | |
"beforeEach": false, | |
"after": false, |
var win = Ti.UI.createWindow({ backgroundColor: '#fff' }); | |
/** | |
* Adds "swipe" event support to Android, and adds swipe up and down to iOS. | |
* @param view The view that should be made swipeable. | |
* @param allowVertical Whether or not vertical swipes (up and down) are allowed; default is false. | |
* @param tolerance How much further you need to go in a particular direction before swipe is fired; default is 2. | |
*/ | |
function makeSwipeable(view, allowVertical, tolerance) { | |
tolerance = tolerance || 2; |
/* | |
* Mixin properties of n objects into the given object - pass in as many objects to mix in as you like. | |
* Can perform a shallow or deep copy (shallow is default for performance reasons). | |
* | |
* Usage: | |
* mixin([Boolean deepCopy,] objectToExtend, objectToMixIn [, as many other objects as needed]) | |
* | |
* Examples: | |
* | |
* var o1 = { |
var http = require("http"), | |
url = require("url"), | |
path = require("path"), | |
fs = require("fs") | |
port = process.argv[2] || 8888; | |
http.createServer(function(request, response) { | |
var uri = url.parse(request.url).pathname | |
, filename = path.join(process.cwd(), uri); |
Locate the section for your github remote in the .git/config
file. It looks like this:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@github.com:joyent/node.git
Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:
#!/bin/bash | |
# A simple script to backup an organization's GitHub repositories. | |
#------------------------------------------------------------------------------- | |
# NOTES: | |
#------------------------------------------------------------------------------- | |
# * Under the heading "CONFIG" below you'll find a number of configuration | |
# parameters that must be personalized for your GitHub account and org. | |
# Replace the `<CHANGE-ME>` strings with the value described in the comments | |
# (or overwrite those values at run-time by providing environment variables). |