Skip to content

Instantly share code, notes, and snippets.

💭
(╯°□°)╯︵ ┻━┻

Ingvar Stepanyan RReverser

💭
(╯°□°)╯︵ ┻━┻
Block or report user

Report or block RReverser

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View cargo-test-junit.py
#!/usr/bin/env python
# Use with
# > cargo test --no-run # print compilation failures if any
# > RUST_TEST_THREADS=1 cargo test -q -- --logfile tests.log 2>failures.log; ../convert-test-log.py
import xml.etree.cElementTree as ET
import re
failure_re = re.compile(r"""thread '(.*?)' panicked at '(.*?)', tests/test\.rs:\d+:\d+
View cidr-repr.rs
extern crate bincode;
extern crate cidr;
extern crate hex_slice;
extern crate rmp_serde;
extern crate serde;
extern crate serde_bytes;
extern crate serde_cbor;
#[macro_use]
extern crate serde_derive;
View serde-cidr.rs
pub struct IpCidr(::cidr::IpCidr);
impl Debug for IpCidr {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
Debug::fmt(&self.0, f)
}
}
impl Deref for IpCidr {
type Target = ::cidr::IpCidr;
@RReverser
RReverser / userChrome.css
Last active Dec 2, 2017
Firefox CSS for nice vertical tabs with TabCenter Redux
View userChrome.css
/* Hide horizontal tab strip */
#TabsToolbar {
visibility: collapse;
}
/* Reduce width of the navigation panel so that it doesn't conflict with macOS window controls */
#nav-bar:not([inFullscreen]) {
padding-left: 70px;
}
View alt_switch.rs
macro_rules! err {
($i:expr, $kind: expr) => {
IResult::Error(error_position!($kind, $i))
};
}
macro_rules! alt_switch {
($i:expr, $($lhs_mac:ident ! ( $($lhs_arg:tt)* ) $(as $lhs_binding:pat)* => $rhs_mac:ident ! ( $($rhs_arg:tt)* ) |)+ _ => $def_mac:ident ! ( $($def_arg:tt)* )) => {{
$(if let IResult::Done(i, $($lhs_binding,)* ..) = $lhs_mac ! ( $i, $($lhs_arg)* ) {
$rhs_mac ! ( i, $($rhs_arg)* )
View rust-sample.json
{
"module": {
"inner": {
"lo": 0,
"hi": 69
},
"items": [{
"ident": "",
"attrs": [{
"id": {
@RReverser
RReverser / acorn-top-level.js
Created Mar 14, 2017
Acorn: top-level parsing experiment
View acorn-top-level.js
// See https://jsperf.com/acorn-top-level-parsing-experiment/1 for example
acorn.plugins.top_level = function (instance) {
// Could skip other things as well, but this
// is where the most time can be saved
instance.parseBlock = function () {
var node = this.startNode();
var length = this.context.length;
do {
this.next();
View bad-promises.js
// consider the following code
// a.js
class A extends Component {
static B = undefined;
state = { B : A.B };
componentWillMount() {
A.B || import('./b.js').then(B => {
@RReverser
RReverser / index.html
Created Dec 21, 2016
regexgen #jsbench #jsperf
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>regexgen</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Untitled benchmark</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
You can’t perform that action at this time.