Skip to content

Instantly share code, notes, and snippets.

View PsichiX's full-sized avatar
👨‍🔬
For the Symmetry! [mental health vacation]

Patryk Budzyński PsichiX

👨‍🔬
For the Symmetry! [mental health vacation]
View GitHub Profile
@PsichiX
PsichiX / wykop.paski.user.js
Last active August 29, 2015 14:07
Wykop Paski
// ==UserScript==
// @name Wykop Paski
// @namespace paski.wykop.psichix.com
// @description Dodaje pod avatarami opisy pomagające daltonistom odróżniać mirków od mirabelek: '#M' - mężczyzna; '#K' - kobieta.
// @include http://www.wykop.pl/*
// @version 1.0.1
// @grant none
// ==/UserScript==
$(document).ready(function () {
$('img.avatar.male').parent().append('<div>#M</div>');
@SamiecAlfa // klasa.
// zmienne.
#oswiadczenie tekst : string = "hello world"
#oswiadczenie liczba : int = 10
// wskaznik pozwala na grzebanie w pamieci, bez tagu #nsfw obiekt bedzie normalnym obiektem.
#nsfw #oswiadczenie wskaznikNaLiczbe : int = #nic
// metoda.
#coolstory Dziel( a : int, b : int ) : int
@PsichiX
PsichiX / hello.frag
Last active August 29, 2015 14:11
GLSL Hello World
// here we declare that we want to use vColor from vertex processing unit.
varying vec4 vColor;
void main()
{
// our fragment shader only want to paint our shape with solid color.
gl_FragColor = vColor;
}
@PsichiX
PsichiX / testPointInBox3d
Created March 16, 2015 21:47
testPointInBox3d
public static bool testPointInBox3d(Vector3d point, Matrix boxTransformWorld, Vector3d boxDimension, Vector3d boxOrigin)
{
Matrix worldToLocalTransform = boxTransformWorld.inverse();
Vector3d localPoint = worldToLocalTransform.transform(point);
return localPoint.x >= -boxOrigin.x && localPoint.x <= boxDimension.x - boxOrigin.x &&
localPoint.y >= -boxOrigin.y && localPoint.y <= boxDimension.y - boxOrigin.y &&
localPoint.z >= -boxOrigin.z && localPoint.z <= boxDimension.z - boxOrigin.z;
}
@PsichiX
PsichiX / intuicio_managed.isc
Created March 31, 2015 10:39
Intuicio - Managed Memory Objects
!intuicio // every Intuicio program must start with header.
!stack 128
!registers-i 8
!data bytes txtCountObj "obj references count: ", 0
!data bytes txtCountCpy "cpy references count: ", 0
!data bytes txtValueObj "obj value: ", 0
!data bytes txtValueCpy "cpy value: ", 0
!data bytes txtCountA "ManagedClass.a references count: ", 0
@PsichiX
PsichiX / grammar.h
Last active August 29, 2015 14:19
Intuicio++ language syntax
#ifndef __GRAMMAR_H__
#define __GRAMMAR_H__
#include "std_extension.h"
#include <pegtl.hh>
namespace IntuicioPlusPlus
{
namespace Grammar
{
@PsichiX
PsichiX / example.js
Last active August 29, 2015 14:22
Awesome AssetManager API explanation
var assets,
assetRef,
assetRefClone,
assetRefs;
// custom asset class that inherit from AssetManager.Asset class.
function TextAsset(manager, id, config){
AssetManager.Asset.call(this, manager, id, config);
@PsichiX
PsichiX / CustomType.editor.json
Last active September 9, 2015 02:14
PlayGate - custom editors
{
"properties": {
"value": { "editorId" : "number" },
"text": { "editorId" : "string" },
"on": { "editorId" : "boolean" }
}
}
@PsichiX
PsichiX / CircleFragment.glsl
Last active November 15, 2015 22:33
Circle-cut GLSL shader
varying vec2 vUv0;
uniform vec4 uTint;
void main(void)
{
float f = step(dot(vUv0.xy), 1.0);
gl_FragColor = vec4(uTint.rgb, uTint.a * f);
}
@PsichiX
PsichiX / _test.ipp
Last active January 4, 2016 20:37
Intuicio++ to JavaScript compilation test
class Ass
{
Ass(v:int) { _value = v; }
~Ass() { _value = 0; }
get():int { return _value; }
set(v:int):void { _value = v; }
property:int
{