Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html>
<head>
<script src="http://xhr-progressive-timeouts.googlecode.com/hg/trunk/lib/xhr-pt.js"></script>
<style type="text/css">
#debug .info { color: silver; }
#debug .ok { color: green; }
#debug .error { color: red; }
</style>
</head>
// Module to access Camelot Unchained's REST API
// Originally written by Mehuge (https://www.github.com/Mehuge)
var Promise = require('./basic-promise.js');
var util = require('util');
var request = require('request');
var servers = [];
function restAPI(name) {
function doThings(todo, whenDone, thereWereErrors) {
var tasks = todo.length, errors = 0;
function finish() {
task --;
if (task === 0) {
// everything is done
if (errors) {
// but there were errors
thereWereErrors();
"imports": {
"resources": [
/* all unitframe related resources from the cu-components module */
{ resource: "cu-components/unitframe/images", dest: "images/unitframe" },
{ resource: "cu-components/unitframe/styles", dest: "styles" },
/* just the portrait resources required */
{ resource: "cu-components/unitframe/portrait/images", dest: "images/unitframe/portrait" }
]
}
var handleReceiveConfigVars;
cu.OnInitialized(function () {
cu.GetConfigVars(Options.activeConfigIndex);
cu.Listen('HandleReceiveConfigVars', function(configs) {
if (handleReceiveConfigVars) {
handleReceiveConfigVars(configs);
handleReceiveConfigVars = null;
}
});
});
lib/cu-components/cu-components.bundle.js
lib/cu-components/cu-components.css
lib/cu-components/unitframe/unitframe.bundle.js
lib/cu-components/skillbar/skillbar.bundle.js
// Based on https://github.com/schchr/cordova-plugin-timers/
private int timerCount = 0;
private Hashtable<Integer, PendingIntent> timerIntents;
AlarmManager alarmManager = null;
private PluginResult setTimeout(JSONArray args) throws JSONException {
final int timerId = ++timerCount;
int time = args.getInt(0);
BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Mehuge
Mehuge / capture.html
Created January 24, 2018 11:40
iOS 11.2.5 breaks <input type="file">
<meta name="apple-mobile-web-app-capable" content="yes">
<input type="file">
@Mehuge
Mehuge / trac-rewrite.conf
Created March 12, 2018 16:21
Trac mod_python redirect old style single repo per project changeset URL to multi repo project
# add the following above </Location>
RewriteEngine On
RedirectMatch "/trac/([A-Z]*)/changeset/([0-9]*)$" "/trac/changeset/$2/$1"