Skip to content

Instantly share code, notes, and snippets.

@glinesbdev
glinesbdev / output.clj
Last active July 2, 2021 08:25
Very basic Fennel Lexer output
[{:column 0 :line 1 :token "(" :type "LPAREN"}
{:column 1 :line 1 :token "local" :type "KEYWORD"}
{:column 7 :line 1 :token "core" :type "VARIABLE"}
{:column 12 :line 1 :token "(" :type "LPAREN"}
{:column 13 :line 1 :token "require" :type "FUNC"}
{:column 21 :line 1 :token ":core" :type "FUNC"}
{:column 26 :line 1 :token ")" :type "RPAREN"}
{:column 27 :line 1 :token ")" :type "RPAREN"}
{:column 0 :line 3 :token "(" :type "LPAREN"}
{:column 1 :line 3 :token "local" :type "KEYWORD"}
@glinesbdev
glinesbdev / DayOver.lua
Created May 12, 2021 20:40
Roact Portal
local TweenService = game:GetService("TweenService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Nevermore = require(ReplicatedStorage:WaitForChild("Nevermore"))
local Roact = Nevermore("Roact")
local RoactRodux = Nevermore("RoactRodux")
local DayOver = Roact.Component:extend("DayOver")
function DayOver:init()
self.frameRef = Roact.createRef()
@glinesbdev
glinesbdev / timer.lua
Created May 10, 2021 14:04
Lua Timer
local Timer = {}
Timer.__index = Timer
local RunService = game:GetService("RunService")
function Timer.new()
local self = setmetatable({}, Timer)
-- Events
self._finishedEvent = Instance.new("BindableEvent")
@glinesbdev
glinesbdev / mapper.exs
Last active August 9, 2020 03:26
Reducing Reducers - Elixir
defmodule Mapper do
def extract_associations(%{} = game) do
Enum.reduce(map, %{}, fn {key, value}, item ->
cond do
is_map(value) ->
put_map(item, key, extract_map_data(value))
is_list(value) ->
list_data = Enum.reduce(value, [], &[extract_map_data(&1) | &2])
put_map(item, key, list_data)
@glinesbdev
glinesbdev / gitlab-search-shortcut.js
Last active January 3, 2020 18:14
Tamper Monkey Scripts
// ==UserScript==
// @name Gitlab search shortcut
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Gives a keyboard shortcut to the search field in Gitlab
// @author Bradyn Glines
// @include /^https:\/\/gitlab\.*/*/
// @grant none
// ==/UserScript==
@glinesbdev
glinesbdev / main.asm
Last active September 20, 2019 20:42
Gameboy Hello World
INCLUDE "hardware.inc"
; Beginning of the rom
SECTION "Header", ROM0[$100]
di ; Disable interrupts since we don't want to be interrupted
jp Start ; Jump to the Start label
nop ; No nothing for 1 cycle (approx: 1MgHz)
ds $150 - $104 ; Write nothing for $150 to $104 which is the rom header information
@glinesbdev
glinesbdev / keybase.md
Created August 27, 2019 18:21
Keybase

Keybase proof

I hereby claim:

  • I am glinesbdev on github.
  • I am glinesbdev (https://keybase.io/glinesbdev) on keybase.
  • I have a public key ASBRMmmp2RsEJRGIGVCeIKU77U0iUem-U2Wl-blyTxikCwo

To claim this, I am signing this object:

@glinesbdev
glinesbdev / main.rs
Last active August 26, 2019 02:32
Basic Pig Latin Translator - Rust
use std::{
fs::File,
io::{prelude::*, BufReader},
};
mod pig_latin;
fn main() {
let file = File::open("text.txt").expect("Can't open file.");
let file_size = file.metadata().unwrap().len();
@glinesbdev
glinesbdev / fib.asm
Created August 22, 2019 04:14
MacOS Assembly - Fibonacci
global _main
extern _printf
section .text
_main:
push rbx ; We have to save this since we use it
mov ecx, 90 ; ecx will countdown to 0
xor rax, rax ; rax will hold the current number
xor rbx, rbx ; rbx will hold the next number
@glinesbdev
glinesbdev / triangle.asm
Created August 22, 2019 04:13
MacOS Assembly - Triangle
global start
section .text
start:
mov rdx, output ; rdx holds address of next byte to write
mov r8, 1 ; initial line length
mov r9, 0 ; number of stars written on line so far
line:
mov byte [rdx], '*' ; write single star