Author: Chris Lattner
This file contains hidden or 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
# Open the debug console with Ctrl+: (which is Ctrl+Shift+; on US keyboards) | |
# (Don't have the browser window open when you do.) | |
# Run it with Ctrl+Enter | |
# Remove the # from the last line to actually save the changes | |
s = r'regular expression to search for goes here' | |
srcField = 'Source Field Name goes here' | |
tgtField = 'Target Field Name goes here' | |
noteType = 'Name of the Note Type goes here' |
This file contains hidden or 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
#include <iostream> | |
// This class was named X to be consistent with http://www.gotw.ca/gotw/076.htm | |
// | |
// Its primary purpose is to hold a private value which no one should be able | |
// to accidentally modify. | |
class X { | |
public: | |
X() : private_(1) { /*...*/ } | |
int getValue() { return private_; } |
This file contains hidden or 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
#include <iostream> | |
// File x.h | |
// This class was named X to be consistent with http://www.gotw.ca/gotw/076.htm | |
// | |
// Its primary purpose is to hold a private value which no one should be able | |
// to accidentally modify. | |
class X | |
{ | |
public: |
This file contains hidden or 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
module Printf | |
%default total | |
-- Formatting AST. | |
data Format | |
= FInt Format | |
| FString Format | |
| FOther Char Format | |
| FEnd |
This file contains hidden or 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
/*<?php | |
//*/public class PhpJava { public static void main(String[] args) { System.out.printf("/*%s", | |
//\u000A\u002F\u002A | |
class PhpJava { | |
static function main() { | |
echo(//\u000A\u002A\u002F | |
"Hello World!"); | |
}} | |
//\u000A\u002F\u002A | |
PhpJava::main(); |
This file contains hidden or 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
""" | |
The main use case of this is to replace either | |
>>> [ x * (x + 1) for x in [1,2,3] ] | |
or | |
>>> map(lambda x: x * (x + 1), [1,2,3]) | |
with | |
>>> map(X * (X + 1), [1,2,3]) #SWAG | |
You can naively think of it as 'lambda X:' without writing 'lambda X:'. |
This file contains hidden or 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
def powerset(list): | |
if not list: | |
yield set() | |
return | |
*rest, last = list | |
yield from powerset(rest) | |
for subset in powerset(rest): | |
yield subset | {last} |
This file contains hidden or 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
(define-syntax <> | |
(syntax-rules () | |
((_ v e ...) | |
(if (null? (command-line-arguments)) | |
(let loop ((v (read-line))) | |
(unless (eof-object? v) | |
e ... | |
(loop (read-line)))) | |
(let file-loop ((port (open-input-file (car (command-line-arguments)))) | |
(rest (cdr (command-line-arguments)))) |
This file contains hidden or 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
/* An HTML template in 180 bytes (minified) | |
Features: Escapes HTML, accepts either strings or functions as values, and that's all (it doesn't handle looping). | |
Usage: | |
OneEightyT( | |
"<h1>{name}</h1><div>{content} @ {currentTime}</div>", | |
{ | |
name: "Stella", |
NewerOlder