Skip to content

Instantly share code, notes, and snippets.

View Uriel29's full-sized avatar

Uriel dos Santos Souza Uriel29

View GitHub Profile
@Uriel29
Uriel29 / promise_monad.md
Created June 19, 2022 20:00 — forked from VictorTaelin/promise_monad.md
async/await is just the do-notation of the Promise monad

async/await is just the do-notation of the Promise monad

CertSimple just wrote a blog post arguing ES2017's async/await was the best thing to happen with JavaScript. I wholeheartedly agree.

In short, one of the (few?) good things about JavaScript used to be how well it handled asynchronous requests. This was mostly thanks to its Scheme-inherited implementation of functions and closures. That, though, was also one of its worst faults, because it led to the "callback hell", an seemingly unavoidable pattern that made highly asynchronous JS code almost unreadable. Many solutions attempted to solve that, but most failed. Promises almost did it, but failed too. Finally, async/await is here and, combined with Promises, it solves the problem for good. On this post, I'll explain why that is the case and trace a link between promises, async/await, the do-notation and monads.

First, let's illustrate the 3 styles by implementing

@Uriel29
Uriel29 / equal_heights_grouped.js
Created September 15, 2016 00:40 — forked from uzielweb/equal_heights_grouped.js
This is a Script to autoresize DIVS grouped to each parente div to set the same heights
<script type="text/javascript">
jQuery(document).ready(function($){
/* Thanks to CSS Tricks for pointing out this bit of jQuery
http://css-tricks.com/equal-height-blocks-in-rows/
It's been modified into a function called at page load and then each time the page is resized. One large modification was to remove the set height before each new calculation. */
equalheight = function(container){
@Uriel29
Uriel29 / form_mainbody.php
Created March 10, 2016 18:12 — forked from jsfernando/form_mainbody.php
Formulário de Acompanhamento de Protocolo - j!3.4.8 + Seblod 3.7.2 override
/* arquivo mainbody.php */
/* templates/seb_one/positions/protocolo_acompanhamento/site/mainbody.php */
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery("#protoca_num").change(function(){
var idnum = jQuery(this).val();
jQuery.ajax({
@Uriel29
Uriel29 / JoomlaNginx.conf
Created January 20, 2016 16:09 — forked from tiagovtg/JoomlaNginx.conf
Configuration file Nginx for Joomla! Akeeba + Uriel29 Merge
server {
######################################################################
## The Master .htaccess - NginX adaptation
##
## Version 3.3
##
## This file is designed to be the template NginX server configuration file
## for your Joomla! sites. You should go through all of its sections and
## modify it to match your site. Most notably, all instances of example.com
## and example\.com should be replaced with your real domain name.