Skip to content

Instantly share code, notes, and snippets.

View EduardoLopes's full-sized avatar

Eduardo Lopes EduardoLopes

View GitHub Profile
@EduardoLopes
EduardoLopes / react-course.md
Last active September 10, 2020 01:36
Even though i already know React, i'm watching a course about it on Udemy.

React Course

Even though i already know React, i'm watching a course about it on Udemy. The course talks about Hooks, but it's mainly created around class components, and talks a lot about the deprecated lifecycle methods. I was kinda aware of that, it's not a complaint.

I'm writing this to list the things i like and things i don't like about some conventions people follow when making react apps.

I'll be updating this as i'm advancing in the course.

I like

import "random" for Random
class Perlin{
construct new(seed, dimension, octaves, tile, unbias){
_random = Random.new(seed)
_dimension = dimension
_octaves = octaves
var budo = require('budo')
//There's no erro if running this directly from the command line
//the error doesn't show if the dir arg is removed
//if there's the --dir arg, subarg seems to change the result
budo.cli(['app/js/main.js:bundle.js', "--live", "--dir", "./app", "-- -t babelify --presets [ env ]"])
/*
Error: TypeError: file.split is not a function
override public function quad_add( _options:PackedQuadOptions ) : Int {
def(_options.visible, true);
def(_options.flipx, false);
def(_options.flipy, false);
var _uid = Luxe.utils.uniquehash();
//First triangle
@EduardoLopes
EduardoLopes / Main.hx
Last active October 5, 2017 15:56
Luxe shutdown bug - test case
/** TEST 4 **/
/** It tries to destroy NOT_child_sprite even when destroy is called from where Luxe.shutdown is being called **/
import luxe.GameConfig;
import luxe.Input;
import luxe.Sprite;
class Main extends luxe.Game {
@EduardoLopes
EduardoLopes / randompaper
Created September 22, 2016 15:21
Phyton script to randomly change wallpaper on lubuntu picking the wallpaper form a folder
#!/usr/bin/env python
import os,random
wallpapers_dir = '/media/100/Wallpapers/';
wallpaper = random.choice(os.listdir(wallpapers_dir))
os.system("pcmanfm --set-wallpaper="+wallpapers_dir+wallpaper)
@EduardoLopes
EduardoLopes / main.hx
Created December 10, 2015 14:21
Luxe Pixel Perfect camera scale
override function onwindowsized( e:WindowEvent ):Void {
zoomRatio.x = Math.floor(Luxe.screen.w / gameResolution.x);
zoomRatio.y = Math.floor(Luxe.screen.h / gameResolution.y);
//get the smallest zoom ratio between zoomRatio.x and zoomRatio.y, and limit it to be greater or equal 1
zoom = Math.floor(Math.max(1, Math.min(zoomRatio.x, zoomRatio.y)));
var width = gameResolution.x * zoom;
var height = gameResolution.y * zoom;
@EduardoLopes
EduardoLopes / debug.md
Created December 20, 2015 02:54
luxe empty project debug - compiled with hxcpp 3.2.203 official package
$ gdb luxe_empty
GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-linux-gnu".
Type "show configuration" for configuration details.
@EduardoLopes
EduardoLopes / gist:6b9850a7af6fc9babb2f
Last active December 18, 2015 17:21
luxe empty project debug - compiled with hxcpp commit history on 0872fd15501c15f99aa136ba14d859e0cb9aa97a
(gdb) bt
#0  0x08714fa8 in hx::MarkAllocUnchecked (inPtr=0x8932324 <hx::__res_0+4>, __inCtx=0x896be28)
    at /media/160/.haxelib/hxcpp/git/src/hx/gc/Immix.cpp:1307
#1  0x0806d562 in hx::MarkAlloc (inPtr=0x8932324 <hx::__res_0+4>, __inCtx=0x896be28)
    at /media/160/.haxelib/hxcpp/git/include/hx/GC.h:284
#2  0x0807e5fb in hx::MarkMember<String> (outT=..., __inCtx=0x896be28)
    at /media/160/.haxelib/hxcpp/git/include/hx/GcTypeInference.h:36
#3  0x0831ddc7 in phoenix::Shader_obj::__Mark (this=0xb7be433c, __inCtx=0x896be28) at ./src/phoenix/Shader.cpp:1971
#4  0x0871517a in hx::MarkObjectAllocUnchecked (inPtr=0xb7be433c, __inCtx=0x896be28)

Sobre blog

Eu não nasci pra escrever em blog, eu já tentei algumas vezes manter um, mas é bem complicado pra mim, não porque eu sou muito ocupado, eu basicamente não consigo manter o blog atualizado, mesmo que eu tenha vontade de escrever algo eu vou procrastinando até que não escrevo. Há algumas semanas estou pensando em criar um blog pra colocar minhas idéias ou qualquer outras coisas relacionada a código. Mas eu sei que não vou manter ele atualizado, então acho que aqui é um bom lugar pra escrever de vez em quando.