Skip to content

Instantly share code, notes, and snippets.

View patarkf's full-sized avatar

Patrick Ferreira patarkf

View GitHub Profile
@patarkf
patarkf / git_to_deploy
Last active August 29, 2015 14:15
GIT to deploy website
Hey, folks. Below, the steps that I followed (after a little search on the web) to deploy my application
(website) using GIT, on the cleanest and easiest way. The advantage of this method is that any small
change pushed to remote repo will be published in your live website.
Step 1: Create the local GIT repository
$ cd /var/www/project/
$ git init
$ git add *
/* A little snippet to see how to integrate another ajax request data with Google Chart API using JQuery */
var = DOM {
/**
* Function that initialize all
* @return {[void]}
*/
onReady: function() {
async function myAsyncFunction() {
const result = await somethingThatReturnsAPromise();
console.log(result);
}
async function myAsyncFunction() {
try {
const result = await somethingThatReturnsAPromise();
console.log(result);
} catch (error) {
console.log(error);
}
}
function makeRequest() {
return fetch('foo')
.then(response => {
if (data.doesItNeedAnotherRequest) {
return makeAnotherRequest(response)
.then(secondResponse => {
console.log(secondResponse);
return secondResponse;
});
async function makeRequest() {
const response = await fetch('foo');
if (response.doestItNeedAnotherRequest) {
const secondResponse = await makeAnotherRequest(response);
console.log(secondResponse);
return secondResponse;
}
console.log(response);
let promise = Promise.resolve();
const posts = [{}, {}, {}];
posts.forEach(post => {
promise = promise.then(() => {
return db.insert(post);
});
});
promise.then(() => {
posts.forEach(post => {
promise = promise.then(db.insert(post));
});
const posts = [{}, {}, {}];
async function insertPosts(posts) {
for (let post of posts) {
await db.insert(post);
}
}
const posts = [{}, {}, {}];
async function insertPosts(posts) {
posts.forEach(post => {
await db.insert(post);
});
}