text stringlengths 17 1.47k | positive stringlengths 673 4.43k | negative stringlengths 677 2.81k |
|---|---|---|
Integrate answers with Flask frontend | import random
import json
from flask import Flask, render_template, abort, redirect, request
app = Flask(__name__)
questions = [{
'question': 'How many shillings were there in a pre-decimalisation pound?',
'answer': '20',
'red_herrings': [
'5',
'10',
'12',
'25',
'... | import random
from flask import Flask, render_template, abort, redirect, request
app = Flask(__name__)
questions = [{
'question': 'How many shillings were there in a pre-decimalisation pound?',
'answer': '20',
'red_herrings': [
'5',
'10',
'12',
'25',
'50',
... |
Fix an issue with the child-task selector. | import logging
from tukio import Workflow
from tukio.task import register
from tukio.task.holder import TaskHolder
from nyuki.utils.evaluate import ConditionBlock
from nyuki.workflow.tasks.utils import generate_schema
log = logging.getLogger(__name__)
class TaskConditionBlock(ConditionBlock):
"""
Override... | import logging
from tukio import Workflow
from tukio.task import register
from tukio.task.holder import TaskHolder
from nyuki.utils.evaluate import ConditionBlock
from nyuki.workflow.tasks.utils import generate_schema
log = logging.getLogger(__name__)
class TaskConditionBlock(ConditionBlock):
"""
Override... |
Use window.location.protocol instead of hardcoded one | $(function() {
/*
* Functions
**/
// Function to clear the table and insert a specific placeholder
var insertPlaceholder = function(msg) {
$('table.certificates tbody').html(
'<tr>' +
'<td colspan="6"><center>' + msg + '</center></td>' +
'</tr>'
);
};
// Reload certificates a... | $(function() {
/*
* Functions
**/
// Function to clear the table and insert a specific placeholder
var insertPlaceholder = function(msg) {
$('table.certificates tbody').html(
'<tr>' +
'<td colspan="6"><center>' + msg + '</center></td>' +
'</tr>'
);
};
// Reload certificates a... |
Fix error on starting sample site | package io.sitoolkit.wt.gui.domain.sample;
import java.io.File;
import io.sitoolkit.util.buidtoolhelper.maven.MavenProject;
import io.sitoolkit.util.buidtoolhelper.process.ProcessCommand;
import io.sitoolkit.util.buidtoolhelper.process.ProcessExitCallback;
import io.sitoolkit.wt.util.infra.concurrent.ExecutorC... | package io.sitoolkit.wt.gui.domain.sample;
import java.io.File;
import io.sitoolkit.util.buidtoolhelper.maven.MavenProject;
import io.sitoolkit.util.buidtoolhelper.process.ProcessCommand;
import io.sitoolkit.util.buidtoolhelper.process.ProcessExitCallback;
import io.sitoolkit.wt.util.infra.concurrent.ExecutorC... |
Set `zip_safe` to false so that we can install pygrow from source. | from pip import req
import pip
from setuptools import find_packages
from setuptools import setup
_install_requirements = req.parse_requirements(
'requirements.txt', session=pip.download.PipSession())
setup(
name='grow',
version=open('grow/VERSION').read().strip(),
description=(
'Develop eve... | from pip import req
import pip
from setuptools import find_packages
from setuptools import setup
_install_requirements = req.parse_requirements(
'requirements.txt', session=pip.download.PipSession())
setup(
name='grow',
version=open('grow/VERSION').read().strip(),
description=(
'Develop eve... |
Raise error if conditions attribute unimplemented. | from PyOpenWorm import *
class Experiment(DataObject):
"""
Generic class for storing information about experiments
Should be overridden by specific types of experiments
(example: see PatchClampExperiment in ChannelWorm.py).
Overriding classes should have a list called "conditions" that
cont... | from PyOpenWorm import *
class Experiment(DataObject):
"""
Generic class for storing information about experiments
Should be overridden by specific types of experiments
(example: see PatchClampExperiment in ChannelWorm.py).
Overriding classes should have a list called "conditions" that
cont... |
Change baseAim to 0, since we're using the Y axis | package edu.stuy.starlorn.entities;
import edu.stuy.starlorn.upgrades.GunUpgrade;
import java.util.LinkedList;
public class Ship extends Entity {
protected LinkedList<GunUpgrade> _gunupgrades;
protected int _baseDamage, _baseShotSpeed, _health;
protected double _baseAim;
public Ship() {
supe... | package edu.stuy.starlorn.entities;
import edu.stuy.starlorn.upgrades.GunUpgrade;
import java.util.LinkedList;
public class Ship extends Entity {
protected LinkedList<GunUpgrade> _gunupgrades;
protected int _baseDamage, _baseShotSpeed, _health;
protected double _baseAim;
public Ship() {
supe... |
Remove unnecessary output from curl when using pushover | <?php
namespace Spatie\Backup\Notifications\Senders;
use Illuminate\Contracts\Config\Repository;
use Spatie\Backup\Notifications\BaseSender;
class Pushover extends BaseSender
{
/** @var array */
protected $config;
/**
* @param Repository $config
*/
public function __construct(Repository $c... | <?php
namespace Spatie\Backup\Notifications\Senders;
use Illuminate\Contracts\Config\Repository;
use Spatie\Backup\Notifications\BaseSender;
class Pushover extends BaseSender
{
/** @var array */
protected $config;
/**
* @param Repository $config
*/
public function __construct(Repository $c... |
Add an entry for deploying | <div class="box">
<div class="box-header">
<h3 class="box-title">{{ trans('releases.label') }}</h3>
</div>
<div class="box-body" id="no_releases">
<p>{{ trans('releases.none') }}</p>
</div>
<div class="box-body table-responsive">
<table class="table table-striped" id="rele... | <div class="box">
<div class="box-header">
<h3 class="box-title">{{ trans('releases.label') }}</h3>
</div>
<div class="box-body" id="no_releases">
<p>{{ trans('releases.none') }}</p>
</div>
<div class="box-body table-responsive">
<table class="table table-striped" id="rele... |
Reset the request instance after the tests complete
Former-commit-id: c62e9dd007e64fa3070aaee69a15b2ee9efa0f6d
Former-commit-id: 152cba49a9c4537146c25be919ed35acd8619871 | <?php
require_once __DIR__ . "/ResolverTestCase.php";
class CanonicalUrlResolverTest extends ResolverTestCase
{
protected function setUp()
{
$this->urlResolver = new \Concrete\Core\Url\Resolver\CanonicalUrlResolver();
}
public function testConfig()
{
$canonical = "http://example.... | <?php
require_once __DIR__ . "/ResolverTestCase.php";
class CanonicalUrlResolverTest extends ResolverTestCase
{
protected function setUp()
{
$this->urlResolver = new \Concrete\Core\Url\Resolver\CanonicalUrlResolver();
}
public function testConfig()
{
$canonical = "http://example.... |
Fix issue with walking paths instead of watching them. (Thanks to @mbibee and @betaveros.) | var fs = require('fs');
var path = require('path');
var logger = require('./logger');
module.exports = watcher;
var dirsToIgnore = /^(?:(?:node_modules|AppData)$|\.)/;
function watcher(paths, extensions, callback) {
paths.forEach(function(path) {
watch(path, true);
});
function watch(path_, isParentDir) ... | var fs = require('fs');
var path = require('path');
var logger = require('./logger');
module.exports = watcher;
var dirsToIgnore = /^(?:(?:node_modules|AppData)$|\.)/;
function watcher(paths, extensions, callback) {
paths.forEach(function(path) {
walk(path, true);
});
function watch(path_, isParentDir) {... |
Use \Exception when in try-catch for pcre exceptions | <?php
namespace Stamp\Action;
use RuntimeException;
class ParseVariableAction extends BaseAction implements ActionInterface
{
private $text = '';
private $regex = '';
public function getActionName()
{
return 'parse_variable';
}
public function setParams($array)
{
$this->... | <?php
namespace Stamp\Action;
class ParseVariableAction extends BaseAction implements ActionInterface
{
private $text = '';
private $regex = '';
public function getActionName()
{
return 'parse_variable';
}
public function setParams($array)
{
$this->setText($array['text'])... |
Fix missing new dependency in event tagger test | <?php
namespace CultuurNet\UDB3\Event;
use Broadway\CommandHandling\Testing\CommandHandlerScenarioTestCase;
use Broadway\EventStore\EventStoreInterface;
use Broadway\EventHandling\EventBusInterface;
class EventTaggerTest extends CommandHandlerScenarioTestCase
{
protected function createCommandHandler(
Ev... | <?php
namespace CultuurNet\UDB3\Event;
use Broadway\CommandHandling\Testing\CommandHandlerScenarioTestCase;
use Broadway\EventStore\EventStoreInterface;
use Broadway\EventHandling\EventBusInterface;
class EventTaggerTest extends CommandHandlerScenarioTestCase
{
protected function createCommandHandler(
Ev... |
Add test for non-GET requests
* Check that we get a 403 result. | from os import environ
from unittest import TestCase
environ['DJANGO_SETTINGS_MODULE'] = 'test_settings'
from incuna_auth.middleware import LoginRequiredMiddleware
class AuthenticatedUser(object):
def is_authenticated(self):
return True
class AnonymousUser(object):
def is_authenticated(self):
... | from os import environ
from unittest import TestCase
environ['DJANGO_SETTINGS_MODULE'] = 'test_settings'
from incuna_auth.middleware import LoginRequiredMiddleware
class AuthenticatedUser(object):
def is_authenticated(self):
return True
class AnonymousUser(object):
def is_authenticated(self):
... |
Upgrade to a way newer boto
Fixes an issue where content-type got %-escaped. | #!/usr/bin/python
from setuptools import setup
setup(name="catsnap",
version="6.0.0",
description="catalog and store images",
author="Erin Call",
author_email="hello@erincall.com",
url="https://github.com/ErinCall/",
packages=['catsnap',
'catsnap.document',
... | #!/usr/bin/python
from setuptools import setup
setup(name="catsnap",
version="6.0.0",
description="catalog and store images",
author="Erin Call",
author_email="hello@erincall.com",
url="https://github.com/ErinCall/",
packages=['catsnap',
'catsnap.document',
... |
fix: Raise non-auth errors from GitHub | import json
from zeus import auth
from zeus.api import client
from zeus.exceptions import ApiError
from zeus.models import Email, Identity
from .base import Resource
from ..schemas import EmailSchema, IdentitySchema, UserSchema
emails_schema = EmailSchema(many=True, strict=True)
identities_schema = IdentitySchema(ma... | import json
from zeus import auth
from zeus.api import client
from zeus.exceptions import ApiError
from zeus.models import Email, Identity
from .base import Resource
from ..schemas import EmailSchema, IdentitySchema, UserSchema
emails_schema = EmailSchema(many=True, strict=True)
identities_schema = IdentitySchema(ma... |
Fix sorting dict items in python 3 | from ipywidgets import widgets
from jinja2 import Template
from traitlets import (
observe,
Unicode,
)
from dallinger.config import get_config
header_template = Template(u"""
<h2>{{ name }}</h2>
<div>Status: {{ status }}</div>
{% if app_id %}<div>App ID: {{ app_id }}</div>{% endif %}
""")
config_template = T... | from ipywidgets import widgets
from jinja2 import Template
from traitlets import (
observe,
Unicode,
)
from dallinger.config import get_config
header_template = Template(u"""
<h2>{{ name }}</h2>
<div>Status: {{ status }}</div>
{% if app_id %}<div>App ID: {{ app_id }}</div>{% endif %}
""")
config_template = T... |
Fix error if regexp doesn't match beause trl() is used directly | <?php
class Kwf_Assets_Util_Trl
{
//returns replacement used for js trl strings
//used by Kwf_Assets_Dependency_File_Js and Kwf_Assets_CommonJs_Underscore_TemplateDependency
public static function getJsReplacement($trlElement)
{
$b = $trlElement['before'];
$fn = substr($b, 0, strpos($b, ... | <?php
class Kwf_Assets_Util_Trl
{
//returns replacement used for js trl strings
//used by Kwf_Assets_Dependency_File_Js and Kwf_Assets_CommonJs_Underscore_TemplateDependency
public static function getJsReplacement($trlElement)
{
$b = $trlElement['before'];
$fn = substr($b, 0, strpos($b, ... |
Remove select from command list. | package com.csforge.sstable;
import com.google.common.base.Strings;
import java.io.File;
import java.util.Arrays;
public class Driver {
public static void main(String ... args) {
if (args.length == 0) {
printCommands();
System.exit(-1);
}
switch(args[0].toLowerCase... | package com.csforge.sstable;
import com.google.common.base.Strings;
import java.io.File;
import java.util.Arrays;
public class Driver {
public static void main(String ... args) {
if (args.length == 0) {
printCommands();
System.exit(-1);
}
switch(args[0].toLowerCase... |
Fix NPE with normal bows. | package io.github.lexware.bukkit.enderbow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.metadata.Fixe... | package io.github.lexware.bukkit.enderbow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.metadata.Fixe... |
Add a message if no options are provided to update | <?php
namespace Lstr\DnsmasqMgmt\Command;
use Exception;
use Lstr\Silex\App\AppAwareInterface;
use Lstr\Silex\App\AppAwareTrait;
use Silex\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Com... | <?php
namespace Lstr\DnsmasqMgmt\Command;
use Exception;
use Lstr\Silex\App\AppAwareInterface;
use Lstr\Silex\App\AppAwareTrait;
use Silex\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Com... |
Handle symlinks in path to home directory | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# © 2017-2021 qsuscs, TobiX
# Should still run with Python 2.7...
from __future__ import print_function, unicode_literals
import os
import sys
from glob import glob
os.chdir(os.path.dirname(os.path.abspath(__file__)))
home = os.path.realpath(os.path.expanduser('~'))
ex... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# © 2017-2019 qsuscs, TobiX
# Should still run with Python 2.7...
from __future__ import print_function, unicode_literals
import os
import sys
from glob import glob
os.chdir(os.path.dirname(os.path.abspath(__file__)))
exit = 0
for f in glob('dot.*'):
dst_home = '~/... |
Reset the padding on each TextView when the RecyclerView binds it | package net.bloople.stories;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.List;
public class NodesAdapter extends RecyclerView.Adapter<NodesAdapter.ViewHolder> {
private... | package net.bloople.stories;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.List;
public class NodesAdapter extends RecyclerView.Adapter<NodesAdapter.ViewHolder> {
private... |
Add checking empty product code | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import csv
class CsvConverter:
def __init__(self, csv_file_path):
self.csv_file_path = csv_file_path
self.rows = []
self.source_product_code = "product_code"
self.source_quantity = "quantity"
def clear(self):
self.rows = [... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import csv
class CsvConverter:
def __init__(self, csv_file_path):
self.csv_file_path = csv_file_path
self.rows = []
self.source_product_code = "product_code"
self.source_quantity = "quantity"
def clear(self):
self.rows = [... |
Throw exception if unknown command in used in control console command | <?php
namespace Phobetor\RabbitMqSupervisorBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class ControlCommand extends Contai... | <?php
namespace Phobetor\RabbitMqSupervisorBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class ControlCommand extends Contai... |
Convert data to float in sparklines | import { Sparkline } from 'lib/visualizations'
window.GobiertoCharters.ChartersController = (function() {
function ChartersController() {}
ChartersController.prototype.show = function(opts){
// DEBUG: Esta funcion DEBE ser eliminada cuando se obtengan datos verdaderos
function mock(length = 2) {
l... | import { Sparkline } from 'lib/visualizations'
window.GobiertoCharters.ChartersController = (function() {
function ChartersController() {}
ChartersController.prototype.show = function(opts){
// DEBUG: Esta funcion DEBE ser eliminada cuando se obtengan datos verdaderos
function mock(length = 2) {
l... |
Add balance checking test victim | from django.test import TestCase
from breach.models import SampleSet, Victim, Target, Round
class RuptureTestCase(TestCase):
def setUp(self):
target = Target.objects.create(
endpoint='https://di.uoa.gr/?breach=%s',
prefix='test',
alphabet='0123456789'
)
... | from django.test import TestCase
from breach.models import SampleSet, Victim, Target, Round
class RuptureTestCase(TestCase):
def setUp(self):
target = Target.objects.create(
endpoint='https://di.uoa.gr/?breach=%s',
prefix='test',
alphabet='0123456789'
)
... |
Allow watching changes in modules map for ymb dev mode | var fs = require('fs'),
path = require('path'),
_ = require('lodash'),
gulp = require('gulp'),
through = require('through2'),
file = require('gulp-file');
module.exports = mapSrcPlugin;
var contents = {};
function requireFresh (src) {
delete require.cache[require.resolve(src)];
return req... | var fs = require('fs'),
path = require('path'),
_ = require('lodash'),
gulp = require('gulp'),
through = require('through2'),
file = require('gulp-file');
module.exports = mapSrcPlugin;
var contents = {};
/**
* @ignore
* Loads `map.json` into stream.
* @alias "map.src"
* @param {Object} data ... |
refactor(database): Fix MySQL pool createConnection return type | <?php
declare(strict_types=1);
namespace Leevel\Database\Mysql;
use Leevel\Database\Manager;
use Leevel\Database\PoolManager;
use Leevel\Protocol\Pool\IConnection;
use Leevel\Protocol\Pool\IPool;
use Leevel\Protocol\Pool\Pool;
/**
* MySQL 连接池.
*
* @codeCoverageIgnore
*/
class MysqlPool extends Pool implements I... | <?php
declare(strict_types=1);
namespace Leevel\Database\Mysql;
use Leevel\Database\Manager;
use Leevel\Database\MysqlPoolConnection;
use Leevel\Database\PoolManager;
use Leevel\Protocol\Pool\IPool;
use Leevel\Protocol\Pool\Pool;
/**
* MySQL 连接池.
*
* @codeCoverageIgnore
*/
class MysqlPool extends Pool implement... |
Fix build to add back the roboto font and bootstrap fonts. | // Copies files not processed by requirejs optimization from source to dist so other tasks can process them
module.exports = {
dist: {
files: [{
expand: true,
dot: true,
cwd: '<%= yeoman.app %>',
dest: '<%= yeoman.dist %>',
src: [
'*.{ico,png,txt}',
'.htaccess',
... | // Copies files not processed by requirejs optimization from source to dist so other tasks can process them
module.exports = {
dist: {
files: [{
expand: true,
dot: true,
cwd: '<%= yeoman.app %>',
dest: '<%= yeoman.dist %>',
src: [
'*.{ico,png,txt}',
'.htaccess',
... |
Change max filesize for uploaded images | <?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Image;
class ImageController extends Controller
{
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
... | <?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use App\Image;
class ImageController extends Controller
{
/**
* Display the specified resource.
*
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
{
... |
Return API error during parse, since it's being sent by the remote server | <?php
namespace BitWasp\Stratum\Request;
use BitWasp\Stratum\Exception\ApiError;
class RequestFactory
{
/**
* @var array
*/
private $nonces = [];
/**
* @param string $method
* @param array $params
* @return Request
*/
public function create($method, $params = array())
... | <?php
namespace BitWasp\Stratum\Request;
use BitWasp\Stratum\Exception\ApiError;
class RequestFactory
{
/**
* @var array
*/
private $nonces = [];
/**
* @param string $method
* @param array $params
* @return Request
*/
public function create($method, $params = array())
... |
Fix `is_anonymous` for Django 2 | from django.conf import settings
if settings.HOOVER_RATELIMIT_USER:
from django.http import HttpResponse
from . import signals
from hoover.contrib.ratelimit.limit import RateLimit
class HttpLimitExceeded(HttpResponse):
def __init__(self):
super().__init__(
"Rate li... | from django.conf import settings
if settings.HOOVER_RATELIMIT_USER:
from django.http import HttpResponse
from . import signals
from hoover.contrib.ratelimit.limit import RateLimit
class HttpLimitExceeded(HttpResponse):
def __init__(self):
super().__init__(
"Rate li... |
Check response status codes in quickFetch. | // We use this function throughout all the things to send and recieve form our
// django-rest-framework API
function quickFetch(url, method, body) {
let csrftoken = Cookies.get('csrftoken');
method = (typeof method !== 'undefined') ? method : 'get';
// Give us back a promise we can .then() on, data can be ... | // We use this function throughout all the things to send and recieve form our
// django-rest-framework API
function quickFetch(url, method, body) {
let csrftoken = Cookies.get('csrftoken');
method = (typeof method !== 'undefined') ? method : 'get';
// Give us back a promise we can .then() on, data can be ... |
Change test names to follow convention | package se.kits.gakusei.controller;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.http... | package se.kits.gakusei.controller;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.mockito.runners.MockitoJUnitRunner;
import org.springframework.http... |
Add databse config to production settings file | from gigs.settings_base import *
DEBUG = False
TEMPLATE_DEBUG = False
ADMINS = ()
INSTALLED_APPS += (
'gunicorn',
)
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'django',
'OPTIONS':{
'read_default_file':'/etc/tugg/my.cnf',
},
},
}
LOGG... | from gigs.settings_base import *
DEBUG = False
TEMPLATE_DEBUG = False
ADMINS = ()
INSTALLED_APPS += (
'gunicorn',
)
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'standard': {
'format': '%(asctime)s [%(levelname)s] %(name)s: %(message)s'
},
... |
Add parameter for log level | """The parameters dictionary contains global parameter settings."""
__all__ = ['Parameters', 'parameters']
# Be EXTREMELY careful when writing to a Parameters dictionary
# Read here for reference: http://wiki.c2.com/?GlobalVariablesAreBad
# https://softwareengineering.stackexchange.com/questions/148108/why-is-global-... | """The parameters dictionary contains global parameter settings."""
__all__ = ['Parameters', 'parameters']
# Be EXTREMELY careful when writing to a Parameters dictionary
# Read here for reference: http://wiki.c2.com/?GlobalVariablesAreBad
# If any issues related to global state arise, the following class should
# be ... |
Update deprecated form type api | <?php
namespace Mapbender\DataSourceBundle\Element\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
* Class DataBaseType
*
* @package Mapbender\DataSourceBundle\Element\Type
* @author Andriy Oblivantsev <es... | <?php
namespace Mapbender\DataSourceBundle\Element\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
/**
* Class DataBaseType
*
* @package Mapbender\DataSourceBundle\Element\Type
* @author Andriy Obliva... |
:white_check_mark: Add a test for teams page data | <?php
namespace Tests\Feature;
use Tests\TestCase;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use App\Org;
use App\User;
class DataTest extends TestCase
{
use DatabaseTransactions;
/**
* Test dashboard gets orgs.
*
* @return void
*/
public function testDashboard()
{
... | <?php
namespace Tests\Feature;
use Tests\TestCase;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use App\Org;
use App\User;
class DataTest extends TestCase
{
use DatabaseTransactions;
/**
* Test dashboard gets orgs.
*
* @return void
*/
public function testDashboard()
{
... |
Add test for blank audit name. | from pyxform.tests_v1.pyxform_test_case import PyxformTestCase
class AuditTest(PyxformTestCase):
def test_audit(self):
self.assertPyxformXform(
name="meta_audit",
md="""
| survey | | | |
| | type | name | label |
... | from pyxform.tests_v1.pyxform_test_case import PyxformTestCase
class AuditTest(PyxformTestCase):
def test_audit(self):
self.assertPyxformXform(
name="meta_audit",
md="""
| survey | | | |
| | type | name | label |
... |
Add canBeAttacked condition to Chasing the Sun | const _ = require('underscore');
const DrawCard = require('../../drawcard.js');
const { Locations, CardTypes, EventNames } = require('../../Constants');
class ChasingTheSun extends DrawCard {
setupCardAbilities() {
this.action({
title: 'Move the conflict to another eligible province',
... | const _ = require('underscore');
const DrawCard = require('../../drawcard.js');
const { Locations, CardTypes, EventNames } = require('../../Constants');
class ChasingTheSun extends DrawCard {
setupCardAbilities() {
this.action({
title: 'Move the conflict to another eligible province',
... |
Make W0 task handler test play more nicely.
Change-Id: I19bacffb3c7b2cea75fc9efd54af104fcb89f4c4 | package org.wikipedia.test;
import android.content.*;
import android.test.*;
import java.util.HashMap;
import org.mediawiki.api.json.*;
import org.wikipedia.WikipediaApp;
import org.wikipedia.zero.*;
import java.util.concurrent.*;
public class WikipediaZeroTests extends ActivityUnitTestCase<TestDummyActivity> {
... | package org.wikipedia.test;
import android.content.*;
import android.test.*;
import org.mediawiki.api.json.*;
import org.wikipedia.WikipediaApp;
import org.wikipedia.zero.*;
import java.util.concurrent.*;
public class WikipediaZeroTests extends ActivityUnitTestCase<TestDummyActivity> {
private static final int T... |
NXP-11577: Fix Sonar Major violation: Javadoc Type | package org.nuxeo.drive.service.impl;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.nuxeo.ecm.core.api.IdRef;
/**
* Helper to handle synchronization root definitions.
*
* @author Antoine Taillefer
*/
pu... | package org.nuxeo.drive.service.impl;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.nuxeo.ecm.core.api.IdRef;
public class RootDefinitionsHelper {
private RootDefinitionsHelper() {
// Utility c... |
Fix fellowship_grant when upload data | import pandas as pd
from django.core.management.base import BaseCommand, CommandError
from django.core.exceptions import ObjectDoesNotExist
from fellowms.models import Fellow
class Command(BaseCommand):
help = "Add old information to database."
# TODO Make use of args and options.
def handle(self, *args... | import pandas as pd
from django.core.management.base import BaseCommand, CommandError
from django.core.exceptions import ObjectDoesNotExist
from fellowms.models import Fellow
class Command(BaseCommand):
help = "Add old information to database."
# TODO Make use of args and options.
def handle(self, *args... |
Bring back useRawDomain for Voyager2 | 'use strict';
// Service for the spec config.
// We keep this separate so that changes are kept even if the spec changes.
angular.module('vlui')
.factory('Config', function() {
var Config = {};
Config.data = {};
Config.config = {};
Config.getConfig = function() {
return {};
};
Config... | 'use strict';
// Service for the spec config.
// We keep this separate so that changes are kept even if the spec changes.
angular.module('vlui')
.factory('Config', function() {
var Config = {};
Config.data = {};
Config.config = {};
Config.getConfig = function() {
return {};
};
Config... |
Use large avatar on profile page | import React, { Component } from 'react';
import { connect } from 'react-redux';
import '../scss/_profile.scss';
import RecipeContainer from './RecipeContainer.js';
class Profile extends Component {
componentDidMount() {
}
componentWillUpdate(nextProps) {
}
render() {
const { avatar, user, recipesOw... | import React, { Component } from 'react';
import { connect } from 'react-redux';
import '../scss/_profile.scss';
import RecipeContainer from './RecipeContainer.js';
class Profile extends Component {
componentDidMount() {
}
componentWillUpdate(nextProps) {
}
render() {
const { avatar, user, recipesOw... |
Revert "set 0000-00-00 00:00:00 to expires default instead of CURRENT_TIMESTAMP"
This reverts commit 939da875a5dd6b20dbc3d940b2e540a9154f2766.
refs #4 | <?php
use Migrations\AbstractMigration;
class CreateRememberMeTokens extends AbstractMigration
{
/**
* Change Method.
*
* More information on this method is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-change-method
* @return void
*/
public function chan... | <?php
use Migrations\AbstractMigration;
class CreateRememberMeTokens extends AbstractMigration
{
/**
* Change Method.
*
* More information on this method is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-change-method
* @return void
*/
public function chan... |
Add js, coffee, yaml, json flags
fixes #3 | /*
* grunt-generate-configs
* https://github.com/creynders/grunt-generate-configs
*
* Copyright (c) 2014 Camille Reynders
* Licensed under the MIT license.
*/
'use strict';
var inquirer = require('inquirer');
var writeFiles = require('./lib/writeFiles');
module.exports = function(grunt){
// Please see the... | /*
* grunt-generate-configs
* https://github.com/creynders/grunt-generate-configs
*
* Copyright (c) 2014 Camille Reynders
* Licensed under the MIT license.
*/
'use strict';
var inquirer = require('inquirer');
var writeFiles = require('./lib/writeFiles');
module.exports = function(grunt){
// Please see the... |
Fix namespacing of generated if | <?php
$vendor_path = 'vendor-bin/box/vendor/humbug/php-scoper/src/PhpParser/NodeVisitor/ClassAliasStmtAppender.php';
if (!file_exists($vendor_path)) {
die('Vendor file does not exist' . PHP_EOL);
}
$search = '/* @var FullyQualified $originalName */
$stmts[] = $this->createAliasStmt($originalName, $stmt)... | <?php
$vendor_path = 'vendor-bin/box/vendor/humbug/php-scoper/src/PhpParser/NodeVisitor/ClassAliasStmtAppender.php';
if (!file_exists($vendor_path)) {
die('Vendor file does not exist' . PHP_EOL);
}
$search = '/* @var FullyQualified $originalName */
$stmts[] = $this->createAliasStmt($originalName, $stmt)... |
Put the time summary in an html table | # -*- encoding: utf-8 -*-
import logging
from celery import shared_task
from django.utils import timezone
from invoice.models import InvoiceUser
from mail.service import queue_mail_message
from mail.tasks import process_mail
from .report import time_summary
logger = logging.getLogger(__name__)
@shared_task
def ma... | # -*- encoding: utf-8 -*-
import logging
from celery import shared_task
from django.utils import timezone
from invoice.models import InvoiceUser
from mail.service import queue_mail_message
from mail.tasks import process_mail
from .report import time_summary
logger = logging.getLogger(__name__)
@shared_task
def ma... |
Make test suite pass when there are no tests | from pathlib import Path
import shutil
from subprocess import call
from django.core.management.base import BaseCommand
from django.core.management import call_command
from django.conf import settings
BABEL_CONF = '''
module.exports = {
presets: [
[
'@babel/preset-env',
{
... | from pathlib import Path
import shutil
from subprocess import call
from django.core.management.base import BaseCommand
from django.core.management import call_command
from django.conf import settings
BABEL_CONF = '''
module.exports = {
presets: [
[
'@babel/preset-env',
{
... |
Use file scope cache to detect main function in file | package org.jetbrains.kotlin.ui.launch;
import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.jetbrains.kotlin.core.builder.KotlinPsiManager;
imp... | package org.jetbrains.kotlin.ui.launch;
import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.jetbrains.kotlin.core.builder.KotlinPsiManager;
imp... |
Move Zig source normalization to `create_files`
This actually works, even if I don't know why. | from dmoj.executors.compiled_executor import CompiledExecutor
class Executor(CompiledExecutor):
ext = 'zig'
name = 'ZIG'
command = 'zig'
test_program = '''
const std = @import("std");
pub fn main() !void {
const io = std.io;
const stdin = std.io.getStdIn().inStream();
const stdout = std.i... | from dmoj.executors.compiled_executor import CompiledExecutor
class Executor(CompiledExecutor):
ext = 'zig'
name = 'ZIG'
command = 'zig'
test_program = '''
const std = @import("std");
pub fn main() !void {
const io = std.io;
const stdin = std.io.getStdIn().inStream();
const stdout = std.i... |
Fix --raw option for help command | <?php
/**
* @file
* Override Symfony Console's HelpCommand to customize the appearance of help.
*/
namespace Platformsh\Cli\Command;
use Platformsh\Cli\CustomTextDescriptor;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Command\HelpCommand as ParentHelpCommand;
use Symfony\Component\... | <?php
/**
* @file
* Override Symfony Console's HelpCommand to customize the appearance of help.
*/
namespace Platformsh\Cli\Command;
use Platformsh\Cli\CustomTextDescriptor;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Command\HelpCommand as ParentHelpCommand;
use Symfony\Component\... |
Change Planning to Pre Alpha | #!/usr/bin/env python
from setuptools import setup, find_packages
def install():
setup(
name='dogu',
version='1.0',
license='MIT',
description='Dogu server, Implementation of dogu interace',
long_description='Dogu server, Implementation of dogu interace',
author='L... | #!/usr/bin/env python
from setuptools import setup, find_packages
def install():
setup(
name='dogu',
version='1.0',
license='MIT',
description='Dogu server, Implementation of dogu interace',
long_description='Dogu server, Implementation of dogu interace',
author='L... |
Replace ternary by default value | import React, { Component } from 'react'
import Card from '../Card'
const DEBOUNCE_MS = 500
const DEFAULT_DOMAIN = 'https://stripe.com'
export default class extends Component {
state = { domain: DEFAULT_DOMAIN }
onChange = e => {
const domain = e.target.value.trim() || DEFAULT_DOMAIN
clearTimeout(this.d... | import React, { Component } from 'react'
import Card from '../Card'
const DEBOUNCE_MS = 500
const DEFAULT_DOMAIN = 'https://stripe.com'
export default class extends Component {
state = { domain: DEFAULT_DOMAIN }
onChange = e => {
const domain = e.target.value.trim()
clearTimeout(this.debouncedSetState)
... |
Write the critical multiplier or the range when the damage gets converted into a String | from random import random
class Die:
"""
Abstracts the random dice throw. Roll will produce the result.
The die can be further parametrized by a multiplicator and/or
a modifier, like 2 * Die(8) +4.
"""
def __init__(self, number, multiplicator=1, modifier=0):
self.number = number
... | from random import random
class Die:
"""
Abstracts the random dice throw. Roll will produce the result.
The die can be further parametrized by a multiplicator and/or
a modifier, like 2 * Die(8) +4.
"""
def __init__(self, number, multiplicator=1, modifier=0):
self.number = number
... |
Make test logging level set by getenv. | import os
try:
from psycopg2cffi import compat
compat.register()
except ImportError:
pass
DEBUG=False
TEMPLATE=DEBUG
USE_TZ = True
STATIC_URL = '/static/'
MEDIA_URL = '/media/'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'django-pq',
'... | try:
from psycopg2cffi import compat
compat.register()
except ImportError:
pass
DEBUG=False
TEMPLATE=DEBUG
USE_TZ = True
STATIC_URL = '/static/'
MEDIA_URL = '/media/'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'django-pq',
'USER': 'dj... |
Fix adding the geolocation to the cache | 'use strict';
let geolocation = require('nativescript-geolocation');
let requester = require('../web/requester').defaultInstance;
let cacheService = require('../common/cache/cache-service');
let constants = require('../common/constants');
let settings = require('../common/settings');
class GeolocationHelper {
isEna... | 'use strict';
let geolocation = require('nativescript-geolocation');
let requester = require('../web/requester').defaultInstance;
let cacheService = require('../common/cache/cache-service');
let constants = require('../common/constants');
let settings = require('../common/settings');
class GeolocationHelper {
isEna... |
Add wos-only option to script | #!/usr/bin/env python3
from parsers.wos import WOSStream
from util.PajekFactory import PajekFactory
from util.misc import open_file, Checkpoint
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser(description="Creates Pajek (.net) files from WOS XML")
parser.add_argument('outfile')
... | #!/usr/bin/env python3
from parsers.wos import WOSStream
from util.PajekFactory import PajekFactory
from util.misc import open_file, Checkpoint
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser(description="Creates Pajek (.net) files from WOS XML")
parser.add_argument('outfile')
... |
Remove duplicate code for alternative function | import warnings
import functools
__all__ = ['deprecated']
class deprecated(object):
'''Decorator to mark deprecated functions with warning.
Adapted from <http://wiki.python.org/moin/PythonDecoratorLibrary>.
Parameters
----------
alt_func : str
If given, tell user what function to use i... | import warnings
import functools
__all__ = ['deprecated']
class deprecated(object):
'''Decorator to mark deprecated functions with warning.
Adapted from <http://wiki.python.org/moin/PythonDecoratorLibrary>.
Parameters
----------
alt_func : str
If given, tell user what function to use i... |
Add basic formatting to table values | /** Component for showing the queried index data as a table */
define( [
"lodash",
"jquery",
"preferences",
"aspects",
"dataTables.bootstrap"
], function(
_,
$,
Preferences,
Aspects
) {
"use strict";
var DataTableView = function() {
};
_.extend( DataTableView.prototype, {
showQueryResul... | /** Component for showing the queried index data as a table */
define( [
"lodash",
"jquery",
"preferences",
"dataTables.bootstrap"
], function(
_,
$,
Preferences
) {
"use strict";
var DataTableView = function() {
};
_.extend( DataTableView.prototype, {
showQueryResults: function( qr ) {
... |
BB-1413: Cover validation by unit tests
- fix model tests after changes | <?php
namespace Oro\Bundle\EntityExtendBundle\Tests\Unit\Model;
use Oro\Bundle\EntityExtendBundle\Model\EnumValue;
use Oro\Component\Testing\Unit\EntityTestCaseTrait;
class EnumValueTest extends \PHPUnit_Framework_TestCase
{
use EntityTestCaseTrait;
/** @var EnumValue */
protected $enumValue;
/**
... | <?php
namespace Oro\Bundle\EntityExtendBundle\Tests\Unit\Model;
use Oro\Bundle\EntityExtendBundle\Model\EnumValue;
use Oro\Component\Testing\Unit\EntityTestCaseTrait;
class EnumValueTest extends \PHPUnit_Framework_TestCase
{
use EntityTestCaseTrait;
/** @var EnumValue */
protected $enumValue;
/**
... |
Set display URL from wurl if curl not specified. | import React from 'react';
import PropTypes from 'prop-types';
import url from 'url';
export default class AppPermission extends React.Component {
constructor(props) {
super(props);
const curl = this.getCurl();
this.state = {
curl: curl,
};
console.log('curl', c... | import React from 'react';
import PropTypes from 'prop-types';
import url from 'url';
export default class AppPermission extends React.Component {
constructor(props) {
super(props);
const curl = this.getCurl();
this.state = {
curl: curl,
};
console.log('curl', c... |
[INT-205] Add deprecation error for using `addLicenseKey` after Shopware 5.5. | <?php
namespace K10rProject\Helpers;
use Shopware\Bundle\PluginInstallerBundle\Service\PluginLicenceService;
use Shopware\Components\Model\ModelManager;
use Shopware\Models\Plugin\License;
class LicenseHelper
{
/** @var PluginLicenceService */
private $licenseService;
/** @var ModelManager */
privat... | <?php
namespace K10rProject\Helpers;
use Shopware\Bundle\PluginInstallerBundle\Service\PluginLicenceService;
use Shopware\Components\Model\ModelManager;
use Shopware\Models\Plugin\License;
class LicenseHelper
{
/** @var PluginLicenceService */
private $licenseService;
/** @var ModelManager */
privat... |
Add eslint 'fix' flag to config.
Can be flipped to 'true' to auto-fix linting violations! | module.exports = function (grunt) {
var allJSFilesInJSFolder = "js/**/*.js";
var distFolder = '../wikipedia/assets/';
grunt.loadNpmTasks( 'grunt-browserify' );
grunt.loadNpmTasks( 'gruntify-eslint' );
grunt.loadNpmTasks( 'grunt-contrib-copy' );
grunt.loadNpmTasks( 'grunt-contrib-less' );
grunt.initConf... | module.exports = function (grunt) {
var allJSFilesInJSFolder = "js/**/*.js";
var distFolder = '../wikipedia/assets/';
grunt.loadNpmTasks( 'grunt-browserify' );
grunt.loadNpmTasks( 'gruntify-eslint' );
grunt.loadNpmTasks( 'grunt-contrib-copy' );
grunt.loadNpmTasks( 'grunt-contrib-less' );
grunt.initConf... |
Add header comments
Remove magic numbers | //@@author A0139248X
package seedu.ezdo.model;
import java.util.EmptyStackException;
/**
* Array-based implementation for a stack with fixed size. Used for undo & redo stacks.
* If stack goes past max capacity, the oldest item that was pushed is replaced.
*/
public class FixedStack<T> {
private static final i... | package seedu.ezdo.model;
import java.util.EmptyStackException;
//@@author A0139248X
/*
* Array-based implementation for a stack with fixed size. Used for undo & redo stacks.
* If stack goes past max capacity, the oldest item to be pushed is replaced.
*/
public class FixedStack<T> {
private int index;
priva... |
Add force pull image option in docker sub entity | <?php
/**
* @package: chapi
*
* @author: bthapaliya
* @since: 2016-10-16
*
*/
namespace Chapi\Entity\Marathon\AppEntity;
use Chapi\Entity\Marathon\AppEntity\DockerParameters;
use Chapi\Entity\Marathon\AppEntity\DockerPortMapping;
use Chapi\Entity\Marathon\MarathonEntityUtils;
class Docker
{
const DIC = self... | <?php
/**
* @package: chapi
*
* @author: bthapaliya
* @since: 2016-10-16
*
*/
namespace Chapi\Entity\Marathon\AppEntity;
use Chapi\Entity\Marathon\AppEntity\DockerParameters;
use Chapi\Entity\Marathon\AppEntity\DockerPortMapping;
use Chapi\Entity\Marathon\MarathonEntityUtils;
class Docker
{
const DIC = self... |
Add croniter as an install dependency. | # -*- coding: utf-8 -*-
import os
from setuptools import find_packages
from setuptools import setup
base_dir = os.path.dirname(__file__)
setup(
name='elastalert',
version='0.0.72',
description='Runs custom filters on Elasticsearch and alerts on matches',
author='Quentin Long',
author_email='qlo@y... | # -*- coding: utf-8 -*-
import os
from setuptools import find_packages
from setuptools import setup
base_dir = os.path.dirname(__file__)
setup(
name='elastalert',
version='0.0.72',
description='Runs custom filters on Elasticsearch and alerts on matches',
author='Quentin Long',
author_email='qlo@y... |
Add test to check that uris are set | from mopidy.models import Track
class BaseCurrentPlaylistControllerTest(object):
uris = []
backend_class = None
def setUp(self):
self.backend = self.backend_class()
def test_uri_set(self):
self.assert_(self.uris)
def test_add(self):
playlist = self.backend.current_playlis... | from mopidy.models import Track
class BaseCurrentPlaylistControllerTest(object):
uris = []
backend_class = None
def setUp(self):
self.backend = self.backend_class()
def test_add(self):
playlist = self.backend.current_playlist
for uri in self.uris:
playlist.add(uri... |
Send title to navigator on control panel item press |
import React, {View, Text, Linking} from 'react-native'
import {logout} from '../api/Account'
import Styles from '../styles/Styles'
import ControlPanelItem from '../components/ControlPanelItem'
import Settings from '../settings'
export default React.createClass({
render() {
return (
<View style={Styles.c... |
import React, {View, Text, Linking} from 'react-native'
import {logout} from '../api/Account'
import Styles from '../styles/Styles'
import ControlPanelItem from '../components/ControlPanelItem'
import Settings from '../settings'
export default React.createClass({
render() {
return (
<View style={Styles.c... |
Fix error in expected TOC output | /***************************************************************************
* *
* EXAMPLE1 *
* *
* CONTENTS ... | /***************************************************************************
* *
* EXAMPLE1 *
* * ... |
Fix propTypes of MyLocalities component | import React from "react-native";
import RoomItem from "./room-item";
import PageEmpty from "./page-empty";
import PageLoading from "./page-loading";
import PageRetry from "./page-retry";
const {
ListView,
View
} = React;
export default class MyLocalities extends React.Component {
constructor(props) {
... | import React from "react-native";
import RoomItem from "./room-item";
import PageEmpty from "./page-empty";
import PageLoading from "./page-loading";
import PageRetry from "./page-retry";
const {
ListView,
View
} = React;
export default class MyLocalities extends React.Component {
constructor(props) {
... |
Use keyword arguments to avoid accidentally setting timeout | import unittest
import bz2
import bmemcached
class MemcachedTests(unittest.TestCase):
def setUp(self):
self.server = '127.0.0.1:11211'
self.client = bmemcached.Client(self.server, 'user', 'password')
self.bzclient = bmemcached.Client(self.server, 'user', 'password',
... | import unittest
import bmemcached
import bz2
class MemcachedTests(unittest.TestCase):
def setUp(self):
self.server = '127.0.0.1:11211'
self.client = bmemcached.Client(self.server, 'user', 'password')
self.bzclient = bmemcached.Client(self.server, 'user', 'password', bz2)
self.data =... |
Handle if the listeners value is already an array. | import { RENDERER_SUFFIX } from './constants';
import contentRendererMixin from './mixin';
export default {
mixins: [contentRendererMixin],
methods: {
/**
* @public
*/
checkAnswer() {
if (this.$refs.contentView && this.$refs.contentView.checkAnswer) {
return this.$refs.contentView.c... | import { RENDERER_SUFFIX } from './constants';
import contentRendererMixin from './mixin';
export default {
mixins: [contentRendererMixin],
methods: {
/**
* @public
*/
checkAnswer() {
if (this.$refs.contentView && this.$refs.contentView.checkAnswer) {
return this.$refs.contentView.c... |
Adjust the style to truncate post index. | $(function() {
function traverse($node, len, maxCount) {
var reachMaxCount = len > maxCount;
if (reachMaxCount) {
$node.hide();
}
var $contents = $node.contents();
for (var i = 0; i < $contents.length; ++i) {
if (reachMaxCount) {
$conte... | $(function() {
function traverse($node, len, maxCount) {
var reachMaxCount = len > maxCount;
if (reachMaxCount) {
$node.hide();
}
var $contents = $node.contents();
for (var i = 0; i < $contents.length; ++i) {
if (reachMaxCount) {
$conte... |
FIX: Use the correct Event loop. | import epics
import asyncio
class PVSuspender:
"""
A class to manage the callback interface between asyincio and
pyepics.
This will probably be a base class eventually.
"""
def __init__(self, RE, pv_name, loop=None):
if loop is None:
loop = asyncio.get_event_loop()
... | import epics
import asyncio
class PVSuspender:
"""
A class to manage the callback interface between asyincio and
pyepics.
This will probably be a base class eventually.
"""
def __init__(self, RE, pv_name, loop=None):
if loop is None:
loop = asyncio.get_event_loop()
... |
Remove pymvpa from documentation build.
git-svn-id: 24f545668198cdd163a527378499f2123e59bf9f@931 ead46cd0-7350-4e37-8683-fc4c6f79bf00 | #!/usr/bin/env python
"""Script to auto-generate our API docs.
"""
# stdlib imports
import os
import sys
# local imports
from interfacedocgen import InterfaceHelpWriter
#*****************************************************************************
if __name__ == '__main__':
nipypepath = os.path.abspath('..')
... | #!/usr/bin/env python
"""Script to auto-generate our API docs.
"""
# stdlib imports
import os
import sys
# local imports
from interfacedocgen import InterfaceHelpWriter
#*****************************************************************************
if __name__ == '__main__':
nipypepath = os.path.abspath('..')
... |
Move date format to setter
* Change date format options to be set from a setter instead of in the
constructor for ResponseParser | package com.fanpics.opensource.android.modelrecord;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.lang.reflect.Type;
import retrofit.client.Response;
import retrofit.converter.ConversionException;
import retrofit.converter.GsonConverter;
public class ResponseParser<T> {
private fi... | package com.fanpics.opensource.android.modelrecord;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.lang.reflect.Type;
import retrofit.client.Response;
import retrofit.converter.ConversionException;
import retrofit.converter.GsonConverter;
public class ResponseParser<T> {
private fi... |
Fix jboss-all generation. Name should be attribute | package org.bedework.util.deployment;
import org.w3c.dom.Element;
import java.io.File;
import java.util.List;
/** Represent a jboss-web.xml file.
*
* @author douglm
*/
public class JbossAllXml extends XmlFile {
private final PropertiesChain props;
private final String version;
public JbossAllXml(final Util... | package org.bedework.util.deployment;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import java.io.File;
import java.util.List;
/** Represent a jboss-web.xml file.
*
* @author douglm
*/
public class JbossAllXml extends XmlFile {
private final PropertiesChain props;
private final String version;
publ... |
Remove file loader from conf | const path = require('path')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const WebpackBundleTracker = require('webpack-bundle-tracker')
module.exports = {
mode: 'development',
entry: {
base: './static/javascript/base',
pages: './static/javascript/pages',
home: './static/javascript/h... | const path = require('path')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
const WebpackBundleTracker = require('webpack-bundle-tracker')
module.exports = {
mode: 'development',
entry: {
base: './static/javascript/base',
pages: './static/javascript/pages',
home: './static/javascript/h... |
Fix AR list module test | define((require) => {
describe('requester_module', () => {
beforeEach(() => {
require('app/views/teacher/modules/assistance_request_list_module');
});
describe('>RetrieveAssistanceRequests', () => {
it('should be defined', () => {
expect(RetrieveAssi... | define((require) => {
describe('requester_module', () => {
beforeEach(() => {
require('app/views/teacher/modules/assistance_request_list_module');
});
define('>RetrieveAssistanceRequests', () => {
it('should be defined', () => {
expect(RetrieveAssist... |
Make error message a bit more neutral | package io.quarkus.hibernate.search.orm.elasticsearch.runtime.devconsole;
import java.time.Duration;
import java.util.stream.Collectors;
import org.hibernate.search.mapper.orm.entity.SearchIndexedEntity;
import org.hibernate.search.mapper.orm.mapping.SearchMapping;
import io.quarkus.devconsole.runtime.spi.DevConsole... | package io.quarkus.hibernate.search.orm.elasticsearch.runtime.devconsole;
import java.time.Duration;
import java.util.stream.Collectors;
import org.hibernate.search.mapper.orm.entity.SearchIndexedEntity;
import org.hibernate.search.mapper.orm.mapping.SearchMapping;
import io.quarkus.devconsole.runtime.spi.DevConsole... |
Set up test directory for js testing | /*
* grunt-perl-tidy
* https://github.com/rabrooks/grunt-perl-tidy
*
* Copyright (c) 2014 Aaron Brooks
* Licensed under the MIT license.
*/
'use strict';
module.exports = function(grunt) {
// Please see the Grunt documentation for more information regarding task
// creation: http://gruntjs.com/creating-tas... | /*
* grunt-perl-tidy
* https://github.com/rabrooks/grunt-perl-tidy
*
* Copyright (c) 2014 Aaron Brooks
* Licensed under the MIT license.
*/
'use strict';
module.exports = function(grunt) {
// Please see the Grunt documentation for more information regarding task
// creation: http://gruntjs.com/creating-tas... |
MRWidget: Make error message bold and red. | import eventHub from '../../event_hub';
export default {
name: 'MRWidgetAutoMergeFailed',
props: {
mr: { type: Object, required: true },
},
data() {
return {
isRefreshing: false,
};
},
methods: {
refreshWidget() {
this.isRefreshing = true;
eventHub.$emit('MRWidgetUpdateReq... | import eventHub from '../../event_hub';
export default {
name: 'MRWidgetAutoMergeFailed',
props: {
mr: { type: Object, required: true },
},
data() {
return {
isRefreshing: false,
};
},
methods: {
refreshWidget() {
this.isRefreshing = true;
eventHub.$emit('MRWidgetUpdateReq... |
Use Conan Center provided libcurl. | from conans import ConanFile, CMake, tools
class LibWFUTConan(ConanFile):
name = "libwfut"
version = "0.2.4"
license = "GPL-2.0+"
author = "Erik Ogenvik <erik@ogenvik.org>"
homepage = "https://www.worldforge.org"
url = "https://github.com/worldforge/libwfut"
description = "A client side C+... | from conans import ConanFile, CMake, tools
class LibWFUTConan(ConanFile):
name = "libwfut"
version = "0.2.4"
license = "GPL-2.0+"
author = "Erik Ogenvik <erik@ogenvik.org>"
homepage = "https://www.worldforge.org"
url = "https://github.com/worldforge/libwfut"
description = "A client side C+... |
Test getenv au lieu d'une référence vers un paramètres | <?php
// app/config/security.php
$container->loadFromExtension('security', [
'encoders' => [
'Tm\UserBundle\Entity\Utilisateur' => 'sha512',
],
'role_hierarchy' => [
'ROLE_ADMIN' => 'ROLE_UTILISATEUR',
'ROLE_SUPER_ADMIN' => ['ROLE_ADMIN', 'ROLE_A... | <?php
// app/config/security.php
$container->loadFromExtension('security', [
'encoders' => [
'Tm\UserBundle\Entity\Utilisateur' => 'sha512',
],
'role_hierarchy' => [
'ROLE_ADMIN' => 'ROLE_UTILISATEUR',
'ROLE_SUPER_ADMIN' => ['ROLE_ADMIN', 'ROLE_A... |
Add more photoshopper tool functions
New function to resize to height
Get dimensions now supported | <?php
/**
* @license MIT
* Full license text in LICENSE file
*/
namespace VLibrary\Core\Tool;
interface Photoshopper
{
/**
* Sets the source image to manipulate, and the destination to save the result
*
* Example:
* $photoshopper->setup('/tmp/myfile.png', '/home/user/profile.png');
*
... | <?php
/**
* @license MIT
* Full license text in LICENSE file
*/
namespace VLibrary\Core\Tool;
interface Photoshopper
{
/**
* Sets the source image to manipulate, and the destination to save the result
*
* Example:
* $photoshopper->setup('/tmp/myfile.png', '/home/user/profile.png');
*
... |
Fix code style according to PSR standard. | <?php
/**
* @author Jean Silva <me@jeancsil.com>
* @license MIT
*/
namespace Jeancsil\FlightSpy\Service\Currency;
class PriceFormatter
{
const CURRENCIES_FILE = 'currencies.json';
private $currencies;
public function __construct($resourcesDir)
{
$this->initializeCurrenciesFile($resourcesDi... | <?php
/**
* @author Jean Silva <me@jeancsil.com>
* @license MIT
*/
namespace Jeancsil\FlightSpy\Service\Currency;
class PriceFormatter
{
const CURRENCIES_FILE = 'currencies.json';
private $currencies;
public function __construct($resourcesDir)
{
$this->initializeCurrenciesFile($resourcesDi... |
Fix drop event with preventDefault
If preventDefault is not triggered, we can't use drop event. I fix it
and added an over function to disable it by default. | (function ($) {
$.fn.dragster = function (options) {
var settings = $.extend({
enter: $.noop,
leave: $.noop,
over: $.noop
}, options);
return this.each(function () {
var first = false,
second = false,
$this = $... | (function ($) {
$.fn.dragster = function (options) {
var settings = $.extend({
enter: $.noop,
leave: $.noop
}, options);
return this.each(function () {
var first = false,
second = false,
$this = $(this);
$this... |
Support passing an array of urls. | const fs = require('fs');
const {join} = require('path');
const {promisify} = require('util');
const readFile = promisify(fs.readFile);
const writeFile = promisify(fs.writeFile);
const mkdirp = promisify(require('mkdirp'));
const request = promisify(require('request'));
const checkCacheExpiry = require('../utils/che... | const fs = require('fs');
const {join} = require('path');
const {promisify} = require('util');
const readFile = promisify(fs.readFile);
const writeFile = promisify(fs.writeFile);
const mkdirp = promisify(require('mkdirp'));
const request = promisify(require('request'));
const checkCacheExpiry = require('../utils/che... |
Disable menu selection in member list | import { ListItem } from 'material-ui/List';
import React from 'react';
import { Link } from 'react-router';
import Phone from './Phone';
export default class MemberItem extends React.Component {
static propTypes = {
isMember: React.PropTypes.bool,
user: React.PropTypes.object,
role: React... | import { ListItem } from 'material-ui/List';
import React from 'react';
import { Link } from 'react-router';
import Phone from './Phone';
export default class MemberItem extends React.Component {
static propTypes = {
isMember: React.PropTypes.bool,
user: React.PropTypes.object,
role: React... |
Fix hard coded "Edit" translation link
Edit link generates 404 error when using http://localhost/<your-project>/public/en/admin/translation | @extends(layoutExtend())
@section('title')
{{ trans('categorie.Translation') }} {{ trans('home.control') }}
@endsection
@section('content')
<table class="table table-bordered table-striped">
<tr>
<th>{{ trans('admin.Files') }}</th>
@foreach(LaravelLocalization::getSupportedLoc... | @extends(layoutExtend())
@section('title')
{{ trans('categorie.Translation') }} {{ trans('home.control') }}
@endsection
@section('content')
<table class="table table-bordered table-striped">
<tr>
<th>{{ trans('admin.Files') }}</th>
@foreach(LaravelLocalization::getSupportedLoc... |
Remove cronos_debug, un-hardcode the mail address in mail_cronos_admin | # -*- coding: utf-8 -*-
from django.conf import settings
from django.core.mail import send_mail
def mail_cronos_admin(title, message):
'''
Wrapper function of send_mail
'''
try:
send_mail(title, message, 'notification@cronos.teilar.gr', [settings.ADMIN[0][1]])
except:
pass
class C... | # -*- coding: utf-8 -*-
from django.conf import settings
from django.core.mail import send_mail
import logging
#import traceback
def cronos_debug(msg, logfile):
'''
To be deprecated, along with the import logging and settings
'''
logging.basicConfig(level = logging.DEBUG, format = '%(asctime)s: %(mess... |
Fix for relationships with dashes on POST|PUT | <?php
namespace Luminary\Services\ApiRequest\Content;
class Content
{
/**
* The request body content
*
* @var array
*/
protected $content;
/**
* Content constructor.
*
* @param array $content
*/
public function __construct(array $content)
{
$this->c... | <?php
namespace Luminary\Services\ApiRequest\Content;
class Content
{
/**
* The request body content
*
* @var array
*/
protected $content;
/**
* Content constructor.
*
* @param array $content
*/
public function __construct(array $content)
{
$this->c... |
Change single Lecture query to use first() in stead of all() | from flask import request
from flask_restful import Resource, Api, abort, reqparse
from .models import db, Comment, Lecture
api = Api()
class CommentListResource(Resource):
def get(self, lecture_id):
db_lecture = Lecture.query.filter(Lecture.id == lecture_id).first()
if not db_lecture:
... | from flask import request
from flask_restful import Resource, Api, abort, reqparse
from .models import db, Comment, Lecture
api = Api()
class CommentListResource(Resource):
def get(self, lecture_id):
db_lecture = Lecture.query.filter(Lecture.id == lecture_id).first()
if not db_lecture:
... |
Add SQL error message to log | package com.ksoichiro.task.aspect;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.core.NestedRuntimeException;
import org.springf... | package com.ksoichiro.task.aspect;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.core.NestedRuntimeException;
import org.springf... |
Check the end of notification fade-out animation | var NotificationComponent = Ember.Component.extend({
classNames: ['js-bb-notification'],
typeClass: function () {
var classes = '',
message = this.get('message'),
type,
dismissible;
// Check to see if we're working with a DS.Model or a plain JS object
... | var NotificationComponent = Ember.Component.extend({
classNames: ['js-bb-notification'],
typeClass: function () {
var classes = '',
message = this.get('message'),
type,
dismissible;
// Check to see if we're working with a DS.Model or a plain JS object
... |
Expand selected mutation's row on load | var MutationTable = function ()
{
var element
function detailFormatter(index, row, element)
{
var impact = row[4]
var affected_sites_count = row[5]
html = 'Impact: ' + impact + '<br>'
html += '# of affected sites: ' + affected_sites_count + '<br>'
if(affected_sites_c... | var MutationTable = function ()
{
var element
function detailFormatter(index, row, element)
{
var impact = row[4]
var affected_sites_count = row[5]
html = 'Impact: ' + impact + '<br>'
html += '# of affected sites: ' + affected_sites_count + '<br>'
if(affected_sites_c... |
Check that input to port is an integer | def parse(s):
try:
return Port(int(s))
except ValueError:
if s == "all":
return Port(None)
else:
start, _, end = s.partition('-')
try:
return Port(int(start), int(end))
except ValueError:
return None
class ... | def parse(s):
try:
return Port(int(s))
except ValueError:
if s == "all":
return Port(None)
else:
start, _, end = s.partition('-')
try:
return Port(int(start), int(end))
except ValueError:
return None
class ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.