Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View k9ordon's full-sized avatar
🐙

Klemens Gordon k9ordon

🐙
View GitHub Profile
@TheRealFlyingCoder
TheRealFlyingCoder / .Keystone.js with Docker and Fly.io
Last active January 10, 2023 13:24
Keystone.js with Docker and Fly.io
So once you figure out all the caveats, running Keystone on Docker and in Fly.io is relatively simple.
package.json:
You need --fix on your setup script for Docker to auto update the schemas
"setup": "keystone postinstall --fix"
NOTES FOR DOCKER:
1. I use Yarn V3 in a monorepo hence the corepack lines and project structure
@codingwithchris
codingwithchris / KEYSTONE-JS-ACCESS-CONTROL.MD
Last active March 16, 2022 09:25
Unpacking Keystone JS Access Control (a security-focused perspective)

Access Control (Creating a Secure and Trusted Application)

Access control is critical to the security of our application. Beyond proper credential encryption, hashing, SALTing etc, access control is the next line of defense in protecting our users data.

Role Based Access Control Methodology (RBAC)

When giving elevated access to a User for a particular part of the system, we use a methodology called RBAC. This means that we create Roles where we assign permissions and apply filter policies. These Roles then get assigned to Users who have their CRUD access to Lists, Records, and Fields determined accordingly.

Our Access Control Philosophy

@ChristopherA
ChristopherA / brew-bundle-brewfile-tips.md
Last active April 19, 2024 06:56
Brew Bundle Brewfile Tips

Brew Bundle Brewfile Tips

Copyright & License

Unless otherwise noted (either in this file or in a file's copyright section) the contents of this gist are Copyright ©️2020 by Christopher Allen, and are shared under spdx:Creative Commons Attribution Share Alike 4.0 International (CC-BY-SA-4.) open-source license.

Sponsor

If you more tips and advice like these, you can become a monthly patron on my GitHub Sponsor Page for as little as $5 a month; and your contributions will be multipled, as GitHub is matching the first $5,000! This gist is all about Homebrew, so if you like it you can support it by donating to them or becoming one of their Github Sponsors.

@njbotkin
njbotkin / README.md
Last active December 19, 2019 13:25
Trigger SPA reloads without server polling with Cloudflare Workers

How it works:

  1. On app deploy, autoincrement Cloudflare KV value
  2. Cloudflare Worker adds a "version" cookie to every Response with the content from the KV
  3. Client checks cookies periodically to see if the "version" cookie has changed. If so, reload page
@mcevskb
mcevskb / trakt-remove-history.js
Last active July 8, 2021 21:07 — forked from hugoboos/trakt-remove-history.js
Remove duplicate episodes from Trakt
// Run in console on the history page (http://trakt.tv/users/<username>/history)
// Will remove all the duplicate episodes, on that page, from the watched history.
var episodesRemoved = []
// episodeItems = $("[data-type=episode]")
episodeItems.each(function(){
var $this = $(this);
var episodeId = $this.data('episode-id')
var showId = $this.data('show-id')

iOS restrictions re: bringing up the keyboard on programmatic focus

I can't find exact specifications on this, but it seems that iOS restricts bringing up the keyboard via programmatically focusing on <input>. It only brings up the keyboard in response to explicit user interaction.

  1. iOS focus on input field only brings up keyboard when called inside a click handler.
  2. It doesn’t work if the focus is async.

This presents a curious problem when you want to autofocus an input inside a modal or lightbox, since what you generally do is click on a button to bring up the lightbox, and then focus on the input after the lightbox has been opened. Without anything fancy, it actually works ok. The problem shows up when you try to add something fancy like a setTimeout or a promise.then(). I don't know why people would want to use a setTimeout here, but waiting for a promise is actually a pretty common use case. E.g. we try to batch dom manipulations like getting a lightbox to show up inside `requestAnimati

This file has been truncated, but you can view the full file.
elementattributeTypeType is not derived from System.Attribute.Element is not a constructor, method, property, event, type or field.targetTypeValue is not a System.Int32sValue is too largeWith AllowHexSpecifier only AllowLeadingWhite and AllowTrailingWhite are permitted.Not a valid number styleValue too large or too small.Input string was not in the correct formatValue is not a System.Int64Input string was not in the correct format: s.Length==0.Input string was not in the correct format: Has Negative Sign.Input string was not in the correct format: Has Positive Sign.Input string was not in the correct format: nDigits == 0.Input string was not in the correct format: no space between number and currency symbol.Input string was not in the correct format: No room for close parens.Input string was not in the correct format: Did not parse entire string. pos = s.Length = Value is not a System.UInt32.Negative numberValue is not a System.UInt64.Value is not a System.Byte.Value too large.Value is not a System.SByte.Val
@Daniel-Hug
Daniel-Hug / delegate-event.js
Last active September 14, 2020 05:05
Vanilla JS equivalent of jQuery's .live(): use event delegation to handle events whose target matches a selector, closest(): get nearest parent element matching selector
// get nearest parent element matching selector
var closest = (function() {
var el = HTMLElement.prototype;
var matches = el.matches || el.webkitMatchesSelector || el.mozMatchesSelector || el.msMatchesSelector;
return function closest(el, selector) {
return matches.call(el, selector) ? el : closest(el.parentElement, selector);
};
})();
@datchley
datchley / es6-eventemitter.js
Last active June 7, 2021 03:40
A straight forward EventEmitter implemented in Javascript using ES6
let isFunction = function(obj) {
return typeof obj == 'function' || false;
};
class EventEmitter {
constructor() {
this.listeners = new Map();
}
addListener(label, callback) {
this.listeners.has(label) || this.listeners.set(label, []);
@Couto
Couto / webpack.js
Last active November 11, 2020 17:53
Fetch polyfill with webpack
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var path = require('path');
var folders = {
APP: path.resolve(__dirname, '../app'),
BUILD: path.resolve(__dirname, '../build'),
BOWER: path.resolve(__dirname, '../bower_components'),
NPM: path.resolve(__dirname, '../node_modules')
};