Skip to content

Instantly share code, notes, and snippets.

View JulianSoto's full-sized avatar
💡
Full Stack Overflow Developer

Julian Soto JulianSoto

💡
Full Stack Overflow Developer
  • México
View GitHub Profile
import React, { useState, useCallback } from 'react';
function Search() {
const [query, setQuery] = useState('');
const [results, setResults] = useState([]);
const queryChangeHandler = useCallback(e => {
setQuery(e.target.value); // set query string on input change
}, []);
const func = async (arr) => {
let arrCopy = [];
arr.forEach(item => {
const newItem = someAsyncFunc(item);
arrCopy.push(newItem);
});
return arrCopy;
}
[1, 2, 3].forEach(item => {
console.log(item);
});
@JulianSoto
JulianSoto / ssl-redirect.html
Created September 15, 2018 01:40 — forked from konklone/ssl-redirect.html
Force a quick redirect to HTTPS on Github Pages for your domain (and only your domain)
<script>
var host = "YOURDOMAIN.github.io";
if ((host == window.location.host) && (window.location.protocol != "https:"))
window.location.protocol = "https";
</script>
@JulianSoto
JulianSoto / clone_object_with_circular_references.js
Created September 3, 2018 03:20 — forked from NV/clone_object_with_circular_references.js
Clone an Object with all its circular references. Take that jQuery.extend!
function cloneObject(object) {
return extendObject({}, object);
}
function extendObject(base, object) {
var visited = [object];
// http://en.wikipedia.org/wiki/Adjacency_list_model
var set = [{value: base}];
@JulianSoto
JulianSoto / LICENSE
Created May 9, 2018 23:04 — forked from rjoleary/LICENSE
Predictive Parser
Copyright 2018 Ryan O'Leary
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 furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all