Skip to content

Instantly share code, notes, and snippets.

View Mark-Simulacrum's full-sized avatar

Mark Rousskov Mark-Simulacrum

View GitHub Profile
@Mark-Simulacrum
Mark-Simulacrum / index.html
Created January 17, 2015 19:13
Calculates numbers that add up to a given sum with a given number of digits. // source http://jsbin.com/himemutimo
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Calculates numbers that add up to a given sum with a given number of digits." />
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
@Mark-Simulacrum
Mark-Simulacrum / TypeMap.js
Created April 10, 2015 22:20
Type register system
class MapItem {
constructor() {
this.numbered = new Map();
this.matchers = [];
}
setBase(value) {
if (value === undefined)
throw new Error("setBase called without a base");
if (this.base)
@Mark-Simulacrum
Mark-Simulacrum / discussion_summary.md
Last active September 22, 2016 02:20
SimpleString and the &'static str vs. String problem for beginners
  • briansmith:
    • Confusion about &String coercing to &str:
      • Thought this was because of AsRef, but now thinks is probably because of Deref.
    • &'static str is immutable, but String is mutable.
      • Similar to C++; not in a good way.
  • DanielKeep:
    • capacity == 0 && len != 0 to indicate contents are static.
  • rkruppe:
  • Very common speed bump on the learning curve, but it goes much, much
//! A vector type that allows storing small values directly on the stack.
#![feature(untagged_unions)]
use std::iter::FromIterator;
use std::ptr::drop_in_place;
use std::ops::Deref;
use std::fmt;
pub struct SmallVec8<T> {
1 Chunk #12: 8388608 bytes total, used 1959664, wasted 6428944
1 Chunk #5: 65536 bytes total, used 2432, wasted 63104
1 Chunk #5: 65536 bytes total, used 7184, wasted 58352
1 Chunk #5: 65536 bytes total, used 10072, wasted 55464
1 Chunk #5: 65536 bytes total, used 14240, wasted 51296
1 Chunk #5: 65536 bytes total, used 19688, wasted 45848
1 Chunk #5: 65536 bytes total, used 24352, wasted 41184
4 Chunk #4: 32768 bytes total, used 256, wasted 32512
1 Chunk #4: 32768 bytes total, used 400, wasted 32368
1 Chunk #4: 32768 bytes total, used 1176, wasted 31592
Checks a package to catch common mistakes and improve your Rust code.
Usage:
cargo clippy [options] [--] [<opts>...]
Common options:
-h, --help Print this message
--features Features to compile for the package
-V, --version Print version info and exit
@Mark-Simulacrum
Mark-Simulacrum / infra-post.md
Last active April 13, 2017 20:15
Draft version of a post announcing the infrastructure team to users.rlo

Announcing the unofficial Rust infrastructure team

The Rust infra team will manage, as of now:

  • Making sure the pull request queue is continuing to test and merge.
    • including: Travis, Appveyor, Homu
  • Highfive
  • perf.rust-lang.org (currently down, work to bring it up is in progress)
  • Rust's Central Station
    • This runs homu, highfive, etc.
  • Crates.io
@Mark-Simulacrum
Mark-Simulacrum / main.rs
Created July 4, 2018 16:20
crater hunter, some parts taken from github.com/rust-lang-nursery/crater
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate futures;
extern crate percent_encoding;
extern crate reqwest;
extern crate serde_json;
extern crate tokio_core;
extern crate url;