Skip to content

Instantly share code, notes, and snippets.

View SealtielFreak's full-sized avatar
🌴
On vacation

SealtielFreak SealtielFreak

🌴
On vacation
View GitHub Profile
@SealtielFreak
SealtielFreak / bomp_demo.rb
Created July 9, 2021 22:59
Collision demo with Bomp library for Ruby2D
require 'ruby2d'
require 'bomp'
class Box < Rectangle
attr_reader :x, :y, :width, :height
def initialize
super()
self.width = rand 50..150
self.height = rand 50..150
@SealtielFreak
SealtielFreak / index.html
Created July 14, 2021 07:26
Brython and MelonJS
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.jsdelivr.net/npm/brython@3/brython.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/brython@3/brython_stdlib.js"></script>
<script src="https://cdn.jsdelivr.net/npm/melonjs/dist/melonjs.js"></script>
@SealtielFreak
SealtielFreak / package.json
Created July 16, 2021 20:29
Love2D-Typescript
{
"private": true,
"scripts": {
"build": "tstl",
"dev": "tstl --watch",
"love": "love dist"
},
"devDependencies": {
"typescript-to-lua": "...",
"love-typescript-definitions": "...",
@SealtielFreak
SealtielFreak / makefile
Created July 19, 2021 16:28
Makefile template
CC = g++
CFLAGS = -Wall -std=c++2a -m32 -march=i386
LDFLAGS = -static -static-libstdc++
CLIBS =
SRC = src
OBJ = obj
DEP = include
@SealtielFreak
SealtielFreak / arg_parser.cpp
Last active October 2, 2021 23:30
Argument Parser
#include <iostream>
#include <istream>
#include <regex>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
const auto args = "register --name Diego Sealtiel Valderrama Garcia --age 21 -m --software-engineer AFF8310274";
const std::vector<std::string> except_flags = {"--software-engineer", "-m"};
interface ObjectCallable {
call(...args: any[]): void
}
class ClosurePrintLine implements ObjectCallable {
private _it: number
private _step: number
constructor(step: number = 16) {
this._it = 0
#include <iostream>
#include <string>
#include <map>
#include <thread>
#include <functional>
#include <forward_list>
#include <cstdio>
typedef std::map<std::string, void*> MemoryState; // map is no optimized, need a forward_list
@SealtielFreak
SealtielFreak / perceptron.rb
Last active February 1, 2022 23:01
IA on Ruby
#!/usr/bin/ruby
=begin
Perceptron simple with self-learning
Demonstration of an OR gate programmed in Ruby
with a simple perceptron
=end
inputs = [[-1, -1], [-1, 1], [1, -1], [1, 1]]
@SealtielFreak
SealtielFreak / pipe.cpp
Created May 28, 2022 16:42
Pipes in C++
template<typename T>
class Pipe {
T m_value;
public:
Pipe(const T &value) : m_value(value) { /**/ }
Pipe<T> operator |(const std::function<T(T)> &func) {
return func(m_value);
}
@SealtielFreak
SealtielFreak / functor.cpp
Created May 28, 2022 16:49
Functor in CPP
template<typename R, typename ...Args>
class Functor {
protected:
virtual R call(Args ...args) = 0;
public:
R operator()(Args ...args) {
return call(args...);
}
};