This file contains hidden or 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
hello = SayHello "/helloworld.Greeter/SayHello" . HelloRequest | |
main :: IO () | |
main = do | |
c_grpc_init | |
channel <- channelCreate "localhost:50051" (ChannelArgs nullPtr) | |
context <- newClientContext channel | |
invokeCall context (hello "Haskell") >>= print | |
channelDestroy channel |
This file contains hidden or 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
fn getString(json: std::json::Json, key: ~str) -> Option<~str> { | |
match json { | |
std::json::Object(map) => { | |
match map.find(&key) { | |
Some(&std::json::String(str)) => Some(~"return str here"), | |
_ => None | |
} | |
}, | |
_ => None | |
} |
This file contains hidden or 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
;; part of my 100 first lines of clojure/clojurescript | |
;; not finished... not working. | |
(defn withHints [editor hints] | |
(defn insert [str] (.replaceRange editor str (.-from result) (.-to result))) | |
(let [completions (.-list hints)] | |
(cond | |
(= 1 (.-length completions)) (insert (first completions))) | |
(let [complete (.createElement js/document "div") |
This file contains hidden or 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 qualified Data.ByteString as B | |
import qualified Data.ByteString.Unsafe as B | |
import Control.Applicative | |
import Control.Monad.ST | |
import Data.Array.Base ( unsafeRead, unsafeWrite ) | |
import Data.Array.ST | |
dist :: B.ByteString -> B.ByteString -> Int |