Skip to content

Instantly share code, notes, and snippets.

View thisredone's full-sized avatar
🏹
༼ つ ◕_◕ ༽つ ʕ ゚ᴥ ゚ʔ

redka thisredone

🏹
༼ つ ◕_◕ ༽つ ʕ ゚ᴥ ゚ʔ
View GitHub Profile
@thisredone
thisredone / swappable.js
Last active December 9, 2023 15:57
swappable js classess
self._swappableClasses ??= {
existing: {},
instances: {},
bodyStrings: {},
ancestralHooks: {},
};
const isPromise = (v) =>
v != null && (v instanceof Promise || (typeof v === 'object' && typeof v.then === 'function'))
@thisredone
thisredone / pc-uranus-loaded.js
Created March 15, 2022 18:12
Violentmonkey script for Uranus Editor Scripting for Playcanvas
const loadScriptAsync = function (url) {
return new Promise((resolve) => {
var tag = document.createElement('script');
tag.onload = function () {
resolve();
};
tag.onerror = function () {
throw new Error('failed to load ' + url);
};
tag.async = true;
@thisredone
thisredone / global_extensions.coffee
Last active February 26, 2019 13:24
Some usefull extensions
# automatic bind
Object.defineProperty Object.prototype, '_bind',
enumerable: false
get: ->
new Proxy this,
get: (thing, prop) =>
thing[prop].bind(thing)
# Usage
@thisredone
thisredone / interpolation.js
Created October 8, 2018 16:28
PlayCanvas interpolation
function interpolation(current, interp, lerpFunc, isVector, target, source) {
var passed = interp;
return {
get current () {
return current;
},
interpolateTo: function(t) {
if (isVector ? t.equals(target) : t === target) return;
if (isVector) {
target.copy(t);
@thisredone
thisredone / tileset_from_frames.rb
Last active September 16, 2018 18:14
Cut images into tiles of the same size and glue together into a tileset
#!/usr/bin/env ruby
require 'fileutils'
require 'pry'
SIZE = ARGV[0].to_i
max_tileset_width = 7
wanted_geometry = "#{SIZE}x#{SIZE}"
FileUtils.mkdir_p 'tiles'
@thisredone
thisredone / get_prop_it_proxy.coffee
Last active February 2, 2019 21:01
Getting props in CoffeeScript/ES6 with _ (_it) Proxy
global._ = global._it = new Proxy {},
get: (_, prop) ->
retrieve = (props...) ->
fn = (obj) ->
props.reduce ((obj, prop) -> obj[prop]), obj
if props.last() in ['is', 'isnt']
prop = props.pop()
switch prop
when 'is' then (val) -> (obj) -> fn(obj) is val

Keybase proof

I hereby claim:

  • I am thisredone on github.
  • I am redka (https://keybase.io/redka) on keybase.
  • I have a public key ASA7CJFahUUY27_MrR_rn94Vu6WJSkl-aM7bX7xBBWyzJgo

To claim this, I am signing this object:

.primary-background-color {
background-color: #222;
}
.content-background-color {
background-color: #333;
color: #D0D0D0;
}
.color-primary-font-color {
@thisredone
thisredone / gist:cb23b5ae414875175d89
Created February 14, 2015 10:25
playcanvas without webgl
diff --git a/src/framework/framework_application.js b/src/framework/framework_application.js
index 13977dc..1e04457 100644
--- a/src/framework/framework_application.js
+++ b/src/framework/framework_application.js
@@ -84,7 +84,7 @@ pc.extend(pc, function () {
loader.registerHandler(pc.resources.PackRequest, new pc.resources.PackResourceHandler(registry, options.depot));
loader.registerHandler(pc.resources.AudioRequest, new pc.resources.AudioResourceHandler(this.audioManager));
- this.renderer = new pc.ForwardRenderer(this.graphicsDevice);
+ // this.renderer = new pc.ForwardRenderer(this.graphicsDevice);
@thisredone
thisredone / dukas_download.rb
Created September 17, 2012 11:58
Downloads tick data from dukascopy
require 'typhoeus'
require 'pry'
$currencies = {
"AUDJPY" => 1175270400, # starting from 2007.03.30 16:00
"AUDNZD" => 1229961600, # starting from 2008.12.22 16:00
"AUDUSD" => 1175270400, # starting from 2007.03.30 16:00
"CADJPY" => 1175270400, # starting from 2007.03.30 16:00
"CHFJPY" => 1175270400, # starting from 2007.03.30 16:00
"EURAUD" => 1175270400, # starting from 2007.03.30 16:00