Skip to content

Instantly share code, notes, and snippets.

View aaronmaldonado-dev's full-sized avatar
🤓

Aarón Maldonado aaronmaldonado-dev

🤓
View GitHub Profile
const getCombinations = (n) => {
const arr = [];
const maxValue = Math.pow(2, n);
for (let i = 0; i < maxValue; i++) {
arr.push(i.toString(2).padStart(n, '0'));
}
return arr.filter(item => {
const arrItem = item.split('');
for (let i = 0; i < n - 1; i++) {
const sum = parseInt(arrItem[i]) + parseInt(arrItem[i + 1]);
@aaronmaldonado-dev
aaronmaldonado-dev / FetchComponent.js
Created March 10, 2020 18:19
React - basic fetch with debounce component
import React, { useState, useEffect } from 'react';
import Lodash from 'lodash';
const DATA_URL = 'https://jsonplaceholder.typicode.com/todos';
function FetchComponent() {
const [todoList, setTodoList] = useState([]);
const [isLoading, setIsLoading] = useState(false);
const fetchData = (id) => {
@aaronmaldonado-dev
aaronmaldonado-dev / TodoList.js
Created March 10, 2020 18:17
React - basic todo list component
import React, { useState } from 'react';
import Uniqid from 'uniqid';
function ListItems(props) {
return(
props.items.map(
(item, index) =>
<li key={index}>
<input type="checkbox" checked={item.done} onChange={() => {
props.onTaskDone(item.id);
@aaronmaldonado-dev
aaronmaldonado-dev / webgl-triangle.html
Last active March 10, 2020 18:21
Web GL - basic example using classes
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Sekam Dex, WebGL - Drawing a Triangle</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css">
<style>
@aaronmaldonado-dev
aaronmaldonado-dev / gist:5f8f33a6974af7e0ce6a80fc0d11e96b
Created February 11, 2020 20:09
Sekam Dex, WebGL tutorial - Step No. 3
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>WEBGL - 06</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css">
<style>
@aaronmaldonado-dev
aaronmaldonado-dev / gist:e482af6211e348ff7d5e85041fff0131
Created February 11, 2020 18:31
Sekam Dex, WebGL tutorial - Step No. 2
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>WEBGL - 06</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css">
<style>
@aaronmaldonado-dev
aaronmaldonado-dev / gist:845950e3b8e17918c10fdf81355b93b9
Last active February 11, 2020 18:18
Sekam Dex, WebGL tutorial - Step No. 1
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>WEBGL - 06</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css">
<style>