Skip to content

Instantly share code, notes, and snippets.

@simwilso
simwilso / gist:23b0e8ba048167c7c715b5d25b1e8f42
Last active December 9, 2019 02:21
Basic Emit / Recieve Zome
#![feature(proc_macro_hygiene)]
#[macro_use]
extern crate hdk;
extern crate hdk_proc_macros;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
#[macro_use]
extern crate holochain_json_derive;
@simwilso
simwilso / gist:e00251bb5185c8bd80b9970f9bbdc745
Created December 11, 2019 01:22
WebSocket into Emit/Recieve (How to publish a value into Recieve and how to recieve it?)
// I want this function in my rust program to push an entry into the DHT but now sure how to do this under this EMIT method?
let signal_string = "I want this go into the signal entry on my dht";
fn set_to_dht(_signal: String) {
let json = serde_json::json!(
{"id": "signal",
"jsonrpc": "2.0",
"method": "call",
"params": {"instance_id": "test-instance",
@simwilso
simwilso / gist:b0f7363d1fa06863f3384a401d38a508
Last active December 11, 2019 05:37
WebSocket into Emit/Recieve (How to publish a value into Recieve and how to recieve it?)
// trying to create the websocket sync connection and keep it open
let mut client = ClientBuilder::new("ws://localhost:3401")
.unwrap()
.connect_insecure()
.unwrap();
// this doesn't compile due to the function not accepting the dynamic 'client' but is this how the send function should look?
fn set_to_dht(_signal: String) {
@simwilso
simwilso / zome_config
Last active January 14, 2020 23:52
Send Receive Simple Zome
#![feature(proc_macro_hygiene)]
#[macro_use]
extern crate hdk;
extern crate hdk_proc_macros;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
#[macro_use]
extern crate holochain_json_derive;
extern crate reqwest;
extern crate serde_json;
extern crate serde_derive;
extern crate serde;
extern crate ws;
use ws::{connect, CloseCode};
use serde_json::{json, Deserializer, Value};
use std::sync::mpsc::channel;
#![feature(proc_macro_hygiene)]
#[macro_use]
extern crate hdk;
extern crate hdk_proc_macros;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
#[macro_use]
extern crate holochain_json_derive;
@simwilso
simwilso / Hello blog test file index.js
Created February 3, 2020 05:12
index.js test file from micro blog tutorial
/// NB: The tryorama config patterns are still not quite stabilized.
/// See the tryorama README [https://github.com/holochain/tryorama]
/// for a potentially more accurate example
const path = require('path');
const {
Orchestrator,
Config,
combine,
@simwilso
simwilso / hello blog zome lib.rs
Created February 3, 2020 05:16
lib.rs for micro blog tutorial
#![feature(proc_macro_hygiene)]
#[macro_use]
extern crate hdk;
extern crate hdk_proc_macros;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
#[macro_use]
extern crate holochain_json_derive;
@simwilso
simwilso / output.log
Created February 3, 2020 05:30
output.log from micro_blog test command
Packaging files for testing to file: "/home/simwilso/Code/TestDemo/txrx/dist/txrx.dna.json"
> CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && echo $CARGO_TARGET_DIR 
"CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && echo $CARGO_TARGET_DIR "
/home/simwilso/Code/TestDemo/txrx/target
> CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && cargo build --release --target=wasm32-unknown-unknown --target-dir=$CARGO_TARGET_DIR
"CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && cargo build --release --target=wasm32-unknown-unknown --target-dir=$CARGO_TARGET_DIR"
> CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wasm-gc $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/txrx.wasm
"CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/target} && wasm-gc $CARGO_TARGET_DIR/wasm32-unknown-unknown/release/txrx.wasm"
> CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-/tmp/my_first_app/targ