Skip to content

Instantly share code, notes, and snippets.

Julien Berthou grifdail

View GitHub Profile
View tictactoe.js
function setup() {
createCanvas(16000, 16000);
noLoop();
}
function draw() {
background(220);
drawSquare([0,0,0,0,0,0,0,0,0],0,0,width,height, 0);
}
@grifdail
grifdail / VectorSwizzle.cs
Created Aug 21, 2018
Vector swizzle in unity
View VectorSwizzle.cs
using UnityEngine;
static class Vector2Swizzles {
// swizzle of size 2
public static Vector2 Swizzle_xx(this Vector2 a) { return new Vector2(a.x, a.x); }
public static Vector2 Swizzle_xy(this Vector2 a) { return new Vector2(a.x, a.y); }
public static Vector2 Swizzle_x0(this Vector2 a) { return new Vector2(a.x, 0); }
public static Vector2 Swizzle_x1(this Vector2 a) { return new Vector2(a.x, 1); }
public static Vector2 Swizzle_yx(this Vector2 a) { return new Vector2(a.y, a.x); }
@grifdail
grifdail / TwitterWithLessCrap.css
Created May 1, 2018
Remove everything but the tweet field from twitter.
View TwitterWithLessCrap.css
.topbar {
display: none;
}
.dashboard {
display: none;
}
.stream-container {
display: none;
View PlayerController.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerController : MonoBehaviour {
public float speed = 10;
public float frequency = 1;
public FootTarget leftFoot;
public FootTarget rightFoot;
@grifdail
grifdail / color.pde
Created Feb 20, 2018
the template i used with processing
View color.pde
color black = #000000;
color darkBlue = #1D2B53;
color darkPurple = #7E2553;
color darkGreen = #008751;
color brown = #AB5236;
color darkGray = #5F574F;
color lightGray = #C2C3C7;
color white = #FFF1E8;
color red = #FF004D;
color orange = #FFA300;
View mesh.js
// Try on
// http://meshplayground.space/
var palette = randomPalette();
setBackgroundColor(palette[0])
scale(15)
for(var x = 0; x<10; x++) {
for(var y= 0; y<10; y++) {
push();
View ExemplePromise.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
public class ExemplePromise : MonoBehaviour {
public int Pokemon1 = 1;
public int Pokemon2 = 2;
@grifdail
grifdail / AsyncError.cs
Last active Dec 11, 2017
Unity Deferred
View AsyncError.cs
public class AsyncError {
public string Message { get; private set; }
public AsyncError(string _message) {
Message = _message;
}
}
View Voxelizer.js
// Copy that into MeshPlayground
// http://grifdail.fr/MeshPlayground/
var box = new Box(1);
const sphereVolume = (radius, center) => (x,y,z) => sqrt((x-center.x)*(x-center.x)+(y-center.y)*(y-center.y)+(z-center.z)*(z-center.z))<radius;
const mainSphere = sphereVolume(0.4, Vector3.one().scale(0.5));
const holeSphere = sphereVolume(0.7, Vector3.one().scale(1));
const holeSphere2 = sphereVolume(0.3, new Vector3(0.3,0.3,0.6));
View pico8colors.pde
// Pico 8 colors for processing
color BLACK = #000000;
color DARK_BLUE = #1D2B53;
color DARK_PURPLE = #7E2553;
color DARK_GREEN = #008751;
color BROWN = #AB5236;
color DARK_GRAY = #5F574F;
color LIGHT_GRAY = #C2C3C7;
color WHITE = #FFF1E8;
You can’t perform that action at this time.