- https://saml.github.io
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
// @flow | |
type Yo = Path | URL; | |
class Path { | |
title: string; | |
path: string; | |
} | |
class URL { | |
title: string; |
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
GET _search | |
{ | |
"explain": true, | |
"query": { | |
"function_score": { | |
"query": { | |
"filtered": { | |
"query": { | |
"query_string": { | |
"query": "\"cafe edison\"", |
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
//Caused by: java.lang.ClassCastException: com.ning.http.client.providers.netty.NettyResponse cannot be cast to play.api.libs.ws.ning.NingWSResponse | |
//response.underlying[NingWSResponse].ahcResponse.getResponseBodyAsBytes() does not work | |
// Downloads content at url and saves to a temporary file. | |
private def downloadTempFile(url: String): Future[Option[(File, Option[String])]] = | |
WS.url(url).getStream().flatMap { | |
case (response, body) => | |
val contentType = response.headers.get("Content-Type").flatMap(_.headOption) | |
if (response.status == 200) { | |
val tmpFile = File.createTempFile("imgContent", ".tmp") |
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
var http = require('http'); | |
var fs = require('fs'); | |
var usage = `Usage: ${process.argv[0]} ${process.argv[1]} <filepath> <mimetype> [port]`; | |
var filePath = process.argv[2]; | |
if (!filePath) { | |
throw new Error(usage); | |
} | |
var mimetype = process.argv[3] | |
if (!mimetype) { | |
throw new Error(usage); |
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> | |
<title>Object Literal or Block in JS</title> | |
<meta charset="utf-8"> | |
<p>View Console. And View Source.</p> | |
<script> | |
{"x": 1}; | |
</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
import re | |
var r = re.re("((a+)+)$") | |
if re.match("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab", r): | |
echo("good") | |
else: | |
echo("bad") |
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
cmd/command1/ | |
Cargo.toml | |
src/ | |
main.rs # want to use lib1 here. | |
pkg/lib1/ | |
Cargo.toml | |
src/ | |
lib.rs |
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
'use strict'; | |
const fs = require('fs'); | |
const crypto = require('crypto'); | |
const input = fs.createReadStream(__filename); | |
const encrypt = crypto.createCipher("aes-256-ctr", "iamapassword"); | |
const decrypt = crypto.createDecipher("aes-256-ctr", "iamapassword"); | |
input.pipe(encrypt).pipe(decrypt).pipe(process.stdout); |
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
// http://hastebin.com/ubagequlal.pas | |
// pit bro | |
// find deepest pit (which is also the widest due to constraints given in the problem around strict ordering). | |
function Pit(start, middle, end) { | |
return {start: start, middle: middle, end: end}; | |
} | |
var NoPit = Pit(-1, -1, -1); |
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
.PHONY: clean test all | |
all: bin/foo bin/bar | |
bin/%: pkg/**/*.go cmd/%/*.go | |
go build -o $@ ./cmd/$(@F) | |
test: | |
go fmt ./pkg/... ./cmd/... | |
go vet ./pkg/... ./cmd/... |