This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this compiles | |
fn validator<F, T>(f: F) -> Box<Fn(String) -> Result<(), String> + 'static> | |
where F: Fn(String) -> Result<T, String> + 'static { | |
Box::new(move |s| f(s).map(|_| ())) | |
} | |
// this fails with: | |
// error[E0308]: mismatched types | |
// --> src\main.rs:17:14 | |
// | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Begin { pushd; cd 'ruby/command-t/ext/command-t' } | |
Process { | |
/tools/ruby26/bin/ruby ./extconf.rb | |
/tools/msys64/usr/bin/make | |
} | |
End { popd } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang r5rs | |
(#%require schemeunit) | |
(define (any pred lst) | |
(if (null? lst) | |
#f | |
(or (pred (car lst)) (any pred (cdr lst))))) | |
(define (list-contains? el lst) | |
(any (lambda (el*) (equal? el el*)) lst)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
# `pip install Markdown` | |
from markdown import markdown | |
FLOWER = '🌸' | |
START_PINK = '<span style="color: pink">' | |
END_PINK = '</span>' | |
def girlmarkdown(text): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
def esc(txt): | |
left = txt | |
right = txt | |
chrs = r'\~^' | |
for chr in chrs: | |
right = right.replace(chr, '\\char"' + format(ord(chr), 'X')) | |
left = left.replace('\\', '\\\\') | |
chrs = r'$&%#{}_' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import product | |
from operator import itemgetter | |
bools = [True, False] | |
def p6eq(a: bool, b: bool, c: bool) -> bool: | |
return (a and (b or c), | |
(a and b) or (a and c)) | |
def p6(): | |
return [list(p6eq(a, b, c)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% setup | |
\usepackage{fontspec} | |
\setmonofont[ | |
Contextuals=Alternate, | |
]{PragmataPro Liga} | |
\usepackage{listings} | |
\lstset{ | |
basicstyle=\ttfamily, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function! CJKDefine(...) | |
if a:0 == 0 | |
let b:cjk_char = matchstr(getline('.'), '\%' . col('.') . 'c.') | |
else | |
let b:cjk_char = a:1 | |
endif | |
python3 << EOF | |
# unbelievable bullshit | |
setattr(sys, '__stdout__', sys.stdout) | |
from cihai.core import Cihai |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import logging | |
def string(hashCode): | |
""" | |
The hash code for a String object is computed as | |
s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1] | |
using int arithmetic, where s[i] is the ith character of the string, n is | |
the length of the string, and ^ indicates exponentiation. (The hash value | |
of the empty string is zero.) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<assembly | |
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation=" | |
http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 | |
http://maven.apache.org/xsd/assembly-1.1.2.xsd" | |
> | |
<id>src</id> | |
<formats> |