Skip to content

Instantly share code, notes, and snippets.

View employee451's full-sized avatar

Aske Hippe Brun employee451

View GitHub Profile
@colllin
colllin / Readme.md
Last active February 21, 2024 14:55
FaunaDB User Token Expiration (for ABAC)

Auth0 + FaunaDB ABAC integration: How to expire Fauna user secrets.

Fauna doesn't (yet?) provide guaranteed expiration/TTL for ABAC tokens, so we need to implement it ourselves if we care about it.

What's in the box?

3 javascript functions, each of which can be imported into your project or run from the command-line using node path/to/script.js arg1 arg2 ... argN:

  1. deploy-schema.js: a javascript function for creating supporting collections and indexes in your Fauna database.
@Michaelvilleneuve
Michaelvilleneuve / i18n.test.js
Created August 8, 2018 10:14
Jest tests to check for missing translations, unused keys and incomplete translation files
/* eslint-disable */
import fr from 'config/locales/fr';
import en from 'config/locales/en';
import { exec } from 'child_process';
describe('i18n', () => {
test('Translations keys are the same for every language', () => {
const translationKeysEn = iterate(en, '', []);
const translationKeysFr = iterate(fr, '', []);
@alana-mullen
alana-mullen / Detect the last post in the WordPress loop
Last active May 29, 2023 16:50
Detect the last post in the WordPress loop
<?php if (($wp_query->current_post +1) == ($wp_query->post_count)) {
echo 'This is the last post';
} ?>
<?php if (($wp_query->current_post +1) != ($wp_query->post_count)) {
echo 'This is the not the last post';
} ?>
@cowboy
cowboy / github_post_recieve.php
Created October 11, 2010 02:04
GitHub PHP webhook to auto-pull on repo push
<?php
// Use in the "Post-Receive URLs" section of your GitHub repo.
if ( $_POST['payload'] ) {
shell_exec( 'cd /srv/www/git-repo/ && git reset --hard HEAD && git pull' );
}
?>hi