Skip to content

Instantly share code, notes, and snippets.

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

Marcus S. Abildskov marcus-sa

💭
🏋️‍♂️ + 🥩 + 🥊 + 🔊 + 🖥️ = ❤️
View GitHub Profile
@marcus-sa
marcus-sa / identity-schema.json
Created February 24, 2024 23:07
SMS identity schema
{
"title": "Person",
"type": "object",
"properties": {
"traits": {
"type": "object",
"properties": {
"sms": {
"type": "string",
"title": "Phone number",
@marcus-sa
marcus-sa / fetch-request-handler.spec.ts
Last active May 24, 2022 10:28
Deepkit HTTP Cloudflare Workers
import { http, JSONResponse, HttpBody, HttpQueries } from '@deepkit/http';
import { entity } from '@deepkit/type';
import { createTestingApp } from '@deepkit/framework';
import { beforeEach, describe } from '@jest/globals';
import { fetchRequestHandler } from '../src';
import { App } from '@deepkit/app';
@entity.name('user')
class User {
@marcus-sa
marcus-sa / client-and-server.spec.ts
Last active May 23, 2022 22:17
Deepkit WebSocket RPC Cloudflare Workers Interconnection
import { createTestingApp } from '@deepkit/framework';
import { ControllerSymbol, rpc } from '@deepkit/rpc';
import { entity } from '@deepkit/type';
import {
webSocketFetchRequestHandler,
CloudflareWorkerRpcWebSocketClient,
} from '../src';
// https://miniflare.dev/testing/jest
@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
interface IBird {
canFly(): boolean;
}
class Crow implements IBird {
public canFly() {
return true;
}
}
@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 })
# 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 ->
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
@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
@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) {