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
<!doctype html> | |
<html> | |
<head></head> | |
<body> | |
<my-element></my-element> | |
<script type="module"> | |
import {LitElement, html} from 'https://unpkg.com/@polymer/lit-element@latest/lit-element.js?module'; | |
class MyElement extends LitElement { | |
render() { |
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
<script type="module"> | |
import {html, render} from 'https://unpkg.com/lit-html?module'; | |
const myTemplate = (name) => html`<p>Hello ${name}</p>`; | |
render(myTemplate('World'), document.body); | |
</script> |
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
<html> | |
<head> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> | |
</head> | |
<body> | |
<div id="d">nothing here yet</div> | |
<script> | |
var send = XMLHttpRequest.prototype.send; | |
XMLHttpRequest.prototype.send = function(body) { |
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
//! The stringsim program prints out the trigram similarity of two strings | |
//! using what appears to be the same algorithm used by Postgres. | |
//! https://www.postgresql.org/docs/9.1/pgtrgm.html | |
use std::collections::HashSet; | |
use std::hash::Hash; | |
fn main() { | |
let args: Vec<String> = ::std::env::args().collect(); | |
if args.len() != 1+2 { |
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 program spins up php-fpm in the background and a Go web server sending | |
// all requests to a PHP router script. | |
package main | |
import ( | |
"context" | |
"flag" | |
"fmt" | |
"io/ioutil" | |
"log" |
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
#!/usr/bin/env python | |
import argparse | |
import re | |
import sys | |
parser = argparse.ArgumentParser(description= | |
'''Filter some text with a regex, allowing matches to span multiple lines. | |
This tool is based on some ideas from Rob Pike's Sam editor: |
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
;; A concurrent prime sieve translated from | |
;; https://golang.org/doc/play/sieve.go | |
;; by Issac Trotts with help from Chris Murphy and glts on Stack Overflow. | |
(require '[clojure.core.async :as async :refer [<! >! <!! chan go]]) | |
(defn generate-naturals | |
"Sends the sequence 2, 3, 4, ... to channel 'ch'." | |
[ch] | |
(go |
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
#!/usr/bin/env escript | |
%% -*- mode: erlang -*- | |
%%! -smp enable -hidden | |
%% | |
%% A concurrent prime sieve, inspired by the Go prime sieve | |
%% with daisy-chained filter processes. | |
%% https://golang.org/doc/play/sieve.go | |
%% | |
%% Translated by Issac Trotts (2016) | |
%% with help from Amiramix on StackOverflow. |
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
package main | |
import "fmt" | |
func main() { | |
s := "package main\n\nimport \"fmt\"\n\nfunc main() {\n\ts := %#v\n\tfmt.Printf(s, s)\n}\n" | |
fmt.Printf(s, s) | |
} |
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
// See https://code.google.com/p/go/issues/detail?id=640 | |
package main | |
import "fmt" | |
func main() { | |
args := []int{1, 2, 3} | |
fmt.Println(sum(args...)) | |
} |
NewerOlder