This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# simple string | |
SET name "fido" | |
GET name // "fido" | |
# increment | |
SET connections 10 | |
INCR connections // 11 | |
DEL connections // deleted | |
INCR connections // 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://thepythonguru.com/ | |
# start | |
$ python3 | |
# end | |
$ exit() | |
# run | |
$ python script.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"data": [ | |
{ | |
"id":1, "name": "Mike", "human": true | |
}, | |
{ | |
"id":2, "name": "Lucy", "human": false | |
}, | |
{ | |
"id":3, "name": "Arnold", "human": true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// count by regex | |
COUNTIF(range, "F1*") | |
// countif more/less | |
COUNTIF(range, ">2015-01-01") | |
// countif NOT | |
COUNTIF(range, "<>Läkare") | |
// url - google sheets regex syntax |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// count unique values in pivot | |
http://stackoverflow.com/questions/11876238/simple-pivot-table-to-count-unique-values | |
Use "distinct antal" in dialog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function dataToJSON(data) { | |
// out | |
var out= []; | |
// split | |
var header = data[0], | |
body = data.slice(1); | |
// body LOOP | |
for (var i = 0; i < body.length; i++) { | |
// | |
var o = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// data is an array | |
function unique(data) { | |
return data.reduce(function(base, item){ | |
if (base.indexOf(item) < 0 ) { | |
base.push(item); | |
} | |
return base | |
}, []) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function randomList(range, n) { | |
// | |
var checklist = [], out = []; | |
// loop | |
for (var i = 0; out.length < n; i++) { | |
// | |
var num = Math.floor((Math.random() * range)); | |
// if not in checklist | |
if (checklist.indexOf(num) === -1) { | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function dayDiff(f, s, abs){ | |
var f = new Date(f), | |
s = new Date(s), | |
oneDay = 24*60*60*1000; | |
if (abs) { | |
return Math.round(Math.abs((f.getTime() - s.getTime())/(oneDay))); | |
} else { | |
return Math.round((f.getTime() - s.getTime())/(oneDay)); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
**VARIABLER** | |
# calc age | |
=Om Längd([Personnummer]) <= 13 | |
Så | |
TillNummer(FormatDatum(AktuelltDatum(); "yyyy")) - | |
TillNummer(Delstr([Personnummer]; 0; 4)) | |
Annars "-" | |
# relative date; today -n month |
OlderNewer