Skip to content

Instantly share code, notes, and snippets.

Eirik Brandtzæg eirikb

Block or report user

Report or block eirikb

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
eirikb / app.js
Last active Nov 15, 2019
MSAL in Outlook Add-In
View app.js
import "core-js/stable";
import "regenerator-runtime/runtime";
import 'whatwg-fetch';
import { UserAgentApplication } from 'msal';
const clientId = '<PUT YOUR CLIENT ID HERE>';
const scopes = ['User.Read'];
const msal = new UserAgentApplication({ auth: { clientId } });
const p = document.querySelector('p');
eirikb / load-vue-components-from-folder.js
Created May 24, 2017
Load all Vue components from a given folder, no need for an "index.js"-file
View load-vue-components-from-folder.js
const req = require.context('./components/', true, /\.(js|vue)$/i);
req.keys().map(key => {
const name = key.match(/\w+/)[0];
return Vue.component(name, req(key))
View DI.kt
package gutsu
import no.eirikb.gutsu.Gutsu
interface PumpService {
fun startPump()
class DataDesk {
fun sendMessage(text: String) {
View DI.kt
import no.eirikb.gutsu.Gutsu
class DataDesk {
fun sendMessage(text: String) {
println("${hashCode()}: Sending message: $text")
class PumpView(private val pumpService: PumpService) {
init {
use async_std::io;
use async_std::net::{TcpListener, TcpStream};
use async_std::prelude::*;
use async_std::task;
use futures::{AsyncReadExt, future};
async fn in_to_out(incoming: TcpStream, outgoing: TcpStream) {
let (incoming_reader, incoming_writer) = &mut (&incoming, &incoming);
let (outgoing_reader, outgoing_writer) = &mut (&outgoing, &outgoing);
eirikb / imgur-oauth-test.html
Last active Aug 30, 2019
Post to imgur using oauth (api v3) on a static (no server) site
View imgur-oauth-test.html
<!DOCTYPE html>
<html lang="en">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>imgur oauth</title>
<script src=""></script>
$(function () {
var extractToken = function(hash) {
eirikb / Dockerfile
Created Aug 3, 2017
Arch Linux AUR in Docker
View Dockerfile
FROM base/archlinux
RUN pacman -Syu
RUN pacman -S --noconfirm git base-devel
WORKDIR /build
RUN useradd -d /build build-user
RUN echo "build-user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
RUN chown -R build-user /build
View msal-demo.js
<!DOCTYPE html>
<script src=""></script>
const azureAdAppClientId = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';
const sharePointUrl = '';
const config = {
auth: {clientId: azureAdAppClientId},
cache: {cacheLocation: 'localStorage'}
View msal-domdom.html
<!DOCTYPE html>
<script src=""></script>
<script src=""></script>
<script src=""></script>
<script type="text/babel">
const azureAdAppClientId = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';
const sharePointUrl = '';
eirikb / App.vue
Last active Jan 10, 2019
Add MDL to Vue
View App.vue
<style lang="scss">
@import "~material-design-lite/material.css";
You can’t perform that action at this time.