Skip to content

Instantly share code, notes, and snippets.

View ivillamil's full-sized avatar

Iván Villamil ivillamil

View GitHub Profile
@ivillamil
ivillamil / useEffectAfterMount.js
Created September 20, 2021 13:44
Effect hook that executes only after all components have been rendered
import {useEffect, useRef} from 'react'
const useEffectAfterMount = ( effect, deps ) => {
const isMounted = useRef(false)
useEffect(() => {
if (isMounted.current) {
return effect()
} else {
isMounted.current = true
}
}, [deps])
@ivillamil
ivillamil / users-db.json
Last active December 30, 2017 18:07
Generic list of users in JSON format, with the most common properties for demo purposes.
[
{
"id": 0,
"address": "1135 Lowe Expressway",
"avatar": "https://s3.amazonaws.com/uifaces/faces/twitter/herbigt/128.jpg",
"cover": "http://lorempixel.com/500/200/abstract",
"color": "#1e1409",
"description": "Use the virtual HTTP protocol, then you can copy the virtual protocol!",
"email": "[email protected]",
"name": "Antwon Schoen",
.loader {
animation: rotate 1s infinite;
height: 50px;
width: 50px;
}
.loader:before,
.loader:after {
border-radius: 50%;
content: '';
{
"users": [
{
"id": 0,
"address": "1135 Lowe Expressway",
"avatar": "https://s3.amazonaws.com/uifaces/faces/twitter/herbigt/128.jpg",
"cover": "http://lorempixel.com/500/200/abstract",
"color": "#1e1409",
"description": "Use the virtual HTTP protocol, then you can copy the virtual protocol!",
"email": "[email protected]",
[
{
"name": "Reticulated Giraffe",
"species": "Giraffa camelopardalis reticulata",
"description": "The reticulated giraffe (Giraffa camelopardalis reticulata), also known as the Somali giraffe, is a subspecies of giraffe native to Somalia, southern Ethiopia, and northern Kenya. Reticulated giraffes can interbreed with other giraffe subspecies in captivity or if they come into contact with populations of other subspecies in the wild. \nThe reticulated giraffe is among the most well-known of the nine giraffe subspecies. Together with the Rothschild giraffe, it is by far the giraffe most commonly seen in zoos. Its coat consists of large, polygonal, liver-colored spots outlined by a network of bright-white lines. The blocks may sometimes appear deep red and may also cover the legs. The extraordinary height of giraffes is attributed to a ritual known as \"necking\", where two males fight for reproduction rights by slamming their necks into one another. The giraffes with the tallest and
@ivillamil
ivillamil / ngStorage.js
Last active January 21, 2016 11:50
localStorage service wrapper for angularJS
(function () {
'use strict';
angular.module('app')
.factory('Storage', [function () {
var fn = {};
fn.has = function (key) {
var value = window.localStorage.getItem(key);
return !!value;
}
<?php
// Put your device token here (without spaces):
$deviceToken = '6fec50b864578203fb9211c98fb39e9bfa808b9c0ac7183a5405deca9a462aed';
// Put your private key's passphrase here:
$passphrase = 'elpassworddelcertificado';
// Put your alert message here:
$message = 'Alguien busca tus productos!';
@ivillamil
ivillamil / dabblet.html
Last active August 29, 2015 14:00
Rancherita Shared Articles Mail Template
<style>
html, body {
background-image: url(http://rancherita.com.mx/images/bg-tecno-red.jpg);
background-repeat: no-repeat;
background-position: center top;
background-size: cover;
margin: 0;
padding:0;
height: 100%;
}
@ivillamil
ivillamil / MapHandler Sample
Last active August 29, 2015 13:57
Snippet of code using the google maps api.
var app = app || {};
;(function($){
app.MapHandlerView = {
cache: function() {
this.$wrapper = $('#location-area');
this.$inputCountry = this.$wrapper.find('input[name="pais"]');
this.$inputstate = this.$wrapper.find('input[name="estado"]');
this.$inputCity = this.$wrapper.find('input[name="ciudad"]');