Skip to content

Instantly share code, notes, and snippets.

// http://rosettacode.org/wiki/HTTP
use std::io::net::tcp::TcpStream;
use std::io;
#[cfg(not(test))]
fn main() {
let target = "www.rust-lang.org";
// Create a socket. Mutable so we can write to it.
let mut socket = TcpStream::connect(target, 80);
@pfalabella
pfalabella / 100_doors.rs
Created May 29, 2014 14:56
100 doors Enterprise Edition
// Implements http://rosettacode.org/wiki/100_doors
#[cfg(not(test))]
fn main() {
let mut hd = HammingDoor :: new(0u);
for door in hd.iter().take(100) {
let state = if door.state() {"open"} else {"closed"};
println!("Door {} is {}", door.index, state);
}
}
// linqPad snippet
void Main()
{
CleanRecords();
}
public void CleanRecords()
{
StringBuilder builder = new StringBuilder();
string delimiter = "";
double[] array = new double[5];
for(int i=0;i<5;i++)
{
array = new double[5]; // accidentally redefining array
double theAnswer=42D;
array[i]=theAnswer;
}
import java.util.*;
import java.lang.*;
import static java.lang.System.out;
class Main
{
public static void main (String[] args) throws java.lang.Exception
{
List<Pair<?>> lst = new ArrayList<Pair<?>>();
lst.add(new Pair<String>("a","b"));