Skip to content

Instantly share code, notes, and snippets.

@tomtaylor
tomtaylor / gaWorker.js
Created November 12, 2024 14:52 — forked from xiaopc/gaWorker.js
Google Analytics 4 Proxy with Cloudflare Workers
// 2023.4.23 更新,修复 gtag.js 加了个回车导致失效的问题
// 2023.3.2 更新,修复上报到 region*.google-analytics.com 未被代理的问题
addEventListener('fetch', (event) => {
// 这里可以加 filter
return event.respondWith(handleRequest(event));
});
// worker 应用的路由地址,末尾不加 '/'
const DOMAIN = 'https://example.workers.dev/routerpath';
Mix.install([:mint, :castore])
defmodule Main do
def run() do
total =
Stream.resource(
fn ->
{:ok, conn} = Mint.HTTP.connect(:https, "ftp.bit.nl", 443, mode: :passive)
{:ok, conn, _ref} = Mint.HTTP.request(conn, "GET", "/speedtest/10mb.bin", [], nil)
{conn, true}
Mix.install([:mint])
defmodule Main do
require Logger
@byte_count 8192
def run() do
{:ok, conn} = Mint.HTTP.connect(:http, "speed.transip.nl", 80, mode: :passive)
{:ok, conn, _req_ref} = Mint.HTTP.request(conn, "GET", "/10mb.bin", [], "")
From c515297e3003ad2471df788f241a487d5b77ac40 Mon Sep 17 00:00:00 2001
From: Tom Taylor <[email protected]>
Date: Fri, 2 Oct 2020 10:05:55 +0100
Subject: [PATCH] Add integration test to trap left lateral join bug
---
integration_test/cases/joins.exs | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/integration_test/cases/joins.exs b/integration_test/cases/joins.exs
cypress_runner.js:197680 Console was cleared
cypress_runner.js:197677 TypeError: The following error originated from your application code, not from Cypress.
> Cannot read property 'getDescendentByEl' of undefined
When Cypress detects uncaught errors originating from your application it will automatically fail the current test.
This behavior is configurable, and you can choose to turn this off by listening to the `uncaught:exception` event.
at LiveSocket.getViewByEl (webpack://phoenix_live_view/./js/phoenix_live_view.js?./node_modules/babel-loader/lib:908:38)
at eval (webpack://phoenix_live_view/./js/phoenix_live_view.js?./node_modules/babel-loader/lib:882:23)
{
"logger": {
"level": "debug",
"timestamp": false
},
"esclient": {
"apiVersion": "7.5",
"hosts": [{ "host": "elasticsearch" }]
},
"elasticsearch": {
@tomtaylor
tomtaylor / pelias.json
Created May 6, 2020 15:35
Debugging Pelias import
{
"logger": {
"level": "debug",
"timestamp": false
},
"esclient": {
"apiVersion": "7.5",
"hosts": [{ "host": "elasticsearch" }]
},
"elasticsearch": {
@tomtaylor
tomtaylor / refresh.js
Created April 23, 2020 19:36
Google Sheets macro to refresh all the data source sheets in the current file
/** @OnlyCurrentDoc */
function RefreshData() {
var spreadsheet = SpreadsheetApp.getActive();
SpreadsheetApp.enableAllDataSourcesExecution();
spreadsheet.getDataSourceTables().forEach(function(dataSourceTable) { dataSourceTable.refreshData() });
};
commit 96efd048f3e30dbff39ace91a9b936acfafd46b4 (HEAD -> sync-against-ons-postcode-directory, tomtaylor/sync-against-ons-postcode-directory, master)
Author: Tom Taylor <[email protected]>
Date: Tue Aug 20 08:54:05 2019 +0000
Sync with May 2019 ONS Postcode Directory
diff --git a/data/437/369/083/437369083.geojson b/data/437/369/083/437369083.geojson
index 3e7c98891a383..f753fd67f88dd 100644
--- a/data/437/369/083/437369083.geojson
+++ b/data/437/369/083/437369083.geojson
@tomtaylor
tomtaylor / plug_canonical_domain.ex
Last active January 17, 2019 20:47
Redirect requests to the host of the url defined in your endpoint. Expects an upstream proxy to have set X-Forwarded-Proto and X-Forwarded-Port.
defmodule PoplarWeb.PlugCanonicalDomain do
import Plug.Conn
import Phoenix.Controller
alias Plug.Conn
def init(opts), do: opts
def call(conn, _opts) do
endpoint_url = endpoint_url_struct()
conn_url = conn_url_struct(conn)