Skip to content

Instantly share code, notes, and snippets.

View said-and-done's full-sized avatar

Said Nuh said-and-done

  • @tv2 Editorial Dev Team
  • Copenhagen, Denmark
View GitHub Profile
d3.nest()
.key(function(num) { return num % 2 == 0 ? "even" : "odd"; })
.rollup(function(values) { return values.length; })
.map([1, 2, 3, 4, 5]);
(function(console) {
console.save = function(data, filename) {
if (!data) {
console.error('Console.save: No data')
return;
}
if (!filename) filename = 'console.json'
antal adresse
-------------------------------------
16x Fritidshaven 36, 2640 Hedehusene
6x Løvegade 76 A st tv, 4200 Slagelse
6x Løvegade 76 A 3 tv, 4200 Slagelse
6x Løvegade 76 A 2 tv, 4200 Slagelse
6x Løvegade 76 A 1 tv, 4200 Slagelse
5x Løvegade 76 A 4 th, 4200 Slagelse
5x Løvegade 76 A 3 th, 4200 Slagelse
5x Løvegade 76 A 2 th, 4200 Slagelse

Survey Storage

A flexibile survey storage service. Allows you to create new surveys by describing the fields used in the survey. Surveys can then be answered, where each answer is stored alongside the ip that sent in the answer (limited to IPv4). Survey answers can be accessed as a CSV export.

Creating a survey

@said-and-done
said-and-done / gid2wid.js
Created October 2, 2017 12:21
Google spreadsheets - gid to worksheet id
var gid2Wid = function (gid) {
var xorval = gid > 31578 ? 474 : 31578;
var letter = gid > 31578 ? 'o' : '';
return letter + parseInt((gid ^ xorval)).toString(36);
};
@said-and-done
said-and-done / Find & replace in place with sed
Last active June 13, 2018 08:54
Anonymize IP in analytics embed code
#!bash
$ find ../static -type f -name 'content.json' \
-exec grep -Hi "ga('send', 'pageview');" {} \; \
-exec gsed -i "s|ga('send', 'pageview');|ga('set', 'anonymizeIp', true);ga('send', 'pageview');|g" {} \;
@said-and-done
said-and-done / .block
Last active April 17, 2019 11:14
vandring
license: mit
@said-and-done
said-and-done / github.toc.js
Created September 9, 2019 14:08
Github Wiki: generate table of contents from sidebar
out = '';
document.querySelectorAll('li.Box-row').forEach((t) => {
var a = t.querySelector('a');
var text = a.innerText;
var link = a.getAttribute('href');
out += `## [${text}](${link})\n`;
});
console.log(out);
let subscribers = ['foo@mail.dk', 'bar@mail.co.uk'];
let count = subscribers.length;
let current = 0;
let URL = 'https://newsletter.services.tv2.dk/api/unsubscribe';
let unsub = (mail) => {
$.post(URL, {
@said-and-done
said-and-done / serial_comma.js
Last active February 11, 2020 14:02
List items with Oxford comma
let items = [
{name: 'A'},
{name: 'B'},
{name: 'C'}
];
let serial = items.map((item) => {
return item.name
}).reduce((prevVal, currVal, currentIndex, array) => {
var delim = currentIndex === array.length-1 ? ', and ': ', '