Skip to content

Instantly share code, notes, and snippets.

package repo
import (
"gopkg.in/mgo.v2"
"app/db"
"app/model"
)
/**
package workers
import (
"app/repo"
"app/ws"
"github.com/bitly/go-nsq"
)
/*
package main
import (
"net/http"
"os"
"app/api"
"app/db"
"app/repo"
"app/worker"
package api
import (
"log"
"encoding/json"
"net/http"
"app/repo"
"app/worker"
"app/model"
var keystone = require('keystone');
var Types = keystone.Field.Types;
/**
* Job Model
* ==========
*/
var Job = new keystone.List('Job');
Job.add({
nsqlookupd:
image: nsqio/nsq
command: /nsqlookupd
ports:
- "4160"
- "4161"
nsqd:
image: nsqio/nsq
links:
- nsqlookupd
const SET_INFO = 'SET_INFO';
const SET_ERROR = 'SET_ERROR';
const initialState = {
info: {},
error: null
};
const reducer = (state, action) => {
switch (action.type) {
import { useEffect, useState, useReducer } from 'react';
import { isEmpty, isNil } from 'ramda';
const isObjectLiked = (value) =>
value.constructor.name == "Array" ||
value.constructor.name == "Object";
const rehydrate = (value, defaultValue) => {
if (!value) return defaultValue;
if (value === 'false') str = false;
import localforage from 'localforage';
const useStorage = (state, setState) => {
const [rehydrated, setRehydrated] = useState(false);
const [error, setError] = useState(null);
useEffect(() => {
// Async rehydration
localforage.getItem(config.key, (err, value) => {
if (err) {
const SET_INFO = 'SET_INFO';
const SET_ERROR = 'SET_ERROR';
const initialState = {
info: {},
error: null
};
const reducer = (state, action) => {
switch (action.type) {