Skip to content

Instantly share code, notes, and snippets.

View kaidesu's full-sized avatar
🔭
Stargazing

Kai kaidesu

🔭
Stargazing
View GitHub Profile
@mpociot
mpociot / CanBeReplicated.php
Created June 12, 2019 12:32
Add the ability to replicate Laravel models to other models.
<?php
use Illuminate\Support\Arr;
trait CanBeReplicated
{
public function replicateTo(string $model, array $with = null, array $except = null)
{
$defaults = [
$this->getKeyName(),
@jeremyben
jeremyben / ts-build-api.ts
Last active May 20, 2024 10:36
Typescript programmatic build with tsconfig.json (run with `ts-node -T`)
import * as path from 'path'
import ts from 'typescript'
function build(
override: {
compilerOptions?: ts.CompilerOptions
include?: string[]
exclude?: string[]
files?: string[]
extends?: string
@zeddash
zeddash / index.pug
Last active October 24, 2022 21:22
Emoting Eyes Exploration #codepen
div.face-container
div.face
div.eye.left
div.lower
div.lid
div.upper
div.lid
div.eye.right
div.lower
div.lid
@crgeary
crgeary / inertia.js
Last active March 27, 2024 09:00
Inertia adapter for Express
const lodashPick = (object, keys) => {
return keys.reduce((obj, key) => {
if (object && object.hasOwnProperty(key)) {
obj[key] = object[key];
}
return obj;
}, {});
};
const setupProps = async (props) => {

Add more features [advanced]

At some point you might get limited by the Queue class as a data-structure. You have to add methods for new features, that break the definition of a Queue.

  • Multi threaded dequeue(): Maybe you want to break the limit of "one request after the other". E.g. run up to max 5 tasks parallel. You can replace this._pendingPromise (true|false) flag with a counter and check insinside dequeue().

async dequeue() {

@whatupfoo
whatupfoo / 1-orgs-archetype.md
Last active May 2, 2025 12:02
Orgs and Teams Best Practices

Organization archetypes

The intention of this document is to provide some guidance and suggestions to customers who are wondering how they should structure organizations and teams in their GitHub Enterprise environment. The idea isn't to give hard and fast rules on which approach is better than the other, but to give examples of when one approach might be preferable to another depending on the use case.

1. A single organization with direct organization membership for repository access (not teams)

          ________________
          |     Org      |
          |    ______    |
          |   |      |\  |

| | Repo | \ |

@shethj
shethj / Readme.md
Last active October 25, 2024 06:56

Sample Auth.js to support hybrid deployment

This gist includes sample code which supports hybrid deployment in PWA Kit retail react app. The major changes are in auth.js where the authentication module supports storing auth tokens as cookies and login(..) function calls the /sessions OCAPI endpoint to bridge sessions between PWA Kit and SFRA sites.

If you generated a PWA Kit project prior to v2.7.1, you need to adopt the changes from this file in your project.

Code diffs are available in the PR: https://github.com/SalesforceCommerceCloud/pwa-kit/pull/1159/files