Skip to content

Instantly share code, notes, and snippets.

View kidGodzilla's full-sized avatar
👋
Working from home forever

James Futhey kidGodzilla

👋
Working from home forever
View GitHub Profile
@kidGodzilla
kidGodzilla / geoip.js
Created February 22, 2022 20:08
Geo IP node / express
const requestIp = require('request-ip');
function getIp (req) {
let ip = null;
try {
//ip = (req.headers['x-forwarded-for'] || '').split(',').pop() ||
// req.connection.remoteAddress ||
// req.socket.remoteAddress ||
// req.connection.socket.remoteAddress;
@kidGodzilla
kidGodzilla / browserquest-load-external-spritesheet.js
Last active December 13, 2021 00:56
Demonstrates how to load an external sprite into the game client
// Register an external sprite, CORS headers required for images
game.loadSprite('skeletonplayer', {
"id": "skeletonplayer",
"width": 48,
"height": 48,
"filepath_1": "http://filestore.b-cdn.net/skeleton_1.png",
"filepath_2": "http://filestore.b-cdn.net/skeleton_2.png",
"filepath_3": "http://filestore.b-cdn.net/skeleton_3.png",
"animations": {
"atk_right": {
@kidGodzilla
kidGodzilla / raf.js
Created April 4, 2021 05:36
RAF Performance Check (Updated)
/**
* RAF Performance Checking
*
* Will enable and disable a flag on the window object
* When Javascript performance suffers, so that optional features
* Can be Disabled or delayed
*/
(function () {
var lastTimestamp = + new Date();
@kidGodzilla
kidGodzilla / ocdb-jquery.js
Last active March 22, 2021 04:45
jQuery Automatic Data Fill
/**
* Instant Data for your OCDB Project (requires jQuery)
*
* Just use magic classes or data attributes matching your string data and they'll be automatically filled
*
* Example:
*
* <h1 data-for-h1></h1> <!-- This gets populated with data from the key `h1` -->
*
*/
@kidGodzilla
kidGodzilla / changelog-life-embed.html
Last active March 16, 2021 05:59
Changelog.life Embed Code / Widget
/**
* Changelog.life Widget Embed (Beta)
* Replace 'changelogging' with your Changelog subdomain
* Then, place this script tag where you want your changelog dot to appear.
*/
See an example on Codepen: https://codepen.io/kidGodzilla/pen/gOLymGB
<script onload="_changeloglife_init('changelogging')" id="changelog_life" src="https://changelog.life/embed.js"></script>
@kidGodzilla
kidGodzilla / natural-transcription-mapping.js
Created February 25, 2021 04:07
Infer timestamps in real-time from non-timestamped transcription progress updates
function currentTs() {
return (+ new Date()) - window._startTime || 0;
}
function cutTranscription() {
clearTimeout(window._silenceTimr);
window._cutoffTimr = null;
let piece = (_recognizedSpeech[0] || '').substring(_transcriptionLength);
_transcriptionLength = (_recognizedSpeech[0] || '').length;
@kidGodzilla
kidGodzilla / embed-widget.html
Last active March 11, 2021 21:20
Embed Indie.am Widget Example
<!-- indie.am Player Embed Script -->
<script>
window._indieam_username = 'james'; // Change this to your own log ID, typically indie.am/<log_id>
document.querySelector('head').innerHTML += '<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/cleanslate"><style>#indieam_container{position:fixed!important;padding:18px 20px!important;bottom:0!important;left:0!important;z-index:999999999999!important}.indieam_circle{cursor:pointer!important}.indieam_circle>img{width:65px!important;height:65px!important;border-radius:50%!important;box-shadow:1px 2px 22px #00000044!important}#indieam_container>iframe{position:fixed!important;bottom:-88px!important;left:-27px!important;transform-origin:0 0!important;transform:scale(.8)!important;height:750px!important;width:500px!important;display:none!important}#indieam_container>iframe.indieam_in{display:block!important}#indieam_container,#indieam_container iframe { overflow-y: hidden !important }</style>';
function _indieam_toggl
@kidGodzilla
kidGodzilla / custom-embed.html
Created February 11, 2021 06:17
Create a custom Indie.am Blog Embed
<!-- I've created an example you can peek at here: -->
<!-- https://jamesfuthey.com/audiolog -->
<script>
// First, set your Log ID (typically indie.am/<log_id>
window.logId = 'james';
// Now, we fetch data, and print our logs on our current page
fetchData(function () {
// This will output a new array of entries at window.sounds
/**
* @api {get} /freemail/:email isFreeMail
* @apiDescription Tests a domain to see if it's a free email or disposible email address
* @apiGroup Utility
* @apiExample {REST} Example usage:
GET https://api.meetingroom365.com/freemail/foo@gmail.com
* @apiParam {String} email The email address you wish to check
* @apiVersion 0.5.0
* @apiSuccessExample {json} Success
*HTTP/1.1 200 OK
@kidGodzilla
kidGodzilla / dokku_on_digital_ocean.md
Created October 25, 2020 06:43 — forked from henrik/dokku_on_digital_ocean.md
Notes from running Dokku on Digital Ocean.

My notes for Dokku on Digital Ocean.

These may be a bit outdated: Since I originally wrote them, I've reinstalled on a newer Dokku and may not have updated every section below.

Commands

Install dokku-cli (gem install dokku-cli) for a more Heroku-like CLI experience (dokku config:set FOO=bar).

# List/run commands when not on Dokku server (assuming a "henroku" ~/.ssh/config alias)

ssh henroku dokku