Skip to content

Instantly share code, notes, and snippets.

View felipetavares's full-sized avatar

Felipe Tavares felipetavares

View GitHub Profile
// Nenhum(a)/Ambos(as)
var Nenhum=Nenhuma = 0;
var Ambos=Ambas= -1;
// Sim/Não
var Sim = true;
var Não = false;
// Gênero/Número/Grau/Pessoa
var Gênero = {
@felipetavares
felipetavares / userfriendly.sh
Created August 3, 2015 19:49
Download all the User Friendly comics!
#!/bin/bash
years="1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015"
months1="01 02 03 04 05 06 07 08 09 10 11 12"
months2="11 12"
n=1
for y in $years
do
if [ $y = "1997" ]; then
@felipetavares
felipetavares / guidelines.md
Last active November 10, 2017 00:19
Blender Guidelines

Blender Guidelines

Projeto PongBoy

1 Escala

São utilizados milímetros e para a melhor visualização, a escala e número de linhas do gid devem ser alteradas como segue.

No menu lateral, escolha Scene. No campo Units selecione Millimeters dos presets.

@felipetavares
felipetavares / polygon.js
Created November 16, 2018 19:19
Polygon Generator: given a set of tile positions create a polygon from its boundary
function cantor(x, y) {
return (x+y)/2*(x+y+1)+y;
}
function decantor(z) {
let w = Math.floor((Math.sqrt(8*z+1)-1)/2);
let t = (w*w+w)/2;
return {
y: z-t,
@felipetavares
felipetavares / lparser.c
Created November 19, 2018 15:43
+= extension for Lua 5.3
static void assignment (LexState *ls, struct LHS_assign *lh, int nvars) {
expdesc e;
check_condition(ls, vkisvar(lh->v.k), "syntax error");
if (testnext(ls, ',')) { /* assignment -> ',' suffixedexp assignment */
struct LHS_assign nv;
nv.prev = lh;
suffixedexp(ls, &nv.v);
if (!vkisindexed(nv.v.k))
check_conflict(ls, lh, &nv.v);
function vec_(x, y)
return { x = x, y = y }
end
function add(a, b)
return vec_(a.x+b.x, a.y+b.y)
end
function sub(a, b)
return vec_(a.x-b.x, a.y-b.y)
@felipetavares
felipetavares / simple_useful_slow.js
Last active October 31, 2024 08:33
Simple, Useful and Slow: Assorted Reference Statistics Functions (utf-8)
// Simple, Useful and Slow
// Assorted Reference Statistics Functions
// UTF-8 Edition
// Shorthands
pow = Math.pow
sqrt = Math.sqrt
pi = Math.PI
@felipetavares
felipetavares / integration.js
Last active August 9, 2019 17:38
Neurologic Client-Side Integration example
// O nome da função pode ser escolhido arbitrariamente
//
// config: objeto contendo configuração estática relacionada ao fluxo;
//
// callback: função que recebe como argumento um bloco a ser adicionado
// ao chat e termina o estado de loading.
function nldAPI_JornalDoCarro_LeadComplete(config, callback) {
// Extrai os dados usando o objeto global "neurolead"
var leadData = neurolead.getData();
@felipetavares
felipetavares / tetrafrac.glsl
Last active October 20, 2019 01:04
Tetrahedron fractals with raymarching. Camera & ambient occlusion. View with https://github.com/Gargaj/Bonzomatic
#version 450 core
uniform float fGlobalTime; // in seconds
uniform vec2 v2Resolution; // viewport resolution (in pixels)
uniform sampler1D texFFT; // towards 0.0 is bass / lower freq, towards 1.0 is higher / treble freq
uniform sampler1D texFFTSmoothed; // this one has longer falloff and less harsh transients
uniform sampler1D texFFTIntegrated; // this is continually increasing
layout(location = 0) out vec4 out_color; // out_color must be written in order to see anything
@felipetavares
felipetavares / paletted_png.c
Created October 17, 2019 11:04
Detect if a PNG has a palette and load palette+data with libpng
// This examples read a PNG and its palette
#include <png.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
int main() {
png_image img;