Skip to content

Instantly share code, notes, and snippets.

View hughjfchen's full-sized avatar

Hugh JF Chen hughjfchen

View GitHub Profile
@hughjfchen
hughjfchen / Main.hs
Created December 28, 2024 02:14 — forked from gelisam/Main.hs
A variant of SimpleLocalnet which uses a hardcoded list of nodes
#!/usr/bin/env stack
-- stack --resolver lts-8.16 script
-- for https://www.reddit.com/r/haskell/comments/6emo9g/trying_to_get_the_basic_example_in_cloudhaskell/
{-# LANGUAGE LambdaCase, RecordWildCards #-}
import System.Environment (getArgs)
import Control.Distributed.Process
import Control.Distributed.Process.Node (initRemoteTable)
import Control.Distributed.Process.Backend.SimpleLocalnet
@hughjfchen
hughjfchen / gist:d661b5670987ed8ef8fa5e6c03498ea4
Created May 22, 2019 09:11
code to mix mqtt and api within a transient program
{-# LANGUAGE TypeOperators #-}
module Main
(main
) where
import Protolude hiding (async, local)
import Data.String
import Data.Aeson
import Transient.Internals
@hughjfchen
hughjfchen / index.html
Created May 15, 2018 07:36
Semantic ui Sidebar + Navbar
<div class="ui sidebar vertical left menu overlay visible" style="-webkit-transition-duration: 0.1s; overflow: visible !important;">
<div class="item logo">
<img src="img/logo.png" /><img src="img/thumblogo.png" style="display: none" />
</div>
<div class="ui accordion">
<a class="title item">Dashboard <i class="dropdown icon"></i>
</a>
<div class="content">
<a class="item" href="dashboard.html">Dashboard
</a>
@hughjfchen
hughjfchen / gist:ff36cc656fe7c75ae2f3509def022a0e
Created December 12, 2017 07:13 — forked from malcolmsparks/gist:6044878
MQTT example for Clojure core.async
(ns mqtt-insertion.core
(:require [clojure.core.async :refer :all])
(:import (org.eclipse.paho.client.mqttv3
MqttCallback
MqttAsyncClient
MqttConnectOptions
MqttDeliveryToken
MqttException
MqttMessage
MqttTopic
@hughjfchen
hughjfchen / gist:7f8f7328be1b055d8df18e6d1f021b4a
Created August 23, 2017 05:11
can't receive re-frame subscription
;; event fired function
;; snippet: {:on-click #(dispatch [:edit-checklist checklist])}
(defn checklist-table [dt-id data-sub-vector]
(.log js/console "to-display within checklist-table")
[rdt/datatable
dt-id
data-sub-vector
[{::rdt/column-key [:title]
::rdt/column-label "标题"}