Skip to content

Instantly share code, notes, and snippets.

View Rhionin's full-sized avatar

CJ Campbell Rhionin

  • Qualtrics
  • Lehi, UT
View GitHub Profile
@Rhionin
Rhionin / git-copy-file.sh
Created May 21, 2021 22:19
Copy file while preserving git history
#!/bin/bash
# Copy a file, preserving git history
# https://stackoverflow.com/questions/16937359/git-copy-file-preserving-history
set -e
ORIG_FILE="$1"
NEW_FILE="$2"
@Rhionin
Rhionin / remove_VariableDeclaration.js
Created August 19, 2020 20:09
Prepends "window." to any top level variable assignment
/* Prepends "window." to any top level variable assignment
*
* Ex: var foo = 'bar';
* Becomes: window.foo = 'bar';
*/
// NPM Modules
const glob = require('glob');
const path = require('path');
@Rhionin
Rhionin / remove_FunctionDeclaration.js
Created August 19, 2020 20:09
Explicitly assigns root-level functions to the window.
/* Explicitly assigns root-level functions to the window.
*
* Ex: function foobar() { ... };
* Becomes: window.foobar = function() { ... };
*/
// NPM Modules
const glob = require('glob');
const path = require('path');
const fs = require('fs');
@Rhionin
Rhionin / remove_AssignmentExpression_Identifier.js
Created August 19, 2020 20:09
Prepends "window." to any implicitly-global variable declaration
/* Prepends "window." to any implicitly-global variable declaration
*
* Ex: foo = 'bar';
* Becomes: window.foo = 'bar';
*/
// NPM Modules
const glob = require('glob');
const path = require('path');
const fs = require('fs');
@Rhionin
Rhionin / detect-globals-for-webpack-transition.js
Created August 19, 2020 20:07
A script I used to parse the AST from my javascript project to find implicit global references which would break when migrating to webpack
#!/usr/bin/env node
// NPM Modules
var babylon = require('babylon');
var fs = require('fs');
var chalk = require('chalk');
var path = require('path');
var traverse = require('babel-traverse').default;
var t = require('babel-types');
const glob = require('glob');
console.log('myCustomCKPluginTwo.js loaded');
console.log('myCustomCKPluginOne.js loaded');
console.log('loaded ck editor config js!');
CKEDITOR.editorConfig = function(config) {
console.log('loading custom config!');
config.extraPlugins = 'myCustomPlugin';
};
@Rhionin
Rhionin / keybase.md
Last active August 29, 2015 14:14
Publicly-auditable identity

Keybase proof

I hereby claim:

  • I am rhionin on github.
  • I am rhionin (https://keybase.io/rhionin) on keybase.
  • I have a public key whose fingerprint is 7B4F BFFB 32E2 B583 5699 36A8 46FC 3F73 CBA4 8BDD

To claim this, I am signing this object:

@Rhionin
Rhionin / gist:0f5131c3ba5f4d9ee911
Created July 31, 2014 22:17
angular-translate-loader-partial-2.0.1
/*!
* angular-translate - v2.2.0 - 2014-06-03
* http://github.com/PascalPrecht/angular-translate
* Copyright (c) 2014 ; Licensed MIT
*/
angular.module("pascalprecht.translate").provider("$translatePartialLoader",function(){function a(a){this.name=a,this.isActive=!0,this.tables={}}function b(a){return f.hasOwnProperty(a)}function c(a){return angular.isString(a)&&""!==a}function d(a){if(!c(a))throw new TypeError("Invalid type of a first argument, a non-empty string expected.");return b(a)&&f[a].isActive}function e(a,b){for(var c in b)b[c]&&b[c].constructor&&b[c].constructor===Object?(a[c]=a[c]||{},e(a[c],b[c])):a[c]=b[c];return a}a.prototype.parseUrl=function(a,b){return a.replace(/\{part\}/g,this.name).replace(/\{lang\}/g,b)},a.prototype.getTable=function(a,b,c,d,e){var f=b.defer();if(this.tables[a])f.resolve(this.tables[a]);else{var g=this;c({method:"GET",url:this.parseUrl(d,a)}).success(function(b){g.tables[a]=b,f.resolve(b)}).error(function(){e?e(g.name,a).then(function(b){g.tables[a]=b,f.resolve(b)},fu