Skip to content

Instantly share code, notes, and snippets.

View amatiasq's full-sized avatar

A. Matías Quezada amatiasq

View GitHub Profile
import { AmqElement } from './AmqElement';
import { signal } from './signal';
export class AmqButton extends AmqElement {
static {
customElements.define('amq-button', this);
}
render() {
const type = signal<string>('buttonbutton');
@amatiasq
amatiasq / curry.js
Last active January 7, 2025 08:27
Simple way to recursively curry javascript functions http://jsfiddle.net/amatiasq/osrsomq0/
/**
* @param {Function} fn Function to curry.
* @param {Number} lenght The arguments required to invoke the function. Optional. By default is fn.length
* @returns {Function} The currified function.
*/
function curry(fn, length) {
length = length || fn.length;
return function currified() {
var args = [].slice.call(arguments);
version: '2'
services:
nginx-proxy:
image: nginxproxy/nginx-proxy
ports:
- 80:80
- 443:443
volumes:
- vhost:/etc/nginx/vhost.d
@amatiasq
amatiasq / removeWithTransition.ts
Last active December 18, 2023 11:26
removeWithTransition.ts
function insertWithTransition(el: HTMLElement, activeClass = 'is-active') {
el.classList.remove(activeClass);
setTimeout(() => {
el.classList.add(activeClass);
}, 0);
}
function removeWithTransition(el: HTMLElement, activeClass = 'is-active') {
const clone = el.cloneNode(true) as HTMLDivElement;
<!DOCTYPE html>
<html>
<head>
<title>Parcel Sandbox</title>
<meta charset="UTF-8" />
</head>
<body>
<div id="app">
<div class="left">Left</div>
@amatiasq
amatiasq / 1-ExposedReferencesTable.cs
Last active February 3, 2023 13:14
Using ExposedReferences in Unity
using System.Collections.Generic;
using UnityEngine;
public class ExposedReferencesTable : MonoBehaviour, IExposedPropertyTable
{
public List<PropertyName> properties = new();
public List<Object> references = new();
public T Get<T>(ExposedReference<T> reference) where T : Object
{
@amatiasq
amatiasq / odin.cs
Last active January 12, 2023 15:11
class Example : MonoBehaviour {
// Assets only
[AssetsOnly]
public GameObject SomePrefab;
[AssetsOnly]
public List<GameObject> OnlyPrefabs;
// SceneObjectsOnly
[SceneObjectsOnly]
public GameObject SomeSceneObject;
button.click(); // nothing
event = document.createEvent ('MouseEvents');
event.initEvent('click', true, true);
button.dispatchEvent(click) // nothing
// here I discover `event.isTrusted`
event = document.createEvent ('MouseEvents');
event.initEvent('click', true, true);
using System;
// Interface segregation
interface ISimulationReporter<TResult>
{
event Action<TResult> OnComplete;
}
interface ISimulationRunner<TInput>