Skip to content

Instantly share code, notes, and snippets.

View guzmonne's full-sized avatar

Guzman Monne guzmonne

  • Uruguay
  • Montevideo, Uruguay
View GitHub Profile
@guzmonne
guzmonne / windowsjs_export.js
Created January 28, 2022 02:22
Export each animation frame to a `png` with `windowjs`
window.title = "Hello!";
window.visible = false;
const canvas = window.canvas;
const requestMonotonicAnimationFrame = (function () {
const fps = 60;
let start = 0;
const timestep = (function* () {
const step = 1000 / fps;
@guzmonne
guzmonne / windowsjs-exporter.js
Created January 14, 2022 02:51
WindowsJS PNG exporter
window.title = "Hello!";
window.visible = true;
const monotonicDelta = createMonotonicFPSGenerator(60);
function requestMonotonicAnimationFrame(callback) {
callback(monotonicDelta.next().value);
}
const canvas = window.canvas;
@guzmonne
guzmonne / gist.new.tsx
Created June 5, 2021 00:32
Created from Remix Form!
import React from "react"
import { redirect } from "remix"
import type { ActionFunction } from "remix"
export const action: ActionFunction = async ({ request }) => {
const token = "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"
const body = new URLSearchParams(await request.text())
const fileName = body.get("fileName") as string
const content = body.get("content")
@guzmonne
guzmonne / tips.sh
Last active November 13, 2020 23:09
Useful bash tips
# Fix locale error
# Put this into /etc/environment
LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8
# SSH agent
eval `ssh-agent -s`
# Add a key to the keychain
ssh-add ~/.ssh/id_rsa
function Welcome() {
return (
<div>
Welcome {keycloak.idTokenParsed.name}!
<button onClick={() => keycloak.accountManagement()}>
Account
</button>
<button onClick={() => keycloak.logout()}>
Logout
</button>
import React from 'react';
import Keycloak from './Keycloak.js';
import { keycloak } from '../modules/keycloak.js';
function Welcome() {
return (
<div>
Welcome {keycloak.idTokenParsed.name}!
<button onClick={() => keycloak.accountManagement()}>
Account
@guzmonne
guzmonne / App_v2.jsx
Created July 19, 2019 14:22
Keycloak SS0 - App_v2.jsx
import React from 'react';
import Keycloak from './Keycloak.js';
import { keycloak } from '../modules/keycloak.js';
function Welcome() {
return <div>Welcome {keycloak.idTokenParsed.name}!</div>
}
function App() {
return (
import React from 'react';
function App() {
return (
<Keycloak>
<div>Welcome!</div>
</Keycloak>
);
}
import React, {useState, useEffect} from 'react';
import keycloak from '../modules/keycloak.js';
function Keycloak({children}) {
// We'll use this variable to halt the app
// excecution until the user is Authenticated
const [isAuthenticated, setIsAuthenticated] = useState(false);
// The `init()` method we'll be in charge of starting
// the authentication flow.
useEffect(() => {
import React from 'react';
import ReactDOM from 'react-dom';
import App from './components/App.js';
import { init } from './modules/keycloak.js';
// Initialize the Keycloak client
init();
// Render the React application
ReactDOM.render(<App />, document.getElementById('root'));