Credit goes to @btford
19762
function cancelableify(promise) {
      promise.cancel = cancel;
      var then = promise.then;
      promise.then = function() {
        var newPromise = then.apply(this, arguments);
        return cancelableify(newPromise);
      };
      return promise;
    }
1177366
def first_filtered_bt_line(backtrace)
      ((fbt = backtrace.filtered).empty? ? backtrace : fbt).first.to_s
    end
19024
def _nbtt(self):
        
        from .cache import HistoryError
        branch, turn, tick = self._btt()
        tick += 1
        if (branch, turn) in self._turn_end_plan:
            if tick > self._turn_end_plan[branch, turn]:
                self._turn_end_plan[branch, turn] = tick
            else:
                tick = self._turn_end_plan[branch, turn] + 1
        self._turn_end_plan[branch, turn] = tick
        if self._turn_end[branch, turn] > tick:
            raise HistoryError(
                "You're not at the end of turn {}. Go to tick {} to change things".format(
                    turn, self._turn_end[branch, turn]
                )
            )
        parent, turn_start, tick_start, turn_end, tick_end = self._branches[branch]
        if turn < turn_end or (
            turn == turn_end and tick < tick_end
        ):
            raise HistoryError(
                "You're in the past. Go to turn {}, tick {} to change things".format(turn_end, tick_end)
            )
        if self._planning:
            if (turn, tick) in self._plan_ticks[self._last_plan]:
                raise HistoryError(
                    "Trying to make a plan at {}, but that time already happened".format((branch, turn, tick))
                )
            self._plan_ticks[self._last_plan][turn].append(tick)
            self._plan_ticks_uncommitted.append((self._last_plan, turn, tick))
            self._time_plan[branch, turn, tick] = self._last_plan
        self._otick = tick
        return branch, turn, tick
1097786
def credit(amount)
      credit = Credit.new(:amount => amount)
      result = api_request(:post, "/subscribers/#{self.customer_id}/credits.xml", :body => credit.to_xml)
      self.store_credit = (self.store_credit || 0) + amount
      true
    end
1103412
function bnBitCount() {
  var this_array = this.array;
  var r = 0, x = this.s&BI_DM;
  for(var i = 0; i < this.t; ++i) r += cbit(this_array[i]^x);
  return r;
}
1314252
function getFollowers(T, user_id, max_followers, finish) {
  return getFollowersIt(T, user_id, [], -1, max_followers, finish);
}
477024
async function() {
    const oThis = this
      , existingBrandedTokens = await oThis._loadBrandedTokenConfig()
    ;
    for (var uuid in existingBrandedTokens) {
      var brandedToken = existingBrandedTokens[uuid];
      if (oThis.btName.equalsIgnoreCase(brandedToken.Name)) {
        logger.error("* Branded token name already registered and present in BT config file");
        process.exit(1);
      }
      if (oThis.btSymbol.equalsIgnoreCase(brandedToken.Symbol)) {
        logger.error("* Branded token symbol already registered and present in BT config file");
        process.exit(1);
      }
    }
    return true;
  }
