A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.
One-line version to paste in your DevTools
Use $$
if your browser aliases it:
~ 108 byte version
[bool] | |
syntax = t|true|f|false | |
[field] | |
syntax = <fvalue> | |
[field-and-value] | |
syntax = <field>/s*=/s*<fvalue> | |
[field-and-value-list] | |
syntax = (?:<field-and-value>)+ | |
[field-list] | |
syntax = <field>(?:[ ,]+<field>)* |
#![allow(unused_variables)] | |
#![allow(unused_imports)] | |
use std::env; | |
use std::process; | |
use std::thread; | |
use std::io::{self, Read, Write, Error}; | |
use std::net::TcpStream; | |
use std::net::TcpListener; |
// Updated example from http://rosettacode.org/wiki/Hello_world/Web_server#Rust | |
// to work with Rust 1.0 beta | |
use std::net::{TcpStream, TcpListener}; | |
use std::io::{Read, Write}; | |
use std::thread; | |
fn handle_read(mut stream: &TcpStream) { | |
let mut buf = [0u8 ;4096]; |
For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.
Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon
with HyperThreading enabled, but it can work without problem on slower machines.
You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.
class BSTnode(object): | |
""" | |
Representation of a node in a binary search tree. | |
Has a left child, right child, and key value, and stores its subtree size. | |
""" | |
def __init__(self, parent, t): | |
"""Create a new leaf with key t.""" | |
self.key = t | |
self.parent = parent | |
self.left = None |
/** | |
* An implementation for Mergesort. Less efficient | |
* than Quicksort. Again, you'd just use Array.sort | |
* but if you found yourself unable to use that | |
* there's always this option. | |
* | |
* Tests with: | |
* | |
* var array = []; | |
* for(var i = 0; i < 20; i++) { |