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
Move function for adding moves when user clicks on cards
function addMoves() { 'use strict'; // turn on Strict Mode moves++; movesCounter.innerHTML = moves; rating(); //Starting timer when user makes its first click on the cards if (moves == 1) { second = 0; minute = 0; hour = 0; startTimer(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function makeMove(){\n\t$(\".card\").click(function(e){\n\t\tshowCardSymbol($(e.target));\n\t\taddToCardCheck($(e.target));\n\t\tif (cardCheck.length === 2) {\n\t\t\tcheckMatches();\n\t\t}\n\t\tcongratsMessage();\n\t});\n}", "function takeCards()\n {\n if (state.turnedCard)\n {\n ...
[ "0.7880115", "0.73466146", "0.71526766", "0.7134944", "0.7134629", "0.6997075", "0.6878985", "0.68646246", "0.6824192", "0.67994934", "0.679314", "0.67784", "0.6756485", "0.6724491", "0.670292", "0.66926295", "0.66825783", "0.6666016", "0.66611254", "0.66378945", "0.6632416",...
0.67670876
12
Rating function Based on the moves, user will get rating specific rating or stars.
function rating() { 'use strict'; // turn on Strict Mode if (moves > 10 && moves < 19) { stars[2].classList.remove('fa-star'); stars[2].classList.add('fa-star-o'); starsRating = 2; } else if (moves > 20) { stars[1].classList.remove('fa-star'); stars[1].classList.add('fa-star-o'); starsRating = 1; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function rating(moves) {\n // \n let rating = 3;\n\n // Scoring system from 1 to 3 stars\n let stars3 = 10,\n stars2 = 16,\n star1 = 20;\n\n if (moves > stars3 && moves < stars2) {\n $stars.eq(3).removeClass('fa-star').addClass('fa-star-o');\n } else if (moves > stars2 && mov...
[ "0.78940636", "0.78329915", "0.77787524", "0.7774005", "0.7739763", "0.77269536", "0.769004", "0.7676076", "0.76703954", "0.763949", "0.760653", "0.7389732", "0.73660254", "0.723577", "0.71886635", "0.7159756", "0.7139172", "0.70582867", "0.70310605", "0.70205367", "0.7017559...
0.7537224
11
Toggline the congratulation modal
function modalToggle() { 'use strict'; // turn on Strict Mode congoModal.classList.toggle('hide'); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function showCongratulationModal() {\n let template = `\n were ${scorePanel.playTime} seconds on a ${deckConfig.numberOfcards === difficulty.easy ? 'easy' : 'hard'} level, \n with ${scorePanel.moveCounter} moves and ${scorePanel.starCounter} star(s).`;\n\n $(\"#congratulationScore\").text(template);\n $(\...
[ "0.6729323", "0.66939205", "0.65758806", "0.65140384", "0.6500626", "0.6443051", "0.63722503", "0.63673633", "0.6337035", "0.631825", "0.6234612", "0.62173873", "0.62173873", "0.6192255", "0.6189544", "0.61855483", "0.61756074", "0.61730677", "0.6167182", "0.61467", "0.614215...
0.0
-1
Congratulation Modal, after user sucessfully matched all the cards
function isOverModal() { 'use strict'; // turn on Strict Mode if (matchedCards.length === cards.length) { clearInterval(timerInterval); //Defined variable let endTimer = timerCounter.innerHTML; modalToggle(); //Assigning stars, time and moves document.getElementById('endTime').innerHTML = endTimer; document.getElementById('endMoves').innerHTML = moves + 1; document.getElementById('endRatings').innerHTML = starsRating + ' Out Of 3 Stars'; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function setmatchscreen(){\n cardcount= 0; //var to hold all the match cards\n let modal = document.getElementById('modal');\n let span = document.getElementsByClassName(\"close\")[0];\n for(i=0; i<cardarray.length;i++){ //loops through all cards\n if (cardarray[i].ou...
[ "0.68357116", "0.67636406", "0.6718432", "0.66461164", "0.6480009", "0.6472404", "0.6469817", "0.6429782", "0.6428735", "0.6400441", "0.63152534", "0.62675756", "0.6245581", "0.6233706", "0.6215076", "0.62050474", "0.62028915", "0.61839455", "0.6178714", "0.61627567", "0.6160...
0.0
-1
Function for restarting the game
function playAgain() { 'use strict'; // turn on Strict Mode modalToggle(); init(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function restart() {\n game.state.restart();\n}", "function restartGame() {\n playGame();\n }", "function restartGame()\n{\n\tSnake.reset();\n\tMouse.changeLocation();\n\tScoreboard.reset();\n\t\n\tenterState(\"countdown\");\n}", "function restart() {}", "function restartGame() {\n\tthis.game.stats.setSta...
[ "0.87297684", "0.8581637", "0.842008", "0.8373883", "0.8325835", "0.8300972", "0.81533444", "0.81125796", "0.8107974", "0.8104296", "0.80926013", "0.8089746", "0.80254537", "0.8019161", "0.8008237", "0.80007124", "0.79995066", "0.79843736", "0.79833364", "0.79829985", "0.7967...
0.0
-1
Reset function All time, moves and rating will be reset to the their default values
function reset() { 'use strict'; // turn on Strict Mode //Resetting timer timerCounter.innerHTML = "0 Minute 0 Second"; clearInterval(timerInterval); //Resetting moves moves = 0; movesCounter.innerHTML = moves; //Reseting stars stars[1].classList.add("fa-star"); stars[1].classList.remove("fa-star-o"); stars[2].classList.add("fa-star"); stars[2].classList.remove("fa-star-o"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function reset() {\n state.moves = [];\n state.turnCount = 0;\n state.playbackSpeed = 700;\n chooseMove();\n }", "function fullReset() {\n reset();\n score.DROITE = 0;\n score.GAUCHE = 0;\n }", "function reset() { }", "function reset() {\n\t\t\tclear_board()\n\t\t}", "reset(){\n ...
[ "0.8027952", "0.7669807", "0.76210487", "0.7611284", "0.7604743", "0.76007974", "0.7590081", "0.7580365", "0.75753236", "0.7570899", "0.752332", "0.7498892", "0.74797004", "0.7467668", "0.743186", "0.7416143", "0.7406773", "0.7398435", "0.7393521", "0.738837", "0.7373027", ...
0.7133154
64
>>>>>> bug <<<<<customerList refresh
function PurchaseSimilarInventory() { const { setTopHeading } = useContext(TopBarContext); const [flow, setFlow] = useState("basic"); const [calculate, setCalculate] = useState(false); const [datecalculate, setDateCalculate] = useState(false); const [calnum, setCalnum] = useState(-1); const thebval = { purchtype: "", vendor: "", invnumber: "", invdate: "", location: "Trivandrum", invtype: "", gstno: "", panno: "", aadharno: "", purchlocation: "Local", }; const [basevalues, setBaseValues] = useState(thebval); const invdetails = { type: "", name: "", // assetsIdHistory: "", // assetId: "", sno: "", condition: "Good", taxcategory: "", taxperc: "", rate: "", igst: "0", cgst: "0", sgst: "0", nettax: "0", amount: "0", tcs: "0", invamount: "0", wty: "", expirydate: "", //------------------------- purchtype: "", vendor: "", invnumber: "", invdate: "", location: "", invtype: "", gstno: "", panno: "", aadharno: "", purchlocation: "", brand:"", model:"", systype:"part", //------- caseId:"", }; const [values, setValues] = useState([invdetails]); const [err, setErr] = useState({ type: "", name: "", sno: "", condition: "", location: "", invnumber: "", }); const submitItems = async () => { if (values.name === "" || values.sno === "" || values.invnumber === "") { // setIsReqFieldModal(true); console.log("missing inputs"); return; } console.log("Submission Start"); const newitems = [...values]; newitems.map((item) => { item.purchtype = basevalues.purchtype; item.vendor = basevalues.vendor; item.invnumber = basevalues.invnumber; item.invdate = basevalues.invdate; item.location = basevalues.location; item.invtype = basevalues.invtype; item.gstno = basevalues.gstno; item.panno = basevalues.panno; item.aadharno = basevalues.aadharno; item.purchlocation = basevalues.purchtype; }); console.log(newitems); await Axios({ url: `${API}/inventory/${Emp.getId()}/createitems`, method: "POST", data: newitems, }) .then((data) => { console.log("Added", data._id); // setIsReviewModalOpen(true); setValues([invdetails]); setBaseValues(thebval); setErr({ type: "", name: "", sno: "", condition: "", location: "", invnumber: "", }); }) .catch((err) => { console.log("err", err); setErr({ ...err }); }); }; // ----------------------Heading Use Effect------------- useEffect(() => { setTopHeading("Purchase Similar Inventory"); return () => { setTopHeading(""); }; }, []); // ------------------- Calculations---------------------------------- useEffect(() => { // console.log("hello"); // console.log(calnum); let newlist = [...values]; if (basevalues.purchlocation == "Local" && calnum != -1) { newlist[calnum].sgst = parseInt(newlist[calnum].rate) * (parseInt(newlist[calnum].taxperc) / 200); newlist[calnum].cgst = parseInt(newlist[calnum].rate) * (parseInt(newlist[calnum].taxperc) / 200); newlist[calnum].nettax = parseInt(newlist[calnum].sgst) + parseInt(newlist[calnum].cgst); newlist[calnum].amount = parseFloat(newlist[calnum].rate) + parseFloat(newlist[calnum].nettax); // setValues(newlist); } else if (calnum != -1) { newlist[calnum].igst = parseInt(newlist[calnum].rate) * (parseInt(newlist[calnum].taxperc) / 100); newlist[calnum].nettax = newlist[calnum].igst; newlist[calnum].sgst = 0; newlist[calnum].cgst = 0; newlist[calnum].amount = parseFloat(newlist[calnum].rate) + parseFloat(newlist[calnum].nettax); // setValues(newlist); } if (calnum != -1) { newlist[calnum].tcs = parseFloat(newlist[calnum].amount) * 0.001; newlist[calnum].invamount = parseFloat(newlist[calnum].amount) + parseFloat(newlist[calnum].tcs); newlist[calnum].expirydate = moment().format("DD-MM-YYYY"); } setValues(newlist); return () => { console.log("Calculations done!"); }; }, [calculate]); // const handleChange = (name) => (e) => { // setValues({ ...values, [name]: e.target.value }); // }; // ---------Date Calculations ------------ useEffect(() => { // console.log("hello"); // console.log(calnum); let newlist = [...values]; if (calnum != -1) { switch (newlist[calnum].wty) { case "3M": newlist[calnum].expirydate = moment() .add(3, "M") .format("DD-MM-YYYY"); break; case "6M": newlist[calnum].expirydate = moment() .add(6, "M") .format("DD-MM-YYYY"); break; case "1Y": newlist[calnum].expirydate = moment() .add(1, "Y") .format("DD-MM-YYYY"); break; case "2Y": newlist[calnum].expirydate = moment() .add(2, "Y") .format("DD-MM-YYYY"); break; case "3Y": newlist[calnum].expirydate = moment() .add(3, "Y") .format("DD-MM-YYYY"); break; case "4Y": newlist[calnum].expirydate = moment() .add(4, "Y") .format("DD-MM-YYYY"); break; case "5Y": newlist[calnum].expirydate = moment() .add(5, "Y") .format("DD-MM-YYYY"); break; default: break; } } setValues(newlist); return () => { console.log("Calculations done!"); }; }, [datecalculate]); const handleBaseChange = (name) => (e) => { setBaseValues({ ...basevalues, [name]: e.target.value }); }; // const ReviewSubmit = () => { // return ( // <> // <Modal // isOpen={isReviewModalOpen} // onClose={() => setIsReviewModalOpen(false)} // > // <ModalHeader>Information updated Successfully!</ModalHeader> // <ModalBody></ModalBody> // <ModalFooter> // <Button // className="w-full sm:w-auto" // // onClick={() => setIsReviewModalOpen(false)} // onClick={() => setIsReviewModalOpen(false)} // > // Okay! // </Button> // </ModalFooter> // </Modal> // </> // ); // }; // const ReqFieldErrModal = () => { // return ( // <> // <Modal // isOpen={isReqFieldModal} // onClose={() => setIsReqFieldModal(false)} // > // <ModalHeader>Required fields are not filled!</ModalHeader> // <ModalBody></ModalBody> // <ModalFooter> // <Button // className="w-full sm:w-auto" // onClick={() => setIsReqFieldModal(false)} // > // Okay! // </Button> // </ModalFooter> // </Modal> // </> // ); // }; // Basic Form const BasicForm = () => { return ( <div className="px-4 py-3 mt-4 mb-2 bg-white rounded-lg shadow-md dark:bg-gray-800"> <Label className="font-bold"> <span>Purchase Information</span> </Label> <hr className="mb-5 mt-2" /> {/* -----Row 1 --------- */} <div className="flex-row flex space-x-3"> <div className="flex flex-col w-full"> <Label className="w-full"> <span>Purchase Type*</span> <Input className="mt-1" type="text" value={basevalues.purchtype} onChange={handleBaseChange("purchtype")} /> </Label> </div> <div className="flex flex-col w-full"> <Label className="w-full"> <span>Vendor Name*</span> <Input className="mt-1" type="text" value={basevalues.vendor} onChange={handleBaseChange("vendor")} /> </Label> </div> <div className="flex flex-col w-full"> <Label className="w-full"> <span>Invoice Number*</span> <Input className="mt-1" type="text" value={basevalues.invnumber} onChange={handleBaseChange("invnumber")} /> </Label> </div> <div className="flex flex-col w-full"> <Label className="w-full"> <span>Invoice Date*</span> <Input className="mt-1" type="date" value={basevalues.invdate} onChange={handleBaseChange("invdate")} /> </Label> </div> </div> {/* ------------------------Row 2-------------------------- */} <div className="flex-row flex space-x-3"> <div className="flex flex-col w-full"> <Label className="w-full"> <span>Location*</span> <Select className="mt-1" onChange={(e) => { setBaseValues({ ...basevalues, location: e.target.value }); }} > <option value="Trivandrum">Trivandrum</option> <option value="Kottayam">Kottayam</option> <option value="Kozhikode">Kozhikode</option> </Select> </Label> </div> <div className="flex flex-col w-full"> <Label className="w-full"> <span>Invoice Type*</span> <Input className="mt-1" type="text" value={basevalues.invtype} onChange={handleBaseChange("invtype")} /> </Label> </div> <div className="flex flex-col w-full"> <Label className="w-full"> <span>GST Number*</span> <Input className="mt-1" type="text" value={basevalues.gstno} onChange={handleBaseChange("gstno")} /> </Label> </div> <div className="flex flex-col w-full"> <Label className="w-full"> <span>Pan No*</span> <Input className="mt-1" type="text" value={basevalues.panno} onChange={handleBaseChange("panno")} /> </Label> </div> </div> {/* -------------------------ROw 3-------------------- */} <div className="flex-row flex space-x-3"> <div className="flex flex-col w-full"> <Label className="w-full"> <span>Aadhar No*</span> <Input className="mt-1" type="text" value={basevalues.aadharno} onChange={handleBaseChange("aadharno")} /> </Label> </div> <div className="flex flex-col w-full"> <Label className="w-full"> <span>Purchase Location*</span> <Select className="mt-1" onChange={(e) => { setBaseValues({ ...basevalues, purchlocation: e.target.value, }); let newlist = [...values]; newlist.map((item, i) => { item.taxcategory = ""; item.taxperc = ""; }); setValues([invdetails]); }} > <option value="Local">Local</option> <option value="IGST">IGST</option> </Select> </Label> </div> </div> </div> ); }; const ItemForm = (num) => { return ( <div className="px-4 py-3 my-2 bg-white rounded-lg shadow-md dark:bg-gray-800"> <Label className="font-bold"> <span>Item Number : {num + 1},<span className="ml-10"> Net Tax:{values[num].nettax} ,Invoice Amount: {values[num].invamount} </span> </span> </Label> <hr className="mb-5 mt-2" /> {/* ------------------------Row 1-------------------------- */} <div className="flex-row flex space-x-3"> <div className="flex flex-col w-full"> <Label className="w-full"> <span>Select Type*</span> <Select className="mt-1" onChange={(e) => { let newlist = [...values]; newlist[num].systype = e.target.value; setValues(newlist); }} > <option value="part" selected > Part </option> <option value="system">System</option> </Select> </Label> </div> <div className="flex flex-col w-full"> <Label className="w-full"> <span>Select Category*</span> <Select className="mt-1" onChange={(e) => { let newlist = [...values]; newlist[num].type = e.target.value; setValues(newlist); }} > <option value="" selected disabled> Select Category </option> {values[num].systype=="part"?<> <option value="Mouse">Mouse</option> <option value="Keyboard">Keyboard</option> <option value="Monitor">Monitor</option> <option value="Cpu">Cpu</option> <option value="Ram">Ram</option> <option value="Fan">Fan</option> <option value="Motherboard">Motherboard</option> <option value="SMPS">SMPS</option> <option value="HDD">HDD</option> <option value="GCard">Gcard</option> <option value="EnetCard">Enet Card</option> <option value="SerialCard">Serial Card</option> <option value="ParalellCard">Paralell Card</option> <option value="OpticalDrive">Optical Drive</option> <option value="Others">Others</option> </>:<> <option value="console">Console</option> <option value="DMP">DMP</option> <option value="inkjet">Inkjet</option> <option value="KVM">KVM</option> <option value="laptop">Laptop</option> <option value="laser">Laser</option> <option value="LMP">LMP</option> <option value="module">Module</option> <option value="router">Router</option> <option value="scanner">Scanner</option> <option value="server">Server</option> <option value="desktop">Desktop</option> <option value="storage">Storage</option> <option value="switch">Switch</option> <option value="UPS">UPS</option> <option value="others">Others</option> </>} </Select> </Label> </div> {values[num].systype=="part"? <> <div className="flex flex-col w-full"> <Label className="w-full"> <span>Product Name*</span> <Input className="mt-1" type="text" value={values[num].name} onChange={(e) => { let newlist = [...values]; newlist[num].name = e.target.value; setValues(newlist); }} /> </Label> <HelperText valid={false}>{err.name}</HelperText> </div> </> :<> <> <div className="flex flex-col w-full"> <Label className="w-full"> <span>Brand*</span> <Input className="mt-1" type="text" value={values[num].brand} onChange={(e) => { let newlist = [...values]; newlist[num].brand = e.target.value; setValues(newlist); }} /> </Label> <HelperText valid={false}>{err.brand}</HelperText> </div> </> <> <div className="flex flex-col w-full"> <Label className="w-full"> <span>Model*</span> <Input className="mt-1" type="text" value={values[num].model} onChange={(e) => { let newlist = [...values]; newlist[num].model = e.target.value; setValues(newlist); }} /> </Label> <HelperText valid={false}>{err.name}</HelperText> </div> </> </> } <div className="flex flex-col w-full"> <Label className="w-full"> <span>Serial Number*</span> <Input className="mt-1" type="text" value={values[num].sno} onChange={(e) => { let newlist = [...values]; newlist[num].sno = e.target.value; setValues(newlist); }} /> </Label> <HelperText valid={false}>{err.sno}</HelperText> </div> <div className="flex flex-col w-full"> <Label className="w-full"> <span>Select Condition*</span> <Select className="mt-1" onChange={(e) => { let newlist = [...values]; newlist[num].condition = e.target.value; setValues(newlist); }} > <option value="Good">Good</option> <option value="Bad">Bad</option> </Select> </Label> </div> </div> {/* -------------Row 2 --------- */} <div className="flex-row flex space-x-3"> <div className="flex flex-col w-full"> <Label className="w-full"> <span>Warranty*</span> <Select className="mt-1" value={values[num].wty} onChange={(e) => { let newlist = [...values]; newlist[num].wty = e.target.value; setValues(newlist); setCalnum(num); setDateCalculate(!datecalculate); }} > <option value="" selected disabled> Select Category </option> <option value="3M">3 Months</option> <option value="6M">6 Months</option> <option value="1Y">1 Year</option> <option value="2Y">2 Year</option> <option value="3Y">3 Year</option> <option value="4Y">4 Year</option> <option value="5Y">5 Year</option> </Select> </Label> </div> <> <div className="flex flex-col w-full"> <Label className="w-full"> <span>Expiry Date</span> <Input className="mt-1" type="text" value={values[num].expirydate} readOnly={true} /> </Label> <HelperText valid={false}>{err.name}</HelperText> </div> </> <div className="flex flex-col w-full"> <Label className="w-full"> <span>Tax Category*</span> <Select className="mt-1" value={values[num].taxcategory} onChange={(e) => { let newlist = [...values]; let thestring = e.target.value; let theperc = thestring.slice(-3, -1); newlist[num].taxcategory = e.target.value; newlist[num].taxperc = theperc; setValues(newlist); // calculate trigger setCalnum(num); setCalculate(!calculate); }} > {basevalues.purchlocation == "Local" ? ( <> <option value="" selected disabled> Select Tax Category </option> <option value="GST 18%">GST 18%</option> <option value="GST 28%">GST 28%</option> </> ) : ( <> <option value="" selected disabled> Select Tax Category </option> <option value="IGST 18%">IGST 18%</option> <option value="IGST 28%">IGST 28%</option> </> )} </Select> </Label> </div> {/* <div className="flex flex-col w-full"> <Label className="w-full"> <span>Tax Percentage*</span> <Input className="mt-1" type="text" readOnly="true" value={values[num].taxperc} /> </Label> <HelperText valid={false}>{err.invnumber}</HelperText> </div> */} <div className="flex flex-col w-full"> <Label className="w-full"> <span>Rate*</span> <Input className="mt-1" type="text" value={values[num].rate} onChange={(e) => { let newlist = [...values]; newlist[num].rate = e.target.value; setValues(newlist); setCalnum(num); setCalculate(!calculate); }} /> </Label> </div> </div> {/* --------Row 4 ------------- */} {/* <div className="flex-row flex space-x-3 my-2"> {basevalues.purchlocation == "Local" ? ( <> {" "} <div className="flex flex-col w-full"> <Label className="w-full"> <span>CGST*</span> <Input className="mt-1" type="text" readOnly="true" value={values[num].cgst} /> </Label> </div> <div className="flex flex-col w-full"> <Label className="w-full"> <span>SGST*</span> <Input className="mt-1" type="text" readOnly="true" value={values[num].sgst} /> </Label> </div> <div className="flex flex-col w-full"> <Label className="w-full"> <span>Net Tax*</span> <Input className="mt-1" type="text" readOnly="true" value={values[num].nettax} /> </Label> </div> </> ) : ( <> {" "} <div className="flex flex-col w-full"> <Label className="w-full"> <span>IGST</span> <Input className="mt-1" type="text" readOnly="true" value={values[num].igst} /> </Label> </div> <div className="flex flex-col w-full"> <Label className="w-full"> <span>Net Tax*</span> <Input className="mt-1" type="text" readOnly="true" value={values[num].nettax} /> </Label> </div> </> )} </div> */} {/* ----row 4------ */} {/* <div className="flex-row flex space-x-3"> <div className="flex flex-col w-full"> <Label className="w-full"> <span>Amount</span> <Input className="mt-1" type="text" value={values[num].amount} onChange={(e) => { let newlist = [...values]; newlist[num].amount = e.target.value; setValues(newlist); }} /> </Label> </div> <div className="flex flex-col w-full"> <Label className="w-full"> <span>TCS</span> <Input className="mt-1" type="text" value={values[num].tcs} onChange={(e) => { let newlist = [...values]; newlist[num].amount = e.target.value; setValues(newlist); }} /> </Label> </div> <div className="flex flex-col w-full"> <Label className="w-full"> <span>Invoice Amount</span> <Input className="mt-1" type="text" value={values[num].invamount} onChange={(e) => { let newlist = [...values]; newlist[num].invamount = e.target.value; setValues(newlist); }} /> </Label> </div> </div> */} {/* <Label className="font-bold mt-5 mb-2"> <span>Additional Information</span> </Label> */} {/* <hr /> */} </div> ); }; const BottomCard = () => { return ( <Card className="mb-4 shadow-md "> <CardBody> <div className="flex flex-row flex-wrap"> <Button onClick={() => { let newitem = [...values]; let add = values[0]; console.log(add) newitem.push(add); setValues(newitem); }} aria-label="Notifications" aria-haspopup="true" layout="outline" className=" mx-2 " > Add Item </Button> <Button onClick={() => { let newitem = [...values]; if (newitem[1]) { newitem.pop(); setValues(newitem); } }} aria-label="Notifications" aria-haspopup="true" layout="outline" className=" mx-2 " > Remove Item </Button> <Button onClick={submitItems} aria-label="Notifications" aria-haspopup="true" layout="outline" className=" mx-2 " > Submit </Button> </div> </CardBody> </Card> ); }; return ( <> {BasicForm()} {values.map((item, i) => { return ItemForm(i); })} {BottomCard()} </> ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function getCustomerList() {\n\t// TODO: add logic to call backend system\n\n\n}", "function ResetCustomerList() {\n BindOrReloadCustomerTable('Reset');\n}", "get customersList() {\n\t\treturn this._customersList;\n\t}", "function severRefresh(newValue) {\n if (newValue) {\n if (...
[ "0.70704305", "0.69736576", "0.69008005", "0.68298393", "0.68096864", "0.67783123", "0.67059684", "0.66040456", "0.65784174", "0.65544456", "0.64780205", "0.64742035", "0.64562523", "0.6421873", "0.6312858", "0.6308224", "0.62962306", "0.62312764", "0.62229043", "0.6176786", ...
0.0
-1
Used to toggle the menu on small screens when clicking on the menu button
function toggleFunction() { var x = document.getElementById("navDemo"); //alert(x.className.indexOf("show")); if (x.className.indexOf("show") == -1) { x.className += " show"; } else { x.className = x.className.replace(" show", ""); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function menuForSmallScreen() {\n navMenuList.hide();\n\n hideMenuBtn.addClass(ClassName.NONE);\n showMenuBtn.removeClass(ClassName.NONE);\n\n function toggleSmallMenu() {\n navMenuList.fadeToggle();\n toggleButtons();\n }\n\n function toggleMenuEvent...
[ "0.86165327", "0.8036715", "0.780012", "0.77065015", "0.75995696", "0.7574694", "0.75403684", "0.7524451", "0.75068945", "0.75068945", "0.7503618", "0.7501699", "0.74886316", "0.7467993", "0.746118", "0.7406113", "0.7406113", "0.74043226", "0.73866475", "0.73753613", "0.73482...
0.0
-1
Drop in replacement of the `Radio`, `Switch` and `Checkbox` component. Use this component if you want to display an extra label.
function FormControlLabel(props, context) { var checked = props.checked, classes = props.classes, classNameProp = props.className, control = props.control, disabledProp = props.disabled, inputRef = props.inputRef, label = props.label, name = props.name, onChange = props.onChange, value = props.value, other = (0, _objectWithoutProperties3.default)(props, ['checked', 'classes', 'className', 'control', 'disabled', 'inputRef', 'label', 'name', 'onChange', 'value']); var muiFormControl = context.muiFormControl; var disabled = disabledProp; if (typeof control.props.disabled !== 'undefined') { if (typeof disabled === 'undefined') { disabled = control.props.disabled; } } if (muiFormControl) { if (typeof disabled === 'undefined') { disabled = muiFormControl.disabled; } } var className = (0, _classnames2.default)(classes.root, (0, _defineProperty3.default)({}, classes.disabled, disabled), classNameProp); return _react2.default.createElement( 'label', (0, _extends3.default)({ className: className }, other), _react2.default.cloneElement(control, { disabled: disabled, checked: typeof control.props.checked === 'undefined' ? checked : control.props.checked, name: control.props.name || name, onChange: control.props.onChange || onChange, value: control.props.value || value, inputRef: control.props.inputRef || inputRef }), _react2.default.createElement( _Typography2.default, { component: 'span', className: classes.label }, label ) ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Label(_ref) {\n var htmlFor = _ref.htmlFor,\n label = _ref.label,\n required = _ref.required;\n return _react.default.createElement(\"label\", {\n style: {\n display: \"block\"\n },\n htmlFor: htmlFor\n }, label, \" \", required && _react.default.createElement(\"span\", {\n s...
[ "0.68338424", "0.67030853", "0.6557703", "0.64623713", "0.6420008", "0.6416059", "0.6416059", "0.63771886", "0.6285889", "0.6246065", "0.6221066", "0.61106735", "0.60983837", "0.60287285", "0.60223705", "0.5996795", "0.59856206", "0.5935544", "0.59085596", "0.58794147", "0.58...
0.6531685
5
================= for date checking =================
function checkDates(element) { var birthDate = element.value; if(birthDate.length > 10){ alert("Invalid Date Format"); element.value = ""; element.focus(); return; } var split = birthDate.split(/[^\d]+/); var year = parseFloat(split[2]); var month = parseFloat(split[0]); var day = parseFloat(split[1]); if(birthDate != null){ if (!/\d{2}\/\d{2}\/\d{4}/.test(birthDate)) { alert("Invalid Date Format"); element.value = ""; element.focus(); return; } if(month > 13 || day > 32){ alert("Invalid Date Format"); element.value = ""; element.focus(); return; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function dateValidation( date ) {\n\n\t\tvar pass = /^\\d{4}-\\d{2}-\\d{2}/.test( date );\n\t\treturn pass;\n\n\t}", "function checkdate(input){\t \nvar validformat=/^\\d{2}\\/\\d{2}\\/\\d{4}$/ // Basic check for format validity\n\t var returnval= 0\n\t if (!validformat.test(input.value)){\n\t\t input.select();\...
[ "0.76711684", "0.7645414", "0.76122695", "0.76077014", "0.75384104", "0.7458504", "0.7407468", "0.7403451", "0.7402913", "0.73803276", "0.7351411", "0.732255", "0.7315654", "0.731516", "0.7289354", "0.72882485", "0.72827524", "0.7246374", "0.72328573", "0.7217748", "0.7189891...
0.0
-1
New validations for resume name and attachment name validation in AddConsultent.jsp new functions for consultant resume attachment validations
function attachmentNameValidate(){ var attachmentName= document.addConsultantForm.attachmentName; if (attachmentName.value != null && (attachmentName.value != "")) { if(attachmentName.value.replace(/^\s+|\s+$/g,"").length>50){ str = new String(document.addConsultantForm.attachmentName.value); document.addConsultantForm.attachmentName.value=str.substring(0,50); alert("The AttachResumeName must be less than 50 characters"); } document.addConsultantForm.attachmentName.focus(); return (false); } return (true); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function checkResume() {\n\tvar x = document.getElementById('resume').value;\n\tvar sub = x.substring(x.length-3);\n\tvar validate;\n\t\n\tif(sub == \"doc\" || sub == \"ocx\" || sub == \"pdf\"){\n\t\tvalidate = true\n\t}\n\tif(sub == 0 || sub == \"\") {\n\t\tdocument.getElementById('div_4').className='error'\n\t\t...
[ "0.7143847", "0.6299985", "0.591096", "0.5736371", "0.5716605", "0.5593715", "0.55903906", "0.5575404", "0.5569979", "0.554915", "0.55022824", "0.54944205", "0.54754704", "0.5461847", "0.5443368", "0.54389447", "0.5421969", "0.5412685", "0.541155", "0.5378472", "0.53620934", ...
0.67289054
1
user click on start to startGame
function startGame(){ countStartGame = 30; correctAnswers = 0; wrongAnswers = 0; unanswered = 0; if (!timerRunning){ intervalId = setInterval(timer, 1000); timerRunning = true; } timer(); console.log("game startiiing"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function startGame() { }", "onStartGame(event) {\n\n if(this.checkStartButton()){\n console.log('On click btn start'); \n this.app.goToGame();\n\n if(this.start){\n this.app.start(); \n }\n }\n }", "pressedStart()\n\t\t\t{\n\t\t\tif(th...
[ "0.7925207", "0.7908294", "0.78537375", "0.762998", "0.76202166", "0.76115394", "0.75777036", "0.756493", "0.7529975", "0.7495164", "0.74581033", "0.7443494", "0.7438885", "0.74356896", "0.7435168", "0.7434496", "0.7433483", "0.7399481", "0.7386848", "0.7381565", "0.73702115"...
0.0
-1
timer beggins 30 seconds countdown will it be a function?
function timer(){ countStartGame -= 1; console.log(countStartGame); if (countStartGame === 0){ console.log ("time's up"); //need to clear interval - add stop } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function addTime() {\n timer = timer + 30;\n}", "function start30SecTimer(){\r\n\t\tconsole.log( new Date());\r\n\t\t//setTimeout(function(){ console.log( new Date()) }, 30000);\r\n\t\tconsole.log(\"START TIMER!!!!!!\");\r\n\t\tfor(var x = 6; x>1; x--){\r\n\t\t\tsetTimeout(function(){\r\n\t\t\t\t//sendOutCount(...
[ "0.7035286", "0.69687426", "0.69199884", "0.6894611", "0.68926716", "0.6849651", "0.6823727", "0.68000007", "0.679997", "0.676423", "0.6763475", "0.67266095", "0.6720447", "0.67178816", "0.6706305", "0.6689997", "0.6684375", "0.6673262", "0.66707855", "0.6656377", "0.66549444...
0.0
-1
Destroys the instance of the player and it's plugins.
destroy() { // Remove the player from the page. this.wrapper.innerHTML = ''; this.trigger('requestDestroy'); // HACK: fix this hack! Because requestDestroy refers to this.playerPlugin (via get playing) it throws an error when playerPlugin is nulled.. By using setTimeout 0 we effectively added nullifying on the eventstack setTimeout(() => { this.pluginLoader = null; this.playerPlugin = null; this.playlist = null; this.mediaController = null; this.fullscreenController = null; instances = instances.filter(instance => instance.id === this.id); }, 0); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "destroy() {\n // Try to delete as much about anything that could lead to memory leaks.\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Memory_Management\n this.ytPlayer.destroy();\n this.ytPlayer = undefined;\n this.rootElement.parentNode\n .removeChild(th...
[ "0.7446531", "0.7442718", "0.74154264", "0.728973", "0.7181743", "0.7156699", "0.7105579", "0.7088779", "0.70685625", "0.70408124", "0.7035602", "0.68820703", "0.6867774", "0.6848587", "0.6830043", "0.6731127", "0.6703837", "0.6663888", "0.6658892", "0.6658104", "0.66374576",...
0.8091967
0
Don't rerender `` on page navigation (on `route` change). TrackedThreads = React.memo(TrackedThreads)
function TrackedThread({ edit, selected, locale, thread }) { const addedAt = useMemo(() => thread.addedAt, [thread]) const untrackButton = useRef() const undoUntrackButton = useRef() const dispatch = useDispatch() const [untracked, setUntracked] = useState() const onUntrackThread = useCallback(() => { dispatch(untrackThread(thread)) setUntracked(true) }, [thread]) const onTrackThread = useCallback(() => { dispatch(trackThread(thread, { addedAt })) setUntracked(false) }, [thread, addedAt]) useEffect(() => { if (untracked) { // Expired threads don't get an "Undo" button. if (undoUntrackButton.current) { undoUntrackButton.current.focus() } } else if (untracked === false) { untrackButton.current.focus() } }, [untracked]) const isDisabled = thread.expired || untracked const isLink = !isDisabled const Component = isLink ? Link : 'div' return ( <div title={thread.title} className={classNames('tracked-threads__thread', { 'tracked-threads__thread--edit': edit, 'tracked-threads__thread--expired': thread.expired, 'tracked-threads__thread--untracked': untracked, 'tracked-threads__thread--selected': selected && !isDisabled })}> <Component to={isLink ? getUrl(thread.board, thread) : undefined} className={classNames('tracked-threads__thread-inner', { 'tracked-threads__thread__link': isLink })}> {thread.thumbnail && <Picture border picture={thread.thumbnail} width={24} height={24} fit="cover" blur={thread.thumbnail.spoiler ? 0.1 : undefined} className="tracked-threads__thread__thumbnail"/> } <BoardUrl boardId={thread.board.id} className="tracked-threads__thread__board"/> <div className="tracked-threads__thread__title"> {thread.title} </div> {!thread.expired && thread.newRepliesCount && <div className="tracked-threads__thread__new-replies"> <span className="tracked-threads__thread__new-replies-count"> {thread.newRepliesCount} </span> </div> } {!thread.expired && thread.newCommentsCount && <div className="tracked-threads__thread__new-comments"> {thread.newCommentsCount} </div> } </Component> {(edit || thread.expired) && !untracked && <ListButton ref={untrackButton} muted icon="remove" onClick={onUntrackThread} title={getMessages(locale).trackedThreads.untrackThread}/> } {edit && untracked && !thread.expired && <Button ref={undoUntrackButton} title={getMessages(locale).trackedThreads.trackThread} onClick={onTrackThread} className="tracked-threads__undo-untrack rrui__button--text"> {getMessages(locale).actions.undo} </Button> } </div> ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function TrackedThread({\n\tselected,\n\tlocale,\n\tthread,\n\tdispatch\n}) {\n\tconst onUntrackThread = useCallback(() => dispatch(untrackThread(thread)), [thread])\n\tconst isLink = !thread.expired\n\tconst Component = isLink ? Link : 'div'\n\treturn (\n\t\t<div\n\t\t\ttitle={thread.title}\n\t\t\tclassName={clas...
[ "0.58103335", "0.542898", "0.53228194", "0.5296358", "0.5247592", "0.5213371", "0.5190907", "0.51808065", "0.5070394", "0.506929", "0.5060426", "0.50431436", "0.50210977", "0.49881974", "0.49798256", "0.49666816", "0.49288386", "0.4918276", "0.491626", "0.4913396", "0.4911656...
0.62011886
0
an attempt to work around
function sendKeyframe(pc) { console.log('sendkeyframe', pc.iceConnectionState); if (pc.iceConnectionState !== 'connected') return; // safe... pc.setRemoteDescription( pc.remoteDescription, function () { pc.createAnswer( function (modifiedAnswer) { pc.setLocalDescription( modifiedAnswer, function () { // noop }, function (error) { console.log('triggerKeyframe setLocalDescription failed', error); UI.messageHandler.showError(); } ); }, function (error) { console.log('triggerKeyframe createAnswer failed', error); UI.messageHandler.showError(); } ); }, function (error) { console.log('triggerKeyframe setRemoteDescription failed', error); UI.messageHandler.showError(); } ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "protected internal function m252() {}", "transient private protected internal function m182() {}", "transient protected internal function m189() {}", "transient private internal function m185() {}", "static private internal fun...
[ "0.67953676", "0.6461239", "0.642104", "0.6208531", "0.6102396", "0.6011876", "0.59634054", "0.59355253", "0.57962424", "0.573845", "0.56429243", "0.56102186", "0.5574703", "0.5557605", "0.54862726", "0.5471745", "0.5366237", "0.5313665", "0.52801836", "0.52556163", "0.525497...
0.0
-1
this could be useful in Array.prototype.
function arrayEquals(array) { // if the other array is a falsy value, return if (!array) return false; // compare lengths - can save a lot of time if (this.length != array.length) return false; for (var i = 0, l=this.length; i < l; i++) { // Check if we have nested arrays if (this[i] instanceof Array && array[i] instanceof Array) { // recurse into the nested arrays if (!this[i].equals(array[i])) return false; } else if (this[i] != array[i]) { // Warning - two different object instances will never be equal: {x:20} != {x:20} return false; } } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ArrayUtils() {}", "function Array() {}", "[Symbol.iterator]() {\n return this.#array[Symbol.iterator]();\n }", "function arrayMethodFix(fn){ // 809\n return function(){ ...
[ "0.696767", "0.66225266", "0.6128983", "0.60604686", "0.6013327", "0.6009423", "0.59820926", "0.59453964", "0.5943842", "0.59429765", "0.5881751", "0.58740425", "0.5865706", "0.5865706", "0.5865706", "0.58581585", "0.5850747", "0.5845911", "0.582462", "0.5821777", "0.5789929"...
0.0
-1
Sends a COLIBRI message which enables or disables (according to 'state') the recording on the bridge. Waits for the result IQ and calls 'callback' with the new recording state, according to the IQ.
function setRecordingColibri(state, token, callback, connection) { var elem = $iq({to: connection.emuc.focusMucJid, type: 'set'}); elem.c('conference', { xmlns: 'http://jitsi.org/protocol/colibri' }); elem.c('recording', {state: state, token: token}); connection.sendIQ(elem, function (result) { console.log('Set recording "', state, '". Result:', result); var recordingElem = $(result).find('>conference>recording'); var newState = ('true' === recordingElem.attr('state')); recordingEnabled = newState; callback(newState); }, function (error) { console.warn(error); callback(recordingEnabled); } ); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function onCdr(callback)\n{\n if ( !callback || typeof (callback) !== 'function' ) { return; }\n webphone_api.cdrcb.push(callback);\n}", "function connect() {\n sb = new SendBird({appId: APP_ID.value});\n sb.connect(USER_ID.value, (user, error) => {\n if (error) {\n alert(error);\n ...
[ "0.55292344", "0.49632838", "0.4924295", "0.49182978", "0.49025458", "0.47946677", "0.47543642", "0.4711298", "0.46959478", "0.46685758", "0.46531543", "0.46503454", "0.4637619", "0.46288246", "0.4626916", "0.45827892", "0.4579811", "0.45359525", "0.44989538", "0.44596183", "...
0.66643995
1
deflate(data[, options]) > Uint8Array|Array|String data (Uint8Array|Array|String): input data to compress. options (Object): zlib deflate options. Compress `data` with deflate alrorythm and `options`. Supported options are: level windowBits memLevel strategy [ for more information on these. Sugar (options): `raw` (Boolean) say that we work with raw stream, if you don't wish to specify negative windowBits implicitly. `to` (String) if equal to 'string', then result will be "binary string" (each char code [0..255]) Example: ```javascript var pako = require('pako') , data = Uint8Array([1,2,3,4,5,6,7,8,9]); console.log(pako.deflate(data)); ```
function deflate(input, options) { var deflator = new Deflate(options); deflator.push(input, true); // That will never happens, if you don't cheat with options :) if (deflator.err) { throw deflator.msg; } return deflator.result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function gzip(input,options){options=options||{};options.gzip=true;return deflate$1(input,options);}", "function deflate$1(input,options){const deflator=new Deflate(options);deflator.push(input,true);// That will never happens, if you don't cheat with options :)\nif(deflator.err){throw deflator.msg||messages[def...
[ "0.6332804", "0.6329344", "0.61815435", "0.61335", "0.61335", "0.61122954", "0.6091908", "0.608164", "0.60806566", "0.6079221", "0.6062083", "0.6038355", "0.6038355", "0.6038355", "0.6038355", "0.6038355", "0.6038355", "0.6038355", "0.6038355", "0.6038355", "0.6038355", "0....
0.6034561
56
deflateRaw(data[, options]) > Uint8Array|Array|String data (Uint8Array|Array|String): input data to compress. options (Object): zlib deflate options. The same as [[deflate]], but creates raw data, without wrapper (header and adler32 crc).
function deflateRaw(input, options) { options = options || {}; options.raw = true; return deflate(input, options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deflateRaw$1(input, options) {\n\t options = options || {};\n\t options.raw = true;\n\t return deflate$3(input, options);\n\t}", "function deflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return deflate$1(input, options);\n}", "function deflateRaw(input, options) {...
[ "0.7680796", "0.76410246", "0.76410246", "0.7620591", "0.7620591", "0.7614947", "0.7574728", "0.75647724", "0.755764", "0.7534994", "0.7517278", "0.75154525", "0.6568635", "0.6568635", "0.6568635", "0.6568635", "0.6568635", "0.6568635", "0.6568635", "0.6568635", "0.6568635", ...
0.7583417
46
gzip(data[, options]) > Uint8Array|Array|String data (Uint8Array|Array|String): input data to compress. options (Object): zlib deflate options. The same as [[deflate]], but create gzip wrapper instead of deflate one.
function gzip(input, options) { options = options || {}; options.gzip = true; return deflate(input, options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function gzip(input,options){options=options||{};options.gzip=true;return deflate$1(input,options);}", "function gzip$1(input, options) {\n\t options = options || {};\n\t options.gzip = true;\n\t return deflate$3(input, options);\n\t}", "function gzip(input, options) {\n\t options = options || {};\n\t opt...
[ "0.75869906", "0.7519991", "0.7475314", "0.7475314", "0.74652964", "0.74602276", "0.73579544", "0.73579544", "0.7340525", "0.73362404", "0.7313697", "0.730394", "0.6607629", "0.6607629", "0.6607629", "0.65512145", "0.6153322", "0.6144623", "0.6144623", "0.6116595", "0.6116595...
0.7335155
53
inflateRaw(data[, options]) > Uint8Array|Array|String data (Uint8Array|Array|String): input data to decompress. options (Object): zlib inflate options. The same as [[inflate]], but creates raw data, without wrapper (header and adler32 crc).
function inflateRaw(input, options) { options = options || {}; options.raw = true; return inflate(input, options); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function inflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return inflate$1(input, options);\n}", "function inflateRaw(input, options) {\n options = options || {};\n options.raw = true;\n return inflate$1(input, options);\n}", "function inflateRaw(input, options) {\n\t opti...
[ "0.7418727", "0.7418727", "0.74137247", "0.74064463", "0.7394453", "0.7394453", "0.73830867", "0.7376981", "0.73463386", "0.7340878", "0.7328237", "0.7328237", "0.7274889", "0.72629726", "0.7207871", "0.7207871", "0.72034985", "0.72034985", "0.7195765", "0.719202", "0.7128862...
0.74284965
41
Helper (used in 2 places)
function buf2binstring(buf, len) { // use fallback for big arrays to avoid stack overflow if (len < 65537) { if ((buf.subarray && STR_APPLY_UIA_OK) || (!buf.subarray && STR_APPLY_OK)) { return String.fromCharCode.apply(null, utils.shrinkBuf(buf, len)); } } var result = ''; for(var i=0; i < len; i++) { result += String.fromCharCode(buf[i]); } return result; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private internal function m248() {}", "private public function m246() {}", "protected internal function m252() {}", "static private internal function m121() {}", "transient private protected internal function m182() {}", "transient protected internal function m189() {}", "static private protected inter...
[ "0.68026626", "0.67003596", "0.665479", "0.62646127", "0.62632245", "0.6196471", "0.6128034", "0.60641336", "0.60158974", "0.60106325", "0.59154373", "0.58908814", "0.57922685", "0.5754438", "0.57025576", "0.56650496", "0.5632441", "0.56095976", "0.5585894", "0.5585894", "0.5...
0.0
-1
Note: adler32 takes 12% for level 0 and 2% for level 6. It doesn't worth to make additional optimizationa as in original. Small size is preferable.
function adler32(adler, buf, len, pos) { var s1 = (adler & 0xffff) |0 , s2 = ((adler >>> 16) & 0xffff) |0 , n = 0; while (len !== 0) { // Set limit ~ twice less than 5552, to keep // s2 in 31-bits, because we force signed ints. // in other case %= will fail. n = len > 2000 ? 2000 : len; len -= n; do { s1 = (s1 + buf[pos++]) |0; s2 = (s2 + s1) |0; } while (--n); s1 %= 65521; s2 %= 65521; } return (s1 | (s2 << 16)) |0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function adler32(data){var a=1;var b=0;var i=0;var l=data.length;var m=l&~0x3;while(i<m){var n=Math.min(i+4096,m);for(;i<n;i+=4){b+=(a+=data.charCodeAt(i))+(a+=data.charCodeAt(i+1))+(a+=data.charCodeAt(i+2))+(a+=data.charCodeAt(i+3));}a%=MOD;b%=MOD;}for(;i<l;i++){b+=a+=data.charCodeAt(i);}a%=MOD;b%=MOD;return a|b<...
[ "0.6453808", "0.6453808", "0.6453808", "0.6355045", "0.6333638", "0.6333638", "0.6333638", "0.6333638", "0.6333638", "0.6333638", "0.6333638", "0.6333638", "0.6333638", "0.6333638", "0.6333638", "0.6333638", "0.6333638", "0.6333638", "0.6333638", "0.6333638", "0.6333638", "...
0.0
-1
Note: we can't get significant speed boost here. So write code to minimize size no pregenerated tables and array tools dependencies. Use ordinary array, since untyped makes no boost here
function makeTable() { var c, table = []; for(var n =0; n < 256; n++){ c = n; for(var k =0; k < 8; k++){ c = ((c&1) ? (0xEDB88320 ^ (c >>> 1)) : (c >>> 1)); } table[n] = c; } return table; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Array() {}", "function sumArrayPlain(arr) {\n\n window.performance.mark('pStart');\n\n var sum = 0;\n for (var i = 0; i < arr.length; i++)\n sum += arr[i];\n\n pEnd = new Date().getTime();\n /* Adding data to the global array */...
[ "0.6351423", "0.626551", "0.61295223", "0.6040662", "0.60219103", "0.59781724", "0.5955053", "0.5879565", "0.5820634", "0.58065885", "0.5776067", "0.5773094", "0.5760899", "0.57540375", "0.5751431", "0.574649", "0.5744183", "0.5722956", "0.5664927", "0.5648365", "0.5645067", ...
0.0
-1
Unix :) . Don't detect, use this default.
function err(strm, errorCode) { strm.msg = msg[errorCode]; return errorCode; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "static mojangFriendlyOS(){\n const opSys = process.platform\n if (opSys === 'darwin') {\n return 'osx'\n } else if (opSys === 'win32'){\n return 'windows'\n } else if (opSys === 'linux'){\n return 'linux'\n } else {\n return 'unknown_os...
[ "0.60842496", "0.59525836", "0.58187497", "0.57424915", "0.57085973", "0.5652684", "0.5647002", "0.55350727", "0.54870725", "0.5475888", "0.54565", "0.54538655", "0.5415005", "0.5375714", "0.5364179", "0.5357404", "0.53541917", "0.53301984", "0.527862", "0.527862", "0.527862"...
0.0
-1
========================================================================= Flush as much pending output as possible. All deflate() output goes through this function so some applications may wish to modify it to avoid allocating a large strm>output buffer and copying into it. (See also read_buf()).
function flush_pending(strm) { var s = strm.state; //_tr_flush_bits(s); var len = s.pending; if (len > strm.avail_out) { len = strm.avail_out; } if (len === 0) { return; } utils.arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out); strm.next_out += len; s.pending_out += len; strm.total_out += len; strm.avail_out -= len; s.pending -= len; if (s.pending === 0) { s.pending_out = 0; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function flush_pending(strm) {\n\t var s = strm.state;\n\t\n\t //_tr_flush_bits(s);\n\t var len = s.pending;\n\t if (len > strm.avail_out) {\n\t len = strm.avail_out;\n\t }\n\t if (len === 0) { return; }\n\t\n\t arraySet(strm.output, s.pending_buf, s.pending_out, len, strm.next_out);\n\t ...
[ "0.6295302", "0.62700987", "0.6267362", "0.6204446", "0.62010384", "0.6188399", "0.61843765", "0.6183771", "0.61774987", "0.6162318", "0.6162145", "0.6162057", "0.6162057", "0.6156232" ]
0.6159415
87
========================================================================= Put a short in the pending buffer. The 16bit value is put in MSB order. IN assertion: the stream state is correct and there is enough room in pending_buf.
function putShortMSB(s, b) { // put_byte(s, (Byte)(b >> 8)); // put_byte(s, (Byte)(b & 0xff)); s.pending_buf[s.pending++] = (b >>> 8) & 0xff; s.pending_buf[s.pending++] = b & 0xff; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function put_short(s, w) {\n// put_byte(s, (uch)((w) & 0xff));\n// put_byte(s, (uch)((ush)(w) >> 8));\n s.pending_buf[s.pending++] = (w) & 0xff;\n s.pending_buf[s.pending++] = (w >>> 8) & 0xff;\n}", "function put_short(s, w) {\n// put_byte(s, (uch)((w) & 0xff));\n// put_byte(s, (uch)((ush)(w) >> 8)...
[ "0.80095273", "0.80095273", "0.80095273", "0.80095273", "0.80095273", "0.80095273", "0.80095273", "0.80095273", "0.80095273", "0.80095273", "0.80095273", "0.80095273", "0.80095273", "0.80095273", "0.80095273", "0.80095273", "0.80095273", "0.80095273", "0.80095273", "0.80095273"...
0.0
-1
=========================================================================== Read a new buffer from the current input stream, update the adler32 and total number of bytes read. All deflate() input goes through this function so some applications may wish to modify it to avoid allocating a large strm>input buffer and copying from it. (See also flush_pending()).
function read_buf(strm, buf, start, size) { var len = strm.avail_in; if (len > size) { len = size; } if (len === 0) { return 0; } strm.avail_in -= len; utils.arraySet(buf, strm.input, strm.next_in, len, start); if (strm.state.wrap === 1) { strm.adler = adler32(strm.adler, buf, len, start); } else if (strm.state.wrap === 2) { strm.adler = crc32(strm.adler, buf, len, start); } strm.next_in += len; strm.total_in += len; return len; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function read_buf(strm, buf, start, size) {\n var len = strm.avail_in;\n \n if (len > size) { len = size; }\n if (len === 0) { return 0; }\n \n strm.avail_in -= len;\n \n // zmemcpy(buf, strm->next_in, len);\n utils.arraySet(buf, strm.input, strm.next_in, len, start);\n ...
[ "0.6806013", "0.6776525", "0.6776525", "0.6776525", "0.6776525", "0.6775718", "0.67708814", "0.674234", "0.6718914", "0.67015874", "0.66959625", "0.66921324", "0.66756624", "0.6658554", "0.6658554", "0.6612709", "0.6612709", "0.6612709", "0.6612709", "0.6612709", "0.6612709",...
0.0
-1
=========================================================================== Set match_start to the longest match starting at the given string and return its length. Matches shorter or equal to prev_length are discarded, in which case the result is equal to prev_length and match_start is garbage. IN assertions: cur_match is the head of the hash chain for the current string (strstart) and its distance is = 1 OUT assertion: the match length is not greater than s>lookahead.
function longest_match(s, cur_match) { var chain_length = s.max_chain_length; /* max hash chain length */ var scan = s.strstart; /* current string */ var match; /* matched string */ var len; /* length of current match */ var best_len = s.prev_length; /* best match length so far */ var nice_match = s.nice_match; /* stop if match long enough */ var limit = (s.strstart > (s.w_size - MIN_LOOKAHEAD)) ? s.strstart - (s.w_size - MIN_LOOKAHEAD) : 0/*NIL*/; var _win = s.window; // shortcut var wmask = s.w_mask; var prev = s.prev; /* Stop when cur_match becomes <= limit. To simplify the code, * we prevent matches with the string of window index 0. */ var strend = s.strstart + MAX_MATCH; var scan_end1 = _win[scan + best_len - 1]; var scan_end = _win[scan + best_len]; /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. * It is easy to get rid of this optimization if necessary. */ // Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); /* Do not waste too much time if we already have a good match: */ if (s.prev_length >= s.good_match) { chain_length >>= 2; } /* Do not look for matches beyond the end of the input. This is necessary * to make deflate deterministic. */ if (nice_match > s.lookahead) { nice_match = s.lookahead; } // Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); do { // Assert(cur_match < s->strstart, "no future"); match = cur_match; /* Skip to next match if the match length cannot increase * or if the match length is less than 2. Note that the checks below * for insufficient lookahead only occur occasionally for performance * reasons. Therefore uninitialized memory will be accessed, and * conditional jumps will be made that depend on those values. * However the length of the match is limited to the lookahead, so * the output of deflate is not affected by the uninitialized values. */ if (_win[match + best_len] !== scan_end || _win[match + best_len - 1] !== scan_end1 || _win[match] !== _win[scan] || _win[++match] !== _win[scan + 1]) { continue; } /* The check at best_len-1 can be removed because it will be made * again later. (This heuristic is not always a win.) * It is not necessary to compare scan[2] and match[2] since they * are always equal when the other bytes match, given that * the hash keys are equal and that HASH_BITS >= 8. */ scan += 2; match++; // Assert(*scan == *match, "match[2]?"); /* We check for insufficient lookahead only every 8th comparison; * the 256th check will be made at strstart+258. */ do { /*jshint noempty:false*/ } while (_win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && _win[++scan] === _win[++match] && scan < strend); // Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); len = MAX_MATCH - (strend - scan); scan = strend - MAX_MATCH; if (len > best_len) { s.match_start = cur_match; best_len = len; if (len >= nice_match) { break; } scan_end1 = _win[scan + best_len - 1]; scan_end = _win[scan + best_len]; } } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length !== 0); if (best_len <= s.lookahead) { return best_len; } return s.lookahead; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function longest_match$1(s, cur_match) {\n\t var chain_length = s.max_chain_length; /* max hash chain length */\n\t var scan = s.strstart; /* current string */\n\t var match; /* matched string */\n\t var len; /* length of current match */\n\t var best_len =...
[ "0.75376654", "0.7508505", "0.7501495", "0.75013494", "0.74998707", "0.74998707", "0.74998707", "0.74998707", "0.74998707", "0.74998707", "0.74998707", "0.7496742", "0.74936265", "0.748309", "0.74774504" ]
0.7495141
86
=========================================================================== Fill the window when the lookahead becomes insufficient. Updates strstart and lookahead. IN assertion: lookahead < MIN_LOOKAHEAD OUT assertions: strstart <= window_sizeMIN_LOOKAHEAD At least one byte has been read, or avail_in == 0; reads are performed for at least two bytes (required for the zip translate_eol option not supported here).
function fill_window(s) { var _w_size = s.w_size; var p, n, m, more, str; //Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead"); do { more = s.window_size - s.lookahead - s.strstart; // JS ints have 32 bit, block below not needed /* Deal with !@#$% 64K limit: */ //if (sizeof(int) <= 2) { // if (more == 0 && s->strstart == 0 && s->lookahead == 0) { // more = wsize; // // } else if (more == (unsigned)(-1)) { // /* Very unlikely, but possible on 16 bit machine if // * strstart == 0 && lookahead == 1 (input done a byte at time) // */ // more--; // } //} /* If the window is almost full and there is insufficient lookahead, * move the upper half to the lower one to make room in the upper half. */ if (s.strstart >= _w_size + (_w_size - MIN_LOOKAHEAD)) { utils.arraySet(s.window, s.window, _w_size, _w_size, 0); s.match_start -= _w_size; s.strstart -= _w_size; /* we now have strstart >= MAX_DIST */ s.block_start -= _w_size; /* Slide the hash table (could be avoided with 32 bit values at the expense of memory usage). We slide even when level == 0 to keep the hash table consistent if we switch back to level > 0 later. (Using level 0 permanently is not an optimal usage of zlib, so we don't care about this pathological case.) */ n = s.hash_size; p = n; do { m = s.head[--p]; s.head[p] = (m >= _w_size ? m - _w_size : 0); } while (--n); n = _w_size; p = n; do { m = s.prev[--p]; s.prev[p] = (m >= _w_size ? m - _w_size : 0); /* If n is not on any hash chain, prev[n] is garbage but * its value will never be used. */ } while (--n); more += _w_size; } if (s.strm.avail_in === 0) { break; } /* If there was no sliding: * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && * more == window_size - lookahead - strstart * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) * => more >= window_size - 2*WSIZE + 2 * In the BIG_MEM or MMAP case (not yet supported), * window_size == input_size + MIN_LOOKAHEAD && * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. * Otherwise, window_size == 2*WSIZE so more >= 2. * If there was sliding, more >= WSIZE. So in all cases, more >= 2. */ //Assert(more >= 2, "more < 2"); n = read_buf(s.strm, s.window, s.strstart + s.lookahead, more); s.lookahead += n; /* Initialize the hash value now that we have some input: */ if (s.lookahead + s.insert >= MIN_MATCH) { str = s.strstart - s.insert; s.ins_h = s.window[str]; /* UPDATE_HASH(s, s->ins_h, s->window[str + 1]); */ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + 1]) & s.hash_mask; //#if MIN_MATCH != 3 // Call update_hash() MIN_MATCH-3 more times //#endif while (s.insert) { /* UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); */ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[str + MIN_MATCH-1]) & s.hash_mask; s.prev[str & s.w_mask] = s.head[s.ins_h]; s.head[s.ins_h] = str; str++; s.insert--; if (s.lookahead + s.insert < MIN_MATCH) { break; } } } /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, * but this is not important since only literal bytes will be emitted. */ } while (s.lookahead < MIN_LOOKAHEAD && s.strm.avail_in !== 0); /* If the WIN_INIT bytes after the end of the current data have never been * written, then zero those bytes in order to avoid memory check reports of * the use of uninitialized (or uninitialised as Julian writes) bytes by * the longest match routines. Update the high water mark for the next * time through here. WIN_INIT is set to MAX_MATCH since the longest match * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead. */ // if (s.high_water < s.window_size) { // var curr = s.strstart + s.lookahead; // var init = 0; // // if (s.high_water < curr) { // /* Previous high water mark below current data -- zero WIN_INIT // * bytes or up to end of window, whichever is less. // */ // init = s.window_size - curr; // if (init > WIN_INIT) // init = WIN_INIT; // zmemzero(s->window + curr, (unsigned)init); // s->high_water = curr + init; // } // else if (s->high_water < (ulg)curr + WIN_INIT) { // /* High water mark at or above current data, but below current data // * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up // * to end of window, whichever is less. // */ // init = (ulg)curr + WIN_INIT - s->high_water; // if (init > s->window_size - s->high_water) // init = s->window_size - s->high_water; // zmemzero(s->window + s->high_water, (unsigned)init); // s->high_water += init; // } // } // // Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, // "not enough room for search"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function fill_window() {\n\t\tvar n, m;\n\n\t // Amount of free space at the end of the window.\n\t\tvar more = window_size - lookahead - strstart;\n\n\t\t// If the window is almost full and there is insufficient lookahead,\n\t\t// move the upper half to the lower one to make room in the upper half.\n\t\tif (more ...
[ "0.73649114", "0.68951803", "0.6752545", "0.674314", "0.6729958", "0.67143106", "0.6687618", "0.6687618", "0.6687618", "0.6687618", "0.6687618", "0.6687618", "0.6687618", "0.6687618", "0.6687618", "0.6687618", "0.6687618", "0.6687618", "0.6687618", "0.6687618", "0.6687618", ...
0.6687618
86
=========================================================================== Copy without compression as much as possible from the input stream, return the current block state. This function does not insert new strings in the dictionary since uncompressible data is probably not useful. This function is used only for the level=0 compression option. NOTE: this function should be optimized to avoid extra copying from window to pending_buf.
function deflate_stored(s, flush) { /* Stored blocks are limited to 0xffff bytes, pending_buf is limited * to pending_buf_size, and each stored block has a 5 byte header: */ var max_block_size = 0xffff; if (max_block_size > s.pending_buf_size - 5) { max_block_size = s.pending_buf_size - 5; } /* Copy as much as possible from input to output: */ for (;;) { /* Fill the window as much as possible: */ if (s.lookahead <= 1) { //Assert(s->strstart < s->w_size+MAX_DIST(s) || // s->block_start >= (long)s->w_size, "slide too late"); // if (!(s.strstart < s.w_size + (s.w_size - MIN_LOOKAHEAD) || // s.block_start >= s.w_size)) { // throw new Error("slide too late"); // } fill_window(s); if (s.lookahead === 0 && flush === Z_NO_FLUSH) { return BS_NEED_MORE; } if (s.lookahead === 0) { break; } /* flush the current block */ } //Assert(s->block_start >= 0L, "block gone"); // if (s.block_start < 0) throw new Error("block gone"); s.strstart += s.lookahead; s.lookahead = 0; /* Emit a stored block if pending_buf will be full: */ var max_start = s.block_start + max_block_size; if (s.strstart === 0 || s.strstart >= max_start) { /* strstart == 0 is possible when wraparound on 16-bit machine */ s.lookahead = s.strstart - max_start; s.strstart = max_start; /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } /* Flush if we may have to slide, otherwise block_start may become * negative and the data will be gone: */ if (s.strstart - s.block_start >= (s.w_size - MIN_LOOKAHEAD)) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } } s.insert = 0; if (flush === Z_FINISH) { /*** FLUSH_BLOCK(s, 1); ***/ flush_block_only(s, true); if (s.strm.avail_out === 0) { return BS_FINISH_STARTED; } /***/ return BS_FINISH_DONE; } if (s.strstart > s.block_start) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } return BS_NEED_MORE; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deflate_stored(s,flush){/* Stored blocks are limited to 0xffff bytes, pending_buf is limited\n * to pending_buf_size, and each stored block has a 5 byte header:\n */var max_block_size=0xffff;if(max_block_size>s.pending_buf_size-5){max_block_size=s.pending_buf_size-5;}/* Copy as much as...
[ "0.59261113", "0.5765634", "0.57584363", "0.57032734", "0.56545705", "0.56424904", "0.5635157", "0.5626327", "0.56045735", "0.55976427", "0.55753577", "0.5563106", "0.55127627" ]
0.5665257
85
=========================================================================== Compress as much as possible from the input stream, return the current block state. This function does not perform lazy evaluation of matches and inserts new strings in the dictionary only for unmatched strings or for short matches. It is used only for the fast compression options.
function deflate_fast(s, flush) { var hash_head; /* head of the hash chain */ var bflush; /* set if current block must be flushed */ for (;;) { /* Make sure that we always have enough lookahead, except * at the end of the input file. We need MAX_MATCH bytes * for the next match, plus MIN_MATCH bytes to insert the * string following the next match. */ if (s.lookahead < MIN_LOOKAHEAD) { fill_window(s); if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { return BS_NEED_MORE; } if (s.lookahead === 0) { break; /* flush the current block */ } } /* Insert the string window[strstart .. strstart+2] in the * dictionary, and set hash_head to the head of the hash chain: */ hash_head = 0/*NIL*/; if (s.lookahead >= MIN_MATCH) { /*** INSERT_STRING(s, s.strstart, hash_head); ***/ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; s.head[s.ins_h] = s.strstart; /***/ } /* Find the longest match, discarding those <= prev_length. * At this point we have always match_length < MIN_MATCH */ if (hash_head !== 0/*NIL*/ && ((s.strstart - hash_head) <= (s.w_size - MIN_LOOKAHEAD))) { /* To simplify the code, we prevent matches with the string * of window index 0 (in particular we have to avoid a match * of the string with itself at the start of the input file). */ s.match_length = longest_match(s, hash_head); /* longest_match() sets match_start */ } if (s.match_length >= MIN_MATCH) { // check_match(s, s.strstart, s.match_start, s.match_length); // for debug only /*** _tr_tally_dist(s, s.strstart - s.match_start, s.match_length - MIN_MATCH, bflush); ***/ bflush = trees._tr_tally(s, s.strstart - s.match_start, s.match_length - MIN_MATCH); s.lookahead -= s.match_length; /* Insert new strings in the hash table only if the match length * is not too large. This saves time but degrades compression. */ if (s.match_length <= s.max_lazy_match/*max_insert_length*/ && s.lookahead >= MIN_MATCH) { s.match_length--; /* string at strstart already in table */ do { s.strstart++; /*** INSERT_STRING(s, s.strstart, hash_head); ***/ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; s.head[s.ins_h] = s.strstart; /***/ /* strstart never exceeds WSIZE-MAX_MATCH, so there are * always MIN_MATCH bytes ahead. */ } while (--s.match_length !== 0); s.strstart++; } else { s.strstart += s.match_length; s.match_length = 0; s.ins_h = s.window[s.strstart]; /* UPDATE_HASH(s, s.ins_h, s.window[s.strstart+1]); */ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + 1]) & s.hash_mask; //#if MIN_MATCH != 3 // Call UPDATE_HASH() MIN_MATCH-3 more times //#endif /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not * matter since it will be recomputed at next deflate call. */ } } else { /* No match, output a literal byte */ //Tracevv((stderr,"%c", s.window[s.strstart])); /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ bflush = trees._tr_tally(s, 0, s.window[s.strstart]); s.lookahead--; s.strstart++; } if (bflush) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } } s.insert = ((s.strstart < (MIN_MATCH-1)) ? s.strstart : MIN_MATCH-1); if (flush === Z_FINISH) { /*** FLUSH_BLOCK(s, 1); ***/ flush_block_only(s, true); if (s.strm.avail_out === 0) { return BS_FINISH_STARTED; } /***/ return BS_FINISH_DONE; } if (s.last_lit) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } return BS_BLOCK_DONE; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deflate_fast() {\n\t\twhile (lookahead !== 0 && qhead === null) {\n\t\t\tvar flush; // set if current block must be flushed\n\n\t\t\t// Insert the string window[strstart .. strstart+2] in the\n\t\t\t// dictionary, and set hash_head to the head of the hash chain:\n\t\t\tINSERT_STRING();\n\n\t\t\t// Find th...
[ "0.66834676", "0.66489595", "0.6623362", "0.63921976", "0.639217", "0.6382699", "0.63680315", "0.63517934", "0.6348527", "0.6344936", "0.63384753", "0.63384753", "0.63384753", "0.63384753", "0.63384753", "0.63384753", "0.63384753", "0.63384753", "0.63384753", "0.63384753", "0...
0.0
-1
=========================================================================== Same as above, but achieves better compression. We use a lazy evaluation for matches: a match is finally adopted only if there is no better match at the next window position.
function deflate_slow(s, flush) { var hash_head; /* head of hash chain */ var bflush; /* set if current block must be flushed */ var max_insert; /* Process the input block. */ for (;;) { /* Make sure that we always have enough lookahead, except * at the end of the input file. We need MAX_MATCH bytes * for the next match, plus MIN_MATCH bytes to insert the * string following the next match. */ if (s.lookahead < MIN_LOOKAHEAD) { fill_window(s); if (s.lookahead < MIN_LOOKAHEAD && flush === Z_NO_FLUSH) { return BS_NEED_MORE; } if (s.lookahead === 0) { break; } /* flush the current block */ } /* Insert the string window[strstart .. strstart+2] in the * dictionary, and set hash_head to the head of the hash chain: */ hash_head = 0/*NIL*/; if (s.lookahead >= MIN_MATCH) { /*** INSERT_STRING(s, s.strstart, hash_head); ***/ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; s.head[s.ins_h] = s.strstart; /***/ } /* Find the longest match, discarding those <= prev_length. */ s.prev_length = s.match_length; s.prev_match = s.match_start; s.match_length = MIN_MATCH-1; if (hash_head !== 0/*NIL*/ && s.prev_length < s.max_lazy_match && s.strstart - hash_head <= (s.w_size-MIN_LOOKAHEAD)/*MAX_DIST(s)*/) { /* To simplify the code, we prevent matches with the string * of window index 0 (in particular we have to avoid a match * of the string with itself at the start of the input file). */ s.match_length = longest_match(s, hash_head); /* longest_match() sets match_start */ if (s.match_length <= 5 && (s.strategy === Z_FILTERED || (s.match_length === MIN_MATCH && s.strstart - s.match_start > 4096/*TOO_FAR*/))) { /* If prev_match is also MIN_MATCH, match_start is garbage * but we will ignore the current match anyway. */ s.match_length = MIN_MATCH-1; } } /* If there was a match at the previous step and the current * match is not better, output the previous match: */ if (s.prev_length >= MIN_MATCH && s.match_length <= s.prev_length) { max_insert = s.strstart + s.lookahead - MIN_MATCH; /* Do not insert strings in hash table beyond this. */ //check_match(s, s.strstart-1, s.prev_match, s.prev_length); /***_tr_tally_dist(s, s.strstart - 1 - s.prev_match, s.prev_length - MIN_MATCH, bflush);***/ bflush = trees._tr_tally(s, s.strstart - 1- s.prev_match, s.prev_length - MIN_MATCH); /* Insert in hash table all strings up to the end of the match. * strstart-1 and strstart are already inserted. If there is not * enough lookahead, the last two strings are not inserted in * the hash table. */ s.lookahead -= s.prev_length-1; s.prev_length -= 2; do { if (++s.strstart <= max_insert) { /*** INSERT_STRING(s, s.strstart, hash_head); ***/ s.ins_h = ((s.ins_h << s.hash_shift) ^ s.window[s.strstart + MIN_MATCH - 1]) & s.hash_mask; hash_head = s.prev[s.strstart & s.w_mask] = s.head[s.ins_h]; s.head[s.ins_h] = s.strstart; /***/ } } while (--s.prev_length !== 0); s.match_available = 0; s.match_length = MIN_MATCH-1; s.strstart++; if (bflush) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } } else if (s.match_available) { /* If there was no match at the previous position, output a * single literal. If there was a match but the current match * is longer, truncate the previous match to a single literal. */ //Tracevv((stderr,"%c", s->window[s->strstart-1])); /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/ bflush = trees._tr_tally(s, 0, s.window[s.strstart-1]); if (bflush) { /*** FLUSH_BLOCK_ONLY(s, 0) ***/ flush_block_only(s, false); /***/ } s.strstart++; s.lookahead--; if (s.strm.avail_out === 0) { return BS_NEED_MORE; } } else { /* There is no previous match to compare with, wait for * the next step to decide. */ s.match_available = 1; s.strstart++; s.lookahead--; } } //Assert (flush != Z_NO_FLUSH, "no flush?"); if (s.match_available) { //Tracevv((stderr,"%c", s->window[s->strstart-1])); /*** _tr_tally_lit(s, s.window[s.strstart-1], bflush); ***/ bflush = trees._tr_tally(s, 0, s.window[s.strstart-1]); s.match_available = 0; } s.insert = s.strstart < MIN_MATCH-1 ? s.strstart : MIN_MATCH-1; if (flush === Z_FINISH) { /*** FLUSH_BLOCK(s, 1); ***/ flush_block_only(s, true); if (s.strm.avail_out === 0) { return BS_FINISH_STARTED; } /***/ return BS_FINISH_DONE; } if (s.last_lit) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } return BS_BLOCK_DONE; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deflate_fast() {\n\t\twhile (lookahead !== 0 && qhead === null) {\n\t\t\tvar flush; // set if current block must be flushed\n\n\t\t\t// Insert the string window[strstart .. strstart+2] in the\n\t\t\t// dictionary, and set hash_head to the head of the hash chain:\n\t\t\tINSERT_STRING();\n\n\t\t\t// Find th...
[ "0.66324675", "0.60708964", "0.60278755", "0.58126444", "0.56749785", "0.56560904", "0.5632922", "0.5628258", "0.5612574", "0.55996627", "0.5562616", "0.5542642", "0.55422807", "0.55375457", "0.5528214", "0.5515559", "0.55129355", "0.550209", "0.5501354", "0.5501354", "0.5498...
0.0
-1
=========================================================================== For Z_RLE, simply look for runs of bytes, generate matches only of distance one. Do not maintain a hash table. (It will be regenerated if this run of deflate switches away from Z_RLE.)
function deflate_rle(s, flush) { var bflush; /* set if current block must be flushed */ var prev; /* byte at distance one to match */ var scan, strend; /* scan goes up to strend for length of run */ var _win = s.window; for (;;) { /* Make sure that we always have enough lookahead, except * at the end of the input file. We need MAX_MATCH bytes * for the longest run, plus one for the unrolled loop. */ if (s.lookahead <= MAX_MATCH) { fill_window(s); if (s.lookahead <= MAX_MATCH && flush === Z_NO_FLUSH) { return BS_NEED_MORE; } if (s.lookahead === 0) { break; } /* flush the current block */ } /* See how many times the previous byte repeats */ s.match_length = 0; if (s.lookahead >= MIN_MATCH && s.strstart > 0) { scan = s.strstart - 1; prev = _win[scan]; if (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan]) { strend = s.strstart + MAX_MATCH; do { /*jshint noempty:false*/ } while (prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && prev === _win[++scan] && scan < strend); s.match_length = MAX_MATCH - (strend - scan); if (s.match_length > s.lookahead) { s.match_length = s.lookahead; } } //Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan"); } /* Emit match if have run of MIN_MATCH or longer, else emit literal */ if (s.match_length >= MIN_MATCH) { //check_match(s, s.strstart, s.strstart - 1, s.match_length); /*** _tr_tally_dist(s, 1, s.match_length - MIN_MATCH, bflush); ***/ bflush = trees._tr_tally(s, 1, s.match_length - MIN_MATCH); s.lookahead -= s.match_length; s.strstart += s.match_length; s.match_length = 0; } else { /* No match, output a literal byte */ //Tracevv((stderr,"%c", s->window[s->strstart])); /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ bflush = trees._tr_tally(s, 0, s.window[s.strstart]); s.lookahead--; s.strstart++; } if (bflush) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } } s.insert = 0; if (flush === Z_FINISH) { /*** FLUSH_BLOCK(s, 1); ***/ flush_block_only(s, true); if (s.strm.avail_out === 0) { return BS_FINISH_STARTED; } /***/ return BS_FINISH_DONE; } if (s.last_lit) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } return BS_BLOCK_DONE; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function $m2YO$var$deflate_rle(s, flush) {\n var bflush;\n /* set if current block must be flushed */\n\n var prev;\n /* byte at distance one to match */\n\n var scan, strend;\n /* scan goes up to strend for length of run */\n\n var _win = s.window;\n\n for (;;) {\n /* Make sure that we always have enou...
[ "0.7337809", "0.72525966", "0.69772786", "0.6927416", "0.6923", "0.6902618", "0.690135", "0.68757206", "0.685161", "0.685161", "0.68312955", "0.68101317", "0.68007237", "0.67007655", "0.67007655" ]
0.6905223
85
=========================================================================== For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. (It will be regenerated if this run of deflate switches away from Huffman.)
function deflate_huff(s, flush) { var bflush; /* set if current block must be flushed */ for (;;) { /* Make sure that we have a literal to write. */ if (s.lookahead === 0) { fill_window(s); if (s.lookahead === 0) { if (flush === Z_NO_FLUSH) { return BS_NEED_MORE; } break; /* flush the current block */ } } /* Output a literal byte */ s.match_length = 0; //Tracevv((stderr,"%c", s->window[s->strstart])); /*** _tr_tally_lit(s, s.window[s.strstart], bflush); ***/ bflush = trees._tr_tally(s, 0, s.window[s.strstart]); s.lookahead--; s.strstart++; if (bflush) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } } s.insert = 0; if (flush === Z_FINISH) { /*** FLUSH_BLOCK(s, 1); ***/ flush_block_only(s, true); if (s.strm.avail_out === 0) { return BS_FINISH_STARTED; } /***/ return BS_FINISH_DONE; } if (s.last_lit) { /*** FLUSH_BLOCK(s, 0); ***/ flush_block_only(s, false); if (s.strm.avail_out === 0) { return BS_NEED_MORE; } /***/ } return BS_BLOCK_DONE; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deflate_fast(flush) {\n\t\t // short hash_head = 0; // head of the hash chain\n\t\t var hash_head = 0; // head of the hash chain\n \n\t\t var bflush; // set if current block must be flushed\n \n\t\t while (true) {\n\t\t\t// Make sure that we always have enough lookahead, except\n\t\t\t// at the end ...
[ "0.67539406", "0.6724569", "0.637843", "0.63653594", "0.6295601", "0.6234702", "0.6223958", "0.6153701", "0.6106422", "0.6075691", "0.603571", "0.6007223", "0.600191", "0.600191", "0.600191", "0.600191", "0.600191", "0.600191", "0.600191", "0.600191", "0.600191", "0.600191"...
0.0
-1
=========================================================================== Initialize the "longest match" routines for a new zlib stream
function lm_init(s) { s.window_size = 2 * s.w_size; /*** CLEAR_HASH(s); ***/ zero(s.head); // Fill with NIL (= 0); /* Set the default configuration parameters: */ s.max_lazy_match = configuration_table[s.level].max_lazy; s.good_match = configuration_table[s.level].good_length; s.nice_match = configuration_table[s.level].nice_length; s.max_chain_length = configuration_table[s.level].max_chain; s.strstart = 0; s.block_start = 0; s.lookahead = 0; s.insert = 0; s.match_length = s.prev_length = MIN_MATCH - 1; s.match_available = 0; s.ins_h = 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function longest_match(s,cur_match){var chain_length=s.max_chain_length;/* max hash chain length */var scan=s.strstart;/* current string */var match;/* matched string */var len;/* length of current match */var best_len=s.prev_length;/* best match length so far */var nice_match=s.nice_match;/* stop if match long en...
[ "0.6649219", "0.6516887", "0.64467674", "0.63978803", "0.6388808", "0.6328055", "0.62111276", "0.6198129", "0.6192374", "0.6181118", "0.61744523", "0.6143312", "0.6141138", "0.61273575", "0.6118701", "0.6109118", "0.60909086", "0.609031", "0.60864216", "0.60686386", "0.605897...
0.0
-1
We have no pointers in JS, so keep tables separate
function fixedtables(state) { /* build fixed huffman tables if first call (may not be thread safe) */ if (virgin) { var sym; lenfix = new utils.Buf32(512); distfix = new utils.Buf32(32); /* literal/length table */ sym = 0; while (sym < 144) { state.lens[sym++] = 8; } while (sym < 256) { state.lens[sym++] = 9; } while (sym < 280) { state.lens[sym++] = 7; } while (sym < 288) { state.lens[sym++] = 8; } inflate_table(LENS, state.lens, 0, 288, lenfix, 0, state.work, {bits: 9}); /* distance table */ sym = 0; while (sym < 32) { state.lens[sym++] = 5; } inflate_table(DISTS, state.lens, 0, 32, distfix, 0, state.work, {bits: 5}); /* do this just once */ virgin = false; } state.lencode = lenfix; state.lenbits = 9; state.distcode = distfix; state.distbits = 5; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function buildTable(){\n\n}", "function make_table_for_external_dispatcher(id_of_table , row_class_name , state){\n let table_witch_contains_id = document.getElementById(id_of_table);\n let table_rows_with_class_name = document.getElementsByClassName(row_class_name);\n\n while (table_rows_with_class_nam...
[ "0.634005", "0.62782997", "0.6234986", "0.6232895", "0.61956674", "0.61253685", "0.61182165", "0.6103738", "0.60886884", "0.6075594", "0.6073368", "0.60690916", "0.60636455", "0.60636455", "0.60636455", "0.6060776", "0.6054898", "0.6052255", "0.6043594", "0.6034194", "0.60278...
0.0
-1
Update the window with the last wsize (normally 32K) bytes written before returning. If window does not exist yet, create it. This is only called when a window is already in use, or when output has been written during this inflate call, but the end of the deflate stream has not been reached yet. It is also called to create a window for dictionary data when a dictionary is loaded. Providing output buffers larger than 32K to inflate() should provide a speed advantage, since only the last 32K of output is copied to the sliding window upon return from inflate(), and since all distances after the first 32K of output will fall in the output data, making match copies simpler and faster. The advantage may be dependent on the size of the processor's data caches.
function updatewindow(strm, src, end, copy) { var dist; var state = strm.state; /* if it hasn't been done already, allocate space for the window */ if (state.window === null) { state.wsize = 1 << state.wbits; state.wnext = 0; state.whave = 0; state.window = new utils.Buf8(state.wsize); } /* copy state->wsize or less output bytes into the circular window */ if (copy >= state.wsize) { utils.arraySet(state.window,src, end - state.wsize, state.wsize, 0); state.wnext = 0; state.whave = state.wsize; } else { dist = state.wsize - state.wnext; if (dist > copy) { dist = copy; } //zmemcpy(state->window + state->wnext, end - copy, dist); utils.arraySet(state.window,src, end - copy, dist, state.wnext); copy -= dist; if (copy) { //zmemcpy(state->window, end - copy, copy); utils.arraySet(state.window,src, end - copy, copy, 0); state.wnext = copy; state.whave = state.wsize; } else { state.wnext += dist; if (state.wnext === state.wsize) { state.wnext = 0; } if (state.whave < state.wsize) { state.whave += dist; } } } return 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updatewindow(strm, src, end, copy) {\n\t var dist;\n\t var state = strm.state;\n\t\n\t /* if it hasn't been done already, allocate space for the window */\n\t if (state.window === null) {\n\t state.wsize = 1 << state.wbits;\n\t state.wnext = 0;\n\t state.whave = 0;\n\t\n\t ...
[ "0.6681966", "0.66441613", "0.66441613", "0.66441613", "0.66441613", "0.6637881", "0.6636711", "0.66295844", "0.66189325", "0.66103846", "0.66056824", "0.66056824", "0.6594528", "0.65899986", "0.6587221", "0.6587221", "0.6587221", "0.6587221", "0.6587221", "0.6587221", "0.658...
0.0
-1
=========================================================================== Output a short LSB first on the stream. IN assertion: there is enough room in pendingBuf.
function put_short (s, w) { // put_byte(s, (uch)((w) & 0xff)); // put_byte(s, (uch)((ush)(w) >> 8)); s.pending_buf[s.pending++] = (w) & 0xff; s.pending_buf[s.pending++] = (w >>> 8) & 0xff; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function putShortMSB(s,b){// put_byte(s, (Byte)(b >> 8));\n // put_byte(s, (Byte)(b & 0xff));\n s.pending_buf[s.pending++]=b>>>8&0xff;s.pending_buf[s.pending++]=b&0xff;}", "function putShortMSB(s, b) {\n// put_byte(s, (Byte)(b >> 8));\n// put_byte(s, (Byte)(b & 0xff));\n s.pending_buf[s.pending+...
[ "0.7274559", "0.7092112", "0.7075015", "0.7075015", "0.7075015", "0.7075015", "0.7075015", "0.7075015", "0.7075015", "0.7075015", "0.7075015", "0.7075015", "0.7075015", "0.7075015", "0.7075015", "0.7075015", "0.7075015", "0.7075015", "0.7075015", "0.7075015", "0.7075015", "...
0.0
-1
=========================================================================== Send a value on a given number of bits. IN assertion: length <= 16 and value fits in length bits.
function send_bits(s, value, length) { if (s.bi_valid > (Buf_size - length)) { s.bi_buf |= (value << s.bi_valid) & 0xffff; put_short(s, s.bi_buf); s.bi_buf = value >> (Buf_size - s.bi_valid); s.bi_valid += length - Buf_size; } else { s.bi_buf |= (value << s.bi_valid) & 0xffff; s.bi_valid += length; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function send_bits(s, value, length) {\n\t if (s.bi_valid > (Buf_size - length)) {\n\t s.bi_buf |= (value << s.bi_valid) & 0xffff;\n\t put_short(s, s.bi_buf);\n\t s.bi_buf = value >> (Buf_size - s.bi_valid);\n\t s.bi_valid += length - Buf_size;\n\t } else {\n\t s.bi_buf |= (value << ...
[ "0.84644645", "0.8458237", "0.8422658", "0.84223914", "0.8398401", "0.8398401", "0.8398401", "0.8398401", "0.8398401", "0.8398401", "0.8398401", "0.8398401", "0.8398401", "0.83725744", "0.8353432", "0.83477384" ]
0.0
-1
=========================================================================== Reverse the first len bits of a code, using straightforward code (a faster method would use a table) IN assertion: 1 <= len <= 15
function bi_reverse(code, len) { var res = 0; do { res |= code & 1; code >>>= 1; res <<= 1; } while (--len > 0); return res >>> 1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bi_reverse(code, len) {\n\t\tvar res = 0;\n\t\tdo {\n\t\t\tres |= code & 1;\n\t\t\tcode >>= 1;\n\t\t\tres <<= 1;\n\t\t} while (--len > 0);\n\t\treturn res >> 1;\n\t}", "function bi_reverse(code, len) {\n var res = 0;\n\n do {\n res |= code & 1;\n code >>>= 1;\n r...
[ "0.7971538", "0.79377985", "0.7926397", "0.79039055", "0.79021436", "0.78989965", "0.7893038", "0.7874789", "0.7856889", "0.78369194", "0.78369194", "0.78369194", "0.78369194", "0.78369194", "0.78369194", "0.78369194", "0.78369194", "0.78369194" ]
0.0
-1
=========================================================================== Flush the bit buffer, keeping at most 7 bits in it.
function bi_flush(s) { if (s.bi_valid === 16) { put_short(s, s.bi_buf); s.bi_buf = 0; s.bi_valid = 0; } else if (s.bi_valid >= 8) { s.pending_buf[s.pending++] = s.bi_buf & 0xff; s.bi_buf >>= 8; s.bi_valid -= 8; } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bi_flush(s) {\n\t if (s.bi_valid === 16) {\n\t put_short(s, s.bi_buf);\n\t s.bi_buf = 0;\n\t s.bi_valid = 0;\n\t\n\t } else if (s.bi_valid >= 8) {\n\t s.pending_buf[s.pending++] = s.bi_buf & 0xff;\n\t s.bi_buf >>= 8;\n\t s.bi_valid -= 8;\n\t }\n\t }", "function bi...
[ "0.61976147", "0.6166657", "0.6141256", "0.6115985", "0.61072356", "0.6072232", "0.6072232", "0.6072232", "0.6072232", "0.6072232", "0.6072232", "0.6072232", "0.6072232", "0.6072232", "0.60623586", "0.60252243", "0.58954155" ]
0.0
-1
=========================================================================== Compute the optimal bit lengths for a tree and update the total bit length for the current block. IN assertion: the fields freq and dad are set, heap[heap_max] and above are the tree nodes sorted by increasing frequency. OUT assertions: the field len is set to the optimal bit length, the array bl_count contains the frequencies for each bit length. The length opt_len is updated; static_len is also updated if stree is not null.
function gen_bitlen(s, desc) // deflate_state *s; // tree_desc *desc; /* the tree descriptor */ { var tree = desc.dyn_tree; var max_code = desc.max_code; var stree = desc.stat_desc.static_tree; var has_stree = desc.stat_desc.has_stree; var extra = desc.stat_desc.extra_bits; var base = desc.stat_desc.extra_base; var max_length = desc.stat_desc.max_length; var h; /* heap index */ var n, m; /* iterate over the tree elements */ var bits; /* bit length */ var xbits; /* extra bits */ var f; /* frequency */ var overflow = 0; /* number of elements with bit length too large */ for (bits = 0; bits <= MAX_BITS; bits++) { s.bl_count[bits] = 0; } /* In a first pass, compute the optimal bit lengths (which may * overflow in the case of the bit length tree). */ tree[s.heap[s.heap_max]*2 + 1]/*.Len*/ = 0; /* root of the heap */ for (h = s.heap_max+1; h < HEAP_SIZE; h++) { n = s.heap[h]; bits = tree[tree[n*2 +1]/*.Dad*/ * 2 + 1]/*.Len*/ + 1; if (bits > max_length) { bits = max_length; overflow++; } tree[n*2 + 1]/*.Len*/ = bits; /* We overwrite tree[n].Dad which is no longer needed */ if (n > max_code) { continue; } /* not a leaf node */ s.bl_count[bits]++; xbits = 0; if (n >= base) { xbits = extra[n-base]; } f = tree[n * 2]/*.Freq*/; s.opt_len += f * (bits + xbits); if (has_stree) { s.static_len += f * (stree[n*2 + 1]/*.Len*/ + xbits); } } if (overflow === 0) { return; } // Trace((stderr,"\nbit length overflow\n")); /* This happens for example on obj2 and pic of the Calgary corpus */ /* Find the first bit length which could increase: */ do { bits = max_length-1; while (s.bl_count[bits] === 0) { bits--; } s.bl_count[bits]--; /* move one leaf down the tree */ s.bl_count[bits+1] += 2; /* move one overflow item as its brother */ s.bl_count[max_length]--; /* The brother of the overflow item also moves one step up, * but this does not affect bl_count[max_length] */ overflow -= 2; } while (overflow > 0); /* Now recompute all bit lengths, scanning in increasing frequency. * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all * lengths instead of fixing only the wrong ones. This idea is taken * from 'ar' written by Haruhiko Okumura.) */ for (bits = max_length; bits !== 0; bits--) { n = s.bl_count[bits]; while (n !== 0) { m = s.heap[--h]; if (m > max_code) { continue; } if (tree[m*2 + 1]/*.Len*/ !== bits) { // Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); s.opt_len += (bits - tree[m*2 + 1]/*.Len*/)*tree[m*2]/*.Freq*/; tree[m*2 + 1]/*.Len*/ = bits; } n--; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function gen_bitlen(s, desc) // deflate_state *s;\n // tree_desc *desc; /* the tree descriptor */\n {\n var tree = desc.dyn_tree;\n var max_code = desc.max_code;\n var stree = desc.stat_desc.static_tree;\n var has_stree = desc.stat_desc.has_stree;\n var extra =...
[ "0.7310192", "0.72961044", "0.7278004", "0.7245382", "0.7242131", "0.7229786", "0.72161794", "0.72161794", "0.72161794", "0.72161794", "0.72161794", "0.72161794", "0.72161794", "0.72161794", "0.72161794", "0.72161794", "0.72161794", "0.72161794", "0.72161794", "0.72161794", "...
0.0
-1
=========================================================================== Generate the codes for a given tree and bit counts (which need not be optimal). IN assertion: the array bl_count contains the bit length statistics for the given tree and the field len is set for all tree elements. OUT assertion: the field code is set for all tree elements of non zero code length.
function gen_codes(tree, max_code, bl_count) // ct_data *tree; /* the tree to decorate */ // int max_code; /* largest code with non zero frequency */ // ushf *bl_count; /* number of codes at each bit length */ { var next_code = new Array(MAX_BITS+1); /* next code value for each bit length */ var code = 0; /* running code value */ var bits; /* bit index */ var n; /* code index */ /* The distribution counts are first used to generate the code values * without bit reversal. */ for (bits = 1; bits <= MAX_BITS; bits++) { next_code[bits] = code = (code + bl_count[bits-1]) << 1; } /* Check that the bit counts in bl_count are consistent. The last code * must be all ones. */ //Assert (code + bl_count[MAX_BITS]-1 == (1<<MAX_BITS)-1, // "inconsistent bit counts"); //Tracev((stderr,"\ngen_codes: max_code %d ", max_code)); for (n = 0; n <= max_code; n++) { var len = tree[n*2 + 1]/*.Len*/; if (len === 0) { continue; } /* Now reverse the bits */ tree[n*2]/*.Code*/ = bi_reverse(next_code[len]++, len); //Tracecv(tree != static_ltree, (stderr,"\nn %3d %c l %2d c %4x (%x) ", // n, (isgraph(n) ? n : ' '), len, tree[n].Code, next_code[len]-1)); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function gen_codes(tree, max_code, bl_count) // ct_data *tree; /* the tree to decorate */\n// int max_code; /* largest code with non zero frequency */\n// ushf *bl_count; /* number of codes at each bit length */\n{\n var next_code = new Array(MAX_BITS + 1);\n /* next ...
[ "0.82030475", "0.817848", "0.81344014", "0.8130681", "0.8130681", "0.8130681", "0.8130681", "0.8130681", "0.8130681", "0.8130681", "0.8130681", "0.8130681", "0.8130681", "0.8130681", "0.8130681", "0.8130681", "0.8130681", "0.8130681", "0.8130681", "0.8130681", "0.8130681", ...
0.8137075
24
=========================================================================== Initialize the various 'constant' tables.
function tr_static_init() { var n; /* iterates over tree elements */ var bits; /* bit counter */ var length; /* length value */ var code; /* code value */ var dist; /* distance index */ var bl_count = new Array(MAX_BITS+1); /* number of codes at each bit length for an optimal tree */ // do check in _tr_init() //if (static_init_done) return; /* For some embedded targets, global variables are not initialized: */ /*#ifdef NO_INIT_GLOBAL_POINTERS static_l_desc.static_tree = static_ltree; static_l_desc.extra_bits = extra_lbits; static_d_desc.static_tree = static_dtree; static_d_desc.extra_bits = extra_dbits; static_bl_desc.extra_bits = extra_blbits; #endif*/ /* Initialize the mapping length (0..255) -> length code (0..28) */ length = 0; for (code = 0; code < LENGTH_CODES-1; code++) { base_length[code] = length; for (n = 0; n < (1<<extra_lbits[code]); n++) { _length_code[length++] = code; } } //Assert (length == 256, "tr_static_init: length != 256"); /* Note that the length 255 (match length 258) can be represented * in two different ways: code 284 + 5 bits or code 285, so we * overwrite length_code[255] to use the best encoding: */ _length_code[length-1] = code; /* Initialize the mapping dist (0..32K) -> dist code (0..29) */ dist = 0; for (code = 0 ; code < 16; code++) { base_dist[code] = dist; for (n = 0; n < (1<<extra_dbits[code]); n++) { _dist_code[dist++] = code; } } //Assert (dist == 256, "tr_static_init: dist != 256"); dist >>= 7; /* from now on, all distances are divided by 128 */ for ( ; code < D_CODES; code++) { base_dist[code] = dist << 7; for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) { _dist_code[256 + dist++] = code; } } //Assert (dist == 256, "tr_static_init: 256+dist != 512"); /* Construct the codes of the static literal tree */ for (bits = 0; bits <= MAX_BITS; bits++) { bl_count[bits] = 0; } n = 0; while (n <= 143) { static_ltree[n*2 + 1]/*.Len*/ = 8; n++; bl_count[8]++; } while (n <= 255) { static_ltree[n*2 + 1]/*.Len*/ = 9; n++; bl_count[9]++; } while (n <= 279) { static_ltree[n*2 + 1]/*.Len*/ = 7; n++; bl_count[7]++; } while (n <= 287) { static_ltree[n*2 + 1]/*.Len*/ = 8; n++; bl_count[8]++; } /* Codes 286 and 287 do not exist, but we must include them in the * tree construction to get a canonical Huffman tree (longest code * all ones) */ gen_codes(static_ltree, L_CODES+1, bl_count); /* The static distance tree is trivial: */ for (n = 0; n < D_CODES; n++) { static_dtree[n*2 + 1]/*.Len*/ = 5; static_dtree[n*2]/*.Code*/ = bi_reverse(n, 5); } // Now data ready and we can init static trees static_l_desc = new StaticTreeDesc(static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS); static_d_desc = new StaticTreeDesc(static_dtree, extra_dbits, 0, D_CODES, MAX_BITS); static_bl_desc =new StaticTreeDesc(new Array(0), extra_blbits, 0, BL_CODES, MAX_BL_BITS); //static_init_done = true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Constants() {}", "function Constants() {}", "function setConstants() {\n squareConfigs.constantValues = {\n x: squareConfigs.dimensions.x,\n y: squareConfigs.dimensions.y,\n w: squareConfigs.dimensions.w,\n h: squareConfigs.dimensions.h,\n\n actuallyConstantX: squ...
[ "0.6477462", "0.6477462", "0.6084643", "0.5989747", "0.59109056", "0.579599", "0.5717196", "0.5694086", "0.5694086", "0.5694086", "0.5659585", "0.55818164", "0.558161", "0.5556769", "0.5543848", "0.5535738", "0.5528524", "0.5462032", "0.5461605", "0.54583144", "0.5440198", ...
0.0
-1
=========================================================================== Initialize a new block.
function init_block(s) { var n; /* iterates over tree elements */ /* Initialize the trees. */ for (n = 0; n < L_CODES; n++) { s.dyn_ltree[n*2]/*.Freq*/ = 0; } for (n = 0; n < D_CODES; n++) { s.dyn_dtree[n*2]/*.Freq*/ = 0; } for (n = 0; n < BL_CODES; n++) { s.bl_tree[n*2]/*.Freq*/ = 0; } s.dyn_ltree[END_BLOCK*2]/*.Freq*/ = 1; s.opt_len = s.static_len = 0; s.last_lit = s.matches = 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "constructor() { \n \n Block.initialize(this);\n }", "constructor(genesisBlock) {\n\n this.blocks = [];\n\n //2 [0, 2]\n this.addBlock(genesisBlock);\n }", "function init_block() {\n\t\tvar n; // iterates over tree elements\n\n\t\t// Initialize the trees.\n\t\tfor (n = 0...
[ "0.8056365", "0.7342965", "0.7319945", "0.7095824", "0.70780075", "0.7075087", "0.7068257", "0.70115083", "0.6973862", "0.6937791", "0.6902216", "0.6891296", "0.68896234", "0.6884551", "0.68490547", "0.6840111", "0.6802844", "0.68015593", "0.6768908", "0.6744197", "0.6713622"...
0.66690433
46
=========================================================================== Flush the bit buffer and align the output on a byte boundary
function bi_windup(s) { if (s.bi_valid > 8) { put_short(s, s.bi_buf); } else if (s.bi_valid > 0) { //put_byte(s, (Byte)s->bi_buf); s.pending_buf[s.pending++] = s.bi_buf; } s.bi_buf = 0; s.bi_valid = 0; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function bi_flush(s){if(s.bi_valid===16){put_short(s,s.bi_buf);s.bi_buf=0;s.bi_valid=0;}else if(s.bi_valid>=8){s.pending_buf[s.pending++]=s.bi_buf&0xff;s.bi_buf>>=8;s.bi_valid-=8;}}", "function bi_flush(s) {\n if (s.bi_valid === 16) {\n put_short(s, s.bi_buf);\n s.bi_buf = 0;\n ...
[ "0.6588064", "0.6497159", "0.6488631", "0.6452589", "0.6426544", "0.63282317", "0.63277125", "0.6314214", "0.6314214", "0.6314214", "0.6314214", "0.6314214", "0.6314214", "0.6314214", "0.6314214", "0.6314214", "0.6227526", "0.6213828", "0.6213828", "0.6213828", "0.6213828", ...
0.0
-1
=========================================================================== Copy a stored block, storing first the length and its one's complement if requested.
function copy_block(s, buf, len, header) //DeflateState *s; //charf *buf; /* the input data */ //unsigned len; /* its length */ //int header; /* true if block header must be written */ { bi_windup(s); /* align on byte boundary */ if (header) { put_short(s, len); put_short(s, ~len); } // while (len--) { // put_byte(s, *buf++); // } utils.arraySet(s.pending_buf, s.window, buf, len, s.pending); s.pending += len; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function copy_block(s,buf,len,header)//DeflateState *s;\n //charf *buf; /* the input data */\n //unsigned len; /* its length */\n //int header; /* true if block header must be written */\n {bi_windup(s);/* align on byte boundary */if(header){put_short(s,len);put_short(s,~len);}// while (len--)...
[ "0.678666", "0.6686689", "0.6685482", "0.6682091", "0.66631144", "0.66631144", "0.6659264", "0.66396034", "0.66011596", "0.6587834", "0.6572326", "0.65491056", "0.653225", "0.6522475", "0.6462461" ]
0.66295946
85
=========================================================================== Compares to subtrees, using the tree depth as tie breaker when the subtrees have equal frequency. This minimizes the worst case length.
function smaller(tree, n, m, depth) { var _n2 = n*2; var _m2 = m*2; return (tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ || (tree[_n2]/*.Freq*/ === tree[_m2]/*.Freq*/ && depth[n] <= depth[m])); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function smaller(tree,n,m,depth){var _n2=n*2;var _m2=m*2;return tree[_n2]/*.Freq*/<tree[_m2]/*.Freq*/||tree[_n2]/*.Freq*/===tree[_m2]/*.Freq*/&&depth[n]<=depth[m];}", "function smaller(tree, n, m, depth) {\n const _n2 = n * 2;\n const _m2 = m * 2;\n return tree[_n2]/*.Freq*/ < tree[_m2]/*.Freq*/ ||\n ...
[ "0.64469874", "0.60803324", "0.5934289", "0.589644", "0.58895206", "0.58659226", "0.5861905", "0.5861905", "0.5861905", "0.5861905", "0.5861905", "0.5861905", "0.5861905", "0.5861905", "0.5861905", "0.5861905", "0.5861905", "0.5861905", "0.5861905", "0.5861905", "0.5861905", ...
0.58711904
25
=========================================================================== Restore the heap property by moving down the tree starting at node k, exchanging a node with the smallest of its two sons if necessary, stopping when the heap property is reestablished (each father smaller than its two sons).
function pqdownheap(s, tree, k) // deflate_state *s; // ct_data *tree; /* the tree to restore */ // int k; /* node to move down */ { var v = s.heap[k]; var j = k << 1; /* left son of k */ while (j <= s.heap_len) { /* Set j to the smallest of the two sons: */ if (j < s.heap_len && smaller(tree, s.heap[j+1], s.heap[j], s.depth)) { j++; } /* Exit if v is smaller than both sons */ if (smaller(tree, v, s.heap[j], s.depth)) { break; } /* Exchange v with the smallest son */ s.heap[k] = s.heap[j]; k = j; /* And continue down the tree, setting j to the left son of k */ j <<= 1; } s.heap[k] = v; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "swim(k) {\n while (k > 1 && this.heap[Math.floor(k/2)].priority > this.heap[k].priority) {\n /*\n * While not at root node, swap k (parent) with k/2 (child) if\n * parent > child. Continue swimming upwards until the invariant holds.\n */\n [this.heap[k], this.heap[Math.floor(k/2)]]\n...
[ "0.8100696", "0.7786214", "0.7684644", "0.7658836", "0.7649785", "0.7647308", "0.7631074", "0.7631074", "0.7631074", "0.7631074", "0.7631074", "0.7631074", "0.76270545", "0.76270545", "0.7623064", "0.76088023", "0.7603816", "0.75517195", "0.75347507", "0.75347507", "0.7534750...
0.0
-1
inlined manually var SMALLEST = 1; / =========================================================================== Send the block data compressed using the given Huffman trees
function compress_block(s, ltree, dtree) // deflate_state *s; // const ct_data *ltree; /* literal tree */ // const ct_data *dtree; /* distance tree */ { var dist; /* distance of matched string */ var lc; /* match length or unmatched char (if dist == 0) */ var lx = 0; /* running index in l_buf */ var code; /* the code to send */ var extra; /* number of extra bits to send */ if (s.last_lit !== 0) { do { dist = (s.pending_buf[s.d_buf + lx*2] << 8) | (s.pending_buf[s.d_buf + lx*2 + 1]); lc = s.pending_buf[s.l_buf + lx]; lx++; if (dist === 0) { send_code(s, lc, ltree); /* send a literal byte */ //Tracecv(isgraph(lc), (stderr," '%c' ", lc)); } else { /* Here, lc is the match length - MIN_MATCH */ code = _length_code[lc]; send_code(s, code+LITERALS+1, ltree); /* send the length code */ extra = extra_lbits[code]; if (extra !== 0) { lc -= base_length[code]; send_bits(s, lc, extra); /* send the extra length bits */ } dist--; /* dist is now the match distance - 1 */ code = d_code(dist); //Assert (code < D_CODES, "bad d_code"); send_code(s, code, dtree); /* send the distance code */ extra = extra_dbits[code]; if (extra !== 0) { dist -= base_dist[code]; send_bits(s, dist, extra); /* send the extra distance bits */ } } /* literal or match pair ? */ /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ //Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, // "pendingBuf overflow"); } while (lx < s.last_lit); } send_code(s, END_BLOCK, ltree); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function send_tree(s,tree,max_code)// deflate_state *s;\n // ct_data *tree; /* the tree to be scanned */\n // int max_code; /* and its largest code of non zero frequency */\n {var n;/* iterates over all tree elements */var prevlen=-1;/* last emitted length */var curlen;/* length of current code *...
[ "0.70694613", "0.6978705", "0.6972461", "0.6965995", "0.6906903", "0.6906186", "0.6906186", "0.6906186", "0.6906186", "0.6906186", "0.6906186", "0.6906186", "0.6906186", "0.6906186", "0.6906186", "0.6906186", "0.6906186", "0.6906186", "0.6906186", "0.6906186", "0.6906186", ...
0.0
-1
=========================================================================== Construct one Huffman tree and assigns the code bit strings and lengths. Update the total bit length for the current block. IN assertion: the field freq is set for all tree elements. OUT assertions: the fields len and code are set to the optimal bit length and corresponding code. The length opt_len is updated; static_len is also updated if stree is not null. The field max_code is set.
function build_tree(s, desc) // deflate_state *s; // tree_desc *desc; /* the tree descriptor */ { var tree = desc.dyn_tree; var stree = desc.stat_desc.static_tree; var has_stree = desc.stat_desc.has_stree; var elems = desc.stat_desc.elems; var n, m; /* iterate over heap elements */ var max_code = -1; /* largest code with non zero frequency */ var node; /* new node being created */ /* Construct the initial heap, with least frequent element in * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. * heap[0] is not used. */ s.heap_len = 0; s.heap_max = HEAP_SIZE; for (n = 0; n < elems; n++) { if (tree[n * 2]/*.Freq*/ !== 0) { s.heap[++s.heap_len] = max_code = n; s.depth[n] = 0; } else { tree[n*2 + 1]/*.Len*/ = 0; } } /* The pkzip format requires that at least one distance code exists, * and that at least one bit should be sent even if there is only one * possible code. So to avoid special checks later on we force at least * two codes of non zero frequency. */ while (s.heap_len < 2) { node = s.heap[++s.heap_len] = (max_code < 2 ? ++max_code : 0); tree[node * 2]/*.Freq*/ = 1; s.depth[node] = 0; s.opt_len--; if (has_stree) { s.static_len -= stree[node*2 + 1]/*.Len*/; } /* node is 0 or 1 so it does not have extra bits */ } desc.max_code = max_code; /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, * establish sub-heaps of increasing lengths: */ for (n = (s.heap_len >> 1/*int /2*/); n >= 1; n--) { pqdownheap(s, tree, n); } /* Construct the Huffman tree by repeatedly combining the least two * frequent nodes. */ node = elems; /* next internal node of the tree */ do { //pqremove(s, tree, n); /* n = node of least frequency */ /*** pqremove ***/ n = s.heap[1/*SMALLEST*/]; s.heap[1/*SMALLEST*/] = s.heap[s.heap_len--]; pqdownheap(s, tree, 1/*SMALLEST*/); /***/ m = s.heap[1/*SMALLEST*/]; /* m = node of next least frequency */ s.heap[--s.heap_max] = n; /* keep the nodes sorted by frequency */ s.heap[--s.heap_max] = m; /* Create a new node father of n and m */ tree[node * 2]/*.Freq*/ = tree[n * 2]/*.Freq*/ + tree[m * 2]/*.Freq*/; s.depth[node] = (s.depth[n] >= s.depth[m] ? s.depth[n] : s.depth[m]) + 1; tree[n*2 + 1]/*.Dad*/ = tree[m*2 + 1]/*.Dad*/ = node; /* and insert the new node in the heap */ s.heap[1/*SMALLEST*/] = node++; pqdownheap(s, tree, 1/*SMALLEST*/); } while (s.heap_len >= 2); s.heap[--s.heap_max] = s.heap[1/*SMALLEST*/]; /* At this point, the fields freq and dad are set. We can now * generate the bit lengths. */ gen_bitlen(s, desc); /* The field len is now set, we can generate the bit codes */ gen_codes(tree, max_code, s.bl_count); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function build_bl_tree() {\n\t\tvar max_blindex; // index of last bit length code of non zero freq\n\n\t\t// Determine the bit length frequencies for literal and distance trees\n\t\tscan_tree(dyn_ltree, l_desc.max_code);\n\t\tscan_tree(dyn_dtree, d_desc.max_code);\n\n\t\t// Build the bit length tree:\n\t\tbuild_tr...
[ "0.6371719", "0.63665086", "0.6333171", "0.6235446", "0.62348443", "0.6192163", "0.6171294", "0.61624026", "0.61611164", "0.6161077", "0.6161077", "0.6161077", "0.6161077", "0.6161077", "0.6161077", "0.6161077", "0.6161077", "0.6161077", "0.6161077", "0.6161077", "0.6161077",...
0.0
-1
=========================================================================== Scan a literal or distance tree to determine the frequencies of the codes in the bit length tree.
function scan_tree(s, tree, max_code) // deflate_state *s; // ct_data *tree; /* the tree to be scanned */ // int max_code; /* and its largest code of non zero frequency */ { var n; /* iterates over all tree elements */ var prevlen = -1; /* last emitted length */ var curlen; /* length of current code */ var nextlen = tree[0*2 + 1]/*.Len*/; /* length of next code */ var count = 0; /* repeat count of the current code */ var max_count = 7; /* max repeat count */ var min_count = 4; /* min repeat count */ if (nextlen === 0) { max_count = 138; min_count = 3; } tree[(max_code+1)*2 + 1]/*.Len*/ = 0xffff; /* guard */ for (n = 0; n <= max_code; n++) { curlen = nextlen; nextlen = tree[(n+1)*2 + 1]/*.Len*/; if (++count < max_count && curlen === nextlen) { continue; } else if (count < min_count) { s.bl_tree[curlen * 2]/*.Freq*/ += count; } else if (curlen !== 0) { if (curlen !== prevlen) { s.bl_tree[curlen * 2]/*.Freq*/++; } s.bl_tree[REP_3_6*2]/*.Freq*/++; } else if (count <= 10) { s.bl_tree[REPZ_3_10*2]/*.Freq*/++; } else { s.bl_tree[REPZ_11_138*2]/*.Freq*/++; } count = 0; prevlen = curlen; if (nextlen === 0) { max_count = 138; min_count = 3; } else if (curlen === nextlen) { max_count = 6; min_count = 3; } else { max_count = 7; min_count = 4; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function scan_tree(tree, // the tree to be scanned\n\t\tmax_code // and its largest code of non zero frequency\n\t\t) {\n\t\t var n; // iterates over all tree elements\n \n\t\t var prevlen = -1; // last emitted length\n \n\t\t var curlen; // length of current code\n \n\t\t var nextlen = tree[0 * 2 + 1]; // ...
[ "0.7196888", "0.7099034", "0.7092436", "0.70759386", "0.706675", "0.7054964", "0.7054964", "0.7054964", "0.7054964", "0.7054964", "0.7054964", "0.7054964", "0.7054964", "0.7054964", "0.7054964", "0.7054964", "0.7054964", "0.7054964", "0.7054964", "0.7054964", "0.7054964", "...
0.70580226
27
=========================================================================== Send a literal or distance tree in compressed form, using the codes in bl_tree.
function send_tree(s, tree, max_code) // deflate_state *s; // ct_data *tree; /* the tree to be scanned */ // int max_code; /* and its largest code of non zero frequency */ { var n; /* iterates over all tree elements */ var prevlen = -1; /* last emitted length */ var curlen; /* length of current code */ var nextlen = tree[0*2 + 1]/*.Len*/; /* length of next code */ var count = 0; /* repeat count of the current code */ var max_count = 7; /* max repeat count */ var min_count = 4; /* min repeat count */ /* tree[max_code+1].Len = -1; */ /* guard already set */ if (nextlen === 0) { max_count = 138; min_count = 3; } for (n = 0; n <= max_code; n++) { curlen = nextlen; nextlen = tree[(n+1)*2 + 1]/*.Len*/; if (++count < max_count && curlen === nextlen) { continue; } else if (count < min_count) { do { send_code(s, curlen, s.bl_tree); } while (--count !== 0); } else if (curlen !== 0) { if (curlen !== prevlen) { send_code(s, curlen, s.bl_tree); count--; } //Assert(count >= 3 && count <= 6, " 3_6?"); send_code(s, REP_3_6, s.bl_tree); send_bits(s, count-3, 2); } else if (count <= 10) { send_code(s, REPZ_3_10, s.bl_tree); send_bits(s, count-3, 3); } else { send_code(s, REPZ_11_138, s.bl_tree); send_bits(s, count-11, 7); } count = 0; prevlen = curlen; if (nextlen === 0) { max_count = 138; min_count = 3; } else if (curlen === nextlen) { max_count = 6; min_count = 3; } else { max_count = 7; min_count = 4; } } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function send_all_trees(lcodes, dcodes, blcodes) {\n\t\t var rank; // index in bl_order\n \n\t\t send_bits(lcodes - 257, 5); // not +255 as stated in appnote.txt\n \n\t\t send_bits(dcodes - 1, 5);\n\t\t send_bits(blcodes - 4, 4); // not -3 as stated in appnote.txt\n \n\t\t for (rank = 0; rank < blcodes; ra...
[ "0.721052", "0.6960736", "0.6942097", "0.6926114", "0.6910601", "0.6898549", "0.6897821", "0.6881878", "0.68465155", "0.6825804", "0.68159336", "0.6795697", "0.6787552", "0.6787552", "0.6787552", "0.6787552", "0.6787552", "0.6787552", "0.6787552", "0.6787552", "0.6787552", ...
0.0
-1
=========================================================================== Construct the Huffman tree for the bit lengths and return the index in bl_order of the last bit length code to send.
function build_bl_tree(s) { var max_blindex; /* index of last bit length code of non zero freq */ /* Determine the bit length frequencies for literal and distance trees */ scan_tree(s, s.dyn_ltree, s.l_desc.max_code); scan_tree(s, s.dyn_dtree, s.d_desc.max_code); /* Build the bit length tree: */ build_tree(s, s.bl_desc); /* opt_len now includes the length of the tree representations, except * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. */ /* Determine the number of bit length codes to send. The pkzip format * requires that at least 4 bit length codes be sent. (appnote.txt says * 3 but the actual value used is 4.) */ for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) { if (s.bl_tree[bl_order[max_blindex]*2 + 1]/*.Len*/ !== 0) { break; } } /* Update opt_len to include the bit length tree and counts */ s.opt_len += 3*(max_blindex+1) + 5+5+4; //Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", // s->opt_len, s->static_len)); return max_blindex; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function build_bl_tree() {\n\t\tvar max_blindex; // index of last bit length code of non zero freq\n\n\t\t// Determine the bit length frequencies for literal and distance trees\n\t\tscan_tree(dyn_ltree, l_desc.max_code);\n\t\tscan_tree(dyn_dtree, d_desc.max_code);\n\n\t\t// Build the bit length tree:\n\t\tbuild_tr...
[ "0.7984391", "0.79464096", "0.73637545", "0.7298226", "0.7285736", "0.7285724", "0.724746", "0.7231646", "0.7228964", "0.7219668", "0.7219668", "0.7219668", "0.7219668", "0.7219668", "0.7218879", "0.7215603", "0.7215603", "0.7182199", "0.7176828", "0.7176828", "0.7176828", ...
0.0
-1
=========================================================================== Send the header for a block using dynamic Huffman trees: the counts, the lengths of the bit length codes, the literal tree and the distance tree. IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4.
function send_all_trees(s, lcodes, dcodes, blcodes) // deflate_state *s; // int lcodes, dcodes, blcodes; /* number of codes for each tree */ { var rank; /* index in bl_order */ //Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); //Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, // "too many codes"); //Tracev((stderr, "\nbl counts: ")); send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */ send_bits(s, dcodes-1, 5); send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */ for (rank = 0; rank < blcodes; rank++) { //Tracev((stderr, "\nbl code %2d ", bl_order[rank])); send_bits(s, s.bl_tree[bl_order[rank]*2 + 1]/*.Len*/, 3); } //Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); send_tree(s, s.dyn_ltree, lcodes-1); /* literal tree */ //Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); send_tree(s, s.dyn_dtree, dcodes-1); /* distance tree */ //Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function build_bl_tree() {\n\t\t var max_blindex; // index of last bit length code of non zero freq\n\t\t // Determine the bit length frequencies for literal and distance trees\n \n\t\t scan_tree(dyn_ltree, l_desc.max_code);\n\t\t scan_tree(dyn_dtree, d_desc.max_code); // Build the bit length tree:\n \n\t\t ...
[ "0.605133", "0.58291775", "0.5769802", "0.5747375", "0.56533957", "0.56533957", "0.56533957", "0.56533957", "0.5626713", "0.55912226", "0.55687624", "0.556751", "0.55406004", "0.55307066", "0.55298615", "0.55298615", "0.55298615", "0.55298615", "0.55298615", "0.55298615", "0....
0.0
-1
=========================================================================== Initialize the tree data structures for a new zlib stream.
function _tr_init(s) { if (!static_init_done) { tr_static_init(); static_init_done = true; } s.l_desc = new TreeDesc(s.dyn_ltree, static_l_desc); s.d_desc = new TreeDesc(s.dyn_dtree, static_d_desc); s.bl_desc = new TreeDesc(s.bl_tree, static_bl_desc); s.bi_buf = 0; s.bi_valid = 0; /* Initialize the first block of the first file: */ init_block(s); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_init() {\n this.__lookupTable = new qx.data.Array();\n this.__openNodes = [];\n this.__nestingLevel = [];\n this._initLayer();\n }", "function _tr_init(s){if(!static_init_done){tr_static_init();static_init_done=true;}s.l_desc=new TreeDesc(s.dyn_ltree,static_l_desc);s.d_desc=new TreeDesc(s...
[ "0.6510822", "0.6424953", "0.6375535", "0.63501585", "0.6259595", "0.6178484", "0.6144798", "0.61362624", "0.6128932", "0.60982025", "0.6096389", "0.60900533" ]
0.61420107
90
=========================================================================== Send a stored block
function _tr_stored_block(s, buf, stored_len, last) //DeflateState *s; //charf *buf; /* input block */ //ulg stored_len; /* length of input block */ //int last; /* one if this is the last block for a file */ { send_bits(s, (STORED_BLOCK<<1)+(last ? 1 : 0), 3); /* send block type */ copy_block(s, buf, stored_len, true); /* with header */ }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "messageSent (peerId, block) {\n const ledger = this._findOrCreate(peerId)\n ledger.sentBytes(block ? block.data.length : 0)\n if (block && block.cid) {\n ledger.wantlist.remove(block.cid)\n }\n }", "messageSent (peerId, block) {\n const ledger = this._findOrCreate(peerId)\n ledger.sentByt...
[ "0.6636688", "0.6636688", "0.6435359", "0.62935793", "0.60487586", "0.60476345", "0.60344964", "0.6023343", "0.59361583", "0.58950603", "0.58587354", "0.5830017", "0.582569", "0.5822428", "0.5819708", "0.5804283", "0.57723826", "0.57716817", "0.5749839", "0.5746885", "0.57465...
0.5756371
36
=========================================================================== Send one empty static block to give enough lookahead for inflate. This takes 10 bits, of which 7 may remain in the bit buffer.
function _tr_align(s) { send_bits(s, STATIC_TREES<<1, 3); send_code(s, END_BLOCK, static_ltree); bi_flush(s); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function inflate(data, usz) {\n /* shortcircuit for empty buffer [0x03, 0x00] */\n if (data[0] == 3 && !(data[1] & 0x3)) {\n return [new_raw_buf(usz), 2];\n }\n /* bit offset */\n\n\n var boff = 0;\n /* header includes final bit and type bits */\n\n ...
[ "0.528871", "0.52563787", "0.52494574", "0.52383506", "0.51888853", "0.51388097", "0.5121298", "0.51076716", "0.51043904", "0.51043904", "0.51043904", "0.51043904", "0.51019776", "0.50877845", "0.50877845", "0.50877845", "0.50877845", "0.50877845", "0.50877845", "0.50877845", ...
0.0
-1
=========================================================================== Determine the best encoding for the current block: dynamic trees, static trees or store, and output the encoded block to the zip file.
function _tr_flush_block(s, buf, stored_len, last) //DeflateState *s; //charf *buf; /* input block, or NULL if too old */ //ulg stored_len; /* length of input block */ //int last; /* one if this is the last block for a file */ { var opt_lenb, static_lenb; /* opt_len and static_len in bytes */ var max_blindex = 0; /* index of last bit length code of non zero freq */ /* Build the Huffman trees unless a stored block is forced */ if (s.level > 0) { /* Check if the file is binary or text */ if (s.strm.data_type === Z_UNKNOWN) { s.strm.data_type = detect_data_type(s); } /* Construct the literal and distance trees */ build_tree(s, s.l_desc); // Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, // s->static_len)); build_tree(s, s.d_desc); // Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, // s->static_len)); /* At this point, opt_len and static_len are the total bit lengths of * the compressed block data, excluding the tree representations. */ /* Build the bit length tree for the above two trees, and get the index * in bl_order of the last bit length code to send. */ max_blindex = build_bl_tree(s); /* Determine the best encoding. Compute the block lengths in bytes. */ opt_lenb = (s.opt_len+3+7) >>> 3; static_lenb = (s.static_len+3+7) >>> 3; // Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", // opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, // s->last_lit)); if (static_lenb <= opt_lenb) { opt_lenb = static_lenb; } } else { // Assert(buf != (char*)0, "lost buf"); opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ } if ((stored_len+4 <= opt_lenb) && (buf !== -1)) { /* 4: two words for the lengths */ /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. * Otherwise we can't have processed more than WSIZE input bytes since * the last block flush, because compression would have been * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to * transform a block into a stored block. */ _tr_stored_block(s, buf, stored_len, last); } else if (s.strategy === Z_FIXED || static_lenb === opt_lenb) { send_bits(s, (STATIC_TREES<<1) + (last ? 1 : 0), 3); compress_block(s, static_ltree, static_dtree); } else { send_bits(s, (DYN_TREES<<1) + (last ? 1 : 0), 3); send_all_trees(s, s.l_desc.max_code+1, s.d_desc.max_code+1, max_blindex+1); compress_block(s, s.dyn_ltree, s.dyn_dtree); } // Assert (s->compressed_len == s->bits_sent, "bad compressed size"); /* The above check is made mod 2^32, for files larger than 512 MB * and uLong implemented on 32 bits. */ init_block(s); if (last) { bi_windup(s); } // Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, // s->compressed_len-7*last)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function flush_block(eof) { // true if this is the last block for a file\n\t\tvar opt_lenb, static_lenb, // opt_len and static_len in bytes\n\t\t\tmax_blindex, // index of last bit length code of non zero freq\n\t\t\tstored_len, // length of input block\n\t\t\ti;\n\n\t\tstored_len = strstart - block_start;\n\t\tfl...
[ "0.60858995", "0.5848022", "0.5814596", "0.5814596", "0.5814596", "0.5814596", "0.5814596", "0.5814596", "0.5814596", "0.5814596", "0.5814596", "0.5814596", "0.5814596", "0.5814596", "0.5814596", "0.5814596", "0.5814596", "0.5814596", "0.5814596", "0.5814596", "0.5814596", ...
0.58105415
90
=========================================================================== Save the match info and tally the frequency counts. Return true if the current block must be flushed.
function _tr_tally(s, dist, lc) // deflate_state *s; // unsigned dist; /* distance of matched string */ // unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ { //var out_length, in_length, dcode; s.pending_buf[s.d_buf + s.last_lit * 2] = (dist >>> 8) & 0xff; s.pending_buf[s.d_buf + s.last_lit * 2 + 1] = dist & 0xff; s.pending_buf[s.l_buf + s.last_lit] = lc & 0xff; s.last_lit++; if (dist === 0) { /* lc is the unmatched char */ s.dyn_ltree[lc*2]/*.Freq*/++; } else { s.matches++; /* Here, lc is the match length - MIN_MATCH */ dist--; /* dist = match distance - 1 */ //Assert((ush)dist < (ush)MAX_DIST(s) && // (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && // (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); s.dyn_ltree[(_length_code[lc]+LITERALS+1) * 2]/*.Freq*/++; s.dyn_dtree[d_code(dist) * 2]/*.Freq*/++; } // (!) This block is disabled in zlib defailts, // don't enable it for binary compatibility //#ifdef TRUNCATE_BLOCK // /* Try to guess if it is profitable to stop the current block here */ // if ((s.last_lit & 0x1fff) === 0 && s.level > 2) { // /* Compute an upper bound for the compressed length */ // out_length = s.last_lit*8; // in_length = s.strstart - s.block_start; // // for (dcode = 0; dcode < D_CODES; dcode++) { // out_length += s.dyn_dtree[dcode*2]/*.Freq*/ * (5 + extra_dbits[dcode]); // } // out_length >>>= 3; // //Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", // // s->last_lit, in_length, out_length, // // 100L - out_length*100L/in_length)); // if (s.matches < (s.last_lit>>1)/*int /2*/ && out_length < (in_length>>1)/*int /2*/) { // return true; // } // } //#endif return (s.last_lit === s.lit_bufsize-1); /* We avoid equality with lit_bufsize because of wraparound at 64K * on 16 bit machines and because stored blocks are restricted to * 64K-1 bytes. */ }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function track(match) {\n return counters[match] = (counters[match] || 0) + 1;\n }", "function incrementMatchCount() {\n matchCount += 2;\n}", "function checkIfCompleted() {\n matchingCards++;\n\n if (matchingCards >= Math.floor(fieldSize / 2)) {\n gameCompleted = true;\n ...
[ "0.57499295", "0.5212014", "0.51859707", "0.5111995", "0.5039224", "0.50121415", "0.49712586", "0.49325344", "0.48576874", "0.4847375", "0.48212865", "0.48212302", "0.48096582", "0.4798437", "0.47001162", "0.46869558", "0.46755353", "0.46664038", "0.4647019", "0.46444625", "0...
0.0
-1
Copyright Joyent, Inc. and other Node contributors. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
function EventEmitter() { this._events = this._events || {}; this._maxListeners = this._maxListeners || undefined; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function me(e,t,a,s){var n,i=arguments.length,r=i<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,a):s;if(\"object\"==typeof Reflect&&\"function\"==typeof Reflect.decorate)r=Reflect.decorate(e,t,a,s);else for(var d=e.length-1;d>=0;d--)(n=e[d])&&(r=(i<3?n(r):i>3?n(t,a,r):n(t,a))||r);return i>3&&r&&Object.definePro...
[ "0.6149275", "0.54203457", "0.53920096", "0.53668714", "0.53668714", "0.53668714", "0.53408384", "0.5318133", "0.5318133", "0.5318133", "0.5308971", "0.52618045", "0.5255616", "0.52546173", "0.52546173", "0.52546173", "0.52546173", "0.52546173", "0.52546173", "0.52546173", "0...
0.0
-1
++++++++++++++++++++++++++++++++++++++++++++ DATA Constructor and Instances ++++++++++++++++++++++++++++++++++++++++++++
function CatalogItem (imageName, filePath) { this.imageName = imageName; this.filePath = filePath; this.tallyClicked = 0; this.tallyDisplayed = 0; //Push the object to imageArray catalogArray.push(this); imageNameArray.push(this.imageName); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Data() { }", "constructor() {\n super();\n this.data = new Data();\n }", "constructor(data) { }", "constructor(data) {\n \n }", "constructor() {\n this.data = this._loadData();\n }", "constructor(data) {\n this.data = data;\n }", "constructor(dataInput) {\n ...
[ "0.7691085", "0.753114", "0.7498393", "0.73728585", "0.7296609", "0.7263449", "0.7160494", "0.7158822", "0.71553206", "0.70138717", "0.7013545", "0.69452906", "0.69428927", "0.68995243", "0.688462", "0.6873593", "0.6873593", "0.68278205", "0.68025386", "0.6752245", "0.6751113...
0.0
-1
++++++++++++++++++++++++++++++++++++++++++++ FUNCTION DECLARATIONS ++++++++++++++++++++++++++++++++++++++++++++ Function to randomly generate randomIndex1, randomIndex2, and randomIndex3
function checkForData() { if (localStorage.userResults) { catalogArray = JSON.parse(localStorage.userResults); for (var i = 0; i < catalogArray.length; i++) { imageNameArray.push(catalogArray[i].imageName); } } else { catalogArray = []; createCatalogItems(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function createThreeRandomIndexes(){\n\n let randomIndexes = [];\n while (randomIndexes.length !== 3){\n let rand = generateRandomNumber();\n if(!randomIndexes.includes(rand)){\n randomIndexes.push(rand);\n\n }\n }\n return randomIndexes;\n}", "function randomIndex() {\n let n = floor(random(0...
[ "0.7604658", "0.7136812", "0.71226996", "0.6999024", "0.69741267", "0.69292235", "0.69046384", "0.6896481", "0.687405", "0.68581074", "0.68324506", "0.678987", "0.6762413", "0.6676587", "0.66665584", "0.6651931", "0.6639924", "0.66346294", "0.6617684", "0.65913737", "0.658985...
0.0
-1
Function to end survey at 25 clicks
function surveyEnd() { viewResultsButton.textContent = 'View Results'; picSection.appendChild(viewResultsButton); picSection.removeEventListener('click', handleUserClick); for (var i = 0; i < catalogArray.length; i++) { tallyClickFinal.push(catalogArray[i].tallyClicked); tallyViewFinal.push(catalogArray[i].tallyDisplayed); }; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function end_trial() {\n\n // kill any remaining setTimeout handlers\n jsPsych.pluginAPI.clearAllTimeouts();\n\n // gather the data to store for the trial\n var trial_data = {\n \"rt\": Math.round(performance.now() - trial_onset),\n \"digit_response\": digit_response,\n 'cl...
[ "0.64227456", "0.6413096", "0.6383165", "0.6315035", "0.61615896", "0.6158293", "0.6154531", "0.61421865", "0.61421865", "0.6108407", "0.60826856", "0.60767287", "0.6074042", "0.6061887", "0.60602075", "0.6058682", "0.60495466", "0.6020223", "0.6019584", "0.60044336", "0.5961...
0.66317606
0
Function to Load Images to Page
function loadImages() { if (surveyLength > 24) { surveyEnd(); } lastIndex = []; lastIndex.push(randomIndex1); lastIndex.push(randomIndex2); lastIndex.push(randomIndex3); //Re-assigning the variables for each picture randomIndexGenerator(); //While loop to prevent double choices AND no prior choice repeats while (randomIndex1 === lastIndex[0] || randomIndex1 === lastIndex[1] || randomIndex1 === lastIndex[2] || randomIndex2 === lastIndex[0] || randomIndex2 === lastIndex[1] || randomIndex2 === lastIndex[2] || randomIndex3 === lastIndex[0] || randomIndex3 === lastIndex[1] || randomIndex3 === lastIndex[2] || randomIndex1 === randomIndex2 || randomIndex1 === randomIndex3 || randomIndex2 === randomIndex3) { randomIndexGenerator(); } //Makes leftImg's src property equal to the fileName of the indexed item leftImg.src = catalogArray[randomIndex1].filePath; centerImg.src = catalogArray[randomIndex2].filePath; rightImg.src = catalogArray[randomIndex3].filePath; //Adds 1 to the display tally property of the indexed object catalogArray[randomIndex1].tallyDisplayed += 1; catalogArray[randomIndex2].tallyDisplayed += 1; catalogArray[randomIndex3].tallyDisplayed += 1; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function loadImages() {\n\t\t const button = document.querySelector('#loadImages');\n\t\t const container = document.querySelector('#image-container');\n\n\t\t button.addEventListener(\"click\", (event) => {\n\n\t\t const images = imageNames();\n\t\t images.forEach((image) => {\n\t\t ...
[ "0.7676688", "0.731364", "0.73070186", "0.71697855", "0.7169777", "0.7163216", "0.7148358", "0.7096101", "0.70113856", "0.6933231", "0.6932604", "0.6905027", "0.6893312", "0.6842709", "0.68203217", "0.6815961", "0.68065524", "0.6800416", "0.6784943", "0.6782312", "0.6781785",...
0.0
-1
Event Handler for click on picture
function handleUserClick(event) { event.preventDefault(); if (event.target.id === 'left') { catalogArray[randomIndex1].tallyClicked += 1; } else if (event.target.id === 'center') { catalogArray[randomIndex2].tallyClicked += 1; } else if (event.target.id === 'right') { catalogArray[randomIndex3].tallyClicked += 1; } else { alert('Pick a product!'); return; } console.log('I clicked' + event.target.id); surveyLength += 1; localStorage.setItem('userResults', JSON.stringify(catalogArray)); loadImages(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onImageClick() {\n console.log('Clicked Image')\n }", "function imgClick(event) {\n\n}", "imageClickHandler() {\n\t\tconst {data} = this.props,\n\t\t\tlistOfPhotos = document.querySelector('.gallery__photo-list');\n\n\t\tlistOfPhotos.addEventListener('click', e => {\n\t\t\tconst {target} = e,\n\t\t\t...
[ "0.793244", "0.7913272", "0.75001377", "0.72610736", "0.721918", "0.7161421", "0.71362853", "0.7103456", "0.7090242", "0.70852727", "0.70203173", "0.70005375", "0.6998707", "0.6914208", "0.69108677", "0.6900724", "0.6889584", "0.6857063", "0.68258864", "0.68070686", "0.680617...
0.0
-1
Function to Draw Chart
function drawChart() { var ctx = canvas.getContext('2d'); var myBarChart = new Chart(ctx, { type: 'bar', data: data, // options: { // responsive: false // } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "_drawChart()\n {\n\n }", "function drawChart() {\n stroke(0);\n yAxis();\n xAxis();\n}", "function drawChart(arr) {\n drawSleepChart(arr);\n drawStepsChart(arr);\n drawCalorieChart(arr);\n drawHeartRateChart(arr);\n}", "function drawChart() {\n\n // Create the data table.\n var data = ...
[ "0.7766029", "0.74025255", "0.7394388", "0.7315559", "0.7298981", "0.7275957", "0.72704506", "0.7261915", "0.7242139", "0.7208406", "0.7186227", "0.7163451", "0.7124008", "0.7106811", "0.7092066", "0.7067875", "0.7059014", "0.703996", "0.7032495", "0.7031648", "0.7017393", ...
0.0
-1
setup pagination if amount of merchants is greater than per page value
setupPaginator(newProps) { if (this.state.filteredRows.length) { return this.state.filteredRows.length > this.state.perPage; } return newProps.merchants ? newProps.merchants.length > this.state.perPage : null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "handlePageClick(data) {\n const selected = data.selected;\n const offset = Math.ceil(selected * this.state.perPage);\n\n this.setState({\n offset,\n currentPage: selected + 1,\n merchants: this.state.totalRows.slice(offset, offset + this.state.perPage),\n filteredRowsPaged: this.state....
[ "0.6467618", "0.633153", "0.6129411", "0.6013692", "0.5927074", "0.585987", "0.5831542", "0.58012784", "0.57862914", "0.5755217", "0.57505757", "0.57426834", "0.5725534", "0.5725534", "0.56920147", "0.5682638", "0.5668438", "0.5666397", "0.56599253", "0.5656082", "0.56547046"...
0.7424281
0
Handle pagination for complex merchant table
handlePageClick(data) { const selected = data.selected; const offset = Math.ceil(selected * this.state.perPage); this.setState({ offset, currentPage: selected + 1, merchants: this.state.totalRows.slice(offset, offset + this.state.perPage), filteredRowsPaged: this.state.filteredRows.slice(offset, offset + this.state.perPage), }, () => { if (this.state.filteredRowsPaged.length > 0) { this.globalSelectorGroup(this.state.filteredRowsPaged); } else { this.globalSelectorGroup(this.state.merchants); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function pagination(tableID) {\n var table = tableID;\n var trnum = 0;\n var maxRows = 15;\n var totalRows = $(table + \" tbody tr[class*='inList']\").length;\n $(table + \" tbody tr[class*='inList']\").each(function () {\n trnum++;\n if (trnum > maxRows) {\n $(this).hide();...
[ "0.6467562", "0.6442428", "0.6293526", "0.62678313", "0.6221835", "0.6221805", "0.62183696", "0.62111676", "0.61271375", "0.61058706", "0.6097933", "0.6077092", "0.60657465", "0.6065403", "0.6050341", "0.60414356", "0.6007577", "0.5992503", "0.5990029", "0.5979477", "0.597089...
0.64169353
2
Get pagination for complex merchant table; reactabular table lives in Table.js
get paginator() { if (this.pagination && this.props.globalSelector.orgIds.length > 0) { const pageCount = this.state.filterText !== '' ? this.state.filteredPageCount : this.state.pageCount; return ( <Pagination handlePageClick={this.handlePageClick} pageCount={pageCount} currentPage={this.state.currentPage} /> ); } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "renderPagination() {\n if (!_.isEmpty(this.props.pageMeta)) {\n const lastRecord = this.props.pageMeta.current_items_count + this.props.pageMeta.offset;\n const firstRecord = this.props.pageMeta.offset + 1;\n const totalItemsCount = this.props.pageMeta.total_items_count;\n\n...
[ "0.6724144", "0.6720494", "0.6720114", "0.66668576", "0.651038", "0.64357287", "0.6402743", "0.6393985", "0.63901496", "0.6385102", "0.63843", "0.63843", "0.6376642", "0.637434", "0.63591236", "0.63526535", "0.63466215", "0.63443977", "0.63443035", "0.6293342", "0.62765706", ...
0.61404717
31
Search complex merchant table
filterRows(searchString, columnsToSearch) { const lowercaseSearchString = searchString || ''; const objKeyLength = columnsToSearch.length; this.setState((prevState) => { const newRows = { filteredRows: prevState.totalRows.filter((row) => { for (let i = 0; i < objKeyLength; i += 1) { const key = columnsToSearch[i]; if (row[key] && row[key].toLowerCase && row[key].toLowerCase().indexOf(lowercaseSearchString) > -1) { return row[key]; } } return false; }), }; return newRows; }, () => { /* Nested setState is no bueno, but it's the only way to directly capture the newly set filteredRows value in this function in a live search */ this.setState({ filteredPageCount: Math.ceil(this.state.filteredRows.length / this.state.perPage), filteredRowsPaged: this.state.filteredRows.slice(0, this.state.perPage), }, () => { this.globalSelectorGroup(this.state.filteredRowsPaged); }); }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "async index(ctx) {\n const { request, response } = ctx\n\n try {\n const q = await GetRequestQuery(ctx)\n const redisKey = `DownPayment_${q.redisKey}`\n let cached = await RedisHelper.get(redisKey)\n\n if (cached && !q.search) {\n console.log(redisKey)\n return cached\n ...
[ "0.58776355", "0.5789239", "0.5677279", "0.5620365", "0.55751693", "0.55638516", "0.55566597", "0.55396926", "0.55245984", "0.55237097", "0.55235994", "0.5513817", "0.5482206", "0.5473594", "0.546288", "0.54501927", "0.5425111", "0.5424942", "0.5405259", "0.53923196", "0.5384...
0.0
-1
Parse through merchants to create global selector hierarchy
globalSelectorGroup(merchants) { const trueHierarchy = createSelectorBar(merchants); this.setState({ globalSelectorGroup: trueHierarchy, }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "get selectors () {\n return _.extend(super.selectors, {\n node: '.arc',\n highlight: '.highlight',\n })\n }", "parseTreeSelector() {\n this.skipSpace(); // Ignore space after a comma, for example\n\n // A tree selector must begin with a node selector\n let ns = this.parseNod...
[ "0.5643752", "0.564177", "0.5522093", "0.5512223", "0.55110604", "0.54667956", "0.53392327", "0.5235726", "0.51027375", "0.5054602", "0.498947", "0.498947", "0.4982487", "0.49774575", "0.49722803", "0.49584448", "0.4940216", "0.4940216", "0.4940216", "0.4940216", "0.4917505",...
0.65161645
0
Helper function for sorting
compareBy(a, b) { const { key, order } = this.state.sort; if (key && order) { if (a[key] < b[key]) return -1; if (a[key] > b[key]) return 1; return 0; } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function Sort() {}", "sort() {\n\t}", "sort() {\n\t}", "sort(){\n\n }", "function sorter(a,b) {\n return a - b;\n}", "function sortData (data) {\n ...\n}", "function sortFunction(val){\n return val.sort();\n}", "Sort() {\n\n }", "function sortAsc(a, b) {\n return a - b;\n }", "fu...
[ "0.81394196", "0.77322215", "0.77322215", "0.77019256", "0.7466116", "0.74345654", "0.74153644", "0.7377754", "0.7324186", "0.7306006", "0.72732276", "0.720845", "0.7200787", "0.7200787", "0.7200787", "0.7200787", "0.7182604", "0.71309775", "0.71250474", "0.7122583", "0.71096...
0.0
-1
All functions to be called on $(document).ready() should be in this function
function edgtfOnDocumentReady() { edgtfButton().init(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function documentReadyFunction() {\n onPageLoadOrResize();\n onPageLoad();\n }", "function initOnDomReady() {}", "function edgtfOnDocumentReady() {\n edgtfHeaderBehaviour();\n edgtfSideArea();\n edgtfSideAreaScroll();\n edgtfFullscreenMenu();\n edgtfInitMobil...
[ "0.7637316", "0.7295945", "0.72917986", "0.7147366", "0.70661527", "0.6997775", "0.69576925", "0.69490075", "0.69365877", "0.68800694", "0.6833077", "0.682541", "0.682541", "0.682541", "0.682541", "0.67614293", "0.6753088", "0.672049", "0.6687089", "0.6669767", "0.6669577", ...
0.0
-1
Rotate Memory or Accumulator Left Absolute 0x2E
function _rotateLeftAbsolute() { this.name = "Rotate Memory or Accumulator Left Absolute" this.argCount = 0; this.size = Size.MEMORY_A; this.addrMode = AddressingMode.ABSOLUTE; this.mnemonic = 'ROL' }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _rotateLeftAbsoluteX() {\n this.name = \"Rotate Memory or Accumulator Left Absolute Indexed X\"\n this.argCount = 0;\n this.size = Size.MEMORY_A;\n this.addrMode = AddressingMode.ABSOLUTE_INDEXED_X;\n this.mnemonic = 'ROL'\n}", "function _rotateRightAccumulator() {\n this.name = \"Rotate Memory or...
[ "0.74343175", "0.7421901", "0.73863924", "0.7303731", "0.68298024", "0.68284976", "0.68062663", "0.6724552", "0.65210956", "0.64577603", "0.6437752", "0.6413913", "0.63327265", "0.6285353", "0.62688637", "0.62613565", "0.62381095", "0.62231946", "0.62231946", "0.6216956", "0....
0.76143837
0
Rotate Memory or Accumulator Left Direct Page 0x26
function _rotateLeftDP() { this.name = "Rotate Memory or Accumulator Left Direct Page" this.argCount = 0; this.size = Size.MEMORY_A; this.addrMode = AddressingMode.DIRECT_PAGE; this.mnemonic = 'ROL' }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _rotateLeftDPX() {\n this.name = \"Rotate Memory or Accumulator Left Direct Page Indexed X\"\n this.argCount = 0;\n this.size = Size.MEMORY_A;\n this.addrMode = AddressingMode.DIRECT_PAGE_INDEXED_X;\n this.mnemonic = 'ROL'\n}", "function _rotateRightDP() {\n this.name = \"Rotate Memory or Accumula...
[ "0.763694", "0.7465139", "0.73501825", "0.66468763", "0.6616651", "0.651152", "0.63243204", "0.61665314", "0.6058135", "0.5943482", "0.58843964", "0.5882576", "0.5870193", "0.5856959", "0.5856959", "0.5856959", "0.5856959", "0.5847049", "0.5834506", "0.58283377", "0.5827183",...
0.787481
0
Rotate Memory or Accumulator Left Absolute Indexed X 0x3E
function _rotateLeftAbsoluteX() { this.name = "Rotate Memory or Accumulator Left Absolute Indexed X" this.argCount = 0; this.size = Size.MEMORY_A; this.addrMode = AddressingMode.ABSOLUTE_INDEXED_X; this.mnemonic = 'ROL' }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _rotateRightAbsoluteX() {\n this.name = \"Rotate Memory or Accumulator Right Absolute Indexed X\"\n this.argCount = 0;\n this.size = Size.MEMORY_A;\n this.addrMode = AddressingMode.ABSOLUTE_INDEXED_X;\n this.mnemonic = 'ROR'\n}", "function _rotateLeftAbsolute() {\n this.name = \"Rotate Memory or A...
[ "0.74959373", "0.7276008", "0.7002946", "0.68736386", "0.68279", "0.6760987", "0.6574002", "0.6554996", "0.6518214", "0.63686377", "0.62289166", "0.6228141", "0.62104076", "0.62104076", "0.61825615", "0.6167251", "0.6167251", "0.6167251", "0.6167251", "0.61502266", "0.6143089...
0.7733791
0
Rotate Memory or Accumulator Left Direct Page Indexed X 0x36
function _rotateLeftDPX() { this.name = "Rotate Memory or Accumulator Left Direct Page Indexed X" this.argCount = 0; this.size = Size.MEMORY_A; this.addrMode = AddressingMode.DIRECT_PAGE_INDEXED_X; this.mnemonic = 'ROL' }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _rotateLeftDP() {\n this.name = \"Rotate Memory or Accumulator Left Direct Page\"\n this.argCount = 0;\n this.size = Size.MEMORY_A;\n this.addrMode = AddressingMode.DIRECT_PAGE;\n this.mnemonic = 'ROL'\n}", "function _rotateRightDPX() {\n this.name = \"Rotate Memory or Accumulator Right Direct Pag...
[ "0.780992", "0.747796", "0.7469967", "0.6591143", "0.6552049", "0.6551099", "0.62893796", "0.60578746", "0.5895792", "0.58441675", "0.57939506", "0.57722104", "0.5734263", "0.5716874", "0.5713662", "0.56871134", "0.5649602", "0.5645618", "0.5620337", "0.5620337", "0.55897045"...
0.76863647
1
Rotate Memory or Accumulator Right Accumulator 0x6A
function _rotateRightAccumulator() { this.name = "Rotate Memory or Accumulator Right Accumulator" this.argCount = 0; this.size = Size.MEMORY_A; this.addrMode = AddressingMode.ACCUMULATOR; this.mnemonic = 'ROR' }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _rotateRightAbsolute() {\n this.name = \"Rotate Memory or Accumulator Right Absolute\"\n this.argCount = 0;\n this.size = Size.MEMORY_A;\n this.addrMode = AddressingMode.ABSOLUTE;\n this.mnemonic = 'ROR'\n}", "function _rotateRightAbsoluteX() {\n this.name = \"Rotate Memory or Accumulator Right Ab...
[ "0.7301488", "0.729129", "0.70738417", "0.70512545", "0.65957963", "0.64361584", "0.63505715", "0.63399667", "0.63057214", "0.63057214", "0.62479144", "0.61860484", "0.61491376", "0.6098807", "0.6088369", "0.6042117", "0.60115093", "0.58827204", "0.5880513", "0.5857465", "0.5...
0.8431012
0
Rotate Memory or Accumulator Right Absolute 0x6E
function _rotateRightAbsolute() { this.name = "Rotate Memory or Accumulator Right Absolute" this.argCount = 0; this.size = Size.MEMORY_A; this.addrMode = AddressingMode.ABSOLUTE; this.mnemonic = 'ROR' }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _rotateRightAccumulator() {\n this.name = \"Rotate Memory or Accumulator Right Accumulator\"\n this.argCount = 0;\n this.size = Size.MEMORY_A;\n this.addrMode = AddressingMode.ACCUMULATOR;\n this.mnemonic = 'ROR'\n}", "function _rotateRightAbsoluteX() {\n this.name = \"Rotate Memory or Accumulator...
[ "0.7658909", "0.745342", "0.6927619", "0.6870383", "0.67823464", "0.6642205", "0.64832926", "0.64832926", "0.62943846", "0.62934655", "0.6185984", "0.6174134", "0.61561877", "0.61384267", "0.6127303", "0.6108802", "0.61074764", "0.59991443", "0.5984363", "0.59635574", "0.5940...
0.7432865
2
Rotate Memory or Accumulator Right Direct Page 0x66
function _rotateRightDP() { this.name = "Rotate Memory or Accumulator Right Direct Page" this.argCount = 0; this.size = Size.MEMORY_A; this.addrMode = AddressingMode.DIRECT_PAGE; this.mnemonic = 'ROR' }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _rotateRightDPX() {\n this.name = \"Rotate Memory or Accumulator Right Direct Page Indexed X\"\n this.argCount = 0;\n this.size = Size.MEMORY_A;\n this.addrMode = AddressingMode.DIRECT_PAGE_INDEXED_X;\n this.mnemonic = 'ROR'\n}", "function _rotateRightAccumulator() {\n this.name = \"Rotate Memory ...
[ "0.7542031", "0.7105379", "0.69513595", "0.67965776", "0.67398393", "0.64333797", "0.62827593", "0.6184053", "0.607957", "0.6031022", "0.5983472", "0.59147984", "0.585667", "0.58494437", "0.5706723", "0.5706723", "0.5685161", "0.564845", "0.56215155", "0.5583932", "0.5549265"...
0.78634083
0
Rotate Memory or Accumulator Right Absolute Indexed X 0x7E
function _rotateRightAbsoluteX() { this.name = "Rotate Memory or Accumulator Right Absolute Indexed X" this.argCount = 0; this.size = Size.MEMORY_A; this.addrMode = AddressingMode.ABSOLUTE_INDEXED_X; this.mnemonic = 'ROR' }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _rotateRightAccumulator() {\n this.name = \"Rotate Memory or Accumulator Right Accumulator\"\n this.argCount = 0;\n this.size = Size.MEMORY_A;\n this.addrMode = AddressingMode.ACCUMULATOR;\n this.mnemonic = 'ROR'\n}", "function _rotateRightAbsolute() {\n this.name = \"Rotate Memory or Accumulator ...
[ "0.72784024", "0.7242633", "0.721157", "0.70793945", "0.6726225", "0.6678231", "0.66013414", "0.66013414", "0.6499178", "0.63041914", "0.61889285", "0.6124849", "0.6048723", "0.5944712", "0.5929002", "0.5923633", "0.5921155", "0.5914576", "0.5908073", "0.5898166", "0.5894169"...
0.782805
0
Rotate Memory or Accumulator Right Direct Page Indexed X 0x76
function _rotateRightDPX() { this.name = "Rotate Memory or Accumulator Right Direct Page Indexed X" this.argCount = 0; this.size = Size.MEMORY_A; this.addrMode = AddressingMode.DIRECT_PAGE_INDEXED_X; this.mnemonic = 'ROR' }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function _rotateRightDP() {\n this.name = \"Rotate Memory or Accumulator Right Direct Page\"\n this.argCount = 0;\n this.size = Size.MEMORY_A;\n this.addrMode = AddressingMode.DIRECT_PAGE;\n this.mnemonic = 'ROR'\n}", "function _rotateRightAbsoluteX() {\n this.name = \"Rotate Memory or Accumulator Right Ab...
[ "0.77308357", "0.6866606", "0.6806523", "0.6764412", "0.67368245", "0.6629825", "0.60565335", "0.60262495", "0.5934687", "0.59247136", "0.59247136", "0.5909182", "0.5857056", "0.5799374", "0.5730875", "0.5659945", "0.56086606", "0.5555327", "0.5534251", "0.5532459", "0.552765...
0.7789457
0
click a slide in slide thumbnails > change slide
function showSlide(id) { // changing slide -> reset selected element selectedElement = null; if (selectedSlide != null) { selectedSlide.classList.remove('uiSlideSelected'); } selectedSlide = $('#' + id); selectedSlide.classList.add('uiSlideSelected'); var action = "changeSlide"; var data = {}; data.action = action; data.id = id; data.handler = "slide"; Ajax.post(data, "ajax.php", function (json) { if (json.error) { $('#activeSlideContainer').innerHTML = json.error; } else { $('#activeSlideContainer').innerHTML = json.html; } }); data = {}; data.handler = 'slide'; data.action = 'getSlideIndex'; var url = "ajax.php"; console.log("get slide index"); Ajax.post(data, url, function (json) { console.log("got slide index: " + json.index); $('#indexPicker').value = json.index; }) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function switchSlide () {\n grabNextSlide();\n loadSlide();\n }", "function showSlides() {\n slideIndex++;\n showSlidesByClick(slideIndex);\n}", "function slideShow() {\n $thumbArray\n .eq(index) // eq selects the element at the given index\n .trigger('click'); /...
[ "0.7284267", "0.72596025", "0.718012", "0.7054175", "0.7038622", "0.68316835", "0.67867446", "0.6740162", "0.6681874", "0.6622672", "0.65616906", "0.6557785", "0.6517414", "0.65035224", "0.6490582", "0.64894557", "0.64516205", "0.644501", "0.64433914", "0.64309144", "0.642923...
0.0
-1
select an element in a slide > make editable
function selectElement(element) { console.log('new element selected'); // change class of selected (and unselected element) for styling // and make / unmake content editable // and save to database if (selectedElement != null) { selectedElement.classList.remove('uiSelected'); selectedElement.classList.add('drag'); // set selectedElement to uneditable, then saving the changed contents selectedElement.setAttribute("contentEdiatable", false); changeText(selectedElement); } selectedElement = element; element.classList.add("uiSelected"); selectedElement.classList.remove('drag'); element.setAttribute("contentEditable", true); console.log(element); //var elementText = element.getElementsByClassName('textnode')[0].innerHTML; var elementText = element.innerHTML; console.log(elementText); var elementId = element.dataset.id; console.log(elementId); $('#elementText').value = elementText; $('#elementId').value = elementId; // widthPicker, heightPicker, xPicker, yPicker $('#widthPicker').value = element.offsetWidth; $('#heightPicker').value = element.offsetHeight; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function editable(el) {\n // set the clicked list element as editable\n el.target.contentEditable = true;\n //set the focus on this element in order to be able to change the text\n // and to keep the drag functionality working\n el.target.focus();\n}", "function toggleEditMode(mode) {\n var slides = docume...
[ "0.66210043", "0.66047364", "0.6248892", "0.62122303", "0.6202468", "0.61109245", "0.6036614", "0.5968051", "0.5952249", "0.5946495", "0.5910861", "0.5908027", "0.590312", "0.5888018", "0.5873248", "0.58478695", "0.5843096", "0.5824763", "0.57590777", "0.5709005", "0.5696458"...
0.59652174
8
triggered by a click on a slide call function to update selected item and unselect it
function unselectElement() { console.log('element unselected!'); if (selectedElement != null) { selectedElement.classList.remove('uiSelected'); selectedElement.classList.add('drag'); // set selectedElement to uneditable, then saving the changed contents selectedElement.setAttribute("contentEditable", false); changeText(selectedElement); } selectedElement = null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "unSelectItem (i) { this.toggSel(false, i); }", "doUnselectItem() {\n if (this.selected) {\n this.selected.set('selected', false);\n this.set('selected',null);\n }\n }", "function updateSelection(elem) {\n\n jQuery('.flex-item').attr(\"data-is-selected\", \"false\");\n\...
[ "0.6982529", "0.6892198", "0.68837166", "0.68206745", "0.6402647", "0.6366176", "0.6349188", "0.6330962", "0.63260204", "0.6303552", "0.62812376", "0.62789905", "0.6269649", "0.621414", "0.62036866", "0.6192106", "0.61791366", "0.61774963", "0.61719656", "0.61719656", "0.6161...
0.580751
82
triggered by elementdimension number picker ajax request to update dimensions in databse
function editElementDimensions() { console.log("edit element dimensions"); var elementId = $('#elementId').value; console.log(elementId); var element = $('#' + elementId); console.log(element); element.style.width = $('#widthPicker').value + "px"; console.log(element); var data = {}; data.action = "editElementDimensions"; data.id = element.dataset.id; data.width = element.offsetWidth; data.handler = "slide"; var url = "ajax.php"; Ajax.post(data, url, function (json) { if (json.error) { $('#activeSlideContainer').innerHTML = json.error; } else { refreshEditorSlide(json.id); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateDimensionHandler() {\n\n // Get the current NAtural Unit\n var unit = new NaturalUnit();\n\n var id;\n\n id = $(\"#NaturalUnitList\").find('option:selected').val();\n\n unit = getReferenceUnit(id);\n if (unit.ID == -1) {\n // this is a new NAtural...
[ "0.7119299", "0.6495087", "0.6283018", "0.61688954", "0.6075968", "0.592012", "0.5852912", "0.5844542", "0.58080405", "0.5724996", "0.56657696", "0.56534666", "0.5648242", "0.56397265", "0.56374943", "0.5632622", "0.56306434", "0.5573068", "0.55637753", "0.55603683", "0.55496...
0.7309719
0
triggered from mouseup after dragging an element request element position update through ajax
function editElementPosition(selectedElement) { var left = selectedElement.getBoundingClientRect().left; var top = selectedElement.getBoundingClientRect().top; var data = {}; data.action = "editElementPosition"; data.id = selectedElement.dataset.id; data.left = left; data.top = top; data.handler = "slide"; var url = "ajax.php"; Ajax.post(data, url, function (json) { if (json.error) { $('#activeSlideContainer').innerHTML = json.error; } else { // only updates database document, no callback action required } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "onMouseUp(e) {\n // we have finished dragging\n this.isMouseDown = false;\n\n // remove specific styles\n this.options.element.classList.remove(\"dragged\");\n\n // update our end position\n this.endPosition = this.currentPosition;\n\n // send our mouse/touch positi...
[ "0.64260936", "0.6425617", "0.62787956", "0.62787956", "0.62750095", "0.62742996", "0.621151", "0.6165548", "0.61621416", "0.61463434", "0.61344", "0.610288", "0.610288", "0.60891455", "0.6087538", "0.60825616", "0.6062672", "0.6055652", "0.6052325", "0.60324657", "0.60300547...
0.62344575
6
request to update an elements' text in database
function changeText(element) { //var text = element.getElementsByClassName('textnode')[0].innerHTML; var text = element.innerHTML; var elementId = element.dataset.id; console.log("neuer Text für Element " + elementId + " ist " + text); var div = $('#lengthCalculator'); div.innerHTML = element; var width = calculateWidth(element); var height = calculateHeight(element); var data = {}; data.action = "editElement"; data.elementId = elementId; data.text = text; data.height = height; data.width = width; data.handler = "slide"; var url = "ajax.php"; Ajax.post(data, url, function (json) { if (json.error) { $('#activeSlideContainer').innerHTML = json.error; } else { // only updates database document, no callback action required console.log("Neuer Text: " + json.text); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function updateText(elementID, text){\n \n}", "function updateNote(noteEl) {\n const noteText = document.getElementById('note-text').value\n fetch(url + '/' + `${noteEl.parentElement.id} `, {\n method: 'PUT',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(...
[ "0.65596914", "0.6273206", "0.6228144", "0.61891687", "0.6141462", "0.6102611", "0.6089756", "0.60776615", "0.6058269", "0.6040642", "0.60005695", "0.59905666", "0.5978067", "0.5978067", "0.5978067", "0.59659255", "0.59364766", "0.5934099", "0.5930564", "0.5893941", "0.588547...
0.61308557
5
request the deletion of an element refresh editor view
function deleteElement(id) { var elementId = $('#' + id).value; var data = {}; data.action = "deleteElement"; data.elementId = elementId; data.handler = "slide"; var url = "ajax.php"; Ajax.post(data, url, function (json) { if (json.error) { $('#activeSlideContainer').innerHTML = json.error; } else { // update slide $('#activeSlideContainer').innerHTML = json.html; } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "delete() {\n this.html.remove();\n }", "delete () {\n this.element = this.element.delete(this)\n }", "delete() {\n $(`#${this.idDOM}`).remove();\n }", "function onDeleteElement() {\n inputMultiElementDOM.trigger(\"ime:element:delete\");\n \n // Activate textarea\n...
[ "0.6767126", "0.6560261", "0.6551945", "0.6479844", "0.64727074", "0.6402094", "0.63449997", "0.62496346", "0.6243218", "0.6231263", "0.6220395", "0.6207248", "0.6206047", "0.6206047", "0.6192891", "0.6188038", "0.61845917", "0.6159082", "0.615455", "0.61307746", "0.6128477",...
0.0
-1
request deletion of active slide
function deleteSlide() { var data = {}; data.action = "deleteActiveSlide"; data.handler = "slide"; var url = "ajax.php"; Ajax.post(data, url, function (json) { if (json.error) { $('#activeSlideContainer').innerHTML = json.error; } else { // update slide // reload updated presentation showPresentation(json.id); console.log(json.slideId); } }); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function deleteSlide() {\n var slideToDelete = $('.to-delete');\n slideToDelete.remove();\n }", "function deleteSlide(evt) {\n privates.sel.wrap.style.transitionDuration = '0s';\n privates.sel.slides[0].remove();\n privates.sel.wrap.style.transform = `translate${privates.opt.moveDirection}(...
[ "0.77357244", "0.7377002", "0.72924876", "0.7282034", "0.7161172", "0.6709938", "0.6579135", "0.65381134", "0.64747137", "0.6448782", "0.63921636", "0.6382087", "0.6324793", "0.6295693", "0.6248558", "0.6229366", "0.62201375", "0.6201239", "0.6166086", "0.616189", "0.61408406...
0.77518266
0
Automatically parses all request parameters and puts them into the `params` property of the request object. This is the union of all GET (query string) and POST (content) parameters, such that all POST parameters with the same name take precedence. Valid options include the following: maxLength The maximum length (in bytes) of the request content. Overrides Request.maxContentLength for all requests using this middleware. uploadPrefix A special prefix to use for temporary files on disk that are created from file uploads. Overrides Request.defaultUploadPrefix for all requests using this middleware.
function makeParams(app, options) { options = options || {}; var maxLength = options.maxLength; var uploadPrefix = options.uploadPrefix; function paramsApp(request) { if (request.params) { return request.call(app); // Don't overwrite existing params. } request.params = {}; merge(request.params, request.query); return request.parseContent(maxLength, uploadPrefix).then(function (params) { merge(request.params, params); return request.call(app); }, function (error) { if (error instanceof errors.MaxLengthExceededError) { return utils.requestEntityTooLarge(); } throw error; }); } return paramsApp; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function parseBody (req, res, next) {\n var uri = url.parse(req.url, true);\n req.pathname = uri.pathname;\n req.cookies = qs.parse(req.headers.cookie);\n req.query = uri.query;\n\n req.on('readable', function () {\n var body = req.read();\n var contentType = req.headers['content-type'];\n if (conten...
[ "0.56840175", "0.5627153", "0.5602417", "0.5493548", "0.5493548", "0.5485229", "0.5476286", "0.5392052", "0.538496", "0.538496", "0.538496", "0.53082705", "0.5189435", "0.5032697", "0.49922815", "0.49785656", "0.4959587", "0.49431035", "0.49431035", "0.49431035", "0.49379027"...
0.5889075
0
maak component aan en zet niet active gameobject maakt dan een refference naar game en naar gameobject
function Dcomponent(name) { this.mName = name; this.mActive = false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function ActiverCameraCarte(){\n\t//bascule entre la carte du jeu et la vue 3e pers\n\tcameraPerso.SetActive(!cameraPerso.activeSelf);\n\tcameraCarte.SetActive(!cameraCarte.activeSelf);\n\t\n\t//bascule l'affichage de l'interface de camera\n\tuiCarte.SetActive(!uiCarte.activeSelf);\t\n\t\n\t/*cache les textes d'in...
[ "0.65457183", "0.65092015", "0.64623725", "0.63458455", "0.6283822", "0.61846244", "0.614194", "0.6100298", "0.6001252", "0.59877", "0.5986141", "0.5972454", "0.5970727", "0.59693336", "0.5962489", "0.5929339", "0.59270525", "0.59270525", "0.59270525", "0.59270525", "0.592635...
0.0
-1
button callback: context naam of object callback is functie
function Button(iButton, iImage) { _super.call(this, "Button"); //callback, context en sound this._mCallbackFunction = iButton.mCallback; this._mContext = iButton.mContext; this._mSoundEffect = iButton.mSoundEffect; //button image info this._mKey = iImage.mKey; this._mSheet = iImage.mSheet; this._mAnchor = iImage.mAnchor; this._mGroup = iImage.mGroup; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "handleButton() {}", "buttonClick(ev) {\n\n\t\t// Get the button using the index\n\t\tvar btn = this.props.buttons[ev.currentTarget.dataset.index];\n\n\t\t// If there's a callback\n\t\tif(typeof btn.callback == 'function') {\n\t\t\tbtn.callback(btn);\n\t\t} else {\n\t\t\tthis.props.close();\n\t\t}\n\t}", "funct...
[ "0.7049072", "0.7018743", "0.67045593", "0.6546951", "0.6546742", "0.64738196", "0.6413516", "0.62902", "0.61315125", "0.6113609", "0.6079787", "0.6030448", "0.6002051", "0.5983992", "0.5982074", "0.5981315", "0.5951969", "0.59450907", "0.59358037", "0.59348625", "0.5921149",...
0.0
-1
Uploads image locally in the browser To be used in ./UploadImage.js
function UploadImage(props) { const handleFileUpload = function(e) { e.stopPropagation() e.preventDefault() const file = e.target.files ? e.target.files[0] : e.dataTransfer.files[0] const reader = new FileReader() reader.onload = e => { props.handleImageUpload(e.target.result) } reader.onerror = e => { console.log('error') } reader.readAsDataURL(file) } const handleDragOver = function(e) { e.stopPropagation() e.preventDefault() } return ( <div className="uploadimage-container" onDragOver={handleDragOver} onDrop={handleFileUpload} > <span className="uploadimage-info"> <form> <label tabIndex="1" htmlFor="upload-button"> <div style={{ backgroundColor: props.secondaryColor, color: props.primaryColor, }} className="choose-file-button" > choose file </div> </label> <input id="upload-button" style={{ width: '1px', visibility: 'hidden' }} type="file" onChange={e => handleFileUpload(e)} ></input> </form> </span> </div> ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function submitImage() {\n let image = document.querySelector('input[type=file]').files[0];\n if (image) {\n encodeImageFileAsURL(image);\n } else {\n errorMessage(\"No Selected File\");\n }\n }", "function submitImage() {\n let image = document.querySelector('input[type=file]').files[0...
[ "0.7295836", "0.7295836", "0.72433865", "0.7166959", "0.71283275", "0.7034273", "0.7034118", "0.6974571", "0.6921538", "0.6919557", "0.6905386", "0.68774486", "0.6866051", "0.6850128", "0.6784523", "0.67219996", "0.6712172", "0.6634322", "0.66182846", "0.6613366", "0.6586653"...
0.0
-1
todo: merge with getNamedNodeByNameOrFindFunction
function getSymbolByNameOrFindFunction(items, nameOrFindFunc) { var findFunc; if (typeof nameOrFindFunc === "string") findFunc = function (dec) { return dec.getName() === nameOrFindFunc; }; else findFunc = nameOrFindFunc; return utils_1.ArrayUtils.find(items, findFunc); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function $n( root, nodeName ) { return findNodeByName(root,nodeName); }", "getNodeName() {}", "function getNodeByName(node, name) {\n\tfor (var i=0;i<node.childNodes.length;i++) {\n\t\tif (node.childNodes[i].name==name)\n\t\t\treturn node.childNodes[i];\n\t}\n}", "function nodeByName(name, root) {\n retur...
[ "0.7234405", "0.7213357", "0.6847762", "0.6753413", "0.667247", "0.64504325", "0.6433099", "0.61442745", "0.6089772", "0.60751873", "0.60433406", "0.60325", "0.60161674", "0.6013289", "0.59773445", "0.5946763", "0.5925504", "0.5894859", "0.588466", "0.5840062", "0.5824268", ...
0.0
-1
LOGIC HERE: CHECK OUT COMPONENT MOUNTING IF YOU WANT TO TRY IT OUT
render(){ //RENDER LOGIC HERE return( <div class="five columns offset-by-half text-center payCell"> <Pricing /> <Options /> </div> ) }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "isValid(){\n let component = this.props.component\n let key = this.props.attribute\n return !component.state.data[key].error\n }", "isValid(): boolean {\n return this.innerComponent.isValid();\n }", "function validateComponent(component) {\n const {componentUrl, componentId...
[ "0.6132408", "0.59143686", "0.5884589", "0.5827174", "0.580699", "0.57434094", "0.57434094", "0.56972545", "0.56900185", "0.56510246", "0.56259197", "0.5619333", "0.56176275", "0.56169486", "0.56101614", "0.56101614", "0.56064254", "0.5538871", "0.5495302", "0.54732376", "0.5...
0.0
-1
Compares two ArrayBuffer or ArrayBufferView objects. If bitCount is omitted, the two values must be the same length and have the same contents in every byte. If bitCount is included, only that leading number of bits have to match.
function equalBuffers(a, b, bitCount) { var remainder; if (typeof bitCount === "undefined" && a.byteLength !== b.byteLength) { return false; } var aBytes = new Uint8Array(a); var bBytes = new Uint8Array(b); var length = a.byteLength; if (typeof bitCount !== "undefined") { length = Math.floor(bitCount / 8); } for (var i=0; i<length; i++) { if (aBytes[i] !== bBytes[i]) { return false; } } if (typeof bitCount !== "undefined") { remainder = bitCount % 8; return aBytes[length] >> (8 - remainder) === bBytes[length] >> (8 - remainder); } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "function equalBuffers(a, b, bitCount) {\n var remainder;\n\n if (typeof bitCount === \"undefined\" && a.byteLength !== b.byteLength) {\n return false;\n }\n\n var aBytes = new Uint8Array(a);\n var bBytes = new Uint8Array(b);\n\n var length = a.byteLength;\n ...
[ "0.75339097", "0.6466259", "0.6395015", "0.6395015", "0.6380612", "0.6360943", "0.61681306", "0.5953913", "0.58806556", "0.5775409", "0.5770517", "0.5735271", "0.55813944", "0.556135", "0.5533317", "0.5440266", "0.54267716", "0.54244775", "0.5375167", "0.5310889", "0.5299251"...
0.75972325
0