297881
function apply_credit() {
    global $db, $insert_id;
    $cc_id = $_SESSION['cc_id'];
    if ($this->deduction !=0) {
      $db->Execute("insert into " . TABLE_COUPON_REDEEM_TRACK . "
                    (coupon_id, redeem_date, redeem_ip, customer_id, order_id)
                    values ('" . (int)$cc_id . "', now(), '" . $_SERVER['REMOTE_ADDR'] . "', '" . (int)$_SESSION['customer_id'] . "', '" . (int)$insert_id . "')");
    }
    $_SESSION['cc_id'] = "";
  }
275170
def getRemainingCredits(self):
        

        if 'status' in self._response.keys():
            if (self._response['status'] is not None) and ('remaining_credits' in self._response['status'].keys()):
                if self._response['status']['remaining_credits'] is not None:
                    return self._response['status']['remaining_credits']
                else:
                    return ''
            else:
                print("Not remaining credits field\n")
        else:
            return None
1245749
function getNpmCredits(packagePath, credits) {
	const directoryPath = path.dirname(packagePath);
	const name = path.basename(path.dirname(packagePath));

	if (
		name[0] !== '.' && (
			fs.lstatSync(directoryPath).isDirectory() ||
			fs.lstatSync(directoryPath).isSymbolicLink()
		)
	) {
		const packageJson = packageUtil.readJSONSync(packagePath);

		const author = packageUtil.getAuthor(packageJson);
		const maintainers = packageUtil.getMaintainers(packageJson);

		if (author) {
			credits = creditUtil.addCreditToCredits(credits, author, name);
		}

		if (maintainers) {
			maintainers.forEach(maintainer => {
				credits = creditUtil.addCreditToCredits(credits, maintainer, name);
			});
		}
	}

	return credits;
}
1110484
function (btnName) {
            var t = this,
                prefix = t.o.prefix,
                btn = t.btnsDef[btnName],
                hasIcon = btn.hasIcon != null ? btn.hasIcon : true;

            if (btn.key) {
                t.keys[btn.key] = {
                    fn: btn.fn || btnName,
                    param: btn.param || btnName
                };
            }

            t.tagToButton[(btn.tag || btnName).toLowerCase()] = btnName;

            return $('<button/>', {
                type: 'button',
                class: prefix + btnName + '-dropdown-button ' + (btn.class || '') + (btn.ico ? ' ' + prefix + btn.ico + '-button' : ''),
                html: t.hasSvg && hasIcon ?
                  '<svg><use xlink:href="' + t.svgPath + '#' + prefix + (btn.ico || btnName).replace(/([A-Z]+)/g, '-$1').toLowerCase() + '"/></svg>' + (btn.text || btn.title || t.lang[btnName] || btnName) :
                  (btn.text || btn.title || t.lang[btnName] || btnName),
                title: (btn.key ? '(' + (t.isMac ? 'Cmd' : 'Ctrl') + ' + ' + btn.key + ')' : null),
                style: btn.style || null,
                mousedown: function () {
                    $('body', t.doc).trigger('mousedown');

                    t.execCmd(btn.fn || btnName, btn.param || btnName, btn.forceCss);

                    return false;
                }
            });
        }
823189
function bgen(lbl, dsc){
		    var b = new bbop.html.button(
  			lbl,
			{
			    'generate_id': true,
			    'type': 'button',
			    'title': dsc || lbl,
			    //'class': 'btn btn-default btn-xs'
			    'class': 'btn btn-primary btn-xs'
			});
		    return b;
		}
1081876
function ze(pt,ut,bt,ht){var It=pt.indexOf("."),At=We,wt=Xe,mt,yt,_t,vt,xt,St,kt;// Remove trailing zeros.
for(37>bt&&(pt=pt.toLowerCase()),0<=It&&(_t=dt,dt=0,pt=pt.replace(".",""),kt=new Le(bt),xt=kt.pow(pt.length-It),dt=_t,kt.c=ue(he(ce(xt.c),xt.e),10,ut),kt.e=kt.c.length),St=ue(pt,bt,ut),yt=_t=St.length;0==St[--_t];St.pop());if(!St[0])return"0";if(0>It?--yt:(xt.c=St,xt.e=yt,xt.s=ht,xt=qe(xt,kt,At,wt,ut),St=xt.c,vt=xt.r,yt=xt.e),mt=yt+At+1,It=St[mt],_t=ut/2,vt=vt||0>mt||null!=St[mt+1],vt=4>wt?(null!=It||vt)&&(0==wt||wt==(0>xt.s?3:2)):It>_t||It==_t&&(4==wt||vt||6==wt&&1&St[mt-1]||wt==(0>xt.s?8:7)),1>mt||!St[0])pt=vt?he("1",-At):"0";else{if(St.length=mt,vt)// Rounding up may mean the previous digit has to be rounded up and so on.
for(--ut;++St[--mt]>ut;)St[mt]=0,mt||(++yt,St.unshift(1));// Determine trailing zeros.
for(_t=St.length;!St[--_t];);// E.g. [4, 11, 15] becomes 4bf.
for(It=0,pt="";It<=_t;pt+=Pe.charAt(St[It++]));pt=he(pt,yt)}// The caller will add the sign.
return pt}
928135
function _btoa (b) {
   if (b) {
      return  btoa(String.fromCharCode.apply(null, b));
   } else {
      return null;
   }
}
617713
function bnBitCount() {
var r = 0, x = this.s&this.DM;
for(var i = 0; i < this.t; ++i) r += cbit(this.data[i]^x);
return r;
}
1318048
def comment_sent(comment)
      users = ::User.all.select {|user| user.is_admin? || user.can_review?}
      bcc = users.map {|user| user.email}
      @comment = comment
      @who_name = comment.user.profile.name
      mail bcc: bcc, subject: 'CFP MagmaConf - New comment'
    end
1199058
private void bracketProcessB(BracketData bd, byte level) {
        bd.isoRunLast = 0;
        bd.isoRuns[0].limit = 0;
        bd.isoRuns[0].level = level;
        bd.isoRuns[0].lastStrong = bd.isoRuns[0].lastBase = bd.isoRuns[0].contextDir = (byte)(level & 1);
        bd.isoRuns[0].contextPos = 0;
    }