Skip to content

Instantly share code, notes, and snippets.

@daolf
daolf / mrr.js
Last active March 7, 2023 14:23
MRR iOS widget
// Modified from @mutsuda's https://medium.com/@mutsuda/create-an-ios-widget-showing-google-spreadsheets-data-856767a9447e
// Modified from @levelsio's https://gist.github.com/levelsio/a1ca0dd434b77ef26f6a7c403beff4d0
// By @daolf
// Prerequisite: install Scriptable @ https://apps.apple.com/us/app/scriptable/id1405459188
const API_TOKEN = "CHARTMOGUL_TOKEN"
const API_SECRET = "CHARTMOGUL_SECRET"
// Recreating a basic auth with Scriptable lib
import requests
from multiprocessing.dummy import Pool as ThreadPool
def request_scrapingbee(url):
r = requests.get(
url="https://app.scrapingbee.com/api/v1/",
params={
"api_key": "<YOUR_API_KEY>",
"url": url,
},
// source: https://jennamolby.com/how-to-use-cookies-to-capture-url-parameters/
(function(){
function getCookie(cname) {
var name = cname + "=";
var decodedCookie = decodeURIComponent(document.cookie);
var ca = decodedCookie.split(';');
for(var i = 0; i <ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
https://jennamolby.com/how-to-use-cookies-to-capture-url-parameters/
let YOUR_DOMAIN = "YOUR_DOMAIN.TLD" // ex: scrapingbee.com
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
google : 69380
data : 49288
web : 46085
app : 43860
startup : 38345
facebook : 35421
apple : 32965
open : 31515
free : 28377
software : 28353
@daolf
daolf / extruct_example.py
Created January 5, 2019 15:00
Python tips
data_from_extruct = {
'title': 't-shirt',
'brand': 'french-rocket',
'color': 'green',
'offer':{
'amount': 20,
'currency': '€‘
}
}
This file has been truncated, but you can view the full file.
April April
August August
Air Air
Air Earth
Autonomous communities of Spain Spain
Alan Turing Turin
Alanis Morissette Grammy Award
Alanis Morissette Award
Alanis Morissette American
Adobe Illustrator Adobe Illustrator