In ~/.bash_aliases:
alias dev='env $(cat dev.env | xargs)'
alias prod='env $(cat prod.env | xargs)'
Put environment variables in dev.env, prod.env etc
| app :: | |
| Rf.Ref (Object Chat) -> | |
| Rf.Ref (Object Unit) -> | |
| Request -> | |
| Response -> | |
| Effect Unit | |
| app chats sockets req res = do | |
| setHeader res "Access-Control-Allow-Origin" "*" | |
| let outputStream = responseAsStream res | |
| let method = requestMethod req |
| scrollToCurrentYear : Cmd Msg | |
| scrollToCurrentYear = | |
| Process.sleep 100 | |
| |> Task.andThen (always Time.now) | |
| |> Task.andThen | |
| (Time.toYear Time.utc | |
| >> String.fromInt | |
| >> Dom.getElement | |
| ) | |
| |> Task.andThen |
In ~/.bash_aliases:
alias dev='env $(cat dev.env | xargs)'
alias prod='env $(cat prod.env | xargs)'
Put environment variables in dev.env, prod.env etc
| #!/bin/bash | |
| # This creates one window with 3 panes (one vertical split, one horizontal split), | |
| # and one window with 2 panes (one vertical split). | |
| # -d = detached mode | |
| tmux new-session -d | |
| tmux split-window -h # vertical split | |
| tmux split-window # horizontal split |
| const JsDom = require("jsdom").JSDOM; | |
| const fs = require("fs"); | |
| const elmJs = fs.readFileSync(__dirname + "/elm.js", "utf8"); | |
| const html = `<!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge" /> |
| use std::time::{SystemTime, UNIX_EPOCH}; | |
| fn get_time() -> FieldResult<i32> { | |
| SystemTime::now() | |
| .duration_since(UNIX_EPOCH) | |
| .map(|t| t.as_secs() as i32) | |
| .map_err(|_| FieldError::new("yeh", graphql_value!({ "internal_error": "oops" }))) | |
| } |
| // index.html | |
| // <body> | |
| // <div id="app"></div> | |
| // <script src="./main.re"></script> | |
| // </body> | |
| // Open modules sparingly... | |
| open Webapi.Dom; | |
| // Abstract type for our Elm app |
| pub struct Options { | |
| //var default_normalize_email_options = { | |
| // The following options apply to all email addresses | |
| // Lowercases the local part of the email address. | |
| // Please note this may violate RFC 5321 as per http://stackoverflow.com/a/9808332/192024). | |
| // The domain is always lowercased, as per RFC 1035 | |
| all_lowercase: bool, | |
| // The following conversions are specific to GMail | |
| // Lowercases the local part of the GMail address (known to be case-insensitive) | |
| gmail_lowercase: bool, |
| module Main exposing (main) | |
| import Browser | |
| import Element exposing (Attribute, centerX, column, el, padding, spacing, text) | |
| import Element.Border as Border | |
| import Element.Input as Input | |
| import Html exposing (Html, button, div) | |
| import Html.Attributes | |
| const { publicKey, privateKey } = await crypto.generateKey( | |
| { | |
| name: "RSA-OAEP", | |
| modulusLength: 2048, | |
| publicExponent: new Uint8Array([0x01, 0x00, 0x01]), | |
| hash: "SHA-256" | |
| }, | |
| true, | |
| ["encrypt", "decrypt"] | |
| ); |