Skip to content

Instantly share code, notes, and snippets.

View LOZORD's full-sized avatar
💭
i'm chillin

Leo Rudberg LOZORD

💭
i'm chillin
View GitHub Profile
@LOZORD
LOZORD / BusPolicy.java
Last active November 19, 2015 06:03
The programmatic representation of whether or not you are a Badger who takes WildHacks by storm.
// Whether Passenger p (you) can get on the bus at Time t
public boolean attemptToGetOnBus(Passenger p, Time t) throws HustleError {
if (!p.location().equal("CS Building")) {
return false; // what are you doing, kiddo?
} else if (!p.isRegisteredForWildHacks()) {
return false;
}
Time startTime = Time.earliestOf(LEO.arrival(), Time.FIVE_THIRTY);
@LOZORD
LOZORD / maze-gen.hs
Last active November 28, 2015 05:16
A dividing-chamber maze generation program in Haskell
import Data.Matrix
import Data.List --(sortBy, intercalate, minimumBy, maximumBy, filter, nubBy)
import qualified Data.Vector as Vector -- hiding (Vector(++))
import System.Environment (getArgs)
import Data.Bits (xor, rotate, shift, complement)
data Cell = Empty | Wall deriving (Eq)
instance Show Cell where
show c = case c of
Empty -> " "
Wall -> "#"
@LOZORD
LOZORD / day1.rb
Last active December 6, 2015 20:42
My solutions to adventofcode.com
flr = 0
cc = 1
basement_char = nil
File.open('parens.txt', 'r') do |file|
file.each_line do |line|
line.chars.each do |c|
if c == '('
flr += 1
elsif c == ')'
@LOZORD
LOZORD / factory_test.js
Created February 4, 2016 19:25
Factory Example in ES6 (using Babel)
class Abstr {
constructor(f, o) {
this.f = f;
for (var key in o) {
this[key] = o[key];
}
}
run () {
this.f(this);
}
@LOZORD
LOZORD / orgiss.rb
Created August 20, 2016 23:42
A Ruby script for seeing the number of issues across a GitHub organization
#!/usr/bin/env ruby
# be sure to run `gem install octokit`
require 'octokit'
# `io/console` does not need to be installed, just required
require 'io/console'
def get_input(message, hide_entry = false)
print message + '? '
if hide_entry
@LOZORD
LOZORD / main.c
Created September 8, 2016 05:03
Simple cgo test
#include <stdlib.h>
#include <stdio.h>
extern char * GoStrEq(char * cs1, char * st2);
int main(int argc, char ** argv) {
char * s1;
char * s2;
if (argc == 3) {
@LOZORD
LOZORD / Spell.hs
Created September 8, 2016 21:50
Haskell Norvig Spell Correcter
-- Based off of the Peter Norvig Python implementation:
-- http://norvig.com/spell-correct.html
module Spell where
import qualified Data.Map.Strict as Map
import qualified Data.List as List
import qualified Data.Set as Set
wordProbability :: Fractional v => Map.Map String v -> String -> v
wordProbability allWords myWord =
@LOZORD
LOZORD / ng_talk.md
Last active April 28, 2018 15:57
Angular (2 ≤) talk for CUNY Hackathon 2017
@LOZORD
LOZORD / go_talk.md
Last active November 25, 2017 08:26
Let's build a server with Go!

Let's hack with Go!

In this Gist, I'll show you how to get a simple HTTP/JSON server working with the Go programming language.

Link to this guide: goo.gl/cDvRKj.

Thanks to Evan for critiquing this guide!

Intro

Go is an open source programming language made by Google and used by many developers around the world.

@LOZORD
LOZORD / main.cpp
Created March 21, 2018 02:39
My first C++ program (started 3/1/13)
//
// main.cpp
// test!!!
//
// Created by Leo Rudberg on 3/1/13.
// Copyright (c) 2013 Leo Rudberg. All rights reserved.
//
#include <iostream>
#include <string>