const groupBy = key => array =>
array.reduce((objectsByKeyValue, obj) => {
const value = obj[key];
objectsByKeyValue[value] = (objectsByKeyValue[value] || []).concat(obj);
return objectsByKeyValue;
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Date.prototype.addMins = function(mins) { | |
var dat = new Date(this.valueOf()); // make a new date coz we can't change the original | |
dat.setMinutes(dat.getMinutes() + mins*1); // force mins to be integer instead of string | |
return dat; | |
}; | |
Date.prototype.addDays = function(days) { | |
var dat = new Date(this.valueOf()); // make a new date coz we can't change the original | |
dat.setDate(dat.getDate() + days*1); // force days to be integer instead of string | |
return dat; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// yarn add gist:5ceba1081bbf0162b98860b34a511a92 | |
// npm install gist:5ceba1081bbf0162b98860b34a511a92 | |
export const DeepObject = { | |
set: setDeep, | |
get: getDeep | |
}; | |
// https://stackoverflow.com/a/6491621 | |
function getDeep(obj: Object, path: string) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
sudo rm -f /usr/bin/node | |
sudo rm -f /usr/bin/npm | |
sudo ln -s $(which node) /usr/bin/ | |
sudo ln -s $(which npm) /usr/bin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @license | |
* Copyright (c) 2019 Jonathan Catmull. | |
* | |
* 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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title></title> | |
<meta name="author" content=""> | |
<meta name="description" content=""> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> |
Inspired by http://dribbble.com/shots/655650-Login/attachments/56946
I have used HTML5 input attribute "require" to make filed mandatory.