Skip to content

Instantly share code, notes, and snippets.

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

Stephen Rhyne srhyne

🏠
Working from home
View GitHub Profile
@srhyne
srhyne / migrate-index.sh
Created March 30, 2023 19:25
Fix Cloudflare 308 trailing comma redrect issue
# Fix Cloudflare 308 trailing comma redrect issue
# https://community.cloudflare.com/t/cloudflare-pages-get-rid-of-redundat-308-redirect/324582/29
# https://electricui.com/blog/switching-to-cloudflare-pages#how-to-disable-the-trailing-slash-on-cloudflare-pages
find ./dist -name 'index.html' -mindepth 2 -type f \
-exec sh \
-c 'parent="$(dirname "$1")"; mv "$1" "$parent/../$(basename "$parent").html";' \
find-sh {} \;
@srhyne
srhyne / polymorphic_join.sql
Last active August 6, 2018 22:15
Normalize polymorphic foreign relationships using union all
-- using union all to normalize
select id, name, foo, bar from (
select * from messages
left join broadcasts on broadcasts.id = messages.type_id
where type = 'broadcast'
union
select * from messages
@srhyne
srhyne / deferred-promises.js
Created August 6, 2018 15:54
$.Deferred Alternative using Promises
function Deferred( executor ){
var self = this;
this._promise = new Promise(function(resolve, reject){
self._resolver = resolve;
self._rejector = reject;
if( typeof executor === 'function' ){
executor(resolve, rejector)
}
@srhyne
srhyne / twilio-error-codes.json
Created April 23, 2018 20:32
Twilio Error Codes in JSON
[
{
"code": 10001,
"text": "Account is not active"
},
{
"code": 10002,
"text": "Trial account does not support this feature"
},
{
@srhyne
srhyne / new_cy_cg_bottom.html
Created January 2, 2018 17:13
new_cy_cg_bottom.html
<script>
if( window.FS ){
FS.identify(window.CONCO_PID, {
displayName: window.CONTACT_NAME || 'Portal User'
});
}
</script>
@srhyne
srhyne / new_cy_cg_head.js
Created January 2, 2018 17:09
new.conveyour.com portal head
<script>
window['_fs_debug'] = false;
window['_fs_host'] = 'fullstory.com';
window['_fs_org'] = '55HVF';
window['_fs_namespace'] = 'FS';
(function(m,n,e,t,l,o,g,y){
if (e in m) {if(m.console && m.console.log) { m.console.log('FullStory namespace conflict. Please set window["_fs_namespace"].');} return;}
g=m[e]=function(a,b){g.q?g.q.push([a,b]):g._api(a,b);};g.q=[];
o=n.createElement(t);o.async=1;o.src='https://'+_fs_host+'/s/fs.js';
y=n.getElementsByTagName(t)[0];y.parentNode.insertBefore(o,y);
Jessica
Sarah
Emily
Stephanie
Emma
Rebecca
Samantha
Lauren
Laura
Georgia
var updates = {};
//pr_id exists and the contact is starred.
if( contact.pr_id && contact.starred ){
return false;
}
if(updates[contact.id]){
clearTimeout(updates[contact.id]);
}
alias arti="./artisan"
alias up="cd .."
[
{
"iso": "all",
"symbol": "Lek",
"currency": "Lek",
"country": "Albania"
},
{
"iso": "afn",
"symbol": "؋",