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
class PromiseQueue { | |
constructor (limit = 20, cb = () => {}) { | |
/** @type {{promiseFn: () => Promise, cb: void}[]} */ | |
this.queue = [] | |
this.running = 0 | |
this.limit = limit | |
this.cb = cb | |
} |
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
let counter = 0; | |
const postIds = postsToDelete.map(val => val.getIdFromVal) | |
allPosts.forEach((val, index) => { | |
if (postsIds.contains(val.keyToCurrentPostId)){ | |
allPosts.splice(index - counter, 1); | |
counter++; | |
} | |
}) |
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
switchToChannel({state, commit, dispatch}, channelID) { | |
const exists = this.selectByKey(state.channels, {key: '_id', value: channelID}) | |
if (exists) { | |
Object.keys(channels).forEach(key => { | |
const id = channels[key]._id | |
if (id === channelID) { | |
commit('channel', channels[i]) | |
} | |
}) | |
} else { |
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
{ | |
"env": { | |
"browser": true, | |
"commonjs": true, | |
"es6": true, | |
"node": true | |
}, | |
"parserOptions": { | |
"ecmaFeatures": { | |
"jsx": 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
install vscode extentions: | |
eslint | |
prettier - code formatter | |
type this in console to install npm dependensies: | |
npm install eslint | |
npm install -g install-peerdeps | |
install-peerdeps --dev eslint-config-airbnb | |
F1 in vscode then type "eslint" and choose "create .eslintrc.json file" |
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
in /form route | |
const pussy = `?client_id=${your client id here}&client_secret=${your client secret here}` | |
const foursquare = put foursquare link here. Be sure it ends in / or letter | |
// foursquare + pussy should be equal smth like http://link/?client_id... | |
request(foursquare + pussy, function ... |
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 body = { | |
message: 'hi' | |
} | |
const data = new FormData(); | |
data.append( "json", JSON.stringify( body ) ); | |
fetch("/echo/json/", { | |
method: "POST", | |
body: data |
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 auth = require(`./auth.js`) | |
const port = 3000 | |
const request = require('request') | |
// require your modules | |
const express = require('express') | |
const bodyParser = require('body-parser') | |
// create instance of express |
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
https://download.anydesk.com/linux/fedora24/anydesk-2.9.5-1.fc24.x86_64.rpm?_ga=2.163409471.2066833590.1515334281-1634431790.1515334281 |
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
// [GET USER FROM SERVER] | |
export const getAccessToken = ({ commit, dispatch }, { req }) => { | |
if (!req || !req.headers.cookie) return Promise.reject('no-cookie') | |
// [get new tokens] | |
return axios | |
.post(`https://securetoken.googleapis.com/v1/token?key=${projectID}`, { | |
grant_type: 'refresh_token', | |
refresh_token: Cookie.parse(req.headers.cookie).refresh | |
}) | |
.then(res => { |
NewerOlder