Skip to content

Instantly share code, notes, and snippets.

View jutonz's full-sized avatar

Justin Toniazzo jutonz

  • thoughtbot
  • Orlando, Florida, USA
  • 06:54 (UTC -04:00)
View GitHub Profile

Keybase proof

I hereby claim:

  • I am jutonz on github.
  • I am jutonz (https://keybase.io/jutonz) on keybase.
  • I have a public key ASB4kgScwqq-AQAdN-YS6Cjtn9kajFex2zil_yfIYg6yugo

To claim this, I am signing this object:

@jutonz
jutonz / server.java
Created October 15, 2015 03:43
Simple HTTP server in Java
import java.io.IOException;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.util.Random;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import com.sun.net.httpserver.HttpServer;
public class Server {
@jutonz
jutonz / server.cr
Created October 15, 2015 03:22
Simple HTTP server in Crystal
require "http/server"
port = 8080
server = HTTP::Server.new(port) do |request|
HTTP::Response.ok "text/plain", "Hello, Ajita#{"a" * rand(20)}"
end
puts "Listening on localhost:#{port}"
server.listen
@jutonz
jutonz / server.go
Created October 15, 2015 03:20
Simple HTTP server in Go
package main
import (
"fmt"
"time"
"io"
"net/http"
"math/rand"
"bytes"
)
@jutonz
jutonz / server.rb
Last active October 15, 2015 21:03
Simple HTTP server in Ruby
require 'webrick'
include WEBrick
port = 8080
puts "Listening on http://#{Socket.gethostname}:#{port}"
server = HTTPServer.new(Port: port)
server.mount_proc "/" do |request, response|
response.body = "Hello, Ajita#{"a" * rand(20)}"
@jutonz
jutonz / 0_reuse_code.js
Last active August 29, 2015 14:23
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
import java.util.Arrays;
/*-------------------------------------------------------------------------
// AUTHOR: James Bossio
// FILENAME: NumberCollection.java
// SPECIFICATION:
// FOR: CSE 110
// TIME SPENT: 40 mins
//----------------------------------------------------------------------*/
public int findMax()
{
//test
int max = numberArray[0];
for (int i = 0; i < numberArray.length; i++)
{
max = numberArray[i]; // You're overwriting your old max here.
if (numberArray[i] > max)
max = numberArray[i];