Skip to content

Instantly share code, notes, and snippets.

@Kilowhisky
Kilowhisky / DebounceAction.cs
Last active August 16, 2023 15:54
C# Class that debounces an action denoted by a given key
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Threading.Tasks;
using System.Threading;
namespace Utils
{
@Kilowhisky
Kilowhisky / raw-geo.geojson
Created December 7, 2022 05:24
Raw geoJSON that is to be simplified
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Kilowhisky
Kilowhisky / simply-destroyer.geojson
Last active December 7, 2022 05:17
A GeoJSON file that turf.simplify will explode on (6.5.0)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Kilowhisky
Kilowhisky / DataUrlConverter.cs
Last active July 19, 2021 16:22
DataUrl to Binary Converter
private (string type, byte[] data) DataUrlToBinary(string dataUrl)
{
var match = Regex.Match(dataUrl, @"data:(?<type>.+?);base64,(?<data>.+)");
var type = match.Groups["type"].Value;
var base64Data = match.Groups["data"].Value;
var binData = Convert.FromBase64String(base64Data);
return (type, binData);
}
@Kilowhisky
Kilowhisky / controllers.application\.js
Last active February 3, 2021 06:11
Issue with ObjectPromiseProxy
import Controller from '@ember/controller';
import { computed } from '@ember/object';
import { ObjectPromiseProxy, resolvingPromise, resultObject } from '../utils/object-proxy';
export default class ApplicationController extends Controller {
regularObject = resultObject;
//@computed() // uncomment this to get it to work 'somehow'
get promiseObj() {
return ObjectPromiseProxy.create({
@Kilowhisky
Kilowhisky / c_sharp_rockpaperscissors.c
Created January 22, 2021 23:06
Rock Paper Scissors program build in C#
using System;
using System.Collections.Generic;
public class Program
{
public static List<WinEnum> PlayerStats = new List<WinEnum>();
public static void Main()
{
Console.WriteLine("Welcome to my great game");
@Kilowhisky
Kilowhisky / adapters.application.js
Last active August 29, 2018 15:27
Reload Record Hell
import DS from 'ember-data';
import Ember from 'ember';
export default DS.RESTAdapter.extend({
namespace: 'api'
});
@Kilowhisky
Kilowhisky / adapters.application.js
Last active July 26, 2018 23:17
HasMany Explosion
import DS from 'ember-data';
export default DS.RESTAdapter.extend({});
@Kilowhisky
Kilowhisky / adapters.application.js
Created May 15, 2017 22:31
HasMany Unload Exception
import DS from 'ember-data';
import Ember from 'ember';
export default DS.RESTAdapter.extend({
namespace: 'api'
});
@Kilowhisky
Kilowhisky / components.input-autocomplete.js
Created January 23, 2017 17:27
Focus Out Blocking Click
import Ember from 'ember';
export default Ember.Component.extend({
value: null,
options: null,
/**
* List of available options
* @return {Array}
*/