Reference: BCP Business Center
- Clearly identify message as an Ad.
- Give physical location of business.
<?php | |
// Normal php conditional | |
if (true) { | |
echo 'This normal one is true!'; | |
} else { | |
echo 'Its false'; | |
} | |
// Alternative syntax | |
if (true): |
// Fake network calls again, same as before. | |
// We don't have to do much besides make it obvious this is async | |
// async/await enhances Promises, it doesn't replace them! | |
function fakeNetworkCall(url) { | |
const promise = new Promise((resolve, reject) => { | |
setTimeout(() => resolve(url), 1500); | |
}); | |
return promise; | |
} |
// Fancy new function syntax | |
fakeNetworkCall('/api/endpoint/1/') | |
.then(result => fakeNetworkCall('/api/endpoint/2/')) | |
.then(result => fakeNetworkCall('/api/endpoint/3/')) | |
// Maybe we finally call a render method on our last request? | |
.then(result => renderToPage(result)) | |
// Make sure any errors are caught. | |
.catch(error => handleError(error)) |
// Simulate a network request by using setTimeout | |
// This achieves the same thing as our version above. | |
// This time though, we are going to return a Promise! | |
function fakeNetworkCall(url) { | |
const promise = new Promise((resolve, reject) => { | |
setTimeout(() => resolve(url), 1500); | |
}); | |
return promise; | |
} |
// Simulate a network request by using setTimeout | |
function fakeNetworkCall(url, callback) { | |
let returnData = { name: url }; | |
setTimeout(() => callback(returnData), 1500); | |
}; | |
// Make the first call | |
fakeNetworkCall('/api/endpoint/1/', (response1) => { | |
// When the call is done, the callback function | |
// is called, so we can work with the data here. |
#!/bin/bash | |
# Simple script to run the createuser and createdb | |
# commands after a local/server install of PostgreSQL | |
# Exit as soon as any line in the bash script fails | |
# & prints each command executed (prefix with ++) | |
set -e | |
# Make sure we have a name parameter |
Reference: BCP Business Center