Skip to content

Instantly share code, notes, and snippets.

View norman784's full-sized avatar

Norman Paniagua norman784

  • Kiel, Germany
View GitHub Profile
@norman784
norman784 / .bash_function
Last active January 29, 2020 07:50
bash functions
export EDITOR="vim"
function copy() {
pbcopy < $1
}
fzf_edit() {
files=$1
editor=$2
query=$3
@norman784
norman784 / snake.hai
Last active November 22, 2019 10:41
Syntax exploration for programming language focused on game development prototyping
-- Pseudo oversimplistic snake implementation to explore language syntax
-- Import multiple elements of the same package
import std.input { Key key_pressed }
-- Struct declaration
struct Canvas { height: Float width: Float }
struct Vec2 { x: Float y: Float }
struct Snake {
@norman784
norman784 / subnautica_optoctrees.py
Created October 25, 2018 15:02 — forked from AlpyneDreams/subnautica_optoctrees.py
Subnautica Optoctree Batches
def read_int(stream, size=1):
return int.from_bytes(stream.read(size), byteorder='little')
class Node:
def __init__(self, stream):
self.material = read_int(stream)
self.distance = read_int(stream)
self.child = read_int(stream, 2)
@norman784
norman784 / Geometry.swift
Last active October 18, 2023 00:15
Custom geometry with UV texture mapping
//**************
// It works now, but theres some things that I don't get it yet
// like the texture faces in the UV mapping, theres no logic order (at least that I can understand)
//**************
// Texture image
// https://imgur.com/jwKWRBJ
let texture = #imageLiteral(resourceName: "texture")
// Half geometry size
let halfSide: Float = 0.5
@norman784
norman784 / reload.sh
Created January 15, 2018 12:37
Bash script that override Xcode project settings to set the build path relative to the project itself
#!/bin/bash
# TODO: Research how to accomplish this when distributing the library through SPM
# TODO: Check linux OpenGL shader copy files
if [ "$(uname)" == "Darwin" ]; then
swift package generate-xcodeproj
SETTINGS="Enjin.xcodeproj/project.xcworkspace/xcuserdata/$USER.xcuserdatad/WorkspaceSettings.xcsettings"
@norman784
norman784 / Package.swift
Created January 2, 2018 14:22
Support platform specific implementations
// swift-tools-version:4.0
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "CLI",
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.executable(
@norman784
norman784 / main.swift
Created December 20, 2017 14:10
Lazy way to initialize a class without having multiple constructors (only works with mutable vars)
class Demo {
var foo: String? = nil
var bar: String? = nil
init(block: (Demo) -> Void) {
block(self)
}
}
Demo {
@norman784
norman784 / gist:5415468
Last active December 16, 2015 09:49
Functions that I use to localize my apps
<?php
function i18n($file = null) {
global $transtation;
$transtation = array();
if (!isset($_SESSION['lang'])) $_SESSION['lang'] = 'en';
if (!$file) $file = 'default';