This file contains hidden or 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
// cmd/main.go | |
package main | |
import ( | |
"bufio" | |
"errors" | |
"os" | |
"path/filepath" | |
"runtime" | |
"strings" |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sf="urn:fault.partner.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
<soapenv:Body> | |
<soapenv:Fault> | |
<faultcode>sf:REQUEST_LIMIT_EXCEEDED</faultcode> | |
<faultstring>REQUEST_LIMIT_EXCEEDED: ConcurrentRequests (Concurrent API Requests) Limit exceeded.</faultstring> | |
<detail> | |
<sf:UnexpectedErrorFault xsi:type="sf:UnexpectedErrorFault"> | |
<sf:exceptionCode>REQUEST_LIMIT_EXCEEDED</sf:exceptionCode> | |
<sf:exceptionMessage>ConcurrentRequests (Concurrent API Requests) Limit exceeded.</sf:exceptionMessage> |
This file contains hidden or 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 nSecToTime(s) { | |
let seconds = s | |
s = Math.abs(s) | |
let t = [0, 0, 0] | |
let r = s % 3600 | |
t[0] = Math.floor(s / 3600) | |
t[1] = Math.floor(r / 60) | |
r = r % 60 |
This file contains hidden or 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 { performance } = require('perf_hooks') | |
const start = performance.now() | |
const buffer = new ArrayBuffer(393216) | |
let uInt32View = new Uint32Array(buffer) | |
const length = uInt32View.length | |
for (let i = 0; i < length; i++) { | |
uInt32View[i] = i |
This file contains hidden or 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
import crypto from 'crypto' | |
const HASH = crypto.createHash('md5').update('password', 'utf-8').digest('hex') | |
export const encrypt = decrypted => { | |
let iv = new Buffer.alloc(16) | |
let cipher = crypto.createCipheriv('aes-256-cbc', HASH, iv) | |
return cipher.update(decrypted, 'utf8', 'hex') + cipher.final('hex') | |
} |
This file contains hidden or 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
npx @vue/cli create |
This file contains hidden or 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
// It might be that you need components loaded dynamically. You can use the following function | |
const getComponentName = (identifier, method = 'post') => { | |
return `${identifier.replace(/([A-Z])/g, '-$1').toLowerCase().replace(/^-(.*)$/, '$1')}-${method}` | |
} | |
// Example: getComponentName('PriceTable', 'get') yields 'price-table-get' |
This file contains hidden or 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
import moment from 'moment' | |
import flow from 'lodash/flow' | |
import map from 'lodash/fp/map' | |
/** | |
* Returns days relative to first one, e. g.: 0, 2, 9, 10, 11 | |
* | |
* @params {array} dates | |
* @returns {array} | |
*/ |
This file contains hidden or 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
<template> | |
<div> | |
<p>I got {{ amount }} {{ 'cookie' | pluralize(amount) }}</p> | |
<button @click="decrement">Decrement</button> | |
</div> | |
</template> | |
<script> | |
export default { | |
data: () => ({ |
This file contains hidden or 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
/** | |
* This way, you can import the functional program function and use in two ways. You don't have to fear any name collisions. | |
*/ | |
let element = [{key: 1, value: a}, {key: 2, value: b}] | |
// Functional program usage | |
flow([ | |
map(element => omit(['key'])) | |
])(elements) |
NewerOlder