Skip to content

Instantly share code, notes, and snippets.

View iamricky's full-sized avatar

Ricky iamricky

View GitHub Profile
@natanlao
natanlao / dependabot.md
Last active November 9, 2022 14:48
Automatically merging Dependabot PRs

The best way I've found to automatically merge Dependabot PRs is to use actions/github-script to comment @dependabot merge on Dependabot PRs. There are a few reasons why I think this approach makes sense:

  • Commenting @dependabot merge on a Dependabot PR instructs Dependabot to merge the PR after tests (if any) pass, so we don't need to encode that dependency in a workflow file.

  • Unlike using an auto-merge action, nothing happens if the workflow runs on a

@dchima
dchima / tsconfig.json
Created February 23, 2020 16:59
optimal tsconfig setup
{
"compilerOptions": {
"module": "commonjs",
"resolveJsonModule": true,
"esModuleInterop": true,
"lib": ["es6", "dom"],
"allowSyntheticDefaultImports": true,
"rootDir": ".",
"noEmit": true,
"target": "es6",
/* Helper buddy for removing async/await try/catch litter 🗑 */
function O_o(promise) {
return promise.then(data => {
if (data instanceof Error) return [data]
return [null, data]
}).catch(err => [err])
}
/* Look ma, no try/catch */
async function usageExample(params) {
@dimabory
dimabory / gist:56e36474a1bb5573c08f26805a978fb5
Last active July 22, 2023 08:41
General Responsibility Assignment Software Patterns (GRASP)
@fnky
fnky / hooks.js
Last active January 7, 2024 12:32
React Hooks: useReducer with actions and selectors (Redux-like)
function useSelectors(reducer, mapStateToSelectors) {
const [state] = reducer;
const selectors = useMemo(() => mapStateToSelectors(state), [state]);
return selectors;
}
function useActions(reducer, mapDispatchToActions) {
const [, dispatch] = reducer;
const actions = useMemo(() => mapDispatchToActions(dispatch), [dispatch]);
return actions;
  • List all modified file names

    • git whatchanged --since '12/01/2016' --oneline --name-only --pretty=format: | sort | uniq
    • git log --since="4 day ago" --name-only --pretty=format: | sort -u
    • git whatchanged --since '12/01/2016' --until '12/06/2016' --oneline --name-only --pretty=format: | sort | uniq
  • Stash

    • git stash
    • git stash list (Get all stash(s))
    • git stash pop (Reapply stash and remove)
  • git stash apply (Reapply stash and keep copy)

@timelf123
timelf123 / lower_bound.js
Created September 22, 2017 14:08 — forked from Gattermeier/lower_bound.js
Lower bound of Wilson score confidence interval for a Bernoulli parameter
// Node.js implementation of Evan Miller's algorithm for ranking stuff based on upvotes:
// http://www.evanmiller.org/how-not-to-sort-by-average-rating.html
const stats = require('simple-statistics')
const lower_bound = (upvotes, n = 0, confidence = 0.95) => {
if (n === 0) return 0
// for performance purposes you might consider memoize the calcuation for z
const z = stats.probit(1-(1-confidence)/2)
@kevinweber
kevinweber / built-in-tools.md
Last active August 29, 2025 19:51
Collection of AEM Links, Commands & Tips / Cheat Sheet

Web Consoles & Tools

@mattlo
mattlo / README.md
Last active July 6, 2023 07:44
AEM 6.2 Touch UI Rich Text Editor Inline Dialog; Coral UI, RTE, CQ5, CUI, RichText

Example config for RTE within a Dialog

  • rtePlugins enables the CUI registry (cq/ui/rte/core/plugins/PluginRegistry.js)
    • Some plugins are enabled be default, so there's instances online where this section is omitted. You'll need this configuration if you want anything that isn't default. I left some other plugin configurations here that aren't in use.
  • uiSettings is a configuration used by CUI
    • Some online resources will note other cui children. inline is the configuration plugin for the inline toolbar mode. fullscreen is the configuration plugin for the full screen toolbar mode. If a plugin isn't enabled, some settings here won't activate.
  • Fixed inline mode won't work for 6.0 or 6.1. You'll need 6.2. In 6.3+, this may not work due to CUI2 being introduced. CUI2 may simplify some setup.

table

@kevinweber
kevinweber / example.html
Last active May 5, 2023 12:22
AEM: Include another resource + modify tag and class name #data-sly-resource
<!--/* More: https://docs.adobe.com/docs/en/htl/docs/block-statements.html#resource */-->
<!--/* By default, the AEM decoration tags are disabled, the decorationTagName option allows to bring them back, and the cssClassName to add classes to that element. */-->
<div data-sly-resource="${'headline' @
resourceType='about-project/components/content/c34-section-headline',
decorationTagName='span',
cssClassName='className'
}"></div>
<!--/* More about the decoration tag: https://docs.adobe.com/docs/en/aem/6-3/develop/components/decoration-tag.html */-->