This document is an attempt to pin down all the things you don't think about when quoting for a project, and hopefully provide a starting point for some kind of framework to make quoting, working and delivering small-medium jobs more predictable and less stressful.
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
function getAll(request) { | |
return request.then(function (response) { | |
if (!response._paging || !response._paging.next) { | |
return response; | |
} | |
// progress is next / total pages * 10 | |
let _next = response._paging.next._options.endpoint.split("=")[1]; | |
let _total = response._paging.totalPages; | |
let _progress = (_next / _total) * 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
function saySomething(thingToSay){ | |
const {isHelpful, isPositive, statement} = thingToSay | |
if(!isHelpful || !isPositive ) return `...🤐` | |
return `${statement} 👍` | |
} | |
const positiveStatement = { | |
statement: "You did a great job so far. I'm happy to help you finish.", | |
isHelpful: true, | |
isPositive: true |
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 products = [ | |
{ name: 'apples', category: 'fruits', count: 1 }, | |
{ name: 'oranges', category: 'fruits', count: 2 }, | |
{ name: 'potatoes', category: 'vegetables', count: 1 }, | |
{ name: 'kettle chips', category: 'snacks', count: 3 }, | |
]; | |
const groupByCategory = products.reduce((group, product) => { | |
const { category } = product; | |
group[category] = group[category] ?? []; | |
group[category].push(product); |
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
html { | |
max-width: 38rem; | |
padding: 2rem; | |
margin: auto; | |
line-height: 1.5rem; | |
font-size: 24px; | |
} |
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
// String utils | |
// | |
// resources: | |
// -- mout, https://github.com/mout/mout/tree/master/src/string | |
/** | |
* "Safer" String.toLowerCase() | |
*/ | |
function lowerCase(str) { | |
return str.toLowerCase(); |
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
// Handle form submission | |
document.querySelector("form").addEventListener("submit", e => { | |
// Cancel default behavior of sending a synchronous POST request | |
e.preventDefault(); | |
// Create a FormData object, passing the form as a parameter | |
const formData = new FormData(e.target); | |
// Send form data to the server with an asynchronous POST request | |
fetch("https://thejsway-server.herokuapp.com/animals", { | |
method: "POST", | |
body: formData |
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
window.indefiniteArticle = function(phrase) { | |
// Getting the first word | |
var match = /\w+/.exec(phrase) | |
if (match) var word = match[0] | |
else return "an" | |
var l_word = word.toLowerCase() | |
// Specific start of words that should be preceeded by 'an' | |
var alt_cases = ["honest", "hour", "hono"] |
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
console.log(`%c | |
_ _ _ _ _ _ | |
| | (_) | | (_) | | | | |
_____ ___ __ ___ _ __| |_ _ _ __ ___| |_ _| |_ _ _| |_ ___ | |
/ _ \\ \\/ / '_ \\ / _ \\ '__| __| | | '_ \\/ __| __| | __| | | | __/ _ \\ | |
| __/> <| |_) | __/ | | |_ | | | | \\__ \\ |_| | |_| |_| | || __/ | |
\\___/_/\\_\\ .__/ \\___|_| \\__| |_|_| |_|___/\\__|_|\\__|\\__,_|\\__\\___| | |
| | | |
|_| | |
NewerOlder