Skip to content

Instantly share code, notes, and snippets.

View mightyhorst's full-sized avatar
🎯
Focusing

Mitch mightyhorst

🎯
Focusing
View GitHub Profile
// -- Jquery - if needed
// document.getElementsByTagName('head')[0].appendChild(document.createElement('script')).src = '//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'
function SwiftCtrl(){
this.queryUrl = function(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
@mightyhorst
mightyhorst / inject-jquery.js
Created March 15, 2018 00:40 — forked from tad-lispy/inject-jquery.js
Inject jQuery into webpage via console (oneliner)
document.getElementsByTagName('head')[0].appendChild(document.createElement('script')).src = '//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js'
@mightyhorst
mightyhorst / class_decorator.ts
Created September 6, 2018 08:27 — forked from remojansen/class_decorator.ts
TypeScript Decorators Examples
function logClass(target: any) {
// save a reference to the original constructor
var original = target;
// a utility function to generate instances of a class
function construct(constructor, args) {
var c : any = function () {
return constructor.apply(this, args);
}
import { HttpClientModule } from '@angular/common/http';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import { DashboardSidebarModule } from './dashboard-sidebar-module/dashboard-sidebar.module';
@NgModule({
@mightyhorst
mightyhorst / README.md
Created October 6, 2018 07:06 — forked from xaviervia/README.md
Sketch 43 files JSON types
@mightyhorst
mightyhorst / Beam Experience
Last active January 16, 2019 02:09
CV Experience
## Beam Energy, Sydney — Lead Fullstack Developer (Angular 6, Swift iOs, NodeJs, AWS)
#### November 2017 - October 2018
Beam Energy is an award winning innovative startup of 5 people which completely automatea the procurement of solar for huge industrial consumers of electricity, in particular factories and meat works, using IoT and machine learning blended with advanced engineering principles.
The problem they are solving is that a large factory like Pepsi bottling facilities uses an extraordinary amount of power from the grid, which accordingly requires a blend of green energy sources, a large amount of real estate for solar panels, fallback for outages, a significant investment of capex, world class solar engineers, regulatory red tape and long term buy in from the leadership. This process typically involves energy analysts to collect data and build engineering models forecasting usage throughout the day, financial analysis of the cost/benefit of systems that will meet this usage and a business case to
@mightyhorst
mightyhorst / Error handling flow
Last active January 25, 2019 00:14
Error Handling
### Error flow
try
retry
on succeeded write operation add to rollback/undo log
catch
error code swicth case
send back Error Model:
code: 500
urn: io.kitset.{entity}
key: validation.{field}
@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 / 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 / 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 .