Search is not available for this dataset
query
stringlengths
7
355k
document
stringlengths
9
341k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Computes the CRC16XModem checksum of `payload` in littleendian order
function calculateChecksum(payload) { var checksum = strkey_Buffer.alloc(2); checksum.writeUInt16LE(mjs.crc16xmodem(payload), 0); return checksum; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function CRC(payload) {\n var crc = 0;\n for(var i = 0; i < payload.length; ++i) {\n crc = _crctab[crc ^ payload[i]];\n }\n return crc;\n }", "function crc(buf){return(updateCrc(-1,buf,buf.length)^-1)>>>0;// u32\n}", "checksum( buf, start, length ) {\n\n let sum = 0;\n\n for( var i = st...
[ "0.719719", "0.6234908", "0.6000396", "0.59066737", "0.5786782", "0.5741557", "0.57229215", "0.56995636", "0.5676135", "0.5648794", "0.56123316", "0.5511741", "0.5490095", "0.5455794", "0.5451475", "0.5410513", "0.53964925", "0.5369589", "0.5369589", "0.5360512", "0.53538954"...
0.79516816
0
Decodes an "M..." account ID into its MuxedAccount object representation.
function _decodeAddressFullyToMuxedAccount(address) { var rawBytes = StrKey.decodeMed25519PublicKey(address); // Decoding M... addresses cannot be done through a simple // MuxedAccountMed25519.fromXDR() call, because the definition is: // // constructor(attributes: { id: Uint64; ed25519: Buffer }); // ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function UnifiedAccount(accountDef) {\n // we use an id character that a64 will never assign.\n this.id = '*';\n}", "function decode(id) {\n var alphabet = characters();\n return {\n version: alphabet.indexOf(id.substr(0, 1)) & 0x0f,\n worker: alphabet.indexOf(id.substr(1, 1)) & 0x0f\n }...
[ "0.52325195", "0.50660586", "0.50388384", "0.50388384", "0.50388384", "0.50116354", "0.49767363", "0.4915955", "0.4915955", "0.48984516", "0.489214", "0.46223295", "0.45032865", "0.44736305", "0.44580784", "0.445071", "0.4444372", "0.440539", "0.4396924", "0.43606567", "0.433...
0.6106484
0
Converts an xdr.MuxedAccount into its true "M..." string representation.
function _encodeMuxedAccountFullyToAddress(muxedAccount) { if (muxedAccount["switch"]() === src_xdr.CryptoKeyType.keyTypeEd25519()) { return encodeMuxedAccountToAddress(muxedAccount); } var muxed = muxedAccount.med25519(); return StrKey.encodeMed25519PublicKey(decode_encode_muxed_account_Buffer.concat([muxe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _decodeAddressFullyToMuxedAccount(address) {\n var rawBytes = StrKey.decodeMed25519PublicKey(address);\n\n // Decoding M... addresses cannot be done through a simple\n // MuxedAccountMed25519.fromXDR() call, because the definition is:\n //\n // constructor(attributes: { id: Uint64; ed25519: Buffer...
[ "0.5161307", "0.48676345", "0.48386863", "0.483158", "0.47289625", "0.470728", "0.4679006", "0.4655802", "0.46399096", "0.46399096", "0.46367204", "0.45874116", "0.45819095", "0.4579349", "0.45712495", "0.4549804", "0.45158324", "0.45158324", "0.4513243", "0.44968453", "0.448...
0.61093235
0
TODO: Figure out contract owner/id stuff here. How should we represent that?
function Contract(contractId) { contract_classCallCheck(this, Contract); // TODO: Add methods based on the contractSpec (or do that elsewhere?) this._id = contract_Buffer.from(contractId, 'hex'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID() {}", "function OwnerID()...
[ "0.6356731", "0.6356731", "0.6356731", "0.6356731", "0.6356731", "0.6356731", "0.6356731", "0.6356731", "0.6356731", "0.6356731", "0.6356731", "0.6356731", "0.6356731", "0.6356731", "0.6356731", "0.6356731", "0.6356731", "0.6356731", "0.6356731", "0.6356731", "0.6356731", "...
0.0
-1
base64 is 4/3 + up to two characters of the original data
function byteLength (b64) { var lens = getLens(b64) var validLen = lens[0] var placeHoldersLen = lens[1] return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getBase64() {\n var s = this.getDump();\n\n var ch =\n \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";\n var c1, c2, c3, e1, e2, e3, e4;\n var l = s.length;\n var i = 0;\n var r = \"\";\n\n do {\n c1 = s.charCodeAt(i);\n e1 = c1 >> 2;\n c2 = s.charCod...
[ "0.77057606", "0.7324507", "0.72870255", "0.7230772", "0.7183817", "0.71231633", "0.7105772", "0.7089243", "0.7062078", "0.6977857", "0.6975599", "0.6933752", "0.6899215", "0.6899215", "0.6893997", "0.6879304", "0.68740326", "0.68740326", "0.68538475", "0.68362004", "0.681601...
0.0
-1
The Buffer constructor returns instances of `Uint8Array` that have their prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of `Uint8Array`, so the returned instances will have all the node `Buffer` methods and the `Uint8Array` methods. Square bracket notation works as expected it returns a si...
function Buffer (arg, encodingOrOffset, length) { // Common case. if (typeof arg === 'number') { if (typeof encodingOrOffset === 'string') { throw new TypeError( 'The "string" argument must be of type string. Received type number' ) } return allocUnsafe(arg) } return from(arg, en...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function BufferToArrayBuffer () {\n return (new Buffer(this)).buffer\n}", "function BufferToArrayBuffer () {\n return (new Buffer(this)).buffer\n}", "function BufferToArrayBuffer () {\n return (new Buffer(this)).buffer\n}", "function BufferToArrayBuffer () {\n return (new Buffer(this)).buffer\n}", "toB...
[ "0.73534924", "0.73534924", "0.73534924", "0.73534924", "0.6972676", "0.6893956", "0.6893956", "0.684792", "0.684792", "0.684792", "0.684792", "0.684792", "0.684792", "0.684792", "0.6837757", "0.6837757", "0.6837757", "0.6837757", "0.6837757", "0.6837757", "0.6837757", "0.6...
0.0
-1
Finds either the first index of `val` in `buffer` at offset >= `byteOffset`, OR the last index of `val` in `buffer` at offset <= `byteOffset`. Arguments: buffer a Buffer to search val a string, Buffer, or number byteOffset an index into `buffer`; will be clamped to an int32 encoding an optional encoding, relevant is va...
function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) { // Empty buffer means no match if (buffer.length === 0) return -1 // Normalize byteOffset if (typeof byteOffset === 'string') { encoding = byteOffset byteOffset = 0 } else if (byteOffset > 0x7fffffff) { byteOffset = 0x7fffff...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bidirectionalIndexOf(buffer,val,byteOffset,encoding,dir){// Empty buffer means no match\n if(buffer.length===0)return -1;// Normalize byteOffset\n if(typeof byteOffset==='string'){encoding=byteOffset;byteOffset=0;}else if(byteOffset>0x7fffffff){byteOffset=0x7fffffff;}else if(byteOffset<-0x80000000){byte...
[ "0.82827944", "0.82551014", "0.82551014", "0.8253447", "0.8253447", "0.8253447", "0.8253447", "0.8253447", "0.8253447", "0.8253447", "0.8253447", "0.8248611", "0.82462674", "0.82445997", "0.82445997", "0.8228133", "0.8220099", "0.8218732", "0.8218732", "0.8218732", "0.8218732...
0.0
-1
Need to make sure that buffer isn't trying to write out of bounds.
function checkOffset (offset, ext, length) { if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint') if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length') }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function writeBuffer(buffer, pos, src) {\n src.copy(buffer, pos)\n return src.length\n}", "function writeBuffer(buffer, pos, src) {\n src.copy(buffer, pos)\n return src.length\n}", "ensure(n) {\n let minsize = this.pos + n;\n if (minsize > this.capacity) {\n let cap = this.capacity * 2;\n w...
[ "0.6672478", "0.6672478", "0.6633746", "0.6520353", "0.63839674", "0.62772745", "0.6256229", "0.62328905", "0.62328905", "0.6106576", "0.6036704", "0.6019578", "0.59827054", "0.5959428", "0.5950943", "0.5950943", "0.5950943", "0.5950943", "0.5950943", "0.5950943", "0.5950943"...
0.0
-1
ArrayBuffer or Uint8Array objects from other contexts (i.e. iframes) do not pass the `instanceof` check but they should be treated as of that type. See:
function isInstance (obj, type) { return obj instanceof type || (obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function isArrayBuffer (o) { return o instanceof ArrayBuffer }", "function isArrayBuffer (o) { return o instanceof ArrayBuffer }", "function isArrayBuffer(value) {\n return typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer;\n}", "function isArrayBuffer(value) {\n return typeof ArrayBuf...
[ "0.6929726", "0.6929726", "0.6640992", "0.6640992", "0.6640992", "0.6640992", "0.6640992", "0.6640992", "0.6640992", "0.6640992", "0.6640992", "0.6640992", "0.6640992", "0.6640992", "0.6640992", "0.6613789", "0.6571567", "0.6571567", "0.6560591", "0.65499735", "0.65027374", ...
0.0
-1
Code refactored from Mozilla Developer Network:
function assign(target, firstSource) { if (target === undefined || target === null) { throw new TypeError('Cannot convert first argument to object'); } var to = Object(target); for (var i = 1; i < arguments.length; i++) { var nextSource = arguments[i]; if (nextSource === undefined || nextSource ===...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hackUserAgent(){\n if (navigator.userAgent.search('Firefox')!==-1)\n active='mouseup.webcrawler';\n}", "function isMozilla()\n{\n return __isMozilla;\n}", "private internal function m248() {}", "function KAJAX_browserDetect()\n{\n\tthis.screenHeight = window.screen.availHeight;\n\tthis....
[ "0.5864739", "0.56987906", "0.56365114", "0.5626288", "0.55980057", "0.55818903", "0.5580794", "0.5541462", "0.5469785", "0.5444192", "0.54242414", "0.5402028", "0.5386349", "0.5383419", "0.53733236", "0.5346921", "0.5337593", "0.5332459", "0.5320827", "0.5302291", "0.5274175...
0.0
-1
Removes all keyvalue entries from the hash.
function hashClear() { this.__data__ = nativeCreate ? nativeCreate(null) : {}; this.size = 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "clear() {\n var map = this._map;\n var keys = Object.keys(map);\n\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n map[key].clear();\n }\n }", "function clear() {\n this.keys.forEach((key) => {\n this._store[key] = undefined;\n delete this._store[key];\n });\n}", ...
[ "0.67338115", "0.66230935", "0.6513028", "0.6457192", "0.621344", "0.6201073", "0.61395234", "0.61110586", "0.6030125", "0.5966459", "0.5935977", "0.5907212", "0.5907212", "0.5907212", "0.590378", "0.59005594", "0.59005594", "0.59005594", "0.5864768", "0.5864768", "0.5864768"...
0.0
-1
Removes all keyvalue entries from the list cache.
function listCacheClear() { this.__data__ = []; this.size = 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function listCacheClear(){this.__data__=[];}", "function listCacheClear(){this.__data__=[];}", "function listCacheClear(){this.__data__=[];}", "function listCacheClear(){this.__data__=[];}", "function listCacheClear() {\n\t\t this.__data__ = [];\n\t\t this.size = 0;\n\t\t}", "function listCacheClear() ...
[ "0.73564154", "0.73564154", "0.73564154", "0.73564154", "0.731635", "0.72632325", "0.72632325", "0.7261688", "0.7255278", "0.7255278", "0.7234802", "0.7234802", "0.7234802", "0.7234802", "0.7234802", "0.7234802", "0.7234802", "0.7234802", "0.7234802", "0.7234802", "0.72330546...
0.0
-1
Removes all keyvalue entries from the map.
function mapCacheClear() { this.size = 0; this.__data__ = { 'hash': new Hash, 'map': new (Map || ListCache), 'string': new Hash }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "clear() {\n var map = this._map;\n var keys = Object.keys(map);\n\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n map[key].clear();\n }\n }", "clear() {\n log.map(\"Clearing the map of all the entries\");\n this._map.clear();\n }", "function multiMapRemo...
[ "0.7590112", "0.70694387", "0.6735414", "0.6652174", "0.6530006", "0.6267597", "0.62582785", "0.62582785", "0.62582785", "0.617115", "0.617115", "0.617115", "0.6166302", "0.61519635", "0.614778", "0.614778", "0.614778", "0.614778", "0.614778", "0.614778", "0.614778", "0.614...
0.0
-1
Removes all keyvalue entries from the stack.
function stackClear() { this.__data__ = new ListCache; this.size = 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "clear () {\n this._dict = {}\n this._stack = [this._dict]\n }", "function stackClear(){this.__data__={'array':[],'map':null};}", "function stackClear(){this.__data__={'array':[],'map':null};}", "function stackClear(){this.__data__={'array':[],'map':null};}", "function stackClear() {\n\t this.__...
[ "0.63582766", "0.63304627", "0.63304627", "0.63304627", "0.6274707", "0.6228773", "0.6228773", "0.6228773", "0.6228773", "0.6228773", "0.6228773", "0.6228773", "0.62184376", "0.62184376", "0.62184376", "0.62184376", "0.62184376", "0.62184376", "0.62184376", "0.62184376", "0.6...
0.0
-1
v8 likes predictible objects
function Item(fun, array) { this.fun = fun; this.array = array; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compareLike(a,b){\n var al = a.idLikesProp.length;\n var bl = b.idLikesProp.length;\n if(al > bl) return -1;\n if(bl > al) return 1;\n return 0;\n}", "function lookAround() {\n var objectDescription = \"\"\n tj.see().then(function(objects) {\n objects.forEach(function(each) {\n ...
[ "0.5275308", "0.5259251", "0.51914096", "0.51837224", "0.51258314", "0.5044666", "0.4894481", "0.4861732", "0.48405245", "0.48326182", "0.48245227", "0.48138928", "0.48060125", "0.4786252", "0.4785142", "0.47594094", "0.47513723", "0.47400674", "0.47274345", "0.4706265", "0.4...
0.0
-1
alternative to using Object.keys for old browsers
function copyProps (src, dst) { for (var key in src) { dst[key] = src[key] } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getKeys(obj) {\n return Object.keys(obj); // Yes it is builtin!\n }", "function Object_keys(obj) {\n\t if (Object.keys) return Object.keys(obj)\n\t else {\n\t var res = [];\n\t for (var key in obj) res.push(key);\n\t return res;\n\t }\n\t}", "function keys(obj){\n return Object....
[ "0.73833144", "0.7312018", "0.72408074", "0.720008", "0.720008", "0.720008", "0.720008", "0.720008", "0.720008", "0.720008", "0.720008", "0.720008", "0.71107244", "0.6996793", "0.6959349", "0.6931682", "0.6927329", "0.69162315", "0.68797535", "0.68788993", "0.6870084", "0.6...
0.0
-1
prototype class for hash functions
function Hash (blockSize, finalSize) { this._block = Buffer.alloc(blockSize) this._finalSize = finalSize this._blockSize = blockSize this._len = 0 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Hash() {}", "function Hash() {}", "function Hash() {\r\n}", "function Hashers() {\n}", "GetHashCode() {\n\n }", "_generateHash() {\n\n }", "hash() {\n return this.is()\n }", "function Hasher()\n{\n this.truckHash = {};\n}", "calculateHash(){\n return SHA256(this.index + this.pr...
[ "0.8444925", "0.8444925", "0.8012337", "0.7593274", "0.7441991", "0.7378374", "0.73555523", "0.7269683", "0.71957415", "0.718947", "0.7186965", "0.71654564", "0.7144473", "0.71247315", "0.70964617", "0.7088249", "0.70709276", "0.7060434", "0.70601094", "0.7054379", "0.702781"...
0.0
-1
Note: difference from C smlen returned, not passed as argument.
function crypto_sign(sm, m, n, sk) { var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64); var i, j, x = new Float64Array(64); var p = [gf(), gf(), gf(), gf()]; crypto_hash(d, sk, 32); d[0] &= 248; d[31] &= 127; d[31] |= 64; var smlen = n + 64; for (i = 0; i < n; i++) sm[64 + i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sc_stringLength(s) { return s.length; }", "function lengthOfTheLongestSubstringThatContainsAtMost(s, k) {\n // Your code here\n}", "function get_key(stype, ctype) {\r\n return (stype * 65536 + ctype);\r\n}", "function mqcaLen(s, nameCount) {\n log.traceEntry('mqcaLen', \"attr:%d\", s);\n var r...
[ "0.57721114", "0.5524683", "0.551576", "0.54179096", "0.5363709", "0.5351574", "0.5334249", "0.5326163", "0.53187835", "0.53187835", "0.5305045", "0.5219069", "0.5219069", "0.5196396", "0.5164056", "0.5137893", "0.51266086", "0.5094602", "0.5087841", "0.5087841", "0.5087841",...
0.49580616
56
Taken from here and modified for better browser support
function isPromise(input) { return ( ( typeof Promise !== 'undefined' && input instanceof Promise ) || ( input !== null && typeof input === 'object' && typeof input.then === 'function' && typeof input.catch === 'function' ) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "protected internal function m252() {}", "function fixIeBug(e){return browser.msie?e.length-e.replace(/\\r*/g,\"\").length:0}", "private public function m246() {}", "static final private internal function m106() {}", "function ElemToWindow(elem,dummy){\r\nif(!elem) r...
[ "0.5955824", "0.5734138", "0.5477099", "0.54642594", "0.5443228", "0.53419626", "0.5313667", "0.52142", "0.519796", "0.51099896", "0.50701344", "0.5042628", "0.5019758", "0.5007156", "0.49426937", "0.49357232", "0.4902637", "0.4885139", "0.48470518", "0.48289633", "0.48276216...
0.0
-1
We DO NOT return the promise as it gives the user a false sense that the promise is actually somehow related to the callback's execution and that the callback throwing will reject the promise.
function callbackified() { var args = []; for (var i = 0; i < arguments.length; i++) { args.push(arguments[i]); } var maybeCb = args.pop(); if (typeof maybeCb !== 'function') { throw new TypeError('The last argument must be of type Function'); } var self = this; var cb = fun...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "fail(callback) {\n return this.then(null, callback);\n }", "catch(callback) {\n return this.then(null, callback);\n }", "function FailIfRejected() {}", "function FailIfRejected() {}", "function FailIfRejected() {}", "function FailIfRejected() {}", "function FailIfRejected() {}", "function Fai...
[ "0.68198127", "0.6751483", "0.651272", "0.651272", "0.651272", "0.651272", "0.651272", "0.651272", "0.651272", "0.651272", "0.651272", "0.6472909", "0.63621736", "0.62189686", "0.617739", "0.61425686", "0.60334", "0.6011902", "0.5988442", "0.59627974", "0.5948549", "0.59434...
0.0
-1
Setup GUI Controls (for the Overseer)
function addControl(controlObject) { gui.add(controlObject, 'viewSun'); gui.add(controlObject, 'viewStyx'); gui.add(controlObject, 'viewNike'); gui.add(controlObject, 'viewKratos'); gui.add(controlObject, 'viewZelos'); gui.add(controlObject, 'viewBia'); gui.add(controlObject, 'viewAlala'); ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setupUI() {\n //Form controls\n createElement(\"frm\", \"US Census layer controls:\");\n createP(); // spacer\n uiBoss.radio = createRadio();\n\n uiBoss.radio.option(\"sex\", \"Sex\");\n uiBoss.radio.option(\"race\", \"Race / Ethnicity\");\n uiBoss.radio.option(\"incRace\", \"Median I...
[ "0.7409062", "0.6899675", "0.6838278", "0.67305833", "0.6715345", "0.6676", "0.66566074", "0.6651744", "0.6650145", "0.66226894", "0.66105485", "0.65909743", "0.65437776", "0.65228796", "0.6517424", "0.6508013", "0.64984375", "0.6493311", "0.6472165", "0.6471573", "0.6469659"...
0.628833
39
Setup Main Game Loop
function gameLoop() { stats.update(); // Define Over Layers Rotation Speed sunOver.rotation.x += 0.001; sunOver.rotation.z -= 0.001; sunOver.rotation.y += 0.005; sunFakeGas1.rotation.x -= 0.001; sunFakeGas1.rotation.z += 0.001; sunFakeGas1.rotation.y -= 0.005; sunFakeGas2.rotation.x...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function startGame() {\n\tsetup();\n\tmainLoop();\n}", "function mainLoop() {\n if (isGameActive && !isGamePaused) {\n // Update the connected game\n connectedGame.update();\n // Render the connected game\n connectedGame.render();\n ...
[ "0.79413927", "0.7622681", "0.7601725", "0.75511557", "0.7460605", "0.739159", "0.7344247", "0.72999924", "0.7285546", "0.7235278", "0.7227451", "0.72211707", "0.721909", "0.7192066", "0.7157878", "0.7088006", "0.70865464", "0.7086135", "0.7084675", "0.70799017", "0.70585877"...
0.0
-1
Set Aspect Ratio Based on Window Size
function onResize() { camera.aspect = window.innerWidth / window.innerHeight; camera.updateProjectionMatrix(); renderer.setSize(window.innerWidth, window.innerHeight); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function aspectRatio(){\n\tvar width = $(window).width(),\n\t\theight = $(window).height(),\n\t\tratio = width/height;\n\n\tif(ratio < 1.33) {\n\t\t$('#desktopStyle').attr('href', 'css/styleVertical.css')\n\t} else {\n\t\t$('#desktopStyle').attr('href', 'css/style.css')\n\t}\n}", "function resize() {\n ...
[ "0.73653823", "0.72506654", "0.70568234", "0.69867945", "0.6968004", "0.69587404", "0.69585556", "0.6956434", "0.69480973", "0.68818605", "0.6870437", "0.6865692", "0.68349975", "0.6821984", "0.67953855", "0.67779714", "0.67776847", "0.6769961", "0.67674804", "0.67629534", "0...
0.0
-1
Setup Main Camera for the Scene
function setupCamera() { camera = new PerspectiveCamera(45, window.innerWidth / window.innerHeight, 0.1, 5000); camera.position.x = -1100; camera.position.y = 1000; camera.position.z = 1100; camera.lookAt(new Vector3(0, 0, 0)); console.log("Finished setting up Camera"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setupCamera() {\n camera = new PerspectiveCamera(35, config.Screen.RATIO, 0.1, 300);\n camera.position.set(0, 8, 20);\n //camera.rotation.set(0,0,0);\n //camera.lookAt(player.position);\n console.log(\"Finished setting up Camera...\"\n + \"with x\" + camera.ro...
[ "0.76817065", "0.76345056", "0.7620218", "0.75559795", "0.75330746", "0.75149846", "0.75113666", "0.7457064", "0.7425086", "0.73677915", "0.7363912", "0.7244165", "0.7157724", "0.7154038", "0.7132004", "0.71266246", "0.71173304", "0.71065795", "0.70974314", "0.70957625", "0.7...
0.6967004
32
Highlights the toll links in map display
function highlightRoute(routeTollItems, routeAlternative) { if (routeTollItems != null) { for (var i = 0; i < routeTollItems.length; i++) { var tollType = routeTollItems[i].tollType; var color = ppType_S_Color[routeAlternative]; if (tollType == 'A') { color = ppType_A_Color[routeAlternative]; } else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function highlightParking(e) {\n var layer = e.target;\n if (Temp != null) ClearHighlight();\n Temp = e.target;\n layer.setStyle({color: \"#C9C8C7\", fillOpacity : 0.7});\n if (!L.Browser.ie && !L.Browser.opera) { layer.bringToFront(); }\n}", "function highlight() {\n for (let section of linkTo...
[ "0.62307996", "0.6200202", "0.6147286", "0.60670483", "0.5990741", "0.595874", "0.5909287", "0.58790565", "0.58344877", "0.583246", "0.57966423", "0.57569855", "0.575586", "0.57118917", "0.5706978", "0.5694866", "0.56811404", "0.5678775", "0.56637746", "0.56635255", "0.566189...
0.65175885
0
Toll cost object (country)
function CountryTce() { this.name = ""; this.adminAdmissionCost = []; // CostTce array this.roadSectionCost = []; // CostTce array this.tollSystemsNames = []; // TollSystem array this.usageFeeRequiredLinks = null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get cost() {\n return {\n water: 20,\n nitrogen: 5\n }\n }", "function toCostObject(cost) {\n if (cost) {\n var theCost = {};\n theCost.hp = cost[0] ? cost[0] : 0;\n theCost.sp = cost[1] ? cost[1] : 0;\n return theCost;\n } else {\n return null;\n }\n }", "ge...
[ "0.6892253", "0.66413796", "0.6571182", "0.6338483", "0.61734873", "0.60225284", "0.5945138", "0.58530265", "0.58193845", "0.57815284", "0.57568455", "0.5752856", "0.57394785", "0.5723898", "0.57135826", "0.56820655", "0.56816477", "0.56505007", "0.56419235", "0.5614387", "0....
0.70615304
0
Toll cost object (toll info)
function CostTce() { this.name = ""; this.linkIds = []; // String array this.conditions = []; // TceConditon array this.tollStructures = []; // TollStructure array }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get cost() {\n return {\n water: 20,\n nitrogen: 5\n }\n }", "get cost() {\n return {}\n }", "function toCostObject(cost) {\n if (cost) {\n var theCost = {};\n theCost.hp = cost[0] ? cost[0] : 0;\n theCost.sp = cost[1] ? cost[1] : 0;\n return theCost;\n } else {\n...
[ "0.6905045", "0.6846705", "0.6507675", "0.63524014", "0.61988664", "0.61800975", "0.61517966", "0.61458343", "0.60901195", "0.60465974", "0.60110676", "0.6007812", "0.6003555", "0.5989358", "0.59851336", "0.5970357", "0.59587485", "0.59509736", "0.59479135", "0.5886799", "0.5...
0.6916513
0
Toll cost object (conditions)
function TceCondition() { this.time = null; this.pass = null; this.amount = null; this.currency = null; this.methodsOfPayment = null; this.daylightHours = null; this.discountAvailable = null; this.tollSystemsIds = null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function CostTce() {\n\tthis.name = \"\";\n\tthis.linkIds = []; // String array\n\tthis.conditions = []; // TceConditon array\n\tthis.tollStructures = []; // TollStructure array\n}", "get cost() {\n return {\n water: 20,\n nitrogen: 5\n }\n }", "get cost() {\n return {}\n }", "function C...
[ "0.67016387", "0.64876837", "0.62635577", "0.61131537", "0.60430473", "0.5988158", "0.5978602", "0.59618974", "0.5948679", "0.592509", "0.59244776", "0.58895475", "0.5873462", "0.5871236", "0.58631647", "0.58616555", "0.5811135", "0.58019936", "0.57977664", "0.57957333", "0.5...
0.56959605
31
Helper for selecting the value attached to a JS selection
function selectionSettingHelper(selection, value) { for (var opt, j = 0; opt = selection.options[j]; j++) { if (opt.value == value) { selection.selectedIndex = j; break; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function down_value(ele) { \n var selected = ele.value;\n down_select = down[selected]}", "get selectedValue() {\n let selectedElement = this._widget.selectedItem;\n if (selectedElement) {\n return this._itemsByElement.get(selectedElement)._value;\n }\n return \"\";\n }", "function make_se...
[ "0.6869303", "0.6857908", "0.68305975", "0.6587523", "0.6586047", "0.65291256", "0.64554155", "0.64453995", "0.63776", "0.6371202", "0.63622403", "0.6340817", "0.6304916", "0.6255824", "0.6255824", "0.62351465", "0.62182117", "0.61985826", "0.6191157", "0.6190669", "0.6186732...
0.0
-1
Retrieves the name related to the specified language code for the provided toll system id
function getTollSystemNameWithLanguageCode(tollSystemId, tollSystemsNames, lngCode) { for (var i = 0; i < tollSystemsNames.length; i++) { if (tollSystemsNames[i].id == tollSystemId) { for (var j = 0; j < tollSystemsNames[i].names.length; j++) { if (tollSystemsNames[i].names[j].languageCode == lngCode) { ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getLocaleString(id)\r\n{\r\n\tvar lang = getUrlParameter(\"l\");\r\n\treturn locale[lang + \".\" + id] || id;\r\n}", "getTranslatedName(langKey, translationLanguage) {\n let lookupKey = languageNameMap[langKey] || langKey;\n return langData[translationLanguage][lookupKey];\n }", "function mapLa...
[ "0.67747486", "0.6509225", "0.6139332", "0.60703415", "0.60258883", "0.6000078", "0.59627366", "0.59627366", "0.59613174", "0.59608114", "0.5942696", "0.5934813", "0.59072024", "0.5878801", "0.58690953", "0.58391595", "0.5790442", "0.5776583", "0.5764188", "0.57545674", "0.57...
0.77379274
0
Check if a string is null/undefined/withoutContent
function isEmpty(str) { return (!str || 0 === str.length); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function nonEmptyString (data) {\n return string(data) && data !== '';\n }", "function checkNull(content) {\n if (content == null || content == '') {\n return true;\n }\n else\n return false;\n }", "function isDef (val) {\n return val != null && val !== ''\n}"...
[ "0.7316262", "0.73080504", "0.7157815", "0.7157815", "0.70985067", "0.7082014", "0.7081952", "0.70643955", "0.7023984", "0.70110387", "0.69605595", "0.6958784", "0.6958784", "0.69398016", "0.6935837", "0.6918152", "0.68885475", "0.6870843", "0.6828775", "0.6819939", "0.681819...
0.0
-1
function to read food Stock
function readStock(data) { foodS = data.val(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function readStock(data){\n foods=data.val();\n }", "function readStock(data){\n foods=data.val();\n }", "function readStock (data){\n foods = data.val();\n}", "function readStock(data) {\n foodS = data.val();\n foodObj.updateFoodStock(foodS);\n }", "function readStock(data){\n foodS = dat...
[ "0.8141997", "0.8141997", "0.7895278", "0.7832634", "0.7724158", "0.7724158", "0.7698036", "0.7698036", "0.7698036", "0.7698036", "0.7698036", "0.7698036", "0.7698036", "0.7698036", "0.7669284", "0.7659527", "0.7659527", "0.7629874", "0.7532688", "0.75300366", "0.751715", "...
0.7456682
22
Function For Display Result
function displayResult(guessNumber) { if (guessNumber > correctNumber) { showNumberAbove(); } else if (guessNumber < correctNumber) { showNumberBelow(); } else { showYouWon(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayString(result) {\n let output = document.getElementById(\"results\");\n output.innerText = `${result}`;\n\n }", "function printResult(fn) {\n\t// *todo -- C2. Print result to the scre\n\treturn (resultParagraph.innerText = `The Result Is : ${fn}`);\n}", "function display(result...
[ "0.7425657", "0.7408605", "0.73674905", "0.721193", "0.7119581", "0.7011759", "0.69309485", "0.6888138", "0.68454033", "0.6829454", "0.6815169", "0.67825276", "0.6730692", "0.67126596", "0.66700757", "0.6668873", "0.6664378", "0.66430396", "0.6632607", "0.65986794", "0.659326...
0.0
-1
Function initgame for resetiing the all values
function initGame() { correctNumber = getRandomNumber(); document.getElementById("result").innerHTML = ""; guesses = []; displayHistory(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function reset() {\n clear();\n initialize(gameData);\n }", "resetGame() {\n\t\t//stop game\n\t\tthis.running = false\n\t\tclearInterval(this.loop);\n\n\t\t//set original values\n\t\tthis.aliens = [1, 3, 5, 7, 9, 23, 25, 27, 29, 31];\n\t\tthis.direction = 1;\n\t\tthis.ship = [104, 114, 115, 116];\n\...
[ "0.8098383", "0.8051829", "0.7859986", "0.78373885", "0.7782833", "0.7703021", "0.76653934", "0.7660917", "0.7643651", "0.76277804", "0.76059836", "0.7598409", "0.75953656", "0.75848633", "0.75811076", "0.7573909", "0.7556193", "0.75508314", "0.7547001", "0.75382876", "0.7535...
0.0
-1
Function for all guess History
function displayHistory() { let index = guesses.length - 1; let list = "<ul class='list-group'>"; while (index >= 0) { list += "<li class='list-group-item'>" + "You guessed " + guesses[index] + "</li>"; index -= 1; } list += "</ul>"; document.getElementById("history").innerHTML =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function saveGuessHistory(guess) {\r\n guesses.push(guess);\r\n}", "function getGuessHistory(guess) {\n guesses.push(guess);\n console.log(guesses);\n}", "function saveGuessHistory(guess) {\n guesses.push(guess);\n}", "function saveHistory(guess){\n guesses.push(guess);\n}", "function guessHisto...
[ "0.76895154", "0.75919765", "0.7569249", "0.753103", "0.6914063", "0.6821486", "0.6597953", "0.6475985", "0.6462793", "0.6416364", "0.6415967", "0.63394827", "0.6327441", "0.6303894", "0.6303429", "0.6282222", "0.6280428", "0.62519866", "0.6229937", "0.6154463", "0.6139247", ...
0.0
-1
Function for get random number
function getRandomNumber() { let randomNumber = Math.floor(Math.random() * 100) + 1; return randomNumber; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getRandomNumber () {}", "function getNumber() {\n return Math.random();\n}", "function randomNumber() {\r\n return Math.random;\r\n}", "function randNumber () {\n\treturn Math.floor(Math.random() * 10);\n}", "function getNumber(){\n return (1 + Math.floor(48 * Math.random()));\n}", "functio...
[ "0.8815262", "0.84819597", "0.8380089", "0.8331071", "0.829747", "0.82202107", "0.82173693", "0.81900954", "0.8151634", "0.81423664", "0.81314945", "0.81229055", "0.81110525", "0.81082267", "0.80963653", "0.8086065", "0.80856514", "0.80674726", "0.80643743", "0.80549437", "0....
0.0
-1
Function for guess History
function getGuessHistory(guess) { guesses.push(guess); console.log(guesses); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function saveHistory(guess){\n guesses.push(guess);\n}", "function saveGuessHistory(guess) {\r\n guesses.push(guess);\r\n}", "function saveGuessHistory(guess) {\n guesses.push(guess);\n}", "function guessHistory() {\n\tdocument.querySelector(\"#history\").innerHTML = \"History: \" + usedLetters.join(' ,...
[ "0.75392884", "0.7537978", "0.74319434", "0.7044674", "0.65736365", "0.63561815", "0.63330865", "0.6253361", "0.62197673", "0.6174799", "0.61184853", "0.6089108", "0.6088859", "0.6081666", "0.6047048", "0.602709", "0.60199744", "0.5979893", "0.59278023", "0.5921459", "0.59055...
0.75940764
0
Show Function If you Won
function showYouWon() { const text = "Hurrraaay You get It."; let dialog = getDialog('won', text) document.getElementById("result").innerHTML = dialog; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function heroInfo(){\nconsole.log('Dont show');\n\n}", "show() {}", "function show1() {\r\n console.log(\"I am Show function\");\r\n}", "function showAlertFunc() {\n setShowAlert(true);\n }", "show() {\n return true;\n }", "show() {\n\n }", "function showSuccess() {\n showStatus...
[ "0.6664484", "0.6621674", "0.65961546", "0.64439183", "0.64301807", "0.635264", "0.631992", "0.6300666", "0.62794244", "0.62794244", "0.6259195", "0.6244473", "0.61949646", "0.6179253", "0.61478335", "0.61461645", "0.61091095", "0.60823494", "0.60735434", "0.60628533", "0.606...
0.0
-1
Show Function If you guess above
function showNumberAbove() { const text = "Your Guess is too high!"; let dialog = getDialog('warning', text) document.getElementById("result").innerHTML = dialog; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function show1() {\r\n console.log(\"I am Show function\");\r\n}", "function display() {\r\n let showArg = () => arguments[0];\r\n return showArg();\r\n }", "show() {}", "function Display(fn) {\r\n console.log(fn(23, 45));\r\n}", "function display()\n{\n\n}", "function display(){\r\n\r\n ...
[ "0.696747", "0.68854654", "0.67216027", "0.65761226", "0.6570471", "0.64745355", "0.6423635", "0.6415782", "0.6401896", "0.62760484", "0.6266038", "0.62631357", "0.6203531", "0.6203531", "0.6186893", "0.61624485", "0.61613816", "0.60991365", "0.605739", "0.60520023", "0.60336...
0.0
-1
Show Function If you guess low
function showNumberBelow() { const text = "Your Guess is too low!"; let dialog = getDialog('warning', text) document.getElementById("result").innerHTML = dialog; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function processValidGuess(guess) {\n if (guess < aRandomNumber) {\n $('.result-line').text(\"That is too low\");\n } else if (guess > aRandomNumber) {\n $('.result-line').text(\"That is too high\");\n } else {\n increaseWins();\n increaseMinMax();\n $('.result-line').text(\"BOOM!...
[ "0.7154483", "0.70475197", "0.700996", "0.6864731", "0.6840642", "0.6816442", "0.68088466", "0.67953795", "0.6782872", "0.66910785", "0.6673443", "0.66498256", "0.6635817", "0.6619469", "0.6600841", "0.6594365", "0.6580294", "0.65770525", "0.6573553", "0.6569102", "0.65609396...
0.6827195
5
`parse()` Parse a UUID into it's component bytes
function parse(s, buf, offset) { var i = (buf && offset) || 0, ii = 0; buf = buf || []; s.toLowerCase().replace(/[0-9a-f]{2}/g, function (oct) { if (ii < 16) { // Don't overflow! buf[i + ii++] = _hexToByte[oct]; } }); // Zero out remaining bytes if string was short while (ii < 16) { buf[i +...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function parseUUID(uuid) {\n if (typeof uuid !== 'string') {\n throw new TypeError('Invalid type for UUID, expected string but got ' + typeof uuid);\n }\n if (!UUID_RX.test(uuid)) {\n throw new TypeError('Invalid format for UUID: ' + uuid);\n }\n let v;\n const arr = new Uint8Array(...
[ "0.7384558", "0.6504025", "0.6486697", "0.6460371", "0.6460371", "0.6008473", "0.58945024", "0.5759498", "0.57438576", "0.5729614", "0.5729614", "0.5725069", "0.5706968", "0.56981784", "0.56683767", "0.56683767", "0.56683767", "0.56683767", "0.56683767", "0.56683767", "0.5668...
0.0
-1
`unparse()` Convert UUID byte array (ala parse()) into a string
function unparse(buf, offset) { var i = offset || 0, bth = _byteToHex; return bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + bth[buf[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rawGetStrUuid4(binUuid4)\n{\n\tif(!rawIsSafeEntity(binUuid4) || !(binUuid4 instanceof Buffer)){\n\t\tbinUuid4 = rawGetBinUuid4();\n\t}\n\tvar\tparsed\t= binUuid4.toString('hex').match(/(.{8})(.{4})(.{4})(.{4})(.{12})/);\n\tparsed.shift();\t\t\t\t\t\t\t\t// first element is all, then skip it.\n\tvar\tstrUu...
[ "0.6609696", "0.6562299", "0.65571743", "0.65571743", "0.6553086", "0.65395963", "0.65146357", "0.6503958", "0.6492749", "0.64734745", "0.64734745", "0.64734745", "0.64734745", "0.64734745", "0.64734745", "0.64734745", "0.64734745", "0.64734745", "0.64734745", "0.64734745", "...
0.6402168
70
See for API details
function v1(options, buf, offset) { var i = buf && offset || 0; var b = buf || []; options = options || {}; var clockseq = (options.clockseq != null) ? options.clockseq : _clockseq; // UUID timestamps are 100 nano-second units since the Gregorian epoch, // (1582-10-15 00:00). JSNumbers aren't precise en...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "obtain(){}", "function API(){}", "function API(){}", "private internal function m248() {}", "transient private internal function m185() {}", "transient private protected internal function m182() {}", "transient protected internal function m189() {}", "protected ...
[ "0.64539295", "0.628222", "0.6083875", "0.6083875", "0.58966196", "0.58931714", "0.5843906", "0.5807617", "0.56874675", "0.55977154", "0.55894995", "0.55894995", "0.5536012", "0.54927725", "0.547576", "0.5461862", "0.5457917", "0.54515964", "0.54515964", "0.54515964", "0.5451...
0.0
-1
`v4()` Generate random UUID See for API details
function v4(options, buf, offset) { // Deprecated - 'format' argument, as supported in v1.2 var i = buf && offset || 0; if (typeof(options) === 'string') { buf = (options === 'binary') ? new BufferClass(16) : null; options = null; } options = options || {}; var rnds = options.random || (options.rng ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateUUIDv4() {\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {\n var r = Math.random() * 16 | 0,\n v = c == 'x' ? r : (r & 0x3 | 0x8);\n return v.toString(16);\n });\n}", "generateUUIDv4()\n\t{\n\t\tlet tmpBuffer = new Array(16);\n\t\tva...
[ "0.8774882", "0.8718046", "0.86584747", "0.864471", "0.86237174", "0.8621149", "0.8613905", "0.8612914", "0.86098737", "0.85712576", "0.8531813", "0.8523592", "0.8519704", "0.85067177", "0.84895635", "0.847847", "0.8476903", "0.8476355", "0.8471651", "0.8469883", "0.8467385",...
0.0
-1
allows to animate the edit bar
function animate(editBar, direction, frameRate, finalTop, callback, firstIteration){ /** @default */ if(typeof(callback) == "undefined"){ callback = function(){}; } /** determine the operation among the direction */ if(direction == "down"){ operation = "+"; comparison = "<"; }else{ operation =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onEdit() {\n transition(EDIT);\n }", "function edit_mode()\n{\n\tif (imgObj != undefined && imgObj.complete)\n\t{\n\t\t$('#editDiv').animate({height: '200px'}, {duration: 500, queue:false});\n\t\t$('#previewDiv').animate({height: '0px'}, {duration: 500, queue:false});\n\t}\n}", "function animatedC...
[ "0.6651066", "0.63918453", "0.60221493", "0.6018051", "0.59756666", "0.59519655", "0.59458315", "0.5925677", "0.59006894", "0.5899811", "0.5856531", "0.5833425", "0.5822864", "0.5819652", "0.579734", "0.5795346", "0.57860255", "0.57702297", "0.5749118", "0.57487696", "0.57474...
0.59226215
8
Method to add phrase to be displayed
addPhraseToDisplay(){ this.setupLetterToBeDisplayed() }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "addPhraseToDisplay() {\n let displayHTML = ``;\n for (let i = 0; i < this.phrase.length; i++) {\n if (this.phrase[i] === \" \") {\n displayHTML += `<li class=\"hide show\"></li>`;\n } else {\n displayHTML += `<li class=\"hide letter ${this.phrase[i]...
[ "0.69593817", "0.6883067", "0.68565595", "0.68480307", "0.6805699", "0.67901343", "0.6765363", "0.67475355", "0.6717098", "0.67017514", "0.6681756", "0.6637685", "0.66343063", "0.66283005", "0.66104466", "0.65713197", "0.6535138", "0.6517809", "0.6441869", "0.64305633", "0.64...
0.754899
0
Check if selected letter is in phrase
checkLetter(letter, phrase){ let letterMatchFilter = new RegExp(letter) let matched = letterMatchFilter.test(phrase) return matched }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "checkLetter(letter){\r\n if( this.phrase.indexOf(letter) > -1 ){\r\n this.showMatchedLetter(letter);\r\n return true; \r\n }\r\n }", "checkLetter(target){\n if (this.phrase.includes(target)) {\n return true;\n } else {\n return false;\n }\n }", "check...
[ "0.81579125", "0.8112588", "0.80575657", "0.802397", "0.7979288", "0.7978221", "0.79331195", "0.7923965", "0.7901548", "0.7894304", "0.7869369", "0.78581923", "0.78506935", "0.7844681", "0.78437376", "0.7824323", "0.78216094", "0.7811777", "0.78069973", "0.78062963", "0.78001...
0.73314285
39
Method to set letter classes on active phrase
setupLetterToBeDisplayed(){ // Check if character is alphabet letter const matchAlphabetCharacter = /[a-z]/i const matchSpace = /\s/g let textNode let li for (var i =0; i < this.phrase.length; i++){ li = document.createElement('LI'); if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "showMatchedLetter(letter){\n\n const phrases = document.querySelector('#phrase ul').children;\n\n\n\n for (let i = 0; i < phrases.length; i++) {\n if (phrases[i].textContent === letter) {\n phrases[i].setAttribute('class', `show letter ${letter}`);\n\n }\n }\n }", "showMatchedLetter(l)...
[ "0.6856623", "0.67057395", "0.65635985", "0.650825", "0.6384455", "0.63766885", "0.63654095", "0.63276994", "0.62770545", "0.624007", "0.6183793", "0.6175847", "0.6166543", "0.61575115", "0.6150538", "0.6134542", "0.61326", "0.61110526", "0.61085683", "0.608636", "0.6057611",...
0.57030827
56
write a function to call nearby books api
componentDidMount(){ this.connect(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function findBook(){\n\t//get book from input\n let book = getBook();\n //send request to url\n let urlLink = createURL(book);\n sendRequest(urlLink);\n}", "function handleBookSearch () {\n // console.log(\"googleKey\", googleKey);\n axios.get(\"https://www.googleapis.com/books/v1/volumes?q=int...
[ "0.6735085", "0.6446496", "0.643176", "0.6399227", "0.63853234", "0.6250376", "0.62142277", "0.61936826", "0.6150784", "0.6139678", "0.61250937", "0.6114002", "0.61103046", "0.61072105", "0.6104061", "0.6096349", "0.60921663", "0.6048868", "0.60282505", "0.6018448", "0.600656...
0.0
-1
find a element by id in whole page raises exception if not found
function jq(id) { if (!id.startsWith('#')) { id = '#' + id; } var $el = $(id) if ($el.length == 0) throw 'no element with id [' + id + ']' return $el }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function find(doc, element, id) {\n if (!element) {\n element = doc.getElementById(id);\n if (!element) {\n throw new Error('Missing element, id=' + id);\n }\n }\n return element;\n}", "function find(id){\n var elem = document.getElementById(id);\n return elem;\n}", "function find(id) {\n r...
[ "0.7849788", "0.7623598", "0.7554387", "0.7280448", "0.71000546", "0.70937127", "0.6997013", "0.6983291", "0.69790226", "0.69649637", "0.6920066", "0.6868605", "0.68434983", "0.67923486", "0.67923486", "0.6790372", "0.6790243", "0.67256474", "0.67114425", "0.67037815", "0.670...
0.0
-1
find a element by css in parent element raises exception if not found
function find($parent, css) { var $el = $parent.find(css).first() if ($el.length == 0) throw 'no child element with selector [' + css + ']' + ' found in parent ' + $parent.attr('id') return $el }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _findInParentEx(parElm,field){\r\n\t\tvar elm = parElm.find('.' + field);\r\n\t\tif(!elm[0]){\r\n\t\t\telm = parElm.find(\"[name='\" + field + \"']\");\r\n\t\t}else if(!elm[0]){\r\n\t\t\telm = parElm.find('#' + field);\r\n\t\t}\r\n\t\treturn elm;\r\n\t}", "function findParent(element, selector) {\n v...
[ "0.671552", "0.66634846", "0.66634846", "0.66563475", "0.64875406", "0.64828444", "0.6465763", "0.64525473", "0.63260585", "0.6299423", "0.6286171", "0.6273829", "0.6250076", "0.6221067", "0.62080103", "0.6119568", "0.6119568", "0.6111645", "0.6018736", "0.6004872", "0.599646...
0.7920112
0
Supporting functions for searching hashtable buckets
function searchBuckets(buckets, hash) { var i = buckets.length, bucket; while (i--) { bucket = buckets[i]; if (hash === bucket[0]) { return i; } } return null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function searchBuckets(buckets, hash) {\n var i = buckets.length, bucket;\n while (i--) {\n bucket = buckets[i];\n if (hash === bucket[0]) {\n return i;\n }\n }\n return null;\n }", "function search...
[ "0.703565", "0.6949447", "0.6891224", "0.6840394", "0.6840394", "0.64426684", "0.6398186", "0.62808156", "0.61313385", "0.6092441", "0.6000327", "0.5966508", "0.59663707", "0.5877041", "0.58389807", "0.5679034", "0.5646032", "0.5634097", "0.5610567", "0.5599946", "0.5580123",...
0.6939032
2
var uri = " + "login/";
function init(){ $("#login_username").val($.cookie("userName")); $("#login_password").val($.cookie("passWord")); // if($("#login_username").val()!=null && $("#login_password").val()!=null){ // login_event(); // } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "login(url) {\n return self.options.loginUrl ? self.options.loginUrl : '/login';\n }", "function login0(){\n\treturn \"/uadmin\";\n}", "function loginSL(pass) {\n // PHP: http://localhost:7833/cportal/login&username=dylan&password=asdf\n // REST: http://localhost:7833/cportal/login?username=d...
[ "0.6704365", "0.66742754", "0.6244488", "0.6164328", "0.61066544", "0.5981659", "0.59537727", "0.5936852", "0.5932772", "0.59160995", "0.589492", "0.5891342", "0.5875469", "0.5864211", "0.5863583", "0.5823142", "0.5806544", "0.57872546", "0.5777009", "0.5767883", "0.5761121",...
0.0
-1
draw ascending diagonal lines in reference to center point
function diagonalAscending(x, y, s) { line(x - s / 2, y + s / 2, x + s / 2, y - s / 2); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function diagonal({startPoint, endPoint, expanseDirection}) {\n const controlPointX = expanseDirection == \"horizontal\" ? () => (startPoint.x + endPoint.x) / 2 : (point) => point.x;\n const controlPointY = expanseDirection == \"vertical\" ? () => (startPoint.y + endPoint.y) / 2 : (point) => point.y;\n re...
[ "0.6570429", "0.6447819", "0.6348221", "0.6160155", "0.61445016", "0.61363494", "0.6118209", "0.61075366", "0.60771704", "0.60264385", "0.5972699", "0.59640175", "0.59270525", "0.5907177", "0.58886975", "0.5886248", "0.58595246", "0.5833083", "0.58180875", "0.580559", "0.5794...
0.6861492
0
count the number of each color required
function countArray(arr) { var a = [], b = [], prev; arr.sort(); for ( var i = 0; i < arr.length; i++ ) { if ( arr[i] !== prev ) { a.push(arr[i]); b.push(1); } else { b[b.length-1]++; } prev = arr[i]; } return [a, b]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "countPixelsWithColor(idx){\n let n = 0;\n let pixCount = this.pattern.width == 32 ? 1024 : 4096;\n for (let i = 0; i < pixCount; ++i){\n if (this.pixels[i] == idx){++n;}\n }\n return n;\n }", "function count_color(current_coordinate, desired_color, desired_direction, current_count) {\n\t\t\t...
[ "0.7613272", "0.7407305", "0.6990877", "0.6710159", "0.66328007", "0.6553395", "0.6545229", "0.65031266", "0.64958847", "0.6443539", "0.6372073", "0.6325214", "0.62950534", "0.6285482", "0.62823176", "0.62788105", "0.6234834", "0.62217367", "0.6220983", "0.6217506", "0.618139...
0.0
-1
remove transparency when toggle is opened
function switchNavBar(){ if (this.scrollY < 45){ if (document.querySelector(".navbar-toggler").getAttribute("aria-expanded") === "true" || false){ document.querySelector(".navbar").classList.remove("topNavBar"); } else{ document.querySelector(".navbar").classList.add(...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toggleTransparency() {\n enableTransparency = !enableTransparency;\n}", "onToggle() {}", "toggle(){\n if(zoteroRoam.interface.icon.getAttribute('status') == \"off\"){\n zoteroRoam.extension.load();\n } else {\n zoteroRoam.extension.unload();\n ...
[ "0.7664611", "0.6831812", "0.6753663", "0.66100055", "0.65042096", "0.6496958", "0.6486508", "0.6475949", "0.6439515", "0.6438631", "0.64355445", "0.6435265", "0.6428431", "0.64233243", "0.63912386", "0.6374554", "0.63581496", "0.63495886", "0.63365513", "0.6330384", "0.63303...
0.0
-1
switch plus to minus when expanded (faq)
function switchPlus(iconElement){ const icon = iconElement.querySelector('i'); if (iconElement.querySelector(".fa-plus-square") != null){ icon.classList.remove("fa-plus-square"); icon.classList.add("fa-minus-square"); } else { icon.classList.remove("fa-minus-square"); ico...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function plusMinus() {\n if (display.value.charAt(0) === \"-\") { //display=-325\n display.value = display.value.slice(1);\n } else { //display=569 \n display.value = \"-\" + display.value;\n }\n}", "function changePlusMinus() {\n if (screenResult.innerHTML !== \"0\") {\n if (screenResult.innerH...
[ "0.64030653", "0.6373123", "0.618606", "0.6148098", "0.6139647", "0.6101434", "0.59575176", "0.5917084", "0.5848024", "0.58320546", "0.57808787", "0.5738459", "0.5732688", "0.57257986", "0.5713364", "0.5638624", "0.5631748", "0.5605515", "0.5541329", "0.55301327", "0.5504878"...
0.0
-1
Retrieves value for id passed
function getInputVal(id) { return document.getElementById(id).value; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getValue(id) {\r\n return getElm(id).value;\r\n}", "function getValue(id) {\n return $(`#${id}`).val();\n}", "function getValue(id) {\n return document.getElementById(id).value;\n}", "function get(id) {\n var e = D.getElementById(P + id);\n return e ? e.getAttribute('value') : DEFAULTS[...
[ "0.80455995", "0.8008113", "0.7514208", "0.7428824", "0.73890996", "0.72848874", "0.7281983", "0.724967", "0.7173897", "0.70982575", "0.70966136", "0.7062442", "0.7005047", "0.7000542", "0.6972581", "0.6927721", "0.6903663", "0.6878873", "0.6869863", "0.68647003", "0.6855375"...
0.68152255
23
Helper method for the search method of Filterizr
getContentsLowercase() { return this.$node.text().toLowerCase(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "searchFilter(e) {\n this.getSearchResults(formData)\n }", "function search() {\n\t\n}", "function searchTerm(){\n \n }", "search(searchTerm) {\n let results = undefined;\n if (this.props.data) {\n\n if (this.props.caseInsensitive) {\n results = this.props...
[ "0.7187676", "0.7162375", "0.69503736", "0.69035566", "0.68819594", "0.68686897", "0.68643004", "0.68512356", "0.6793524", "0.6791368", "0.6723878", "0.6670588", "0.666627", "0.6663059", "0.66377556", "0.65861154", "0.65824574", "0.6579435", "0.6573368", "0.6567106", "0.65441...
0.0
-1
Returns all categories of the .filtritem datacategory attribute with a regexp regarding all whitespace.
getCategories() { return this.$node.attr('data-category').split(/\s*,\s*/g); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fetch_categories(wiki){\n var cats=[]\n var reg=new RegExp(\"\\\\[\\\\[:?(\"+category_words.join(\"|\")+\"):(.{2,60}?)\\]\\](\\w{0,10})\", \"ig\")\n var tmp=wiki.match(reg)//regular links\n if(tmp){\n var reg2=new RegExp(\"^\\\\[\\\\[:?(\"+category_words.join(\"|\")+\"):\", \"...
[ "0.58154327", "0.5766453", "0.5643814", "0.5541858", "0.55268323", "0.536728", "0.5303782", "0.52605486", "0.52107245", "0.5206438", "0.5161686", "0.5160238", "0.51150286", "0.5088816", "0.50737333", "0.5033506", "0.5019498", "0.4992443", "0.495404", "0.49378368", "0.4925148"...
0.6545484
0
Wrapper around jQuery's innerHeight to calculate the item's width
getHeight() { return this.$node.innerHeight(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function oldOuterHeight(element){\r\n //return 100;\r\n return element.height();\r\n}", "function getItemsWidth(callback){\n var sum = 0;\n container.find('.menu-item').each( function(callback){\n var elementWidth = $(this).outerWidth(true);\n sum += elementWidth;\n });\n\n ...
[ "0.67766577", "0.6497331", "0.6478641", "0.6441156", "0.6438789", "0.6411349", "0.6370559", "0.63618386", "0.6282013", "0.6265932", "0.62385917", "0.6235752", "0.6229018", "0.62132597", "0.6210425", "0.61793435", "0.6157169", "0.6148442", "0.61416405", "0.6134115", "0.6125713...
0.636782
7
Wrapper around jQuery's innerWidth to calculate the item's width
getWidth() { return this.$node.innerWidth(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getItemsWidth(callback){\n var sum = 0;\n container.find('.menu-item').each( function(callback){\n var elementWidth = $(this).outerWidth(true);\n sum += elementWidth;\n });\n\n typeof callback === 'function' && callback();\n return sum;\n }", "function outerWidt...
[ "0.73107755", "0.7286967", "0.7257353", "0.7189089", "0.7181474", "0.71023583", "0.7066174", "0.705029", "0.6974057", "0.6937468", "0.6921656", "0.69043094", "0.68744886", "0.68293065", "0.6788153", "0.6697081", "0.6657697", "0.66204554", "0.6606132", "0.65973866", "0.6574580...
0.65944797
20
Recalculates the dimensions of the element and updates them in the state
updateDimensions() { this.props.w = this.getWidth(); this.props.h = this.getHeight(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "updateSize() {\n this.w = this.ent.width + this.wo;\n this.h = this.ent.height + this.ho;\n }", "recalculateSizes() {\n let elem = ReactDOM.findDOMNode(this).parentNode;\n this.width = elem.offsetWidth - 30;\n this.divHeight = elem.offsetHeight;\n this.height = this.data.length * 60;\n this...
[ "0.7314883", "0.7183509", "0.7015535", "0.70110554", "0.6998952", "0.6983284", "0.6978355", "0.6872395", "0.68298596", "0.6815208", "0.6778484", "0.67188966", "0.6675214", "0.6675214", "0.66335094", "0.6617666", "0.65932804", "0.6589995", "0.6552876", "0.6552264", "0.6542469"...
0.7572155
0
Sets up the events related to the FilterItem instance
bindEvents() { this.$node.on(transitionEndEvt, () => { // On transitionEnd determine if the item is filtered out or not, // in case it is add the .filteredOut class for easy targeting by // the user and set the z-index to -1000 to prevent mouse events // from being intercepted. const {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "setupFilterListener() {\n // show hide filter sections\n $('.filter-section').on('click', '.filter-title', (event) => {\n const $section = $(event.delegateTarget);\n const filter = $section.data('section');\n $section.children('.filter-body__list').toggleClass('filter-body__list--hidden');\n ...
[ "0.71448445", "0.6692602", "0.66886157", "0.6621677", "0.64348185", "0.62825936", "0.6253528", "0.6239235", "0.62378603", "0.62319595", "0.62113124", "0.61791265", "0.6149576", "0.6142461", "0.6120301", "0.6116938", "0.6081123", "0.6070426", "0.6043163", "0.59602916", "0.5932...
0.0
-1
Removes all events related to the FilterItem instance
unbindEvents() { this.$node.off(transitionEndEvt); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onFiltersCleared() {\n }", "function clearEvents() {\n\t\t\tvar ident;\n\t\t\tfor (ident in listenersByEventId) {\n\t\t\t\tr.removeListener(ident);\n\t\t\t}\n\t\t}", "function cleanEvent() {\n\tvar removable = ACT.Event.removable;\n\tfor (var itor = 0; itor < removable.length; itor++) {\n\t\tif (removable[ito...
[ "0.6675469", "0.6481064", "0.63882744", "0.63610333", "0.6315221", "0.62849444", "0.6277805", "0.62621796", "0.62491417", "0.62491417", "0.62170047", "0.6142197", "0.61374116", "0.6133138", "0.61079085", "0.6080865", "0.6043797", "0.6037576", "0.6001963", "0.59708", "0.596233...
0.0
-1
Creating new molecule via prompt
static create() { let name, muts, atoms; cl(`Creating new molecule. "Ctrl+c" to exit`.gray); rl.question(`Name » \n`.green, molName => { name = molName; rl.question(`Mutates (space separated)» \n`.green, molMutate => { muts = molMutate.split(' '); rl.question(`Atoms » \n`.green + `predefined:`.w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createPublicComponent() {\n var prompt = {\n name: ' name: ',\n repo: ' repo (username/project): ',\n desc: ' description: ',\n author: ' author: '\n };\n program.prompt(prompt, function(obj){\n console.log();\n conf.name = obj.name;\n conf.repo = obj.repo;\n conf.author...
[ "0.658342", "0.6552722", "0.6448571", "0.62887746", "0.6126554", "0.60528076", "0.6014788", "0.6006281", "0.59996563", "0.59960425", "0.5954071", "0.5951688", "0.5937463", "0.5918856", "0.5918179", "0.59105086", "0.5908742", "0.5878504", "0.5876592", "0.5865288", "0.5860591",...
0.76063645
0
Creating new atom via prompt
static create() { let name, muts, tag, attr cl(`Creating new atom. "Ctrl+c" to exit`.gray); rl.question(`Name » `.green, atomName => { name = atomName; rl.question(`Mutates » `.green, atomMutate => { muts = atomMutate.split(' '); rl.question(`Tag » `.green, atomTag => { tag = atomTag; ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function newPrompt() {\n prompt = new Prompt('title', 'Prompt:', (result) => {\n alert(`Result: ${result}`);\n dispose(prompt);\n }, 'defaultValue');\n prompt.setVisible(true);\n}", "function prompt(str) {}", "function CreateIntern() {\n inquirer\n .prompt([\n {\n type: \"input\",\n ...
[ "0.6597993", "0.63806653", "0.6297187", "0.6284468", "0.62651825", "0.6206518", "0.6158694", "0.6141413", "0.6125502", "0.61242086", "0.6111184", "0.61085135", "0.60792625", "0.60769033", "0.6060258", "0.6059652", "0.6024431", "0.59893763", "0.59670204", "0.59642315", "0.5958...
0.7557044
0
Saving new atom into moleculate.json
static save(atom) { let data = jsonfile.readFileSync(MAINFILE); if (isNewAtom(atom.name)) { data.atoms.push(atom); jsonfile.writeFileSync(MAINFILE, data, {spaces: 4}); cl(`Created new atom: `.green + `${atom.name}`.gray); } else cl(`Atom already exists: `.red + `${atom.name}`.gray); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function writeJson() {\n fs.writeFileSync(__dirname + '/animes.json', JSON.stringify(anime))\n console.log(\"Arquivo JSON atualizado!\")\n}", "function save() {\n fs.writeFile('aaddress.json', JSON.stringify(addressData), 'utf-8', function (err) {\n ...
[ "0.6410551", "0.6183556", "0.6078118", "0.6033672", "0.6027423", "0.60133576", "0.5980786", "0.5915603", "0.5914358", "0.5797628", "0.5777462", "0.5749806", "0.5744696", "0.5737254", "0.565985", "0.564517", "0.56329757", "0.5623554", "0.56167066", "0.56165266", "0.5616152", ...
0.7972201
0
Builds BEM blocks from moleculate.json
function buildBlocks() { let data = jsonfile.readFileSync(MAINFILE); let dir = path.join(process.cwd(), data.dir), atoms = data.atoms, molecules = data.molecules; if (molecules.length === 0) { cl('Error: no molecules initialised'.red); cl('Use --help to list commands'.gray); rl.close(); } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "generateBlocks () {\n\t\tvar segments = {\n\t\t\tb1 : {i:0, j:0},\n\t\t\tb2 : {i:0, j:3},\n\t\t\tb3 : {i:0, j:6},\n\t\t\tb4 : {i:3, j:0},\n\t\t\tb5 : {i:3, j:3},\n\t\t\tb6 : {i:3, j:6},\n\t\t\tb7 : {i:6, j:0},\n\t\t\tb8 : {i:6, j:3},\n\t\t\tb9 : {i:6, j:6}\t\t\n\t\t}\n\t\tfor (var block in segments) {\n\t\t\tvar r...
[ "0.5909822", "0.5764334", "0.57373035", "0.5714804", "0.5673435", "0.5639723", "0.56284976", "0.5573609", "0.55399436", "0.55399203", "0.54809004", "0.5477697", "0.5469723", "0.5426835", "0.5422156", "0.5403577", "0.540313", "0.5401684", "0.5390151", "0.5389379", "0.5345746",...
0.7533064
0
round num to p places
function round(num, p) { let m = Math.pow(10, p); return Math.round(num * m) / m; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function roundNum(num){\n return Math.round(num * 10) / 10;\n }", "function round(num, places) {\n var multiplier = Math.pow(10, places);\n return Math.round(num * multiplier) / multiplier;\n }", "function round(num, places) {\n var shift = Ma...
[ "0.7212149", "0.71791404", "0.71622777", "0.71302193", "0.7129125", "0.7102723", "0.70720917", "0.7068557", "0.7029001", "0.7024904", "0.69661796", "0.69527674", "0.6946411", "0.69365215", "0.6901949", "0.68863773", "0.68501604", "0.6814656", "0.6804305", "0.67712885", "0.675...
0.81749284
0
returns a string like (irongearwheel 1, ironplate 1)
function makeIngredientString(ingredients) { let ret = '('; for (i in ingredients) { if (ret != '(') { ret += ', '; } ret += `${i}: ${ingredients[i]}`; } return ret + ')'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "toString() {\n var output = \"(\";\n for (var i = 0; i < this.size; i++) {\n output += this.get(i);\n if (i != this.size - 1) output += \", \";\n }\n output += \")\";\n return output;\n }", "getNumberPairsString() {\n\t\tif(this.numberPairs === []) throw \"Please set Number Pairs first ...
[ "0.64674425", "0.63144994", "0.6258132", "0.617251", "0.6079264", "0.6052951", "0.60197526", "0.6000108", "0.5995398", "0.5982361", "0.59133345", "0.5906202", "0.5893972", "0.5859797", "0.58439475", "0.5828689", "0.5749087", "0.57439286", "0.5710505", "0.568066", "0.5678115",...
0.6782466
0
this adds a name property to each object in the map which is a bit ugly
function printIngredients(ingredients) { let arr = []; for (let p in ingredients) { ingredients[p].name = p; ingredients[p].times = core.calculateTimes(ingredients[p].name, ingredients[p].amount); if (!ingredients[p].times) { ingredients[p].tier += 100; } arr.push(ingredients[p]); } a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "__init25() {this.forceRenames = new Map()}", "function addItemsByName(c){\n c.itemsByName = {};\n c.items.forEach(function(item){\n c.itemsByName[item.name] = item;\n });\n}", "function makeMap(name, relName) {\n var prefix, plugin,\n index = name.indexOf('!');\n\n if (...
[ "0.6550196", "0.63377774", "0.62570983", "0.62570983", "0.62570983", "0.62570983", "0.6219696", "0.614842", "0.61375713", "0.60635674", "0.5985146", "0.5882324", "0.5858275", "0.5844699", "0.58328855", "0.5781056", "0.5739965", "0.5734181", "0.5718734", "0.57180995", "0.57116...
0.0
-1
coming from npm validator
validate(value) { // Using validator npm package. There are many more validations with npm validator: // as documented on their site: https://www.npmjs.com/package/validator if (!validator.isEmail(value)) { throw new Error('Please enter valid email address!') ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "validate() {}", "validate() { }", "_validate() {\n\t}", "requirements({ msg, suffix }) {\n\t\treturn true;\n\t}", "async validate() {\n return true\n }", "function required() { }", "function YffValidator() {}", "function validLegacyPackage(input) {\n const { validForOldPackages } = validateL...
[ "0.6254682", "0.6060995", "0.60013443", "0.58956367", "0.5793775", "0.5754949", "0.5658873", "0.56264", "0.55642295", "0.5563267", "0.5561911", "0.55516225", "0.5497496", "0.5489177", "0.5483338", "0.54533863", "0.54495466", "0.54463863", "0.54334843", "0.53838515", "0.537671...
0.5066001
58
var API_SECRET = 'aa48ef30ca475af7';
function searchImg(kw){ var url = "https://api.flickr.com/services/rest/?method=flickr.photos.search&api_key="+API_KEY+"&tags="+kw+"&safe_search=1&per_page=5"; console.log(url); //ajax var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getAPIKey(){\n\n}", "function returnAPIKey(){\r\n\treturn \"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\";\r\n}", "function getUserSecretKey() {\n return localStorage.getItem('userSecretKey');\n}", "function setupGlobals(secrets) {\n SECRET_KEY = secrets.secretKey;\n ...
[ "0.6964479", "0.6623337", "0.6614766", "0.65570027", "0.64701504", "0.64498615", "0.6341991", "0.63362795", "0.62332493", "0.61789614", "0.6114776", "0.60221666", "0.59595394", "0.5949599", "0.589948", "0.58792686", "0.5877002", "0.5861407", "0.5861407", "0.5861255", "0.58596...
0.0
-1
this function checks if the plugin is instantiated and runs the right callback function (yes or no)
function isInstantiated(element, actions) { var pluginObj = $.data(element, pluginName); if (pluginObj) { actions.yes(pluginObj); } else { actions.no(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pluginloaded()\n{\r\n}", "isPluginLoaded(plugin){\n\t\tvar _plugin = this.getPlugin(plugin);\n\t\treturn (_plugin) ? _plugin.is_loaded : false;\n\t}", "function isLoaded() {\n\t\tif (!qz) {\n\t\t\t$(\"textarea[name=qz_log]\").append('Błąd:\\n\\n\\tPlugin nie załadowany!\\n\\n');\n\t\t\treturn false;\n...
[ "0.64081365", "0.61041826", "0.6002885", "0.59783876", "0.5947421", "0.58591026", "0.585151", "0.58412254", "0.5797251", "0.5713137", "0.56983507", "0.56719375", "0.5666344", "0.5658617", "0.56186885", "0.56171304", "0.5542086", "0.550244", "0.5501173", "0.5489712", "0.548800...
0.7116367
0
this function checks if the responseArr is composed of only one value and if so, it responds with the value directly instead of an array
function respond(responseArr) { // if the responseArr.length is only 1, then just return the value if (responseArr.length == 1) { return responseArr[0]; } else if (responseArr.length == 0) { return false; } else if (responseArr.length > 1) { return responseArr; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkSingleResult(personArr) {\n if (personArr.length === 1) {\n return personArr[0];\n } else if (personArr.length > 1) {\n return personArr;\n } else {\n return undefined;\n }\n}", "serializeResponse(response) {\n let serializedResponse = [];\n response.flat().forEach((value) => {\n...
[ "0.6305824", "0.59983003", "0.5953395", "0.58245903", "0.56045973", "0.55827224", "0.55154824", "0.55133593", "0.54409546", "0.5395065", "0.5376187", "0.53353643", "0.5322064", "0.5320708", "0.5264524", "0.52426463", "0.52378625", "0.5216837", "0.51876867", "0.51859844", "0.5...
0.82032347
0
validates any object by verifying properties and respective typeofs
function validateObj(obj, props) { /* props: prop: typeof prop (str) */ _.each(props, function(expected_type, prop_name) { if (!obj[prop_name]) { throw new Error("There is no '" + prop_name + "' in " + obj); } var actual_type = typeof obj[prop_name]; if (actual_type != expect...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkObjType(objInput, objInputConstructor, blnAllowSubclasses) {\n\ttry {\n\t\t//call confirmObjType\n\t\tconfirmObjType(objInput, objInputConstructor, blnAllowSubclasses);\n\n\t\t//if we didn't get an error in that last call, return true\n\t\treturn true;\n\t} //end try\n\tcatch(e) {\n\t\t//if we got an...
[ "0.67605805", "0.6671769", "0.658265", "0.658265", "0.658265", "0.64553815", "0.64321786", "0.63539267", "0.6340567", "0.6313349", "0.6284291", "0.62703085", "0.6261584", "0.6260939", "0.62075245", "0.61487347", "0.6139118", "0.6126668", "0.61126244", "0.6078346", "0.6077611"...
0.7268857
0
function checks if is array or string
function arrStr(i) { /* i: - obj,* - funcs:* - str, * - arrItem, * - arr, * - objItem, - obj - context */ var type = typeof i.obj; if (type === 'string') { i.funcs.str.call(i.context, i.obj); } else if ( _.isArray(i.obj) ) { // the obj is an a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function is_array(input) {\n if (Object.prototype.toString.call(input) === \"[object Array]\") {\n return true;\n }\n return false;\n}", "function isArray(arg){if(Array.isArray){return Array.isArray(arg)}return objectToString(arg)===\"[object Array]\"}", "function arrayOrObject(collection) {\n let che...
[ "0.7474269", "0.7446007", "0.737766", "0.7310765", "0.72504807", "0.7238467", "0.7238467", "0.7238467", "0.7148844", "0.7111249", "0.71057", "0.7089098", "0.7089098", "0.70653623", "0.7056699", "0.7055281", "0.7013904", "0.7006366", "0.699254", "0.699254", "0.697542", "0.69...
0.0
-1
helper methods to update index and largest number
function updateLargest(threeLargest, num){ if (threeLargest[2] === null || num > threeLargest[2]) { shiftAndUpdate(threeLargest, num, 2) } else if (threeLargest[1] === null || num > threeLargest[1]) { shiftAndUpdate(threeLargest, num, 1) } else if (threeLargest[0] === null || num > threeLargest[0]) {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_incrementMaxIndex() {\n if (this._maxIndex < this._capacity) {\n this._maxIndex++;\n }\n }", "function sortBestWithHelper(numbers) {\n // run as many times as there are items\n for (let j = 0; j < numbers.length - 1; j++) {\n\n // FInd max number and max location startin...
[ "0.70324975", "0.6437116", "0.6355046", "0.6316196", "0.62738603", "0.62645966", "0.61846614", "0.61487174", "0.613015", "0.6112783", "0.6083152", "0.6037026", "0.598373", "0.59826046", "0.59777135", "0.5956391", "0.594035", "0.59181315", "0.5878598", "0.58643854", "0.5840504...
0.6551018
1
get events from the table, use dynamic loading if parameters sent
async getAll(params,res) { try{ let query = "SELECT * FROM events"; let queryParams = [ this.table ]; let result=null; if (params.from && params.to) { query += " WHERE end_date >= $1 AND start_date < $2"; ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadEvents() {\n API.getDj(user.sub)\n .then((res) => {\n setEvents(res.data[0].events);\n })\n .catch((err) => console.log(err));\n }", "getEventTickets(event_id: number, callback) {\n super.query(\n 'SELECT tt.name, tt.description, et.price, et.amount FROM ticket_type...
[ "0.6287962", "0.6232761", "0.61942", "0.6193533", "0.6176371", "0.60281634", "0.6021705", "0.601115", "0.600767", "0.5989134", "0.59423125", "0.59327424", "0.59212226", "0.59143263", "0.5860865", "0.58514374", "0.58453035", "0.58398205", "0.5839644", "0.5835115", "0.5772584",...
0.53676015
65
FUNCTIONS LOCAL PAGES / ADDPATIENT
function initAddPatientSection(){ /* * DEFINE ELEMNTS * */ $("#dob-value").datepicker({changeMonth: true,yearRange: "1900:"+moment().year(),dateFormat: "yy-mm-dd",changeYear: true}); $("#dod-value").datepicker({changeMonth: true,yearRange: "1900:"+moment().year(),dateFormat: "yy-mm-dd",changeYear: true})...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function directUserFromAddInfo() {\n if (nextStep == \"A new department\") {\n addDepartmenet();\n }\n if (nextStep == \"A new role\") {\n addRole();\n }\n if (nextStep == \"A new employee\") {\n addEmployee();\n } \n }", "function ad...
[ "0.6330101", "0.5837603", "0.57756674", "0.5770651", "0.5726353", "0.57023126", "0.5684879", "0.5630347", "0.55988955", "0.5593096", "0.55661494", "0.55120134", "0.5507637", "0.5470005", "0.54495776", "0.5424844", "0.5413861", "0.5401265", "0.5393135", "0.5377078", "0.5372579...
0.0
-1
Use game instead of this!!!
handlePlayerLoaded(player) { super.handlePlayerLoaded(); game.send_command('player_ready', {}); // This will make the new local player visible // to others connected people player.updateLocalPlayer(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Game(){\n\t}", "function Game() { }", "init(game) {\n\n }", "constructor(game) {\n this.realGame = game;\n }", "constructor(){\n this.current_game = new Game()\n }", "function draw(game)\n{\n game.draw();\n\n\n}", "function Game() {\n}", "tickCaller(game){\n game.tick();...
[ "0.7554368", "0.75157076", "0.7421584", "0.73103726", "0.73015237", "0.71959656", "0.71746236", "0.7135727", "0.7117998", "0.7105783", "0.70900565", "0.70756984", "0.70697933", "0.70497835", "0.70009834", "0.69940156", "0.699334", "0.6986827", "0.69805634", "0.69805634", "0.6...
0.0
-1
Use game instead of this!!!
handleRemotePlayerLoaded(player) { console.log(`REMOTE DATA LOADED : ${player.id}`); // Remove player from initialisingPlayers ... game.initialisingPlayers = game.initialisingPlayers.filter(p => p.id !== player.id); // ... and add it to remotePlayers game.remotePlayers.push(player); player.act...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Game(){\n\t}", "function Game() { }", "init(game) {\n\n }", "constructor(game) {\n this.realGame = game;\n }", "constructor(){\n this.current_game = new Game()\n }", "function draw(game)\n{\n game.draw();\n\n\n}", "function Game() {\n}", "tickCaller(game){\n game.tick();...
[ "0.75549275", "0.7516108", "0.7421812", "0.7310997", "0.7300724", "0.7195729", "0.7175309", "0.71374166", "0.71174663", "0.71063066", "0.7090485", "0.70752233", "0.70683473", "0.70494395", "0.70016855", "0.6993342", "0.6993145", "0.6986133", "0.69804376", "0.69804376", "0.694...
0.0
-1
Description of setup() goes here.
function setup() { createCanvas(640, 360); // Sets starting positions circle1.x = (1 / 3) * width; circle2.x = (2 / 3) * width; circle1.y = (1 / 2) * height; circle2.y = (1 / 2) * height; coin1.x = random(0, width); coin2.x = random(0, width); coin3.x = random(0, width); coin1.y = random(0, height...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setup() {}", "function _setup () {\n }", "setup() {}", "setup() {}", "setup() {}", "function setup() {\n\n\t\t\t\t\t}", "function Setup() {\n}", "setup(config) {\r\n setup(config);\r\n }", "async setup() { }", "function setup(args, ctx) {\n}", "function setUp()/* : voi...
[ "0.8834774", "0.8627692", "0.85742414", "0.85742414", "0.85742414", "0.85551745", "0.80747616", "0.8045414", "0.7929076", "0.77549374", "0.7411904", "0.7401294", "0.73824686", "0.73823124", "0.735559", "0.734193", "0.7257352", "0.72325295", "0.72285974", "0.72262245", "0.7199...
0.0
-1
Displays all songs via an array in the original order
function displaySongs(req, res) { //Variables let result = {}; try { //Define the song list for the session if (req.session.songs == undefined) { req.session.songs = []; } //Update the list result.songs = req.session.songs; } catch (e) { result = {'error' : e.message}; }...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadSongs() {\n if (!store.getItem('songs')) createStore()\n var songArray = JSON.parse(store.getItem('songs'))\n for (var i = 0; i < songArray.length; i++) {\n var para = document.createElement('P');\n var t = document.createTextNode(songArray[i]);\n para.appendChild(t);\n document.querySe...
[ "0.7292472", "0.7169897", "0.7026638", "0.7002446", "0.6969", "0.6888647", "0.68755096", "0.6795367", "0.67718273", "0.6707553", "0.66804564", "0.66161656", "0.65892446", "0.6566266", "0.65087295", "0.6494246", "0.647901", "0.64572096", "0.64492637", "0.64171606", "0.64163715...
0.0
-1
Displays a newly sorted array of songs
function displaySortedSongs(req, res) { //Variables let result = {}; try { //Define the song list for the session if (req.session.songs == undefined) { req.session.songs = []; } //Update the list result.songs = req.session.songs.sort(); } catch (e) { result = {'error' : ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displaySongs() {\n\t\trequire(['hbs!../templates/songs'],\n\t\t\tfunction(songTemplate){\n\t\t\t\t$(\".list-group\").html(songTemplate(songs));\n\t\t\t});\n\t}", "function loadSongs() {\n if (!store.getItem('songs')) createStore()\n var songArray = JSON.parse(store.getItem('songs'))\n for (var i = 0;...
[ "0.70974493", "0.6924097", "0.68510777", "0.67270774", "0.67269707", "0.6711948", "0.6643152", "0.65638113", "0.6524889", "0.65209985", "0.6428408", "0.63765", "0.6364345", "0.6327495", "0.63157904", "0.62903714", "0.62846166", "0.6260523", "0.6246376", "0.6244608", "0.622491...
0.6890205
2
Adds a song provided by the query string song=
function addSong(req, res) { //Variables let result = {}; try { //Define the song list for the session if (req.session.songs == undefined) { req.session.songs = []; } //Fail: No Song Provided if (req.query.song == undefined) { result = {result: "Please provide a song to add ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addSong(song) {\n if (!store.getItem('songs')) createStore()\n var songArray = JSON.parse(store.getItem('songs'))\n songArray.push(song)\n store.setItem('songs', JSON.stringify(songArray))\n}", "function addSongToDatabase(song) {\nsongDatabase.push(song);\n}", "async function addSong(song){\n ...
[ "0.7488415", "0.7119673", "0.70795494", "0.70412236", "0.69481176", "0.67735296", "0.67199606", "0.6706025", "0.66270685", "0.6627034", "0.6615287", "0.6597604", "0.65725166", "0.6550213", "0.6527974", "0.64736515", "0.6463582", "0.64618164", "0.6450533", "0.6434278", "0.6424...
0.69517624
4
Removes a song provided by the query string song=
function removeSong(req, res) { //Variables let result = {}; try { //Define the song list for the session if (req.session.songs == undefined) { req.session.songs = []; } //Fail: No Song Provided if (req.query.song == undefined) { result = {result: "Please provide a song to r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function removeSong(song) {\n if (!store.getItem('songs')) createStore()\n var songArray = JSON.parse(store.getItem('songs'))\n var index = songArray.indexOf(song)\n songArray.splice(index, 1)\n store.setItem('songs', JSON.stringify(songArray))\n}", "function removeSong() {\n}", "function removeFromPlayli...
[ "0.74934864", "0.74064374", "0.7100462", "0.7076179", "0.7050863", "0.6914642", "0.6848216", "0.681256", "0.673342", "0.6632651", "0.6621276", "0.66085017", "0.6435192", "0.6411206", "0.63503224", "0.63462543", "0.63183355", "0.6250903", "0.6239741", "0.6192751", "0.6145409",...
0.6954865
5
Clears all songs from the array
function clearSongs(req, res) { //Variables let result = {}; try { //Resets the session's songs req.session.songs = []; //Update the list result.songs = req.session.songs; } catch (e) { result = {'error' : e.message}; } //Respond with the data res.writeHead(200, {'Content-Type'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "clear() {\n this._array = []\n }", "function clearArray() {\n openCards.splice(0, 2);\n openClass.splice(0, 2);\n}", "function clearsongs() {\n fileinput.value = null;\n}", "function clearAll() {\n questionsAnswered = 0;\n trueAnswers = [];\n trueQuestions = [];\n userAnswers = [...
[ "0.707453", "0.69998467", "0.6886268", "0.6834943", "0.68268013", "0.68264335", "0.681796", "0.6742987", "0.66528064", "0.6633825", "0.661913", "0.6608206", "0.6603374", "0.658871", "0.656236", "0.65604967", "0.6530342", "0.6528085", "0.6521903", "0.65139335", "0.6512726", ...
0.0
-1
Define a custom compile so version can be got from inside the .styl
function stylusCompile(str, path) { return stylus(str) .set('filename', path) .set('warn', true) .set('compress', true) .define('versionPath', function(urlPath) { return new stylus.nodes.Literal('url(' + basic.versionPath(urlPath) + ')'); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function VersionCompiler() {\n}", "function compile() {\n\n}", "function compile(str, path) {\n return stylus(str)\n .set('filename', path)\n .use(nib())\n .use(bootstrap())\n }", "function compile(str, path) {\n return stylus(str)\n .set('filename', path)\n .use(nib());...
[ "0.6951369", "0.639741", "0.6349832", "0.63063073", "0.62982917", "0.628191", "0.628191", "0.62576216", "0.62258893", "0.5985994", "0.5884282", "0.58336663", "0.573562", "0.56699944", "0.5651334", "0.5549236", "0.5539362", "0.55377406", "0.5529545", "0.5520207", "0.55184925",...
0.62051255
9
Function invoked when the user presses the 'OK' button. If the url could not be parsed, returns the unmodified url. If url was successfully parsed, builds a new embedding url for the video id with the user specified options encoded as query parameters.
function done() { if (!video_id) resolve(url_typed); var result_url = 'https://www.youtube.com/embed/' + video_id; var looping = false; var playlist_set = false; parameters.forEach(function(parameter, index) { var element = document.getElementById(parameter.name); var value_string = Getter[parame...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function urlWithoutEmbed() {\n if (window.location.href.includes(\"?embed=true&\")) {\n return window.location.href.replace(\"embed=true&\", \"\");\n } else if (window.location.href.includes(\"?embed=true\")) {\n return window.location.href.replace(\"?embed=true\", \"\");\n ...
[ "0.57287914", "0.5561203", "0.5534986", "0.5516779", "0.5480396", "0.547358", "0.5412666", "0.539744", "0.538567", "0.538366", "0.5352746", "0.5301486", "0.5215688", "0.51289093", "0.50718784", "0.505155", "0.5047729", "0.50289035", "0.5010484", "0.4981329", "0.49515396", "...
0.5856019
0
CORS POST / UPDATE
function CorsPostRequest(url,param){ var xhr = createCORSRequest('POST', url); if (!xhr) { sciMonk.REST.requestError = true; serverMessage('Cannot connect to server: CORS not supported'); return; } // Response handlers. xhr.onload = function() { sciMonk.REST.responseText = xhr.resp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function cors(req, res, next){\n res.header(\"Access-Control-Allow-Origin\", \"*\");\n \tres.header(\"Access-Control-Allow-Headers\", \"Origin, X-Requested-With, Content-Type, Accept\");\n \tres.header(\"Access-Control-Allow-Methods\", \"GET,POST,DELETE,OPTIONS,PUT\");\n \tnext();\n}", "_enableCORS() {\n ...
[ "0.64753056", "0.6332621", "0.6301261", "0.62385875", "0.6196859", "0.61445236", "0.6121222", "0.61194444", "0.6095752", "0.60898834", "0.6087706", "0.6003854", "0.59945226", "0.5980764", "0.5975146", "0.594195", "0.59365904", "0.5935383", "0.5931528", "0.58994764", "0.589062...
0.64900076
0
the default way content scripts work. To get around this, include this file as a content script before your main file and implement the functions onPageLoad: called when a new page is loaded removeAddedNodes: this should remove any nodes you previously added to the DOM. This is necessary because page state isn't clean ...
function _onPageLoadOuter() { // Back-forward navigation can add nodes: create a clean slate. removeAddedNodes(); // defined by application. onPageLoad(); // defined by application. }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drupalgap_remove_pages_from_dom() {\n try {\n var current_page_id = drupalgap_get_page_id(drupalgap_path_get());\n $.each(drupalgap.pages, function(index, page_id) {\n if (current_page_id != page_id) {\n $('#' + page_id).empty().remove();\n }\n });\n // Reset drupalgap....
[ "0.66361266", "0.6557486", "0.6404106", "0.6232471", "0.61206084", "0.61167663", "0.60788494", "0.6000758", "0.59968716", "0.59932107", "0.594591", "0.5911016", "0.5906929", "0.58990633", "0.58798045", "0.5868411", "0.58619684", "0.58268136", "0.5823638", "0.57684386", "0.575...
0.697958
0
window.location is an object so we convert it to a string to copy it.
function _getLocation() { return "" + window.location; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getURL(){\n\treturn window.location;\n}", "function copyUrl() {\n let dummy = document.createElement('input');\n url = window.location.href;\n\n document.body.appendChild(dummy);\n dummy.value = url;\n dummy.select();\n document.execCommand('copy');\n document.body.removeChild(dummy...
[ "0.66421205", "0.66095334", "0.6474175", "0.6474175", "0.6474175", "0.6474175", "0.6474175", "0.6474175", "0.6474175", "0.6474175", "0.6474175", "0.6474175", "0.6474175", "0.6474175", "0.6474175", "0.6474175", "0.6474175", "0.6419052", "0.6373508", "0.6373508", "0.62449604", ...
0.73245585
0
const LoginAction = require('./action/loginAction'); const LoginStore = require('./store/loginStore'); const connectToStores = require("altutils/lib/connectToStores");
function requireLogin(nextState, replace){ let data = window._test_data; let isLogin = !!data; if(!isLogin){ if(window.__needReloadForLogin){ // replace(null, nextState.location.pathname); window.location.reload(); } else { replace({nextState: nextState},...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mapStoreToProps(store) {\n\n return {\n \n email: store.login.email,\n password: store.login.password,\n userToken: store.login.userToken,\n userId: store.login.userId\n}\n}", "static connectStore(reduxStore) {\n store = reduxStore;\n }", "function mapStateToProps(state){\n ...
[ "0.6047758", "0.59886855", "0.5966111", "0.5894237", "0.5851572", "0.57112163", "0.5676154", "0.5656509", "0.56149983", "0.55538857", "0.5527033", "0.5511409", "0.5503473", "0.54855204", "0.54574513", "0.54552853", "0.5451972", "0.5449893", "0.5435253", "0.54126227", "0.54067...
0.0
-1
Gets the count of active workers
function numWorkers() { return Object.keys(cluster.workers).length; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function numWorkers() { return workerIds().length }", "get workerCount() {\n return this.workerSet.workerCount;\n }", "function countActiveJobs () {\r\n return state.jobs.reduce((count, job) => {\r\n if (job.state === 'active') {\r\n count++;\r\n }\r\n return count;\r\n }, 0);\r\n}", ...
[ "0.83580637", "0.754862", "0.7341774", "0.71575284", "0.69782984", "0.6582715", "0.6559634", "0.64817315", "0.6387161", "0.6326921", "0.6277642", "0.6212495", "0.61883545", "0.6182782", "0.61376804", "0.61258733", "0.6099534", "0.60541546", "0.6013619", "0.6011612", "0.600666...
0.7999584
1
Forks off the workers unless the server is stopping
function forkNewWorkers() { if (!stopping) { for (var i = numWorkers(); i < workerCount; i++) { console.log(chalk.gray('forking...')); const worker = cluster.fork(); worker.on('message', function (msg) { console.log(chalk.white.bgBlue(`Master ${process.pi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function forkNewWorkers() {\n var sWho = \"boot.js: forkNewWorkers\";\n if (!stopping) {\n for (var i = numWorkers(); i < numCpus; i++) {\n\t\tconsole.log(sWho + \"(): fork()-ing a new worker...\");\n\t\tcluster.fork()\n\t}\n }\n}", "run() {\n this.forkWorkers()\n }", "forkWorkers() {\n for (var i...
[ "0.731595", "0.7109889", "0.71097976", "0.7064868", "0.6994232", "0.6973574", "0.6790081", "0.67695236", "0.67355293", "0.6664275", "0.65941924", "0.655695", "0.6416329", "0.63516295", "0.62987286", "0.6219141", "0.6072899", "0.60349226", "0.60309535", "0.6003457", "0.6002008...
0.74711
0
Stops a single worker Gives 60 seconds after disconnect before SIGTERM
function stopWorker(worker) { console.log(chalk.yellow('stopping', worker.process.pid)); worker.disconnect(); var killTimer = setTimeout(function () { worker.kill(); }, 5000); // Ensure we don't stay up just for this setTimeout killTimer.unref(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function stopWorker(worker) {\n console.log('stopping', worker.process.pid)\n worker.disconnect()\n var killTimer = setTimeout(function() {\n worker.kill()\n }, 60000)\n\n // Ensure we don't stay up just for this setTimeout\n killTimer.unref()\n}", "function disconnectAndShutdownWorker(worker) {\n fu...
[ "0.7825162", "0.7318109", "0.7220068", "0.7074914", "0.6945196", "0.69246006", "0.6922077", "0.688012", "0.6871072", "0.66063356", "0.65791094", "0.6571469", "0.6537545", "0.6428104", "0.6351187", "0.6313633", "0.63082", "0.6290078", "0.62726057", "0.62427443", "0.6193582", ...
0.783318
0
Tell the next worker queued to restart to disconnect This will allow the process to finish it's work for 60 seconds before sending SIGTERM
function stopNextWorker() { var i = workersToStop.pop(); var worker = cluster.workers[i]; if (worker) stopWorker(worker); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "disconnect() {\n if (!cluster.isMaster) {\n throw new Error('Try disconnect from worker process');\n }\n\n if (!this._disconnecting) {\n this._disconnecting = true;\n\n this._log('disconnecting');\n\n // Max wait time\n let timeout = setTi...
[ "0.7130043", "0.66820556", "0.65576875", "0.64371365", "0.6423497", "0.6400523", "0.62965995", "0.6202903", "0.6131786", "0.6063102", "0.6042847", "0.6042847", "0.6042847", "0.60302085", "0.60239446", "0.60124516", "0.60066783", "0.6002531", "0.5989391", "0.5968759", "0.59650...
0.5836033
26
Stops all the works at once
function stopAllWorkers() { stopping = true; console.log(chalk.yellow('stopping all workers...')); for (var id in cluster.workers) { stopWorker(cluster.workers[id]); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "stop() {\n if (!this.running) {\n return;\n }\n\n this.running = false;\n\n for (const worker of this.workers) {\n worker.stop();\n }\n }", "stop() {\n this.finishAll();\n }", "stopAll() {\n this.clearQueue();\n this.stop();\n }", "stopCurrentWork() {\n ...
[ "0.80391747", "0.7876052", "0.7527383", "0.75140464", "0.7460689", "0.7254775", "0.72180253", "0.72119874", "0.71695745", "0.70592314", "0.7048369", "0.69891804", "0.6988399", "0.6950535", "0.68958104", "0.68913776", "0.6876036", "0.6872986", "0.6862728", "0.68607444", "0.683...
0.6528681
57