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

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

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
(function(console) {
console.save = function(data, filename) {
if (!data) {
console.error('Console.save: No data')
return;
}
if (!filename) filename = 'console.json'
d3.nest()
.key(function(num) { return num % 2 == 0 ? "even" : "odd"; })
.rollup(function(values) { return values.length; })
.map([1, 2, 3, 4, 5]);
var draw_table = function(data, caption){
var table = d3.select(".data-table").append("table");
var tbody = table.append("tbody");
var trows = tbody
.selectAll("tr")
.data(data)
.enter()
.append("tr");
var draw = function(cities){
var width = $(".linechart svg");
var svg = d3.select(".linechart svg");
var width = svg.node().width.baseVal.value;
var height = svg.node().height.baseVal.value;
var margin = {top: 20, right: 80, bottom: 30, left: 50},
width = width - margin.left - margin.right,
height = height - margin.top - margin.bottom,
var current = $('.mainNavTabs li.active a').attr('href').substr(1);
if(current == 'nutrients'){
var rows = 'Type\tgram';
var cols = ['Fedt', 'Protein', 'Kulhydrat (tilgængelig)', 'Kostfibre'];
$('tr.nutrient-row td').filter(function(){
return cols.indexOf($(this).text()) != -1;
}).each(function(){
var self = $(this);
var name = self.text();
@said-and-done
said-and-done / func.throttle.js
Created May 21, 2016 07:00
Call function at most once per every [wait] milliseconds. Useful for rate-limiting.
window.addEventListener('resize', throttle(resizer, 200));
function throttle(func, wait) {
// from underscore.js
var _now = Date.now || function() { return new Date().getTime(); },
context, args, result, timeout = null, previous = 0;
var later = function() {
previous = _now();
timeout = null;
result = func.apply(context, args);
#antal dato
-----------------
75 8/9/2015
69 1/9/2015
63 26/5/2015
62 9/6/2015
54 15/9/2015
51 19/5/2015
42 12/5/2015
41 16/6/2015
SELECT salesperson_id,
Sum(sold / salesperson_count) AS amount
FROM project_items
JOIN(SELECT allocation.project_item_id,
sold,
salesperson_id
FROM project_item_sellers
JOIN(SELECT project_item_id,
Sum(amount) AS sold