Skip to content

Instantly share code, notes, and snippets.

const hello = () => {
  console.log('Hello World');
}
hello();
const hello = () => {
 console.log('Hello World');
// API Reference: https://www.wix.com/velo/reference/api-overview/introduction
// “Hello, World!” Example: https://learn-code.wix.com/en/article/1-hello-world
import {makeAutoObservable, autorun, toJS} from 'mobx'
import * as uuid from 'uuid'
const fakeData = [
{
"name": "blah0",
"number": "0",
import {makeAutoObservable, autorun} from 'mobx'
import * as uuid from 'uuid'
class RepeaterStore {
constructor(){
this.items = []
}
}
function connectRepeater({selector = '#repeater1', initialData, renderItem}) {
@tomenden
tomenden / machine.js
Created August 26, 2020 06:22
Generated by XState Viz: https://xstate.js.org/viz
async function listBranches(){}
async function createBranch(){}
async function deleteBranch(){}
async function renameBranch(){}
async function publishBranch(){}
const branchesManager = Machine({
id: "branches-manager",
initial: "loading",
@tomenden
tomenden / machine.js
Created August 19, 2020 09:56
Generated by XState Viz: https://xstate.js.org/viz
const getBranches = async () =>
await [
{
id: "fe4b7150-c29d-4da0-8785-5f4479163f0f",
sourceBranchId: "fe4b7150-c29d-4da0-8785-5f4479163f0f",
name: "Origin Version",
branchUpdatedUser: {
value: "jojo.halastra@gmail.com",
valueType: "EMAIL", // can be: EMAIL, SITE_OWNER, WIX_STAFF
},
@tomenden
tomenden / chene.js
Created December 25, 2017 09:23
normalize values (feature scaling)
// https://en.wikipedia.org/wiki/Normalization_(statistics)#Examples
data = [
14,
15,
17,
22,
25,
28,
40,
40,
@tomenden
tomenden / debounced-channel.js
Created December 8, 2016 13:04
Debounced channel
//usage example:
function* watchChangeAction() {
const changeActionChannel = yield actionChannel(actionTypes.CHANGE);
const requestChannel = yield call(debouncedChannel, 300, changeActionChannel);
// handleRequest will be called with the debounced actions
yield fork(handleRequest, requestChannel)
}
export function* debouncedChannel(ms, originalChannel) {
function* gen() {
const three = yield 'three';
const two = yield 'two';
const sum = yield `${two}, ${three}`;
return sum;
}
const iterable = gen(); // the generator instance folllws the iterable protocol