Skip to content

Instantly share code, notes, and snippets.

View migreva's full-sized avatar

Michael Varano migreva

View GitHub Profile
@migreva
migreva / which-scrolling-elements.js
Created August 4, 2023 14:09
get all elements that have a scrollbar
// copied from this SO post here:
// https://stackoverflow.com/a/27822785/1337683
function isScroller(el) {
var isScrollableWidth, isScollableHeight, elStyle;
elStyle = window.getComputedStyle(el, null); // Note: IE9+
if (elStyle.overflow === 'scroll' ||
elStyle.overflowX === 'scroll' ||
elStyle.overflowY === 'scroll') {
return true;
@migreva
migreva / fib-even.js
Created August 30, 2019 12:43
Even Fib Numbers
/**
* Project Euler, Problem 2
* https://projecteuler.net/problem=2
*
* Each new term in the Fibonacci sequence is generated by adding the previous
* two terms. By starting with 1 and 2, the first 10 terms will be:
*
* 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
*
* By considering the terms in the Fibonacci sequence whose values do not
@migreva
migreva / flatten.js
Last active July 4, 2019 02:25
Flatten some arrays
/**
* Yo dawg I heard you like arrays, so if you put arrays in your
* arrays here's a function that can flatten it. O(n) complexity
*
* e.g flattenArray([[1,2,[3]],4]) -> [1,2,3,4]
*
* @param {Array} inputArray - Unflattened array
* @returns {Array} flattened array, bye bye pesky nested arrays
*/
function flattenArray(inputArray, outputArray = []) {
@migreva
migreva / saml.md
Last active September 28, 2018 17:05
Some SAML legwork

We're looking to onboard okta eventually to our microservices. Here I've collected some thoughts on how best to do this with the stack we have.

Echo

Echo has a concept of middleware, specifically sessions.

We will be able to leverage this in our servers, though we will need a database to store these sessions, probably. Luckily, the underlying session library called gorilla has a list of stores it plays nicely with.

SAML

Keybase proof

I hereby claim:

  • I am migreva on github.
  • I am migreva (https://keybase.io/migreva) on keybase.
  • I have a public key ASCJcF5AaIsKLBKGiMg-qbrke5klL6CtwwkJ5sIWaMhMAAo

To claim this, I am signing this object:

@migreva
migreva / goquery.go
Created June 23, 2017 15:34
Goquery fails to find element that exists
package main
import (
"log"
"net/http"
"github.com/PuerkitoBio/goquery"
)
func main() {
@migreva
migreva / gist:2a926b95f25366da657c
Last active January 15, 2016 03:44 — forked from cgmartin/gist:10328349
Less + newer: Watch for imported file changes
//
// grunt-newer:
// Check for newer @import .less files example
// See: https://github.com/tschaub/grunt-newer/issues/29
//
grunt.initConfig({
// ...
newer: {
options: {
override: function(details, include) {