Skip to content

Instantly share code, notes, and snippets.

# Source: https://gist.github.com/0431989df4836eb82bdac0cc53c7f3d6
# Used in https://youtu.be/R6OeIgb7lUI
##############################
# Flux 2 With GitOps Toolkit #
##############################
# What Is GitOps And Why Do We Want It?: https://youtu.be/HKkhD6nokC8
# Argo CD: Applying GitOps Principles To Manage Production Environment In Kubernetes: https://youtu.be/vpWQeoaiRM4
@ottokruse
ottokruse / verify-jwt-rs256.ts
Last active April 4, 2024 15:46
Verify JWT signature, for RS256 in NodeJS (code in TypeScript). Only needs public key modulus and exponent (i.e. not as PEM/DER)
/*
This gist's core function is verifyJwt, whose purpose is to verify JWT's signed
using RS256
The public key needs to be provided as n (modulus) and e (exponent).
JWT algorithm RS256 in fact means RSASSA-PKCS1-v1_5 using SHA-256:
https://tools.ietf.org/html/rfc7518#section-3.1
The specification of RSASSA-PKCS1-v1_5 specifies the steps to verify signatures:
@lfades
lfades / Auth.js
Created October 11, 2018 19:06
Next.js Auth implementation: Apollo Server + Passport + Passport-jwt
/**
* server/dataSources/Auth.js
* Auth implementation, it's not really a dataSource so it doesn't need to be here
*/
const { authenticate, createJwt } = require('../lib/passport');
const { ON_HTTPS } = require('../configs');
const ONE_MINUTE = 1000 * 60;
const ONE_DAY = ONE_MINUTE * 60 * 24;
const ONE_MONTH = ONE_DAY * 30;
@F1LT3R
F1LT3R / sha1-hash-node.js
Created August 1, 2017 04:09
sha1 hash node.js
const crypto = require('crypto')
const sha1 = path => new Promise((resolve, reject) => {
const hash = crypto.createHash('sha1')
const rs = fs.createReadStream(path)
rs.on('error', reject)
rs.on('data', chunk => hash.update(chunk))
rs.on('end', () => resolve(hash.digest('hex')))
})
@amboutwe
amboutwe / yoast_seo_breadcrumb_add_woo_shop.php
Last active March 15, 2024 14:55
Multiple examples of how to customize the Yoast SEO breadcrumbs
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/*
* Add shop link to the Yoast SEO breadcrumbs for a WooCommerce shop page.
* Credit: https://wordpress.stackexchange.com/users/8495/rjb
* Last Tested: Apr 20 2017 using Yoast SEO 4.6 on WordPress 4.7.3
*/
add_filter( 'wpseo_breadcrumb_links', 'wpseo_breadcrumb_add_woo_shop_link' );
@amboutwe
amboutwe / yoast_seo_breadcrumb_remove_link.php
Last active April 12, 2024 06:43
These snippets are examples of how you can modify the Yoast SEO breadcrumb visual output. These snippets will not alter the breadcrumb schema output. Please consult the schema documentation to change the breadcrumb schema: https://developer.yoast.com/features/schema/api#to-add-or-remove-graph-pieces
@sn3p
sn3p / index.html
Last active May 18, 2019 05:50
Gist for blog post "Customizing the Intercom Launcher" http://blog.learningspaces.io/customizing-the-intercom-launcher
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Inject a stylesheet into the iframe</title>
<link rel="stylesheet" href="intercom.css">
</head>
<script>
// IMPORTANT: Make sure to change YOUR_APP_ID
(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true; s.src='https://widget.intercom.io/widget/YOUR_APP_ID'; var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})()
@aaronwaldon
aaronwaldon / 1) readme.md
Last active March 24, 2023 14:25
How to set up Gulp for Craft CMS. Includes SASS compilation and minification, JavaScript minification, livereloading, and browser sync.

How to set up Gulp with a Craft CMS project

I freaking love working with technologies like Gulp, and wanted to share how to get my current Craft front-end workflow set up. With a few tweaks, this can also be used with virtually any other sites (I've used it with Laravel, static sites, ExpressionEngine, etc).

Project Directory Structure

  • project root/
    • craft/
      • templates/
  • (your craft template files)
@ms-studio
ms-studio / add-term-to-custom-taxonomy.php
Created December 15, 2015 08:10
add term metabox to custom taxonomy - using WP 4.4 term meta functions
<?php
// source: http://wordpress.stackexchange.com/questions/211703/need-a-simple-but-complete-example-of-adding-metabox-to-taxonomy
// code authored by jgraup - http://wordpress.stackexchange.com/users/84219/jgraup
// CREATE CUSTOM TAXONOMY
add_action( 'init', '___create_my_custom_tax' );
@mattclements
mattclements / function.php
Last active April 16, 2024 17:04
Wordpress Disable Comments (add to function.php)
<?php
add_action('admin_init', function () {
// Redirect any user trying to access comments page
global $pagenow;
if ($pagenow === 'edit-comments.php') {
wp_redirect(admin_url());
exit;
}