Skip to content

Instantly share code, notes, and snippets.

.related-products li {
float: left;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
-ms-box-sizing: border-box;
-o-box-sizing: border-box;
box-sizing: border-box;
padding: 0.5em;
width: 50%;
}
@tbillington
tbillington / main.rs
Last active August 29, 2015 14:20
Rust unpacking
let r2: Result<((String, (Vec<&str>, Vec<char>)), &str), ParseError> = heading.parse("** r&wr");
println!("{:?}", r2);
let ((r3, (_, _)), _, _) = r2;
println!("{:?}", r3);
src/main.rs:50:9: 50:29 error: mismatched types:
expected `core::result::Result<((collections::string::String, (collections::vec::Vec<&str>, collections::vec::Vec<char>)), &str), parser_combinators::primitives::ParseError>`,
found `(_, _, _)`
(expected enum `core::result::Result`,
found tuple) [E0308]
package main
import (
"encoding/json"
"fmt"
"golang.org/x/net/websocket"
"net/http"
"strings"
"sync"
"time"
package main
import (
"encoding/json"
"fmt"
"io"
"log"
"strings"
)
var chans = make(map[string]*chan string)
func Server() {
println("started server")
for {
var timeout = make(chan string, 1)
go func() {
time.Sleep(1 * time.Second)
timeout <- "timeout!"
}()
#include <iostream>
void main() {
std::cout << "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n31\n32\n33\n34\n35\n36\n37\n38\n39\n40\n41\n42\n43\n44\n45\n46\n47\n48\n49\n50\n51\n52\n53\n54\n55\n56\n57\n58\n59\n60\n61\n62\n63\n64\n65\n66\n67\n68\n69\n70\n71\n72\n73\n74\n75\n76\n77\n78\n79\n80\n81\n82\n83\n84\n85\n86\n87\n88\n89\n90\n91\n92\n93\n94\n95\n96\n97\n98\n99\n100\n101\n102\n103\n104\n105\n106\n107\n108\n109\n110\n111\n112\n113\n114\n115\n116\n117\n118\n119\n120\n121\n122\n123\n124\n125\n126\n127\n128\n129\n130\n131\n132\n133\n134\n135\n136\n137\n138\n139\n140\n141\n142\n143\n144\n145\n146\n147\n148\n149\n150\n151\n152\n153\n154\n155\n156\n157\n158\n159\n160\n161\n162\n163\n164\n165\n166\n167\n168\n169\n170\n171\n172\n173\n174\n175\n176\n177\n178\n179\n180\n181\n182\n183\n184\n185\n186\n187\n188\n189\n190\n191\n192\n193\n194\n195\n196\n197\n198\n199\n200\n201\n202\n203\n204\n205\n206\n207\n208\n209\n210\n211\n212\n213\n214\n215\n2
# Grab your time module !
import time
# Capture the time at the start of your program
time_at_start = time.time()
# The code you want to time goes here
for i in range(1,billion):
foo()
blah()
C:\Users\Trent\Desktop\blah\hello_world>cargo build
Updating git repository `https://github.com/bjz/gl-rs`
Updating git repository `https://github.com/netvl/rust-xml`
Compiling rust-xml v0.1.0 (https://github.com/netvl/rust-xml#361fc1ac)
Compiling khronos_api v0.0.1 (https://github.com/bjz/gl-rs#8bf7197a)
Build failed, waiting for other jobs to finish...
Could not compile `rust-xml`.
--- stderr
src\writer\mod.rs:1:38: 1:40 error: expected `;` but found `as`
C:\Users\Trent\Desktop\blah\hello_world>cargo update gl -v
Updating git repository `https://github.com/bjz/gl-rs`
Unable to update https://github.com/bjz/gl-rs
Caused by:
Executing `git clone https://github.com/bjz/gl-rs C:\Users\Trent\.cargo\git\db
\gl-rs-5020f97825182d66 --bare --no-hardlinks --quiet` failed
Caused by:
Could not execute process `git clone https://github.com/bjz/gl-rs C:\Users\Tre
C:\Users\Trent\Desktop\blah\hello_world>cargo update gl -v
Updating git repository `https://github.com/bjz/gl-rs`
Unable to update https://github.com/bjz/gl-rs
Caused by:
failed to clone into: C:\Users\Trent\.cargo\git\db\gl-rs-5020f97825182d66
Caused by:
[2] SSL is not supported by this copy of libgit2.