Skip to content

Instantly share code, notes, and snippets.

View de314's full-sized avatar

David Esposito de314

  • BetterCloud
  • Atlanta
View GitHub Profile
@de314
de314 / notes.proto
Created March 28, 2020 01:21
Remote Proto Test
syntax = "proto3";
service NoteService {
rpc List (Empty) returns (NoteList) {}
rpc Insert (Note) returns (Note) {}
rpc Delete (NoteRequestId) returns (Note) {}
}
message Empty {}
const express = require("@runkit/runkit/express-endpoint/1.0.0");
const jsonServer = require('json-server')
const axios = require('axios')
const app = express(exports);
async function addDataSource(data, url) {
const res = await axios.get(url);
Object.assign(data, res.data)
}
import React from 'react';
import { Field } from 'formik';
import AceEditor from 'react-ace';
import 'brace/mode/ejs';
import 'brace/theme/textmate';
export const EjsForm = ({ name }) => (
<Field name={name}>
@de314
de314 / adminBro.js
Created February 26, 2019 16:01
Admin Bro + FeathersJS
// Admin Bro
const AdminBro = require('admin-bro');
const AdminBroExpressjs = require('admin-bro-expressjs');
const logger = require('./logger');
AdminBro.registerAdapter(require('admin-bro-mongoose'));
module.exports = function(app) {
const adminBroSettings = app.get('adminBro');
const adminBroRootPath =
function test() { return 'Hello, World!' }
function fromFunc(func) { return func.toString() }
function toFunc(funcString) { return new Function(`return ${funcString.toString()}`)() }
let tmp = fromFunc(test)
// tmp = "function test() { console.log('Hello, World!') }"
tmp = toFunc(tmp)

We start with the dictionary: { a, ab, bc, aab, aac, bd, ca }

And the Search String: bcaab

1. Build the Trie

Following the steps in the first video you should end up with

trie

@de314
de314 / bbs.sh
Created January 13, 2018 03:12
Start script for browser sync
#!/bin/bash
# You need to globally install broswser-sync `npm i -g browser-sync` and might need to export the node path
# Then you can run `$ bbs` to serve the current directory or `bbs ~/workspace/web/my-project` to specify the base directory
SERVER_DIR=${1:-$PWD}
echo $SERVER_DIR
browser-sync start -s $SERVER_DIR -f $SERVER_DIR --port 3333 --ui-port 3334 --directory --cors
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@de314
de314 / package.json
Created December 30, 2017 16:07
Browser Sync
{
"name": "demo",
"version": "0.0.1",
"description": "",
"main": "index.js",
"scripts": {
"start": "browser-sync start --server --files '*.css, *.html, *.js'"
},
"keywords": [],
"author": "",
switch (action.type) {
// ...
case 'CHECK_PASSWORD': {
// the following should probably be configurable settings
// v v v v v v v v v v
const minPasswordLength = 8
const maxPasswordLength = 30
const pwRegSpecial = /[_:!#$%=+<>-]/
const pwBadChars = /[^\w:!#$%=+<>-]/
const pwRegLower = /[a-z]/