Skip to content

Instantly share code, notes, and snippets.

Mikael Berg mikberg

Block or report user

Report or block mikberg

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
@mikberg
mikberg / Client.java
Created Mar 6, 2018
Deadly Dungeon Java Snippet
View Client.java
/*
* Copyright (c) 2017, Just AS. All rights reserved.
*/
package com.gojust.deadlydungeon.client;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
@mikberg
mikberg / sauce.js
Created Jan 23, 2016
Report Nightwatch results to SauceLabs
View sauce.js
/* eslint no-console:0 */
const https = require('https');
module.exports = function sauce(callback) {
const currentTest = this.client.currentTest;
const username = this.client.options.username;
const sessionId = this.client.capabilities['webdriver.remote.sessionid'];
const accessKey = this.client.options.accessKey;
if (!this.client.launch_url.match(/saucelabs/)) {
@mikberg
mikberg / mockRelay.js
Created Jan 19, 2016
Relay mock module
View mockRelay.js
import Relay from 'real-react-relay';
export class Mutation extends Relay.Mutation {
_resolveProps(props) {
this.props = props;
}
}
export class MockStore {
reset() {
@mikberg
mikberg / connection.js
Last active Jun 18, 2019
MongoDB connection with async/await
View connection.js
import { MongoClient } from 'mongodb';
import promisify from 'es6-promisify';
let _connection;
const connect = () => {
if (!process.env.MONGO_CONNECTION_STRING) {
throw new Error(`Environment variable MONGO_CONNECTION_STRING must be set to use API.`);
}
You can’t perform that action at this time.