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
const util = require('util'); | |
// `same` means that new export is same as old one. Same name, also type, also user defined. | |
// The only thing that we impliclty assume will change even for `same` is that new exports are always | |
// considered to be named exports, even if original one was default. | |
const same = Symbol("SAME") | |
const importMappings = [ | |
[["@wasp/config.js", dflt("config")], | |
["wasp/server", same] |
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
#!/usr/bin/env cabal | |
{- cabal: | |
build-depends: base >= 4.7 && < 5, split, directory, filepath, extra | |
-} | |
{-# LANGUAGE BangPatterns #-} | |
import Control.Monad (forM, forM_) | |
import Control.Monad.Extra (partitionM) | |
import Data.List.Split (splitOn) |
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
Wasp is a full-stack web app framework that uses React (for client), NodeJS and Prisma (for server). | |
High-level of the app is described in main.wasp file (which is written in special Wasp DSL), details in JS/JSX files. | |
Wasp DSL (used in main.wasp) reminds a bit of JSON, and doesn't use single quotes for strings, only double quotes. Examples will follow. | |
Important Wasp features: | |
- Routes and Pages: client side, Pages are written in React. | |
- Queries and Actions: RPC, called from client, execute on server (nodejs). | |
Queries are for fetching and should not do any mutations, Actions are for mutations. | |
- Entities: central data models, defined via PSL (Prisma schema language), manipulated via Prisma. | |
Typical flow: Routes point to Pages, Pages call Queries and Actions, Queries and Actions work with Entities. |
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
printTree :: Int -> IO () | |
printTree h = (putStrLn . unlines . center) $ "()" : (showTreeLvl <$> [0 .. h]) ++ ["[]"] | |
where showTreeLvl l = "/" ++ (take (l * 2) . drop (l `mod` 3) . concat . repeat) "~~o~~*~o~~*~~o~*" ++ "\\" | |
center ss = let w = maximum (length <$> ss) in (\s -> concat (replicate ((w - length s) `div` 2) " ") ++ s) <$> ss | |
-- > printTree 5 | |
-- | |
-- () | |
-- /\ | |
-- /~o\ |
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
.mmsF1c:nth-child(10)::after, .mmsF1c:nth-child(19)::after { | |
border-bottom-color: black; | |
border-bottom-width: 2px; | |
} | |
// Good way to apply this CSS consistently is to use Stylebot Chrome extension. |
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
#!/usr/bin/env bash | |
# This script should be positioned in /etc/NetworkManager/dispatcher.d/ | |
# This script disconnects wifi card when wifi dongle connects and reconnects wifi card when | |
# wifi dongle disconnects. That way, when dongle is connected, we are sure it is being used instead of | |
# wifi card being used, and it all happens automatically. | |
event_interface=$1 | |
event_type=$2 |
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
/** | |
* Validates and parses given blob uri and returns storage account, container and blob names. | |
* @param {string} blobUri - Valid Azure storage blob uri. | |
* Check link for more details: https://docs.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata#resource-uri-syntax . | |
* Few examples of valid uris: | |
* - https://myaccount.blob.core.windows.net/mycontainer/myblob | |
* - http://myaccount.blob.core.windows.net/myblob | |
* - https://myaccount.blob.core.windows.net/$root/myblob | |
* @returns {Object} With following properties: | |
* - {string} storageAccountName |