Skip to content

Instantly share code, notes, and snippets.

View petermikitsh's full-sized avatar
🏳️‍🌈

Peter Mikitsh petermikitsh

🏳️‍🌈
View GitHub Profile
@petermikitsh
petermikitsh / index.js
Created March 7, 2022 07:41
Form post demo
const express = require('express');
const app = express();
const port = 3000;
app.get('/', (req, res) => {
res.setHeader('Content-Type', 'text/html');
res.send(`
<form action="/Form.do" method="POST">
<div>
<button>Submit the form</button>
@petermikitsh
petermikitsh / react-shadow-dom.html
Created September 29, 2021 23:18
react-shadow-dom.html
<!DOCTYPE html>
<html>
<head>
<title>React + Shadow DOM</title>
</head>
<body style="margin: 0">
<global-navigation>
<div slot="breadcrumbContent" style="color: red">Breadcrumbs</div>
<div slot="pageContent" style="color: blue">Page Content</div>
</global-navigation>
@petermikitsh
petermikitsh / index.html
Created March 26, 2020 20:18
Angular 8
<!DOCTYPE html>
<html>
<head>
<title>Angular 8</title>
</head>
<body>
<app-root></app-root>
<script src="https://unpkg.com/reflect-metadata@0.1.13/Reflect.js"></script>
<script src="https://unpkg.com/zone.js@0.10.3/dist/zone.js"></script>
<script src="https://unpkg.com/@reactivex/rxjs@6.5.4/dist/global/rxjs.umd.js"></script>
@petermikitsh
petermikitsh / client_code.js
Last active December 6, 2019 16:18
SAML implementation for feathers.js
/* SAML Authentication Flow
* - Open GET /SSO/SAML2 in an iframe
* - this will redirect to the identity provider ("IdP")
* - The user will insert their credentials in the IdP's website
* - The IdP will redirect to POST /SSO/SAML2
* - The response is validated
* - A user is created (should check if it exists first)
* - Set the JWT cookie
* - Send HTML response to instruct parent window to close the iframe
*/
(
function() {
const lagRadar = ( config = {} ) => {
const {
frames = 50,
speed = 0.0017,
size = 300,
inset = 3,
parent = document.body,
} = config;
@petermikitsh
petermikitsh / email.rb
Created January 1, 2014 22:06
PA DMV License Exam E-mail Notifier
# Provide the approriate server, port, from, username, and password fields.
# Author: Peter Mikitsh
require 'net/smtp'
def send_email(to, opts={})
opts[:server] ||= '' # SMTP SERVER
opts[:port] ||= 587 # PORT: DEFAULT IS 587
opts[:from] ||= '' # 'FROM' E-MAIL FIELD
@petermikitsh
petermikitsh / index.js
Created December 28, 2017 23:13
requirebin sketch
// Welcome! require() some modules from npm (like you were using browserify)
// and then hit Run Code to run your code on the right side.
// Modules get downloaded from browserify-cdn and bundled in your browser.
var timm = require('timm');
var obj = {foo: ''};
var newObj = timm.setIn(obj, ['foo', 'bar'], 'baz');
console.log('the object is', newObj);
@petermikitsh
petermikitsh / .eslintrc
Created February 28, 2017 17:35
linter config
// AirBNB Linting Rules
// See more @ https://gist.github.com/nkbt/9efd4facb391edbf8048
{
"env": {
"browser": true,
"node": true,
"es6": true
},
@petermikitsh
petermikitsh / keybase.md
Created February 28, 2017 02:20
keybase.md

Keybase proof

I hereby claim:

  • I am petermikitsh on github.
  • I am petermikitsh (https://keybase.io/petermikitsh) on keybase.
  • I have a public key ASAqwMNwoRSaTkH2qQHqmaFYJsmo3F77EghGYGYT6c5f5wo

To claim this, I am signing this object:

@petermikitsh
petermikitsh / DOMUtils.js
Created December 13, 2016 23:16
Utility functions for inspecting various DOM characteristics
// Find the height of the deepest DOM node
function getHeight(node) {
var children = node.children;
if (children.length === 0) {
return 1;
} else {
var childHeights = Array.from(children).map(function (child) {
return getHeight(child);
});
return 1 + Math.max.apply(null, childHeights);