Skip to content

Instantly share code, notes, and snippets.

View fleon's full-sized avatar

fleonus fleon

View GitHub Profile
Namespace(alwaysupdate=1, apitoken=None, command='import', days=10, dryrun=None, forcecopy=0, forcedownload=0, info=None, input=None, installer='/Users/fleon/.sdkbox/bin/sdkbox.pyc', jsonapi=0, key=None, legacy=None, local=0, manifest='manifest.json', mkey=None, mvalue=None, nohelp=1, nopatching=0, nopatchingcpp=0, noupdate=0, output=None, patcherrors=0, platform=None, plugin=u'/Users/fleon/.sdkbox/plugins/sdkbox-sdkboxplay_v2.7.0.0/', project='/Users/fleon/git/curse-of-the-cards/game/build/jsb-link/', projectpath=['proj.ios_mac/curse-of-the-cards.xcodeproj', 'proj.android-studio'], remote=1, runin='gui-creator', server='download.sdkbox.com/installer/v1/', silenttime=None, symbol=None, verbose=0)
get remote manifest from http://download.sdkbox.com/installer/v1/manifest.json
{
"packages": {
"SDKBOX": {
"versions": {
"1.4.0.0": {
"bundle": "sdkbox_installer.zip",
"sha1": "ef75f1afa4b63c5affa911cda34f1e5f7eb46b45"
}
computeCoinGainForWinning(against: User, cleanWin = false) {
const L = against.experience.level
const l = this.experience.level
const c = cleanWin ? 1.5 : 1
const m = this.gameUnlocked ? 2 : 1
return Math.floor(
c * m * Math.log10(2 * L) / Math.log10(1.01) * (
1 - (L - l < 0 ? Math.min(1.9, (l - L + 1) ** 0.18) - 1 : 0) +
(L - l > 0 ? L - l : 0) ** 2 / L ** 1.25
)
@fleon
fleon / GarbageCollector.ts
Created October 2, 2018 12:09
cocos2dx custom garbage collection
import Timeout, { timeout } from 'utils/Timeout'
export default class GarbageCollector {
private static gcTimeout: Timeout
static cancel() {
if (this.gcTimeout) {
this.gcTimeout.cancel()
}
}
@fleon
fleon / Common.ts
Created August 23, 2018 12:06
cocos2dx-TouchHelper
export function noop() {}
@fleon
fleon / cyclic-copy.js
Created July 2, 2016 13:00
cyclic-copy.js
var utils = {
forEach: function (obj, fn, ctx) {
if (obj === null || typeof obj === 'undefined') {
return
}
if (obj instanceof Array) {
for (var i = 0; i < obj.length; i++) {
if (fn.call(ctx, obj[i], i, obj)) {
break
Augmented Senses
—————————
2026 shall be the year to enable us to do more with our senses
AR / VR becomes mainstream
Augmented Sight Contact Lenses: a wearable tech, allowing you to overlay your eyes with additional information configurable by the touch of your favourite device
Augmented Hearing: earplugs
@fleon
fleon / DOMFootprint.js
Last active August 29, 2015 14:22
DOMFootprint
/**
* Creates a new DOMFootprint for the given HTML node.
* @param {Node} element The HTML node to create a footprint for.
*/
function DOMFootprint(element) {
this.element = element;
this.capture();
}
DOMFootprint.prototype = {
@fleon
fleon / observe-function.js
Last active August 29, 2015 14:16
Tell me when this updates
//javascript:
function observeFn(obj, fnName, before, after) {
var originalFn = obj[fnName],
noop = function () {};
before = typeof before === 'function' ? before : noop;
after = typeof after === 'function' ? after : noop;
obj[fnName] = function () {
var args = [].slice.call(arguments);
before({
args: args,
@fleon
fleon / add-jquery.js
Created February 20, 2015 17:37
Useful Bookmarklets for Developers
// javascript:
var script = document.createElement('script');
var protocol = window.location.protocol;
if (protocol.indexOf('file') >= 0) {
protocol = 'http:';
}
script.src = protocol + '//code.jquery.com/jquery-1.11.2.min.js';
document.getElementsByTagName('head')[0].appendChild(script);