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
select sort(array_agg(select id from data where ts_rank(name_vector, name) > 0.8) || id) as bucket | |
from data | |
group by bucket |
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
/* @TODO this query is slow because OFFSET is slow! */ | |
with data as ( | |
/* your query */ | |
), sample_size as (select generate_series(1, /* sample size */)) | |
select t.* | |
from (select trunc(random() * (select count(*) from data)) as offset_index from sample_size) sample | |
left join data t on t.id = (select id from data limit 1 offset sample.offset_index); |
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
-- | commentBlockStart | |
-- >>> parse stripCommentBlock "fail" "hello world /* fo /*meow face */o */ bar * / * / /* poop /* zz **/*/ end" | |
-- Right "hello world bar * / * / end" | |
stripCommentBlock :: GenParser Char st String | |
stripCommentBlock = do | |
first <- many (noneOf "/") | |
rest <- (eof >> return "") <|> (commentBlock >> stripCommentBlock) <|> ((++) <$> string "/" <*> stripCommentBlock) | |
return (first ++ rest) | |
-- | commentBlock |
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
-- | Generate list permutations in Haskell | |
-- >>> permutateList [[1,2], [3,4]] | |
-- [[1,3],[1,4],[2,3],[2,4]] | |
permutateList :: [[a]] -> [[a]] | |
permutateList = foldl (liftA2 (++)) [[]] . map (map (: [])) |
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
// Playground - noun: a place where people can play | |
import UIKit | |
func $(s1 : String) -> [String] { | |
return ["selector: " + s1] | |
} | |
func css(s1 : String) -> [String] -> [String] { | |
return { (data: [String]) -> [String] in |
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
func apply<A, B> (data : A, fn : B) -> A { | |
return fn(data) // '(A) -> $T2' is not identical to 'B' | |
} | |
func apply<A, B : A -> A> (data : A, fn : B) -> A { // Expected '>' to complete generic parameter list | |
return fn(data) | |
} |
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
`timescale 1ns / 1ps | |
module BinToDec( | |
input mclk, | |
input [7:0] sw, | |
output reg [3:0] an, | |
output reg [6:0] seg, | |
output reg [7:0] Led | |
); |
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
Running sch2hdl... | |
Command Line: sch2hdl -batch C:/Users/Ryan/pong/sch2HdlBatchFile | |
Release 14.7 - sch2hdl P.20131013 (nt64) | |
Copyright (c) 1995-2013 Xilinx, Inc. All rights reserved. | |
Started : "Synthesize - XST". | |
Running xst... | |
Command Line: xst -intstyle ise -ifn "C:/Users/Ryan/pong/pong_top.xst" -ofn "C:/Users/Ryan/pong/pong_top.syr" | |
Reading design: pong_top.prj |
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
myFunction :: Record -> Record -> a | |
foobar = myFunction Record { meow = "face" } | |
Record { meow = "face" } | |
-- vs -- | |
myFunction :: (Record, Record) -> a | |
foobar = myFunction( |
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 Dockerfile; | |
if (!req.body.modules.length) { | |
Dockerfile = multiline.stripIndent(function () { return undefined; /* | |
FROM haskell-online-ghc | |
ADD execute.sh . | |
*/ }); | |
} else { | |
Dockerfile = multiline.stripIndent(function () { return undefined; /* | |
FROM haskell-online-ghc |