Skip to content

Instantly share code, notes, and snippets.

@Kukks
Kukks / stringify.ts
Created April 15, 2016 11:02
Aurelia stringify value converter
export class StringifyValueConverter {
public toView( value: any ): string {
if ( value ) {
return JSON.stringify(value);
} else {
return "null object";
}
}
}
@Kukks
Kukks / window-close-notifier.ts
Created April 21, 2016 09:43
Wrapped the onbveforeload event is a static function to send a confirmation message when the user tries to close the window
export class WindowCloseNotifierHelper {
public static setMessage( message: any ) {
if ( message && _.isFunction(message) ) {
window.onbeforeunload = message;
} else if ( message ) {
window.onbeforeunload = ( e: any ) => {
if ( e ) {
e.returnValue = message;
}
import { autoinject } from "aurelia-dependency-injection";
import { Router } from "aurelia-router";
import { ObserverLocator } from "aurelia-binding";
declare var $: any;
@autoinject()
export class ModalService {
constructor( private router: Router, private observerLocator: ObserverLocator ) {
this.observeRouterNavigation();
export class Reflection {
public static getPropertyName( propertyFunction: Function ): string {
return /\.([^\.;]+);?\s*\}$/.exec(propertyFunction.toString())[1];
}
public static getPropertiesOfObject( object: any ): string[] {
let result: string[] = [];
if ( typeof object === "object" ) {
for ( let i in object ) {
@Kukks
Kukks / resursive property.cs
Created November 3, 2016 11:09
C# helper method to dig through an object recursively via string
private readonly BindingFlags flags = BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
private object GetPropertyRecursive(string property, object obj)
{
var splitted = property.Split('.');
var value = obj.GetType().GetProperty(splitted[0], flags).GetValue(obj);
if (value == null)
{
@Kukks
Kukks / app.html
Last active May 2, 2018 07:50 — forked from 3cp/app.html
input event trigger
<template>
<input value.bind="message">
<br>
<p>Message: ${message}</p>
<button click.trigger="tryChange()">jQuery('input')[0].val('test').trigger('change')</button>
<button click.trigger="tryInput()">jQuery('input').val('test2').trigger('input')</button>
</template>

Keybase proof

I hereby claim:

  • I am kukks on github.
  • I am kukks (https://keybase.io/kukks) on keybase.
  • I have a public key ASAXY_-1gn4ZEucBUj0gWy69ZJEaYtddCnZW9srMdu-HaAo

To claim this, I am signing this object:

public async Task UploadScreenshot(string clientId)
{
Screenshot ss = ((ITakesScreenshot) Driver).GetScreenshot();
var link = await UploadImageAnonymous(ss.AsBase64EncodedString, $"btcpayservertests_{DateTime.Now}");
Logs.Tester.LogInformation($"screenshot uploaded to {link}");
}
private async Task<string> UploadImageAnonymous(string base64, string name,string clientId)
@Kukks
Kukks / unit-of-work-observer.ts
Last active February 14, 2020 09:03
Aurelia Unit Of Work Observer
import { CloneUtility } from "./clone";
import { Disposable } from "aurelia-binding";
import { BindingEngine } from "aurelia-binding";
/**
* Unit Of Work Observer
* Based on the work of fragsalat's MultiObserver found at
* https://gist.github.com/fragsalat/819a58021fc7b76a2704
*
*
* The purpose of this observer is to observe all changes made to a model and allows you
@Kukks
Kukks / esnextbin.md
Created July 14, 2020 08:01
esnextbin sketch