Skip to content

Instantly share code, notes, and snippets.

View benzap's full-sized avatar
🏠
Working from home

Benjamin Zaporzan benzap

🏠
Working from home
View GitHub Profile
@benzap
benzap / p3.rs
Created December 4, 2018 03:07
Broken Implementation for Problem 3
// Problem 3
#![allow(unused)]
extern crate regex;
use std::default::Default;
use std::collections::HashMap;
use std::collections::HashSet;
use std::io::BufReader;
use std::io::BufRead;
@benzap
benzap / MultiLinkedList.sol
Last active October 5, 2018 22:13
Multi Linked List Implementation in Solidity
pragma solidity ^0.4.24;
/*
Title:
Multiple Linked List Storage
Description:
Dynamic Storage Contract for storing multiple linked lists each
uniquely identified by a key. Implementation allows for
@benzap
benzap / byte.cljc
Last active March 16, 2022 09:41
Working with bytes between clojure and clojurescript
(ns byte
"My own take on byte conversion. `(byte)` doesn't work with unsigneds
within clojure, and signed values don't work well within
clojurescript. Includes additional bitwise functions for working
specifically with bytes.")
(defn signed
"Signed byte that works between clojure and clojurescript.
@benzap
benzap / hiccup2xml
Last active September 20, 2018 15:55
hiccup2xml script written in eden
#!/usr/bin/env eden
local help-message = "
hiccup2xml - Hiccup Markup to XML Markup
Usage:
hiccup2xml read <filename>
hiccup2xml eval <string>
@benzap
benzap / ChefFactory.sol
Last active September 18, 2018 18:31
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.4.25+commit.59dbf8f1.js&optimize=true&gist=
pragma solidity ^0.4.7;
contract ChefFactory {
event CreateChef(address _address);
struct Chef {
uint8 cooking_ability; // Personal Cooking Rating 1-10
uint8 baddaboops; // Acquired Taste Rating 1-10
}
@benzap
benzap / i3-config
Created September 7, 2018 15:59
~/.i3/config file for i3 window manager
# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
#
# This config file uses keycodes (bindsym) and was written for the QWERTY
# layout.
#
# To get a config file with the same key positions, but for your current
# layout, use the i3-config-wizard
#
@benzap
benzap / edn_linter.cljc
Created August 4, 2018 01:29
EDN Linter Example Use Case
(ns edn-linter
;; require name of edn linter
(:require [the-name :refer [parse-with-info]]
(def input-string "[:a :b
{:test 123}]")
(def parsed-edn (parse-with-info input-string))
;; {:line 0
;; :type :vector
@benzap
benzap / higher-order-fizzbuzz.fif
Created May 28, 2018 07:22
Higher Order fizzbuzz from reddit post
;; From reddit comments
;; https://www.reddit.com/r/Clojure/comments/8lizcb/rclojure_fizz_buzz_contest_hardmode/
$clear-stack
doc higher-fizzbuzz
"( map seq -- seq ) Returns modified seq with map target factors."
fn higher-fizzbuzz
*xs <> setl
*m <> setl
@benzap
benzap / fif-repl.cljs
Last active May 28, 2018 04:49
Fif Interactive Repl Used in blog posts
(ns website.fif-repl
(:require
[clojure.string :as str]
[rum.core :as rum]
[fif.core :as fif]
[fif.stack-machine :as stack]
[fif.stack-machine.error-handling :refer [set-error system-error]]
;; Nothing to see here
[website.repl-imports :refer [import-super-secret-words]]))
@benzap
benzap / fizzbuzz.fif
Last active May 28, 2018 07:20
Fizzbuzz in fif langauge github.com/benzap/fif
fn fizz-buzz
*n <> setl
n 3 mod zero?
n 5 mod zero? and if "FizzBuzz" else
n 3 mod zero? if "Fizz" else
n 5 mod zero? if "Buzz" else
n
then then then
endfn