Skip to content

Instantly share code, notes, and snippets.

View philpoore's full-sized avatar
🏠
Working from home

Phil Poore philpoore

🏠
Working from home
View GitHub Profile
@philpoore
philpoore / entitlemensts.xml
Created February 25, 2022 21:04
entitlemensts.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
@philpoore
philpoore / scripts.js
Created February 11, 2021 13:03
MongoDB handy scripts
//////////////////////////////
// Get currently running ops, good for finding out indexing progress
db.currentOp().inprog.map(a => a.msg)
/* [
undefined,
undefined,
"Index Build: scanning collection Index Build: scanning collection: 10385246/54469342 19%",
] */
//////////////////////////////
alert('hello');
@philpoore
philpoore / vwo.js
Created May 26, 2020 17:21
VWO to Adobe Javascript Integration Snippet
var _vis_opt_queue = window._vis_opt_queue || [],
_vis_counter = 0, adobeVar = 'eVar63';
_vis_opt_queue.push(function() {
try {
if (_vis_counter) {
return;
}
var _vis_combination;
s[adobeVar] = '';
@philpoore
philpoore / time-docker-build.sh
Created September 5, 2018 19:13
Generate JSON output of docker build step timing, useful for profiling
#!/bin/bash
# script: time-docker-build.sh
#
# All command line arguments are passed to docker build command.
#
# usage: ./time-docker-build.sh
#
DATE_FORMAT="+%s"
@philpoore
philpoore / OUTPUT
Created August 3, 2017 10:21
buffer-weirdness.js
# LOL, gist doesnt like utf8 chars :D
hello ☹ more here
bufferA length: 17 : "hello 9 more here"
bufferB length: 19 : "hello ☹ more here"
bufferC length: 19 : "hello ☹ more here"
bufferA json {"type":"Buffer","data":[104,101,108,108,111,32,57,32,109,111,114,101,32,104,101,114,101]}
bufferB json {"type":"Buffer","data":[104,101,108,108,111,32,226,152,185,32,109,111,114,101,32,104,101,114,101]}
bufferC json {"type":"Buffer","data":[104,101,108,108,111,32,226,152,185,32,109,111,114,101,32,104,101,114,101]}
@philpoore
philpoore / console.txt
Created January 10, 2017 15:45
Shows error when res.json and next are both called.
% node middleware.js 130 ↵
Error: Can't set headers after they are sent.
at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:344:11)
at ServerResponse.header (/usr/local/lib/node_modules/express/lib/response.js:718:10)
at ServerResponse.send (/usr/local/lib/node_modules/express/lib/response.js:163:12)
at ServerResponse.json (/usr/local/lib/node_modules/express/lib/response.js:249:15)
at /Users/phil/Desktop/middleware.js:20:6
at Layer.handle [as handle_request] (/usr/local/lib/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/usr/local/lib/node_modules/express/lib/router/index.js:312:13)
at /usr/local/lib/node_modules/express/lib/router/index.js:280:7
// manage json objects to js form data
const formData = (obj) => {
let data = new FormData();
for (var key in obj){
if (!obj.hasOwnProperty(key)) { continue; }
let item = obj[key];
function player_status(health){
if (health == 100){
return "Full Health";
}
if (health > 10){
return "Injured";
}