Skip to content

Instantly share code, notes, and snippets.

View samrocksc's full-sized avatar
:shipit:
LFG

Sam Clark samrocksc

:shipit:
LFG
View GitHub Profile
@samrocksc
samrocksc / foo.md
Last active July 12, 2023 06:51
tester

Nice

@samrocksc
samrocksc / deeply-nested.html
Last active January 8, 2023 17:44
deeply-nested-clicks.js
<!DOCTYPE html>
<head>
<title>I am a page</title>
<style>
.closed {
display: none;
}
.hide_content>ul {
@samrocksc
samrocksc / index.html
Created January 8, 2023 17:08
sub-queries
‎‎​
@samrocksc
samrocksc / fp-ts-fetch.ts
Created April 10, 2022 16:42
Functional isometric-fetch
import fetch from 'isomorphic-unfetch';
import { pipe } from 'fp-ts/lib/function';
import * as TE from 'fp-ts/lib/TaskEither';
import * as E from 'fp-ts/lib/Either';
import * as O from 'fp-ts/lib/Option';
export const url = 'https://swapi.dev/api/planets/1/';
export const log = <A>(x: A) => {
console.info(x);
@samrocksc
samrocksc / googlesecretmanager.ts
Last active September 6, 2021 05:59
Writing a functional chained library to simplify Google Secret Manager
/* eslint-disable functional/functional-parameters */
/**
* This code was written to be followed along with from top to bottom. It is meant to show the value
* of having a functional interface, with object arity of one and controlling what goes into functions interface
* very strict fashion
*
* TODO: how do we make this chain easily? Commonality in needs and dependence inversion
* TODO: What if we need to add an over arching dependency?
*
* Why do i like function declaraitons more than class in stantiations?
@samrocksc
samrocksc / docker-compose.yaml
Created April 14, 2021 08:43
Local DB's Dockerfile
version: '3.1'
services:
redis:
image: "redis:alpine"
ports:
- '6379:6379'
networks:
- backend
mongo:
image: mongo
const fsx = require("fs-extra");
const glob = require("glob");
const fs = require("fs");
const path = require("path");
const mm = require("minimatch");
const getIgnoredFiles = (path) => {
const str = fsx.readFileSync(path).toString();
const lines = str
.split(/\r?\n/)
@samrocksc
samrocksc / unpackLerna.js
Last active April 4, 2020 10:16
holy fucking stupid
const { readFileSync, readdirSync } = require('fs');
const fsx = require('fs-extra');
const { promisify } = require('util');
const lernaConfig = require('./lerna.json');
/**
* grabs the lerna config, and then does a deep search of all packages and hard copies
* the node_modules that need to be
*/
const main = async () => {
@samrocksc
samrocksc / dba.md
Last active January 30, 2020 15:35
Thoughts on dba stuff

Notes on TypeORM and Lessons Learned DBA


  • TypeORM seems to have some opinionations that are pretty unfamiliar. While it may seem advantageous to use them, it's not advantageous to from a 3 year view. When you build a DB it should always be prepared for inevitable change. It's not unforeseeable that we at some point get integrated into a bigger company.
  • PostgreSQL has some awesome new features(plugins, jsonb aggregators); however, it's always my best practice to right as I possibly can to ther SQL-92 spec(SQL - ANSI (American National Standards Institute) SQL (Standard|Reference|Specification) - SQL (92|99|2003|2011))
  • SQL-92 is primarily what most base database connectors connect to. There are subtle differences to each kind of architecture for example:
    • mssql TOP:
      SELECT TOP 10 * FROM users;
  • Postgres LIMIT
@samrocksc
samrocksc / debug w stack
Last active April 19, 2019 18:58
Gives the stack for name of file and line number.
const v = require('debug')('verbose');
const e = require('debug')('error');
const w = require('debug')('warning');
const buildStack = () => {
const depth = 3;
if (!this.stackIs) {
Object.defineProperty(this, 'stackIs', {
get: function() {
const orig = Error.prepareStackTrace;