Skip to content

Instantly share code, notes, and snippets.

@hardvain
hardvain / dom.scala
Last active July 22, 2021 06:45
zio dom env
import org.scalajs.dom._
import org.scalajs.dom.document._
import zio._
import org.scalajs.dom.raw._
import scala.scalajs.js
import scala.scalajs.js.annotation._
import scala.language.postfixOps
trait DomService:
def implementation: UIO[DOMImplementation]
<pre>_SECTION_BEGIN;
// Code Source: wisestocktrader
SetChartOptions(0,chartShowArrows|chartShowDates);
/*Body Colors*/
whiteBody=C>=O;
blackBody=O>C;
/*Body Size*/
import React, { useState, useEffect } from "react";
import { Checkbox, Input, Row, Col, Slider } from "antd";
import ReactDOM from "react-dom";
import { v4 as uuidv4 } from "uuid";
const Component = ({ checked, text = "", id }) => {
const [value, setValue] = useState(false);
const [num, setNum] = useState(0);
useEffect(() => {
setValue(checked);
@hardvain
hardvain / BObject.scala
Last active December 13, 2019 10:17
Boxs
package in.boxs
sealed trait Position
case object Center extends Position
case object Corner extends Position
sealed trait Axis
case object XAxis extends Axis
case object YAxis extends Axis
case object ZAxis extends Axis
@hardvain
hardvain / notes.md
Created January 15, 2019 21:26 — forked from matthewjberger/notes.md
How to make an electron app using Create-React-App and Electron with Electron-Builder.
@hardvain
hardvain / SVG.hs
Created August 13, 2018 14:11
SVG
{-# LANGUAGE ExistentialQuantification, GADTs #-}
module Main where
class SvgNode a where
toSVG :: a -> String
data SvgNodeObject where
Pack :: SvgNode a => a -> SvgNodeObject
@hardvain
hardvain / Error
Last active August 12, 2018 06:37
SVG
• Couldn't match type ‘Circle’ with ‘Line’
Expected type: Tree Line
Actual type: Tree Circle
• In the expression: Node (Circle (20, 30) 50) []
In the second argument of ‘Node’, namely
‘[Node (Circle (20, 30) 50) []]’
In the expression:
Node (Line (100, 100) (30, 60)) [Node (Circle (20, 30) 50) []]
|
11 | sampleTree = Node (Line (100,100) (30,60)) [Node (Circle (20,30) 50) []]
@hardvain
hardvain / list.rs
Created January 30, 2018 16:02
Singly Linked List in Rust
use std::fmt::*;
/// A struct that represents a single node in a list
///
/// # State
/// * `element` - The element of type T that is stored in the node
/// * `next` - An optional value that points to the next element in the list
#[derive(PartialEq, Debug)]
pub struct Node<T: Debug> {
pub element: T,
@hardvain
hardvain / JSONParser.hs
Created January 11, 2018 07:48 — forked from zearen/JSONParser.hs
A simple haskell demonstation showing parsing JSON with Parsec
{-
Zachary Weaver <[email protected]>
JSONParser.hs
Version 0.1.1
A simple example of parsing JSON with Parsec in haskell. Note that
since the primary point of this excersize is demonstration,
Text.Parsec.Token was avoided to expose more of the grammar. Also,
complicated optimizations and shorcuts were avoided (mostly).
@hardvain
hardvain / json.hs
Created January 11, 2018 07:48 — forked from fero23/json.hs
JSON Parser with Haskell's Parsec
import Text.ParserCombinators.Parsec
import Data.List
type Args = [String]
type Body = [String]
type Label = String
data JSONProp = JSONProp Label JSON deriving Show
data JSON = JSONObject [JSONProp]
| JSONNumber Double