Skip to content

Instantly share code, notes, and snippets.

@theRemix
theRemix / destructuring.js
Created July 19, 2018 01:50
Nested Destructuring Styles
const data = {
cat : {
dog : {
bird : {
mouse : "squeek"
}
}
}
};
(let [base 3,
exp 3]
(do
(defn multiply [x, y]
(* x y))
(defn exponent
([base pow] (exponent base base (dec pow)))
([acc base pow] (cond
(> pow 0) (exponent (multiply acc base) base (dec pow))
:else acc)))
# subroutine
def multiply(x, y)
x * y
end
# variables (input)
base = 3
exponent = 3
product = 0
(let [base 3,
exp 2]
(do
(defn multiply [x, y]
(* x y))
(defn exponent [x, y]
(reduce multiply (mapv (fn [_] x) (range y))))
(exponent base exp)))
@theRemix
theRemix / app.correct.ts
Last active February 21, 2018 17:43
Submit Form via xhr using state values from onion
// sampleCombine will emit when source stream emits only
// this is correct
function intent (sources$: Sources) {
return sources$.DOM.select('form')
.events('submit', { preventDefault : true })
.compose(sampleCombine(sources$.onion.state$))
.map(([ event, state ]) => ({
url: '/api/endpoint',
category: 'Form',
method: 'POST',
@theRemix
theRemix / app.tsx
Last active September 28, 2017 01:53
CycleJS xstream HTTP example
import xs, { Stream } from 'xstream';
import { VNode, DOMSource } from '@cycle/dom';
import { HTTPSource } from '@cycle/http';
import { StateSource } from 'cycle-onionify';
import { Sources, Sinks } from './interfaces';
export type AppSources = Sources & { onion: StateSource<AppState> };
export type AppSinks = Sinks & { onion: Stream<Reducer>, HTTP: Stream<any> };
export type Reducer = (prev: AppState) => AppState;
export type AppState = {
@theRemix
theRemix / Debian.Xenial.sh
Last active September 8, 2017 06:37
VBox Scripts
#!/bin/sh
VBOX_NAME=Xenial1
VBOX_PORT=3892
VBoxManage createvm --name "$VBOX_NAME" --register
VBoxManage modifyvm "$VBOX_NAME" --memory 512 --acpi on --boot1 dvd --nic1 bridged --bridgeadapter1 wlo1
VBoxManage createhd --filename ~/vms/$VBOX_NAME.vhd --size 5000
VBoxManage storagectl "$VBOX_NAME" --name "IDE Controller" --add ide
VBoxManage storageattach "$VBOX_NAME" --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium ~/vms/$VBOX_NAME.vhd
@theRemix
theRemix / README.md
Created August 24, 2017 07:51
CLI Exercise

This exercise can be performed in Bash, CMD, or Powershell

Follow the instructions

If you mess up, or think you may have made a mistake, delete the entire cli-directory and start at 1. again.

  1. in your home directory, create a new directory named cli-exercise
  2. navigate into your new cli-exercise directory ...
@theRemix
theRemix / README.md
Created August 24, 2017 06:46
Networking Research Assignment

Answer these questions

In a sentence, or short paragraph form.

What is your current local ip address?

How did you obtain your local ip address?

What is your network address?