Skip to content

Instantly share code, notes, and snippets.

Man At Work 🚜

Eduardo Pereira eduardonunesp

Man At Work 🚜
View GitHub Profile
View snake.c
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <SDL2/SDL.h>
#ifdef _DEBUG
#define LOG(msg) printf(msg);
#define LOGF(fmt, ...) fprintf(stdout, fmt, __VA_ARGS__)
eduardonunesp / fakes3.test.js
Created Jun 30, 2020
Using Node.js AWS-SDK + FakeS3 mocking tests
View fakes3.test.js
const fs = require('fs')
const AWS = require('aws-sdk')
const FAKE_S3_HOST = process.env.FAKE_S3_HOST || "localhost"
const FAKE_S3_PORT = process.env.FAKE_S3_HOST || "localhost"
// Create S3 service object using fakes3
const s3 = new AWS.S3({
region: 'us-east-2',
secretAccessKey: '123',
eduardonunesp / main.cpp
Last active May 15, 2020
Vector2 template with useful functions for geometry
View main.cpp
#include <iostream>
#include "Vector2.h"
int main(int argc, const char * argv[]) {
Vector2<float> u {-8, 1};
Vector2<float> v {-2, 7};
std::cout << "Anglen (degrees): " << u.angle(v) * (180/M_PI) << std::endl;
return 0;
View monte_carlo.cpp
#include <iostream>
#include <random>
#include <vector>
#include <math.h>
#include <sstream>
struct Vector {
int x;
int y;
View OpenGLApplication.cpp
#include <stdlib.h>
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <iostream>
//macro to write shader programs inline
#ifndef GLSL
#define GLSL(version,A) "#version " #version "\n" #A
extends Node2D
signal swipe(direction)
var swipe_start = null
var minimum_drag = 100
func _unhandled_input(event):
if event.is_action_pressed("ui_click"):
swipe_start = get_global_mouse_position()
eduardonunesp / observer.go
Created Sep 24, 2019
Simple Observer Pattern In Go
View observer.go
package main
import (
type (
Observable interface {
Add(observer Observer)
eduardonunesp / player.cs
Last active Sep 24, 2019
Unity Move Towards Angle
View player.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Player : MonoBehaviour
public float rotateSpeed = 30f;
public float moveSpeed = 200f;
private Rigidbody2D rb;
View flatten.js
const _ = require('lodash')
* Returns a new array that is a one-dimensional flattening of self (recursively)
* Warning: Because it's a recursive function be careful when use against huge
* neested arrays it can throw Maximum Stack Size Exceeded on JS VMs
* Know limits of calls for browsers
* - IE 11: 12,064
View game_coin.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Coin : MonoBehaviour
// Config
[Header("Private States")]
[SerializeField] private AudioClip fxCatch;
private bool available = true;
You can’t perform that action at this time.