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
// ==UserScript== | |
// @name JPDB Yes, keep going! | |
// @namespace http://tampermonkey.net/ | |
// @version 0.7 | |
// @description Makes "Yes, keep going!" the default button. | |
// @author boccato | |
// @match https://jpdb.io/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=jpdb.io | |
// @grant none | |
// ==/UserScript== |
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
{-# LANGUAGE OverloadedStrings #-} | |
module Main where | |
import Control.Exception (bracket) | |
import Network.Wai | |
import Network.HTTP.Types (status200) | |
import Test.Hspec | |
import Test.Hspec.Wai |
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
-- https://begriffs.com/posts/2014-10-19-warp-server-controller-test.html | |
mkApp :: FilePath -> Application | |
mkApp p = fileServer $ pack p | |
withApp :: ActionWith Application -> ActionWith FilePath | |
withApp action path = do | |
action (mkApp path) | |
withTempFolder :: ActionWith FilePath -> 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
spec :: Spec | |
spec = with app $ do | |
describe "DELETE" $ do | |
it "responds with 200" $ do | |
a <- liftIO (withTempFile "." "bla.txt" $ \file _ -> do return (delete "bla")) | |
a `shouldRespondWith` 200 |
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 System.IO.Temp (withTempDirectory, withTempFile) | |
import Test.Hspec | |
import Test.Hspec.Wai | |
app :: IO Application | |
app = pure myApplication | |
spec :: Spec | |
spec = with app $ do | |
describe "DELETE" $ do |
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
module Main where | |
import Control.Monad | |
import System.Random | |
nSimulations = 100 | |
nCurrentReposts = 1 | |
takeDistinct :: Eq a => Int -> [a] -> [a] | |
takeDistinct n xs = sample n xs [] |
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
create table discussoes (id number, assunto_id number); | |
insert into discussoes values (1, 6); | |
insert into discussoes values (2, 7); | |
insert into discussoes values (3, 8); | |
create table seguidor_assunto (usuario_id number, assunto_id number); | |
insert into seguidor_assunto values (95, 7); | |
create table seguidor_discussao (usuario_id number, discussao_id number); | |
insert into seguidor_discussao values (95, 1); |