Skip to content

Instantly share code, notes, and snippets.

@psema4
psema4 / bookmarklet.js
Created June 11, 2011 20:18 — forked from kn0ll/bookmarklet.js
advanced bookmarklet template
javascript:(function() {
if(!window.your_bookmarklet) {
var doc = document,
js = doc.createElement('script');
js.type = 'text/javascript';
js.src = 'loader.js';
js.async = true;
# wget --header='Accept-Encoding: gzip' -O root.bin.gz http://bellard.org/jslinux/root.bin
# gunzip root.bin.gz
# mkdir mnt
# mkdir files
# sudo mount -t ext2 -o loop root.bin mnt
# dd if=/dev/zero of=files/root.bin bs=1k count=4096
# sudo mke2fs -m 0 -i 2000 files/root.bin
# mkdir mnt2
# sudo mount -t ext2 -o loop files/root.bin mnt2
# sudo cp -dpR mnt/* mnt2/
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>
MobileSafari Live Click Bug
</title>
<script src='http://code.jquery.com/jquery-git.js' type='text/javascript'></script>
<script src='http://media.lib.byu.edu/js/jquery/plugins/jquery.livequery-1.0.3.js' type='text/javascript'></script>
</head>
<body style='font-family: Helvetica;'>

Before you begin

Make sure you have adb installed and that it works. Test this by connecting your phone and running adb devices. In order to proceed past the build stage, your device must be rooted. The device I used is running Cyanogenmod with root enabled for both apps and adb.

Build

Fetch the Android NDK

You'll need to get the Android NDK. I used r8e, which you can get from here: http://dl.google.com/android/ndk/android-ndk-r8e-linux-x86.tar.bz2. Make sure you get the x86 version, as the x86_64 version will not help you. Let's call the path where you unpack this NDK_PATH.

Grunt and Cordova 3

The advantages of using Grunt with Cordova:

  1. It simplifies working with the cordova cli.
  2. It provides a mechanism to copy platform customization to the platforms directory without having to commit the generated plugins and platforms directories to version control.
  3. It provides a way to watch resources and automatically run cordova commands.

Stack Overflow: .gitignore for PhoneGap/Cordova 3.0 projects - what should I commit?

#!/usr/bin/env bash
# Use this one-liner to produce a JSON literal from the Git log:
git log \
--pretty=format:'{%n "commit": "%H",%n "author": "%an <%ae>",%n "date": "%ad",%n "message": "%f"%n},' \
$@ | \
perl -pe 'BEGIN{print "["}; END{print "]\n"}' | \
perl -pe 's/},]/}]/'
@psema4
psema4 / git_branch_parent.sh
Last active May 30, 2016 13:49 — forked from intel352/git_branch_parent.sh
Determine "parent" of the active git branch (Ubuntu)
#!/usr/bin/env bash
# via http://stackoverflow.com/a/17843908/773209
#
# Ubuntu variant
#
# if ack-grep isn't found:
# $ sudo apt-get install ack-grep
branch=`git rev-parse --abbrev-ref HEAD`
@psema4
psema4 / mersenne-twister.js
Created November 21, 2015 03:23 — forked from banksean/mersenne-twister.js
a Mersenne Twister implementation in javascript. Makes up for Math.random() not letting you specify a seed value.
/*
I've wrapped Makoto Matsumoto and Takuji Nishimura's code in a namespace
so it's better encapsulated. Now you can have multiple random number generators
and they won't stomp all over eachother's state.
If you want to use this as a substitute for Math.random(), use the random()
method like so:
var m = new MersenneTwister();
@psema4
psema4 / slim-container-examples.php
Created May 12, 2016 03:07 — forked from akrabat/slim-container-examples.php
Example uses of Slim 3's container
<?php
// All file paths relative to root
chdir(dirname(__DIR__));
require "vendor/autoload.php";
$settings = ['foo' => 'FOO', 'bar' => 'BAR'];
$app = new \Slim\App($settings);
// Set some things into the container
@psema4
psema4 / ep_app.js
Created June 16, 2016 16:13 — forked from focusaurus/ep_app.js
Example of how a main express app can mount sub-applications on a mount point with app.use('/mount-point', subapp); If you GET /, you'll see the main_app's '/' response. If you GET /ep_app, you'll see the ep_app's '/' response.
var express = require("express");
var app = express();
app.get('/', function (req, res) {
res.send("This is the '/' route in ep_app");
});
module.exports = app;