Skip to content

Instantly share code, notes, and snippets.

View jlongster's full-sized avatar
💭
Workin on my app

James Long jlongster

💭
Workin on my app
View GitHub Profile
new MyReadStream().pipe(new MyDuplex()).pipe(new MyTransform()).pipe(new MyWriteStream())
expect(thisFooVar).toEqual();
var Class = {
propTypes: {
field: React.PropTypes.oneOfType([
React.PropTypes.string,
React.PropTypes.number
])

I did some poking around CodeMirror and how it works, particularly with it's current code folding implementation. My goal was to see if there was a way to only have part of the string in memory, render those parts, and still have line numbers be correct. My goal was to have the editor display something like this:

1 
2 
3  function() {
27 }
28
let router =
Router.create () |>
Router.post
"/"
(
fun req body =>
Cohttp_lwt_body.to_string body >>= (
fun body => {
let str =
switch (Uri.get_query_param (req |> Request.uri) "foo") {
open Lwt;
open Cohttp;
open Cohttp_lwt_unix;
let module Util = Yojson.Basic.Util;
let router =
Router.add_route
--- reason (cohttp) ---
jlong-16106:~/tmp/wrk(master)% ./wrk -t12 -c400 -d30s http://127.0.0.1:8000/
Running 30s test @ http://127.0.0.1:8000/
12 threads and 400 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 12.45ms 6.96ms 45.37ms 62.82%
Req/Sec 2.16k 652.23 9.32k 84.95%
772252 requests in 30.04s, 2.31GB read
Socket errors: connect 0, read 1057, write 0, timeout 0
% npm run build
> loot-syncing-server@0.0.1 build /Users/james/projects/loot-sync
> eval $(dependencyEnv) && nopam && rebel
*** jenga: [47575] root=/Users/james/projects/loot-sync, sys=Darwin, j=1, f=1 (NO_VERSION_UTIL)
- build . Default_Tar__Index.cmx
+ bash -c 'ocamlfind ocamlopt -pp refmt -bin-annot -g -w -30 -w -40 -open Default_Tar -I _build/default/src -package async -o _build/default/src/Default_Tar__Index -c -impl src/Index.re 2>&1| berror; (exit ${PIPESTATUS[0]})'
ocamlfind: Error from package `threads': Missing -thread or -vmthread switch
- exit . Default_Tar__Index.cmx, 282ms, exited with code 2
@jlongster
jlongster / output.js
Last active August 27, 2016 01:00
query macro
from t in transactions
where t.x == 3 / 4 * 2 and z > 10
select { t.x * 3 }
// Output:
({
table: "transactions",
binding: "t",

Keybase proof

I hereby claim:

  • I am jlongster on github.
  • I am jlongster (https://keybase.io/jlongster) on keybase.
  • I have a public key whose fingerprint is A8BB 4191 6054 C104 3113 73BC A9E2 E79E 99FF 9594

To claim this, I am signing this object:

syntax where = function(ctx) {
const binaryOps = ["or", "and", "==", ">", "<", "-", "+", "*", "/", "."];
const dummy = #`dummy`.get(0);
function matchNext(names) {
const marker = ctx.mark();
const next = ctx.next();
ctx.reset(marker);
return !next.done && names.includes(next.value.val());
}
// @flow
// Goal: define a top-level app state like the following. `sources`
// would be state managed by a redux reducer
type SourceState = { count: number };
type AppState = { sources: SourceState};
// Define a selector that takes a piece of the state, like sources
// (this is contrived)
function getNumSources(state: SourceState, x : number) {