Skip to content

Instantly share code, notes, and snippets.

View adriaandotcom's full-sized avatar
🕵️‍♂️
Developing the privacy-first Simple Analytics

Adriaan adriaandotcom

🕵️‍♂️
Developing the privacy-first Simple Analytics
View GitHub Profile
@adriaandotcom
adriaandotcom / aa-readme.md
Last active December 17, 2019 16:54
Run AB-tests without cookies and IPs

Goal

I'm creating AB-tests and want to have a client side JavaScript function that returns a small integer. The integer will be the same every time the same user connects to my website. I don't want to use cookies, localStorage or IPs for this. Just a very simple hash with the user agent and maybe a few more variables.

Read more on Twitter: https://twitter.com/AdriaanvRossum/status/1198102973114654720

Results

We tested all convert to int functions with the dataset from agents.js, these are the results:

@adriaandotcom
adriaandotcom / time_zone_per_country.csv
Last active May 18, 2023 09:31
List of time zone names with country codes (version 2018i from https://www.iana.org/time-zones)
country_code time_zone
AD Europe/Andorra
AE Asia/Dubai
AF Asia/Kabul
AG America/Antigua
AI America/Anguilla
AL Europe/Tirane
AM Asia/Yerevan
AO Africa/Luanda
AQ Antarctica/Casey
@adriaandotcom
adriaandotcom / endpoint.json
Last active December 1, 2018 13:06
Hugo API
{
"hostname": "codewithhugo.com",
"timezone": "UTC",
"visits": [
{
"utc_date": "2018-11-28",
"count": 2
},
{
"utc_date": "2018-11-29",
@adriaandotcom
adriaandotcom / comments.sql
Last active November 19, 2018 08:00
Output of teppic's answer
CREATE TABLE IF NOT EXISTS comment (
comment_id serial primary key,
original_id integer,
text text,
upvotes integer
);
INSERT INTO "public"."comment" ("comment_id", "original_id", "text", "upvotes") VALUES
('1', NULL, 'Hi.. should be 1', '10'),
('2', NULL, 'Je.. should be 10', '0'),
@adriaandotcom
adriaandotcom / comments.js
Created November 18, 2018 17:00
Write recusive function to read comments
const comments = [
{ id: 1, original_id: null, upvotes: 10, text: 'Hi..' },
{ id: 2, original_id: null, upvotes: 0, text: 'Je..' },
{ id: 3, original_id: 1, upvotes: 0, text: 'Di..' },
{ id: 4, original_id: 1, upvotes: 7, text: 'Si..' },
{ id: 5, original_id: 1, upvotes: 5, text: 'Op..' },
{ id: 6, original_id: null, upvotes: 2, text: 'Op..' },
{ id: 7, original_id: 6, upvotes: 2, text: 'Op..' },
{ id: 8, original_id: 5, upvotes: 3, text: 'Op..' },
{ id: 9, original_id: 1, upvotes: 3, text: 'Op..' }
@adriaandotcom
adriaandotcom / gist:b76c5d319bcb7d1dd530add901dd0d8a
Last active November 17, 2018 08:09
Placeholder for privacyfirstproduct.com
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
</head>
</html>
<body>
<p>
Hey guys, I'm live streaming while building my #24hrstartup on <a href="https://www.twitch.tv/adriaanvanrossum">twitch</a><br>

Keybase proof

I hereby claim:

  • I am harianus on github.
  • I am harianus (https://keybase.io/harianus) on keybase.
  • I have a public key ASCcznYg2mV6CndZAEuaxXoG9DhPNN1Z6hqXcEQ_imAf1wo

To claim this, I am signing this object:

{
"current_city": "Amsterdam",
"you_can_add_more_fields_later": "if you like"
}
@adriaandotcom
adriaandotcom / application.controller.js
Last active January 28, 2016 12:29
Ember: Set class on root div element
import Ember from 'ember';
export default Ember.Controller.extend({
// This is arrow function in > ES6
addClass: () => {
// Run next, otherwise the DOM is not ready
Ember.run.next(this, function() {
export default Ember.Controller.extend({
appName:'Testing CORS on IE',
init: function() {
$.get('https://api.socialshop-development.nl').done(function(data) {
console.log("got result: ", data);
});
}
});