Skip to content

Instantly share code, notes, and snippets.

View NaturalDevCR's full-sized avatar
💭
I may be slow to respond.

Josue NaturalDevCR

💭
I may be slow to respond.
View GitHub Profile
@JamieMason
JamieMason / group-objects-by-property.md
Created September 14, 2018 07:38
Group Array of JavaScript Objects by Key or Property Value

Group Array of JavaScript Objects by Key or Property Value

Implementation

const groupBy = key => array =>
  array.reduce((objectsByKeyValue, obj) => {
    const value = obj[key];
    objectsByKeyValue[value] = (objectsByKeyValue[value] || []).concat(obj);
    return objectsByKeyValue;
@mizterp
mizterp / mysql_iso_country.sql
Last active April 3, 2020 18:09
MySQL Country table (data source: iso.org)
CREATE TABLE IF NOT EXISTS `country` (
`iso2` char(2) NOT NULL,
`name` varchar(45) NOT NULL,
`iso3` char(3) NOT NULL,
`numeric` smallint(3) UNSIGNED NOT NULL,
PRIMARY KEY (`iso2`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `country` (`iso2`, `name`, `iso3`, `numeric`) VALUES
('AF', 'Afghanistan', 'AFG', 4),
@yajra
yajra / axios-401-response-interceptor.js
Last active September 20, 2023 06:24
Axios 401 response interceptor.
// Add a 401 response interceptor
window.axios.interceptors.response.use(function (response) {
return response;
}, function (error) {
if (401 === error.response.status) {
swal({
title: "Session Expired",
text: "Your session has expired. Would you like to be redirected to the login page?",
type: "warning",
showCancelButton: true,
@mistergraphx
mistergraphx / responsive_columns.html
Last active September 26, 2021 21:03
Responsive Columns with columnizer
<article class="list-thema js-fixie">
<h2></h2>
<ul class="js-columnize">
<li><a href=""><i class="icon-chevron-right"></i></a></li>
<li><a href=""></a></li>
<li><a href=""></a></li>
<li><a href=""></a></li>
<li><a href=""></a></li>
<li><a href=""></a></li>
<li><a href=""></a></li>