Skip to content

Instantly share code, notes, and snippets.

View qnighy's full-sized avatar

Masaki Hara qnighy

View GitHub Profile
"" ... "" + script data
"." ... "." + script data
"<" ... "" + script data less-than sign
"</" ... "" + script data end tag open
"</." ... "</." + script data
"</a" ... "" + script data end tag name
"</script " ... "" + before attribute name
"</foo " ... "</foo " + script data
"</script/" ... "" + self-closing start tag
"</foo/" ... "</foo/" + script data
@qnighy
qnighy / main.rs
Created March 28, 2021 01:00
stdin.scan() for competitive programming
use std::io::{self, BufRead};
use std::str::{self, FromStr};
fn from_buf<T: FromStr>(buf: &[u8]) -> io::Result<T>
where
T::Err: std::error::Error + Send + Sync + 'static,
{
let s = str::from_utf8(buf).map_err(|e| io::Error::new(io::ErrorKind::InvalidInput, e))?;
T::from_str(s).map_err(|e| io::Error::new(io::ErrorKind::InvalidInput, e))
}
{"context":{"logLevel":20,"namespace":"Importer","package":"ts-jest","version":"27.0.0-next.6"},"message":"creating Importer singleton","sequence":1,"time":"2021-02-22T07:29:38.486Z"}
{"context":{"actualVersion":"27.0.0-next.3","expectedVersion":">=27.0.0-next.2 <28","logLevel":20,"namespace":"versions","package":"ts-jest","version":"27.0.0-next.6"},"message":"checking version of jest: OK","sequence":2,"time":"2021-02-22T07:29:38.492Z"}
{"context":{"logLevel":20,"namespace":"ts-jest-transformer","package":"ts-jest","version":"27.0.0-next.6"},"message":"created new transformer","sequence":3,"time":"2021-02-22T07:29:38.493Z"}
{"context":{"logLevel":20,"namespace":"ts-jest-transformer","package":"ts-jest","version":"27.0.0-next.6"},"message":"created new transformer","sequence":4,"time":"2021-02-22T07:29:38.661Z"}
{"context":{"logLevel":30,"namespace":"ts-jest-transformer","package":"ts-jest","version":"27.0.0-next.6"},"message":"no matching config-set found, creating a new one","sequence":5,"time":"2021-02-22T0
@qnighy
qnighy / behaviour.js
Last active September 12, 2020 01:19
A historical JavaScript library and one of precursors of jQuery by Ben Nolan and Simon Willison -- Licensed under BSD. http://www.bennolan.com/behaviour/
/*
Behaviour v1.1 by Ben Nolan, June 2005. Based largely on the work
of Simon Willison (see comments by Simon below).
Description:
Uses css selectors to apply javascript behaviours to enable
unobtrusive javascript in html documents.
Usage:
#!/usr/bin/ruby
#
# generated_code.rb is in the same directory as this test.
$LOAD_PATH.unshift(File.expand_path(File.dirname(__FILE__)))
old_gc = GC.stress
GC.stress = 0x01 | 0x04
require 'generated_code_pb'
require 'generated_code_proto2_pb'
GC.stress = old_gc
@qnighy
qnighy / nu-ty.v
Created December 21, 2019 08:55
nu type
Inductive LatticeExpr {T} :=
| LAtom (t: T)
| LTop
| LIntersection (t0: LatticeExpr) (t1: LatticeExpr)
| LBottom
| LUnion (t0: LatticeExpr) (t1: LatticeExpr).
Arguments LatticeExpr T: clear implicits.
CoInductive ATy :=
| TyNumber
#--
# Cross-compile ruby, using Rake
#
# This source code is released under the MIT License.
# See LICENSE file for details
#++
#
# This code is inspired and based on notes from the following sites:
#
CREATE TEMP FUNCTION parseMessage(messageB64 BYTES)
RETURNS STRING
LANGUAGE js AS """
const toSextet = (ch) => {
if (0x41 <= ch && ch < 0x41 + 26) {
return ch - 0x41;
} else if (0x61 <= ch && ch < 0x71 + 26) {
return ch - (0x61 - 26);
} else if (0x30 <= ch && ch < 0x30 + 10) {
return ch + (52 - 0x30);
@qnighy
qnighy / rustc-phases.txt
Created May 19, 2019 14:15
rustc phases memo
- https://github.com/rust-lang/rust/blob/1.34.2/src/librustc_driver/driver.rs
- https://github.com/rust-lang/rust/blob/1.34.2/src/librustc_typeck/lib.rs
compile_input
phase_1_parse_input
parsing: syntax::parse::parse_crate_from_*
phase_2_configure_and_expand
attributes injection: syntax::attr::inject
(various setups like features, crate types and disambiguator)
recursion limit: rustc::middle::recursion_limit::update_limits
@qnighy
qnighy / Makefile
Last active May 5, 2019 06:00
GCJ2019 Round1C
#!/usr/bin/make -f
EXECS = a b c
CXX = g++
CXXFLAGS = -O2 -Wall -Wextra -g -std=gnu++14
all: $(EXECS)
clean:
$(RM) $(EXECS)