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 / .bash_aliases
Last active August 28, 2016 20:56
Github aliases - Keeping it simple
alias gs='git status '
alias ga='git add . '
alias gc='git commit -m '
alias gp='git push '
alias ac='git add . && git commit -m '
# Inspired by 21st Century C, 2nd Ed. <- go check it out!
# Purpose: Compile code from the terminal (stdin).
# Note: allheads.h simply includes all the basic sys h files.
# Careful: using the c2go alias runs then removes the a.out.
# How to use:
# $> go_c << '---'
# heredoc> int main() { printf("Hello from the terminal!\n"); }
# heredoc> ---
Rails.application.config.middleware.use OmniAuth::Builder do
# Offline auth
provider :shopify,
ShopifyApp.configuration.api_key,
ShopifyApp.configuration.secret,
scope: ShopifyApp.configuration.scope,
setup: lambda { |env|
strategy = env['omniauth.strategy']
shopify_auth_params = strategy.session['shopify.omniauth_params']&.with_indifferent_access
Rails.application.config.middleware.use OmniAuth::Builder do
# Online auth
provider :shopify,
ShopifyApp.configuration.api_key,
ShopifyApp.configuration.secret,
scope: ShopifyApp.configuration.scope,
per_user_permissions: true,
setup: lambda { |env|
strategy = env['omniauth.strategy']
class EraserController < ApplicationController
include ShopifyApp::WebhookVerification
def customer
params.permit!
# We don't store Shopify customer info.
head :ok
end
@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

@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 / 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 / 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 / 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') {