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 lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>vuex-playlist</title> | |
</head> | |
<body> | |
<div id="app"></div> | |
<script src="/dist/build.js"></script> | |
</body> |
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
<script> | |
// Register the service worker | |
if ('serviceWorker' in navigator) { | |
navigator.serviceWorker.register('/service-worker.js').then(function(registration) { | |
// Registration was successful | |
console.log('ServiceWorker registration successful with scope: ', registration.scope); | |
}).catch(function(err) { | |
// registration failed :( | |
console.log('ServiceWorker registration failed: ', err); | |
}); |
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
const express = require('express'); | |
const app = express(); | |
const server = app.listen(3001, function() { | |
console.log('server running on port 3001'); |
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
// This is the function we will use to call Promise.race(). | |
// logWinner is simply a function that races two promises | |
// and logs the "winner" of the race as a side effect. | |
function logWinner (p1, p2) { | |
Promise.race([p1, p2]).then(console.log.bind(console)); | |
} | |
// Here are 2 promises, p1 and p2. p2 always resolves | |
// first, since p1 resolves in 20 ms, and p2 resolves | |
// in 10 ms. By any reasonable definition of "race", |
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
import React, { useState, useMemo } from "react"; | |
export default function SimpleStateHooks() { | |
const [count, setCount] = useState(1000); | |
function returnValue(inputValue) { | |
return inputValue + 10; | |
} | |
var calculatedValue = useMemo(() => returnValue(10), [10]); |
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
{ | |
"coreVersion": "1", | |
"enhancementNumber": 1, | |
"date": "2019-11-27T16:33:20.906Z", | |
"version": "1.1.191128" | |
} |
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
#!/bin/bash | |
function code-up() { | |
wget https://vscode-update.azurewebsites.net/latest/linux-deb-x64/stable -O /tmp/code_latest_amd64.deb | |
sudo dpkg -i /tmp/code_latest_amd64.deb | |
} | |
export -f code-up | |
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
const JSXELEMENT_CHILDREN = [ | |
'JSXText', | |
'JSXExpressionContainer', | |
'JSXSpreadChild', | |
'JSXElement', | |
'JSXFragment' | |
] | |
const isJSXElementChildrenType = x => x && JSXELEMENT_CHILDREN.includes(x.type) | |
module.exports = { |
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
import { useReducer, useState, useEffect } from "react"; | |
const reduceCartFromOrders = (current, [id, quantity]) => { | |
if (current === null) current = {}; | |
if (quantity === null) { | |
delete current[id]; | |
return current; | |
} |
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
package main | |
import ( | |
"fmt" | |
) | |
func BinarySearch(target_map []int, value int) int { | |
start_index := 0 | |
end_index := len(target_map) - 1 |
OlderNewer