Skip to content

Instantly share code, notes, and snippets.

View alijaya's full-sized avatar

Ali Jaya Meilio alijaya

View GitHub Profile
@alijaya
alijaya / Example.yarn
Last active February 13, 2022 17:20
Yarn Return Jump Command
title: Start
---
Hello, this is a trial for callback stack
-> Yes
<<push SomeNode Start_1>>
-> No
Some spill over
===
title: Start_1
---
@alijaya
alijaya / transform.js
Created November 18, 2020 10:40
To transform coordinate from offset space (padding box of element) to page space
export function parseOrigin(transformOrigin) {
return transformOrigin.split(" ").map(parseFloat);
}
export function getElementMatrix(element) {
const matrix = new DOMMatrix();
let current = element;
while (current) {
const computedStyle = window.getComputedStyle(current);
const origin = parseOrigin(computedStyle.transformOrigin);
@alijaya
alijaya / GetShapeArea.jsx
Last active November 9, 2021 19:10 — forked from bryanbuchanan/GetShapeArea.jsx
Script to find the area of shapes in Adobe Illustrator
/* Save this file with a jsx extension and place in your
Illustrator/Presets/en_US/Scripts folder. You can then
access it from the File > Scripts menu */
var decimalPlaces = 3;
function calculateArea (obj) {
if (obj.typename == "PathItem") {
return obj.area; // could be negative
} else if (obj.typename == "CompoundPathItem") {
@alijaya
alijaya / droste.cpp
Created June 6, 2019 03:11
OpenFX Droste Plugin
/*
OFX Invert Example plugin, a plugin that illustrates the use of the OFX Support library.
Copyright (C) 2007 The Open Effects Association Ltd
Author Bruno Nicoletti bruno@thefoundry.co.uk
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
@alijaya
alijaya / linearwave.glsl
Created November 21, 2017 17:34
Natron Wave GLSL
#define TAU 6.2831853072
uniform vec2 origin = vec2(0.0, 0.0);
uniform float direction = 0.0;
uniform float amplitude = 10.0;
uniform float length = 10.0;
uniform float evolution = 0.0;
vec2 distanceDirection(vec2 pos) {
float angle = direction * TAU;
@alijaya
alijaya / d3DataTest.tsv
Last active October 7, 2015 18:38
D3 Data Test
name value
Locke 4
Reyes 8
Ford 15
Jarrah 16
Shephard 23
Kwon 42
@alijaya
alijaya / The End of It
Last active August 29, 2015 14:14
The End of It
---
title : The End of It
---
Hmmm... sorry telat berkabar lagi...
Dan sekarang banyak pertanyaan ke aku kenapa aku menghapus beberapa blog post aku.
Dan inilah jawabannya...
Jeng jeng jeng...
#### Goal Yang Tidak Tercapai ####
@alijaya
alijaya / easing.hx
Last active August 29, 2015 14:12 — forked from anonymous/easing.hx
import flash.display.Sprite;
import flash.Lib;
class Test {
static function linear(t:Float) : Float return t;
static function quad(t:Float) : Float return t * t;
static function cubic(t:Float) : Float return t * t * t;
static function quart(t:Float) : Float return t * t * t * t;
static function quint(t:Float) : Float return t * t * t * t * t;
static function poly(t:Float, p:Float=2.0) : Float return Math.pow(t, p);
@alijaya
alijaya / PRNG Linear Congruential Generator
Created December 14, 2014 20:29
PRNG Linear Congruential Generator
/**
http://try.haxe.org/#7dB24
http://en.wikipedia.org/wiki/Linear_congruential_generator
*/
class Test {
// define the multiplier
static var a : Int = 1140671485;
// define the increment
static var c : Int = 12820163;
// define the modulo
@alijaya
alijaya / slicingbitmap
Last active December 18, 2015 21:09 — forked from anonymous/slicingbitmap
var bd = Assets.getBitmapData("img/sumachan.png");
var temp:BitmapData = new BitmapData(300, 300, true, 0);
temp.copyPixels(bd, new Rectangle(0, 0, 300, 300), new Point(0, 0));
var data:Data = Tools.build32ARGB(temp.width, temp.height, Bytes.ofData(temp.getPixels(temp.rect)));
var bo:BytesOutput = new BytesOutput();
var writer:Writer = new Writer(bo);
writer.write(data);
var byteArray:ByteArray = bo.getBytes().getData();