text
stringlengths
16
4.96k
positive
stringlengths
321
2.24k
negative
stringlengths
310
2.21k
Order feedback by most recent
from django import forms from django.contrib import admin from feedback.models import Feedback class FeedbackAdminForm(forms.ModelForm): class Meta: model = Feedback fields = '__all__' widgets = { 'comments': forms.Textarea(attrs={'cols': 80, 'rows': 5}), 'user_age...
from django import forms from django.contrib import admin from feedback.models import Feedback class FeedbackAdminForm(forms.ModelForm): class Meta: model = Feedback fields = '__all__' widgets = { 'comments': forms.Textarea(attrs={'cols': 80, 'rows': 5}), 'user_age...
Make the room and teacher columns of TEXT type
package com.satsumasoftware.timetable.db; import android.provider.BaseColumns; import com.satsumasoftware.timetable.db.util.SchemaUtilsKt; public final class ClassDetailsSchema implements BaseColumns { public static final String TABLE_NAME = "class_details"; public static final String COL_CLASS_ID = "class_...
package com.satsumasoftware.timetable.db; import android.provider.BaseColumns; import com.satsumasoftware.timetable.db.util.SchemaUtilsKt; public final class ClassDetailsSchema implements BaseColumns { public static final String TABLE_NAME = "class_details"; public static final String COL_CLASS_ID = "class_...
Fix syncdb in database router
from .settings import CONNECTION_NAME class Log4DjangoRouter(object): def db_for_read(self, model, **hints): if model._meta.app_label == 'log4django': return CONNECTION_NAME return None def db_for_write(self, model, **hints): if model._meta.app_label == 'log4django': ...
from .settings import CONNECTION_NAME class Log4DjangoRouter(object): def db_for_read(self, model, **hints): if model._meta.app_label == 'log4django': return CONNECTION_NAME return None def db_for_write(self, model, **hints): if model._meta.app_label == 'log4django': ...
Handle when no moduleDependencies delcared.
'use strict'; module.exports = function (gulp, gutil) { var scripts = require('../lib/scripts.js')(gulp, gutil); gulp.task('scripts', ['scripts-main', 'scripts-tpls', 'scripts-deps', 'scripts-deps-metadata']); gulp.task('scripts-main', function () { return scripts.processScripts(scripts.JS_MAIN_PATTERN, sc...
'use strict'; module.exports = function (gulp, gutil) { var scripts = require('../lib/scripts.js')(gulp, gutil); gulp.task('scripts', ['scripts-main', 'scripts-tpls', 'scripts-deps', 'scripts-deps-metadata']); gulp.task('scripts-main', function () { return scripts.processScripts(scripts.JS_MAIN_PATTERN, sc...
Remove a fixed module ID
<?php namespace filsh\yii2\oauth2server; /** * Instead use bootstrap module * should be removed in v2.1 version * * @deprecated v2.0.1 */ class Bootstrap implements \yii\base\BootstrapInterface { use BootstrapTrait; /** * @inheritdoc */ public function bootstrap($app) { /*...
<?php namespace filsh\yii2\oauth2server; /** * Instead use bootstrap module * must be removed in v2.1 * * @deprecated v2.0.1 */ class Bootstrap implements \yii\base\BootstrapInterface { use BootstrapTrait; /** * @inheritdoc */ public function bootstrap($app) { /** @var $mo...
Add support for --token in login command This can be used when you already have the token and do not want to open the browser.
import click import webbrowser import floyd from floyd.client.auth import AuthClient from floyd.manager.auth_config import AuthConfigManager from floyd.model.access_token import AccessToken from floyd.log import logger as floyd_logger @click.command() @click.option('--token', is_flag=True, default=False, help='Just ...
import click import webbrowser import floyd from floyd.client.auth import AuthClient from floyd.manager.auth_config import AuthConfigManager from floyd.model.access_token import AccessToken from floyd.log import logger as floyd_logger @click.command() def login(): """ Log into Floyd via Auth0. """ cl...
Clear trades from old search from data viewer before adding new ones
package uk.ac.cam.cstibhotel.otcanalyser.gui; import java.awt.BorderLayout; import javax.swing.JFrame; import uk.ac.cam.cstibhotel.otcanalyser.communicationlayer.SearchListener; import uk.ac.cam.cstibhotel.otcanalyser.communicationlayer.SearchResult; public class GUI extends JFrame implements SearchListener { pri...
package uk.ac.cam.cstibhotel.otcanalyser.gui; import java.awt.BorderLayout; import javax.swing.JFrame; import uk.ac.cam.cstibhotel.otcanalyser.communicationlayer.SearchListener; import uk.ac.cam.cstibhotel.otcanalyser.communicationlayer.SearchResult; public class GUI extends JFrame implements SearchListener { pri...
Write .msg of chunk to file
#!/usr/bin/env python """ This example demonstrates a client fetching images from a server running img_server.py. The first packet contains the number of chunks to expect, and then that number of chunks is read. Lost packets are not handled in any way. """ from nuts import UDPAuthChannel channel = UDPAu...
#!/usr/bin/env python """ This example demonstrates a client fetching images from a server running img_server.py. The first packet contains the number of chunks to expect, and then that number of chunks is read. Lost packets are not handled in any way. """ from nuts import UDPAuthChannel channel = UDPAu...
Allow creation of the first famous user.
package edu.brown.hackathon.fifteenminutes; import java.io.IOException; import java.util.List; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.google.appengine.api.datastore.DatastoreService; import com.google.appengine.ap...
package edu.brown.hackathon.fifteenminutes; import java.io.IOException; import java.util.List; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.google.appengine.api.datastore.DatastoreService; import com.google.appengine.ap...
Remove usage of dump component.
import React, { Component } from "react"; import { connect } from "react-redux"; import { SCREEN_STATE_PAGE_ENTER, SCREEN_STATE_PAGE_EXIT } from "../screen/action"; @connect( state => { return { screenAnimation: state.screen.animation }; }) export default class Transition extends Component { animationSta...
import React, { Component } from "react"; import { connect } from "react-redux"; import { SCREEN_STATE_PAGE_ENTER, SCREEN_STATE_PAGE_EXIT } from "../screen/action"; import Dumb from "./dumb"; @connect( state => { return { screenAnimation: state.screen.animation }; }) export default class Transition extend...
Use /download as core download route.
<?php /** * Copyright Zikula Foundation 2014 - Zikula Application Framework * * This work is contributed to the Zikula Foundation under one or more * Contributor Agreements and licensed to You under the following license: * * @license MIT * * Please see the NOTICE file distributed with this source code for furt...
<?php /** * Copyright Zikula Foundation 2014 - Zikula Application Framework * * This work is contributed to the Zikula Foundation under one or more * Contributor Agreements and licensed to You under the following license: * * @license MIT * * Please see the NOTICE file distributed with this source code for furt...
Change exception to more appropriate
<?php namespace X509\GeneralName; class IPv4Address extends IPAddress { /** * Initialize from octets * * @param string $octets * @throws \InvalidArgumentException * @return self */ public static function fromOctets($octets) { $ip = null; $mask = null; $bytes = unpack("C*", $octets); switch (cou...
<?php namespace X509\GeneralName; class IPv4Address extends IPAddress { /** * Initialize from octets * * @param string $octets * @throws \InvalidArgumentException * @return self */ public static function fromOctets($octets) { $ip = null; $mask = null; $bytes = unpack("C*", $octets); switch (cou...
Apply only for walkable contents.
<?php /** * BEAR.Framework * * @license http://opensource.org/licenses/bsd-license.php BSD */ namespace BEAR\Framework\Resource\View; use BEAR\Resource\Object as ResourceObject; use BEAR\Resource\Requestable; use BEAR\Resource\Renderable; /** * Request renderer * * @package BEAR.Framework * @subpackage Vie...
<?php /** * BEAR.Framework * * @license http://opensource.org/licenses/bsd-license.php BSD */ namespace BEAR\Framework\Resource\View; use BEAR\Resource\Object as ResourceObject; use BEAR\Resource\Requestable; use BEAR\Resource\Renderable; /** * Request renderer * * @package BEAR.Framework * @subpackage Vie...
Change column's name and add a foreign key for the vehicles_colors table
<?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateVehiclesTable extends Migration { /** * Run the migrations. */ public function up() { Schema::create('vehicles', function (Blueprint $table) { $table->string('code'); ...
<?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateVehiclesTable extends Migration { /** * Run the migrations. */ public function up() { Schema::create('vehicles', function (Blueprint $table) { $table->string('code'); ...
Make sure we're testing the right function!
import pytest import pytz from astral import LocationInfo class TestLocationInfo: def test_Default(self): loc = LocationInfo() assert loc.name == "Greenwich" assert loc.region == "England" assert loc.timezone == "Europe/London" assert loc.latitude == pytest.approx(51.4733, ...
import pytest import pytz from astral import LocationInfo class TestLocationInfo: def test_Default(self): loc = LocationInfo() assert loc.name == "Greenwich" assert loc.region == "England" assert loc.timezone == "Europe/London" assert loc.latitude == pytest.approx(51.4733, ...
Format file with python Black
#!/usr/bin/env python # encoding: utf-8 """ Created on Aug 29, 2014 @author: tmahrt """ from setuptools import setup import io setup( name="praatio", version="4.2.1", author="Tim Mahrt", author_email="timmahrt@gmail.com", url="https://github.com/timmahrt/praatIO", package_dir={"praatio": "praa...
#!/usr/bin/env python # encoding: utf-8 ''' Created on Aug 29, 2014 @author: tmahrt ''' from setuptools import setup import io setup(name='praatio', version='4.2.1', author='Tim Mahrt', author_email='timmahrt@gmail.com', url='https://github.com/timmahrt/praatIO', package_dir={'praatio':'p...
Add siprefix to runtime dependencies.
from setuptools import setup from os import path here = path.abspath(path.dirname(__file__)) with open(path.join(here, 'README.rst')) as readme_file: long_description = readme_file.read() setup( name='pyfds', description='Modular field simulation tool using finite differences.', long_description=long...
from setuptools import setup from os import path here = path.abspath(path.dirname(__file__)) with open(path.join(here, 'README.rst')) as readme_file: long_description = readme_file.read() setup( name='pyfds', description='Modular field simulation tool using finite differences.', long_description=long...
Remove use of getElement() in example @rev W-3224090@ @rev goliver@
/* * Copyright (C) 2013 salesforce.com, inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable ...
/* * Copyright (C) 2013 salesforce.com, inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable ...
Fix bug. board is property. not but function.
import React from 'react'; import { connect } from 'react-redux'; import pieceComponent from '../components/piece'; import { holdPiece, enhanceCanDropPosition } from '../actions'; import store from '../stores/index'; const mapStateToProps = (state) => { return { }; }; const mapDispatchToProps = (dispatch) => { ...
import React from 'react'; import { connect } from 'react-redux'; import pieceComponent from '../components/piece'; import { holdPiece, enhanceCanDropPosition } from '../actions'; import store from '../stores/index'; const mapStateToProps = (state) => { return { }; }; const mapDispatchToProps = (dispatch) => { ...
Update default client registration implementation
/* * oxCore is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. * * Copyright (c) 2014, Gluu */package org.xdi.model.custom.script.type.client; import java.util.Map; import org.xdi.model.SimpleCustomProperty; /** * Dummy implementation of interface ClientRegistration...
/* * oxCore is available under the MIT License (2008). See http://opensource.org/licenses/MIT for full text. * * Copyright (c) 2014, Gluu */package org.xdi.model.custom.script.type.client; import java.util.Map; import org.xdi.model.SimpleCustomProperty; /** * Dummy implementation of interface ClientRegistration...
Use PORT env var with 5000 fallback Makes more sense IMO since the example site uses PORT=3000 but not this generated website, and 5000 seems to be the default of `tux-scripts start`. This approach solves both issues really, since it allows the user to set their own port, or just use the default.
import React from 'react' import createContentfulAdapter from 'tux-adapter-contentful' import tux from './middleware/tux' import history from 'react-chain-history' import createReactChain from 'react-chain' import Home from './home' import './index.css' const publicUrl = process.env.PUBLIC_URL ? process.env.PUBLIC_UR...
import React from 'react' import createContentfulAdapter from 'tux-adapter-contentful' import tux from './middleware/tux' import history from 'react-chain-history' import createReactChain from 'react-chain' import Home from './home' import './index.css' const publicUrl = process.env.PUBLIC_URL ? process.env.PUBLIC_UR...
Add an additional property assayStr SVN-Revision: 7349
package gov.nih.nci.calab.dto.workflow; public class AssayBean { private String assayId; private String assayName; private String assayType; private String assayStr; public AssayBean(String assayId, String assayName, String assayType) { super(); // TODO Auto-generated constructor stub this.assayId = ass...
package gov.nih.nci.calab.dto.workflow; public class AssayBean { private String assayId; private String assayName; private String assayType; public AssayBean(String assayId, String assayName, String assayType) { super(); // TODO Auto-generated constructor stub this.assayId = assayId; this.assayName = a...
Rename bootstrap-sass Gulp task to 'sass'
var gulp = require('gulp'); var sass = require('gulp-sass'); // Common paths. var paths = { BootstrapSCSS: 'priv/assets/bootstrap-custom/bootstrap-custom.scss', BootstrapInclude: 'priv/components/bootstrap-sass/assets/stylesheets', } // Build admin CSS from SASS/CSS gulp.task('sass', function() { return g...
var gulp = require('gulp'); var sass = require('gulp-sass'); // Common paths. var paths = { BootstrapSCSS: 'priv/assets/bootstrap-custom/bootstrap-custom.scss', BootstrapInclude: 'priv/components/bootstrap-sass/assets/stylesheets', } // Build admin CSS from SASS/CSS gulp.task('bootstrap-sass', function() { ...
Update modal creator with new heading markup.
<?php /** * Snippet for displaying a Campaign's creator property, which is an array. * * For available variables: * @see dosomething_campaign_load(). */ ?> <div class="promotion promotion--creator"> <a class="wrapper" href="#" data-modal-href="#modal--creator"> <p class="__copy"><?php print t('Created by');...
<?php /** * Snippet for displaying a Campaign's creator property, which is an array. * * For available variables: * @see dosomething_campaign_load(). */ ?> <div class="promotion promotion--creator"> <a class="wrapper" href="#" data-modal-href="#modal--creator"> <p class="__copy"><?php print t('Created by');...
Add class docblock explaining the dependency on the LocaleListener
<?php namespace OpenConext\EngineBlockBridge\EventListener; use EngineBlock_ApplicationSingleton; use OpenConext\EngineBlockBundle\Localization\LocaleProvider; use Zend_Translate_Adapter; /** * This listener depends on the LocaleListener in the EngineBlockBundle, so the priority should be set so that it is * calle...
<?php namespace OpenConext\EngineBlockBridge\EventListener; use EngineBlock_ApplicationSingleton; use OpenConext\EngineBlockBundle\Localization\LocaleProvider; use Zend_Translate_Adapter; final class SetCortoTranslationsLocaleListener { /** * @var LocaleProvider */ private $localeProvider; /**...
Remove non required if else statement
package com.catpeds.rest.resource; import java.util.Objects; import org.springframework.hateoas.ResourceSupport; import com.catpeds.model.Pedigree; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; /** * {@link Pedigree}'s {@link ResourceSupport} * * @auth...
package com.catpeds.rest.resource; import java.util.Objects; import org.springframework.hateoas.ResourceSupport; import com.catpeds.model.Pedigree; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; /** * {@link Pedigree}'s {@link ResourceSupport} * * @auth...
Split line to avoid flake8 warning
from comics.aggregator.crawler import CrawlerBase, CrawlerImage from comics.core.comic_data import ComicDataBase class ComicData(ComicDataBase): name = 'GU Comics' language = 'en' url = 'http://www.gucomics.com/' start_date = '2000-07-10' rights = 'Woody Hearn' class Crawler(CrawlerBase): hi...
from comics.aggregator.crawler import CrawlerBase, CrawlerImage from comics.core.comic_data import ComicDataBase class ComicData(ComicDataBase): name = 'GU Comics' language = 'en' url = 'http://www.gucomics.com/' start_date = '2000-07-10' rights = 'Woody Hearn' class Crawler(CrawlerBase): hi...
Make the comment be concise
//Require Module var log4js = require('log4js'); var logger = log4js.getLogger('Logging'); /** * Excute mysql query and return the result. * * @Param {Object} db * @Param {String} query * @Param {function} callback * @Return {Object['affectedRows']} r * @Return {Object} err */ function excuteMySQLQuery (db,qu...
//Require Module var log4js = require('log4js'); var logger = log4js.getLogger('Logging'); function excuteMySQLQuery (db,query,callback){ /** * Receive the database connection, query and callback function, * Then show the query which will be test at first. * After that, excute the query. * If...
Increment minor version to 2.13 to prepare for a new release. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=155003222
/** * Copyright 2015 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by appli...
/** * Copyright 2015 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by appli...
Add save as pdf feature.
import sublime, sublime_plugin import os import re from subprocess import call from .mistune import markdown HTML_START = '<!DOCTYPE html><html><head><meta charset="utf-8"></head><body>' HTML_END = '</body></html>' class CreateMinuteCommand(sublime_plugin.TextCommand): def run(self, edit): region = sublime.Region...
import sublime, sublime_plugin import os import re from .mistune import markdown HTML_START = '<!DOCTYPE html><html><head><meta charset="utf-8"></head><body>' HTML_END = '</body></html>' class CreateMinuteCommand(sublime_plugin.TextCommand): def run(self, edit): region = sublime.Region(0, self.view.size()) md_s...
Change label 'Create Property' to 'Add Property'.
<?php use yii\helpers\Html; use yii\grid\GridView; /* @var $this yii\web\View */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = 'Properties'; $this->params['breadcrumbs'][] = $this->title; ?> <div class="property-index"> <h1><?= Html::encode($this->title) ?></h1> <p> <?= Html::...
<?php use yii\helpers\Html; use yii\grid\GridView; /* @var $this yii\web\View */ /* @var $dataProvider yii\data\ActiveDataProvider */ $this->title = 'Properties'; $this->params['breadcrumbs'][] = $this->title; ?> <div class="property-index"> <h1><?= Html::encode($this->title) ?></h1> <p> <?= Html::...
Improve confidence interval test code
package imagej.data.autoscale; import static org.junit.Assert.assertEquals; import net.imglib2.img.Img; import net.imglib2.img.array.ArrayImgs; import net.imglib2.ops.util.Tuple2; import net.imglib2.type.numeric.RealType; import net.imglib2.type.numeric.integer.ByteType; import org.junit.Test; import org.scijava.Cont...
package imagej.data.autoscale; import static org.junit.Assert.assertTrue; import net.imglib2.img.Img; import net.imglib2.img.array.ArrayImgs; import net.imglib2.ops.util.Tuple2; import net.imglib2.type.numeric.RealType; import net.imglib2.type.numeric.integer.ByteType; import org.junit.Test; import org.scijava.Contex...
Add mail_certificate which sends email with flask-mail Replace COMMAND_MAIL. Send certs from /etc/openvpn/client/ Use template /templates/mail.txt
#!/usr/bin/env python # -*- coding: utf-8 -*- import datetime from subprocess import call from ca import app, db from ca.models import Request from flask import Flask, render_template from flask_mail import Mail, Message def mail_certificate(id, email): msg = Message('Freifunk Vpn03 Key', sender = 'no-reply@ca...
#!/usr/bin/env python # -*- coding: utf-8 -*- import datetime from subprocess import call from ca import app, db from ca.models import Request for request in Request.query.filter(Request.generation_date == None).all(): # noqa prompt = "Do you want to generate a certificate for {}, {} ?" print(prompt.format(...
Include a slug for the upcoming event
<?php // Copyright 2019 Peter Beverloo. All rights reserved. // Use of this source code is governed by the MIT license, a copy of which can // be found in the LICENSE file. error_reporting((E_ALL | E_STRICT) & ~E_WARNING); ini_set('display_errors', 1); require __DIR__ . '/../vendor/autoload.php'; require __DIR__ . '/...
<?php // Copyright 2019 Peter Beverloo. All rights reserved. // Use of this source code is governed by the MIT license, a copy of which can // be found in the LICENSE file. error_reporting((E_ALL | E_STRICT) & ~E_WARNING); ini_set('display_errors', 1); require __DIR__ . '/../vendor/autoload.php'; require __DIR__ . '/...
Add default empty code to sensors created through sensor manager
// Default sensor generator. const createSensor = ({ id, macAddress, name, location, batteryLevel, isActive, logInterval }) => ({ id, macAddress, name, location, batteryLevel, isActive, logInterval, }); class SensorManager { constructor(dbService, utils) { this.db = dbService; this.utils = util...
// Default sensor generator. const createSensor = ({ id, macAddress, name, location, batteryLevel, isActive, logInterval }) => ({ id, macAddress, name, location, batteryLevel, isActive, logInterval, }); class SensorManager { constructor(dbService, utils) { this.db = dbService; this.utils = util...
Add markup to table to make AJAX update it.
<?php if(isset($CreateGameMessage)) { echo $CreateGameMessage; } ?> <table class="standard" id="GameList" class="ajax"> <tr> <th>Players</th> <th>Current Turn</th> <th></th> </tr><?php foreach($ChessGames as $ChessGame) { ?> <tr> <td><?php echo $ChessGame->getWhitePlayer()->getLinkedDisplayName(fals...
<?php if(isset($CreateGameMessage)) { echo $CreateGameMessage; } ?> <table class="standard"> <tr> <th>Players</th> <th>Current Turn</th> <th></th> </tr><?php foreach($ChessGames as $ChessGame) { ?> <tr> <td><?php echo $ChessGame->getWhitePlayer()->getLinkedDisplayName(false); ?> vs <?php echo $Chess...
Fix Pref Selection schedule reference
import React, { Component} from 'react'; import { inject, observer } from 'mobx-react'; import TextRow from '../fields/TextRow'; import CheckRow from '../fields/CheckRow'; import CheckValueRow from '../fields/CheckValueRow'; import SelectRow from '../fields/SelectRow'; import { times, days } from './schedule.fixture' ...
import React, { Component} from 'react'; import { inject, observer } from 'mobx-react'; import TextRow from '../fields/TextRow'; import CheckRow from '../fields/CheckRow'; import CheckValueRow from '../fields/CheckValueRow'; import SelectRow from '../fields/SelectRow'; import { times, days } from './schedule' @inject...
Add possibility of custom country list.
<?php session_start(); error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT); define("DOC_ROOT", str_replace("/core/inc", "", str_replace("\\", "/", __DIR__))); require_once(DOC_ROOT."/core/inc/constants.php"); require_once(DOC_ROOT."/core/inc/functions.php"); require_once(filePath("inc/country_list.php")); require_once(DOC_...
<?php session_start(); error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT); define("DOC_ROOT", str_replace("/core/inc", "", str_replace("\\", "/", __DIR__))); require_once(DOC_ROOT."/core/inc/constants.php"); require_once(DOC_ROOT."/core/inc/functions.php"); require_once(DOC_ROOT."/core/inc/country_list.php"); require_once...
Remove dead code in phantomjs server.
"use strict"; var system = require("system"); if (system.args.length < 2) { console.log("Missing arguments."); phantom.exit(); } var url = system.args[1]; var renderHtml = function(url, cb) { var page = require("webpage").create(); var finished = false; page.settings.loadImages = false; page.settings.localToRem...
"use strict"; var system = require("system"); if (system.args.length < 2) { console.log("Missing arguments."); phantom.exit(); } var server = require("webserver").create(); var url = system.args[1]; var renderHtml = function(url, cb) { var page = require("webpage").create(); var finished = false; page.settings...
Increase number of cronjobs on cronjob list page to 100 Close #2953
<?php namespace wcf\acp\page; use wcf\data\cronjob\CronjobList; use wcf\page\SortablePage; /** * Shows information about configured cron jobs. * * @author Alexander Ebert * @copyright 2001-2019 WoltLab GmbH * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> * @package...
<?php namespace wcf\acp\page; use wcf\data\cronjob\CronjobList; use wcf\page\SortablePage; /** * Shows information about configured cron jobs. * * @author Alexander Ebert * @copyright 2001-2019 WoltLab GmbH * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> * @package...
Remove obsolete error class 'DatabaseDriverError'
<?php /* * PHP-Auth (https://github.com/delight-im/PHP-Auth) * Copyright (c) delight.im (https://www.delight.im/) * Licensed under the MIT License (https://opensource.org/licenses/MIT) */ namespace Delight\Auth; class AuthException extends \Exception {} class UnknownIdException extends AuthException {} class I...
<?php /* * PHP-Auth (https://github.com/delight-im/PHP-Auth) * Copyright (c) delight.im (https://www.delight.im/) * Licensed under the MIT License (https://opensource.org/licenses/MIT) */ namespace Delight\Auth; class AuthException extends \Exception {} class UnknownIdException extends AuthException {} class I...
Fix indentation; override old-style start() from BackendBase
from urllib import urlencode from urllib2 import urlopen from rapidsms.backends.base import BackendBase class TropoBackend(BackendBase): """A RapidSMS threadless backend for Tropo""" def configure(self, config=None, **kwargs): self.config = config def start(self): """Override Bac...
from urllib import urlencode from urllib2 import urlopen from rapidsms.backends.base import BackendBase class TropoBackend(BackendBase): """A RapidSMS threadless backend for Tropo""" def configure(self, config=None, **kwargs): self.config = config super(TropoBackend, self).configure(**kwargs) ...
Improve error message and imports
from typing import IO, Text import re from logging import getLogger from io import StringIO import yaml NBSP = "\u00A0" pattern = re.compile(r"^\s*[\u00A0]+\s*", re.MULTILINE) logger = getLogger(__name__) def _replace_nbsp(origdata): counter = 0 def _replacer_func(matchobj): nonlocal counter ...
from typing import IO, Text from re import compile, MULTILINE from logging import getLogger from io import StringIO import yaml NBSP = "\u00A0" pattern = compile(r"^\s*[\u00A0]+\s*", MULTILINE) logger = getLogger(__name__) def _replace_nbsp(origdata): counter = 0 def _replacer_func(matchobj): non...
Select features using classification model
import pandas as pd from sklearn.feature_selection import SelectKBest, f_classif def select_kbest_clf(data_frame, target, k=4): """ Selecting K-Best features for classification :param data_frame: A pandas dataFrame with the training data :param target: target variable name in DataFrame :param k: de...
import pandas as pd from sklearn.feature_selection import SelectKBest, f_classif def select_kbest_clf(data_frame, target, k=4): """ Selecting K-Best features for classification :param data_frame: A pandas dataFrame with the training data :param target: target variable name in DataFrame :param k: de...
Allow to be applied to constructors git-svn-id: e7d6bde23f017c9ff4efd468d79d66def666766b@9919 eae3c2d3-9b19-0410-a86e-396b6ccb6ab3
/* * FindBugs - Find bugs in Java programs * Copyright (C) 2008, University of Maryland * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (...
/* * FindBugs - Find bugs in Java programs * Copyright (C) 2008, University of Maryland * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (...
Format number as string or it errors in some webservers
from django.conf.urls.defaults import * import os.path urlpatterns = patterns('', url(r'^media/(?P<path>.+)?$', 'django.views.static.serve', { 'document_root': os.path.join(os.path.dirname(__file__), 'media'), 'show_indexes': True }, name='media'), url(r'^$', 'overseer.views.index', name=...
from django.conf.urls.defaults import * import os.path urlpatterns = patterns('', url(r'^media/(?P<path>.+)?$', 'django.views.static.serve', { 'document_root': os.path.join(os.path.dirname(__file__), 'media'), 'show_indexes': True }, name='media'), url(r'^$', 'overseer.views.index', name=...
Fix: Align text in code editor with component (remove padding)
import React from 'react'; import PropTypes from 'prop-types'; import Styled from 'rsg-components/Styled'; const styles = ({ fontFamily, color, space, fontSize }) => ({ root: { padding: [[space[1], space[2], space[1], space[1]]], fontFamily: fontFamily.base, fontSize: fontSize.small, color: color.light, bac...
import React from 'react'; import PropTypes from 'prop-types'; import Styled from 'rsg-components/Styled'; const styles = ({ fontFamily, color, space, fontSize }) => ({ root: { padding: [[space[1], space[2], space[1], space[1]]], fontFamily: fontFamily.base, fontSize: fontSize.small, color: color.light, bac...
Expand ~ and ~xxx at the start of filenames.
""" Functions for retrieving strings from files """ import os def string_from_file(string, strip=True): """ Return an unaltered string or the contents of a file if the string begins with @ and the rest of it points at a path. If 'strip' is True, remove leading and trailing whitespace (default beh...
""" Functions for retrieving strings from files """ import os def string_from_file(string, strip=True): """ Return an unaltered string or the contents of a file if the string begins with @ and the rest of it points at a path. If 'strip' is True, remove leading and trailing whitespace (default beh...
Add test to show disk usage ratio per partition.
package com.alibaba.rocketmq.example.verify; import com.alibaba.rocketmq.common.UtilAll; import org.apache.commons.cli.*; public class SelectPartition { public static void main(String[] args) throws ParseException { Options options = new Options(); Option option = new Option("p", "path", true, "P...
package com.alibaba.rocketmq.example.verify; import com.alibaba.rocketmq.common.UtilAll; import org.apache.commons.cli.*; public class SelectPartition { public static void main(String[] args) throws ParseException { Options options = new Options(); Option option = new Option("p", "path", true, "P...
Add Django as a requirement Django>=1.3 is required, although >=1.4.1 is recommended
#!/usr/bin/env python try: from setuptools import setup, find_packages except ImportError: from ez_setup import use_setuptools use_setuptools() from setuptools import setup, find_packages setup( name='django-bleach', version="0.1.3", description='Easily use bleach with Django models and te...
#!/usr/bin/env python try: from setuptools import setup, find_packages except ImportError: from ez_setup import use_setuptools use_setuptools() from setuptools import setup, find_packages setup( name='django-bleach', version="0.1.3", description='Easily use bleach with Django models and te...
Add testCanJsonSerialize test to datetime helper
<?php namespace ZpgRtf\Tests\Helpers; use PHPUnit\Framework\TestCase; use ZpgRtf\Helpers\DateTimeHelper; class DateTimeHelperTest extends TestCase { public function testCanInstantiate() { $this->assertInstanceOf( DateTimeHelper::class, new DateTimeHelper() ); } ...
<?php namespace ZpgRtf\Tests\Helpers; use PHPUnit\Framework\TestCase; use ZpgRtf\Helpers\DateTimeHelper; class DateTimeHelperTest extends TestCase { public function testCanInstantiate() { $this->assertInstanceOf( DateTimeHelper::class, new DateTimeHelper() ); } ...
Remove non existing class name
// Copyright 2020 Google LLC // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // https://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writin...
// Copyright 2020 Google LLC // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // https://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writin...
Fix a test that was broken on some versions of java 8. Will change in the future
package com.novoda.simplechromecustomtabs; import com.novoda.notils.exception.DeveloperError; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import static org.fest.assertions.api.Assertions.assertThat; import static org...
package com.novoda.simplechromecustomtabs; import com.novoda.notils.exception.DeveloperError; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import static org.fest.assertions.api.Assertions.assertThat; @RunWith(Robolec...
Add firstAamcMethod to sessionType model This has been added to the frontend since the extraction happened.
import Ember from 'ember'; import DS from 'ember-data'; const { String:EmberString, computed } = Ember; const { Model, attr, belongsTo, hasMany } = DS; const { htmlSafe } = EmberString; export default Model.extend({ title: attr('string'), calendarColor: attr('string'), active: attr('boolean'), assessment: att...
import Ember from 'ember'; import DS from 'ember-data'; const { String:EmberString, computed } = Ember; const { Model, attr, belongsTo, hasMany } = DS; const { htmlSafe } = EmberString; export default Model.extend({ title: attr('string'), calendarColor: attr('string'), active: attr('boolean'), assessment: att...
Change subscribed events in AvaiabilityEventSubscriber
<?php /* * WellCommerce Open-Source E-Commerce Platform * * This file is part of the WellCommerce package. * * (c) Adam Piotrowski <adam@wellcommerce.org> * * For the full copyright and license information, * please view the LICENSE file that was distributed with this source code. */ namespace WellCommerce\Plu...
<?php /* * WellCommerce Open-Source E-Commerce Platform * * This file is part of the WellCommerce package. * * (c) Adam Piotrowski <adam@wellcommerce.org> * * For the full copyright and license information, * please view the LICENSE file that was distributed with this source code. */ namespace WellCommerce\Plu...
Upgrade to Flask 0.12.3 to fix CVE-2018-1000656
from setuptools import setup with open('README.md') as file: long_description = file.read() setup( name="chalupas-files", version="0.1.0", author="Antonin Messinger", author_email="antonin.messinger@gmail.com", description=" Convert any document", long_description=long_description, li...
from setuptools import setup with open('README.md') as file: long_description = file.read() setup( name="chalupas-files", version="0.1.0", author="Antonin Messinger", author_email="antonin.messinger@gmail.com", description=" Convert any document", long_description=long_description, li...
Fix USER in fabric file (the deploy user and ssh user aren't necessarily the same). Set default value for PROJECT (this is the go-rts-zambia repo after all).
from fabric.api import cd, sudo, env import os PROJECT = os.environ.get('PROJECT', 'go-rts-zambia') DEPLOY_USER = os.environ.get('DEPLOY_USER', 'jmbo') env.path = os.path.join('/', 'var', 'praekelt', PROJECT) def restart(): sudo('/etc/init.d/nginx restart') sudo('supervisorctl reload') def deploy(): w...
from fabric.api import cd, sudo, env import os expected_vars = [ 'PROJECT', ] for var in expected_vars: if var not in os.environ: raise Exception('Please specify %s environment variable' % ( var,)) PROJECT = os.environ['PROJECT'] USER = os.environ.get('USER', 'jmbo') env.path = os.path.j...
Allow internal `nextTick` utility to use microtasks when possible.
import { Promise } from 'rsvp'; export const nextTick = typeof Promise === 'undefined' ? setTimeout : cb => Promise.resolve().then(cb); export const futureTick = setTimeout; /** @private @returns {Promise<void>} promise which resolves on the next turn of the event loop */ export function nextTickPromise() { ret...
import { Promise } from 'rsvp'; export const nextTick = setTimeout; export const futureTick = setTimeout; /** @private @returns {Promise<void>} promise which resolves on the next turn of the event loop */ export function nextTickPromise() { return new Promise(resolve => { nextTick(resolve); }); } /** Retr...
CRM-739: Create class and command (oro.process.definition.load) to read process configuration from *.yml files to DB - small fix in configuration
<?php namespace Oro\Bundle\WorkflowBundle\Configuration; use Oro\Bundle\WorkflowBundle\Entity\ProcessTrigger; use Symfony\Component\Config\Definition\ConfigurationInterface; use Symfony\Component\Config\Definition\Processor; use Symfony\Component\Config\Definition\Builder\TreeBuilder; class ProcessTriggerListConfigu...
<?php namespace Oro\Bundle\WorkflowBundle\Configuration; use Oro\Bundle\WorkflowBundle\Entity\ProcessTrigger; use Symfony\Component\Config\Definition\ConfigurationInterface; use Symfony\Component\Config\Definition\Processor; use Symfony\Component\Config\Definition\Builder\TreeBuilder; class ProcessTriggerListConfigu...
Fix terms to only show terms ahead of focused term.
<?php namespace Kula\Core\Bundle\SystemBundle\Controller; use Kula\Core\Bundle\FrameworkBundle\Controller\Controller; class CoreTermsController extends Controller { public function indexAction() { $this->authorize(); $this->processForm(); $term_service = $this->get('kula.core.term'); /...
<?php namespace Kula\Core\Bundle\SystemBundle\Controller; use Kula\Core\Bundle\FrameworkBundle\Controller\Controller; class CoreTermsController extends Controller { public function indexAction() { $this->authorize(); $this->processForm(); // Get terms $terms = $this->db()->db_select('CORE_T...
Fix: Reduce visibility of field to maximum needed
<?php namespace Application\Service; use Zend\Log\Logger; class ErrorHandlingService { /** * @var Logger */ private $logger; public function __construct(Logger $logger) { $this->logger = $logger; } public function logException(\Exception $e) { $trace = $e->getT...
<?php /** * Created by Gary Hockin. * Date: 04/12/14 * @GeeH */ namespace Application\Service; use Zend\Log\Logger; class ErrorHandlingService { /** * @var Logger */ protected $logger; public function __construct(Logger $logger) { $this->logger = $logger; } public fun...
Add ConnectionError handling and reconnection to Twitter streamer
import logging import time from django.core.management.base import BaseCommand, CommandError from django.conf import settings from social.models import * from social.utils import * from tweetstream import FilterStream, ConnectionError class Command(BaseCommand): help = "Start Twitter streaming" def handle(sel...
import logging from django.core.management.base import BaseCommand, CommandError from django.conf import settings from social.models import * from social.utils import * from tweetstream import FilterStream class Command(BaseCommand): help = "Start Twitter streaming" def handle(self, *args, **options): ...
Fix callback cast of SerializeResponse
/* * Copyright 2014 Danilo Reinert * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed ...
/* * Copyright 2014 Danilo Reinert * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed ...
Improve test structure for themeable
import React, {PropTypes} from 'react' import {render} from 'react-dom' import {getContextualizer} from 'react-context-props' import {equal} from 'assert' import themeable from './themeable' describe('themeable', () => { it('gets the prop from context', () => { const root = document.createElement('div') docu...
import React, {PropTypes} from 'react' import {render} from 'react-dom' import {getContextualizer} from 'react-context-props' import {equal} from 'assert' import themeable from './themeable' const root = document.createElement('div') document.body.appendChild(root) describe('themeable', () => { it('gets the prop fr...
Fix CORS to allow for credentials Something changed in the client code requiring this setting.
import logging import os import flask import flask_cors from sqlalchemy_jsonapi import flaskext as flask_jsonapi from swd6 import config from swd6.db.models import db CONF = config.CONF DEFAULT_CONF_PATH = '/opt/swd6/api/api.conf' app = None def start(): # pylint: disable=global-statement global app a...
import logging import os import flask import flask_cors from sqlalchemy_jsonapi import flaskext as flask_jsonapi from swd6 import config from swd6.db.models import db CONF = config.CONF DEFAULT_CONF_PATH = '/opt/swd6/api/api.conf' app = None def start(): # pylint: disable=global-statement global app a...
Support fetching urls for inbox attachments
'use strict'; var express = require('express'); var router = module.exports = express.Router(); router.post('/url', function(req, res, next) { var data = req.body, model; if (data.type === 'expense_attachment') { model = req.app.get('bookshelf').models.ExpenseAttachment; } else if (data.type === 'inbo...
var express = require('express'); var router = module.exports = express.Router(); router.post('/url', function(req, res, next) { var data = req.body, model; if (data.type === 'expense_attachment') { model = req.app.get('bookshelf').models.ExpenseAttachment; } if (!model) return res.status(400).send(...
Add custom authentication form to set the label 'username' label to 'student number' for the login form.
from django.contrib.auth import get_user_model from django.contrib.auth.forms import AuthenticationForm from django.core.exceptions import ObjectDoesNotExist, ValidationError from django.utils.translation import ugettext_lazy as _ from registration.forms import RegistrationForm from .models import WhitelistedUsername...
from django.contrib.auth import get_user_model from django.core.exceptions import ObjectDoesNotExist, ValidationError from django.utils.translation import ugettext_lazy as _ from registration.forms import RegistrationForm from .models import WhitelistedUsername User = get_user_model() class ExclusiveRegistrationF...
Fix flake8 errors for build.
from __future__ import absolute_import from __future__ import print_function import logging from kale import task logger = logging.getLogger(__name__) class FibonacciTask(task.Task): # How many times should taskworker retry if it fails. # If this task shouldn't be retried, set it to None max_retries =...
from __future__ import absolute_import from __future__ import print_function import logging from kale import task logger = logging.getLogger(__name__) class FibonacciTask(task.Task): # How many times should taskworker retry if it fails. # If this task shouldn't be retried, set it to None max_retries =...
Improve error feedback on server add screen
import React, { Component, PropTypes } from 'react'; import { connect } from 'react-redux'; import { addServer } from '../actions/servers'; import { setStatus, clearStatus } from '../actions/status'; import ServerForm from '../widgets/server-form'; class ServerAdd extends Component { static propTypes = { disp...
import React, { Component, PropTypes } from 'react'; import { connect } from 'react-redux'; import { addServer } from '../actions/servers'; import { setStatus, clearStatus } from '../actions/status'; import ServerForm from '../widgets/server-form'; class ServerAdd extends Component { static propTypes = { disp...
Return latest 3 data items
var express = require('express'); var bodyParser = require('body-parser'); var app = express(); var jsonParser = bodyParser.json(); var request = require('request'); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: true })); app.get('/', function (req, res) { res.send('Slack Commands!'); }); ...
var express = require('express'); var bodyParser = require('body-parser'); var app = express(); var jsonParser = bodyParser.json(); var request = require('request'); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: true })); app.get('/', function (req, res) { res.send('Slack Commands!'); }); ...
Fix incorrect checksum verification when checksum is 32 (0x20, space)
#!/usr/bin/env python class TeleinfoParser: integerKeys = [ 'ISOUSC', 'BASE', 'HCHC', 'HCHP', 'EJPHN', 'EJPHPM', 'BBRHCJB', 'BBRHPJB', 'BBRHCJW', 'BBRHPJW', 'BBRHCJR', 'BBRHPJR', 'PEJP', 'IINST', 'IINST1', 'IINST2', 'IINST3', 'ADPS', 'IMAX', 'IMAX1', 'IMAX2', 'IMAX3', 'PAPP', 'ADIR1', 'ADIR2', 'ADIR3' ] de...
#!/usr/bin/env python class TeleinfoParser: integerKeys = [ 'ISOUSC', 'BASE', 'HCHC', 'HCHP', 'EJPHN', 'EJPHPM', 'BBRHCJB', 'BBRHPJB', 'BBRHCJW', 'BBRHPJW', 'BBRHCJR', 'BBRHPJR', 'PEJP', 'IINST', 'IINST1', 'IINST2', 'IINST3', 'ADPS', 'IMAX', 'IMAX1', 'IMAX2', 'IMAX3', 'PAPP', 'ADIR1', 'ADIR2', 'ADIR3' ] de...
Update title to ReCAPTCHA v3
<?php require_once 'recaptcha.class.php'; $form_id = "form"; $site_key = 'YOUR_SITE_KEY'; $secret_key = 'YOUR_SECRET_KEY'; $recaptcha = new Recaptcha($form_id, $site_key, $secret_key); ?> <!doctype html> <html> <head> <title>ReCAPTCHA v3 API Class Demo</title> </head> <body> <?php ob_start(); ?> <form id="form" meth...
<?php require_once 'recaptcha.class.php'; $form_id = "form"; $site_key = 'YOUR_SITE_KEY'; $secret_key = 'YOUR_SECRET_KEY'; $recaptcha = new Recaptcha($form_id, $site_key, $secret_key); ?> <!doctype html> <html> <head> <title>Invisible ReCAPTCHA API Class Demo</title> </head> <body> <?php ob_start(); ?> <form id="for...
Revert the ,bgimage: define.classPath(this) to require, since the correct new way of loading local resources for WebGL causes an exception in Dali. /root/teem/dreemgl-dev/classes/ui/view.js:532 if(require.loaded(this._bgimage)){ bgimagemode:"stretch" is left in the code, since that fixes the problem with the sizin...
/* Copyright 2015-2016 Teeming Society. Licensed under the Apache License, Version 2.0 (the "License"); DreemGL is a collaboration between Teeming Society & Samsung Electronics, sponsored by Samsung and others. You may not use this file except in compliance with the License. You may obtain a copy of the License at htt...
/* Copyright 2015-2016 Teeming Society. Licensed under the Apache License, Version 2.0 (the "License"); DreemGL is a collaboration between Teeming Society & Samsung Electronics, sponsored by Samsung and others. You may not use this file except in compliance with the License. You may obtain a copy of the License at htt...
Drop obsoleted support for offset.
from .base import Base class List(Base): current = None def __init__(self, result, object_type): Base.__init__(self, result) self.object_type = object_type def __len__(self): """Return the count field.""" return int(self['count']) def get_object_name(self): r...
from .base import Base class List(Base): current = None def __init__(self, result, object_type): Base.__init__(self, result) self.object_type = object_type def __len__(self): """Return the count field.""" return int(self['count']) def get_object_name(self): r...
Remove unused imports Only define MsgPackEngine if we can import MsgPack
import json class Engine(object): # The list of content types we match CONTENT_TYPES = [] def dumps(self, data): # pragma: no cover '''How to serialiser an object''' raise NotImplementedError def loads(self, data): # pragma: no cover '''How to deserialise a string''' ...
import json try: import msgpack except ImportError: pass from decimal import Decimal from datetime import date, datetime, time class Engine(object): # The list of content types we match CONTENT_TYPES = [] def dumps(self, data): # pragma: no cover '''How to serialiser an object''' ...
Add the missing 'np.' before 'array'
"""The metrics module implements functions assessing prediction error for specific purposes.""" import numpy as np def trapz(x, y): """Trapezoidal rule for integrating the curve defined by x-y pairs. Assume x and y are in the range [0,1] """ assert len(x) == len(y), 'x and y need to be of same le...
"""The metrics module implements functions assessing prediction error for specific purposes.""" import numpy as np def trapz(x, y): """Trapezoidal rule for integrating the curve defined by x-y pairs. Assume x and y are in the range [0,1] """ assert len(x) == len(y), 'x and y need to be of same len...
Remove node engine version from published package
/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */ /* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */ /* eslint-disable no-console */ import fs from 'fs'; import path from 'path'; import async from 'async'; // ///////////////////////////////////////////////////////////...
/* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */ /* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */ /* eslint-disable no-console */ import fs from 'fs'; import path from 'path'; import async from 'async'; // ///////////////////////////////////////////////////////////...
Fix Reader to support non-model audio (no ID)
Kpcc.Article = DS.Model.extend({ title : DS.attr(), short_title : DS.attr(), published_at : DS.attr(), byline : DS.attr(), teaser : DS.attr(), body : DS.attr(), public_url : DS.attr(), assets : DS.hasMany('asset'), audio ...
Kpcc.Article = DS.Model.extend({ title : DS.attr(), short_title : DS.attr(), published_at : DS.attr(), byline : DS.attr(), teaser : DS.attr(), body : DS.attr(), public_url : DS.attr(), assets : DS.hasMany('asset'), audio ...
Fix RN 0.47 breaking change
package com.balthazargronon.RCTZeroconf; import com.facebook.react.ReactPackage; import com.facebook.react.bridge.JavaScriptModule; import com.facebook.react.bridge.NativeModule; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.uimanager.ViewManager; import java.util.ArrayList; impo...
package com.balthazargronon.RCTZeroconf; import com.facebook.react.ReactPackage; import com.facebook.react.bridge.JavaScriptModule; import com.facebook.react.bridge.NativeModule; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.uimanager.ViewManager; import java.util.ArrayList; impo...
11239: Abort running request if new one fired
// ELMO.Views.DashboardReport // // View model for the dashboard report ELMO.Views.DashboardReportView = class DashboardReportView extends ELMO.Views.ApplicationView { get el() { return '.report'; } get events() { return { 'change .report-chooser': 'handleReportChange', 'click .action-link-cl...
// ELMO.Views.DashboardReport // // View model for the dashboard report ELMO.Views.DashboardReportView = class DashboardReportView extends ELMO.Views.ApplicationView { get el() { return '.report'; } get events() { return { 'change .report-chooser': 'handleReportChange', 'click .action-link-cl...
Update char swap operation without temp character
/* Write a function that takes a string as input and returns the string reversed. Example: Given s = "hello", return "olleh". */ package main import ( "fmt" ) func main() { tests := [][]string{{"", ""}, {" ", " "}, {" ", " "}, {"a", "a"}, {"ab", "ba"}, {"hello", "olleh"}, {"Hello, 世界!", "!界世 ,olleH"}} for _...
/* Write a function that takes a string as input and returns the string reversed. Example: Given s = "hello", return "olleh". */ package main import ( "fmt" ) func main() { tests := [][]string{{"", ""}, {" ", " "}, {" ", " "}, {"a", "a"}, {"ab", "ba"}, {"hello", "olleh"}, {"Hello, 世界!", "!界世 ,olleH"}} for _...
Fix nodejs v6 'TypeError: Object.values is not a function'
const chalk = require('chalk'); LOG_TYPES = { NONE: 0, ERROR: 1, NORMAL: 2, DEBUG: 3 }; let logType = LOG_TYPES.NORMAL; const setLogType = (type) => { if (typeof type !== 'number') return; logType = type; }; const logTime = () => { let nowDate = new Date(); return nowDate.toLocaleDa...
const chalk = require('chalk'); LOG_TYPES = { NONE: 0, ERROR: 1, NORMAL: 2, DEBUG: 3 }; let logType = LOG_TYPES.NORMAL; const setLogType = (type) => { if (!(type in Object.values(LOG_TYPES))) return; logType = type; }; const logTime = () => { let nowDate = new Date(); return nowDate...
Use @lru_cache now that memoize is gone.
from django.utils.lru_cache import lru_cache from . import app_settings @lru_cache def get_render_method(): return from_dotted_path(app_settings.EMAIL_RENDER_METHOD) @lru_cache def get_context_processors(): return [from_dotted_path(x) for x in app_settings.EMAIL_CONTEXT_PROCESSORS] def from_dotted_path(full...
from django.utils.functional import memoize from . import app_settings def get_render_method(): return from_dotted_path(app_settings.EMAIL_RENDER_METHOD) get_render_method = memoize(get_render_method, {}, 0) def get_context_processors(): return [from_dotted_path(x) for x in app_settings.EMAIL_CONTEXT_PROCESS...
Refactor and split input amount into pounds and pence
// ($(this).val() && Number($(this).val()) > 0) function isValidAmount(input) { var maxVal = 100000000 var minVal = 0 var pounds; var pence; var trimmedInput = input.trim() var decimalPointPosition = trimmedInput.indexOf('.') if(decimalPointPosition === -1) { pounds = trimmedInput...
// ($(this).val() && Number($(this).val()) > 0) function isValidAmount(input) { var maxVal = 100000000 var minVal = 0 var value = input.split('.') var pounds = value[0] var pence = value[1] pounds = pounds.replaceAll(/^£|[\s,]+/g, "") if(pence) { var lengthOfPence = pence.length ...
Add vi scrolling keys to scrolling key-binding
exports = module.exports = function (UI) { var setHistoryHeight = function () { // Set the history component dynamic height UI.components.history.height = UI.screen.height - UI.components.input.height; }; UI.screen.on('prerender', function () { setHistoryHeight(); }); UI.screen.on('resize', fun...
exports = module.exports = function (UI) { var setHistoryHeight = function () { // Set the history component dynamic height UI.components.history.height = UI.screen.height - UI.components.input.height; }; UI.screen.on('prerender', function () { setHistoryHeight(); }); UI.screen.on('resize', fun...
Fix "const" search and replace
'use strict'; let rpc = require('./rpc'); let util = require('./util'); let idKey = util.idKey; let realmKey = util.realmKey; let registeredConstructors = {}; exports.create = create; exports.registerConstructors = registerConstructors; function create(realmId, info) { let schema = info.schema; let construc...
'use strict'; let rpc = require('./rpc'); let util = require('./util'); let idKey = util.idKey; let realmKey = util.realmKey; let registeredConstructors = {}; exports.create = create; exports.registerConstructors = registerConstructors; function create(realmId, info) { let schema = info.schema; let construc...
Update warning message one last time
import warning from './warning'; const requestStatuses = { IDLE: 'IDLE', PENDING: 'PENDING', FAILED: 'FAILED', SUCCEEDED: 'SUCCEEDED', }; if (process.env.NODE_ENV !== 'production') { Object.defineProperty(requestStatuses, 'NULL', { get() { warning( `You attempted to access the NULL request...
import warning from './warning'; const requestStatuses = { IDLE: 'IDLE', PENDING: 'PENDING', FAILED: 'FAILED', SUCCEEDED: 'SUCCEEDED', }; if (process.env.NODE_ENV !== 'production') { Object.defineProperty(requestStatuses, 'NULL', { get() { warning( `You attempted to access the NULL request...
Fix uuid generator, add objectSize calculator
var titleCase = function toTitleCase(str) { return str.replace(/\w\S*/g, function (txt) { return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); }); }; var uuid = function uuidGenerator () { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { var r = Math.random()*16|0...
var titleCase = function toTitleCase(str) { return str.replace(/\w\S*/g, function (txt) { return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase(); }); }; var uuid = function uuidGenerator () { 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { var r = Math.random()*16|0, v = c...
Fix particle texture causing FileNotFoundException The string used in the ResourceLocation for the sprinkler water particle was for an icon instead of the texture. As a result, the client would throw an exception and then it would instead use the "missingo" texture. Although this does fix the black and purple texture...
package com.infinityraider.agricraft.renderers.particles; //heavily inspired by the OpenBlocks sprinkler import com.infinityraider.agricraft.utility.BaseIcons; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Si...
package com.infinityraider.agricraft.renderers.particles; //heavily inspired by the OpenBlocks sprinkler import com.infinityraider.agricraft.utility.BaseIcons; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Si...
Initialize select dropdown for categories with maps
from django import forms from django.utils.translation import ugettext_lazy as _ from adhocracy4.categories.forms import CategorizableFieldMixin from adhocracy4.maps import widgets as maps_widgets from . import models class MapIdeaForm(CategorizableFieldMixin, forms.ModelForm): class Media: js = ('js/se...
from django import forms from django.utils.translation import ugettext_lazy as _ from adhocracy4.categories.forms import CategorizableFieldMixin from adhocracy4.maps import widgets as maps_widgets from . import models class MapIdeaForm(CategorizableFieldMixin, forms.ModelForm): def __init__(self, *args, **kwar...
Add unserialize handler for data objects
<?php namespace Slack; /** * A serializable model object that stores its data in a hash. */ abstract class DataObject implements \JsonSerializable { /** * @var array The object's data cache. */ public $data = []; /** * Creates a data object from an array of data. * * @param arra...
<?php namespace Slack; /** * A serializable model object that stores its data in a hash. */ abstract class DataObject implements \JsonSerializable { /** * @var array The object's data cache. */ public $data = []; /** * Creates a data object from an array of data. * * @param arra...
[1.4][sfSympalPlugin][0.7] Fix so we only enable markdown editor for Markdown slot types git-svn-id: a12887034337be3812df6d060455f26cce89a7aa@25946 ee427ae8-e902-0410-961c-c3ed070cd9f9
<?php include_stylesheets_for_form($form) ?> <?php include_javascripts_for_form($form) ?> <span id="sympal_content_slot_<?php echo $contentSlot->getId() ?>_editor_form" class="sympal_<?php echo sfInflector::tableize($contentSlot->getType()) ?>_content_slot_editor_form"> <?php echo $form->renderHiddenFields() ?> <...
<?php include_stylesheets_for_form($form) ?> <?php include_javascripts_for_form($form) ?> <span id="sympal_content_slot_<?php echo $contentSlot->getId() ?>_editor_form" class="sympal_<?php echo sfInflector::tableize($contentSlot->getType()) ?>_content_slot_editor_form"> <?php echo $form->renderHiddenFields() ?> <...
Convert tests to es6 format
var fs = require('fs') var slSystems = require('../src/slSystemsCrawler') var webTimmi = require('../src/webTimmiCrawler') describe('sls systems crawler', () => { var obj var expected before(() => { obj = slSystems.table(fs.readFileSync(__dirname + '/fixture/meilahti.html', 'utf-8')) expect...
var fs = require('fs') var slSystems = require('../src/slSystemsCrawler') var webTimmi = require('../src/webTimmiCrawler') describe('sls systems crawler', function () { var obj var expected before(function () { obj = slSystems.table(fs.readFileSync(__dirname + '/fixture/meilahti.html', 'utf-8')) ...
Use a basic for loop
module.exports = Ready; function Ready() { var listeners = []; var args = null; function onReady(callback) { if (typeof callback === "function") { if (args) { call(callback); } else { listeners.push(callback); } } } ...
module.exports = Ready; function Ready() { var listeners = []; var args = null; function onReady(callback) { if (typeof callback === "function") { if (args) { call(callback); } else { listeners.push(callback); } } } ...
Update the crontab schedule to run every day at midnight
""" Celery tasks for the User Profiles portion of RAPID. """ import datetime import logging from celery.schedules import crontab from celery.task import PeriodicTask from profiles.models import Profile LOGGER = logging.getLogger(None) """The logger for this module""" # Note: Logging doesn't appear to work properly ...
""" Celery tasks for the User Profiles portion of RAPID. """ import datetime import logging from celery.schedules import crontab from celery.task import PeriodicTask from profiles.models import Profile LOGGER = logging.getLogger(None) """The logger for this module""" # Note: Logging doesn't appear to work properly ...
Add &v as alias for &vote
package com.tisawesomeness.minecord.command.misc; import com.tisawesomeness.minecord.Bot; import com.tisawesomeness.minecord.command.Command; import com.tisawesomeness.minecord.util.MessageUtils; import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import net.dv8tion.jda.api.utils.MarkdownUtil; public cla...
package com.tisawesomeness.minecord.command.misc; import com.tisawesomeness.minecord.Bot; import com.tisawesomeness.minecord.command.Command; import com.tisawesomeness.minecord.util.MessageUtils; import net.dv8tion.jda.api.events.message.MessageReceivedEvent; import net.dv8tion.jda.api.utils.MarkdownUtil; public cla...
Make the 'd' in 'updated' optional along with the space before the date
"use strict"; const util = require("gulp-util"); const through = require("through2"); const moment = require("moment"); module.exports = function(options) { options = options || {}; function updateDate(file, options) { const now = moment().format("YYYY/MM/DD"), regex = /Last updated?: ?(\d{4}\/\d...
"use strict"; const util = require("gulp-util"); const through = require("through2"); const moment = require("moment"); module.exports = function(options) { options = options || {}; function updateDate(file, options) { const now = moment().format("YYYY/MM/DD"), regex = /Last updated: (\d{4}\/\d{2...
Increment version in preparation for release
import subprocess import sys from setuptools import Command, setup class RunTests(Command): user_options = [] def initialize_options(self): pass def finalize_options(self): pass def run(self): errno = subprocess.call([sys.executable, '-m', 'unittest', 'gis_metadata.tests.te...
import subprocess import sys from setuptools import Command, setup class RunTests(Command): user_options = [] def initialize_options(self): pass def finalize_options(self): pass def run(self): errno = subprocess.call([sys.executable, '-m', 'unittest', 'gis_metadata.tests.te...
[Telegram] Update to context based callbacks
import telegram import telegram.ext import os import dotenv version = "0.2.0" # Load credentials from .env dotenv.load_dotenv() token = os.getenv("TELEGRAM_BOT_API_TOKEN") bot = telegram.Bot(token = token) updater = telegram.ext.Updater(token = token, use_context = True) def test(update, context): context.bot.s...
import telegram import telegram.ext import os import dotenv version = "0.1.4" # Load credentials from .env dotenv.load_dotenv() token = os.getenv("TELEGRAM_BOT_API_TOKEN") bot = telegram.Bot(token = token) updater = telegram.ext.Updater(token = token) def test(bot, update): bot.sendMessage(chat_id = update.mess...
Use "os" as valid constant for SYSTEM EOL check
package org.theultimatedeployer.enforcer.editorconfig.check; /** * Created by chris on 20.09.16. */ public class EOLCheckConfig implements CheckConfig{ public static final int SYSTEM = 0; public static final int UNIX = 1; public static final int WINDOWS = 2; // MAC OS X now uses UNIX -> old apple ;-) p...
package org.theultimatedeployer.enforcer.editorconfig.check; /** * Created by chris on 20.09.16. */ public class EOLCheckConfig implements CheckConfig{ public static final int SYSTEM = 0; public static final int UNIX = 1; public static final int WINDOWS = 2; // MAC OS X now uses UNIX -> old apple ;-) p...