Skip to content

Instantly share code, notes, and snippets.

View rizary's full-sized avatar
🎯
Focusing

rizary rizary

🎯
Focusing
View GitHub Profile
_ <- mdo
historyState <- manageHistory $ HistoryCommand_PushState <$> setState
let
f (currentSet, currentHistoryState, oldRoute) idxChange =
let newRoute = switchPkgRoute currentSet oldRoute idxChange
in
HistoryStateUpdate
{ _historyStateUpdate_state = DOM.SerializedScriptValue jsNull
, _historyStateUpdate_title = ""
, _historyStateUpdate_uri = newRoute
@rizary
rizary / GSoC'19.md
Last active August 25, 2019 00:29
This is my summary for GSoC 2019

Describe my work briefly

  • Adding tags and search box feature to existing UI v3 code
  • Remove the use of dyn function for routing case
  • Add dropdown and address bar routing
  • Expanding Type API and removing MonadWidget constraint
  • Adding content in home page
  • Adding Luite's diff link to matrix table

What is done

routeLink True r w = do
let cfg = (def :: ElementConfig EventResult t (DomBuilderSpace m))
& elementConfig_eventSpec %~ addEventSpecFlags (Proxy :: Proxy (DomBuilderSpace m)) Click (\_ -> preventDefault)
& elementConfig_initialAttributes .~ "href" =: r
(e, a) <- element "a" cfg w
setRoute $ (switchPkgRoute (Just $ decodeFrag r)) <$ domEvent Click e
return a
routeLink False r w = do
let cfg = (def :: ElementConfig EventResult t (DomBuilderSpace m))
& elementConfig_initialAttributes .~ "href" =: r
newPkgs: oldPkgs:
with oldPkgs;
let
noCheck = p: haskell.lib.dontCheck p;
noHaddock = p: haskell.lib.dontHaddock p;
fast = p: noHaddock (noCheck p);
static = p: haskell.lib.justStaticExecutables (fast p);
in {
# All haskellPackages
@rizary
rizary / dsl.hs
Last active December 6, 2019 07:18
dsl london
import DB (dbTable, dbMap, dbFilter, runExpr)
import Prelude (error)
type FirstName = String
type LastName = String
type Age = Int
type City = String
data Row = Row FirstName LastName Age City
{ jupyterWith
, haskellPackages
, haskellPkg ? (_: [])
, pythonPkg ? (_: [])
, pythonOverridesList ? []
}:
let
jupyterSrc = jupyterWith + "/nix";
inherit (import jupyterSrc {}) pkgs lib;
$remoteport = bash.exe -c "ip a | grep 'inet '"
$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';
if( $found ){
$remoteport=$remoteport.Split("inet");
foreach ($rp in $remoteport) {
if ($rp -match '172.\d{1,3}\.\d{1,3}\.\d{1,3}') {
$remoteport=$rp;
$remoteport=$remoteport.Split("/");
@rizary
rizary / dockertosmth.rs
Last active September 18, 2020 12:46
trying to create an async function in Rust
async fn docker_json_to_smth(arg: (Docker, &ContainerSummary)) -> () {
let (docker, csummary) = arg;
let container = docker
.inspect_container(
csummary.id.as_ref().unwrap(),
None::<InspectContainerOptions>,
)
.await
.unwrap();
{
"name": "rust",
"version": "0.1.0",
"description": "frontend wasm in rust",
"license": "MIT",
"private": true,
"scripts": {
"todo_watch": "yarn run todo_clean && rollup -c rollup.dev.js --watch",
"todo_clean": "rimraf ./devhtml/js",
},
pub fn run_fmt(toml_content: &Root, cwd: PathBuf) -> anyhow::Result<()> {
let commands = toml_content
.formatters
.values()
.map(|c| c.command.clone().unwrap_or("".into()));
let args = toml_content.formatters.values().map(|c| {
let arg = match c.args.clone() {
Some(vstr) => vstr,
None => Vec::new(),