Skip to content

Instantly share code, notes, and snippets.

View emrivero's full-sized avatar
💻
Road to computer engineering

Emilio Martínez Rivero emrivero

💻
Road to computer engineering
  • G+D
  • Seville, Spain
View GitHub Profile
@ulises-jeremias
ulises-jeremias / auth-hook.js
Last active June 10, 2024 15:40
Examples of hooks utils using axios, recoil.js, keycloak-js, @react-keycloak/web and more.
import { useCallback, useEffect, useState } from 'react';
import { useSetRecoilState } from 'recoil';
import { useKeycloak } from '@react-keycloak/web';
import { commonNotification } from './common';
/**
* Returns the auth info and some auth strategies.
*
*/
#!/usr/bin/env node
'use strict';
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var fs = _interopDefault(require('fs'));
var arg = _interopDefault(require('arg'));
var chalk = _interopDefault(require('chalk'));
var spawn = _interopDefault(require('cross-spawn'));
var delay = _interopDefault(require('delay'));
@sebmarkbage
sebmarkbage / WhyReact.md
Created September 4, 2019 20:33
Why is React doing this?

I heard some points of criticism to how React deals with reactivity and it's focus on "purity". It's interesting because there are really two approaches evolving. There's a mutable + change tracking approach and there's an immutability + referential equality testing approach. It's difficult to mix and match them when you build new features on top. So that's why React has been pushing a bit harder on immutability lately to be able to build on top of it. Both have various tradeoffs but others are doing good research in other areas, so we've decided to focus on this direction and see where it leads us.

I did want to address a few points that I didn't see get enough consideration around the tradeoffs. So here's a small brain dump.

"Compiled output results in smaller apps" - E.g. Svelte apps start smaller but the compiler output is 3-4x larger per component than the equivalent VDOM approach. This is mostly due to the code that is usually shared in the VDOM "VM" needs to be inlined into each component. The tr

@enepomnyaschih
enepomnyaschih / base64.js
Last active November 10, 2024 11:35
https://www.npmjs.com/package/byte-base64 - Encode JS Uint8Array, simple array of bytes or native JS string to base64 and back
/*
MIT License
Copyright (c) 2020 Egor Nepomnyaschih
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@jgleal
jgleal / fiddleToMapea5
Last active September 13, 2018 07:40
Macro de iMacros (https://imacros.net/) para cambiar los recursos de un fiddle a Mapea 5
VERSION BUILD=1003 RECORDER=CR
TAG POS=1 TYPE=A ATTR=TXT:remove
TAG POS=1 TYPE=A ATTR=TXT:remove
TAG POS=1 TYPE=A ATTR=TXT:remove
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:show-result ATTR=ID:external_resource CONTENT=https://sigc.desarrollo.guadaltel.es/mapea5/js/mapea.ol.min.js
TAG POS=1 TYPE=A ATTR=TITLE:"Add resource"
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:show-result ATTR=ID:external_resource CONTENT=https://sigc.desarrollo.guadaltel.es/mapea5/assets/css/mapea.ol.min.css
TAG POS=1 TYPE=A ATTR=TITLE:"Add resource"
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:show-result ATTR=ID:external_resource CONTENT=https://sigc.desarrollo.guadaltel.es/mapea5/js/configuration.js
TAG POS=1 TYPE=A ATTR=TITLE:"Add resource"
@manmorjim
manmorjim / .zshrc
Last active April 12, 2018 18:22
ZSH configuration file
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=/home/manueljmorillo/.oh-my-zsh
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-zsh is loaded.
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
#ZSH_THEME="agnoster"
@manmorjim
manmorjim / init.coffee
Last active November 19, 2018 13:31
atom-settings-guadaltel
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->
fetch('https://api.github.com/repos/:user/:repo/issues?per_page=1000').then(res => res.json()).then(res => {
console.log('"title","labels","id","created","author"');
console.log(res.map(i => `"${i.title}","${i.labels.map(l => l.name).join(';')}","#${i.number}","${i.created_at}","${i.user.login}"`).join('\n'));
});
@hauthorn
hauthorn / postman.desktop
Last active November 18, 2024 11:36
Postman desktop entry
[Desktop Entry]
Categories=Development;
Comment=Supercharge your API workflow
Exec="/home/hauthorn/Programs/Postman/Postman"
Icon=/home/hauthorn/Programs/Postman/app/resources/app/assets/icon.png
Name=Postman
Terminal=false
Type=Application
Version=1.0
@Dither
Dither / moon_phase.js
Created September 17, 2016 10:07
JS function to calculate moon phase
function moon_phase(date) { // ported from http://www.voidware.com/moon_phase.htm
var year = date.getYear(),
month = date.getMonth(),
day = date.getDay();
if (month < 3) {
year--;
month += 12;
}