Skip to content

Instantly share code, notes, and snippets.

View mightyhorst's full-sized avatar
🎯
Focusing

Nick Mitchell mightyhorst

🎯
Focusing
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<style>
.editor { font-family: 'Roboto Mono', monospace; font-size: 12px; outline: none; overflow-y: auto; padding-left: 48px; counter-reset: line; }
.editor div { display: block; position: relative; white-space: pre-wrap; }
.editor div::before { content: counter(line); counter-increment: line; position: absolute; right: calc(100% + 16px); opacity: 0.5; }
</style>
</head>
@mightyhorst
mightyhorst / scrollinto.jsx
Last active October 29, 2021 05:28 — forked from giventofly/scroll into.js
scroll to element vanilla js
//from https://css-tricks.com/snippets/jquery/smooth-scrolling/
// Scroll to specific values
// scrollTo is the same
window.scroll({
top: 2500,
left: 0,
behavior: 'smooth'
});
@mightyhorst
mightyhorst / index.css
Created October 19, 2021 02:14 — forked from stereokai/index.css
Trigonometry in CSS
//----------------------------------*\
// TRIGONOMETRY FUNCTIONS
//----------------------------------*/
// # Trigonometry in CSS
//
// - Through Taylor/Maclaurin polynomial representation: http://people.math.sc.edu/girardi/m142/handouts/10sTaylorPolySeries.pdf
// - Useful if you don't want to use JS.
// - With CSS Variables.
// - `calc()` can't do power (x ^ y) so I used multiplication instead.
@mightyhorst
mightyhorst / walksync.js
Created July 22, 2020 22:34 — forked from kethinov/walksync.js
List all files in a directory in Node.js recursively in a synchronous fashion
// List all files in a directory in Node.js recursively in a synchronous fashion
var walkSync = function(dir, filelist) {
var fs = fs || require('fs'),
files = fs.readdirSync(dir);
filelist = filelist || [];
files.forEach(function(file) {
if (fs.statSync(dir + file).isDirectory()) {
filelist = walkSync(dir + file + '/', filelist);
}
else {
@mightyhorst
mightyhorst / 00_postgres-docker-compose.yml
Last active November 18, 2019 06:14 — forked from onjin/docker-compose.yml
example docker compose for postgresql with db init script
postgres:
image: postgres:9.4
volumes:
# ~~~~~~~~~~~~~~
#
# @name Migrations and Seeders
# @description mapping each file as an example only, in reality you would just map the entire seeders folder
# @warning the order is important
#
# @param path_on_your_computer:path_to_init_db_folder_in_postgres_container
@mightyhorst
mightyhorst / connect.js
Created October 31, 2019 22:39 — forked from gaearon/connect.js
connect.js explained
// connect() is a function that injects Redux-related props into your component.
// You can inject data and callbacks that change that data by dispatching actions.
function connect(mapStateToProps, mapDispatchToProps) {
// It lets us inject component as the last step so people can use it as a decorator.
// Generally you don't need to worry about it.
return function (WrappedComponent) {
// It returns a component
return class extends React.Component {
render() {
return (
@mightyhorst
mightyhorst / bitbucket-pipelines.yml
Created October 9, 2019 03:19 — forked from jincod/bitbucket-pipelines.yml
Docker deployment using Bitbucket Pipelines and Heroku
pipelines:
default:
- step:
name: build and publish docker image
services:
- docker
caches:
- docker
script:
- docker build -t $APP_NAME .
@mightyhorst
mightyhorst / keycloak.sh
Created April 19, 2019 01:57 — forked from luciddreamz/keycloak.sh
Keycloak Admin API Rest Example: Get User
#!/bin/bash
# requires https://stedolan.github.io/jq/download/
# config
KEYCLOAK_URL=http://localhost:8080/auth
KEYCLOAK_REALM=realm
KEYCLOAK_CLIENT_ID=clientId
KEYCLOAK_CLIENT_SECRET=clientSecret
USER_ID=userId
@mightyhorst
mightyhorst / is_installed.sh
Created March 4, 2019 05:57 — forked from JamieMason/is_installed.sh
Check if a program exists from a bash script.Thanks to twitter.com/joshnesbitt and twitter.com/mheap for the help with detecting npm packages.
#!/bin/bash
# Functions ==============================================
# return 1 if global command line program installed, else 0
# example
# echo "node: $(program_is_installed node)"
function program_is_installed {
# set to 1 initially
local return_=1
@mightyhorst
mightyhorst / README.md
Created October 6, 2018 07:06 — forked from xaviervia/README.md
Sketch 43 files JSON types