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 / 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 / iso-3166-country-codes.txt
Created March 6, 2014 18:08
ISO 3166-1 Country Codes
AF,AX,AL,DZ,AS,AD,AO,AI,AQ,AG,AR,AM,AW,AU,AT,AZ,BS,BH,BD,BB,BY,BE,BZ,BJ,BM,BT,BO,BQ,BA,BW,BV,BR,IO,BN,BG,BF,BI,KH,CM,CA,CV,KY,CF,TD,CL,CN,CX,CC,CO,KM,CG,CD,CK,CR,CI,HR,CU,CW,CY,CZ,DK,DJ,DM,DO,EC,EG,SV,GQ,ER,EE,ET,FK,FO,FJ,FI,FR,GF,PF,TF,GA,GM,GE,DE,GH,GI,GR,GL,GD,GP,GU,GT,GG,GN,GW,GY,HT,HM,VA,HN,HK,HU,IS,IN,ID,IR,IQ,IE,IM,IL,IT,JM,JP,JE,JO,KZ,KE,KI,KP,KR,KW,KG,LA,LV,LB,LS,LR,LY,LI,LT,LU,MO,MK,MG,MW,MY,MV,ML,MT,MH,MQ,MR,MU,YT,MX,FM,MD,MC,MN,ME,MS,MA,MZ,MM,NA,NR,NP,NL,NC,NZ,NI,NE,NG,NU,NF,MP,NO,OM,PK,PW,PS,PA,PG,PY,PE,PH,PN,PL,PT,PR,QA,RE,RO,RU,RW,BL,SH,KN,LC,MF,PM,VC,WS,SM,ST,SA,SN,RS,SC,SL,SG,SX,SK,SI,SB,SO,ZA,GS,SS,ES,LK,SD,SR,SJ,SZ,SE,CH,SY,TW,TJ,TZ,TH,TL,TG,TK,TO,TT,TN,TR,TM,TC,TV,UG,UA,AE,GB,US,UM,UY,UZ,VU,VE,VN,VG,VI,WF,EH,YE,ZM,ZW
@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 / 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
@srhyne
srhyne / zc_fields.js
Created October 29, 2010 06:15
Paste & execute this in your browser's js console when you're on a Zoho Creator form's scriptbuilder page.
/**
* ZC fields render
*
* When on a Zoho Creator form scriptbuilder page, paste this into your javascript console
* (if on FF I recommend firebug) & execute it. This will render a DS code for all of the form fields
* DOUBLE CLICK the textarea created to remove it
*
* @param string m -Change to "insert","collect", or "update" to change the DS code output
* @param string r -Change to whatever you want your record collection variable to be
* @author Stephen Rhyne @srhyne
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]);
}