Skip to content

Instantly share code, notes, and snippets.

Avatar
💻
Man At Work 🚜

Eduardo Pereira eduardonunesp

💻
Man At Work 🚜
View GitHub Profile
@eduardonunesp
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
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>
#define GLEW_STATIC
#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
#endif
View SwipeDetector.gd
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
eduardonunesp / observer.go
Created Sep 24, 2019
Simple Observer Pattern In Go
View observer.go
package main
import (
"fmt"
"sync"
)
type (
Observable interface {
Add(observer Observer)
View velocity_towards_angle.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Player : MonoBehaviour
{
public Rigidbody2D rb;
public float rotateSpeed = 300f;
public float angularSpeed = 10f;
private float yAxis;
View character_controller.cs
using UnityEngine;
using UnityEngine.Events;
public class CharacterController2D : MonoBehaviour
{
[SerializeField] private float m_JumpForce = 400f; // Amount of force added when the player jumps.
[Range(0, 1)] [SerializeField] private float m_CrouchSpeed = .36f; // Amount of maxSpeed applied to crouching movement. 1 = 100%
[Range(0, .3f)] [SerializeField] private float m_MovementSmoothing = .05f; // How much to smooth out the movement
[SerializeField] private bool m_AirControl = false; // Whether or not a player can steer while jumping;
[SerializeField] private LayerMask m_WhatIsGround; // A mask determining what is ground to the character
View timer.cs
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Bomb : MonoBehaviour
{
// Use this for initialization
void Start()
{
int seconds = 3;
@eduardonunesp
eduardonunesp / destroy_after_animation_end.cs
Last active Sep 24, 2019
Destroy Game Object after animation end
View destroy_after_animation_end.cs
using UnityEngine;
public class ExplosionCenter : MonoBehaviour
{
// Use this for initialization
void Start()
{
Destroy(gameObject, this.GetComponent<Animator>().GetCurrentAnimatorStateInfo(0).length);
}
You can’t perform that action at this time.