Skip to content

Instantly share code, notes, and snippets.

View matias-eduardo's full-sized avatar
🏝️
🇵🇷

matias matias-eduardo

🏝️
🇵🇷
View GitHub Profile
@matias-eduardo
matias-eduardo / particle-with-soa.c
Created July 15, 2023 19:31
Particles with SOA
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#if defined(__linux)
#define HAVE_POSIX_TIMER
#include <time.h>
#ifdef CLOCK_MONOTONIC
#define CLOCKID CLOCK_MONOTONIC

Minimal D3D11

Minimal D3D11 reference implementation: An uncluttered Direct3D 11 setup & basic rendering primer / API familiarizer. Complete, runnable Windows application contained in a single function and laid out in a linear, step-by-step fashion that should be easy to follow from the code alone. ~215 LOC. No modern C++ / OOP / obscuring cruft. View on YouTube

hollowcube

@matias-eduardo
matias-eduardo / wm_char.cpp
Last active May 23, 2021 07:30
wm_char and sending unicode codepoint event
// window.event.character_input -- // note(matias): not always triggered by keydown
case WM_CHAR: {
State& state = *(State*)GetWindowLongPtrW(hwnd, GWLP_USERDATA);
uint32_t ch = (uint32_t)wParam;
// note(matias): searching for utf-16 in wikipedia helps a lot here
// ch.is_printable?
if ((ch >= 32 && ch != 127) || ch == '\t' || ch == '\n' || ch == '\r') {
@matias-eduardo
matias-eduardo / osx_window.odin
Last active March 1, 2021 07:24
Small script to create an OSX window with Odin. [WIP]
package main
import "core:fmt"
foreign import objc "system:objc"
foreign import cg "system.CoreGraphics.framework"
@force foreign import _appkit "system:Appkit.framework"
main :: proc() {
@matias-eduardo
matias-eduardo / aoc_day_4.odin
Last active December 8, 2020 06:42
Advent of Code 2020 - Day 4
package main
import "core:os"
import "core:fmt"
import "core:strings"
import "core:strconv"
import "core:container"
import "core:unicode"
main :: proc() {
@matias-eduardo
matias-eduardo / foldcomments.py
Created April 29, 2020 08:23
My own version of Fold Comments Sublime Package
from sublime import Region, Settings, load_settings
import sublime_plugin
from itertools import tee, chain
try:
from itertools import izip as zip
except ImportError: # will be 3.x series
pass
@matias-eduardo
matias-eduardo / 01_github_status_update.rb
Last active March 23, 2022 03:00
A script that updates GitHub user status using the GraphQL API v4 (Usage: Run once per minute)
# frozen_string_literal: true
require "dotenv/load"
require "graphql/client"
require "graphql/client/http"
module GitHub
# -1- Initialize client
HTTP = GraphQL::Client::HTTP.new("https://api.github.com/graphql") do
def headers(context)
@matias-eduardo
matias-eduardo / CSS.sublime-syntax
Last active December 29, 2022 02:57
Sublime Text Settings and Syntax Highlighting
%YAML 1.2
---
# Derived from https://github.com/i-akhmadullin/Sublime-CSS3
name: CSS
file_extensions:
- css
- css.erb
- css.liquid
scope: source.css
variables:
@matias-eduardo
matias-eduardo / vertical-integration.md
Created September 24, 2018 15:29
Peter Thiel on Vertical Integration

There are, in my mind, probably only two broad categories in the entire history of the last two hundred and fifty years where people actually came up with new things and made money doing so. One is these sort of vertically integrated complex monopolies which people did build in the second industrial revolution at the end of the nineteenth and start of the twentieth century. This is like Ford, it was the vertically integrated oil companies like Standard Oil, and what these vertically integrated monopolies typically required was a very complex coordination, you've got a lot of pieces to fit together in just the right way, and when you assemble that you had a tremendous advantage. This is actually done surprisingly little today and so I think this is sort of a business form that when people can pull it off, is very valuable.

It's typically fairly capital intensive, we live in a culture where it's very hard to get people to buy into anything that's super complicated and takes very long to build. When I think of

class EraserController < ApplicationController
include ShopifyApp::WebhookVerification
def customer
params.permit!
# We don't store Shopify customer info.
head :ok
end