Skip to content

Instantly share code, notes, and snippets.

View resistdesign's full-sized avatar
💭
Exploring bypassed terrain.

Ryanne Graff resistdesign

💭
Exploring bypassed terrain.
View GitHub Profile
@ceving
ceving / ancestors.js
Last active May 29, 2023 05:05
JavaScript ancestor class list
/**
* Returns the list of ancestor classes.
*
* Example:
* ancestors(HTMLElement) .map (e => e.name || e.constructor.name)
* => [ "HTMLElement", "Element", "Node", "EventTarget", "Function", "Object" ]
*/
function ancestors (anyclass)
{
switch (true) {
@DrPaulBrewer
DrPaulBrewer / UploaderForGoogleDrive.js
Last active December 17, 2022 09:49
Upload Browser Blobs to Files in Google Drive API v3
// upload.js, from https://github.com/googledrive/cors-upload-sample
// Contributors Steve Bazyl, Mike Procopio, Jeffrey Posnick, Renaud Sauvain
// License: Apache 2.0 http://www.apache.org/licenses/LICENSE-2.0
//
// Implements Resumable Upload for Google Drive as described by
// https://developers.google.com/drive/v3/web/resumable-upload
//
// Modified by Paul Brewer, Economic and Financial Technology Consulting LLC
// Nov. 1 2017
// 1. use Google Drive API V3 instead of V2
@lmakarov
lmakarov / lambda-basic-auth.js
Created August 30, 2017 19:15
Basic HTTP Authentication for CloudFront with Lambda@Edge
'use strict';
exports.handler = (event, context, callback) => {
// Get request and request headers
const request = event.Records[0].cf.request;
const headers = request.headers;
// Configure authentication
const authUser = 'user';
const authPass = 'pass';
@resistdesign
resistdesign / Example.js
Last active July 18, 2017 20:35
Universal Type Structure (UTS)
// Type Map
{
PrimitiveType: {
name: 'PrimitiveType',
label: 'Primitive Type',
primitive: true
},
AnotherType: {
name: 'AnotherType',
label: 'Another Type',
@resistdesign
resistdesign / SPO.md
Last active July 11, 2017 04:53
Standard Persistence Operations

Standard Persistence Operations

Driven by UTS

Bulk Operations (This may just be the right basis for all transactions here???)

Collection Management

  • Create Collection
  • typeName
@resistdesign
resistdesign / Example.js
Last active June 30, 2017 01:24
Universal Query Structure (UQS)
// Query
{
type: 'OR_SET',
data: [
{
type: 'AND_SET',
data: [
{
type: 'CONDITION',
fieldName: 'myField',
@resistdesign
resistdesign / index.js
Last active December 9, 2016 03:57
JS DI Concept
// JSDI
class K{
handler;
constructor(handler){
this.handler = handler;
}
exec() {
@resistdesign
resistdesign / index.js
Created November 15, 2016 20:43
Collate Pages
function collate(pages = []){
const flats = [];
const { length } = pages;
const flatLength = Math.ceil(length/2);
const even = length % 2 === 0;
const newPages = [...pages];
if(!even){
const lastPage = newPages.pop();
@resistdesign
resistdesign / FluxDI.js
Last active June 16, 2016 06:42
A simple React Flux implementation with Dependency Injection for Components created by a React Router createElement handler.
import React, { Component } from 'react';
export default class FluxDI {
static validateContextName(name){
if(typeof name !== 'string'){
throw new Error('`name` must be a string.');
}
}
@resistdesign
resistdesign / index.js
Created April 21, 2016 05:22
Bindable Demo
function Bindable(ClassRef, onChangeMethodName){
class BindableClass{
constructor(...args){
const instance = new (ClassRef.bind(this))(...args);
for(const k in instance){
if(instance.hasOwnProperty(k)){
const initialValue = instance[k];
const privatePropertyName = `_${k}`;
instance[privatePropertyName] = initialValue;