Skip to content

Instantly share code, notes, and snippets.

View alaingalvan's full-sized avatar
Resident Latte Graphics Engineer. 👍

Alain Galvan alaingalvan

Resident Latte Graphics Engineer. 👍
View GitHub Profile
@alaingalvan
alaingalvan / Programming-Resources.md
Last active March 19, 2016 19:27
Software Development for Web Apps/Games Resources

Software Development Resources

When you do something, you need to put every ounce of effort you have into it, and finish it in a way that will make the people around you and yourself proud. You need to Live in what you're doing, breathe it and dream it. PhDs talk about this all the time, but this philosophy of focusing on one topic applies to everything you do.

This list is mostly Web and C++ resources, and is oriented for software development in Apps and Games.

Videos

Have you ever been bored learning something? When I see a video like the ones from VSauce or Kurzgesagt – In a Nutshell I'm captivated. It's the job of a video maker to make it as easy as possible for you to learn something, to entertain you if possible.

@alaingalvan
alaingalvan / read_bmp_ds_grid.gml
Last active July 11, 2022 22:11
A way of reading a bitmap as a 2D array of colors in Game Maker Studio. Works with Game Maker 8.1.
///read_bmp(filename)
// Reads 24 or 32 bit bitmap files
//returns a ds_grid of colors encoded as rgb hex
var handle;
handle = file_bin_open(argument0, 0);
var offset, width, height, bits, output;
offset = 29;
width = 0;
height = 0;
bits = 0;
@alaingalvan
alaingalvan / react-carousel.js
Created December 29, 2016 20:08
A TypedScript Carousel Component for React.

Keybase proof

I hereby claim:

  • I am alaingalvan on github.
  • I am alaingalvan (https://keybase.io/alaingalvan) on keybase.
  • I have a public key whose fingerprint is 9F1B 21A6 7465 C633 405A DCCA D6FA 92C2 72F6 C9A2

To claim this, I am signing this object:

@alaingalvan
alaingalvan / hyper-vscode.js
Created April 7, 2017 23:33
My Hyper terminal config
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 12,
// font family with optional fallbacks
fontFamily: 'Fira Code, Menlo, "DejaVu Sans Mono", "Lucida Console", monospace',
// terminal cursor background color and opacity (hex, rgb, hsl, hsv, hwb or cmyk)
cursorColor: '#bc3fbc',
@alaingalvan
alaingalvan / bevel-normals.glsl
Created August 3, 2017 17:29
Some bevel shader magic. :3
void rng_seed(output int rng, int seed)
{
int chash = seed;
if (chash == 0) chash = 1;
rng = chash * 30391861;
}
float rng_uniform(output int rng)
{
float res = rng / float(2137483647) * 0.5 + 0.5;
@alaingalvan
alaingalvan / screenspacebentconesao.glsl
Last active December 27, 2023 20:53
GPU Pro 3 sample of bent cones screen space ambient occlusion.
void main()
{
vec3 positionX = backproject(depthTexture(pixelCoordinateI), inverseViewProjectionMatrix);
vec3 normalX = normalTexture(pixelCoordinateI);
// get ONB to transform samples
mat3 orthoNormalBasis = computeONB(normalX);
// select samples for pixel out of pattern
int patternOffset = getPatternOffset(pixelCoordinateI);
float ao = 0.0;
@alaingalvan
alaingalvan / pycounter.cpp
Created August 10, 2017 13:17
Python C++ bindings code sample from docs
/*
* Copyright (C) 1999 Michael P. Reilly, All rights reserved.
* Written by Michael P. Reilly.
*/
/* headers */
#include <Python.h>
/* Module globals */
static PyObject *counter_error = NULL;
import React from 'react';
import Anime from 'react-anime';
class PlaybackAnime extends React.Component {
constructor() {
this.state = { play: true };
this.anime = null;
}
toggleAnime = () => {
//-----------------------------------------------------------------------------
// Photoshop Trick
// Author: Kiran Sudhakara
//
// Produces an image that most image editors cannot downsize Inspired
// by http://www.4p8.com/eric.brasseur/gamma.html
//-----------------------------------------------------------------------------
#include "windows.h"
#include <stdio.h>
//-----------------------------------------------------------------------------