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
class Target { | |
ref = new Ref(); | |
foo() { | |
return this.bar(); | |
} | |
bar() { | |
return this.ref; | |
} | |
} | |
class Ref { |
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
interface AstNode<T> { | |
value: T; | |
} | |
const n1: AstNode<number> = { value: 1 }; | |
const n2: AstNode<string> = { value: "asdf" }; | |
// https://github.com/microsoft/TypeScript/pull/26063 says that if T is a tuple | |
// type, the mapped type will map each specific type in the tuple. | |
type Values<T> = { [P in keyof T]: T[P] extends AstNode<infer V> ? V : never }; |
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
import path from "path"; | |
import { Polly, PollyConfig } from "@pollyjs/core"; | |
// @ts-ignore polly's typings aren't great but we don't really need them for this small init code | |
import { setupPolly } from "setup-polly-jest"; | |
import { MODES } from "@pollyjs/utils"; | |
import { env } from "@src/env"; | |
Polly.register(require("@pollyjs/adapter-node-http")); | |
Polly.register(require("@pollyjs/persister-fs")); |
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
class Foo { | |
a = 1; | |
b(): void {} | |
c(): boolean { | |
return true; | |
} | |
} | |
// https://medium.com/dailyjs/typescript-create-a-condition-based-subset-types-9d902cea5b8c | |
type FilterFlags<Base, Condition> = { |
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
### Keybase proof | |
I hereby claim: | |
* I am stephenh on github. | |
* I am stephenhaberman (https://keybase.io/stephenhaberman) on keybase. | |
* I have a public key ASBgKUp5p77PdVZdtSABrgJit4xQ9iahkzipyPmQwPAPuQo | |
To claim this, I am signing this object: |
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
role1 = { name, perms: [p1, p2, p3] } | |
role2 = { name, perms: [p3, p4] } | |
roles = [role1, role2, ...] | |
# put lists in sorted sort | |
# O(N_roles * N_permissions log N_permissions) | |
roles.forEach { sortInPlace(_.perms) } | |
# compare each role to the other, N^2 = 16m comparison |
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
newtype Nut = Nut Int deriving Show | |
newtype Bolt = Bolt Int deriving Show | |
compareNutBolt :: Nut -> Bolt -> Int | |
compareNutBolt (Nut i) (Bolt j) = i - j | |
-- given a compare function, breaks [a] into smaller/equal/bigger | |
partition :: (a -> Int) -> [a] -> ([a], [a], [a]) | |
partition f [] = ([], [], []) |
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
[shaberma@shaberma-ld1 ~ master]$ java -Xmx1G -cp mirror-all.jar mirror.MirrorServer ~/linkedin 10000 | |
2016-03-18 09:57:42 INFO mirror.MirrorServer initialSync Starting new session | |
2016-03-18 09:57:48 INFO mirror.MirrorServer initialSync Server has 49517 paths | |
2016-03-18 09:57:48 INFO mirror.MirrorServer initialSync Client has 7050 paths | |
2016-03-18 09:57:48 INFO mirror.MirrorSession seedQueueForInitialSync Queueing 43891 paths to send to the remote host | |
... | |
2016-03-18 10:00:11 SEVERE mirror.MirrorServer$1 onError Error from incoming client stream | |
io.grpc.StatusException: CANCELLED [43/17808] | |
at io.grpc.Status.asException(Status.java:509) | |
at io.grpc.stub.ServerCalls$2$1.onCancel(ServerCalls.java:227) |
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
and here is the same request from 208.43.121.200 (and it fails validation because request chain is terminated with content-type text/html ): | |
curl -i -c poker_cookies.txt -L -H'User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.5.30729; OfficeLiveConnector.1.3; OfficeLivePatch.0.0; .NET CLR 3.0.30729)' 'http://api.bizographics.com/v2/getuid?api_key=3d2e5d0fe63241629dab1e775752758a&redirect_url=http%3A%2F%2Ftags.bluekai.com%2Fsite%2F23060%3Fid%3D%24UID%26kid%3D0' | |
HTTP/1.1 302 Found | |
Date: Thu, 09 Jul 2015 01:02:31 GMT | |
Location: http://api.bizographics.com/v2/getuid?api_key=3d2e5d0fe63241629dab1e775752758a&redirect_url=http%3A%2F%2Ftags.bluekai.com%2Fsite%2F23060%3Fid%3D%24UID%26kid%3D0&3pc=true | |
Server: nginx | |
Set-Cookie: BizoID=9993950c-83c6-4b58-bf74-b7315e663a2f; Domain=.bizographics.com; Expires=Thu, 07-Jan-2016 13:02:31 GMT; Path=/ | |
Content-Length: 0 | |
Connection: keep-alive |
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
@external *; | |
.fa {} | |
.fa-2x {} | |
.fa-3x {} | |
.fa-4x {} | |
.fa-5x {} | |
.fa-adjust {} | |
.fa-adn {} | |
.fa-align-center {} |