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 / flashtojs.as
Created September 9, 2013 20:30
convert a flash animation to javascript
var animationName = 'Elric_Jump_Down';
import com.adobe.images.PNGEncoder;
import com.adobe.serialization.json.JSON;
import com.hurlant.util.Base64;
import org.aszip.zip.ASZip;
import org.aszip.compression.CompressionMethod;
import org.aszip.saving.Method;
var console = {log: trace};
@fleon
fleon / submitData.js
Last active December 21, 2015 05:38
Submit data to a page
function submitData(url, method, data) {
var $form = $('<form></form>')
.attr('action', url)
.attr('method', method)
.appendTo('body');
for (var i in data) {
if (!data.hasOwnProperty(i)) continue;
$('<input type="hidden"/>')
.attr('name', i)
@fleon
fleon / animToJSON.as
Last active December 20, 2015 08:09
1. Convert a frame-based Flash animation to JSON. (Add the below code in frame 1 of your animation.) Dependencies - as3corelib: https://github.com/mikechambers/as3corelib as3crypto: https://code.google.com/p/as3crypto/
import com.adobe.images.PNGEncoder;
import com.adobe.serialization.json.JSON;
import com.hurlant.util.Base64;
var frames = {};
var children = [];
function enterFrameHandler (e:Event):void {
if (frames[currentFrame]) {
System.setClipboard(JSON.encode(children));