Skip to content

Instantly share code, notes, and snippets.

Avatar
🤖
Building

Jordan Coeyman acoyfellow

🤖
Building
View GitHub Profile
@acoyfellow
acoyfellow / example.html
Created Mar 15, 2022
Phonesites Custom Redirect
View example.html
<!-- add this code to a Code block. Style with "style" and "class" attributes -->
<button
onclick="window.location= redirect;"
style=""
class="button-reset pv3 tc ba b--transparent bg-animate pointer w-100 br2">
Click Me
</button>
<!-- add this to a page's Custom Code > Below Body -->
@acoyfellow
acoyfellow / example.html
Created Mar 15, 2022
Phonesites.com redirect based on "referrerId" URL parameter
View example.html
<script>
function beforePost(){
var referrerId= params.filter(function(p){
return p.key==='referrerId'
})[0]||{};
// add a new line for each referrer.
if(referrerId.val==='google'){ redirect = "https://google.com" };
};
</script>
@acoyfellow
acoyfellow / service-worker.js
Last active Dec 15, 2021
Svelte Kit service worker (does not cache external URLs)
View service-worker.js
import { timestamp, build, files } from '$service-worker';
const name = `cache-${timestamp}`;
self.addEventListener('install', (event) => {
event.waitUntil(caches.open(name).then((cache) => cache.addAll(['/', ...build, ...files])));
});
self.addEventListener('activate', (event) => {
event.waitUntil(
@acoyfellow
acoyfellow / url-params-inject.html
Created Dec 3, 2021
Phonesites Script: Add URL variables into form data
View url-params-inject.html
<script>
function beforePost(){
window.params.forEach(function (param) {
formData[param.key]= param.val;
});
};
</script>
View cookies-popup.html
<script src="https://unpkg.com/optkit@latest/index.js"></script>
<script>
const acceptedCookies = localStorage.getItem('acceptedCookies');
if(!acceptedCookies){
let optKit = new OptKit({target:document.body})
const testConfirm = async (_) => {
let confirmed = await confirm("Do you accept cookies?");
if (!confirmed) return window.location="https://google.com";
localStorage.setItem('acceptedCookies', true);
};
@acoyfellow
acoyfellow / storage.sol
Last active Nov 28, 2021
Example of a simple smart contract
View storage.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
/**
* @title Storage
* @dev Store & retrieve value in a variable
*/
contract Storage {
uint256 number;
/**
* @dev Store value in variable
@acoyfellow
acoyfellow / stephane.html
Created Oct 26, 2021
Stephane Storm Code Snippet
View stephane.html
<a href="https://stephanestorm.groovepages.com/ouvrezuncomptegratuit"
class="link relative button-reset pa3 db tc ba b--transparent bg-animate pointer w-100 br2 fw8"
target="_blank">
Plateforme Marketing Digitale
</a>
View details-tachyons.html
<details class="pv1 ph2 ph4-ns mw6 center cf tc">
<summary class="bg-blue link relative button-reset pv3 white db tc ba b--transparent bg-animate pointer w-100 br2 fw8">
Details
</summary>
<ul class="list pl0 ml0 center mw6 ba b--light-silver br3">
<li class="ph3 pv2 bb b--light-silver">
<a href="#">Top Option</a>
</li>
<li class="ph3 pv2 bb b--light-silver">
<a href="#">Middle Option(s)</a>
View stripe.js
//pseudocode, a mix of frontend + backend javascript:
//step1 (frontend):
const checkout = async () => {
try {
let resp = await fetch(`/api/checkout`, {
method: "POST",
headers: {
"content-type": "application/json",
},
@acoyfellow
acoyfellow / service-worker.js
Created Sep 4, 2021
Svelte Kit `service-worker.js`
View service-worker.js
import { timestamp, build, files } from '$service-worker';
const name = `cache-${timestamp}`;
self.addEventListener('install', (event) => {
event.waitUntil(caches.open(name).then((cache) => cache.addAll(['/', ...build, ...files])));
});
self.addEventListener('activate', (event) => {
event.waitUntil(