Skip to content

Instantly share code, notes, and snippets.

@glinesbdev
glinesbdev / main.ml
Created August 22, 2024 01:22
Code Wars Ocaml Powers of Two kata
let rec power x n =
match n with
| 0 -> 1
| _ -> x * (power x (n - 1))
let powersOfTwo n =
let rec loop acc d =
match d with
| 0 -> acc
| x -> loop (acc @ [power 2 x]) (x - 1)
@glinesbdev
glinesbdev / AuraEffectActor.cpp
Last active November 19, 2023 06:53
AuraEffectActor Side Quest (From Udemy Course)
void AAuraEffectActor::OnOverlap(AActor* TargetActor)
{
// ... original code here...
// For each of the EEffectApplicationPolicy::ApplyOnOverlap, apply effect to the target
for (const auto& EffectPolicy : FilterApplicationGameplayEffects(EEffectApplicationPolicy::ApplyOnOverlap))
{
ApplyEffectToTarget(TargetActor, EffectPolicy.Key);
}
}
@glinesbdev
glinesbdev / main.emojic
Last active April 23, 2023 20:30
Emojicode - JSON HTTP Request
📜 🔤request.emojic🔤
🏁 🍇
🆕🗺️ 🔤jsonplaceholder.typicode.com🔤 🔤/todos/1🔤❗ ➡️ request
🆗 🚀request❗ 🍇
💪request❗ ➡️ body
😀 body❗
🍉
🙅 error 🍇
@glinesbdev
glinesbdev / _main.emojic
Last active April 22, 2023 06:45
Emojicode - Classes
📜 🔤customer.emojic🔤
📜 🔤astronaut.emojic🔤
📜 🔤credit_card.emojic🔤
📜 🔤helpers.emojic🔤
🏁 ➡️ 🔢 🍇
🆕💳 🔤48829284848291🔤 🔤12/24🔤 🔤512🔤❗ ➡️ 🖍️🆕customer_credit_card
🆕💳 🔤84562234578543🔤 🔤05/27🔤 🔤854🔤❗ ➡️ astronaut_credit_card
🆕👩‍💼 🔤Frank🔤 🔤Williams🔤 customer_credit_card❗ ➡️ customer
@glinesbdev
glinesbdev / args.rs
Last active January 15, 2023 03:08
Sample program to open and write to a file conditionally with arguments (https://github.com/glinesbdev/file_reader_writer)
use std::path::Path;
use crate::types::Result;
/// Struct to store command line arguments
pub struct Args {
filepath: String,
contents: String,
append: bool,
truncate: bool,
@glinesbdev
glinesbdev / LTexture.cpp
Last active August 8, 2022 16:41
C++ Rule of 5
#include "LTexture.h"
LTexture::~LTexture()
{
Free();
}
LTexture::LTexture(const LTexture& other)
: mWidth(other.mWidth)
, mHeight(other.mHeight)
@glinesbdev
glinesbdev / bank.cr
Created April 14, 2022 16:25
gw2_data_gen output
require "json"
module Gw2Api
struct Bank
include JSON::Serializable
# The item's ID.
getter id : UInt32
# The amount of items in the item stack.
@glinesbdev
glinesbdev / Service.lua
Created October 17, 2021 06:02
Rodux store:dispatch error
function Service:SetProfile(player: Player, key: string, value: any)
DataManager:Set(player, key, value)
self.Client.FetchStoreAction:Fire(player, { type = ReducerActions.UPDATE_PLAYER_PROFILE })
end
@glinesbdev
glinesbdev / fnlfmt-output.clj
Created July 4, 2021 18:04
Fennel formatting -- off?
(where ident (not (identifier? ident))) (if (keyword? str-token)
(parsers.next text pos col 1
line tokens
str-token
types.keyword)
(string.find str-token "^:%w*")
;; Match a "string" identifier i.e. :hello
(parsers.next text pos col 1
line tokens
str-token
@glinesbdev
glinesbdev / lexer.clj
Last active July 3, 2021 00:06
Fennel Lexer
(local keywords (require :keywords))
(local types {:arg "ARG"
:doc "DOCSTRING"
:fn "FUNC"
:keyword "KEYWORD"
:let "VARIABLE"
:lbracket "LBRACKET"
:lcurly "LCURLY"
:lparen "LPAREN"