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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>N-API | Node.js v4.6.0 Documentation</title> | |
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:400,700,400italic"> | |
<link rel="stylesheet" href="assets/style.css"> | |
<link rel="stylesheet" href="assets/sh.css"> | |
<link rel="canonical" href="https://nodejs.org/api/n-api.html"> | |
</head> |
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>N-API | Node.js v4.6.0 Documentation</title> | |
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:400,700,400italic"> | |
<link rel="stylesheet" href="assets/style.css"> | |
<link rel="stylesheet" href="assets/sh.css"> | |
<link rel="canonical" href="https://nodejs.org/api/n-api.html"> | |
</head> |
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 _3d = {}; | |
_3d.vector = (x = 0, y = 0, z = 0) => [x, y, z]; | |
_3d.matrix = (v0, v1, v2) => _3d.vector(v0, v1, v2); | |
_3d.identity = _3d.matrix([1, 0, 0], [0, 1, 0], [0, 0, 1]); | |
_3d.scale = (v, s) => _3d.vector(v[0] * s, v[1] * s, v[2] * s); | |
_3d.sum = (v0, v1, v2) => _3d.vector(v0[0] + v1[0] + v2[0], v0[1] + v1[1] + v2[1], v0[2] + v1[2] + v2[2]); | |
_3d.transform = (v, m) => _3d.sum(_3d.scale(m[0], v[0]), _3d.scale(m[1], v[1]), _3d.scale(m[2], v[2])); | |
_3d.multiply = (m0, m1) => _3d.matrix(_3d.transform(m1[0], m0), _3d.transform(m1[1], m0), _3d.transform(m1[2], m0)); |
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
'use strict' | |
const blocks = { | |
symbols: '[\u2000-\u2bff]', | |
cjk: '[\u2e80-\u9fff]', | |
surrogates: '[\ud800-\udbff]', | |
selectors: '[\ufe00-\ufe0f]' | |
}; | |
const valid = new RegExp(`^${Object.keys(blocks).map(key => blocks[key]).join('|')}$`); |
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
'use strict' | |
const a = [{ id: 1 }, { id: 2 }, { id: 1 }, { id: 3 }]; // guaranteed to have a length less than 25 | |
function unique1(a) { | |
const r = []; | |
o: for (let o of a) { | |
for (let i of r) | |
if (o.id === i.id) |
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
var test_data = [ | |
{ id: 'a', order_by: 1 }, | |
{ id: 'b', order_by: 2 }, | |
{ id: 'c', order_by: 3 }, | |
{ id: 'd', order_by: 4 }, | |
{ id: 'e', order_by: 5 }, | |
{ id: 'f', order_by: 6 }, | |
{ id: 'g', order_by: 7 }, | |
{ id: 'h', order_by: 8 }, | |
{ id: 'i', order_by: 9 } |
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
require 'test_helper' | |
class IndependentMatcheesControllerTest < ActionController::TestCase | |
# Without this method I get... | |
# RuntimeError: @controller is nil: make sure you set it in your test's setup method. | |
# test/controllers/independent_matchees_controller_test.rb:15:in `block in <class:IndependentMatcheesControllerTest>' | |
# With it I get... | |
# NameError: uninitialized constant IndependentMatcheesControllerTest::IndependentMatcheesController | |
# test/controllers/independent_matchees_controller_test.rb:11:in `setup' | |
def setup |
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
test |
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
function linkGiftCards(giftCards, customerId, callback) { | |
function linkCard(card, id, callback2) { | |
// do some stuff | |
callback2(); | |
} | |
async.each(giftCards, function (card, callback2) { | |
linkCard(card, customerId, callback2); | |
}, function (err) { |
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
function decrypt(cipherText, key) { | |
var keyInt = key.codePointAt(0), | |
plainText = ''; | |
for (var char = 0; char < cipherText.length; char += 2) | |
plainText += String.fromCharCode(parseInt(cipherText.substr(char, 2), 16) ^ keyInt); | |
return plainText; | |
} |
NewerOlder