Skip to content

Instantly share code, notes, and snippets.

View ptomasroos's full-sized avatar

Tomas Roos ptomasroos

View GitHub Profile
@webdados
webdados / ga_tcf2.js
Last active February 23, 2024 08:45
Google Analytics with TCF v2.0 support
/* Need help? Hire us: https://www.webdados.pt/contactos/ */
//We need to wait for the page to be ready, or else the Consent platform may not be loaded yet, and we'll fire the pageview earlier than we should
window.onload = function() {
var google_analytics_id = 'UA-111111-01'; //Replace with yours
//Prepare the data layer
window.dataLayer = window.dataLayer || []
//gtag function
function gtag() {
dataLayer.push(arguments);
@patmigliaccio
patmigliaccio / install-cf-gae-ssl.md
Last active February 9, 2025 18:06
Configuring Cloudflare SSL/TLS certificates on Google App Engine

Configuring Cloudflare SSL/TLS on Google App Engine

Implementing end-to-end HTTPS encryption with CloudFlare for Google App Engine applications.

Google App Engine - Custom Domains

Add Domains

Register the root domain with Google Cloud Platform at the following:

@calexandre
calexandre / merge-zsh-history.sh
Last active April 2, 2025 15:40
Merge two zsh history files
#!/bin/bash
# Inspired on https://david-kerwick.github.io/2017-01-04-combining-zsh-history-files/
set -e
history1=$1
history2=$2
merged=$3
echo "Merging history files: $history1 + $history2"
test ! -f $history1 && echo "File $history1 not found" && exit 1
@cmod
cmod / hugofastsearch.md
Last active April 17, 2025 23:32 — forked from eddiewebb/readme.md
Fast, instant client side search for Hugo static site generator
@Centril
Centril / await.md
Last active April 30, 2019 13:52
Centril's views on the "Await Syntax Write Up"

Centril's views on the "Await Syntax Write Up"

in our opinion this — which we will call the "error handling problem” — remains the primary problem that we are trying to resolve.

I don't agree that this is the primary problem; it's one of many problems to resolve; Chaining (and thus not forcing temporaries), general composability, and working well with IDEs is among notable problems.

Syntactic Sugar Solution:

I think it is a stretch to call this syntactic sugar in the first place. The syntax await? is composing await + ?. In my view this is not enough semantic compression to be deserving of the description "syntactic sugar".

@kstrauser
kstrauser / black.md
Last active March 18, 2023 00:24
Using the "black" Python formatter in VS Code

This is how to use the Black Python code formatter in VS Code.

Make a Python 3.6 virtualenv for running Black

Black itself requires Python 3.6 to run, but few of our projects are on that version. The VS Code plugin conveniently lets you run black from its own virtualenv.

I had to give a specific version of black this morning. I didn't yesterday. Don't specify the version unless it makes you (and if you do, give the current version, not the one from this doc).

$ cd ~/Envs
@eddiewebb
eddiewebb / readme.md
Last active April 9, 2025 04:31
Hugo JS Searching with Fuse.js
@shihanng
shihanng / .chunkwmrc
Last active January 6, 2024 04:17
chunkwm + skhd
#!/bin/bash
#
# NOTE: specify the absolutepath to the directory to use when
# loading a plugin. '~' expansion is supported.
#
chunkc core::plugin_dir /usr/local/opt/chunkwm/share/chunkwm/plugins
#
@lostmsu
lostmsu / LifeSpan.cs
Last active April 12, 2025 01:14
Control LifeSpan treadmill from C# (treadmill drops connection if not kept alive)
// License: MIT
using System;
using System.Collections.Concurrent;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
public class LifeSpanTreadmill: IDisposable
{