Skip to content

Instantly share code, notes, and snippets.

View cloakedninjas's full-sized avatar

Daniel Jackson cloakedninjas

View GitHub Profile
@cloakedninjas
cloakedninjas / bootstrap.js
Last active December 15, 2021 12:06
Define top-level route in Strapi v4
// src/plugins/healthcheck/server/bootstrap.js
/**
With a plugin called healthcheck, this exposes a URL of /status without any /api or /admin prefix
**/
module.exports = ({ strapi }) => {
const routes = [
{
method: 'GET',
path: `/status`,
@cloakedninjas
cloakedninjas / font-awesome-upgrade-4-5.js
Created June 1, 2020 10:23
Node script to perform find/replace of Font Awesome icon from v4 to v5
const fs = require('fs');
const path = require('path');
// Sourced from https://fontawesome.com/how-to-use/on-the-web/setup/upgrading-from-version-4#name-changes
const changes = fs.readFileSync('icon-changes.csv', 'utf8');
const icons = changes.split('\r\n');
const OLD_PREFIX = 'fa fa-';
const ROOT_FOLDER = 'src';
const DRY_RUN = true;
@cloakedninjas
cloakedninjas / bootstrap.js
Created September 28, 2015 14:27
Bootstrapping a Phaser game to begin unit testing
var game;
function createGame() {
game = new MyGame.Game();
game.state.onStateChange.add(function (state) {
if (state === 'menu') {
runTests(); // wait for boot + preload to complete before running tests
}
}, this);
game.play(); // init's game and sets the initial Phaser.State
#!/usr/bin/env node
'use strict';
/**
* Usage:
*
* grunt.registerTask('checkAndroidManifest', 'Check manifest', function () {
* var done = this.async(),
* checkAndroidManifest = require('./bin/grunt-fix-manifest.js');
@cloakedninjas
cloakedninjas / CordovaBackupAgentHelper.java
Created July 10, 2015 14:08
Concrete implementation of BackupAgentHelper using FileBackupHelper to backup a single file
public class CordovaBackupAgentHelper extends BackupAgentHelper {
static final String FILE_NAME = "gameData.json";
static final String FILES_BACKUP_KEY = "data_file";
@Override
public void onCreate() {
FileBackupHelper helper = new FileBackupHelper(this, FILE_NAME);
addHelper(FILES_BACKUP_KEY, helper);
}