Skip to content

Instantly share code, notes, and snippets.

Overview

Terrain is a Terra development environment for better smart contract development experience.

Terrain will help:

  • scaffold your dapp project
  • ease the development and deployment process
  • create custom task for blockchain and contract interaction with less boilerplate code
  • using terra.js directly could be cumbersome, Terrain gives you extensions and utilities to help you
const axios = require('axios')
const toStringParams = o =>
Object
.keys(o)
.map(k => `${k}=${o[k]}`)
.join('&')
@iboss-ptk
iboss-ptk / SketchSystems.spec
Last active November 15, 2021 06:00
App State
App State
App not running*
open app -> Logged in?
App opened
kill app -> App not running
close app -> App Backgrounded
Login Screen
login -> Login

Design Decision For Analytics Tracking

  • Event name is following [this convention](Naming conventions: one step towards clean data) an Object-Action Framework eg.
    • Object: Account, Action: Signed Up
    • Object: Post, Action: Created
  • Following that, means we can separate module (file) by object. eg. account has its own module.
  • in each module, we can implement the detail about the tracking
    • params
    • transformation (if needed)
  • if the tracking function seems do similar transformation before every calls, consider moving those logic into the tracking function itself. (eg. post.engaged)
  • if the tracking depends on state changes, consider creating a component with hook in it to capture state changes from the context, app state, or any global-ish state (eg. ProfileUpdateTracker)
@iboss-ptk
iboss-ptk / reader.ts
Last active September 11, 2020 11:37
// === lib ===
type Contextualized<C, R> = (context: C) => R
const contexualize = contextConsumerGenerator => context => {
const generator = contextConsumerGenerator()
let contextConsumerIter = generator.next()
let consume: any = contextConsumerIter.value
while (!contextConsumerIter.done) {

First attempt!

Number of user that reads at least P posts weekly for within at least W consecutive weeks

  • P determined by looking at weekly post reading per user distribution, we want al least
  • W determined by retention rate
    • same user for n weeks, where is the critical line where we can say this user stick with us

What does this says?

  • Read more posts means product is good???
    • what if they just can’t find what they want?
# download
curl -o tracknoti.sh https://gist.githubusercontent.com/iboss-ptk/1459ebbad09d254c8cc2b377009d82b4/raw/31e9fe496e54b4afa31288dcb975bcdb5bcb9115/tracker.sh
# grant permission
chmod +x tracknoti.sh
# run
./tracknoti.sh
test() {
curl -s https://tracker.lel.asia/tracker?trackingNumber=LEXPU029939203 | tr '\n' ' ' | tr -s ' ' | grep "journey__step _step-5 _done" > /dev/null
}
while :
do
test
if [ $? -eq 0 ]
then