Skip to content

Instantly share code, notes, and snippets.

View fowlmouth's full-sized avatar
🦃

Tim E fowlmouth

🦃
View GitHub Profile
@vasanthk
vasanthk / System Design.md
Last active July 24, 2024 23:02
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
// Implements http://rosettacode.org/wiki/Checkpoint_synchronization
//
// We implement this task using Rust's Barriers. Barriers are simply thread
// synchronization points--if a task waits at a barrier, it will not continue
// until the number of tasks for which the variable was initialized are also
// waiting at the barrier, at which point all of them will stop waiting. This
// can be used to allow threads to do asynchronous work and guarantee properties
// at checkpoints.
use std::sync::atomic::AtomicBool;
import macros
macro `=>`(p, b: expr): expr {.immediate.} =
echo treeRepr(p)
#echo(treeRepr(b))
var params: seq[PNimrodNode] = @[newIdentNode("auto")]
case p.kind
of nnkPar:
for c in children(p):
@zah
zah / Messages.nim
Last active December 16, 2015 23:58
Registering messages
there are 3 types of messages
1) statically dispatched to a certain component:
if has(Component): get(Component).doMessage(args)
2) dynamically dispatched to a single component
let (offset, proc_ptr) = entity->typeinfo->vtable[messageID]
proc_ptr(entity->data[offset], args)
3) dynamically dispatched to every component that implements them (multicast messages)
let runlist = entity->typeinfo->multicast_vtable[messageID]
@fowlmouth
fowlmouth / entitty.nim
Last active December 16, 2015 23:49
nimrod component/entity system
## entitty has been moved to the fowltek package
@fowlmouth
fowlmouth / SNACK.rb
Last active December 16, 2015 08:08
SNUSP Needed a stACK
%w/gosu ostruct optparse/.each &method(:require)
include Gosu
file = nil
playfieldSize = nil
mode = :SNACK
ipf = 1
font = './LiberationMono-Regular.ttf'
autostart = false
import irc, re, tables, macros, macro_dsl
var
commands = initTable[string, proc(event: var TircEvent;
args: string){.closure.}]()
handlers: seq[tuple[
pattern: TRegex;
match: proc(event: var TircEvent; args: var openarray[string]){.
closure.}]] = @[]
matchPattern: TRegex

Adds a few new spells which let you eat soulgems to recharge your magicka. Find the new spells (they are actually lesser powers) in the console with help "Tome: Consume" -- I'll put them in levelled loot or something later

  • Black souls restore 175 Magickz, -50% magicka regeneration for 30 seconds
  • Grand souls restore 150 Magickz, -40% magicka regeneration for 30 seconds
  • Greater souls restore 100 magickz, -25% magicka regen for 25 seconds
  • Common souls restore 75 magickz, -18% magicka regen for 20 seconds
  • Lesser souls restore 50 magickz, -12% magicka regen for 15 seconds
  • Petty souls restore 25 magickz, -6% magicka regen for 10 seconds