Skip to content

Instantly share code, notes, and snippets.

View NeuTrix's full-sized avatar

michael j. Walker NeuTrix

  • BrandGeneering.com
  • San Franciscos, LA, Las Vegas
View GitHub Profile
@NeuTrix
NeuTrix / gist:6fce61ab77b8eeb9354376f20ec6f2e7
Last active September 4, 2023 02:03
Steps for Setting up a staging server in GoDaddy
Sure, here are the steps on how to set up a staging server on GoDaddy, numbered:
1. Go to the GoDaddy website and log in to your account.
2. Click on the **Hosting** tab and select the **Staging Servers** option.
3. Click on the **Create Staging Server** button.
4. Enter the following information:
* The name of your staging server
* The domain name of your staging server
* The operating system for your staging server
* The amount of storage space you need for your staging server
@NeuTrix
NeuTrix / lattice.js
Created January 13, 2022 20:50
Solution to lattice interview problem (from memory)
// -- The "API" fakes
const surveys = [
{ id: "surveyID-01",name: "Survey A" },
{ id: "surveyID-02",name: "Survey B" },
]
const prompts = [
{
id: 'promptId-01',
survey_id: 'surveyID-01',
@NeuTrix
NeuTrix / gist:915736e6c3a3752c6906f41bbd127d57
Created January 16, 2019 17:02
package.json for React Redux CRUD toy app
{
"name": "date_trader",
"version": "0.0.1",
"description": "Basic CRUD template in React and Redux",
"main": "index.js",
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
@NeuTrix
NeuTrix / eslintrc.json: airbnb styleguide
Last active February 4, 2019 18:34
eslintrc.json for airbnb styleguide. Place in the root folder of js application
{
"env": {
"browser": true,
"es6": true,
"node": true,
"jest": true
},
"extends": [
"airbnb",
"plugin:jsx-a11y/recommended",
@NeuTrix
NeuTrix / Codility: PermMissingElem
Last active December 31, 2021 02:49
javaScript solution to Codility PermMissingElem problem (Easy)
// ANSWER:
function solution(A) {
// make a dictionary of expected values: O(n)
let map = []
for (let i = 0; i < A.length + 1; i+= 1) {
map[i] = { num: i+1, bool: -1 }
}
// evaluate subset against dictionary, marking included values: O(n)
@NeuTrix
NeuTrix / Codility: FrogJmp JavaScript solution
Last active July 13, 2018 04:15
Solution in JavaScript warning: parseInt() is nutty!
function solution(X, Y, D) {
let range = (Y - X); // max distance to go
// special cases
let hops = D === Y ? 0 : parseInt(range / D); // whole jumps [1]
let extra = range % D; // any left over hops required
console.log(`===>| X:${X} | Y:${Y} | D:${D} | range:${range} | hops:${hops} | extra:${extra} |`)
return extra ? hops + 1 : hops
}
// [1] parseInt() [at least in Chrome] exhibits wonky behavior when working with small fractions. For example:
@NeuTrix
NeuTrix / Codility: PermCheck. JavaScript solution
Created July 12, 2018 02:46
A simple javascript solve to the Codility PermCheck challenge
// ===== ANSWER:
function solution(A) {
let set = new Set(); // holds a unique set of values
let max = 1; // largest number in set
let min = 1; // smallest number in set
let n = A.length
for (let i = 0; i < n; i += 1) {
let num = A[i];
@NeuTrix
NeuTrix / Codility Stonewall Solution Using JavaScript Stack
Last active July 12, 2018 02:48
Cover "Manhattan skyline" using the minimum number of rectangles in JavaScript
// ===== ANSWER
function solution(H) {
// write your code in JavaScript (Node.js 8.9.4)
let stack = [];
let count = 0;
let height = 0;
// adds a block to the stack when value exceeds current height
const addBlock = (value) => {
@NeuTrix
NeuTrix / Google interview: Longest word in Dictionary (javaScript)
Last active January 5, 2022 23:27
Find longest word in dictionary that is a subsequence of a given string
##The Challenge
Given a string S and a set of words D, find the longest word in D that is a subsequence of S.
Word W is a subsequence of S if some number of characters, possibly zero, can be deleted from S to form W, without reordering the remaining characters.
Note: D can appear in any format (list, hash table, prefix tree, etc.
For example, given the input of S = "abppplee" and D = {"able", "ale", "apple", "bale", "kangaroo"} the correct output would be "apple"
The words "able" and "ale" are both subsequences of S, but they are shorter than "apple".
@NeuTrix
NeuTrix / gist:d6df1bd329faa84cac344940ba1151db
Created May 25, 2018 21:40
Simple number formatter for U.S. commas
const numCom = (x) => {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}