Skip to content

Instantly share code, notes, and snippets.

View eliasfeijo's full-sized avatar

Elias Feijó eliasfeijo

View GitHub Profile
@eliasfeijo
eliasfeijo / meta.html
Created August 20, 2022 22:17
HTML responsive viewport meta (that behaves like a native app)
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui"
/>
@eliasfeijo
eliasfeijo / SymbolKeysToStringTask.js
Last active June 24, 2022 07:59
Javascript function to replace an object's symbol keys with equivalent string keys
// Typescript version: https://gist.github.com/eliasfeijo/672c83ff971653b551e168b156bb3baf
// Symbol used to make "_perform" method pseudo-private
const _perform = Symbol('_perform');
class SymbolKeysToStringTask {
constructor() {
this.symbolCounter = 0;
}
@eliasfeijo
eliasfeijo / SymbolKeysToStringTask.ts
Last active June 24, 2022 07:54
Typescript function to replace an object's symbol keys with equivalent string keys
// Javascript version: https://gist.github.com/eliasfeijo/0b1286a88faef97e752dcb72f925cbee
type TDefaultRecord = Record<string | number | symbol, unknown>;
type TDefaultRecordOrArray = TDefaultRecord | Array<unknown>;
type TRecordWithStringKeys = Record<string, unknown>;
type TaskPerformResponse = TRecordWithStringKeys | Array<unknown> | unknown;
type TaskRunResponse = TRecordWithStringKeys;
class SymbolKeysToStringTask {
private symbolCounter = 0;
Backtrace:
0: ((:METHOD INITIALIZE-INSTANCE :AFTER (CL-STEAMWORKS:STEAMCLIENT)) #<CL-STEAMWORKS:STEAMCLIENT @NIL> :VERSION T) [fast-method]
1: ((LAMBDA (SB-PCL::|.P0.| SB-PCL::|.P1.|)) #<unavailable argument> #<unavailable argument>)
2: ((FLET CL-STEAMWORKS::MAYBE-CREATE :IN CL-STEAMWORKS:CREATE-INTERFACES) CL-STEAMWORKS:STEAMCLIENT)
3: ((:METHOD CL-STEAMWORKS:CREATE-INTERFACES (ORG.SHIRAKUMO.FRAF.STEAMWORKS.CFFI::STEAMWORKS T)) #<CL-STEAMWORKS:STEAMWORKS-CLIENT {1007AEA163}> (CL-STEAMWORKS:STEAMCLIENT CL-STEAMWORKS:STEAMUTILS CL-STE..
4: ((:METHOD INITIALIZE-INSTANCE :AFTER (ORG.SHIRAKUMO.FRAF.STEAMWORKS.CFFI::STEAMWORKS)) #<CL-STEAMWORKS:STEAMWORKS-CLIENT {1007AEA163}> :INTERFACES NIL) [fast-method]
5: ((SB-PCL::EMF INITIALIZE-INSTANCE) #<unused argument> #<unused argument> #<CL-STEAMWORKS:STEAMWORKS-CLIENT {1007AEA163}> :APP-ID 480)
6: (SB-PCL::FAST-MAKE-INSTANCE #<unavailable argument> #<more unavailable arguments>) [more]
7: (SB-INT:SIMPLE-EVAL-IN-LEXENV (START-CLIENT) #<NULL-LEXENV>)
8
@eliasfeijo
eliasfeijo / error.lisp
Created May 21, 2019 05:08
Error deserted
~/quicklisp/local-projects/deserted/src $ ./build/deserted/deserted
key position: <ERROR> [02:05:33] bodge-util utils.lisp (invoke-bodgy h0) -
Unhandled condition:
Resource with id NIL not found
[Condition of type SIMPLE-ERROR]
#<ENVIRONMENT {10072F2823}>
[Environment of thread #<THREAD "single-threaded-executor" RUNNING {1006E36EA3}>]
@eliasfeijo
eliasfeijo / ui.lisp
Created May 17, 2019 11:56
scroll-area test
(button :label "Top-Level Button"
:on-click (lambda (window)
(let* ((container (find-element "container" window))
(text (format nil "text~d" *counter*))
(label (make-instance 'label :text text))
(scroll-position (area-scroll-position container)))
(format t "~%scroll-position: ~a" scroll-position)
(bodge-util:adopt container label)
(setf *counter* (incf *counter*)))))
(scroll-area :name "container"
@eliasfeijo
eliasfeijo / RunSingleScript.groovy
Created May 29, 2018 04:29
Grails 2.x run-script with arguments
/*
* Copyright 2005-2018 the original author or authors.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,