Skip to content

Instantly share code, notes, and snippets.

@kchodorow
kchodorow / Runner.java
Created April 17, 2015 20:39
Friday's class example
import java.util.ArrayList;
public class Runner {
public static void main(String[] args) {
Person msM = new Teacher("Ms.", "M");
ArrayList<Person> people = new ArrayList<Person>();
people.add(msM);
msM.getName();
((Teacher) msM).assignHomework();
@kchodorow
kchodorow / Zoo.java
Created April 17, 2015 20:50
Homework skeleton
import java.util.ArrayList;
public class Zoo {
public static void main(String[] args) {
ArrayList<Animal> animals = new ArrayList<Animal>();
// Generate 100 random animals.
for (int i = 0; i < 100; i++) {
double randomNum = Math.random();
@kchodorow
kchodorow / server.py
Created May 12, 2015 16:35
A very basic server
import time
import BaseHTTPServer
HOST_NAME = 'localhost'
PORT_NUMBER = 9000 # Choose a number > 1024.
class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_GET(s):
"""Respond to a GET request."""
s.send_response(200)
@kchodorow
kchodorow / javadoc.bzl
Last active June 15, 2017 07:45
Javadoc-generating rule for Bazel
# Copyright 2015 The Bazel Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@kchodorow
kchodorow / deps.sh
Created December 24, 2015 19:56
Setup a directory for making a game with Phaser.io, Closure, and Git
#!/bin/bash
set -e
js/closure-library/closure/bin/build/depswriter.py --root_with_prefix='. ../../../..' > deps.js
cat deps.js
@kchodorow
kchodorow / fix_workspace.py
Last active February 5, 2016 21:26
Replaces illegal repository names with legal ones.
#!/usr/bin/env python
#
# Copyright 2016 The Bazel Authors. All arights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
load("//:tester.bzl", "greet")
greet(
name = "a-greeting",
my_name = "kristina",
)
@kchodorow
kchodorow / .emacs
Created September 16, 2016 14:19
Emacs config
(setq-default indent-tabs-mode nil)
(setq column-number-mode t)
(custom-set-variables
'(js2-global-externs (quote ("goog"))))
(add-hook 'js2-post-parse-callbacks
(lambda ()
(let ((buf (buffer-string))
(index 0))
(while (string-match "\\(goog\\.require\\|goog\\.provide\\)('\\([^'.]*\\)" buf index)
(setq index (+ 1 (match-end 0)))
@kchodorow
kchodorow / BUILD
Last active April 3, 2017 15:53
load() example
load('//:my-first-extension.bzl', 'greeting')
greeting()
@kchodorow
kchodorow / BUILD
Created March 29, 2017 16:48
Simple rule example
load('//bazel:my-first-rule.bzl', 'my_rule')
my_rule(name = 'whatever')