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
Slik lager du linker for å laste ned | |
http://data.brreg.no/enhetsregisteret/enhet.{filformat}?$filter=startswith(naeringskode1/kode, '{næringskode}')+and+registreringsdatoEnhetsregisteret+gt+datetime'{yyyy-MM-DD}T00:00' | |
Så om du vil ha ned alle som sysler med produksjon av øl og er registrert etter 1. august 2015 i en .csv-fil blir | |
filformat = csv | |
næringskode = 11.050 | |
yyyy-MM-DD = 2015-08-01 |
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
/** | |
* | |
* Import data from brreg | |
* @customfunction | |
**/ | |
function onOpen() { | |
SpreadsheetApp.getUi() | |
.createMenu('BRREG') | |
.addItem('Import from brreg', 'importSetup') |
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
var saxStream = require('sax').createStream(true, {trim: true}) | |
var hh = require('http-https') | |
var streamify = require('streamify') | |
var stream = streamify() | |
var url = 'https://raw.githubusercontent.com/zrrrzzt/sitemap-to-array/master/test/data/sitemap.xml' | |
var list = [] | |
function objectFromArray (arr) { | |
var obj = {} |
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
'use strict' | |
const axios = require('axios') | |
const api = 'https://valgresultat.no/api/2017/st' | |
const REDS = ['MDG', 'RØDT', 'A', 'SV', 'SP'] | |
module.exports = () => { | |
return new Promise(async (resolve, reject) => { | |
try { | |
const response = await axios.get(api) |
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
'use strict' | |
const setColor = require('./changecolor') | |
const getMandater = require('./get-mandater') | |
const switchColor = async color => { | |
try { | |
const result = await setColor(color) | |
console.log(result) | |
} catch (error) { |
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
/* You'll need this on your client | |
Gun.on('opt', function (ctx) { | |
if (ctx.once) { | |
return | |
} | |
ctx.on('out', function (msg) { | |
var to = this.to | |
// Adds headers for put | |
msg.headers = { | |
token: 'thisIsTheTokenForReals' |
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
[ | |
{ | |
"zone": "Stor-Oslo", | |
"municipality": "Oslo", | |
"area": "Oslo", | |
"stations": [ | |
{ | |
"zone": "Stor-Oslo", | |
"municipality": "Oslo", | |
"area": "Oslo", |
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
const data = require('./data.json') | |
function returnHighestColor (list) { | |
let color = 'ffffff' | |
if (list.includes('990099')) { | |
color = '990099' | |
} else if (list.includes('ff0000')) { | |
color = 'ff0000' | |
} else if (list.includes('ff9900')) { | |
color = 'ff9900' |
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
(async () => { | |
const siteMap = require('sitemap-crawler') | |
const validate = require('html-validator') | |
const url = 'http://www.npmjs.com' | |
function generateSitemap (url) { | |
return new Promise(async (resolve, reject) => { | |
siteMap(url, (error, result) => { | |
if (error) { | |
return reject(error) |