Skip to content

Instantly share code, notes, and snippets.

@eternal44
eternal44 / map.txt
Last active September 20, 2022 06:27
gracie combatives tree
standing
closing the distance
double leg takedown
haymaker
helmet -> clinch
- aggressive opponent
- passive
from clinch
@eternal44
eternal44 / test.js
Created July 2, 2020 00:26
jest test example
import React from 'react'
import { render } from '@testing-library/react'
import '@testing-library/jest-dom/extend-expect'
import ERshow from '../components/ERshow'
import {
offer,
YetAnotherMUAprofileShow,
MUAoffer,
exchangeRequest,
@eternal44
eternal44 / gist:dd0fdc7c085ef53f95ced3ccc5cbe545
Last active January 6, 2020 00:43
potential profile views

Synopsis:

There are a couple different ways to design an app but most are centered around the way the data is stored and accessed. This is the reason why going from a one-directional marketplace to a bi-directional marketplace was difficult: everything built "on top" of the data had to change as well.

Goals

Streamline our development and product planning processes.

Goal 1 - finalize data model based on our desired functionality

@eternal44
eternal44 / main.html
Created May 15, 2019 05:09
practicing html
<!DOCTYPE html>
<html>
<head>
<style>
.flex-container{
display:flex;
align-items: center;
font-family: arial;
}
function foo(arg1, arg2, cb) {
return arg1 + arg2 + cb(4)
}
console.log(foo(1, 2, function(num) {
return num + 2
}))
var myArr = [1,2,3]
@eternal44
eternal44 / countObjKeys.js
Last active August 6, 2016 03:32
Returns a count of all the keys in an array of nested objects
function countObjKeys(arr) {
var keyCount = 0
function traverseObj(obj) {
for (var key in obj){
if(typeof obj[key] === 'object')
traverseObj(obj[key])
keyCount++
}
@eternal44
eternal44 / findIndex.js
Last active July 27, 2016 16:36
Finds the index of an integer in a sorted array
function bsearch(ns, n) {
var startPoint = 0
var endPoint = ns.length - 1
var midPoint
while((startPoint < (endPoint + 1))) {
midPoint = Math.floor((endPoint - startPoint) / 2) + startPoint
if(ns[midPoint] === n){
return midPoint
@eternal44
eternal44 / countChars.js
Created June 3, 2016 00:18
Returns a map of characters & their consecutive frequency.
// 'AAAABBCDDDEEAA' => 'A4B2C1D3E2A2'
function countChars (str) {
var currentChar = str[0];
var charCount = 1;
var results = [];
for (var i = 1; i < str.length; i++) {
if(str[i] === currentChar) {
charCount++;
@eternal44
eternal44 / 8ball.md
Last active May 27, 2016 06:09
Find the odd ball out

8 ball problem

Of 8 balls one of them is a different weight. The only way to find the different ball is to use a scale. Find the odd ball (no pun intended) and determine if it's heavier or lighter than the rest.

Solution summary

Use a decision tree to deduce what balls need to be removed.

Max number of weighings: 3 #####Notes:

  • Finding normal balls for reference in the 2 ball series is trivial so I won't reference finding them.
  • Numbers in an array represent balls on one side of a scale like "[1, 2, 3]".