const groupBy = key => array =>
array.reduce((objectsByKeyValue, obj) => {
const value = obj[key];
objectsByKeyValue[value] = (objectsByKeyValue[value] || []).concat(obj);
return objectsByKeyValue;Debug Modern JavaScript with VSCode. Part of VSCode Course.
npm init -y
This file contains hidden or 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
| <template> | |
| <div> | |
| <a href="#" @click.prevent="show" class="w-full"> | |
| <img class="w-64" :src="thumbnail"> | |
| </a> | |
| <div class="lightbox fixed pin z-50 flex justify-center items-center" v-if="visible" @click="hide"> | |
| <div class="fixed pin-r pin-t text-white cursor-pointer text-4xl p-1 mr-2" @click.stop="hide">×</div> | |
| <div class="flex"> | |
| <div class="cursor-pointer self-center px-8" | |
| @click.stop="prev" |
This file contains hidden or 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 bash | |
| set -e | |
| if [ ! -d src/amazon-s3-and-cloudfront ]; then | |
| echo 'This script must be run from the repository root.' | |
| exit 1 | |
| fi | |
| for PROG in composer find sed |
This file contains hidden or 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
| <svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48"> | |
| <title>Switcher</title> | |
| <g class="nc-interact_switcher-c-48"> | |
| <rect x="2" y="11" width="44" height="26" rx="13" ry="13" fill="#d1d1d1"/> | |
| <rect class="nc-switcher-background" x="2" y="11" width="44" height="26" rx="13" ry="13" fill="#72C472" opacity="0"/> | |
| <circle cx="15" cy="24" r="11" fill="#fff"/> | |
| </g> | |
| <script> | |
| (function() { |
This file contains hidden or 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
| <?php | |
| namespace App; | |
| /** | |
| * Advanced Custom Fields drop-in functionality for Sage 9 | |
| * Version: 1.0 | |
| * Author: Michael W. Delaney | |
| */ | |
This file contains hidden or 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
| <?php | |
| namespace App\Http\Controllers; | |
| use Route; | |
| use Illuminate\Http\Request; | |
| class GitHubController extends Controller | |
| { |
This file contains hidden or 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
| <?php | |
| // tells the CDN that the content 'Vary' depending on 'Origin' request header | |
| header('Vary: Origin', true); | |
| // allowed origins | |
| $allowed_http_origins = array( | |
| 'http://example.com', | |
| 'http://www.example.com', | |
| 'http://127.0.0.1', |
This file contains hidden or 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
| /** | |
| * Calculate the center/average of multiple GeoLocation coordinates | |
| * Expects an array of objects with .latitude and .longitude properties | |
| * | |
| * @url http://stackoverflow.com/a/14231286/538646 | |
| */ | |
| function averageGeolocation(coords) { | |
| if (coords.length === 1) { | |
| return coords[0]; | |
| } |