This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// linqPad snippet | |
void Main() | |
{ | |
CleanRecords(); | |
} | |
public void CleanRecords() | |
{ | |
StringBuilder builder = new StringBuilder(); | |
string delimiter = ""; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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")); |