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
(protected) r = this >> nDB
function bnpDRShiftTo(n,r) { for(var i = n; i < this.t; ++i) r[i-n] = this[i]; r.t = Math.max(this.t-n,0); r.s = this.s; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get record() {\n return new B_Record(this.get_record_bin());\n }", "get db() {\n return this._db;\n }", "function SDB(state) {\n var stack = state.stack;\n var n = stack.pop();\n\n if (exports.DEBUG) {\n console.log(state.step, 'SDB[]'...
[ "0.5854444", "0.57315916", "0.5527455", "0.54902464", "0.5453797", "0.5433116", "0.541026", "0.53947645", "0.5382679", "0.5362607", "0.5358324", "0.53390104", "0.5283285", "0.5275703", "0.52659714", "0.52251416", "0.5208499", "0.5181765", "0.5149001", "0.51464134", "0.5127945...
0.0
-1
(protected) r = this << n
function bnpLShiftTo(n,r) { var bs = n%this.DB; var cbs = this.DB-bs; var bm = (1<<cbs)-1; var ds = Math.floor(n/this.DB), c = (this.s<<bs)&this.DM, i; for(i = this.t-1; i >= 0; --i) { r[i+ds+1] = (this[i]>>cbs)|c; c = (this[i]&bm)<<bs; } for(i = ds-1; i >= 0; --i) r[i] = 0; r[ds] = c; r.t = this.t+ds+1; r.s = this.s; r.clamp(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "0x20(){return a << b}", "function rotr(x, n) {\n return x << (32 - n) | x >>> n;\n}", "function bnpRShiftTo(n, r) {\n\t var self = this\n\t r.s = self.s\n\t var ds = Math.floor(n / self.DB)\n\t if (ds >= self.t) {\n\t r.t = 0\n\t return\n\t }\n\t var bs = n % self.DB\n\t var cbs = self.DB - bs\...
[ "0.6666154", "0.65684676", "0.6520716", "0.6520716", "0.6455233", "0.6428054", "0.642265", "0.6422008", "0.6422008", "0.6422008", "0.6422008", "0.6422008", "0.6422008", "0.6422008", "0.6385195", "0.63797104", "0.63715786", "0.63637096", "0.63637096", "0.63637096", "0.6348662"...
0.0
-1
(protected) r = this >> n
function bnpRShiftTo(n,r) { r.s = this.s; var ds = Math.floor(n/this.DB); if(ds >= this.t) { r.t = 0; return; } var bs = n%this.DB; var cbs = this.DB-bs; var bm = (1<<bs)-1; r[0] = this[ds]>>bs; for(var i = ds+1; i < this.t; ++i) { r[i-ds-1] |= (this[i]&bm)<<cbs; r[i-ds] = this[i]>>bs; } if(bs > 0) r[this.t-ds-1] |= (this.s&bm)<<cbs; r.t = this.t-ds; r.clamp(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rotr(x, n) {\n return x << (32 - n) | x >>> n;\n}", "function rotl(x, n) {\n return x << n | x >>> (32 - n);\n}", "function rotl(x, n) {\n return (x << n) | (x >>> (32 - n));\n}", "function rotl( x, n ) {\n return ( x >>> ( 32 - n ) ) | ( x << n );\n }", "function rotl(x, n) {\n re...
[ "0.6944473", "0.6758659", "0.67397445", "0.67136276", "0.66858965", "0.6510775", "0.6510775", "0.6424868", "0.6424868", "0.6424868", "0.6424868", "0.6424868", "0.6424868", "0.6424868", "0.63862187", "0.635912", "0.6358895", "0.6358895", "0.6358895", "0.6343444", "0.6343444", ...
0.6228594
77
(protected) r = this a
function bnpSubTo(a,r) { var i = 0, c = 0, m = Math.min(a.t,this.t); while(i < m) { c += this[i]-a[i]; r[i++] = c&this.DM; c >>= this.DB; } if(a.t < this.t) { c -= a.s; while(i < this.t) { c += this[i]; r[i++] = c&this.DM; c >>= this.DB; } c += this.s; } else { c += this.s; while(i < a.t) { c -= a[i]; r[i++] = c&this.DM; c >>= this.DB; } c -= a.s; } r.s = (c<0)?-1:0; if(c < -1) r[i++] = this.DV+c; else if(c > 0) r[i++] = c; r.t = i; r.clamp(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function A() {\n r.call(this);\n }", "function z(){r.call(this)}", "get a() {\n\t\treturn this._a_;\n\t}", "get a() {\n\t\treturn this._a_;\n\t}", "get a() {\n return this._a_;\n }", "setR(r) {\nthis._r = r;\nreturn this;\n}", "ap(r) {\n return ap(this, r);\n }", "ap(r) {\n ...
[ "0.7887505", "0.6961472", "0.6889745", "0.6889745", "0.6741326", "0.67147154", "0.6645265", "0.6645265", "0.65065205", "0.64600086", "0.6406615", "0.6406615", "0.6406615", "0.6406615", "0.6406615", "0.6406615", "0.6406615", "0.6406615", "0.6406615", "0.6406615", "0.6406615", ...
0.0
-1
(protected) r = this a, r != this,a (HAC 14.12) "this" should be the larger one if appropriate.
function bnpMultiplyTo(a,r) { var x = this.abs(), y = a.abs(); var i = x.t; r.t = i+y.t; while(--i >= 0) r[i] = 0; for(i = 0; i < y.t; ++i) r[i+x.t] = x.am(0,y[i],r,i,0,x.t); r.s = 0; r.clamp(); if(this.s != a.s) BigInteger.ZERO.subTo(r,r); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function self($this) {\n\treturn $this;\n}", "subUnsafe(other) { return this.#sub(other); }", "function z(){r.call(this)}", "setR(r) {\nthis._r = r;\nreturn this;\n}", "function Y(){var e=a();return this.copyTo(e),e}", "function G(){var t=a();return this.copyTo(t),t}", "function f() { \"use strict\"; r...
[ "0.6002266", "0.58763033", "0.56839097", "0.56422764", "0.5565282", "0.5562465", "0.5532877", "0.55160415", "0.5507149", "0.54126394", "0.53935885", "0.53935885", "0.5385262", "0.5385262", "0.5344674", "0.5344674", "0.5344674", "0.5344674", "0.5344674", "0.5344674", "0.534467...
0.0
-1
(protected) r = this^2, r != this (HAC 14.16)
function bnpSquareTo(r) { var x = this.abs(); var i = r.t = 2*x.t; while(--i >= 0) r[i] = 0; for(i = 0; i < x.t-1; ++i) { var c = x.am(i,x[i],r,2*i,0,1); if((r[i+x.t]+=x.am(i+1,2*x[i],r,2*i+1,c,x.t-i-1)) >= x.DV) { r[i+x.t] -= x.DV; r[i+x.t+1] = 1; } } if(r.t > 0) r[r.t-1] += x.am(i,x[i],r,2*i,0,1); r.s = 0; r.clamp(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "XOR_R(r1){\n this.register_A = r1 ^ this.register_A;\n this.zero_flag = this.register_A === 0;\n this.carry_flag = false;\n this.subtraction_flag = false;\n this.half_carry_flag = false;\n }", "RR_R(r1){\n let lo = r1 & 0x1;\n let hi = r1 >> 1;\n let rt = (lo << (BITS_A...
[ "0.6440434", "0.62129754", "0.61445135", "0.61389476", "0.61136216", "0.6075788", "0.60501647", "0.60054326", "0.59395623", "0.5917619", "0.5917619", "0.5880961", "0.5858079", "0.5826148", "0.57878315", "0.5736276", "0.5735339", "0.5718753", "0.5687484", "0.5650332", "0.56460...
0.0
-1
(protected) divide this by m, quotient and remainder to q, r (HAC 14.20) r != q, this != m. q or r may be null.
function bnpDivRemTo(m,q,r) { var pm = m.abs(); if(pm.t <= 0) return; var pt = this.abs(); if(pt.t < pm.t) { if(q != null) q.fromInt(0); if(r != null) this.copyTo(r); return; } if(r == null) r = nbi(); var y = nbi(), ts = this.s, ms = m.s; var nsh = this.DB-nbits(pm[pm.t-1]); // normalize modulus if(nsh > 0) { pm.lShiftTo(nsh,y); pt.lShiftTo(nsh,r); } else { pm.copyTo(y); pt.copyTo(r); } var ys = y.t; var y0 = y[ys-1]; if(y0 == 0) return; var yt = y0*(1<<this.F1)+((ys>1)?y[ys-2]>>this.F2:0); var d1 = this.FV/yt, d2 = (1<<this.F1)/yt, e = 1<<this.F2; var i = r.t, j = i-ys, t = (q==null)?nbi():q; y.dlShiftTo(j,t); if(r.compareTo(t) >= 0) { r[r.t++] = 1; r.subTo(t,r); } BigInteger.ONE.dlShiftTo(ys,t); t.subTo(y,y); // "negative" y so we can replace sub with am later while(y.t < ys) y[y.t++] = 0; while(--j >= 0) { // Estimate quotient digit var qd = (r[--i]==y0)?this.DM:Math.floor(r[i]*d1+(r[i-1]+e)*d2); if((r[i]+=y.am(0,qd,r,j,0,ys)) < qd) { // Try it out y.dlShiftTo(j,t); r.subTo(t,r); while(r[i] < --qd) r.subTo(t,r); } } if(q != null) { r.drShiftTo(ys,q); if(ts != ms) BigInteger.ZERO.subTo(q,q); } r.t = ys; r.clamp(); if(nsh > 0) r.rShiftTo(nsh,r); // Denormalize remainder if(ts < 0) BigInteger.ZERO.subTo(r,r); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bnpDivRemTo(m, q, r) {\n\t var self = this\n\t var pm = m.abs()\n\t if (pm.t <= 0) return\n\t var pt = self.abs()\n\t if (pt.t < pm.t) {\n\t if (q != null) q.fromInt(0)\n\t if (r != null) self.copyTo(r)\n\t return\n\t }\n\t if (r == null) r = new BigInteger()\n\t var y = new BigInteger(),...
[ "0.7361538", "0.7361538", "0.73573184", "0.7326463", "0.7326463", "0.7326463", "0.7326463", "0.7326463", "0.7326463", "0.7326463", "0.7326463", "0.7326463", "0.7326463", "0.7326463", "0.7326463", "0.7326463", "0.7326463", "0.7326463", "0.7326463", "0.7326463", "0.7326463", ...
0.7306327
56
(public) this mod a
function bnMod(a) { var r = nbi(); this.abs().divRemTo(a,null,r); if(this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r,r); return r; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get a() {\n\t\treturn this._a_;\n\t}", "get a() {\n\t\treturn this._a_;\n\t}", "get a() {\n return this._a_;\n }", "function ai(a) {\n this.m = a\n}", "function M(){this.a={}}", "set a(val) {\n\t\tthis._a_ = val * 2;\n\t}", "set a(val) {\n\t\tthis._a_ = val * 2;\n\t}", "function w(){this.a={...
[ "0.71102196", "0.71102196", "0.6818816", "0.6425755", "0.6398882", "0.61737627", "0.61737627", "0.6133958", "0.61257035", "0.6110084", "0.6063708", "0.6057419", "0.59832966", "0.59351337", "0.58691454", "0.5861765", "0.58456826", "0.5839061", "0.57936484", "0.57804126", "0.57...
0.0
-1
Modular reduction using "classic" algorithm
function Classic(m) { this.m = m; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function montReduce(x) {\n while (x.t <= this.mt2) {\n // pad x so am has enough room later\n x[x.t++] = 0;\n }for (var i = 0; i < this.m.t; ++i) {\n // faster way of calculating u0 = x[i]*mp mod DV\n var j = x[i] & 0x7fff;\n var u0 = j * this.mpl + ((j * this.mph + (x[i] >> 15) * th...
[ "0.6492456", "0.6492456", "0.6492456", "0.6478665", "0.6478665", "0.64568865", "0.64568865", "0.64568865", "0.64568865", "0.64568865", "0.64568865", "0.64568865", "0.64568865", "0.64568865", "0.64568865", "0.64568865", "0.64568865", "0.64568865", "0.64568865", "0.64568865", "...
0.0
-1
(protected) return "1/this % 2^DB"; useful for Mont. reduction justification: xy == 1 (mod m) xy = 1+km xy(2xy) = (1+km)(1km) x[y(2xy)] = 1k^2m^2 x[y(2xy)] == 1 (mod m^2) if y is 1/x mod m, then y(2xy) is 1/x mod m^2 should reduce x and y(2xy) by m^2 at each step to keep size bounded. JS multiply "overflows" differently from C/C++, so care is needed here.
function bnpInvDigit() { if(this.t < 1) return 0; var x = this[0]; if((x&1) == 0) return 0; var y = x&3; // y == 1/x mod 2^2 y = (y*(2-(x&0xf)*y))&0xf; // y == 1/x mod 2^4 y = (y*(2-(x&0xff)*y))&0xff; // y == 1/x mod 2^8 y = (y*(2-(((x&0xffff)*y)&0xffff)))&0xffff; // y == 1/x mod 2^16 // last step - calculate inverse mod DV directly; // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints y = (y*(2-x*y%this.DV))%this.DV; // y == 1/x mod 2^dbits // we really want the negative inverse, and -DV < y < DV return (y>0)?this.DV-y:-y; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bnModPow(e, m) {\n var i = e.bitLength(), k, r = nbv(1), z;\n if (i <= 0) return r;\n else if (i < 18) k = 1;\n else if (i < 48) k = 3;\n else if (i < 144) k = 4;\n else if (i < 768) k = 5;\n else k = 6;\n if (i < 8)\n z = new Classic(m);\n else if (m.isEven())\n z...
[ "0.6254393", "0.61926866", "0.61926866", "0.61926866", "0.61926866", "0.61926866", "0.61926866", "0.61926866", "0.612913", "0.612913", "0.6126345", "0.61167604", "0.608618", "0.60735345", "0.60735345", "0.60735345", "0.60735345", "0.60735345", "0.60735345", "0.60735345", "0.6...
0.0
-1
x = x/R mod m (HAC 14.32)
function montReduce(x) { while(x.t <= this.mt2) // pad x so am has enough room later x[x.t++] = 0; for(var i = 0; i < this.m.t; ++i) { // faster way of calculating u0 = x[i]*mp mod DV var j = x[i]&0x7fff; var u0 = (j*this.mpl+(((j*this.mph+(x[i]>>15)*this.mpl)&this.um)<<15))&x.DM; // use am to combine the multiply-shift-add into one call j = i+this.m.t; x[j] += this.m.am(0,u0,x,i,0,this.m.t); // propagate carry while(x[j] >= x.DV) { x[j] -= x.DV; x[++j]++; } } x.clamp(); x.drShiftTo(this.m.t,x); if(x.compareTo(this.m) >= 0) x.subTo(this.m,x); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mod(x, m) {\n return ((x % m) + m) % m;\n}", "function mod(x, m) {\n return ((x % m) + m) % m;\n}", "function mod (num, m) { return ((num % m) + m) % m; }", "function mod (num, m) { return ((num % m) + m) % m; }", "function mod (num, m) { return ((num % m) + m) % m; }", "function gmod(n,m){ re...
[ "0.7431943", "0.7431943", "0.693809", "0.693809", "0.693809", "0.690342", "0.67674375", "0.67412084", "0.6713338", "0.66939044", "0.6662061", "0.6656487", "0.6656487", "0.6651071", "0.66479003", "0.6630517", "0.66261876", "0.66261876", "0.6622791", "0.6610281", "0.6607287", ...
0.0
-1
r = "x^2/R mod m"; x != r
function montSqrTo(x,r) { x.squareTo(r); this.reduce(r); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function mod(x, m) {\n return ((x % m) + m) % m;\n}", "function mod(x, m) {\n return ((x % m) + m) % m;\n}", "stringX() {return this.x - 0.5*this.r/2;}", "function modinv(x, m)\n{\n // calculate a,b such that a*x+b*m = g\n var [g, a, b] = GCD(x,m);\n if (a<numzero(a)) return a+m;\n return a;\n}...
[ "0.57992804", "0.57992804", "0.5396208", "0.53722554", "0.5308139", "0.5304197", "0.5266612", "0.5257362", "0.52149075", "0.5205655", "0.51960933", "0.51890075", "0.51733774", "0.51677334", "0.51573604", "0.5148757", "0.5148757", "0.5148757", "0.51472664", "0.5130833", "0.512...
0.0
-1
r = "xy/R mod m"; x,y != r
function montMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function r(r,o,a,s){e=r,t=a,n=-3*r+3*o-2*a-s,i=2*r-2*o+a+s}", "function r(o,M){var D=o.split(\"_\");return M%10==1&&M%100!=11?D[0]:M%10>=2&&M%10<=4&&(M%100<10||M%100>=20)?D[1]:D[2]}", "function mod(x, m) {\n return ((x % m) + m) % m;\n}", "function mod(x, m) {\n return ((x % m) + m) % m;\n}", "stringX() ...
[ "0.53772426", "0.53148067", "0.52019477", "0.52019477", "0.5154438", "0.51277965", "0.5037556", "0.5004299", "0.49786752", "0.49475902", "0.49295637", "0.49295637", "0.48907468", "0.48874667", "0.48766735", "0.487025", "0.48661304", "0.4852779", "0.48273948", "0.48214242", "0...
0.0
-1
(protected) true iff this is even
function bnpIsEven() { return ((this.t>0)?(this[0]&1):this.s) == 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "isEven() {\n return (this.low & 1) === 0;\n }", "function bnpIsEven() {\n return ((this.t > 0) ? (this[0] & 1) : this.s) == 0;\n }", "function bnpIsEven() {\n return ((this.t > 0) ? (this[0] & 1) : this.s) == 0;\n }", "function bnpIsEven() {\n return ((this.t > 0) ? (...
[ "0.8406392", "0.7872265", "0.7872265", "0.78625864", "0.7857068", "0.7857068", "0.7834824", "0.7834824", "0.7834824", "0.7828928", "0.7742386", "0.7742386", "0.7728565", "0.7652589", "0.76503295", "0.7644145", "0.7640417", "0.7629148", "0.7629148", "0.7629148", "0.7629148", ...
0.78499377
60
(protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79)
function bnpExp(e,z) { if(e > 0xffffffff || e < 1) return BigInteger.ONE; var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1; g.copyTo(r); while(--i >= 0) { z.sqrTo(r,r2); if((e&(1<<i)) > 0) z.mulTo(r2,g,r); else { var t = r; r = r2; r2 = t; } } return z.revert(r); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sqr(number) { return number * number}", "function mulberry32(a) {\n return function() {\n a |= 0; a = a + 0x6D2B79F5 | 0;\n var t = Math.imul(a ^ a >>> 15, 1 | a);\n t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t;\n return ((t ^ t >>> 14) >>> 0) / 4294967296;\n }\n}", "function b...
[ "0.67812824", "0.6721616", "0.667814", "0.66451985", "0.6640544", "0.6640189", "0.66384405", "0.66384405", "0.6610541", "0.65880716", "0.65880716", "0.6586046", "0.6586046", "0.65848553", "0.65848553", "0.65848553", "0.65848553", "0.65848553", "0.65848553", "0.65848553", "0.6...
0.0
-1
(public) this^e % m, 0 <= e < 2^32
function bnModPowInt(e,m) { var z; if(e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m); return this.exp(e,z); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bnModPow(e, m) {\n var i = e.bitLength(),\n k,\n r = nbv(1),\n z;\n if (i <= 0) return r;else if (i < 18) k = 1;else if (i < 48) k = 3;else if (i < 144) k = 4;else if (i < 768) k = 5;else k = 6;\n if (i <...
[ "0.76256883", "0.7625084", "0.7625084", "0.7617418", "0.7617418", "0.75928855", "0.75928855", "0.7591833", "0.7582333", "0.7582333", "0.7581249", "0.7574761", "0.7574761", "0.7574761", "0.757351", "0.7573405", "0.7567553", "0.7567553", "0.75670266", "0.75584406", "0.75584406"...
0.75539356
64
jsbn2 stuff (protected) convert from radix string
function bnpFromRadix(s,b) { this.fromInt(0); if(b == null) b = 10; var cs = this.chunkSize(b); var d = Math.pow(b,cs), mi = false, j = 0, w = 0; for(var i = 0; i < s.length; ++i) { var x = intAt(s,i); if(x < 0) { if(s.charAt(i) == "-" && this.signum() == 0) mi = true; continue; } w = b*w+x; if(++j >= cs) { this.dMultiply(d); this.dAddOffset(w,0); j = 0; w = 0; } } if(j > 0) { this.dMultiply(Math.pow(b,j)); this.dAddOffset(w,0); } if(mi) BigInteger.ZERO.subTo(this,this); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function h$ghcjsbn_tmp_toJSBN(b) {\n var j = new BigInteger(), bl = b[0], i;\n for(i = 0; i < bl; i++) j.data[i] = b[i+1];\n j.s = 0;\n j.t = bl;\n return j;\n/* ASSERTVALID_B(b, \"toJSBN\");\n var j0 = new BigInteger();\n var j1 = new BigInteger();\n var j2 = new BigInteger();\n for(var i = b[0]; i > 0;...
[ "0.68604124", "0.68604124", "0.68604124", "0.68604124", "0.68604124", "0.64310926", "0.64113057", "0.6407487", "0.6394752", "0.6377339", "0.63687086", "0.6362644", "0.63492346", "0.6335809", "0.6303014", "0.6294572", "0.6294572", "0.6294572", "0.6294572", "0.6294572", "0.6294...
0.0
-1
(protected) return x s.t. r^x < DV
function bnpChunkSize(r) { return Math.floor(Math.LN2*this.DB/Math.log(r)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static approxEq(x, y) {\nvar DIFF, EPS, SIZE;\n//--------\nEPS = 5e-5;\nDIFF = Math.abs(x - y);\nSIZE = Math.max(Math.abs(x), Math.abs(y));\nif (SIZE <= 1) {\nreturn DIFF < EPS;\n} else {\nreturn DIFF / SIZE < EPS;\n}\n}", "function verifSide(actX,i,valX,max)\n{\n return (((actX+(i*25)+valX)<0)||((actX+(i*2...
[ "0.6147133", "0.6013874", "0.56987005", "0.5673543", "0.5669797", "0.56438255", "0.56329846", "0.563259", "0.56303006", "0.5597823", "0.5556644", "0.55256087", "0.5523057", "0.55152833", "0.5509554", "0.54912525", "0.54801095", "0.5468122", "0.54615235", "0.54615235", "0.5453...
0.0
-1
(public) 0 if this == 0, 1 if this > 0
function bnSigNum() { if(this.s < 0) return -1; else if(this.t <= 0 || (this.t == 1 && this[0] <= 0)) return 0; else return 1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "isZero() {\n return this.value == 0;\n }", "function o0(o1, o2) {\n try {\nreturn --this.o655 == 0;\n}catch(e){}\n}", "isZero() { return (this.#val === BN_0); }", "isZero() {\n return this.high === 0 && this.low === 0;\n }", "sol() { return this.pos == 0; }", "get negative () {\n retu...
[ "0.6416564", "0.62657714", "0.59058076", "0.5873262", "0.5860204", "0.58478665", "0.5802061", "0.57786113", "0.56696266", "0.5641842", "0.5641503", "0.56346637", "0.55556726", "0.55554295", "0.5511258", "0.5456321", "0.5445312", "0.53759646", "0.53730774", "0.5371902", "0.534...
0.0
-1
(protected) this = n, this >= 0, 1 < n < DV
function bnpDMultiply(n) { this[this.t] = this.am(0,n-1,this,0,0,this.t); ++this.t; this.clamp(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "n(val) {\n this._n = val;\n return this;\n }", "function N(a){n(this,a)}", "get(){return this[n]}", "set next(n) {\t\t\t\t\t\t// configura novo valor de n, somente se for > do que o atual\n\t\tif (n > this.$n) this.$n = n;\n\t}", "static constrain(v){\r\n while(v<0){v+=1;}\r\n while(v>...
[ "0.607401", "0.6002053", "0.5899723", "0.57966125", "0.56439304", "0.5593456", "0.54900944", "0.54356056", "0.54285955", "0.5386609", "0.53530186", "0.5340947", "0.532861", "0.53038377", "0.53038377", "0.53038377", "0.53038377", "0.53038377", "0.53038377", "0.53038377", "0.53...
0.0
-1
(protected) this += n = 0
function bnpDAddOffset(n,w) { if(n == 0) return; while(this.t <= w) this[this.t++] = 0; this[w] += n; while(this[w] >= this.DV) { this[w] -= this.DV; if(++w >= this.t) this[this.t++] = 0; ++this[w]; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "undefined(state, n) {\n state.a += n;\n }", "increment() {\n\t\t++this.amount;\n\t}", "get next() { return this.$n++; }", "function incrementer(n) { afficher(index += n); }", "function addOne(n){\n return n += 1;\n}", "increment() {\n this[$referenceCount]++;\n }", "function...
[ "0.7729201", "0.6934396", "0.6877341", "0.6817428", "0.6811031", "0.6782622", "0.67658055", "0.67545086", "0.6618305", "0.6539163", "0.6507117", "0.6470742", "0.64438957", "0.64383954", "0.6329764", "0.6280653", "0.6277563", "0.62544596", "0.6246216", "0.6219666", "0.61992097...
0.0
-1
(protected) convert to radix string
function bnpToRadix(b) { if(b == null) b = 10; if(this.signum() == 0 || b < 2 || b > 36) return "0"; var cs = this.chunkSize(b); var a = Math.pow(b,cs); var d = nbv(a), y = nbi(), z = nbi(), r = ""; this.divRemTo(d,y,z); while(y.signum() > 0) { r = (a+z.intValue()).toString(b).substr(1) + r; y.divRemTo(d,y,z); } return z.intValue().toString(b) + r; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bnToString(b) {\n var self = this\n if (self.s < 0) return \"-\" + self.negate()\n .toString(b)\n var k\n if (b == 16) k = 4\n else if (b == 8) k = 3\n else if (b == 2) k = 1\n else if (b == 32) k = 5\n else if (b == 4) k = 2\n else return self.toRadix(b)\n var km = (1 << k) - 1,\n d, m = ...
[ "0.6596687", "0.6596687", "0.6596687", "0.6596687", "0.6596687", "0.6596687", "0.6596687", "0.6555484", "0.6555484", "0.65217733", "0.6519197", "0.6519197", "0.6519197", "0.6518932", "0.6516749", "0.651269", "0.6503056", "0.64993274", "0.64993274", "0.649443", "0.6491491", ...
0.0
-1
(public) return value as integer
function bnIntValue() { if(this.s < 0) { if(this.t == 1) return this[0]-this.DV; else if(this.t == 0) return -1; } else if(this.t == 1) return this[0]; else if(this.t == 0) return 0; // assumes 16 < DB < 32 return ((this[1]&((1<<(32-this.DB))-1))<<this.DB)|this[0]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get intValue() {}", "get valueInteger() {\n\t\treturn this.__valueInteger;\n\t}", "get valueInteger () {\r\n\t\treturn this.__valueInteger;\r\n\t}", "function o2ws_get_int() { return o2ws_get_int32(); }", "function toInt(val){\n\t // we do not use lang/toNumber because of perf and also because it\n\...
[ "0.8062313", "0.72035396", "0.71846676", "0.71775496", "0.7111766", "0.70502305", "0.69886273", "0.698818", "0.698818", "0.697269", "0.697269", "0.6960986", "0.6959027", "0.69558144", "0.69558144", "0.6943782", "0.6943782", "0.6943782", "0.6943782", "0.6943782", "0.6943782", ...
0.69251597
74
(protected) r = this + a
function bnpAddTo(a,r) { var i = 0, c = 0, m = Math.min(a.t,this.t); while(i < m) { c += this[i]+a[i]; r[i++] = c&this.DM; c >>= this.DB; } if(a.t < this.t) { c += a.s; while(i < this.t) { c += this[i]; r[i++] = c&this.DM; c >>= this.DB; } c += this.s; } else { c += this.s; while(i < a.t) { c += a[i]; r[i++] = c&this.DM; c >>= this.DB; } c += a.s; } r.s = (c<0)?-1:0; if(c > 0) r[i++] = c; else if(c < -1) r[i++] = this.DV+c; r.t = i; r.clamp(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function add_(self, a) {\n return self.add(a);\n}", "suma(){\n return this.a + this.b;\n }", "function addiere(a,b) {\n\t\t\t\tvar erg = a + b;\n\t\t\t\treturn erg;\n\t\t}", "add(a, b) {\r\n this.data[0] = a.data[0] + b.data[0];\r\n this.data[1] = a.data[1] + b.data[1];\r\n th...
[ "0.6958733", "0.67737406", "0.6687434", "0.6640313", "0.66318834", "0.66062677", "0.66062677", "0.6603584", "0.6603584", "0.65958405", "0.6592635", "0.6592635", "0.6573848", "0.6573848", "0.6573848", "0.6573848", "0.6573848", "0.6573848", "0.6573848", "0.6573848", "0.6573848"...
0.65576833
58
run may have just been called through dependencies being fulfilled just in this very frame
function doRun() { if (Module['calledRun']) return; // run may have just been called while the async setStatus time below was happening Module['calledRun'] = true; ensureInitRuntime(); preMain(); if (ENVIRONMENT_IS_WEB && preloadStartTime !== null) { Module.printErr('pre-main prep time: ' + (Date.now() - preloadStartTime) + ' ms'); } if (Module['_main'] && shouldRunNow) { Module['callMain'](args); } postRun(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function doRun(){// run may have just been called through dependencies being fulfilled just in this very frame,\n // or while the async setStatus time below was happening\n if(calledRun)return;calledRun=true;Module['calledRun']=true;if(ABORT)return;initRuntime();preMain();readyPromiseResolve(Module);if(Module['o...
[ "0.71392477", "0.7067637", "0.69554377", "0.69400525", "0.6908047", "0.681903", "0.67304075", "0.6727342", "0.65550256", "0.6475799", "0.6438775", "0.64352113", "0.64148164", "0.6402986", "0.6317247", "0.6317247", "0.6317247", "0.63035524", "0.6261234", "0.6261234", "0.622619...
0.5703796
54
Creates a function overload resolution table to the given method 'methodName' in the given prototype, if the overload table doesn't yet exist.
function ensureOverloadTable(proto, methodName, humanName) { if (undefined === proto[methodName].overloadTable) { var prevFunc = proto[methodName]; // Inject an overload resolver function that routes to the appropriate overload based on the number of arguments. proto[methodName] = function() { // TODO This check can be removed in -O3 level "unsafe" optimizations. if (!proto[methodName].overloadTable.hasOwnProperty(arguments.length)) { throwBindingError("Function '" + humanName + "' called with an invalid number of arguments (" + arguments.length + ") - expects one of (" + proto[methodName].overloadTable + ")!"); } return proto[methodName].overloadTable[arguments.length].apply(this, arguments); }; // Move the previous function into the overload table. proto[methodName].overloadTable = []; proto[methodName].overloadTable[prevFunc.argCount] = prevFunc; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createMethod(methodName){\n return function(){\n throw new Error('The \"'+methodName+'\" method is not available on the playback technology\\'s API');\n };\n}", "function createXNodeMethod(methodName) {\n\t\tXNode.prototype[methodName] = function() {\n\t\t\treturn this.node[methodName].apply(this.n...
[ "0.5103538", "0.50628316", "0.48640546", "0.48640546", "0.4862484", "0.47813582", "0.46100906", "0.45749334", "0.4536829", "0.45298368", "0.45298368", "0.45298368", "0.45298368", "0.45298368", "0.45298368", "0.45298368", "0.45298368", "0.45298368", "0.4504423", "0.4499308", "...
0.6609852
0
Registers a symbol (function, class, enum, ...) as part of the Module JS object so that handwritten code is able to access that symbol via 'Module.name'. name: The name of the symbol that's being exposed. value: The object itself to expose (function, class, ...) numArguments: For functions, specifies the number of arguments the function takes in. For other types, unused and undefined. To implement support for multiple overloads of a function, an 'overload selector' function is used. That selector function chooses the appropriate overload to call from an function overload table. This selector function is only used if multiple overloads are actually registered, since it carries a slight performance penalty.
function exposePublicSymbol(name, value, numArguments) { if (Module.hasOwnProperty(name)) { if (undefined === numArguments || (undefined !== Module[name].overloadTable && undefined !== Module[name].overloadTable[numArguments])) { throwBindingError("Cannot register public name '" + name + "' twice"); } // We are exposing a function with the same name as an existing function. Create an overload table and a function selector // that routes between the two. ensureOverloadTable(Module, name, name); if (Module.hasOwnProperty(numArguments)) { throwBindingError("Cannot register multiple overloads of a function with the same number of arguments (" + numArguments + ")!"); } // Add the new function into the overload table. Module[name].overloadTable[numArguments] = value; } else { Module[name] = value; if (undefined !== numArguments) { Module[name].numArguments = numArguments; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function define(name, value) {\n Object.defineProperty(exports, name, {\n value: value,\n enumerable: true\n });\n}", "define(name, value) {\n if (Object.prototype.hasOwnProperty.call(this.values, name)) {\n throw new ReferenceError(`Variable ${name} has already been declared.`);...
[ "0.6065042", "0.5907688", "0.5880901", "0.5671248", "0.55329335", "0.54931086", "0.54931086", "0.54931086", "0.54931086", "0.54931086", "0.54931086", "0.54931086", "0.54393893", "0.5393519", "0.53900003", "0.5375349", "0.5366473", "0.5320763", "0.5289489", "0.52333635", "0.51...
0.7113097
0
When converting a number from JS to C++ side, the valid range of the number is [minRange, maxRange], inclusive.
function __embind_register_integer(primitiveType, name, size, minRange, maxRange) { name = readLatin1String(name); if (maxRange === -1) { // LLVM doesn't have signed and unsigned 32-bit types, so u32 literals come out as 'i32 -1'. Always treat those as max u32. maxRange = 4294967295; } var shift = getShiftFromSize(size); registerType(primitiveType, { name: name, 'fromWireType': function(value) { return value; }, 'toWireType': function(destructors, value) { // todo: Here we have an opportunity for -O3 level "unsafe" optimizations: we could // avoid the following two if()s and assume value is of proper type. if (typeof value !== "number" && typeof value !== "boolean") { throw new TypeError('Cannot convert "' + _embind_repr(value) + '" to ' + this.name); } if (value < minRange || value > maxRange) { throw new TypeError('Passing a number "' + _embind_repr(value) + '" from JS side to C/C++ side to an argument of type "' + name + '", which is outside the valid range [' + minRange + ', ' + maxRange + ']!'); } return value | 0; }, 'argPackAdvance': 8, 'readValueFromPointer': integerReadValueFromPointer(name, shift, minRange !== 0), destructorFunction: null, // This type does not need a destructor }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function range(nbr,min,max){if(nbr<min){return min;}else if(nbr>max){return max;}else{return nbr;}}", "function toNumberRange(value, min, max) {\n if (_Type__WEBPACK_IMPORTED_MODULE_0__[\"hasValue\"](value)) {\n value = _Type__WEBPACK_IMPORTED_MODULE_0__[\"toNumber\"](value);\n return fitToRange...
[ "0.71254426", "0.70027244", "0.67878395", "0.6767743", "0.67281413", "0.6708403", "0.6698865", "0.6691565", "0.6678553", "0.66698563", "0.66376096", "0.6606054", "0.6592495", "0.6564608", "0.6548371", "0.64950234", "0.6488208", "0.6485397", "0.648301", "0.64829844", "0.648041...
0.0
-1
For types whose wire types are 32bit pointers.
function simpleReadValueFromPointer(pointer) { return this['fromWireType'](HEAPU32[pointer >> 2]); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function opaqueAllTypesClz32(argument) {\n return Math.clz32(argument);\n}", "function h$writePtrPtrU32(ptr, ptr_off, v, x, y) {\n x = x || 0;\n y = y || 0;\n var arr = ptr.arr[ptr_off + 4 * x];\n arr[0].dv.setInt32(arr[1] + y, v);\n}", "function h$writePtrPtrU32(ptr, ptr_off, v, x, y) {\n x = x || 0;\...
[ "0.5872316", "0.56684864", "0.56684864", "0.5611329", "0.55908304", "0.5585153", "0.5585153", "0.55539465", "0.55525124", "0.5545535", "0.5541986", "0.55259025", "0.55259025", "0.55216694", "0.55216694", "0.55216694", "0.5520601", "0.5520601", "0.5520601", "0.5509527", "0.550...
0.559178
4
Function implementation of operator new, per 13.2.2 ES3
function new_(constructor, argumentList) { if (!(constructor instanceof Function)) { throw new TypeError('new_ called with constructor type ' + typeof(constructor) + " which is not a function"); } /* * Previously, the following line was just: function dummy() {}; * Unfortunately, Chrome was preserving 'dummy' as the object's name, even though at creation, the 'dummy' has the * correct constructor name. Thus, objects created with IMVU.new would show up in the debugger as 'dummy', which * isn't very helpful. Using IMVU.createNamedFunction addresses the issue. Doublely-unfortunately, there's no way * to write a test for this behavior. -NRD 2013.02.22 */ var dummy = createNamedFunction(constructor.name, function(){}); dummy.prototype = constructor.prototype; var obj = new dummy; var r = constructor.apply(obj, argumentList); return (r instanceof Object) ? r : obj; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function newOperator(constructor, ...params){\n const result = {}\n Object.setPrototypeOf(result, Person.prototype)\n constructor.apply(result, params)\n return result\n}", "function myNew(func, ...arg) {\n let obj = {};\n obj.__proto__ = func.prototype;\n let res = func.apply(obj, arg);\n return...
[ "0.7059751", "0.6571295", "0.6505361", "0.64329165", "0.6342355", "0.6335628", "0.6333263", "0.6310198", "0.6298154", "0.6283314", "0.6256712", "0.6256712", "0.6253197", "0.6253197", "0.6253197", "0.6207867", "0.61958474", "0.61389214", "0.61221623", "0.6036005", "0.60329723"...
0.60924566
19
The path to interop from JS code to C++ code: (handwritten JS code) > (autogenerated JS invoker) > (templategenerated C++ invoker) > (target C++ function) craftInvokerFunction generates the JS invoker function for each function exposed to JS through embind.
function craftInvokerFunction(humanName, argTypes, classType, cppInvokerFunc, cppTargetFunc) { // humanName: a human-readable string name for the function to be generated. // argTypes: An array that contains the embind type objects for all types in the function signature. // argTypes[0] is the type object for the function return value. // argTypes[1] is the type object for function this object/class type, or null if not crafting an invoker for a class method. // argTypes[2...] are the actual function parameters. // classType: The embind type object for the class to be bound, or null if this is not a method of a class. // cppInvokerFunc: JS Function object to the C++-side function that interops into C++ code. // cppTargetFunc: Function pointer (an integer to FUNCTION_TABLE) to the target C++ function the cppInvokerFunc will end up calling. var argCount = argTypes.length; if (argCount < 2) { throwBindingError("argTypes array size mismatch! Must at least get return value and 'this' types!"); } var isClassMethodFunc = (argTypes[1] !== null && classType !== null); // Free functions with signature "void function()" do not need an invoker that marshalls between wire types. // TODO: This omits argument count check - enable only at -O3 or similar. // if (ENABLE_UNSAFE_OPTS && argCount == 2 && argTypes[0].name == "void" && !isClassMethodFunc) { // return FUNCTION_TABLE[fn]; // } var argsList = ""; var argsListWired = ""; for(var i = 0; i < argCount - 2; ++i) { argsList += (i!==0?", ":"")+"arg"+i; argsListWired += (i!==0?", ":"")+"arg"+i+"Wired"; } var invokerFnBody = "return function "+makeLegalFunctionName(humanName)+"("+argsList+") {\n" + "if (arguments.length !== "+(argCount - 2)+") {\n" + "throwBindingError('function "+humanName+" called with ' + arguments.length + ' arguments, expected "+(argCount - 2)+" args!');\n" + "}\n"; // Determine if we need to use a dynamic stack to store the destructors for the function parameters. // TODO: Remove this completely once all function invokers are being dynamically generated. var needsDestructorStack = false; for(var i = 1; i < argTypes.length; ++i) { // Skip return value at index 0 - it's not deleted here. if (argTypes[i] !== null && argTypes[i].destructorFunction === undefined) { // The type does not define a destructor function - must use dynamic stack needsDestructorStack = true; break; } } if (needsDestructorStack) { invokerFnBody += "var destructors = [];\n"; } var dtorStack = needsDestructorStack ? "destructors" : "null"; var args1 = ["throwBindingError", "invoker", "fn", "runDestructors", "retType", "classParam"]; var args2 = [throwBindingError, cppInvokerFunc, cppTargetFunc, runDestructors, argTypes[0], argTypes[1]]; if (isClassMethodFunc) { invokerFnBody += "var thisWired = classParam.toWireType("+dtorStack+", this);\n"; } for(var i = 0; i < argCount - 2; ++i) { invokerFnBody += "var arg"+i+"Wired = argType"+i+".toWireType("+dtorStack+", arg"+i+"); // "+argTypes[i+2].name+"\n"; args1.push("argType"+i); args2.push(argTypes[i+2]); } if (isClassMethodFunc) { argsListWired = "thisWired" + (argsListWired.length > 0 ? ", " : "") + argsListWired; } var returns = (argTypes[0].name !== "void"); invokerFnBody += (returns?"var rv = ":"") + "invoker(fn"+(argsListWired.length>0?", ":"")+argsListWired+");\n"; if (needsDestructorStack) { invokerFnBody += "runDestructors(destructors);\n"; } else { for(var i = isClassMethodFunc?1:2; i < argTypes.length; ++i) { // Skip return value at index 0 - it's not deleted here. Also skip class type if not a method. var paramName = (i === 1 ? "thisWired" : ("arg"+(i - 2)+"Wired")); if (argTypes[i].destructorFunction !== null) { invokerFnBody += paramName+"_dtor("+paramName+"); // "+argTypes[i].name+"\n"; args1.push(paramName+"_dtor"); args2.push(argTypes[i].destructorFunction); } } } if (returns) { invokerFnBody += "return retType.fromWireType(rv);\n"; } invokerFnBody += "}\n"; args1.push(invokerFnBody); var invokerFunction = new_(Function, args1).apply(null, args2); return invokerFunction; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function JavaInvoke() {\r\n}", "function helloFunctionInvoker(hello){\n hello('function args');\n}", "function CFunc(name, args, retVal) {\n function makeArgument(a) {\n if (!a) return null;\n const arg = MOBridgeSupportArgument.alloc().init();\n setKeys(arg, {\n type64: a.type\n });\n ...
[ "0.56310254", "0.5310954", "0.52002484", "0.515308", "0.48963365", "0.48963365", "0.48963365", "0.48963365", "0.48963365", "0.4860841", "0.48409113", "0.47932884", "0.47932884", "0.47722", "0.47722", "0.47722", "0.47703397", "0.4751401", "0.47258136", "0.47156188", "0.471286"...
0.79830444
0
root of all pointer and smart pointer handles in embind
function ClassHandle() { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor (ptr) {\n this.ptr = ptr\n this._destroyListeners = []\n this._destroyPromise = new Promise((resolve) => {\n this._destroyResolve = resolve\n })\n this._destroyPromise.then(() => {\n this._destroyListeners.forEach((listener) => {\n listener(this)\n })\n })\n }",...
[ "0.57861084", "0.56068826", "0.551735", "0.54917085", "0.54917085", "0.54191536", "0.53754616", "0.5348062", "0.53371745", "0.52674943", "0.5253667", "0.52248335", "0.5205727", "0.5178629", "0.51785976", "0.51700366", "0.5163196", "0.5163196", "0.5163196", "0.5163196", "0.516...
0.0
-1
URL Template v2.0.6 (
function expand(url, params, variables) { var tmpl = parse(url), expanded = tmpl.expand(params); if (variables) { variables.push.apply(variables, tmpl.vars); } return expanded; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function template (options) {\n\t var variables = [],\n\t url = expand(options.url, options.params, variables);\n\t variables.forEach(function (key) {\n\t delete options.params[key];\n\t });\n\t return url;\n\t}", "function createUrl(tpl, variables) {\r\n return tpl.replace(/\\{([^\\}]+)\\}/g,...
[ "0.67540354", "0.6710016", "0.66048586", "0.6517271", "0.6517271", "0.6517271", "0.6517271", "0.6517271", "0.6517271", "0.6517271", "0.6517271", "0.6517271", "0.6473835", "0.6468381", "0.6468381", "0.6464805", "0.6442212", "0.64154816", "0.6373655", "0.6291472", "0.629056", ...
0.0
-1
URL Template (RFC 6570) Transform.
function template (options) { var variables = [], url = expand(options.url, options.params, variables); variables.forEach(function (key) { delete options.params[key]; }); return url; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createUrl(tpl, variables) {\r\n return tpl.replace(/\\{([^\\}]+)\\}/g, function (variable, key) {\r\n return key in variables ? variables[key] : variable;\r\n });\r\n }", "function template (options) {\n\n var variables = [], url = expand(options.url, options.params, varia...
[ "0.6925154", "0.6760309", "0.6760309", "0.6760309", "0.6760309", "0.6760309", "0.6760309", "0.6760309", "0.6760309", "0.6760309", "0.67563975", "0.67365557", "0.67365557", "0.63542056", "0.6199783", "0.6060413", "0.6001007", "0.59438264", "0.5925711", "0.58712894", "0.584286"...
0.6883055
1
Service for URL templating.
function Url(url, params) { var self = this || {}, options$$1 = url, transform; if (isString(url)) { options$$1 = { url: url, params: params }; } options$$1 = merge({}, Url.options, self.$options, options$$1); Url.transforms.forEach(function (handler) { if (isString(handler)) { handler = Url.transform[handler]; } if (isFunction(handler)) { transform = factory(handler, transform, self.$vm); } }); return transform(options$$1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function demoTemplate({\n url\n}) {\n return `Go here to see a demo <a href=\"${url}\">${url}</a>.`;\n}", "function template(options) {\n var variables = [],\n url = expand(options.url, options.params, variables);\n variables.forEach(function (key) {\n delete options.params[key];\n });\n return url...
[ "0.65809613", "0.65192235", "0.6507946", "0.64059323", "0.64059323", "0.64027184", "0.64027184", "0.64027184", "0.64027184", "0.64027184", "0.64027184", "0.64027184", "0.64027184", "0.64027184", "0.63139075", "0.62014467", "0.6138727", "0.5991061", "0.58379054", "0.5729998", ...
0.0
-1
XDomain client (Internet Explorer).
function xdrClient (request) { return new PromiseObj(function (resolve) { var xdr = new XDomainRequest(), handler = function handler(_ref) { var type = _ref.type; var status = 0; if (type === 'load') { status = 200; } else if (type === 'error') { status = 500; } resolve(request.respondWith(xdr.responseText, { status: status })); }; request.abort = function () { return xdr.abort(); }; xdr.open(request.method, request.getUrl()); if (request.timeout) { xdr.timeout = request.timeout; } xdr.onload = handler; xdr.onabort = handler; xdr.onerror = handler; xdr.ontimeout = handler; xdr.onprogress = function () {}; xdr.send(request.getBody()); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function xdrClient (request) {\n return new PromiseObj(function (resolve) {\n\n var xdr = new XDomainRequest(), handler = function (ref) {\n var type = ref.type;\n\n\n var status = 0;\n\n if (type === 'load') {\n status = 200;\n } else if (type =...
[ "0.66740274", "0.664105", "0.664105", "0.664105", "0.664105", "0.664105", "0.664105", "0.664105", "0.664105", "0.6607422", "0.6607422", "0.65116125", "0.6046756", "0.570742", "0.5586355", "0.55824524", "0.55533683", "0.5527345", "0.53925127", "0.53883755", "0.5377183", "0.5...
0.66231215
9
HTTP method override Interceptor.
function method (request) { if (request.emulateHTTP && /^(PUT|PATCH|DELETE)$/i.test(request.method)) { request.headers.set('X-HTTP-Method-Override', request.method); request.method = 'POST'; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "intercept(req, next) {\n if (req.method === 'JSONP') {\n return this.jsonp.handle(req);\n }\n // Fall through for normal HTTP requests.\n return next.handle(req);\n }", "intercept(req, next) {\n if (req.method === 'JSONP') {\n return this.jsonp.handle(r...
[ "0.6643519", "0.6643519", "0.6643519", "0.6643519", "0.6643519", "0.6469818", "0.60097545", "0.5925656", "0.586097", "0.5851553", "0.58461994", "0.58268934", "0.5821371", "0.57700545", "0.5768504", "0.5766474", "0.5756035", "0.56853807", "0.5640843", "0.56179935", "0.56011593...
0.535123
41
Service for interacting with RESTful services.
function Resource(url, params, actions, options$$1) { var self = this || {}, resource = {}; actions = assign({}, Resource.actions, actions); each(actions, function (action, name) { action = merge({ url: url, params: assign({}, params) }, options$$1, action); resource[name] = function () { return (self.$http || Http)(opts(action, arguments)); }; }); return resource; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function RestService() {\n // This is the spoke we'll be in touch with. When returning will wrap it with Plug.\n var spoke = through.obj();\n\n // It's always good to init services on the second tick\n process.nextTick(function () {\n spoke.write(messages.log(\"STARTING API\"));\n\n var api = express();\...
[ "0.72275144", "0.65103894", "0.63224214", "0.6258098", "0.6122539", "0.59976894", "0.5957328", "0.59443754", "0.59406364", "0.58652747", "0.58305925", "0.5823525", "0.5823525", "0.5814718", "0.58138204", "0.5802795", "0.57892436", "0.57746756", "0.5751222", "0.5745047", "0.57...
0.54862964
40
Retrieves an auth token so that the user can exceed the uauthenticated rate limit
function getAuthToken () { console.log('You have hit the rate limit for unauthenticated requests, please log in to raise your rate limit:\n'.red); program.prompt('GitHub Username: ', function (user) { console.log('\nAfter entering your password, hit return' + ' twice.\n'.green); var authProcess = spawn('curl', [ '-u', user, '-d', '{"scopes":["repo"],"note":"mdlint"}', '-s', 'https://api.github.com/authorizations' ], { stdio: [process.stdin, 'pipe', process.stderr] }); authProcess.stdout.setEncoding('utf8'); authProcess.stdout.on('data', function (data) { var response = JSON.parse(data); if (response.message) { console.log(response.message.red + '\n'); process.exit(); } else { fs.writeFileSync(tokenFile, response.token); console.log('Authenticated :). Now try your lint again. \n'.green); process.exit(); } }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getRequestToken() {\n return apiClient.get(\n '/authentication/token/new?api_key=6c1e80dae659cb7d1abdf16afd8bb0e3'\n )\n }", "async getUserAuthenticationToken() {\n\n\t\tif (this.userAuthToken !== null) {\n\t\t\t// userAuthToken is still valid no need\n\t\t\t// to recalculate it so call the callback ...
[ "0.7035979", "0.6960911", "0.68620807", "0.672577", "0.66880494", "0.6617844", "0.6575533", "0.6546989", "0.6523108", "0.6515465", "0.6497888", "0.64920354", "0.64789265", "0.64639044", "0.6380196", "0.6377417", "0.6376784", "0.63588995", "0.6357987", "0.6346817", "0.63218975...
0.0
-1
handle mouse wheel events
function handler(canvasid) { var idcode=canvasid[canvasid.length-1]; var idx=((idcode=="x")?0:((idcode=="y")?1:2)); var ii=GLOBAL.iiarr[idx]; var canvas=document.getElementById(canvasid); var img=document.getElementById(canvas.id+"-img"); var phony=document.getElementById(canvas.id+"-img-phony"); canvas.width =parseFloat(canvas.parentNode.style.width ); canvas.height=parseFloat(canvas.parentNode.style.height); var maxii=181*217/Math.max(canvas.width,canvas.height); GLOBAL.iiarr[idx]=Math.min(maxii,Math.max(0,ii)); DrawImage(canvas,img,idx); var phonyid="map-"+idx+"-"+GLOBAL.iiarr[idx]; phony.useMap="#"+phonyid; var areas=document.getElementById(phony.useMap.substr(1)).childNodes; for (var areaiter=0; areaiter < areas.length; areaiter++){ areas[areaiter].addEventListener("click",MouseClickAreaHandler,false); areas[areaiter].addEventListener("mouseover",MouseOverAreaHandler,false); // areas[areaiter].addEventListener("mouseout", MouseOutAreaHandler ,false); } phony.addEventListener("mousedown", MouseDraggingHandler_start,false); phony.addEventListener("mousemove", MouseDraggingHandler_move ,false); phony.addEventListener("mouseup", MouseDraggingHandler_stop ,false); phony.addEventListener("mousewheel", MouseWheelHandler,false); phony.addEventListener("DOMMouseScroll",MouseWheelHandler,false); function MouseWheelHandler(e){ var delta = Math.max(-1, Math.min(1, (e.wheelDelta || -e.detail))); var ii=GLOBAL.iiarr[idx]; if (delta>0){ii+=1;}else{ii-=1;} GLOBAL.iiarr[idx]=Math.min(maxii,Math.max(0,ii)); Update(); if (GLOBAL.area_map_flag){ var phonyid="map-"+idx+"-"+GLOBAL.iiarr[idx]; phony.useMap="#"+phonyid; var areas=document.getElementById(phony.useMap.substr(1)).childNodes; for (var areaiter=0; areaiter < areas.length; areaiter++){ areas[areaiter].addEventListener("mouseover",MouseOverAreaHandler,false); areas[areaiter].addEventListener("click",MouseClickAreaHandler,false); // areas[areaiter].addEventListener("mouseout", MouseOutAreaHandler ,false); } } } // function MouseWheelHandler }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "mouseWheel(_delta) {}", "function mouseWheel(event) {\n pos += event.delta;\n}", "function handleWheel(delta, event) {\n\n QMouse.isMouseWheel = true;\n\n // Update Mouse Position\n QMouse.X = event.offsetX | event.layerX;\n QMouse.Y = event.offsetY | event.layerY;\n\n ...
[ "0.81449676", "0.7941387", "0.7910802", "0.7814185", "0.7757932", "0.7725161", "0.76599467", "0.76547253", "0.7554527", "0.75438136", "0.75340223", "0.74957687", "0.74697286", "0.7458841", "0.74546665", "0.7453565", "0.7447268", "0.7439002", "0.74034345", "0.739445", "0.73771...
0.0
-1
Draws a crease line, updates on Crease Point input change
function drawCrease(input) { if (line) { scene.remove(line); } var points = getCreaseInputs(input); if(isValidCrease(input) === false){ return; } line_geometry = new THREE.Geometry(); line_geometry.vertices.push(points[0], points[1]); line = new THREE.Line(line_geometry, lineMaterial); scene.add(line); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawline() {\n\n if (isDrawing) {\n linePoint2 = d3.mouse(this);\n gContainer.select('line').remove();\n gContainer.append('line')\n .attr(\"x1\", linePoint1.x)\n .attr(\"y1\", linePoint1.y)\n ...
[ "0.70853513", "0.6902469", "0.6782946", "0.67382157", "0.67174864", "0.66203725", "0.65801877", "0.6574689", "0.654762", "0.65370244", "0.65017253", "0.6487955", "0.64847493", "0.6475334", "0.64677876", "0.6440193", "0.64362234", "0.6399584", "0.63889146", "0.6384229", "0.638...
0.7938718
0
TODO: change this to accept options instead of wrangler_file_id
function GeneSetGroup (wrangler_file_id) { TabSeperatedFile.call(this, { wrangler_file_id: wrangler_file_id }); // TODO: remove this (?) this.setSubmissionType.call(this, "gene_set_collection"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setFileNameWith(file) {\n $(file).parent().parent().find(\".jancyFileWrapTexts\").find(\"span\").width($(file).parent().parent().width() - 197);\n}", "function setFileNameWith(file) {\n $(file).parent().parent().find(\".jancyFileWrapTexts\").find(\"span\").width($(file).parent().parent().width() -...
[ "0.5131443", "0.5131443", "0.5078335", "0.50472075", "0.5015782", "0.5003612", "0.4990771", "0.49460408", "0.49354964", "0.4924638", "0.4898594", "0.48498374", "0.48206264", "0.48168254", "0.48099968", "0.48027295", "0.477455", "0.47672355", "0.47606468", "0.4739204", "0.4734...
0.4534221
56
Generate a number between 0 3 ,zero is our targer
function randomChance() { return Math.floor(Math.random() * 3); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function generateNum() {\n\treturn Math.floor(Math.random()*100)\n}", "function genNum() {\n // 198 = 99 - (-99)\n return Math.floor((Math.random() * 198) - 99);\n}", "function genNum(){\n\trandomNum = Math.floor(Math.random() * Math.floor(numberMax + numberMin)) \n}", "function generateNumber() {\n retur...
[ "0.71028024", "0.7087485", "0.7009213", "0.7007363", "0.6976727", "0.6936445", "0.69149345", "0.69108915", "0.69089794", "0.69089794", "0.69051147", "0.69039285", "0.689765", "0.68817383", "0.6859779", "0.6857613", "0.68424106", "0.6842053", "0.68334466", "0.6813726", "0.6801...
0.0
-1
vuex v3.1.1 (c) 2019 Evan You
function n(t){var e=Number(t.version.split(".")[0]);if(e>=2)t.mixin({beforeCreate:r});else{var n=t.prototype._init;t.prototype._init=function(t){void 0===t&&(t={}),t.init=t.init?[r].concat(t.init):r,n.call(this,t)}}function r(){var t=this.$options;t.store?this.$store="function"===typeof t.store?t.store():t.store:t.parent&&t.parent.$store&&(this.$store=t.parent.$store)}}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getFieldVuex() {\n return store.getters.dataField;\n }", "function vuexInit(){var options=this.$options;// store injection\n\tif(options.store){this.$store=options.store;}else if(options.parent&&options.parent.$store){this.$store=options.parent.$store;}}", "function U(He){Le&&(He._devtoolHook=Le,Le.emit('v...
[ "0.71114504", "0.70059747", "0.6747754", "0.6744582", "0.662208", "0.662208", "0.662208", "0.6618358", "0.6592901", "0.6487492", "0.63576543", "0.63523763", "0.63509184", "0.63509184", "0.63509184", "0.63509184", "0.63509184", "0.6339643", "0.6321553", "0.62844443", "0.628122...
0.0
-1
! vuerouter v3.0.6 (c) 2019 Evan You
function r(t,e){0}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private public function m246() {}", "private internal function m248() {}", "function jj(t,e,n,r,i,o,a,s){var l=(\"function\"===typeof n?n.options:n)||{};return l.__file=\"source.vue\",l.render||(l.render=t.render,l.staticRenderFns=t.staticRenderFns,l._compiled=!0,i&&(l.functional=!0)),l._scopeId=r,l}", "func...
[ "0.5984435", "0.58520705", "0.5815317", "0.5757029", "0.5727303", "0.57165563", "0.56561184", "0.55692035", "0.5557477", "0.5542094", "0.5522843", "0.55133104", "0.5479876", "0.5443766", "0.5443255", "0.5442146", "0.5415237", "0.53994054", "0.5397749", "0.5375185", "0.5375185...
0.0
-1
Initialize function, receives a DomElementId string and assigns the Dom Element to el for future use.
function init(domElementId, callback){ el = document.getElementById(domElementId); //Render the Layout in Dom Element el el.innerHTML = Layout(); //Assign DOM Elements txtCreateItem = document.getElementById("txt-create-item"); btnCreateItem = document.getElementById("btn-create-item"); //Register button onclick event btnCreateItem.onclick = onCreateItem; // onCreateItemCallback = callback; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function init(domElementId){\n\tel = document.getElementById(domElementId)\n\t//Returns Todo List to simplify Jquery Style Chaining API\n\treturn TodoList;\n}", "constructor(el) {\n this.el = el || {};\n }", "constructor(element) {\r\n this.element = document.getElementById(element)\r\n }",...
[ "0.75144947", "0.70310915", "0.68899244", "0.683086", "0.63798684", "0.62945586", "0.62626094", "0.6224272", "0.6224272", "0.6168347", "0.6155521", "0.60777074", "0.60751295", "0.5937388", "0.59264463", "0.5925393", "0.58982545", "0.5882771", "0.5844314", "0.5837004", "0.5804...
0.65691715
4
Initialize function, receives a DomElementId string and assigns the Dom Element to el for future use.
function init(domElementId){ el = document.getElementById(domElementId) //Returns Todo List to simplify Jquery Style Chaining API return TodoList; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor(el) {\n this.el = el || {};\n }", "constructor(element) {\r\n this.element = document.getElementById(element)\r\n }", "constructor(el) {\n this.el = el;\n }", "function init(domElementId, callback){\n\tel = document.getElementById(domElementId);\n\n\t//Render the Layout in...
[ "0.70317376", "0.6889506", "0.68314624", "0.65673274", "0.6381667", "0.62948316", "0.6263454", "0.6225174", "0.6225174", "0.61670923", "0.61555934", "0.60781264", "0.6073943", "0.59388554", "0.59275556", "0.5924387", "0.58971554", "0.58817357", "0.58442557", "0.5840062", "0.5...
0.7514261
0
Renders all objects in TodoList.items using Item Template
function render(){ var src = "" for(i in TodoList.items) src += ItemTemplate(TodoList.items[i]); el.innerHTML = src; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function render(todoItems) {\n // const sortedData = todoItems.sortby(['id'])\n const container = document.querySelector('.js-todolist');\n container.innerHTML = '';\n const todoItemsReverse = todoItems.reverse();\n // for (const todoItem of sortedData) {\n for (const todo...
[ "0.7524637", "0.74975294", "0.7435264", "0.7344821", "0.7159357", "0.7054646", "0.6973523", "0.6955017", "0.6851485", "0.6840535", "0.6798981", "0.67904633", "0.6770597", "0.6713732", "0.67127234", "0.6710842", "0.6650769", "0.6641668", "0.6633112", "0.66037863", "0.6591429",...
0.7950711
0
reset active classes for nav items
function resetNavBarActiveItems(){ $("#navDashboardLinkItem").removeClass("active"); $("#navPlayersLinkItem").removeClass("active"); $("#navAdminsLinkItem").removeClass("active"); $("#navGroupsLinkItem").removeClass("active"); $("#navEventsLinkItem").removeClass("active"); $("#navCoursesLinkItem").removeClass("active"); $("#navResultsLinkItem").removeClass("active"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function resetActiveLink() {\n menuLinks.forEach((li) => {\n li.classList.remove(\"active\");\n });\n}", "function setNavActive() {\n $('.nav-a.active').toggleClass('active');\n $(this).toggleClass('active');\n }", "function setActiveNavigation(activeTab) {\n $(\".nav li\").removeClass(\"active\...
[ "0.76830125", "0.76333964", "0.74146444", "0.74146444", "0.7364739", "0.7302722", "0.7281692", "0.7209341", "0.71823895", "0.71705705", "0.7168519", "0.71427476", "0.71349293", "0.7110896", "0.7065239", "0.70497906", "0.703111", "0.70099914", "0.7008698", "0.69799906", "0.697...
0.8037945
0
Clean the results based on duplicates and needing ALL values //
function arrayEquals(arrA, arrB) { let equals = true arrA.forEach((a, i) => { if(!equals) return if(i >= arrB.length || arrB[i] !== a) equals = false }) return equals }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_removeDuplicates(data, options) {\n let uniqueValue = [];\n let uniqueData = [];\n let objects = JP.query(data, options.object);\n\n objects.forEach((object, index) => {\n let value = JP.query(object, options.value)[0];\n if (uniqueValue.indexOf(value) === -1){\n uniqueValue.push(valu...
[ "0.7221932", "0.65920717", "0.6452534", "0.63466114", "0.61459416", "0.61258036", "0.6083578", "0.60674196", "0.6009945", "0.600187", "0.5997938", "0.59682995", "0.59653556", "0.5936444", "0.592666", "0.587824", "0.58740073", "0.5871026", "0.58695036", "0.5862457", "0.5844053...
0.0
-1
Add opportunity (on form submission)
function addOpp() { // Get Data from the input fields var newOpp = { title: $('#title').val(), category: $('#category').val(), desc: $('#desc').val(), fields: $('#fields').val(), period: $('#period').val(), } if ($('#reward-c').val() || $('#reward-h').val()) { let rewards = ""; let first = true; if ($('#reward-c').val()) { rewards = rewards + $('#reward-c').val(); } if ($('#reward-h').val()) { if (first) { first = false; rewards = rewards + $('#reward-h').val(); } else { rewards = rewards + ', ' + $('#reward-h').val(); } } newOpp.rewards = rewards; } if ($('#wage').val()) { newOpp.wage = $('#wage').val(); } // Push new opportunity to the array of opportunities opps.push(newOpp); // display the new array of opportunities var oppScript = ""; opps.forEach(function(opp) { oppScript = oppScript + '<div class="col-md-4 opp-col pb-4"> <div class="opp-container"> <h3>' + opp.title + '</h3> <p class="opp-category">' + opp.category; oppScript = oppScript + '</p> <p class="opp-desc">' + (opp.desc).substring(0, 50) + '...' + '</p> <p class="opp-field">' + opp.fields; oppScript = oppScript + '</p> <p class="opp-period">' + 'لمدة ' + opp.period + '</p>'; if (typeof opp.wage != 'undefined') { oppScript = oppScript + '<p class="opp-wage">' + opp.wage + ' ريال ' + '</p>' } oppScript = oppScript + '<div class="text-center"> <a type="button" class="btn" href="opp.html">التفاصيل</a> </div> </div> </div>' }); $(".opps-row").html(oppScript); $('.message-container').slideDown(); setTimeout( function() { $('.message-container').slideUp(); }, 3000); // $('.message').append('<div class="message-container fixed-top">تم إضافة الفرصة بنجاح!</div>'); // // setTimeout( // function() { // $('.message').empty(); // }, 5000); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "handleFormSubmit(e) {\n this.addComic();\n }", "function addGoal() {\n\t\t\tif (vm.adding == false) {\n\t\t\t\tvm.adding = true;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Make sure that there are values in the\n\t\t\t// fields\n\t\t\tif (vm.goalName === '' || vm.goalImportance === '') {\n\t\t\t\treturn;\n\t\t\t}\...
[ "0.6300899", "0.62147105", "0.614248", "0.6083525", "0.6043832", "0.6037407", "0.599555", "0.593057", "0.5916525", "0.5902061", "0.5891479", "0.58699584", "0.5858776", "0.5852538", "0.5845648", "0.5829874", "0.581555", "0.58027345", "0.58021337", "0.57887286", "0.5767238", ...
0.5937096
7
CONSTRUCTOR Inputs: Name of database document and it's respective schema Notes: Possible schemas can be found here:
function RPC_Model(schemaName, schemaJSON) { this.schema = schemaJSON; this.mongooseModel = mongoose.model(schemaName, new Schema(this.schema)); this.schemaName = schemaName; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Database(name) \n{\nthis.tables = {};\nthis.name = name;\n}", "schema() { }", "constructor(schemaChange, name, schema, parent, dialog) {\n this.schemaChange = schemaChange;\n this.name = name;\n this.schema = schema;\n this.parent = parent;\n this.dialog = dialog;\n ...
[ "0.6363567", "0.62926126", "0.62822217", "0.6174474", "0.59703773", "0.5856925", "0.57536894", "0.5697396", "0.5690447", "0.5690447", "0.5690447", "0.5690447", "0.56524354", "0.56306463", "0.5626977", "0.56176347", "0.56159234", "0.5583266", "0.5583266", "0.5579682", "0.55636...
0.5317921
46
Simple Response return for most Mongoose callback functions
function defaultResponseReturn(Response, instance) { return function(err, instances) { var result = instances || instance; if(err) { Response(err); } else { Response(null, result); } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async function getCandidate(req,res){\n var return_response = { \"status\": null, \"message\": null, \"data\": {} } \n try {\n const doc = await Candidate.find({});\n return_response.status = 200;\n return_response.message = \"Success\";\n return_response.data = doc;\n } catch ...
[ "0.62141603", "0.61339843", "0.60500145", "0.60341483", "0.5882048", "0.5822877", "0.5742801", "0.5732723", "0.57326907", "0.5690335", "0.5683713", "0.5670946", "0.56653136", "0.5656011", "0.56333697", "0.56306106", "0.5628055", "0.5620923", "0.5591995", "0.5553789", "0.55526...
0.0
-1
Write your code! Canvas where your game will be played!
function initCanvas(width, height){}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function draw(){\r\n // We define the background color, the sky\r\n context.fillStyle = \"#c0e5f1\";\r\n // We define the x- and y-Position (top-left corner) of the background\r\n context.fillRect(0, 0, canvas.width, canvas.height);\r\n // Call the \"Draw Background\" function\r\n background.draw();\r\n // ...
[ "0.6693262", "0.66874707", "0.65501577", "0.650644", "0.6455544", "0.6409965", "0.64060366", "0.63855106", "0.6348024", "0.6344823", "0.63080055", "0.63024414", "0.6298581", "0.6294167", "0.62838125", "0.62759155", "0.62724596", "0.62621814", "0.62555575", "0.62531465", "0.62...
0.0
-1
Draw your maze! Where are your energy pills? How should you place them? What about power ups?
function initMaze(){}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function drawMaze() {\n\tvar canvas = document.getElementById(\"maze\");\n\tvar context = canvas.getContext('2d');\n\tvar i, y;\n\tcontext.strokeStyle='black';\n\tfor(y=0; y<=610; y+=10) {\t\n\t\tcontext.beginPath();\n\t\tcontext.moveTo(0,y);\n\t\tcontext.lineTo(600,y);\n\t\tcontext.lineWidth=1;\n\t\tcontext.strok...
[ "0.7810492", "0.7380694", "0.7377591", "0.72737205", "0.7158664", "0.7058064", "0.70144844", "0.6977286", "0.6968469", "0.69660324", "0.69474226", "0.69333684", "0.69130766", "0.6906382", "0.6870622", "0.682254", "0.6722877", "0.6643445", "0.6592553", "0.6567338", "0.6537188"...
0.6851658
15
See if sprite can move one more step at the given (x,y) facing the given direction
function canMove (x,y,dir) {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function canBeMoved(direction) {\n return block.every(function(blockCell) {\n var p = direction(blockCell); // next state\n // check for boundaries and elements of the same type\n return p.y >= 0 && p.x >= 0 && p.y < dimention[1] && p.x < dimention[0] && field[p.y][p.x] !== ...
[ "0.6591468", "0.6576128", "0.65548956", "0.64943117", "0.64802504", "0.64373124", "0.6394775", "0.6350045", "0.6287304", "0.6284429", "0.6237724", "0.6174555", "0.61623216", "0.61610013", "0.61583424", "0.61456686", "0.61368805", "0.61067516", "0.60915834", "0.6060695", "0.60...
0.7259557
0
welcome screen animation OPTIONAL
function updateWelcomeScreen () {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function displayWelcome() {\n\t$(\"#welcome\").css('opacity', 0).show().animate({ opacity: 1 }, 750, function() {\n\t \t$(\"#welcome\").animate({ top: \"15%\" }, 1000, function() {\n\t \t\t$(\"#welcomemessage\").fadeIn(function () {\n\t \t\t\tsetTimeout(function() {\n\t \t\t\t\t$(\"#welcomebutton\").fadeIn(functio...
[ "0.7529636", "0.7381515", "0.71753395", "0.7049929", "0.69621754", "0.6757623", "0.6699554", "0.6625824", "0.66090506", "0.6583265", "0.6532268", "0.65173364", "0.6432347", "0.64083445", "0.6354284", "0.63259906", "0.6321166", "0.63039553", "0.6279336", "0.62790334", "0.62763...
0.753405
0
show || update score
function showScore(){ ctx.fillStyle="black"; ctx.fillRect(CANVAS_WIDTH-250, 10, 190, 40); ctx.fillStyle = "white"; ctx.font = "24px monospace"; ctx.textAlign = "left"; ctx.fillText("score: " + parseInt(score), CANVAS_WIDTH-250, 37); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateScore() {\n document.querySelector(\"#score\").innerHTML = \"Score: \" + score;\n }", "function updateScore() {\n document.getElementById(\"demo9\").innerHTML = \"Score: \" + score;\n }", "function updateScore(value) {\n addScore(value);\n displayScore();\n}...
[ "0.7663399", "0.7636699", "0.7526363", "0.7466327", "0.7430234", "0.7386744", "0.7368273", "0.7341629", "0.7305776", "0.7277595", "0.72756666", "0.7252861", "0.72473353", "0.72389555", "0.71993923", "0.7197679", "0.7186347", "0.7182971", "0.71429926", "0.71310365", "0.7127623...
0.0
-1
run the game. Create mrPacman and 4 ghosts. Reset their positions.
function run() {}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setup() {\n createCanvas(575, 675)\n cols = width / scale\n rows = height / scale\n //frameRate changed for easier animations and movement speed changes\n frameRate(30)\n\n // animation setup\n animationSetUp()\n\n //create new game\n game = new Game()\n\n // game board set up\n game.setupGrid(...
[ "0.6717358", "0.66068244", "0.65489066", "0.6534558", "0.6533208", "0.6519098", "0.6515385", "0.650819", "0.64338875", "0.64247084", "0.6407802", "0.6381072", "0.63471395", "0.63459855", "0.63393193", "0.6332745", "0.63316184", "0.6319234", "0.631174", "0.6307115", "0.6300518...
0.0
-1
Executes every time the 'valid' event is triggered
function youtubeValid(t){// t = this if(t.getValue() != ""){ var videoInfo = getYoutubeVideoInfo(t.getValue()); //returns a string containing the selected video's information var videoInfoObject = parseJson(videoInfo.body); //convert from a string to an XML Object var secondsString = videoInfoObject.entry.media$group.yt$duration.seconds;//get the 'seconds' attribute we need var seconds = parseInt(secondsString); var time = formatTime(seconds); //converts the video duration (in seconds) to the desired format var title = videoInfoObject.entry.title.$t;//get the video title var container = t.findParentByType("dialogfieldset"); var youtubeDuration = container.getComponent("duration"); // the 'duration' widget var youtubeDurationLabel = container.getComponent("durationLabel"); // the 'duration label' widget var youtubeVideoName = container.getComponent("videoName"); // the 'videoName' widget var youtubeVideoNameLabel = container.getComponent("videoNameLabel"); // the 'videoName' widget youtubeDuration.setValue(time); youtubeDurationLabel.setText(time); youtubeVideoName.setValue(title); youtubeVideoNameLabel.setText(title); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "afterValidChange() { }", "validateInit() {\n this.runValidation(true);\n }", "function validate(){\n\n\t\t//TODO: make this work\n\n\n\t}", "function validCycle(event) {\n update(event);\n validOrNot(event);\n validForm(event);\n}", "function valid(){return validated}", "function validation(...
[ "0.69794214", "0.6794825", "0.6725379", "0.6481961", "0.64757246", "0.64694375", "0.64613706", "0.6414585", "0.63441443", "0.6330273", "0.6252113", "0.62486815", "0.6235717", "0.6234934", "0.6225729", "0.6206375", "0.6145285", "0.61396706", "0.61360955", "0.6103722", "0.60918...
0.0
-1
converts a string into an Json Object
function parseJson(json){ eval('var data =' + json); return data; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function toObject(str) {\n return gadgets.json.parse(str);\n}", "function toObject(str) {\n return gadgets.json.parse(str);\n}", "function str2JSON(str){\n\treturn JSON.parse(str);\n}", "function json2obj(str)\n{\n return eval('(' + str + ')');\n}", "function jsonToObj(str) {\n\t\tif (!$.isString(...
[ "0.80173165", "0.80173165", "0.77995336", "0.77443254", "0.762207", "0.7463785", "0.7423364", "0.73983276", "0.7368622", "0.7199587", "0.71669674", "0.71669674", "0.71669674", "0.71669674", "0.71669674", "0.71669674", "0.71669674", "0.71669674", "0.71669674", "0.71669674", "0...
0.0
-1
gets the desired video information
function getYoutubeVideoInfo(id){ var youtubeApiUrl = "https://gdata.youtube.com/feeds/api/videos/"; var v2Parameter = "?v=2"; var jsonParameter = "&alt=json"; var response = CQ.utils.HTTP.get(youtubeApiUrl + id + v2Parameter + jsonParameter); return response; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getVideoInformation() {\n if (config.useRemoteData) {\n return getRemoteVideoInformation();\n }\n return getLocalVideoInformation();\n\n}", "async function getVideoInfo() {\n\tlet videos = document.querySelectorAll(\n\t\t'ytd-browse #contents #contents #items ytd-thumbnail .yt-simple-end...
[ "0.7567891", "0.74346185", "0.72672266", "0.71350867", "0.7095404", "0.7049103", "0.69045216", "0.677848", "0.676778", "0.6717711", "0.6645546", "0.66026616", "0.65441424", "0.6541425", "0.6491064", "0.6443167", "0.6438557", "0.64296377", "0.63556665", "0.63364846", "0.632531...
0.67529047
9
converts from seconds to the desired duration format: hh:mm:ss
function formatTime(totalSeconds){ var seconds = totalSeconds%60; var minutes = Math.floor(totalSeconds/60); var hours = Math.floor(minutes/60); if(hours > 0) minutes = minutes%60; if(hours < 10) hours = "0" + hours; if(minutes < 10) minutes = "0" + minutes; if(seconds < 10) seconds = "0" + seconds; return hours +":"+minutes+":"+seconds; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "convertDuration (seconds){\n let hours = Math.floor(seconds / 3600);\n seconds %= 3600;\n let minutes = Math.floor(seconds / 60);\n\n return hours+\"h \"+minutes+\"m\";\n }", "#secondsToTime(s) {\r\n\t\tlet momentTime = moment.duration(s, 'seconds');\r\n\t\tlet sec = momentTime.sec...
[ "0.8102121", "0.784536", "0.7589821", "0.75599647", "0.75510377", "0.7507525", "0.74792325", "0.74506074", "0.7412715", "0.74050564", "0.73792595", "0.737781", "0.7371972", "0.7367512", "0.73642397", "0.73574805", "0.7350247", "0.7344105", "0.73269", "0.7312306", "0.73014176"...
0.6998873
65
Executes every time the 'invalid' event is triggered
function youtubeInvalid(t,msg){// t = this var container = t.findParentByType("dialogfieldset"); var youtubeDurationLabel = container.getComponent("durationLabel"); // the 'duration label' widget var youtubeVideoNameLabel = container.getComponent("videoNameLabel"); // the 'videoName' widget youtubeDurationLabel.setText(""); youtubeVideoNameLabel.setText(""); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onInvalid(errors) {\n console.log(errors);\n }", "function onInvalidInput() {\n\n transition(\"ERROR_INPUT\");\n\n }", "afterValidChange() { }", "adapterDidInvalidate(errors) {\n var attribute = void 0;\n\n for (attribute in errors) {\n if (errors.hasOwnProperty(attribute)) {\n ...
[ "0.7448369", "0.65909237", "0.64219505", "0.63482034", "0.6233127", "0.61573946", "0.6096706", "0.608694", "0.6063479", "0.60424197", "0.6041023", "0.6040897", "0.6011899", "0.60063565", "0.59854066", "0.5983471", "0.5950519", "0.59489423", "0.5939185", "0.59309214", "0.58608...
0.0
-1
import shelves from '../images/emptyshelves.png';
function IngredientList({ availIngredients, saveNewIngredient, updateIngredientTimeLine, updateIngredientAmount, autoUseIngredient }) { const [newIngredientName, setNewIngredientName] = useState(''); const [newIngredientAmount, setNewIngredientAmount] = useState(null); const [newIngredientMeasure, setNewIngredientMeasure] = useState(''); const handleSubmit = (ingredient) => { saveNewIngredient(ingredient); }; const handleNameChange = (e) => { setNewIngredientName(e.target.value); e.preventDefault(); }; const handleAmountChange = (e) => { setNewIngredientAmount(e.target.value); e.preventDefault(); }; const handleMeasureChange = (e) => { setNewIngredientMeasure(e.target.value); e.preventDefault(); }; return ( <div> <AvailableTitle> <h2> Current Ingredient Stock </h2> <ClockParagraph> <p>Click on clock to set usage timeframe, or click on wrench to update ingredient count manually</p> </ClockParagraph> </AvailableTitle> <AvailableIngredientsWrapper> <ul> {availIngredients.map((ingredient, index) => ( <Ingredient ingredient={ingredient} key={index} updateIngredientTimeLine={updateIngredientTimeLine} updateIngredientAmount={updateIngredientAmount} autoUseIngredient={autoUseIngredient}/> ))} </ul> </AvailableIngredientsWrapper> <form> <AddIngredientTitle> <h4>Add ingredient</h4> </AddIngredientTitle> <NewIngredientWrapper> <div> <p>Name</p> <TextInput name='name' onChange={handleNameChange}></TextInput> </div> <div> <p>Amount</p> <TextInput name='amount' onChange={handleAmountChange}></TextInput> </div> <div> <p>Measurement (if not applicable, input 'null')</p> <TextInput name='measure' placeholder='lbs., gallons, boxes, oz., etc.' onChange={handleMeasureChange}></TextInput> </div> <SaveButton onClick={(e) => { handleSubmit({ newIngredientName, newIngredientAmount, newIngredientMeasure }); }}>Save</SaveButton> </NewIngredientWrapper> </form> </div > ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "loadSpriteSheet(){\n this.spriteSheet = loadImage('assets/sprites.png');\n }", "makeImagePath1(product) {\n return require(`../assets/images/${product.images[1]}`);\n }", "makeImagePath2(product) {\n return require(`../assets/images/${product.images[2]}`);\n }", "makeImagePath(product) {\...
[ "0.658954", "0.6346681", "0.63415027", "0.63189274", "0.6241132", "0.6230925", "0.6167694", "0.61458915", "0.6124944", "0.6080497", "0.59766334", "0.59392256", "0.5919421", "0.5881535", "0.5837802", "0.58300024", "0.581817", "0.57956165", "0.57904404", "0.57499623", "0.573972...
0.0
-1
From Relicensed from the "Do What the Fck You Want To Public License".
function getWeatherChanceValue(timeMs) { let unix = Math.floor(timeMs / 1000); // Get Eorzea hour for weather start let bell = unix / 175; // Do the magic 'cause for calculations 16:00 is 0, 00:00 is 8 and 08:00 is 16 let increment = (bell + 8 - (bell % 8)) % 24; // Take Eorzea days since unix epoch let totalDays = (unix / 4200) >>> 0; // The following math all needs to be done as unsigned integers. let calcBase = ((totalDays * 0x64) + increment) >>> 0; let step1 = ((calcBase << 0xB) ^ calcBase) >>> 0; let step2 = ((step1 >>> 8) ^ step1) >>> 0; return step2 % 0x64; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function licNotice(answer) {\n if (answer === 'Apache 2.0') {\n return `\n Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file \n except in compliance with the License. You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless ...
[ "0.70789", "0.6999031", "0.6574779", "0.64180183", "0.6207177", "0.6175353", "0.6149885", "0.61334527", "0.6129822", "0.6101268", "0.60971665", "0.5987143", "0.5964633", "0.59605193", "0.59283227", "0.59272885", "0.59209794", "0.5912749", "0.59017444", "0.5894045", "0.5871221...
0.0
-1
when loaded shuffle data
componentDidMount() { this.setState({ data: this.shuffleArray(this.state.data) }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "shuffle() {\n // TODO\n }", "function load() {\n shuffle();\n var shuffledDeck = deck.slice(0, 5);\n checkPoints(shuffledDeck);\n}", "function ReloadTestData(data) {\n Frc.shuffle() ;\n for (var i=0; i<data.length; i++) {\n data[i][0] = Frc[i] ;\n data[i][1] = Math.floor(Math.random()*10) ...
[ "0.7255586", "0.6966312", "0.69415176", "0.6862799", "0.6795091", "0.6694614", "0.66945124", "0.66750777", "0.6668145", "0.6665998", "0.665834", "0.66227144", "0.6619545", "0.6583857", "0.65673214", "0.65652734", "0.6564522", "0.65384674", "0.65221536", "0.64816993", "0.64653...
0.6153941
46
Firebug console or native browser console
function consoleLog() { if (typeof(console) == 'object' && typeof(console["log"]) != "undefined") { console.log.apply(console, arguments); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getFirebugConsole(safeWin, unsafeWin, chromeWin) {\n try {\n chromeWin = chromeWin.top;\n // assert FB is installed\n if (!chromeWin.Firebug)\n return null;\n var fbVersion = parseFloat(chromeWin.Firebug.version);\n var fbConsole = chromeWin.Firebug.Console;\n var fbContext = chrom...
[ "0.73394054", "0.71571153", "0.71571153", "0.7101851", "0.7101851", "0.67744005", "0.6665635", "0.6665635", "0.6665635", "0.6656699", "0.65939444", "0.6421116", "0.62636", "0.6251301", "0.62359285", "0.62083554", "0.62083554", "0.6190509", "0.6182183", "0.6164408", "0.6164408...
0.0
-1
Return an associative array with the GET parameters of the supplied URL, or the URL of the current page if no parameter is passed.
function getUrlParams(url) { var params = {}; if (typeof url == "undefined") { url = window.location.href; } var parts = url.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m, key, value) { params[key] = decodeURIComponent(value); }); return params; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function get_url_params() {\n var url_params = new URLSearchParams(window.location.search);\n\n return url_params;\n}", "function getURLParams()\n{\n var vars = [], hash;\n var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');\n for(var i = 0; i < hashes.length; i+...
[ "0.7449035", "0.71950054", "0.7156514", "0.7113758", "0.71092767", "0.7099208", "0.70852816", "0.70024765", "0.6989503", "0.69468063", "0.69382787", "0.69286877", "0.69168925", "0.6881164", "0.6865311", "0.68546534", "0.6845076", "0.6842526", "0.68425244", "0.68345886", "0.68...
0.6447991
48
Binary search in a sorted array with timestamps : [[t1, ...], [t2, ...], ...] Return the index of the first element with a timestamp > t, or null if the array does not contain anything newer.
function bsearchT(t, arr) { var first = 0; var last = arr.length - 1; if (last < 0 || arr[last][0] <= t) { return null; } if (arr[first][0] > t) { return first; } while (first < last) { var mid = Math.floor((first + last) / 2); if (arr[mid][0] <= t) { first = mid + 1; if (arr[first][0] > t) { return first; } } else { last = mid; } } return first; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function binarySearch(t) {\n\t\tlet low = 0;\n\t\tlet high = records.length - 1;\n\t\tlet curr = Math.floor((high + low) / 2);\n\t\twhile(low < high) {\n\t\t\tif(t < records[curr]['to']) {\n\t\t\t\thigh = curr;\n\t\t\t}\n\t\t\telse if(t > records[curr]['to']) {\n\t\t\t\tlow = curr + 1;\n\t\t\t}\n\t\t\telse {\n\t\t...
[ "0.6692026", "0.603222", "0.58841443", "0.5838607", "0.5710833", "0.5693896", "0.56424975", "0.56329405", "0.56132275", "0.560815", "0.55794936", "0.5572304", "0.55640244", "0.55564404", "0.55507666", "0.55328894", "0.551211", "0.5504179", "0.55022097", "0.5498574", "0.549204...
0.71609294
0
Concatenate or merge two sorted arrays with timestamps. In most cases, it should be a simple concatenation. Return the merged array
function concatT(old_array, new_array) { if (old_array.length <= 0) { return new_array; } if (new_array.length <= 0) { return old_array; } if (old_array[old_array.length - 1][0] < new_array[0][0]) { return old_array.concat(new_array); } var i = bsearchT(new_array[0][0], old_array); if (i == null) { i = old_array.length - 1; while ((i > 0) && (old_array[i - 1][0] == new_array[0][0])) { i--; } } // clone the old array because we will be modifying it with splice() var merged_array = old_array.slice(0); for (var n = 0; n < new_array.length; n++) { while ((i < merged_array.length) && (merged_array[i][0] <= new_array[n][0])) { while (merged_array[i][0] == new_array[n][0]) { // consoleLog("skipping duplicate element ", i, n); n++; if (n >= new_array.length) { // consoleLog("returning early, duplicates"); return merged_array; } } i++; } if (i == merged_array.length) { // consoleLog("returning now"); while ((n < new_array.length) && (merged_array[i - 1][0] == new_array[n][0])) { n++; } if (n < new_array.length) { return merged_array.concat(new_array.slice(n)); } else { return merged_array; } } // consoleLog("inserting element", n, "at", i, "(", new_array[n], ")"); merged_array.splice(i, 0, new_array[n]); i++; } // consoleLog("returning merged array"); return merged_array; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "mergeTime(arr1,arr2) {\n let results = [];\n let i=0;\n let j=0;\n while(i < arr1.length && j < arr2.length) {\n if (arr1[i] < arr2[j]) {\n results.push(arr1[i]);\n i++;\n } else {\n results.push(arr2[j]);\n j++\n }\n\n }\n while(i < ...
[ "0.6954699", "0.6610238", "0.6475205", "0.64210343", "0.64019394", "0.6389138", "0.6382141", "0.63683087", "0.6358739", "0.63477653", "0.6313073", "0.631112", "0.6281394", "0.627489", "0.62728834", "0.62665325", "0.62655294", "0.6260682", "0.6214105", "0.620859", "0.6207264",...
0.0
-1
Inventory handling managing the database of network elements (nodes)
function node_new(new_node_id) { if (new_node_id in nodes) { consoleWarn("Trying to add already existing node '" + new_node_id + "'."); return; } consoleLog("Adding new node: '" + new_node_id + "'."); nodes[new_node_id] = { events: [], load: [], state: { updated: 0, owner: null, }, vms: {}, }; // monitor that new node once nodes_monitored.push('&,' + new_node_id); nodes_redraw = true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function inventory() { }", "function addInventory() {\n var sqlQuery = 'SELECT * FROM products';\n connection.query(sqlQuery, function(error, data) {\n if (error) throw error;\n selectAddInventory(data);\n });\n}", "function inventory() {\n connection.query(\"SELECT * FROM products\", function (err...
[ "0.6748815", "0.6406075", "0.61015695", "0.60950416", "0.5859845", "0.5858853", "0.58533084", "0.58446", "0.5832837", "0.57878", "0.5770771", "0.5763984", "0.5655934", "0.5634753", "0.5616509", "0.558508", "0.5581621", "0.5580245", "0.5557528", "0.5539375", "0.5536774", "0....
0.0
-1
Display Left sidebar with list of network elements and VMs obj can be any object with the fields ._html_id and ._expanded
function appendExpandableItem(selector, obj, extraCss, htmlHeader, htmlContent) { var liCss = "expandable"; if (extraCss) { liCss += " " + extraCss; } $(selector).append("<li class=\"" + liCss + "\" id=\"" + obj._html_id + "\">" + "<div class=\"exphead\">" + htmlHeader + "</div>" + "<div class=\"expcontent\">" + htmlContent + "</div>" + "</li>\n"); if (obj._expanded) { $("#" + obj._html_id).addClass("expanded");; } else { $("#" + obj._html_id + " .expcontent").hide(); obj._expanded = false; } $("#" + obj._html_id + " .expander").toggle(function(_obj) { return function() { $("#" + _obj._html_id + " .expcontent").show("fast"); $("#" + _obj._html_id).addClass("expanded");; $("#" + _obj._html_id + " .expander").removeClass("ui-icon-circle-triangle-s");; $("#" + _obj._html_id + " .expander").removeClass("ui-icon-minus");; $("#" + _obj._html_id + " .expander").addClass("ui-icon-circle-triangle-n");; _obj._expanded = true; }; }(obj), function(_obj) { return function () { $("#" + _obj._html_id + " .expcontent").hide("fast"); $("#" + _obj._html_id).removeClass("expanded"); $("#" + _obj._html_id + " .expander").removeClass("ui-icon-circle-triangle-n");; $("#" + _obj._html_id + " .expander").removeClass("ui-icon-minus");; $("#" + _obj._html_id + " .expander").addClass("ui-icon-circle-triangle-s");; _obj._expanded = false; }; }(obj)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function NetworksListView(){\n\tclearNav();\n\t\n\tclearSection();\n\tvar local_simulation = get_local_simulation();\n\tvar local_device = get_local_device();\n\tvar lists = getRealNetworks(local_simulation.partition_list);\n\tvar html = NetworksListTemplate(lists, local_device);\n\t\n\tgetContainer().innerHTML = ...
[ "0.5827435", "0.5647786", "0.5639772", "0.55595374", "0.5522421", "0.54525256", "0.5373643", "0.5274206", "0.5258011", "0.52563655", "0.5255725", "0.52402157", "0.5239843", "0.5203601", "0.51751214", "0.5164824", "0.51629835", "0.51415753", "0.51398903", "0.5106465", "0.51014...
0.0
-1
Display Tabs (settings, load graph, other)
function inputCheck(boolvar, idname) { return boolvar ? '<input type="checkbox" id="' + idname + '" value="' + idname + '" checked="checked"/>' : '<input type="checkbox" id="' + idname + '" value="' + idname + '"/>'; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function display_tabs( tabs ) {\n var tabs_code = $(tabs);\n\n set_active_tab( tabs_code );\n preapare_tabs_interface( tabs_code );\n\n $('#app-table>header').empty();\n $('#app-table>header').append( tabs_code );\n }", "loadOneTab() { }", "function Tabs(category) {\n v...
[ "0.7116724", "0.67973834", "0.6741595", "0.6683811", "0.6567229", "0.65133363", "0.6511479", "0.6489277", "0.64860547", "0.6441037", "0.6407865", "0.63903385", "0.63262546", "0.63157994", "0.631398", "0.631018", "0.62997675", "0.6296913", "0.62897027", "0.628574", "0.6282097"...
0.0
-1
global, used for tooltips
function displayLoadGraph(node_id) { if (! (node_id in nodes)) { consoleWarn("Cannot display load graph for unknown node:", node_id); return; } load_redraw = false; var node_name = node_id; var low_threshold = 0; var high_threshold = 100; var max_tps = 4.999; if ("state" in nodes[node_id]) { if ("name" in nodes[node_id].state) { node_name = nodes[node_id].state.name; } if ("low_threshold" in nodes[node_id].state) { low_threshold = nodes[node_id].state.low_threshold; } if ("high_threshold" in nodes[node_id].state) { high_threshold = nodes[node_id].state.high_threshold; } if ("hard_max_tp" in nodes[node_id].state) { max_tps = +nodes[node_id].state.hard_max_tp + 0.999; } } var load_data = []; if ("load" in nodes[node_id]) { load_data = nodes[node_id].load; } var t1 = new Date().getTime(); // now var t0 = t1 - oldLoadGraphPeriod * 60 * 1000; // default: -20 minutes // rdcchhb - check the received tp_data and load_data // consoleAddMessage("#console1", CONSOLE_INFO, '[rdcchhb] current time is "' +t1 + '"'); // setup plot var colors = [ "#d1d2d4", "#89ba17", "#e32119", "#00a9d4", "#d1d2d4" ]; var colorsbg = [ "#e1e2e3", "#d5e4af", "#f6b495", "#badeee", "#e1e2e3" ]; var options = { series: { shadowSize: 0 }, grid: { hoverable: true }, xaxis: { min: t0, max: t1, mode: "time", timezone: "browser" }, yaxes: [ { min: 0, max: 100, color: "#00a9d4", tickFormatter: function(v, axis) { return v + "% "; } }, { min: 0, max: max_tps, tickDecimals: 0, position: "right", color: "#b1b3b4" } ], legend: { position: 'nw', sorted: true }, colors: colors }; var lowLine = [[t0, low_threshold], [t1, low_threshold]]; var highLine = [[t0, high_threshold], [t1, high_threshold]]; var tp_data = []; tp_labels = []; if ("events" in nodes[node_id]) { var num_tp = 0; for (var e = 0; e < nodes[node_id].events.length; e++) { var event_type = nodes[node_id].events[e][1]; if (( event_type >= EVENT_NE_SCALE_OUT && event_type <= EVENT_NE_SCALE_IN_FAIL) || (event_type == EVENT_NE_UPDATED_INV)) { num_tp = nodes[node_id].events[e][2]; var event_time = nodes[node_id].events[e][0] // protect against events happening exactly at the same time if ((tp_data.length == 0) || (tp_data[tp_data.length - 1][0] != event_time)) { tp_data.push( [ event_time, num_tp ] ); if (event_type == EVENT_NE_SCALE_OUT) { tp_labels.push("Scaling out"); } else if (event_type == EVENT_NE_SCALE_OUT_DONE) { tp_labels.push("Finished scaling out"); } else if (event_type == EVENT_NE_SCALE_OUT_FAIL) { tp_labels.push("Failed scaling"); } else if (event_type == EVENT_NE_SCALE_IN) { tp_labels.push("Scaling in"); } else if (event_type == EVENT_NE_SCALE_IN_DONE) { tp_labels.push("Finished scaling in"); } else if (event_type == EVENT_NE_SCALE_IN_FAIL) { tp_labels.push("Failed scaling"); } else if (event_type == EVENT_NE_UPDATED_INV) { tp_labels.push("Updated inventory"); } else { tp_labels.push(""); } } } } // set a point in the future for the number of TPs if (num_tp > 0) { if (nodes[node_id].state.status == STATUS_SCALING_IN) { num_tp--; } else if (nodes[node_id].state.status == STATUS_SCALING_OUT) { num_tp++; } tp_data.push( [ t1 + 600 * 1000, num_tp ] ); } } loadGraph = $.plot($("#loadgraph"), [ { data: tp_data, lines: { fill: true }, label: "Number of traffic processors", yaxis: 2 }, lowLine, highLine, { data: load_data, label: node_name + " load" }, ], options); // rdcchhb - check the received tp_data and load_data // consoleAddMessage("#console1", CONSOLE_INFO, '[rdcchhb] loadgraph subroutine. load_data is "' +load_data + '"'); // consoleAddMessage("#console1", CONSOLE_INFO, '[rdcchhb] loadgraph subroutine. tp_data is "' +tp_data + '"'); // consoleAddMessage("#console1", CONSOLE_INFO, '[rdcchhb] loadgraph subroutine. numb_tp is "' +num_tp + '"'); /* var tx = (t0 + t1) / 2; var o = loadGraph.pointOffset( { x: tx, y: 1, yaxis: 2 } ); var ctx = loadGraph.getCanvas().getContext("2d"); ctx.beginPath(); o.left += 4; ctx.moveTo(o.left, o.top); ctx.lineTo(o.left, o.top - 10); ctx.lineTo(o.left + 10, o.top - 5); ctx.lineTo(o.left, o.top); ctx.fillStyle = "#000"; ctx.fill(); */ $("#loadgraph").bind("plothover", function (event, pos, item) { if (item) { if (previousPoint != item.dataIndex) { previousPoint = item.dataIndex; $("#graphtooltip").remove(); var d = new Date(item.datapoint[0]); var h = d.getHours(); if (h < 10) { h = '0' + h; } var m = d.getMinutes(); if (m < 10) { m = '0' + m; } var s = d.getSeconds(); if (s < 10) { s = '0' + s; } var msg = "Time: " + h + ":" + m + ":" + s + "<br />"; if (item.seriesIndex == 0) { if ((item.dataIndex >= 0) && (item.dataIndex <= tp_labels.length) && tp_labels[item.dataIndex]) { msg += tp_labels[item.dataIndex] + "<br />"; } msg += "Number of TPs: <b>" + item.datapoint[1] + "</b>"; } else if (item.seriesIndex == 1) { msg = "Low threshold: <b>" + item.datapoint[1] + "%</b>"; } else if (item.seriesIndex == 2) { msg = "High threshold: <b>" + item.datapoint[1] + "%</b>"; } else if (item.seriesIndex == 3) { msg += node_name + " load: <b>" + item.datapoint[1].toFixed(2) + "%</b>"; } else if (item.seriesIndex == 4) { msg += "Event: ???"; } graphShowTooltip(item.pageX, item.pageY, colorsbg[item.seriesIndex], colors[item.seriesIndex], msg); } } else { $("#graphtooltip").remove(); previousPoint = null; } }); var tphtml = '<table><tbody><tr>'; var sorted_vms = Object.keys(nodes[node_id].vms).sort(); for (var i = 0; i < sorted_vms.length; i++) { var vm = nodes[node_id].vms[sorted_vms[i]]; // rdcchhb - check the received tp_data and load_data // consoleAddMessage("#console1", CONSOLE_INFO, '[rdcchhb] vm"'+i+'".status is "' +vm.status+ '"'); if (vm.type == VM_TSP_CSCF_TP || vm.type == VM_TSP_MTAS_TP || vm.type == VM_CBA_CSCF_PL || vm.type == VM_CBA_MTAS_PL || vm.type == VM_LAPZ_MSC_CP || vm.type == VM_SEA_MSC_CP) { if (vm.status == "poweredOn") { if (("load" in vm) && (vm.load.length > 0)) { tphtml += add_tp_bar(vm.load[vm.load.length - 1][1]); } else { tphtml += add_tp_bar(0); } } else { tphtml += add_tp_bar(-1); } } } tphtml += '</tr></tbody></table>'; $("#loadtps").html(tphtml); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function init() {\n setUpToolTip();\n}", "function tooltips ( ) {\r\n\r\n\t\t// Tooltips are added with options.tooltips in original order.\r\n\t\tvar tips = scope_Handles.map(addTooltip);\r\n\r\n\t\tbindEvent('update', function(values, handleNumber, unencoded) {\r\n\r\n\t\t\tif ( !tips[handleNumber] ) {\r\n\t\...
[ "0.71197665", "0.7032768", "0.6950251", "0.6947077", "0.6947077", "0.6947077", "0.6947077", "0.6947077", "0.6947077", "0.6947077", "0.6947077", "0.6947077", "0.6947077", "0.692834", "0.68173313", "0.6794768", "0.67702866", "0.67702866", "0.67702866", "0.67702866", "0.67418414...
0.0
-1
Communication with the server
function serverResponse(data) { if (data == null) { consoleAddMessage("#console1", CONSOLE_ERROR, "Cannot communicate with server!"); consoleWarn('Null server response'); updates_failed++; return; } var timestamp = new Date().getTime(); consoleLog("data =", data); // DEBUG if (data.id != server_id) { consoleClear("#console1"); if (server_id != '0') { consoleAddMessage("#console1", CONSOLE_INFO, "Server restarted."); } server_id = data.id; nodes_updated = 0; } updates_failed = 0; for (var key in data) { if (key == "id") { // skip } else if (key == GLOBAL_EVENT) { consoleLog('Updating global events ', data[key]); // DEBUG nodes[key].events = concatT(nodes[key].events, data[key].events); for (var e in data[key].events) { consoleAddMessage("#console1", data[key].events[e][1], data[key].events[e][2], data[key].events[e][0]); } } else if (key == "nodes") { consoleLog('Updating list of nodes ', data.nodes); // DEBUG for (var n in data.nodes) { var node_id = data.nodes[n]; if (! (node_id in nodes)) { node_new(node_id); } nodes[node_id]._updated = timestamp; } for (var node_id in nodes) { if ((nodes[node_id]._updated != timestamp) && (node_id != '*')) { node_destroy(node_id); } } } else if (key == "nodes_t") { nodes_updated = data.nodes_t; } else { consoleLog('Updating node ' + key + ': ', data[key]); // DEBUG if (! data[key]) { // node does not exist (maybe already deleted by the code above) if (key in nodes) { node_destroy(key); } continue; } if ("events" in data[key]) { nodes[key].events = concatT(nodes[key].events, data[key].events); var name = key; if (("state" in data[key]) && ("name" in data[key].state)) { name = data[key].state.name; } else if ("name" in nodes[key].state) { name = nodes[key].state.name; } for (var e in data[key].events) { consoleAddMessage("#console1", data[key].events[e][1], data[key].events[e][2], data[key].events[e][0], key); } } if ("load" in data[key]) { nodes[key].load = concatT(nodes[key].load, data[key].load); if (key == tmp_monitor) { load_redraw = true; } } if ("state" in data[key]) { nodes[key].state = data[key].state; nodes_redraw = true; } if ("vms" in data[key]) { for (var vm_name in data[key].vms) { if (data[key].vms[vm_name]) { if (! nodes[key].vms) { nodes[key].vms = {}; } if (! nodes[key].vms[vm_name]) { node_add_vm(key, vm_name); } nodes[key].vms[vm_name].type = data[key].vms[vm_name].type; nodes[key].vms[vm_name].status = data[key].vms[vm_name].status; if ("events" in data[key].vms[vm_name]) { nodes[key].vms[vm_name].events = concatT(nodes[key].vms[vm_name].events, data[key].vms[vm_name].events); } if ("load" in data[key].vms[vm_name]) { nodes[key].vms[vm_name].load = concatT(nodes[key].vms[vm_name].load, data[key].vms[vm_name].load); load_redraw = true; } if ("proc_status" in data[key].vms[vm_name]) { nodes[key].vms[vm_name].proc_status = nodes[key].vms[vm_name].proc_status; } } else { if (nodes[key].vms && (vm_name in nodes[key].vms)) { node_del_vm(key, vm_name); } } } } } } if (nodes_redraw) { nodes_redraw = false; displayNodes('#vmlist'); } if (load_redraw && tmp_monitor) { displayLoadGraph(tmp_monitor); } consoleScroll("#console1"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "sendHello() {\n this.write({cmd: 'hello', str: 'Hello, client!'})\n this.write({cmd: 'hello2', str: 'Hello again, client!'})\n }", "run() {\n this.reset();\n this.socket = net.createConnection({\n 'host': this.host.address, \n 'port': this.port...
[ "0.67716396", "0.67308176", "0.6476318", "0.6284817", "0.6275366", "0.6255781", "0.62358505", "0.622459", "0.6172239", "0.61685896", "0.61518735", "0.61375487", "0.6124304", "0.61196613", "0.61148095", "0.61144704", "0.6103114", "0.6086432", "0.6082501", "0.6021248", "0.60173...
0.0
-1
Requests to the vappcontroller AJAX server. The option parameter 'nodes_params' will be added to the query string. The list of nodes to be monitored is in 'nodes_monitored'. Each element of that list is a node_id, optionally followed by a commaseparated list of VMs to monitor for that node. Prepending '&' to a node means that it should be removed after requesting the update once.
function queryServer(nodes_params) { //consoleLog("XXX nodes_params = ", nodes_params); if (! nodes_params) { nodes_params = ""; } if (! nodes_owner) { consoleAddMessage("#console1", CONSOLE_ERROR, "Missing operator name, cannot query server"); return; } //consoleLog('AJAX init for nodes: ', nodes_monitored); // DEBUG //consoleLog('nodes = ', nodes); // DEBUG // Subscribe to the global events if (nodes[GLOBAL_EVENT].events && nodes[GLOBAL_EVENT].events.length > 0) { nodes_params += "&ns=" + GLOBAL_EVENT + "," + nodes[GLOBAL_EVENT].events.slice(-1)[0][0] + ",-,-"; } else { nodes_params += "&ns=*,0,-,-"; } // Subscribe to changes to specific nodes for (var i = 0; i < nodes_monitored.length; i++) { var vm_info = nodes_monitored[i].split(","); var node_id = vm_info[0]; var temp_monitoring = false; if (node_id == '&') { vm_info.splice(0, 1); node_id = vm_info[0]; temp_monitoring = true; } if (! (node_id in nodes)) { consoleWarn('Cannot monitor unknown node:', node_id); nodes_monitored.splice(i, 1); i--; continue; } consoleLog('nodes[' + node_id + '] = ', nodes[node_id]); // DEBUG var event_time = 0; if (temp_monitoring) { event_time = '-'; } else if (nodes[node_id].events && nodes[node_id].events.length > 0) { event_time = nodes[node_id].events.slice(-1)[0][0]; } var load_time = 0; if (temp_monitoring) { load_time = '-'; } else if (nodes[node_id].load && nodes[node_id].load.length > 0) { load_time = nodes[node_id].load.slice(-1)[0][0]; } var state_time = 0; if (nodes[node_id].state && nodes[node_id].state.updated > 0) { state_time = nodes[node_id].state.updated; } // Parameters: node_id, event_time, load_time, state_time nodes_params += "&ns=" + encodeURIComponent(node_id) + "," + event_time + "," + load_time + "," + state_time; // Now check if we have to monitor any VMs for that node var vm_list_changed = false; for (var j = 1; j < vm_info.length; j++) { var vm_name = vm_info[j]; if (vm_name == '&') { vm_name = vm_info[j + 1]; vm_info.splice(j, 2); j--; vm_list_changed = true; } else if (! (vm_name in nodes[node_id].vms)) { consoleWarn('Cannot monitor unknown VM:', vm_name, 'for node:', node_id); continue; } consoleLog('nodes[' + node_id + '].vms[' + vm_name + '] = ', nodes[node_id].vms[vm_name]); // DEBUG if (nodes[node_id].vms[vm_name]) { var event_time = 0; if (nodes[node_id].vms[vm_name].events && nodes[node_id].vms[vm_name].events.length > 0) { event_time = nodes[node_id].vms[vm_name].events.slice(-1)[0][0]; } var load_time = 0; if (nodes[node_id].vms[vm_name].load && nodes[node_id].vms[vm_name].load.length > 0) { load_time = nodes[node_id].vms[vm_name].load.slice(-1)[0][0]; } // (node info) + vm_name, event_time, load_time nodes_params += "," + encodeURIComponent(vm_name) + "," + event_time + "," + load_time; } } // Check if the monitoring of this node was only temporary if (temp_monitoring) { nodes_monitored.splice(i, 1); i--; } else if (vm_list_changed) { consoleLog("@@@@@@@@@@@", nodes_monitored[i]); // DEBUG consoleLog("@@@@@@@@@@@", vm_info); // DEBUG nodes_monitored[i] = vm_info.join(","); consoleLog("@@@@@@@@@@@", nodes_monitored[i]); // DEBUG } } //consoleLog('AJAX nodes_params: ', nodes_params); // DEBUG // Send the request to the server $.getJSON('ajax?id=' + server_id + "&on=" + nodes_owner + "&nt=" + nodes_updated + nodes_params) .done(serverResponse) .fail(serverError); /* if (timer_test > 0) { timer_test--; consoleLog("----- Next automatic update in 5 seconds (" + timer_test + " left)."); consoleAddMessage("#console1", CONSOLE_DEBUG, "TEST: Next update in 5 seconds."); setTimeout(queryServer, 5000, ""); } else { consoleLog("----- End of automatic updates."); consoleAddMessage("#console1", CONSOLE_DEBUG, "TEST: Stopping automatic updates."); } */ }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function doGetNodes() {\r\n\tvar req = new XMLHttpRequest();\r\n\treq.open('GET', httpNodesUri, true);\r\n\treq.setRequestHeader('Cache-Control', 'no-cache');\r\n\r\n\treq.onreadystatechange = function () {\r\n\t\tif (this.readyState == 4 && this.status == 200) {\r\n\t\t\tnodesPayload = JSON.parse(req.responseText...
[ "0.5795913", "0.5479802", "0.5242063", "0.5240739", "0.5190827", "0.5136627", "0.5118279", "0.50525594", "0.50485504", "0.5048341", "0.49593544", "0.49365163", "0.49307957", "0.49262488", "0.49098712", "0.49049285", "0.48844138", "0.48787758", "0.48362127", "0.4832406", "0.48...
0.716084
0
Generate a random integer between min inclusive and max exclusive
function randomNumGenerator(min, max) { return Math.floor(Math.random() * (max - min) + min); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function randInt(min, max) { return Math.random() * (max - min) + min; }", "function randInt(min, max) { return Math.random() * (max - min) + min; }", "function generateRandomInteger(min, max) {\n return Math.floor(min + Math.random()*(max + 1 - min))\n }", "function randomIntGen(min, max){\n re...
[ "0.8915418", "0.8915418", "0.8751571", "0.8751237", "0.87481505", "0.8747737", "0.8727775", "0.8721387", "0.872062", "0.870209", "0.8697077", "0.8678767", "0.8676859", "0.86742", "0.8672972", "0.8669338", "0.8662761", "0.86609805", "0.8645277", "0.8638868", "0.86385864", "0...
0.0
-1
Given a string, return the character that is most commonly used in the string. Examples maxChar("abcccccccd") === "c" maxChar("apple 1231111") === "1"
function maxChar(str) { let max = 0; let winner = ''; const obj = [...str].reduce((acc, el) => { const element = acc[el] ? (acc[el] + 1) : 1 return Object.assign(acc, {[el]: element}) } , {}) for (let prop in obj) { if (obj[prop] > max) { max = obj[prop] winner = prop } } return winner; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function maxChar(string){\n\tlet max = 1;\n\tconst chars = {};\n\tlet maxChar = '';\n\n\tfor(let char of string){\n\t\tif(!chars[char]){\n\t\t\tchars[char] = 1;\n\t\t} else {\n\t\t\tchars[char]++;\n\t\t\tif(chars[char] > max){\n\t\t\t\tmax = chars[char];\n\t\t\t\tmaxChar = char;\n\t\t\t}\n\t\t}\n\t}\n\t\n\treturn ...
[ "0.8330308", "0.8295609", "0.8291538", "0.82900286", "0.8285804", "0.82841825", "0.82707596", "0.8268139", "0.82586545", "0.822154", "0.8205577", "0.8173499", "0.8163964", "0.8142509", "0.8108902", "0.8102258", "0.8016007", "0.80000407", "0.7979679", "0.79759455", "0.7967235"...
0.74749255
37
FIn Espesores.js Funcion calcular presion aplicada por el plato de carga
function PresionPlato(){ var carga = document.getElementById("carga").value; var radio = document.getElementById("radioPlato").value; var total = (carga/(Math.PI *Math.pow(radio,2))); var total2 = total.toFixed(3); document.getElementById("presionPlato").value = total2; //Reporte document.getElementById('recibeformulaPres').innerHTML = "p = "+carga+" lb / (3.14 * "+radio+" in ^ 2)"; document.getElementById('recibeformulaPres1').innerHTML = "p = "+total.toFixed(3)+" psi"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function calculocompraslocales(cant,costo)\n{\n var ret; \n var pu//preciounitario\n pu=costo/cant;// calculamos el costo unitario \n //if($(\"#nfact_imp\").val()!=\"SF\") //si tiene el texto SF es sin factura \n // ret=pu*glob_factorIVA; //confactura\n //else ...
[ "0.69221264", "0.691029", "0.66571826", "0.6635655", "0.65938306", "0.6586226", "0.6525497", "0.6522207", "0.6504812", "0.6486524", "0.6456231", "0.6447204", "0.64306766", "0.6379339", "0.63753706", "0.6370662", "0.63400877", "0.63332224", "0.63327044", "0.6323712", "0.631762...
0.61425966
41
Funcion Tipo de Base
function TipoDeBase(){ var selec= document.getElementById("cmbBases").value; var Temperatura = document.getElementById("temperatura").value; var carpetaAsfal = document.getElementById('espesorCarpAs').value; //Base Granular var g2=(-9.75931139328379E-17*Math.pow(Temperatura,9))+(5.46986907807787E-14*Math.pow(Temperatura,8))+(-1.27654962067594E-11*Math.pow(Temperatura,7))+(1.58864156551974E-09*Math.pow(Temperatura,6))+(-1.1023753410111E-07*Math.pow(Temperatura,5))+(3.76645182242896E-06*Math.pow(Temperatura,4))+(-6.53196229905006E-06*Math.pow(Temperatura,3))+(-0.00407329228255549*Math.pow(Temperatura,2))+(0.123821446090005*Temperatura)+(0.000495264121354921); var g4=(-1.19715687597883E-16*Math.pow(Temperatura,9))+(6.79683571074634E-14*Math.pow(Temperatura,8))+(-1.60371776893476E-11*Math.pow(Temperatura,7))+(2.0109845212668E-09*Math.pow(Temperatura,6))+(-1.39768070117618E-07*Math.pow(Temperatura,5))+(4.71830866821676E-06*Math.pow(Temperatura,4))+(-3.37913871817364E-06*Math.pow(Temperatura,3))+(-0.00521489431412192*Math.pow(Temperatura,2))+(0.149310492735822*Temperatura)+(0.000428946767669913); var g8=(-7.50532015925703E-17*Math.pow(Temperatura,9))+(4.60559688217666E-14*Math.pow(Temperatura,8))+(-1.17563329134641E-11*Math.pow(Temperatura,7))+(1.59756213119477E-09*Math.pow(Temperatura,6))+(-1.20932032943166E-07*Math.pow(Temperatura,5))+(4.55586268444108E-06*Math.pow(Temperatura,4))+(-2.08575530109556E-05*Math.pow(Temperatura,3))+(-0.00468997049392783*Math.pow(Temperatura,2))+(0.14747257163981*Temperatura)+(0.000354921151597409); var g12=(-3.97208981691757E-17*Math.pow(Temperatura,9))+(2.82342417162375E-14*Math.pow(Temperatura,8))+(-8.15889925607528E-12*Math.pow(Temperatura,7))+(1.23533836632328E-09*Math.pow(Temperatura,6))+(-1.03286285635384E-07*Math.pow(Temperatura,5))+(4.33938206434448E-06*Math.pow(Temperatura,4))+(-0.000035185010801797*Math.pow(Temperatura,3))+(-0.00417231872415869*Math.pow(Temperatura,2))+(0.14392283334746*Temperatura)+(0.000308782636238902); //Base Tratada Por Cemento var c2=(-4.15310099556024E-17*Math.pow(Temperatura,9))+(2.62622743173115E-14*Math.pow(Temperatura,8))+(-6.92666125737089E-12*Math.pow(Temperatura,7))+(9.76354528475776E-10*Math.pow(Temperatura,6))+(-7.7207082727071E-08*Math.pow(Temperatura,5))+(3.10215372678613E-06*Math.pow(Temperatura,4))+(-2.27882734407103E-05*Math.pow(Temperatura,3))+(-0.00299030349196983*Math.pow(Temperatura,2))+(0.106457175686955*Temperatura)+(0.000500063442871124); var c4=(2.59127222627986E-17*Math.pow(Temperatura,9))+(-7.03767350978749E-15*Math.pow(Temperatura,8))+(-3.45853147553157E-13*Math.pow(Temperatura,7))+(3.26213264734143E-10*Math.pow(Temperatura,6))+(-4.58844016115734E-08*Math.pow(Temperatura,5))+(2.69893461890547E-06*Math.pow(Temperatura,4))+(-4.66467863020625E-05*Math.pow(Temperatura,3))+(-0.0020598167211574*Math.pow(Temperatura,2))+(0.0982200116850436*Temperatura)+(0.000428806348963917); var c8=(2.95215822351919E-17*Math.pow(Temperatura,9))+(-8.20861037376417E-15*Math.pow(Temperatura,8))+(-3.1408641692262E-13*Math.pow(Temperatura,7))+(3.57151756086305E-10*Math.pow(Temperatura,6))+(-5.07102067004439E-08*Math.pow(Temperatura,5))+(2.96892653928182E-06*Math.pow(Temperatura,4))+(-4.98725004263179E-05*Math.pow(Temperatura,3))+(-0.00230019488662947*Math.pow(Temperatura,2))+(0.105814001726685*Temperatura)+(0.000345136123030443); var c12=(3.10255979038948E-17*Math.pow(Temperatura,9))+(-7.95009115370183E-15*Math.pow(Temperatura,8))+(-6.29136947074595E-13*Math.pow(Temperatura,7))+(4.26954924540035E-10*Math.pow(Temperatura,6))+(-5.75614386155721E-08*Math.pow(Temperatura,5))+(3.27351174611579E-06*Math.pow(Temperatura,4))+(-5.21425059218927E-05*Math.pow(Temperatura,3))+(-0.00259911620742059*Math.pow(Temperatura,2))+(0.114594311249675*Temperatura)+(0.000306507428604164); if (Temperatura!=68) { if (selec == 1) { if(carpetaAsfal >= 0 && carpetaAsfal <=2) {//0 a 2 var total = (g2 -1)/2+1; document.getElementById("FactorCorrec").value=total.toFixed(7); document.getElementById('tipoBase').innerHTML = 'G'+carpetaAsfal; }else if (carpetaAsfal >= 2 && carpetaAsfal <=4) {//2 a 4 var total = (((g4 -g2)*(carpetaAsfal-2))/2)+g2; document.getElementById("FactorCorrec").value=total.toFixed(7); document.getElementById('tipoBase').innerHTML = 'G'+carpetaAsfal; }else if (carpetaAsfal >= 4 && carpetaAsfal <=8) {//4 a 8 var total = (((g8 -g4)*(carpetaAsfal-4))/4)+g4; document.getElementById("FactorCorrec").value=total.toFixed(7); document.getElementById('tipoBase').innerHTML = 'G'+carpetaAsfal; }else if (carpetaAsfal >= 8 && carpetaAsfal <=12) {//8 a 12 var total = (((g12 -g8)*(carpetaAsfal-8))/4)+g8; document.getElementById("FactorCorrec").value=total.toFixed(7); document.getElementById('tipoBase').innerHTML = 'G'+carpetaAsfal; } }else if (selec == 2) { if(carpetaAsfal >= 0 && carpetaAsfal <=2) { var total = (c2 -1)/2+1; document.getElementById("FactorCorrec").value=total.toFixed(7); document.getElementById('tipoBase').innerHTML = 'G'+carpetaAsfal; }else if (carpetaAsfal >= 2 && carpetaAsfal <=4) { var total = (((c4 -c2)*(carpetaAsfal-2))/2)+c2; document.getElementById("FactorCorrec").value=total.toFixed(7); document.getElementById('tipoBase').innerHTML = 'G'+carpetaAsfal; }else if (carpetaAsfal >= 4 && carpetaAsfal <=8) { var total = (((c8 -c4)*(carpetaAsfal-4))/4)+c4; document.getElementById("FactorCorrec").value=total.toFixed(7); document.getElementById('tipoBase').innerHTML = 'G'+carpetaAsfal; }else if (carpetaAsfal >= 8 && carpetaAsfal <=12) { var total = (((c12 -c8)*(carpetaAsfal-8))/4)+c8; document.getElementById("FactorCorrec").value=total.toFixed(7); document.getElementById('tipoBase').innerHTML = 'G'+carpetaAsfal; } } }else if (Temperatura==68) { document.getElementById("FactorCorrec").value=1; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Base() {}", "function Base() {\n}", "function inherit(){}", "function UHRBase() {\n\n}", "function UHRBase() {\n\n}", "function Base() {\n }", "function heredaDe(prototipoHijo, prototipoPadre) { // Esta es una funcion que recibe funciones\n var fn = function () {} // Creamos una funcion ...
[ "0.6532928", "0.6197199", "0.60917866", "0.5872962", "0.5872962", "0.5781031", "0.5775686", "0.57492447", "0.5748079", "0.57284015", "0.57284015", "0.57284015", "0.57158786", "0.5667755", "0.5624914", "0.5551917", "0.55508125", "0.5547337", "0.55472785", "0.55345565", "0.5526...
0.0
-1
Shares the Etherpad name with other participants.
function shareEtherpad() { connection.emuc.addEtherpadToPresence(etherpadName); connection.emuc.sendPresence(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function shareEtherpad() {\n APP.xmpp.addToPresence(\"etherpad\", etherpadName);\n}", "assignGuestName (socket, guestNumber, nickNames, namesUsed) {\n const name = `Guest_${guestNumber}`;\n nickNames[socket.id] = name;\n socket.emit('nameResult', {\n success: true,\n name\n });\n name...
[ "0.7512528", "0.5725569", "0.5453142", "0.53935593", "0.5236883", "0.51516825", "0.5109399", "0.5108649", "0.5088656", "0.5067909", "0.5035694", "0.50278795", "0.4972351", "0.49517295", "0.4935706", "0.49336493", "0.49251348", "0.49026814", "0.48963198", "0.4892752", "0.48908...
0.77199477
0
Creates the Etherpad button and adds it to the toolbar.
function enableEtherpadButton() { if (!$('#etherpadButton').is(":visible")) $('#etherpadButton').css({display: 'inline-block'}); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "renderToolbarButton() {\n const toolbars = this.instance.getChildByClass(this.instance.root, 'gm-toolbar');\n if (!toolbars) {\n return; // if we don't have toolbar, we can't spawn the widget\n }\n\n const toolbar = toolbars.children[0];\n this.toolbarBtn = document.cr...
[ "0.6851485", "0.66250414", "0.64830184", "0.6451737", "0.642687", "0.6409139", "0.63990515", "0.6396914", "0.6383983", "0.63486415", "0.6343713", "0.6335535", "0.6272856", "0.6271495", "0.62020123", "0.6180282", "0.61585486", "0.61349076", "0.61278486", "0.61225927", "0.61106...
0.67477375
1
Creates the IFrame for the etherpad.
function createIFrame() { etherpadIFrame = document.createElement('iframe'); etherpadIFrame.src = domain + etherpadName + options; etherpadIFrame.frameBorder = 0; etherpadIFrame.scrolling = "no"; etherpadIFrame.width = $('#largeVideoContainer').width() || 640; etherpadIFrame.height = $('#largeVideoContainer').height() || 480; etherpadIFrame.setAttribute('style', 'visibility: hidden;'); document.getElementById('etherpad').appendChild(etherpadIFrame); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createIFrame() {\n etherpadIFrame = document.createElement('iframe');\n etherpadIFrame.src = domain + etherpadName + options;\n etherpadIFrame.frameBorder = 0;\n etherpadIFrame.scrolling = \"no\";\n etherpadIFrame.width = $('#largeVideoContainer').width() || 640;\n etherpadIFrame.height ...
[ "0.6959947", "0.62934476", "0.5976476", "0.5947101", "0.5905134", "0.58901954", "0.58202726", "0.5731176", "0.5726435", "0.5583179", "0.5579358", "0.5578177", "0.5576883", "0.55499953", "0.552492", "0.54762864", "0.5454121", "0.54252005", "0.5406613", "0.5370379", "0.5299502"...
0.7749555
0
Check if the current addon intends to be hinted. Typically this is for hinting/linting libraries such as eslint or jshint
hintingEnabled() { let isProduction = process.env.EMBER_ENV === 'production'; let testsEnabledDefault = process.env.EMBER_CLI_TEST_COMMAND === 'true' || !isProduction; let explicitlyDisabled = this.app && this.app.options && this.app.options.hinting === false; return testsEnabledDefault && !explicitlyDisabled; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function hasHint (hints) {\n\tfor (var i in hints) {\n\t\tif (hints[i]) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}", "function check_hint()\n{\n\t\n\t// Did we already show hint? Or are there no ongoing drags/animations?\n\tif (showing_hint){\n\t\tconsole.log(\"Checking hint...\");\n\t\t\n\t\t//Get th...
[ "0.6574414", "0.6193216", "0.5987149", "0.5922055", "0.57744765", "0.56574875", "0.55860376", "0.55728495", "0.55728495", "0.55127203", "0.54249", "0.53932047", "0.5368473", "0.53547674", "0.5346847", "0.53449714", "0.5342256", "0.53201014", "0.5317996", "0.5314137", "0.53121...
0.6407347
1
Discovers all child addons of this addon and an AddonInfo about each addon in this.addonPackages (keyed on addon name). Child addons include those from 'dependencies' (not devDependencies) and inrepo addons Any packageInfos that we find that are marked as not valid are excluded.
discoverAddons() { // prefer `packageRoot`, fallback to `root`; this is to maintain backwards compatibility for // consumers who create a new instance of the base addon model class directly and don't set // `packageRoot` let pkgInfo = this.packageInfoCache.getEntry(this.packageRoot || this.root); if (pkgInfo) { let addonPackageList = pkgInfo.discoverAddonAddons(); this.addonPackages = pkgInfo.generateAddonPackages( addonPackageList, (addonInfo) => this.shouldIncludeChildAddon && !this.shouldIncludeChildAddon(addonInfo) ); // in case any child addons are invalid, dump to the console about them. pkgInfo.dumpInvalidAddonPackages(addonPackageList); } else { // There are cases where an addon can be created in memory and not actually // have a root entry (or have one that is not actually pointing to a directory, // like 'foo' in some of the tests. We don't want to crash, but want to let // things continue even though they're empty. this.addonPackages = Object.create(null); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async updateAddonRepositoryData() {\n let addons = await this.getVisibleAddons(null);\n logger.debug(\"updateAddonRepositoryData found \" + addons.length + \" visible add-ons\");\n\n await Promise.all(addons.map(addon =>\n AddonRepository.getCachedAddonByID(addon.id).then(aRepoAddon => {\n if ...
[ "0.61474013", "0.5913503", "0.58219624", "0.55046535", "0.5239861", "0.5029384", "0.4901486", "0.48491442", "0.4828232", "0.4789205", "0.47610164", "0.4704393", "0.46947834", "0.4628979", "0.45738834", "0.45402002", "0.44923258", "0.4471209", "0.44631553", "0.44427586", "0.44...
0.73463976
0
This method climbs up the hierarchy of addons up to the host application. This prevents previous addons (prior to `this.import`, ca 2.7.0) to break at importing assets when they are used nested in other addons.
_findHost() { let current = this; let app; // Keep iterating upward until we don't have a grandparent. // Has to do this grandparent check because at some point we hit the project. do { app = current.app || app; } while (current.parent.parent && (current = current.parent)); return app; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "discoverAddons() {\n // prefer `packageRoot`, fallback to `root`; this is to maintain backwards compatibility for\n // consumers who create a new instance of the base addon model class directly and don't set\n // `packageRoot`\n let pkgInfo = this.packageInfoCache.getEntry(this.packageRoot || this.root...
[ "0.5383611", "0.51045036", "0.49603733", "0.49231604", "0.48563278", "0.48110336", "0.47793204", "0.477812", "0.47137147", "0.47124335", "0.46880016", "0.46701124", "0.45786047", "0.45522353", "0.4539783", "0.4539087", "0.45117006", "0.4509285", "0.4509285", "0.4503998", "0.4...
0.0
-1
Send everyone in the playerlist their name as well as everyone in the que
static sendQue(socket) { var playerNames = Player.updateNames() for(var i in Player.list){ var socket = SOCKET_LIST[i]; //socket.emit('Players', socket.name, playerNames) console.log(playerNames) socket.emit('Players', socket.name, playerNames) } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "sendAllMembers(name, data) {\n\t\tlet member = Array.from(this.members).filter((user) => user.name === name);\n\t\tconst memNames = [];\n\t\tfor (let member of this.members) {\n\t\t\tmember.name === name ? memNames.push(\"you\") : memNames.push(member.name);\n\t\t}\n\t\tdata.text = \"In room: \".concat(memNames.jo...
[ "0.68723124", "0.6763342", "0.6680726", "0.6528784", "0.6374334", "0.6221974", "0.6218211", "0.6205564", "0.6189486", "0.599907", "0.5945769", "0.58558273", "0.5853555", "0.5852155", "0.5834324", "0.58187205", "0.58121324", "0.57838976", "0.5770352", "0.5768452", "0.57546073"...
0.7443067
0
Get the current playernames
static updateNames() { var playerNames = []; for (var i in Player.list) { playerNames.push(SOCKET_LIST[i].name); } ; return playerNames; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getAllNamesPlayers()\n {\n return this.players.map(player => player.getName());\n }", "function getPlayerName(player) {\r\n return player.PLAYER;\r\n}", "function loadPlayerNames() {\n var player_names = [\n\t\t\"Aaron Ramsey\",\n\t\t\"Abdul Rahman Baba\",\n\t\t\"Adam Lallana\",\n\t\t\"Adem Ljajic\"...
[ "0.8027108", "0.6836199", "0.6812035", "0.67015815", "0.6587808", "0.65266365", "0.65075004", "0.6490363", "0.6465564", "0.64560485", "0.6404803", "0.6327427", "0.63038665", "0.62832254", "0.6272092", "0.62528354", "0.6205687", "0.6183072", "0.6177864", "0.6103091", "0.606273...
0.7790094
1
href = Thiago Vallin / Rafa Reis
decodeHtml(html) { const txt = document.createElement('textarea'); txt.innerHTML = html; return txt.value; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get href() {return encodeURI(stringAttribute.get(this, 'href'));}", "get href(){return $href;}", "get href(){return $href;}", "function _(e){var t=document.createElement(\"a\");return t.href=e,t}", "function href(editor, v) {\n\t\tvar a = getFirstAnchor(editor);\n\t\tif (!v)\n\t\t\treturn a ? a.href : '';\...
[ "0.715427", "0.7025624", "0.7025624", "0.69692576", "0.6806277", "0.6662019", "0.65937364", "0.65353584", "0.6448026", "0.6439492", "0.6422836", "0.6420274", "0.6417747", "0.63884336", "0.63637036", "0.6358394", "0.63380945", "0.63355356", "0.6295218", "0.62860197", "0.628601...
0.0
-1
it tells the store what specific parts it needs to be notified of when a change occurs so they can update state accordingly and rerender; this is how the App component subscribes to the store this func and Provider make it possible to render new state;
function mapStateToProps(state) { return { chores: state.chores } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Provider({ store, children }) {\n //console.log(\"STORE_PROVIDER_IS_ACTIVEs\");\n\n const [state, setState] = React.useState(\n store.getState()\n );\n React.useEffect(\n () =>\n store.subscribe(() => {\n\n //console.log(\"REDUX_STORE_IS_ACTIVEs\");\n\n const lastState = store...
[ "0.69938886", "0.6726515", "0.6695996", "0.6692172", "0.66502285", "0.6575116", "0.65651673", "0.6422997", "0.639718", "0.63311505", "0.6317546", "0.6312911", "0.62977636", "0.62741876", "0.62570065", "0.61951196", "0.6181496", "0.6161795", "0.6138613", "0.61331934", "0.61126...
0.0
-1
Anything returned from this function will end up as props on the PromoForm container
function mapDispatchToProps(dispatch) { // Whenever selectBrand is called, the result // should be passed to all of our reducers. return bindActionCreators({selectBrand, selectPromotion, selectSlot, selectFullPromo, editFields}, dispatch); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "getProps() {\n let result = super.getProps();\n result.label = result.label ? result.label : '';\n result.inputStyle = result.inputStyle ? result.inputStyle : {};\n result.containerStyle = result.containerStyle ? result.containerStyle: {};\n result.labelStyle = result.labelStyle ...
[ "0.65741825", "0.6216278", "0.61510366", "0.598923", "0.59588194", "0.59496826", "0.59447855", "0.5941818", "0.5912043", "0.5898496", "0.5887556", "0.5874158", "0.586362", "0.58521545", "0.5847194", "0.58258474", "0.58124006", "0.57844436", "0.57683843", "0.57674646", "0.5724...
0.0
-1
Write a object to the database file.
async function writeToDB(content) { try { await fs.writeFileSync(path.join(__dirname, '../../db/db.json'), JSON.stringify(content)); } catch(err) { console.log('Could not write to file :(' + err); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "writeDbObject(obj) {\n this.writeUB4(obj.toid.length);\n this.writeBytesWithLength(obj.toid);\n if (obj.oid) {\n this.writeUB4(obj.oid.length);\n this.writeBytesWithLength(obj.oid);\n } else {\n this.writeUB4(0);\n }\n this.writeUB4(0); // snapshot\n this.write...
[ "0.71094847", "0.6413418", "0.63722146", "0.6359445", "0.6230884", "0.6033907", "0.5939538", "0.57657427", "0.57487947", "0.5743452", "0.5719728", "0.5696048", "0.5696048", "0.56669116", "0.5648214", "0.5644914", "0.56444734", "0.56049013", "0.55927575", "0.55857855", "0.5570...
0.5555999
23
Read a database file to a object.
async function readFromDB() { return await JSON.parse(fs.readFileSync(path.join(__dirname, '../../db/db.json'))); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "readFromDB() {\n return readFile(\"db/db.json\", \"utf8\");\n }", "function readFile( filename ){\n return fs.readFileSync( path.join(dbFolder(), filename)).toString();\n }", "function read() {\n\tvar data = JSON.parse(fs.readFileSync('db/db.json', 'utf-8'));\n\treturn data;\n}", "readDbO...
[ "0.71794087", "0.68327975", "0.6694844", "0.65316683", "0.6498033", "0.628159", "0.6225904", "0.61525357", "0.6141926", "0.610741", "0.61040515", "0.60082334", "0.5952637", "0.5939405", "0.58726233", "0.5830468", "0.5823237", "0.5663781", "0.56221026", "0.5570073", "0.5556651...
0.6434743
5
Label an image with unary and pairwise terms. TODO: alphaexpansion
function imageCRFLabel(imageData, unary, lambda) { var contrast = imageCRFContrast(imageData); // constract maxflow graph var g = maxFlowInit(); maxFlowAddNodes(g, imageData.width * imageData.height); // add unary terms for (var y = 0; y < imageData.height; y++) { for (var x = 0; x < imageData.width; x++) { var u = y * imageData.width + x; maxFlowAddSourceEdge(g, u, unary[y][x]); } } // add pairwise terms for (var y = 1; y < imageData.height; y++) { for (var x = 0; x < imageData.width; x++) { var u = (y - 1) * imageData.width + x; var v = y * imageData.width + x; maxFlowAddEdge(g, u, v, lambda * contrast.north[y][x]); maxFlowAddEdge(g, v, u, lambda * contrast.north[y][x]); } } for (var y = 0; y < imageData.height; y++) { for (var x = 1; x < imageData.width; x++) { var u = y * imageData.width + x; maxFlowAddEdge(g, u, u - 1, lambda * contrast.west[y][x]); maxFlowAddEdge(g, u - 1, u, lambda * contrast.west[y][x]); } } var diagLambda = lambda / Math.sqrt(2.0); for (var y = 1; y < imageData.height; y++) { for (var x = 1; x < imageData.width; x++) { var u = (y - 1) * imageData.width + x - 1; var v = y * imageData.width + x; maxFlowAddEdge(g, u, v, diagLambda * contrast.northwest[y][x]); maxFlowAddEdge(g, v, u, diagLambda * contrast.northwest[y][x]); } } for (var y = 1; y < imageData.height; y++) { for (var x = 0; x < imageData.width - 1; x++) { var u = (y - 1) * imageData.width + x + 1; var v = y * imageData.width + x; maxFlowAddEdge(g, u, v, diagLambda * contrast.northeast[y][x]); maxFlowAddEdge(g, v, u, diagLambda * contrast.northeast[y][x]); } } // find mincut var f = maxFlowBK(g); // generate labels var labels = []; for (var y = 0; y < imageData.height; y++) { var column = []; for (var x = 0; x < imageData.width; x++) { var u = y * imageData.width + x; column[x] = (g.cut[u] == MAX_FLOW_SOURCE) ? 1 : 0; } labels[y] = column; } return labels; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Label() { // Labels (-1 means empty, -2 means undefined)\r\n this.even = undefined; // Even label: alternating path of even distance from root to vertex\r\n this.odd = []; // Odd label: base nodes of blossoms can have two\r\n}", "function encodeLabels(segmentation, ...
[ "0.5486794", "0.52453023", "0.52082735", "0.5136994", "0.5084835", "0.5065959", "0.50365865", "0.50061095", "0.50000393", "0.50000393", "0.49778184", "0.49637198", "0.4962145", "0.49583852", "0.4952433", "0.4942034", "0.49257052", "0.4917245", "0.49123636", "0.490611", "0.490...
0.68044794
0
Compare two arrays (commonly extracted from buffer.getChannelData()) with constraints: options.thresholdSNR: Minimum allowed SNR between the actual and expected signal. The default value is 10000. options.thresholdDiffULP: Maximum allowed difference between the actual and expected signal in ULP(Unit in the last place). The default is 0. options.thresholdDiffCount: Maximum allowed number of sample differences which exceeds the threshold. The default is 0. options.bitDepth: The expected result is assumed to come from an audio file with this number of bits of precision. The default is 16.
function compareBuffersWithConstraints(actual, expected, options) { if (!options) options = {}; if (actual.length !== expected.length) testFailed('Buffer length mismatches.'); var maxError = -1; var diffCount = 0; var errorPosition = -1; var thresholdSNR = (options.thresholdSNR || 10000); var thresholdDiffULP = (options.thresholdDiffULP || 0); var thresholdDiffCount = (options.thresholdDiffCount || 0); // By default, the bit depth is 16. var bitDepth = (options.bitDepth || 16); var scaleFactor = Math.pow(2, bitDepth - 1); var noisePower = 0, signalPower = 0; for (var i = 0; i < actual.length; i++) { var diff = actual[i] - expected[i]; noisePower += diff * diff; signalPower += expected[i] * expected[i]; if (Math.abs(diff) > maxError) { maxError = Math.abs(diff); errorPosition = i; } // The reference file is a 16-bit WAV file, so we will almost never get // an exact match between it and the actual floating-point result. if (Math.abs(diff) > scaleFactor) diffCount++; } var snr = 10 * Math.log10(signalPower / noisePower); var maxErrorULP = maxError * scaleFactor; if (snr >= thresholdSNR) { testPassed('Exceeded SNR threshold of ' + thresholdSNR + ' dB.'); } else { testFailed('Expected SNR of ' + thresholdSNR + ' dB, but actual SNR is ' + snr + ' dB.'); } if (maxErrorULP <= thresholdDiffULP) { testPassed('Maximum difference below threshold of ' + thresholdDiffULP + ' ulp (' + bitDepth + '-bits).'); } else { testFailed('Maximum difference of ' + maxErrorULP + ' at the index ' + errorPosition + ' exceeded threshold of ' + thresholdDiffULP + ' ulp (' + bitDepth + '-bits).'); } if (diffCount <= thresholdDiffCount) { testPassed('Number of differences between results is ' + diffCount + ' out of ' + actual.length + '.'); } else { testFailed(diffCount + ' differences found but expected no more than ' + diffCount + ' out of ' + actual.length + '.'); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function compareArrays (oldArray, newArray, options) {\n // For backward compatibility, if the third arg is actually a bool, interpret\n // it as the old parameter 'dontLimitMoves'. Newer code should use { dontLimitMoves: true }.\n options = (typeof options === 'boolean') ? { dontLimitMoves: options }...
[ "0.57749796", "0.57412165", "0.57281893", "0.5727517", "0.5727517", "0.5711899", "0.5681763", "0.5681763", "0.5679594", "0.5679594", "0.5679594", "0.5679594", "0.5679594", "0.5679594", "0.5452367", "0.5409068", "0.5376733", "0.5356096", "0.5356096", "0.5355672", "0.533136", ...
0.760667
0
Create an impulse in a buffer of length sampleFrameLength
function createImpulseBuffer(context, sampleFrameLength) { var audioBuffer = context.createBuffer(1, sampleFrameLength, context.sampleRate); var n = audioBuffer.length; var dataL = audioBuffer.getChannelData(0); for (var k = 0; k < n; ++k) { dataL[k] = 0; } dataL[0] = 1; return audioBuffer; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createStereoImpulseBuffer(context, sampleFrameLength) {\n var audioBuffer = context.createBuffer(2, sampleFrameLength, context.sampleRate);\n var n = audioBuffer.length;\n var dataL = audioBuffer.getChannelData(0);\n var dataR = audioBuffer.getChannelData(1);\n\n for (var k = 0; k < n; ++k)...
[ "0.75263226", "0.75263226", "0.68920356", "0.68920356", "0.632705", "0.6150853", "0.612429", "0.5902425", "0.5783863", "0.5628275", "0.55517095", "0.5447707", "0.54432946", "0.5438855", "0.54174745", "0.5412393", "0.5383046", "0.53300166", "0.5281003", "0.52799463", "0.525962...
0.8437261
1
Create a buffer of the given length with a linear ramp having values 0 <= x < 1.
function createLinearRampBuffer(context, sampleFrameLength) { var audioBuffer = context.createBuffer(1, sampleFrameLength, context.sampleRate); var n = audioBuffer.length; var dataL = audioBuffer.getChannelData(0); for (var i = 0; i < n; ++i) dataL[i] = i / n; return audioBuffer; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function sliding(n) {\n return new SlidingBuffer(ring(n), n);\n}", "function fixed(n) {\n return new FixedBuffer(ring(n), n);\n}", "function SlowBuffer(length) {\n // eslint-disable-next-line eqeqeq\n if (+length != length) length = 0;\n assertSize(+length);\n return createUnsafeBuffer(+length);\n}", "...
[ "0.5695793", "0.54018956", "0.5358065", "0.5158307", "0.5144002", "0.5065776", "0.50528586", "0.5041037", "0.5034923", "0.4898186", "0.48834822", "0.48834822", "0.48834822", "0.48610315", "0.48610315", "0.48556194", "0.48531333", "0.48531333", "0.4846901", "0.4845676", "0.481...
0.66798407
1
Create an AudioBuffer of length |sampleFrameLength| having a constant value |constantValue|. If |constantValue| is a number, the buffer has one channel filled with that value. If |constantValue| is an array, the buffer is created wit a number of channels equal to the length of the array, and channel k is filled with the k'th element of the |constantValue| array.
function createConstantBuffer(context, sampleFrameLength, constantValue) { var channels; var values; if (typeof constantValue === "number") { channels = 1; values = [constantValue]; } else { channels = constantValue.length; values = constantValue; } var audioBuffer = context.createBuffer(channels, sampleFrameLength, context.sampleRate); var n = audioBuffer.length; for (var c = 0; c < channels; ++c) { var data = audioBuffer.getChannelData(c); for (var i = 0; i < n; ++i) data[i] = values[c]; } return audioBuffer; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createConstantBuffer(context, sampleFrameLength, constantValue) {\n var audioBuffer = context.createBuffer(1, sampleFrameLength, context.sampleRate);\n var n = audioBuffer.length;\n var dataL = audioBuffer.getChannelData(0);\n\n for (var i = 0; i < n; ++i)\n dataL[i] = constantValue;\n\...
[ "0.8232728", "0.55788535", "0.55788535", "0.5341614", "0.5341614", "0.52795666", "0.49277818", "0.49277818", "0.48611498", "0.4792038", "0.4518094", "0.44687134", "0.4428806", "0.43605888", "0.4307192", "0.42561933", "0.42232248", "0.42006865", "0.41688406", "0.41628414", "0....
0.8294203
0
Create a stereo impulse in a buffer of length sampleFrameLength
function createStereoImpulseBuffer(context, sampleFrameLength) { var audioBuffer = context.createBuffer(2, sampleFrameLength, context.sampleRate); var n = audioBuffer.length; var dataL = audioBuffer.getChannelData(0); var dataR = audioBuffer.getChannelData(1); for (var k = 0; k < n; ++k) { dataL[k] = 0; dataR[k] = 0; } dataL[0] = 1; dataR[0] = 1; return audioBuffer; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createImpulseBuffer(context, sampleFrameLength) {\n var audioBuffer = context.createBuffer(1, sampleFrameLength, context.sampleRate);\n var n = audioBuffer.length;\n var dataL = audioBuffer.getChannelData(0);\n\n for (var k = 0; k < n; ++k) {\n dataL[k] = 0;\n }\n dataL[0] = 1;\n\...
[ "0.78334713", "0.78334713", "0.63576996", "0.63576996", "0.61745924", "0.577996", "0.5691106", "0.5647514", "0.5561082", "0.55510974", "0.5547345", "0.5529315", "0.5519007", "0.54949784", "0.5476185", "0.54661536", "0.5402161", "0.5346005", "0.5278198", "0.5256365", "0.524782...
0.8593268
1