Skip to content

Instantly share code, notes, and snippets.

View marcus-sa's full-sized avatar
💭
🏋️‍♂️ + 🥩 + 🥊 + 🔊 + 🖥️ = ❤️

Marcus S. Abildskov marcus-sa

💭
🏋️‍♂️ + 🥩 + 🥊 + 🔊 + 🖥️ = ❤️
  • Copenhagen, Denmark
  • 02:28 (UTC +02:00)
  • LinkedIn in/marcus-sa
View GitHub Profile

Keybase proof

I hereby claim:

  • I am marcus-sa on github.
  • I am marcussa (https://keybase.io/marcussa) on keybase.
  • I have a public key ASDminMVQERLycG1DDUERhKv_gYGgjbIz8Nih9vhvICZ9Ao

To claim this, I am signing this object:

<?php
$db_host = 'localhost';
$db_name = 'testdb';
$db_charset = 'utf8mb4';
$db_username = 'root';
$db_password = '';
try {
$db = new PDO('mysql:host='.$db_host.';dbname='.$db_name.';charset='.$db_charset, $db_username, $db_password);
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
var superagent = require('superagent');
if (!String.prototype.startsWith) {
String.prototype.startsWith = function(search, pos) {
return this.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
}
}
var methods = ['get', 'post', 'put', 'patch', 'del'];
@marcus-sa
marcus-sa / Feathers.js
Last active February 1, 2018 18:27
Feathers Provider for AdonisJS
'use strict'
const _ = require('lodash')
const path = require('path')
const { ioc } = require('@adonisjs/fold')
const feathers = require('@feathersjs/feathers')
module.exports = class Feathers {
constructor(Config, Env, Helpers) {
@marcus-sa
marcus-sa / index.js
Created February 27, 2018 17:19
Loading Screen
import React, { Component } from 'react'
import { observer, inject } from 'mobx-react'
import * as utils from '../../../utils'
import Game from '../../Game'
import { Image, Progress, Message, Container } from './styled'
@inject(stores => stores.loadingScreen)
@observer
import { Middleware } from 'redux';
export interface IActionLifecycle {
resolveType: string;
rejectType: string;
}
/**
* Middleware which allows to chain async actions as Promises.
* @see https://github.com/redux-observable/redux-observable/issues/90
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
@marcus-sa
marcus-sa / UserController.ts
Last active April 17, 2018 18:12
Titan controller & routing example
import { Route } from 'Titan/Http/Routing'
@Route.group('threads')
export class ThreadController {
@Route.get(':id', { name: 'thread-comment' })
async comment({ request, response, id }) {
// ...
Route.generate('thread-comment', { id: 1 })
interface IBird {
canFly(): boolean;
}
class Crow implements IBird {
public canFly() {
return true;
}
}
@marcus-sa
marcus-sa / setup_bazel_binary.sh
Created March 6, 2020 13:31
Setup Bazel binaries locally
#!/bin/bash
set -eo pipefail
bazelBin=$(node -p "require('@bazel/bazel').getNativeBinary()")
# Provide the bazel binary globally. We don't want to access the binary
# through Node as it could result in limited memory.
sudo chmod a+x ${bazelBin}
sudo cp ${bazelBin} /usr/local/bin/bazel