anchor stringlengths 10 14.3k | positive stringlengths 10 14.9k |
|---|---|
saves the data into local storage | function bookmarkWhere() {
var string = JSON.stringify(where);
localStorage.setItem('whereBookmark', string);
} |
Close navList if click outside div | function clickOutside(e) {
var container = $("#navList");
if ((!container.is(e.target) && !$("#mobile-nav").is(e.target))) // if the target of the click isn't the container...
{
container.removeClass("show");
}
} |
Resets the contents and reenable the find buttons; | function goBack() {
id('data').innerHTML = "";
id("find-btn").disabled = false;
} |
ADD TO main_windows LIST | function add_to_main_windows_list(window_id)
{
var temp_main_windows_list = get_main_windows_list();
var index = temp_main_windows_list.indexOf(window_id);
if (index < 0)
{
//this windows is not in the list currently
temp_main_windows_list.push(window_id);
}
localStorage.main_windows = temp_main_w... |
Obtengo los medicamentos de un determinado paciente | function getMedicamentosPaciente(req, res){
console.log('- GET MEDICAMENTOS PACIENTE -');
var query = Paciente.findById(req.params.idPaciente);
query.populate({
path: 'medicamentos',
model: 'Medicamento'
})
.exec(function (err, paciente) {
if (err) {
... |
Simulate forces and update node and label positions on tick. | function tick(e) {
node
.each(gravity(e.alpha * .1))
.each(collide(.5))
.attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; });
label
.style("left", function(d) { return (d.x - d.dx / 2) + "px"; })
.style("top", function(d) { return (d.y - d.dy / 2) + "px"; }... |
create new reply box | function createNewReplyBox(reply_location){
div_top = reply_location.parentElement.parentElement.childNodes[3];
debugger;
div1 = document.createElement("div");
div1.className = "replies";
div1.style.display = "block";
div_top.parentNode.insertBefore(div1, div_top.nextSibling);
blank1 = document.createTex... |
Fahrenheit = Celcius 9/5 +32 | function convertToFahrenheit(temp){
let fahr = temp *9/5 +32;
console.log(`${temp} degrees in C is ${fahr} degrees in F`);
} |
Define our tasks using plain functions | function copy() {
// Copy these folders and contents as is
gulp.src([
'src/background/**',
'src/content/**',
'src/popup/**',
'src/styles/**',
'src/vendor/**'], {base: 'src'})
.pipe(gulp.dest(OUTPUT_DIR_WEB_EXTENSION));
// Compile less into css
gulp.src('src/**/*.less', {base: 'src'})
... |
sets event behaviour button needs always be clickable even if nonClickable layer blocks it | function setEventBehaviour(){
button.style("pointer-events","all");
} |
Sprite based collision checking | function SpriteCollision(offset, sprite1, sprite2)
{
for (var x = 0; x < sprite1.width; ++x)
{
var xx = +x + +offset[0];
if (xx < 0 || xx >= sprite2.width) continue;
for (var y = 0; y < sprite1.height; ++y)
{
var yy = +y + +offset[1];
if (yy < 0 || yy >= sprite2.height) continue;
var pix1 = sprite1.r... |
MERCADO SECCION MONEDAS SUGERENCIAS | function datosugerencia($id_sugerencia){
var id = $id_sugerencia;
var base_url= 'http://localhost/sistema_monedas/';
$.ajax({
url: base_url + "sugerencias/view/" + id,
type:"POST",
success:function(resp){
$("#modal-default .modal-body").html(resp);
... |
A function that sets the transparent state of the navbar. | function handleTransparentNavbar() {
setTransparentNavbar(dispatch, (fixedNavbar && window.scrollY === 0) || !fixedNavbar);
} |
Funcion para eliminar comentarios | function removeComment() {
let shortenId2=this.id.slice(15)
// console.log(shortenId2)
let commentRef3= firebase.database().ref("posts/"+shortenId2);
let optionConfirmRemove = confirm ("Confirma si quieres eliminar el comentario")
if (optionConfirmRemove == true){
commentRef3.remove();
}... |
initialize all the button click function | function buttonsSetting() {
var buttons = document.getElementsByTagName("li");
for (var i = 0; i < buttons.length; i++) {
buttons[i].bubbles = true;
EventUtil.addHandler(buttons[i], "click", buttonFunc(i, "custom"));
}
} |
Gets current value in a desired format. | getProcessedValue(value) {
const {
minDate, maxDate, maxDetail, returnValue,
} = this.props;
const processFunction = (() => {
switch (returnValue) {
case 'start':
return getDetailValueFrom;
case 'end':
return getDetailValueTo;
case 'range':
... |
If you have a new step, just add a condition and create the class | function ScenarioStepFactory(step,ctx) {
this.isAction = () => step.action !== undefined
this.isConsumedMessage = () => (step.message !== undefined) && (step.consumed_by !== undefined)
this.isProducedMessage = () => (step.message !== undefined) && (step.produced_by !== undefined)
this.isCalledAPI = () => (step.... |
Wrapper around buildLineContent which will reuse the structure in display.externalMeasured when possible. | function getLineContent(cm, lineView) {
var ext = cm.display.externalMeasured;
if (ext && ext.line == lineView.line) {
cm.display.externalMeasured = null;
lineView.measure = ext.measure;
return ext.built
}
return buildLineContent(cm, lineView)
} |
Client wants to leave the game | function leaveClient() {
socket.emit('leave', {name: playerId});
} |
Function to set the interval execution | function makeInterval() {
intervalID = setInterval(function() {
fadeOutAndIn();
}, intervalTime);
} |
When LWC is used in the context of an Aura application, the compiler produces AMD modules, that doesn't resolve properly circular dependencies between modules. In order to circumvent this issue, the module loader returns a factory with a symbol attached to it. This method returns the resolved value if it received a fac... | function resolveCircularModuleDependency$1(fn) {
{
if (!isFunction$2(fn)) {
throw new TypeError(`Circular module dependency must be a function.`);
}
}
return fn();
} |
the above contains processing for the entry the following displays it, but should be extracted possibly to the updateVenueMarkerVisibilityFlag... this attempts to display all | function _subfunction(placeObject){
console.log('displayed'+placeObject.name);
var retval=new VenueObject(placeObject);//turn that off
retval.done(function(marker){
placeObject.marker=marker;
});
} |
Get the temp from the the API with a getJSON call | function getTemperature(){
$.getJSON("api/getTemp", function(tempJson){
updateGraph(tempJson);
});
} |
Data fetch: artists' info | async function getArtists() {
//In questa copia del progetto, mi sono salvato tutti gli artisti e le loro informazioni in un file json
artistsList = await fetch('artists.json').then(r => r.json());
} |
This is the common logic for both the Node.js and web browser implementations of `debug()`. | function setup(env) {
createDebug.debug = createDebug;
createDebug.default = createDebug;
createDebug.coerce = coerce;
createDebug.disable = disable;
createDebug.enable = enable;
createDebug.enabled = enabled;
createDebug.humanize = __webpack_require__(4695);
createDebug.destroy = destroy;
Object.keys... |
Function to add to inventory | function addInventory() {
var query = "SELECT * from products";
connection.query(query, function (error, results) {
if (error) throw error;
inquirer.prompt([
{
type: "input",
message: "What is the id of the product you want to add?",
... |
Set player to intial location. | restart() {
this.x = 200;
this.y = 380;
} |
applies the necessary transform value to scale the item up | function applyTransforms(el, nobodyscale) {
// zoomer area and scale value
var zoomerArea = el.querySelector('.zoomer__area'),
zoomerAreaSize = {width: zoomerArea.offsetWidth, height: zoomerArea.offsetHeight},
zoomerOffset = zoomerArea.getBoundingClientRect(),
scaleVal = zoomerAreaSize.width/zoomerAreaSize... |
Change the BG of body | function bodyBG(image) {
let bg = "linear-gradient(45deg,rgba(0, 0, 0, 0.6) 65%, rgba(250, 250, 250, 0.34))";
if (window.innerWidth < 800) {
document.body.style.backgroundImage = bg + ",url('img/sm/" + image + "')";
} else {
document.body.style.backgroundImage = bg + ",url('img/" + image + ... |
Constructor for a stack entry on the global exception handler stack | function HandlerStackEntry(k, next)
{
this.k = k;
this.next = next;
} |
render the children of this component the children of this component is an arrow function that takes the count and inrementCount and renders the original component and passes the count and inrementCount to it | render() {
return (
<div>
{this.props.children(this.state.count, this.incrementCount)}
</div>
);
} |
method to get the movieID and setting it to state | getId(title, year) {
//using the google youtube api to get the video id
let youtube = (params, callback) => {
axios.get(this.state.url, { params: params }).then(function(response) {
callback(response.data.items[0])
}).catch(function(error) {
console.error(error);
});
... |
update the profile and clear the input text | function updateProfile() {
if (newName.value!="") {
name.innerHTML = newName.value;
}
if (newEmail.value!="") {
email.innerHTML = newEmail.value;
}
if (newPhone.value!="") {
phone.innerHTML = newPhone.value;
}
if (newZipcode.value!="") {
zipcode.innerHTML = newZipcode.value;
}
if (newPassw... |
Function to initialize the controls | function createControls(camera, domElement) {
// Create new OrbitControls linked to the camera and the renderer's DOM element
const controls = new OrbitControls(camera, domElement);
return controls;
} |
================================ POSTS =============================== create new user | async createTypePlant(req, res) {
const { name, legendary } = req.body;
const newType = new TypePlant({ name, legendary });
try {
await newType.save(function (err) {
if (err) return res.status(400).json({ error: `Error en los datos ingresados` });
res.status(200).json({ message: `Planta ${name} creada ... |
creates a subscription and returns the unsubscribe function; | function subscribe(name, callback) {
// Subscripton names are lowercased so both 'Shift+Space' and 'shift+space' works.
name = name.toLowerCase();
// remove spaces so both 'Shift + Space' and 'shift+space' works.
name.replace(/\s/, '');
if (typeof __subscriptions[name] === 'undefined') {
__su... |
var j = 0; | function particle() {
for (var i=0; i<50; i++) {
var dir = new THREE.Vector3(2*Math.random()-1, Math.random()*4, 2*Math.random()-1);
dir.multiplyScalar(6/dir.length());
var color = (Math.random() > 0.5) ? 0x333333 : 0x666666;
var p = new Particle(obj.position, dir, color, 0.1);
... |
TODO: check if result is React component and highlight it | function propertyValue(t, v) {
if (t === 'string')
return util.inspect(v, { colors: true });
else if (t === 'number' || t === 'boolean')
return v.toString().blue;
else if (t === 'object' && v == 'null')
return 'null'.blue;
else if (t === 'undefined')
return 'undef... |
returns the negated variants of PageElementCurrently's state check functions | get not() {
return {
/**
* Returns true if PageElement currently does not exist.
*/
exists: () => !this.exists(),
/**
* Returns true if PageElement is currently not visible.
*/
isVisible: () => !this.isVisible(),... |
Adds the comment to local storage via redux actions | onAddComment(evt){
evt.preventDefault();
if (this.state.comment.trim() === ''){
return;
}
const newComment = {
content: this.state.comment,
posted: new Date(),
}
// empty the comment text
this.setState({comment: ''});
... |
makes a function to compare the object values from the specified compare operation callback | function makeCompare (fn) {
return function (value, key) {
return hasOwn(this, key) && fn(value, this[key])
}
} |
resets the amount of tasks to 0 takes the todosFile json and modifies the tasks in it this function is invoked when the user enter the command 'reset' | function resetTodosList (jsonObject) {
//empty tasks
jsonObject.tasks = [];
console.log('tasks list emptied successfully');
//turn into string and save it to the file
jsonObject = JSON.stringify(jsonObject);
return fs.writeFile('todo.json',jsonObject);
} |
draws one round corner, starting at origin (needs to be translated/rotated to be placed properly). | function drawRoundCorner(Wright, r, transform$$1) {
var angle = Math.PI/2 * Wright / (Wright + Wtop);
// not sanitizing this one, because negative values
// are useful to fill the box correctly.
var ri = {
x: r.x - Wright,
y: r.y - Wtop
... |
Helper functions for state... | function updateQuiz(pointer, value, currentlyEditing) {
setQuiz(oldQuiz => {
let q = [...oldQuiz.problems];
q = q.map((problem, i) => {
if (i === pointer) {
if (currentlyEditing.type === QUESTION) {
return { ...problem, question: value };
} else if (currentlyEditi... |
Carga la MT / 1. Comprueba si el API es compatible con el navegador 2. Hacemos trigger en el input que carga la ventana del explorador de archivos | function cargarMT(){
if( APIcompatible() ) { //[1]
$('#cargarMT').trigger('click'); //[2]
}else{
mostrarAlert('API FileRader no compatible con este navegador.')
}
} |
Mark a component as needing a rerender, adding an optional callback to a list of functions which will be executed once the rerender occurs. | function enqueueUpdate(component) {
ensureInjected();
// Various parts of our code (such as ReactCompositeComponent's
// _renderValidatedComponent) assume that calls to render aren't nested;
// verify that that's the case. (This is called by each top-level update
// function, like setState, forceUpdate, etc.... |
Retrieving an icon for the card's footer: | function retrieveFooterIcon(iconNum) {
iconNum = iconNum ? iconNum : 0
switch(iconNum) {
// Devices Cards
case '1':
return <FontAwesomeIcon icon={faMapMarkerAlt} style={{width: '20px', height: '20px'}} />;
// Warehouses Cards
case '2':
return <FontAwesomeIcon icon={faWare... |
test for square code | function squareTest(t){ //t=1 for player1, t=2 for player2
j=1;
while (gotSquare==0 && j<n+1){
i=1;
while (gotSquare==0 && i<n+1){
if (state[i][j]==t){
for (l=j;l<n+1;l++){
if (l==j){start=i+1}else{start=1;}
for (k=start;k<n+1;k++){
if (state[k][l]==t){
if ((0<k+l-j && k+l-j<n+1 &&... |
combines searchURL with user input | function formatQueryParams(params) {
const queryItems = Object.keys(params).map(
(key) => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`
);
return queryItems.join("&");
} |
This does the same as the function above, but for the weekList table. | function changeEmojiWeek(){
var em = document.getElementById("weekList").childElementCount;
if(em == 0){
document.getElementById("emojiWeek").innerHTML = "😀";
}else if(em < 3){
document.getElementById("emojiWeek").innerHTML = "🙄";
}else if(em < 5){
document.getElementById("emojiWeek").innerHTML... |
Get the value for the table cell | function getIt(id) {
var result;
result = document.getElementById(id).value.trim();
return result;
} |
set xurrent route name | setCurrentRouteName(routeName){
currentRoute = routeName;
currentPoiIndex = null;
} |
Show or hide the ondemand details panel. | function toggleDetails() {
const details = d3.select("#details");
details.style("display",
details.style("display") === "none" ? "block" : "none"
);
d3.select("#guide strong").text(
details.style("display") === "none" ? "show" : "hide"
);
} |
Hooks and props are merged as arrays. | function mergeHook (
parentVal,
childVal
) {
var res = childVal
? parentVal
? parentVal.concat(childVal)
: Array.isArray(childVal)
? childVal
: [childVal]
: parentVal;
return res
? dedupeHooks(res)
: res
} |
Convert Stringformatted options into Objectformatted ones | function createOptions( options ) {
var object = {};
jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
object[ flag ] = true;
} );
return object;
} |
Partial class which not works on its own | createMultiplayerIO() {
this.socket.on("pong", (pingTimestamp) => {
var pongTimestamp = Date.now();
var ping = pongTimestamp - pingTimestamp;
this.events.emit('ping', ping);
});
this.otherPlayers = this.physics.add.group();
this.socket.on('currentPlayers', function (data) {
this.createAllPlayers(... |
Create an data object exposed by 's events | function createCoreData(draggable /*: DraggableCore*/, x /*: number*/, y /*: number*/) /*: DraggableData*/ {
var state = draggable.state;
var isStart = !(0, _shims.isNum)(state.lastX);
var node = findDOMNode(draggable);
if (isStart) {
// If this is our first move, use the x and y as last coords.
return... |
Attach a set of options to widget | setOption(internal_name, option) {
if (IsString(internal_name, true) && IsObject(option)) {
PopLog.info(this.name, `Option set for ${internal_name}`, option);
this.asset.option.set(internal_name, option);
}
} |
Grabs the external_id from the Pivotal API | function getExternalId(story) {
$.ajax({
url: pivotalProjectUrl + "/stories/" + story.getAttribute('data-id'),
async: false,
dataType: 'json',
success: function(data) {
id = data.external_id;
if(id !== null) {
jiraUrl = jiraBase + id;
... |
So we can use nice names | isWorseThan(other) {
return !this.isBetterThan(other);
} |
Creates the mail body and encodes it to base64 format. | makeBody(){
// an object for mail
let mail;
mail = new mailComposer({
to: this.to,
text: this.body,
subject: this.sub,
textEncoding: "base64"
});
//Compiles and encodes the mail.
mail.compile().build((err, msg) => {
if (err){
return console.log('Error compiling email ' + error);
}
... |
FROM, SELECT, WHERE, ORDERBY, CALLBACK | static findOneWhereOrder(from, select, where, orderBy, callback) {
findOne(from, where, select, orderBy, callback);
} |
Fetch an image (html img snippet with inline base64 src attribute) snippet and save the image as file | function fetchImage2base64 (path, dest, key) {
return limitedFetch(`${domain}${path}`)
.then(r=>r.buffer())
.then(buf=>{
const imgdom = new JSDOM(buf);
const src = imgdom.window.document.querySelector('img').getAttribute('src');
const imageBuffer = decodeBase64Ima... |
Display path on map, along with markers for start and end waypoints, and for the next waypoint. | displayPath()
{
// Show start and end waypoints.
let startMarker = new google.maps.Marker({
position: this._navPath.waypoints[0],
map: this._map,
icon: {
path: google.maps.SymbolPath.CIRCLE,
scale: 5,
fillCo... |
Instance of the element is created/upgraded. Use: initializing state, set up event listeners, create shadow dom. | constructor() {
super();
} |
Compute the average with .forEach() | function average(numbers) {
let sum = 0;
numbers.forEach(function(arrNum) {
sum = arrNum += sum;
});
let arrAvg = sum/numbers.length;
return arrAvg;
} |
helper function to make title case | function toTitleCase(str)
{
return str.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
} |
Return the PKCS1 RSA encryption of "text" as an evenlength hex string | function RSAEncrypt(text) {
var m = pkcs1pad2(text,(this.n.bitLength()+7)>>3);
if(m == null) return null;
var c = this.doPublic(m);
if(c == null) return null;
var h = c.toString(16);
if((h.length & 1) == 0) return h; else return "0" + h;
} |
LOGIC TO DELETE COURSE | function deleteCourse() {
let courseId = $(this).attr('data-id');
coursesService.deleteCourse(courseId)
.then(() => {
showInfo('Course deleted.');
loadMyCourses();
// showView('Catalog');
}).catch(handleError);
} |
Fill the formatted Salutation in the Form | fillForm(fSalut) {
this.salutationForm.setValue({
firstname: fSalut.firstname,
gender: fSalut.gender,
// language: fSalut.language,
language: this.convertLanguage(fSalut.language),
lastname: fSalut.lastname,
letterSalutation: fSalut.letterS... |
check if the heap is empty | isEmpty() {
return this.heap.length === 0;
} |
logic function calculate which numbers to replace with fizz/buzz | function fizzBuzz(fizz, buzz) {
// initialize an array to hold our results
let resultsArray = [];
// use a for loop to replace words divisable by 3, 5, or both with fizz, buzz, or fizzbuzz respectively
// use the continue statement to exit the current iteration of the for loop and continue to the next
... |
Produces a GraphQL Value AST given a JavaScript value. A GraphQL type must be provided, which will be used to interpret different JavaScript values. | JSON Value | GraphQL Value | | | | | Object | Input Object | | Array | List | | Boolean | Boolean | | String | String / Enum Value | | Number | Int / Float | | Mixed | E... | function astFromValue(value, type) {
// Ensure flow knows that we treat function params as const.
var _value = value;
if (type instanceof _definition.GraphQLNonNull) {
var astValue = astFromValue(_value, type.ofType);
if (astValue && astValue.kind === Kind.NULL) {
return null;
}
return astV... |
Function to put stmts from path in a HTML format with linkouts | function generatePathLinkout(pathArray) {
// Build an html string of the paths
// pathArray is a list of dicts for each edge in the path:
// pathArray[i] gives a dict for the support of edge i
// pathArray[i][stmt type j] is a list of all statements of type j supporting edge i
// pathArray[i][stmt type j][k] ... |
gotoCheckLimit is configured only for [n_item = +1 or 1] it may be extended later | gotoCheckLimit(current_line, n_item, line_limit) {
if (n_item > 0 && current_line < line_limit) {
return true;
}
else if (n_item < 0 && current_line > line_limit) {
return true;
}
else {
return false;
}
} |
Initializes the scene views with the values read from the XML file. | initViews() {
let viewsId = []; //array used for interface cameras dropdown
for (var key in this.graph.views) {
if (this.graph.views.hasOwnProperty(key)) {
var view = this.graph.views[key];
if (view.type === "ortho") {
let v = new CGFcame... |
Alert if clicked on outside of ul list and menu button | function handleClickOutside(event) {
if (ref.current && !ref.current.contains(event.target) && menuButtonRef.current && !menuButtonRef.current.contains(event.target) && props.isColumnNavBarDisplayed) {
// If outside, then close the ul list
props.requireColumnNavBarDisplayedToggle();
... |
format date using native date object | function formatMoment(m, format) {
if (!m.isValid()) {
return m.localeData().invalidDate();
}
format = expandFormat(format, m.localeData());
formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format);
return formatFunctions[format](m);
} |
public function avialble for evryone just like function prototype | greet() {
console.log('hello' + ' ' + this.firstname + ' ' + this.lastname);
} |
Helper that calls fromDotSeparatedString() but wraps any error thrown. | function fieldPathFromArgument(methodName, path) {
if (path instanceof FieldPath$1) {
return path._internalPath;
}
else if (typeof path === 'string') {
return fieldPathFromDotSeparatedString(methodName, path);
}
else {
var message = 'Field path arguments must be of ty... |
TODO optimise for this common case | function interpolate(from, to, direction, stream) {
circleStream(stream, radius, delta, direction, from, to);
} |
replace this once we get the database in place | function getRegularCustomerAccountsAndValue(jsonFeed){
var regValues = new Array(4);
regValues[0] = jsonFeed[3];
regValues[1] = jsonFeed[4];
regValues[2] = jsonFeed[1];
regValues[3] = jsonFeed[1];
return regValues;
} |
zeros(number, size) {
var stringNumber = String(number);
while(stringNumber.length < (size || 2)) {
stringNumber = '0' + stringNumber;
}
return stringNumber;
} | to make score 6 zeros |
function verNotaRecibida(nroNotaRec, nameArchivo) {
var URL = getUrlApp() + "/DownloadServlet?tipo=VER_NOTA_REC&nroNotaRec=" + nroNotaRec + "&nameArchivo=" + nameArchivo + TAB_ID_REQUEST;
/*
window.status = URL;
var w = window.open(URL,"Memo","width=" + ancho + ",height=" + alto + ",top=" + posX + ",le... | Esta funcion se usa para ver la nota recibida en la consulta de notas recibida |
function updateTopics(topics) {
topics.forEach(function(d, i) { d.r = Math.max(12, r(d.count)); }); // min. collision
force.nodes(data.topics = topics).start();
updateNodes();
updateLabels();
} | Update the known topics. |
function PlaySfx() {
if (blockSfx) return;
blockSfx = true;
audio.PlayOneShot(swingSfx,1.0);
yield WaitForSeconds(swingSfx.length);
blockSfx = false;
} | play sound of swing |
function ResetBoard() {
var allSquares = $(".square");
for (var i = 0; i < allSquares.length; i++) {
$(".square:eq(" + i + ")").removeClass('movable');
}
} | Remove movable space promts from each square |
function renderGesture() {
if (!webGl) { return; } // Gesture renders are entirely disabled for canvas renderers (it's just too slow at the moment!)
/*
* Only one gesture is rendered at a time, so first the current gesture - if any - is removed.
*/
clearGesture();
/*
* The LeapTrainer controller s... | This function is called when a training gesture is saved and when a gesture is recognized. It depends on the LeapTrainer Controller providing a renderableGesture array. |
constructor(id, admins) {
super(id, 'IT'); // calls the constructor of the base class
// must call super before using the 'this' keyword
this.admins = admins;
} | will use base class constructor by default |
deleteOne(condition, cb) {
orm.deleteOne(
'burgers',
condition, (res) => cb(res)
);
} | Deletes a burger from the table |
function walk(node, fn) {
const queue = [node]
while (queue.length) {
const next = queue.shift()
if (fn(next) !== false) {
Array.from(next.children, (c) => queue.push(c))
}
}
} | Breadthfirst node tree walk. Doesn't recurse into child when the callback fn returns false |
get id() {
return this.constructor.id;
} | Way to get a static property without explicitly specifying the class |
function addDeletedOrLocalIndex(txn, callback) {
var docStore = txn.objectStore(DOC_STORE);
docStore.createIndex('deletedOrLocal', 'deletedOrLocal', {unique : false});
docStore.openCursor().onsuccess = function (event) {
var cursor = event.target.result;
if (cursor) {
var metadata = cur... | migration to version 2 unfortunately "deletedOrLocal" is a misnomer now that we no longer store local docs in the main docstore, but whaddyagonnado |
function updatesHandler() {
let apiKey = localStorage.getItem("apiKey");
// include @bookId
let title = document.getElementById(titleFieldId).value;
let author = document.getElementById(authorFieldId).value;
let category = document.getElementById(categoryFieldId).value;
let file = document.getEl... | view update complete handle changes |
function TimeoutNextClickCheck(tot) {
if(IsRadioClick==false) {
// BMOD: use confirm instead of alert
// alert("You did not click on an answer");
// return false;
if(!confirm("Proceed without answer?")) {
return false;
}
}
// alert("new func");
var checked = 0;
for(nn = 0; nn < tot; nn++) {
if(document.Q... | BRENDAN MOD: NEW FUNCTION |
function endOperations(group) {
var ops = group.ops;
for (var i = 0; i < ops.length; i++) // Read DOM
{ endOperation_R1(ops[i]); }
for (var i$1 = 0; i$1 < ops.length; i$1++) // Write DOM (maybe)
{ endOperation_W1(ops[i$1]); }
for (var i$2 = 0; i$2 < ops.length; i$2++) // Read DOM
{ end... | The DOM updates done when an operation finishes are batched so that the minimum number of relayouts are required. |
function translateError(err, result) {
if (!err) {
return this.resolve(result);
}
if (typeof err === 'object') {
if (err instanceof Error) {
return this.reject(ret);
}
return this.reject(Object.assign(new Error(err.message), { errCode: err.errCode }));
} else ... | Used only with promisify. Transform callback to promise result. |
constructor(x, y) {
this.x = x;
this.y = y;
} | creates conservation at x, y with type x, y are given in coordinates from 0 to 1 |
function drawLayer(destinationTexture, layer) {
// if isColor = true
if(layer.isColor){
drawColorOnMask(destinationTexture, layer);
texture.needsUpdate = true;
}
// if isColor = false
else if (!layer.isColor) {
drawGraphicOnMask(destinationText... | NEW build layers function |
function allocateInSlot$1(vm, children) {
{
assert$1.invariant(isObject$1$1(vm.cmpSlots), `When doing manual allocation, there must be a cmpSlots object available.`);
}
const {
cmpSlots: oldSlots
} = vm;
const cmpSlots = vm.cmpSlots = create$3(null);
for (let i = 0, len = children.... | NOTE: we should probably more this routine to the synthetic shadow folder and get the allocation to be cached by in the elm instead of in the VM |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.