Skip to content

Instantly share code, notes, and snippets.

package unwrittenfun.sponge.lunge.lua.tables;
import org.luaj.vm2.LuaTable;
import unwrittenfun.sponge.lunge.lua.functions.IValidFunction;
import unwrittenfun.sponge.lunge.lua.functions.LuaGenericFunction;
import java.lang.reflect.Method;
import java.util.*;
public class LuaJavaObject extends LuaTable {
@jamesbirtles
jamesbirtles / transition-to.ts
Created April 15, 2016 23:41
Transition between two elements in angular 2, works well with text.
function transitionTo(parent: any, from: any, to: any): Promise<void> {
return new Promise<void>(resolve => {
const transitionElement = DOM.clone(from);
const fromBCR: ClientRect = DOM.getBoundingClientRect(from);
// Hide old element until animation is complete.
DOM.setStyle(from, "display", "none");
// Temporarily display to element to get the BCR and styles.
DOM.setStyle(to, "display", "block");
import { Subject } from 'rxjs/Subject';
import { Subscriber } from 'rxjs/Subscriber';
import { ISubscription, Subscription } from 'rxjs/Subscription';
import { ObjectUnsubscribedError } from 'rxjs/util/ObjectUnsubscribedError';
/**
* MemorizingSubject acts like a BehaviorSubject, except that it is seeded
* with no value, calls to getValue() will fail before the first `next` call,
* and it does not push a value to subscribers if `next` has not been called.
*/
import { Component } from 'preact';
type Deferred<T> = {
[P in keyof T]?: Promise<T[P]>;
};
function isPromise<T>(V: any): V is Promise<T> {
return 'then' in V;
}

Keybase proof

I hereby claim:

  • I am UnwrittenFun on github.
  • I am unwrittenfun (https://keybase.io/unwrittenfun) on keybase.
  • I have a public key whose fingerprint is 8804 7BA1 1E9A 5791 7BB4 45E0 4F24 9117 2B7F D6BE

To claim this, I am signing this object:

@jamesbirtles
jamesbirtles / Buttons.html
Last active January 15, 2018 16:01
svelte boolean attributes
<button :disabled>Hello</button>
<button disabled="{{disabled}}">Hello</button>
<button>Hello</button>
<script>
export default {
data() {
return {
disabled: false,
};
@jamesbirtles
jamesbirtles / Nested.html
Created January 15, 2018 23:27
SSR Nested Store
Hello {{$name}}
<script>
import { Store } from 'svelte/store.js';
const store = new Store({ name: 'James' });
export default {
store: () => store,
}
@jamesbirtles
jamesbirtles / client.ts
Created August 25, 2019 14:38
Jayson WebSocket server and client
import {
Client,
ClientOptions,
Utils,
UtilsJSONStringifyOptions,
RequestParamsLike,
JSONRPCResultLike
} from "jayson";
import { promisify, isString, isError } from "util";
import WS from "ws";
@jamesbirtles
jamesbirtles / ElementAs.svelte
Created May 9, 2023 12:39
Example svelte component with an `as` property allowing for any element to be chosen
<script lang="ts">
import type { HTMLAttributes, SvelteHTMLElements } from 'svelte/elements';
type T = $$Generic<{ as?: keyof SvelteHTMLElements }>;
type ElementAttrs = T['as'] extends keyof SvelteHTMLElements
? SvelteHTMLElements[T['as']]
: HTMLAttributes<HTMLDivElement>;
type $$Props = { class?: string } & T & ElementAttrs;
let className = '';
@jamesbirtles
jamesbirtles / branches.json
Last active April 25, 2024 10:22
peopleplus-components-coverage
{"schemaVersion":1,"label":"branches","message":"30.82%","color":"red"}