Skip to content

Instantly share code, notes, and snippets.

View kitsonk's full-sized avatar
🔨
Nailing It!

Kitson Kelly kitsonk

🔨
Nailing It!
View GitHub Profile
@kitsonk
kitsonk / bronto.ts
Last active August 10, 2022 12:03
Example Deno Static Server
import {
green,
cyan,
bold,
yellow,
red
} from "https://deno.land/std@v0.20.0/fmt/colors.ts";
import {
Application,
@kitsonk
kitsonk / bundler.ts
Last active February 1, 2022 08:08 — forked from theoparis/bundler.ts
deno issue 1
/// <reference no-default-lib="true"/>
/// <reference lib="deno.ns" />
/// <reference lib="deno.unstable" />
/// <reference lib="dom" />
/// <reference lib="dom.iterable" />
/// <reference lib="dom.asynciterable" />
import { Application } from "https://deno.land/x/oak/mod.ts";
import staticFiles from "https://deno.land/x/static_files/mod.ts";
import {
@kitsonk
kitsonk / CLA.md
Created June 25, 2021 01:08
oak CLA

oak Individual Contributor License Agreement Thank you for your interest in contributing to oak ("We" or "Us").

This contributor agreement ("Agreement") documents the rights granted by contributors to Us. To make this document effective, please sign it and send it to Us by electronic submission. This is a legally binding document, so please read it carefully before agreeing to it. The Agreement may cover more than one software project managed by Us.

1. Definitions

"You" means the individual who Submits a Contribution to Us.

"Contribution" means any work of authorship that is Submitted by You to Us in which You own or assert ownership of the Copyright. If You do not own the Copyright in the entire work of authorship, please follow the instructions in https://github.com/oakserver/oak/blob/main/CONTRIBUTING.md.

const decoder = new TextDecoder();
async function handleRequest({ request, respondWith }: Deno.RequestEvent) {
let resolve: (response: Response) => void;
const p = new Promise<Response>((res) => {
resolve = res;
});
const r = respondWith(p);
let response: Response;
if (request.body) {
@kitsonk
kitsonk / lodash_example.ts
Last active August 18, 2020 18:10
An example of using lodash under Deno in a type safe way.
// @deno-types="https://unpkg.com/@types/lodash@4.14.135/index.d.ts"
import * as lodash from "https://cdn.pika.dev/lodash-es@^4.17.15";
console.log(Object.keys(lodash));
declare module 'deno' {
export = deno;
}
declare namespace deno {
const bytesSymbol: unique symbol;
export class DenoBlob implements domTypes.Blob {
private readonly [bytesSymbol];
@kitsonk
kitsonk / README.md
Last active August 8, 2017 09:37
Working with Intern 3 from vscode

Work with Intern from vscode

This document provides an example of how you can configure vscode to test with Intern.

You will need to edit your .vscode/launch.json in the root of your project and follow the example JSON below.

This will provide two "tasks", both being the unit tests, in Node.js and Chrome. The latter needs the Chrome Debugger plugin installed in vscode. You need to tailor the below to match you environment and assumes that intern is installed in the root of node_modules and that you are serving your project root up at localhost:8080.

@kitsonk
kitsonk / webpack.config.ts
Created July 14, 2017 15:34
Making Page Bundles for Electron
import * as webpack from 'webpack';
import { resolve } from 'path';
import { existsSync } from 'fs';
const NormalModuleReplacementPlugin: any = require('webpack/lib/NormalModuleReplacementPlugin');
export = function webpackConfig(): webpack.Configuration {
return {
entry: {
index: './lib/pages/index.js',
@kitsonk
kitsonk / project.json
Created June 23, 2017 16:25
Dojo 2 Todo MVC TSX
This file has been truncated, but you can view the full file.
{"dependencies":{"production":{"@dojo/core":"next","@dojo/has":"next","@dojo/i18n":"next","@dojo/routing":"next","@dojo/shim":"next","@dojo/widget-core":"next","globalize":"^1.2.3","maquette":"~2.5.1","pepjs":"^0.4.2","cldrjs":"^0.4.6"},"development":{"@dojo/cli-build-webpack":"next","@dojo/cli-test-intern":"next","@dojo/interfaces":"next","@dojo/loader":"next","@types/chai":"3.4.34","@types/glob":"~5.0.0","@types/node":"6.0.48","chai":"3.5.0","intern":"^3.4.3","typescript":">=2.0.0 || >=2.0.0-dev || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >= 2.4.0-dev","@dojo/core":"next","@dojo/has":"next","@dojo/i18n":"next","@dojo/shim":"next","bundle-loader":"^0.5.5","copy-webpack-plugin":"^4.0.1","css-loader":"^0.26.1","extract-text-webpack-plugin":"^2.0.0-rc.3","file-loader":"^0.10.0","html-loader":"^0.4.4","html-webpack-plugin":"^2.28.0","imports-loader":"^0.7.0","json-css-module-loader":"^1.0.0","loader-utils":"^0.2.16","optimize-css-assets-webpack-plugin":"^1.3.1","pkg-dir":"^1.0.0","postcss-cssnext":"^2.9.0","
@kitsonk
kitsonk / project.json
Created April 29, 2017 07:11
Dojo 2 Hello World
This file has been truncated, but you can view the full file.
{"dependencies":{"production":{"@dojo/core":"2.0.0-alpha.25","@dojo/has":"beta1","@dojo/routing":"2.0.0-alpha.10","@dojo/shim":"beta1","@dojo/stores":"2.0.0-alpha.11","@dojo/widget-core":"2.0.0-alpha.27","@dojo/i18n":"2.0.0-alpha.7","maquette":"2.4.3"},"development":{"@dojo/cli-build-webpack":"^2.0.0-alpha.11","@dojo/cli-test-intern":"^2.0.0-alpha.2","@dojo/interfaces":"2.0.0-alpha.11","@dojo/loader":"2.0.0-beta.9","@types/chai":"3.4.34","@types/glob":"~5.0.0","@types/grunt":"~0.4.0","@types/node":"6.0.48","chai":"3.5.0","intern":"~3.4.1","typescript":"~2.2.1","@types/minimatch":"*","assertion-error":"^1.0.1","deep-eql":"^0.1.3","type-detect":"0.1.1","benchmark":"2.1.1","charm":"0.2.0","diff":"1.1.0","digdug":"~1.6.0","dojo":"2.0.0-alpha.7","glob":"^5.0.3","istanbul":"0.4.1","leadfoot":"~1.7.0","lodash-amd":"4.16.4","mimetype":"0.0.8","platform":"^1.3.1","source-map":"~0.5.1","lodash":"^4.14.0","decompress":"3.0.0","fs.realpath":"^1.0.0","inflight":"^1.0.4","inherits":"^2.0.1","minimatch":"^3.0.2","once":"^1.