Skip to content

Instantly share code, notes, and snippets.

View VladimirCores's full-sized avatar
💭
evolve

Vladimir Cores VladimirCores

💭
evolve
View GitHub Profile
@VladimirCores
VladimirCores / gist:15eb68b7f6b741cd5ead9f47517dbf73
Created November 21, 2020 09:29
String value type and String object type
let st1 = new String('NAME')
let st2 = st1
let st3 = 'NAME'
console.log('st1 === st2 ->', st1 === st2)
console.log('st1 == st2 ->', st1 == st2)
console.log('st1 === st3 ->', st1 === st3)
console.log('st1 == st3 ->', st1 == st3)
console.log('st2 === st3 ->', st2 === st3)
console.log('st2 == st3 ->', st2 == st3)
console.log('======================')
Add to ~/.bash_profile:
function killOnTCPPort () {
kill -QUIT $(sudo lsof -sTCP:LISTEN -i tcp:$1 -t)
}
Then source ~/.bash_profile and run
const BRACKETS = ['{', '}', '(', ')', '[', ']']
let isValidByCount = (str) => {
let bracketPosition = 0
let bracketsAmountPerType = new Array(BRACKETS.length).fill(0)
for (let char of str) {
bracketPosition = BRACKETS.indexOf(char)
if (bracketPosition > -1) bracketsAmountPerType[bracketPosition] += 1
}
for (let i = 0; i < BRACKETS.length; i+=2)
if (bracketsAmountPerType[i] !== bracketsAmountPerType[i+1])
/*
* serial executes Promises sequentially.
* @param {funcs} An array of funcs that return promises.
* @example
* const urls = ['/url1', '/url2', '/url3']
* serial(urls.map(url => () => $.ajax(url)))
* .then(console.log.bind(console))
*/
export const sequence = funcs => funcs.reduce((acc, b) => acc.then((f => x => f().then((list => Array.prototype.concat.bind(list))(x)))(b)), Promise.resolve([]))
@VladimirCores
VladimirCores / gist:8e3ea60ae8c37c008181b4265d6ae991
Created September 29, 2019 13:09
Remove breaks from text and copy to clipboard
function copyToClipboard(text) {
var dummy = document.createElement("textarea");
// to avoid breaking orgain page when copying more words
// cant copy when adding below this code
// dummy.style.display = 'none'
document.body.appendChild(dummy);
//Be careful if you use texarea. setAttribute('value', value), which works with "input" does not work with "textarea". – Eduard
dummy.value = text;
dummy.select();
document.execCommand("copy");
0. Downalod atlassian-jira-core-X.X.X-x64.bin
1. gcloud config set compute/zone europe-west4-a
2. sudo chmod a+x atlassian-jira-core-X.X.X-x64.bin
3. sudo ./atlassian-jira-core-X.X.X-x64.bin
@VladimirCores
VladimirCores / meta-tags.md
Created August 10, 2018 18:57 — forked from lancejpollard/meta-tags.md
Complete List of HTML Meta Tags

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta name="keywords" content="your, tags"/>
<meta name="description" content="150 words"/>
<meta name="subject" content="your website's subject">
<meta name="copyright"content="company name">
<meta name="language" content="ES">
@VladimirCores
VladimirCores / gist:5df9026ccd882799ab43523d63b6d9b3
Created August 9, 2018 16:33
Convert image to base64 on mac with OpenSSL
openssl base64 -A -in <image_path> | pbcopy
@VladimirCores
VladimirCores / gist:5a35fe7804f131cbdf75b47c1c50039e
Created August 8, 2018 08:23
Change all files permission from current folder to not executable in git
find . -type f -exec git update-index --chmod=-x {} \;
git status
git commit -m "Changing file permissions to remove execute bit"
git push
gcloud config list project
gcloud compute target-vpn-gateways \
create vpn-1 \
--network vpn-network-1 \
--region us-east1
gcloud compute target-vpn-gateways \
create vpn-2 \
--network vpn-network-2 \