Skip to content

Instantly share code, notes, and snippets.

View bendyorke's full-sized avatar

Ben Yorke bendyorke

View GitHub Profile
bendyorke / Colorized Terminal Output
Created June 30, 2013 20:56
How to colorize text in the terminal
//foreground color
public static final String BLACK_TEXT() { return "\033[30m";}
public static final String RED_TEXT() { return "\033[31m";}
public static final String GREEN_TEXT() { return "\033[32m";}
public static final String BROWN_TEXT() { return "\033[33m";}
public static final String BLUE_TEXT() { return "\033[34m";}
public static final String MAGENTA_TEXT() { return "\033[35m";}
public static final String CYAN_TEXT() { return "\033[36m";}
public static final String GRAY_TEXT() { return "\033[37m";}
/* Here is your chance to take over Socrates!
Spend 10 minutes on each of the following hacks to the socrates website.
Enter them in the console to make sure it works and then save
your results here.
Choose a new pair for each. Add your names to the section you complete.
bendyorke / index.html
Last active December 19, 2015 07:19 — forked from dbc-challenges/index.html
DBC Phase 2 Practice Assessment Part 3
<!doctype html>
<link rel="stylesheet" href="">
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href=",400,600,700,800">
<link rel="stylesheet" href=",900">
<link rel="stylesheet" href="">
bendyorke / zoo.js
Last active December 19, 2015 07:29 — forked from dbc-challenges/zoo.js
// YOUR CODE: Create your Zoo "object literal" and Animal "constructor" and "prototypes" here.
var Zoo = {
animals: {},
init: function(animalInput) {
for(index in animals) {
this.animals[animalInput[index].name] = animalInput[index].legs;
bendyorke / gist:6059481
Created July 23, 2013 02:46
<form action="/${1:url}" method="post">
<input type="${2:text}" name="$3">
<input type="${4:password}" name="$5">
${6:<input type="submit" value="Submit">}
<scope>text.html - ruby</scope>
module GameOfLife
def input, n
# return 42 if input == "the universe and everything"
@board = make_board_from input
n.times { age!; print_board; sleep(0.2) }
def self.age!
results = parse_cells
process results
bendyorke / benchmark.rb
Created May 20, 2014 06:54
Benchmarking sampling of a hash
require "benchmark"
n = 10000
arr = (1..1000).to_a
zip = arr
hash = Hash[zip] do |x|"%-30s" %["sampling array"]) { n.times do
bendyorke /
Last active March 12, 2021 14:25
Setting up a new mac
bendyorke / todo
Last active August 29, 2015 14:04
#!/usr/bin/env python
""" |"""
"""t is for people that want do things, not organize their tasks."""
from __future__ import with_statement
import os, re, sys, hashlib
from operator import itemgetter
from optparse import OptionParser, OptionGroup
bendyorke / zero_to_clojure.clj
Last active May 13, 2016 21:11
Fully featured clojure web server in 10 lines of code
#! /usr/bin/env boot
(set-env! :dependencies '[[compojure "1.5.0"]
[http-kit "2.1.8"]])
(require '[compojure.core :refer [defroutes GET]])
(require '[org.httpkit.server :refer [run-server]])
(defroutes routes
(GET "/" [] "Hello World!"))