text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Fix where clause in getPublishedPost | <?php
namespace SymfonyDay\Bundle\BlogBundle\Entity;
use Doctrine\ORM\EntityRepository;
/**
* PostRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class PostRepository extends EntityRepository
{
public function getPublishedPost($id)
{
... | <?php
namespace SymfonyDay\Bundle\BlogBundle\Entity;
use Doctrine\ORM\EntityRepository;
/**
* PostRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class PostRepository extends EntityRepository
{
public function getPublishedPost($id)
{
... |
Raise the number of iterations in empty session benchmarks | /*
* Copyright 2015 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, softw... | /*
* Copyright 2015 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, softw... |
Delete an empty line again... | 'use strict';
/* Configurable navbar
*
* The following variables can be declared in a conf file
* disable - Boolean
* search - Boolean
* navigation - Boolean
* notifier - Boolean
* template - String
*
* Example;
*
* {
* "navbar" : {
* "search" : true,
* "navigation" : true,
* "tem... | 'use strict';
/* Configurable navbar
*
* The following variables can be declared in a conf file
* disable - Boolean
* search - Boolean
* navigation - Boolean
* notifier - Boolean
* template - String
*
* Example;
*
* {
* "navbar" : {
* "search" : true,
* "navigation" : true,
* "tem... |
Rename "escapeRow" method to just "escape" | <?php
declare(strict_types=1);
namespace Rinvex\Support\Traits;
trait Escaper
{
/**
* Escape all values.
*
* @param array $data
*
* @return array
*/
protected function escape(array $data): array
{
$arrayDot = array_filter(array_dot($data));
foreach ($arrayDo... | <?php
declare(strict_types=1);
namespace Rinvex\Support\Traits;
trait Escaper
{
/**
* Escape all values of row.
*
* @param array $row
*
* @return array
*/
protected function escapeRow(array $row): array
{
$arrayDot = array_filter(array_dot($row));
foreach ($... |
Fix a Python lint error | # -*- encoding: utf-8
import pytest
from reindex_shard_config import create_reindex_shard
@pytest.mark.parametrize(
'source_name, source_id, expected_reindex_shard', [
('sierra', 'b0000001', 'sierra/2441'),
('miro', 'A0000001', 'miro/128')
])
def test_create_reindex_shard(source_name, source_id, expecte... | # -*- encoding: utf-8
import pytest
from reindex_shard_config import create_reindex_shard
@pytest.mark.parametrize(
'source_name, source_id, expected_reindex_shard', [
('sierra', 'b0000001', 'sierra/2441'),
('miro', 'A0000001', 'miro/128')
])
def test_create_reindex_shard(source_name, source_id, expecte... |
Revert to secure DEV environment | <?php
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Debug\Debug;
// If you don't want to setup permissions the proper way, just uncomment the following PHP line
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
umask(0002);
// This check ... | <?php
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Debug\Debug;
// If you don't want to setup permissions the proper way, just uncomment the following PHP line
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
umask(0002);
// This check ... |
Make use of __DEV__ environment variable | import React from 'react'
import { createStore, applyMiddleware, compose } from 'redux'
import { Provider } from 'react-redux'
import thunk from 'redux-thunk'
import devTools from 'remote-redux-devtools'
import Tabs from './component/Tabs'
import {reducer, initialise} from './store/reducer'
class App extends React.Co... | import React from 'react'
import { createStore, applyMiddleware, compose } from 'redux'
import { Provider } from 'react-redux'
import thunk from 'redux-thunk'
import devTools from 'remote-redux-devtools'
import Tabs from './component/Tabs'
import {reducer, initialise} from './store/reducer'
class App extends React.Co... |
Add test for detailed listformatter. | package graval
import (
. "github.com/smartystreets/goconvey/convey"
"os"
"testing"
"time"
)
type TestFileInfo struct{}
func (t *TestFileInfo) Name() string {
return "file1.txt"
}
func (t *TestFileInfo) Size() int64 {
return 99
}
func (t *TestFileInfo) Mode() os.FileMode {
return os.ModeSymlink
}
func (t *... | package graval
import (
. "github.com/smartystreets/goconvey/convey"
"os"
"testing"
"time"
)
type TestFileInfo struct{}
func (t *TestFileInfo) Name() string {
return "file1.txt"
}
func (t *TestFileInfo) Size() int64 {
return 99
}
func (t *TestFileInfo) Mode() os.FileMode {
return os.ModeSymlink
}
func (t *... |
Store variables for signal status | /**
* Get the network speed from zebedee/ping endpoint and output the network health
**/
function networkStatus(ping) {
var $good = $('.icon-status--good'),
$ok = $('.icon-status--ok'),
$poor = $('.icon-status--poor'),
$veryPoor = $('.icon-status--very-poor');
if (ping > 0 && ping <... | /**
* Get the network speed from zebedee/ping endpoint and output the network health
**/
function networkStatus(ping) {
if (ping > 0 && ping < 100) {
$('.icon-status div').css({"opacity": "1.0"});
} else if (ping >= 100 && ping < 200) {
$('.icon-status--good').css({"opacity": "0.2"});
... |
Fix 'Uncaught ReferenceError: d is not defined' | var Line = require('./line');
var simplifyGeometry = function(points, tolerance){
var dmax = 0;
var index = 0;
for (var i = 1; i <= points.length - 2; i++){
var d = new Line(points[0], points[points.length - 1]).perpendicularDistance(points[i]);
if (d > dmax){
index = i;
dmax = d;
}
}... | var Line = require('./line');
var simplifyGeometry = function(points, tolerance){
var dmax = 0;
var index = 0;
for (var i = 1; i <= points.length - 2; i++){
d = new Line(points[0], points[points.length - 1]).perpendicularDistance(points[i]);
if (d > dmax){
index = i;
dmax = d;
}
}
... |
Update to new multiauthor taxonomy name | import sys
import json
import requests
from string import Template
import dateutil.parser
def posts_at_url(url):
current_page = 1
max_page = sys.maxint
while current_page <= max_page:
resp = requests.get(url, params={'json':1,'page':current_page})
results = json.loads(resp.content) ... | import sys
import json
import requests
from string import Template
import dateutil.parser
def posts_at_url(url):
current_page = 1
max_page = sys.maxint
while current_page <= max_page:
resp = requests.get(url, params={'json':1,'page':current_page})
results = json.loads(resp.content) ... |
Test for API url's without path parameters. | package org.trello4j;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.trello4j.model.Action;
/**
* Created with IntelliJ IDEA.
* User: joel
* Date: 2012-04-15
* Time: 11:00 AM
*/
public class TrelloURLTest {
/**
* Should build url with filter.
*
* @throws Exce... | package org.trello4j;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.trello4j.model.Action;
/**
* Created with IntelliJ IDEA.
* User: joel
* Date: 2012-04-15
* Time: 11:00 AM
*/
public class TrelloURLTest {
/**
* Should build url with filter.
*
* @throws Exce... |
Move the pragma: nocover to except block | import gym
import pytest
# Import for side-effect of registering environment
import imitation.examples.airl_envs # noqa: F401
import imitation.examples.model_envs # noqa: F401
ENV_NAMES = [env_spec.id for env_spec in gym.envs.registration.registry.all()
if env_spec.id.startswith('imitation/')]
@pytes... | import gym
import pytest
# Import for side-effect of registering environment
import imitation.examples.airl_envs # noqa: F401
import imitation.examples.model_envs # noqa: F401
ENV_NAMES = [env_spec.id for env_spec in gym.envs.registration.registry.all()
if env_spec.id.startswith('imitation/')]
@pytes... |
Improve tests for Path methods
Replicates graphql/graphql-js@f42cee922d13576b1452bb5bf6c7b155bf0e2ecd | from graphql.pyutils import Path
def describe_path():
def can_create_a_path():
first = Path(None, 1, "First")
assert first.prev is None
assert first.key == 1
assert first.typename == "First"
def can_add_a_new_key_to_an_existing_path():
first = Path(None, 1, "First")
... | from graphql.pyutils import Path
def describe_path():
def add_path():
path = Path(None, 0, None)
assert path.prev is None
assert path.key == 0
prev, path = path, Path(path, 1, None)
assert path.prev is prev
assert path.key == 1
prev, path = path, Path(path, ... |
Change large example to use streaming | package main
import (
"bufio"
"github.com/sean-duffy/xlsx"
"os"
"strconv"
)
func main() {
outputfile, err := os.Create("test.xlsx")
w := bufio.NewWriter(outputfile)
ww := xlsx.NewWorkbookWriter(w)
c := []xlsx.Column{
xlsx.Column{Name: "Col1", Width: 10},
xlsx.Column{Name: "Col2", Width: 10},
}
sh :=... | package main
import (
"github.com/sean-duffy/xlsx"
"strconv"
)
func main() {
c := []xlsx.Column{
xlsx.Column{Name: "Col1", Width: 10},
xlsx.Column{Name: "Col2", Width: 10},
}
sh := xlsx.NewSheetWithColumns(c)
sh.Title = "MySheet"
for i := 0; i < 10; i++ {
r := sh.NewRow()
r.Cells[0] = xlsx.Cell{
... |
Fix entity index aggregator argument error | import logging
from followthemoney import model
from servicelayer.worker import Worker
from ingestors.manager import Manager
log = logging.getLogger(__name__)
class IngestWorker(Worker):
"""A long running task runner that uses Redis as a task queue"""
def dispatch_next(self, task, entities):
next_s... | import logging
from followthemoney import model
from servicelayer.worker import Worker
from ingestors.manager import Manager
log = logging.getLogger(__name__)
class IngestWorker(Worker):
"""A long running task runner that uses Redis as a task queue"""
def dispatch_next(self, task, entities):
next_s... |
Make an error go to stderr and remove net 1 LOC | """
This file provides a single interface to unittest objects for our
tests while supporting python < 2.7 via unittest2.
If you need something from the unittest namespace it should be
imported here from the relevant module and then imported into your
test from here
"""
# Import python libs
import os
import sys
# sup... | """
This file provides a single interface to unittest objects for our
tests while supporting python < 2.7 via unittest2.
If you need something from the unittest namespace it should be
imported here from the relevant module and then imported into your
test from here
"""
# Import python libs
import os
import sys
# sup... |
Allow to retrieve the service manager object using $this->getService() | <?php
/**
* @version $Id$
* @package Koowa_Object
* @copyright Copyright (C) 2007 - 2012 Johan Janssens. All rights reserved.
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
*/
/**
* Object Serviceable Interface
*
* @author Johan Janssens <johan@nooku.org>
* @package Koowa_O... | <?php
/**
* @version $Id$
* @package Koowa_Object
* @copyright Copyright (C) 2007 - 2012 Johan Janssens. All rights reserved.
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
*/
/**
* Object Serviceable Interface
*
* @author Johan Janssens <johan@nooku.org>
* @package Koowa_O... |
Use ThreadUtils instead of its own executor | package mil.nga.mapcache.io.network;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import mil.nga.mapcache.utils.ThreadUtils;
/**
* Makes http requests asynchronously.
*/
public class HttpClient {
/**
* The instance of this class.
*/
private static final Htt... | package mil.nga.mapcache.io.network;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* Makes http requests asynchronously.
*/
public class HttpClient {
/**
* The instance of this class.
*/
private static final HttpClient instance = new HttpClient();
/*... |
Make the tree of classes. | <?php
namespace App\Http\Controllers;
use DB;
use App\Http\Requests;
use Illuminate\Http\Request;
class HomeController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
//$this->middleware('auth');
}
/**
... | <?php
namespace App\Http\Controllers;
use DB;
use App\Http\Requests;
use Illuminate\Http\Request;
class HomeController extends Controller
{
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
//$this->middleware('auth');
}
/**
... |
Add option to provide callback for request, ok and error actions
The callbacks are passed dispatch and getState along with the other
arguments. | import {createAction} from 'redux-act'
import _defaults from 'lodash.defaults';
const defaultOption = {
request:{},
ok:{},
error:{}
}
export default function createActionAsync(description, api, options = defaultOption) {
_defaults(options, defaultOption);
let actions = {
request: createAction(`${descrip... | import {createAction} from 'redux-act'
import _defaults from 'lodash.defaults';
const defaultOption = {
request:{},
ok:{},
error:{}
}
export default function createActionAsync(description, api, options = defaultOption) {
_defaults(options, defaultOption);
let actions = {
request: createAction(`${descrip... |
Add flowtype back in with valid structure for prod | // @flow
import React from 'react'
import classNames from 'classnames'
type Props = {
isAuthenticationView: boolean,
isDiscoverView: boolean,
isNavbarHidden: boolean,
isNotificationsActive: boolean,
isOnboardingView: boolean,
isProfileMenuActive: boolean,
userDetailPathClassName?: string,
}
export const... | import React, { PropTypes } from 'react'
import classNames from 'classnames'
// type Props = {
// isAuthenticationView: boolean,
// isDiscoverView: boolean,
// isNavbarHidden: boolean,
// isNotificationsActive: boolean,
// isOnboardingView: boolean,
// isProfileMenuActive: boolean,
// userDetailPathClass... |
Fix default container limit issue
https://github.com/rancher/rancher/issues/21664 | import { get, set, setProperties } from '@ember/object';
import { hash } from 'rsvp';
import { inject as service } from '@ember/service';
import Route from '@ember/routing/route';
export default Route.extend({
globalStore: service(),
clusterStore: service(),
scope: service(),
model(params) {
const... | import { get, set, setProperties } from '@ember/object';
import { hash } from 'rsvp';
import { inject as service } from '@ember/service';
import Route from '@ember/routing/route';
export default Route.extend({
globalStore: service(),
clusterStore: service(),
scope: service(),
model(params) {
const... |
Introduce factory for email config fixture
This allows to create local fixtures that use email config with a
broader scope than 'function'. | """
:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
import pytest
from byceps.services.email import service as email_service
from byceps.services.shop.cart.models import Cart
from byceps.services.shop.sequence import service as sequence_service
from byceps.services.shop... | """
:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
import pytest
from byceps.services.email import service as email_service
from byceps.services.shop.cart.models import Cart
from byceps.services.shop.sequence import service as sequence_service
from byceps.services.shop... |
Allow to use not with general conditions | /*
* (C) YANDEX LLC, 2014-2015
*
* The Source Code called "YoctoDB" available at
* https://bitbucket.org/yandex/yoctodb is subject to the terms of the
* Mozilla Public License, v. 2.0 (hereinafter referred to as the "License").
*
* A copy of the License is also available at http://mozilla.org/MPL/2.0/.
*/
pack... | /*
* (C) YANDEX LLC, 2014-2015
*
* The Source Code called "YoctoDB" available at
* https://bitbucket.org/yandex/yoctodb is subject to the terms of the
* Mozilla Public License, v. 2.0 (hereinafter referred to as the "License").
*
* A copy of the License is also available at http://mozilla.org/MPL/2.0/.
*/
pack... |
Disable braekpad automatic registration while we figure out stuff
Review URL: http://codereview.chromium.org/462022
git-svn-id: fd409f4bdeea2bb50a5d34bb4d4bfc2046a5a3dd@33686 0039d316-1c4b-4281-b951-d872f2087c98 | # Copyright (c) 2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Breakpad for Python.
Sends a notification when a process stops on an exception."""
import atexit
import getpass
import urllib
import traceback
impor... | # Copyright (c) 2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Breakpad for Python.
Sends a notification when a process stops on an exception."""
import atexit
import getpass
import urllib
import traceback
impor... |
Fix event name being returned instead of description in API | <?php
namespace Zeropingheroes\Lanager\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class Event extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
... | <?php
namespace Zeropingheroes\Lanager\Http\Resources;
use Illuminate\Http\Resources\Json\JsonResource;
class Event extends JsonResource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
... |
Add codeception framework for E2E tests [wip] | <?php
/** @var \Codeception\Scenario $scenario $I */
$I = new FunctionalTester($scenario);
$I->wantTo('perform analysis and see svg results');
@mkdir(codecept_output_dir() . 'svg');
$configFolder = codecept_data_dir('svg' . DIRECTORY_SEPARATOR . 'config');
$expectationFolder = codecept_data_dir('svg' . DIRECTORY_SEP... | <?php
/** @var \Codeception\Scenario $scenario $I */
$I = new FunctionalTester($scenario);
$I->wantTo('perform analysis and see svg results');
$configFolder = codecept_data_dir('svg' . DIRECTORY_SEPARATOR . 'config');
$expectationFolder = codecept_data_dir('svg' . DIRECTORY_SEPARATOR . 'expectation');
$outputFolder =... |
Fix a bug to specify a script resource name. | package com.github.dakusui.scriptunit.core;
import com.github.dakusui.scriptunit.annotations.Load;
import java.util.Properties;
import static com.github.dakusui.scriptunit.exceptions.ConfigurationException.scriptNotSpecified;
import static java.util.Objects.requireNonNull;
public interface Config {
String getScri... | package com.github.dakusui.scriptunit.core;
import com.github.dakusui.scriptunit.annotations.Load;
import java.util.Properties;
import static com.github.dakusui.scriptunit.exceptions.ConfigurationException.scriptNotSpecified;
import static java.util.Objects.requireNonNull;
public interface Config {
String getScri... |
Use out with out, err with err. | /**
* Copyright 2010 The PlayN Authors
*
* 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 2010 The PlayN Authors
*
* 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 ... |
Remove debug of ui router state changes. | (function (module) {
module.controller('projectListProcess', projectListProcess);
projectListProcess.$inject = ["processes", "project", "$state", "mcmodal", "$filter"];
function projectListProcess(processes, project, $state, mcmodal, $filter) {
var ctrl = this;
ctrl.viewProcess = viewProce... | (function (module) {
module.controller('projectListProcess', projectListProcess);
projectListProcess.$inject = ["processes", "project", "$state", "mcmodal", "$filter"];
function projectListProcess(processes, project, $state, mcmodal, $filter) {
console.log('projectListProcess');
var ctrl = ... |
Remove error message when using MAQ module | from impacket.ldap import ldapasn1 as ldapasn1_impacket
class CMEModule:
'''
Module by Shutdown and Podalirius
Initial module:
https://github.com/ShutdownRepo/CrackMapExec-MachineAccountQuota
Authors:
Shutdown: @_nwodtuhs
Podalirius: @podalirius_
'''
def option... | from impacket.ldap import ldapasn1 as ldapasn1_impacket
class CMEModule:
'''
Module by Shutdown and Podalirius
Initial module:
https://github.com/ShutdownRepo/CrackMapExec-MachineAccountQuota
Authors:
Shutdown: @_nwodtuhs
Podalirius: @podalirius_
'''
def option... |
Add ability to match input field's height | import classNames from 'classnames/dedupe';
import React from 'react';
import {omit} from '../../utils/Util';
const FieldLabel = (props) => {
let {children, className, matchInputHeight, required} = props;
let isToggle = false;
React.Children.forEach(children, (child) => {
let {props = {}} = child;
if ([... | import classNames from 'classnames/dedupe';
import React from 'react';
import {omit} from '../../utils/Util';
const FieldLabel = (props) => {
let {children, className, required} = props;
let isToggle = false;
React.Children.forEach(children, (child) => {
let {props = {}} = child;
if (['radio', 'checkbox... |
Add test case for search term without hits | <?php
namespace fennecweb\ajax\listing;
use \fennecweb\WebService as WebService;
class TraitsTest extends \PHPUnit_Framework_TestCase
{
public function testExecute()
{
list($service) = WebService::factory('listing/Traits');
$results = ($service->execute(array('dbversion' => DEFAULT_DBVERSION... | <?php
namespace fennecweb\ajax\listing;
use \fennecweb\WebService as WebService;
class TraitsTest extends \PHPUnit_Framework_TestCase
{
public function testExecute()
{
//Test for traits without search term or limit
list($service) = WebService::factory('listing/Traits');
$results = ($... |
Add a URL to the whitelist | IRG.constants = (function(){
var approvedDomains = function(){
return ["imgur.com", "flickr.com", "cdn.diycozyhome.com", "pbs.twimg.com", "msnbc.com",
"fbcdn-sphotos-f-a.akamaihd.net", "flic.kr", "instagram.com", "deviantart.com",
"s-media-cache-ak0.pinimg.com", "gfycat.com", "g... | IRG.constants = (function(){
var approvedDomains = function(){
return ["imgur.com", "flickr.com", "cdn.diycozyhome.com", "pbs.twimg.com", "msnbc.com",
"fbcdn-sphotos-f-a.akamaihd.net", "flic.kr", "instagram.com", "deviantart.com",
"s-media-cache-ak0.pinimg.com", "gfycat.com", "g... |
Add autoHide prop to pass down | import React, {Component, PropTypes} from 'react'
import classnames from 'classnames'
import {Scrollbars} from 'react-custom-scrollbars'
class FancyScrollbox extends Component {
constructor(props) {
super(props)
}
static defaultProps = {
autoHide: true,
}
render() {
const {autoHide, children, c... | import React, {Component, PropTypes} from 'react'
import {Scrollbars} from 'react-custom-scrollbars'
class FancyScrollbox extends Component {
constructor(props) {
super(props)
}
render() {
const {children, className} = this.props
return (
<Scrollbars
className={`fancy-scroll--containe... |
Use PHP 8 union types | <?php
declare(strict_types = 1);
/**
* /src/Entity/Interfaces/UserGroupAwareInterface.php
*
* @author TLe, Tarmo Leppänen <tarmo.leppanen@pinja.com>
*/
namespace App\Entity\Interfaces;
use App\Entity\UserGroup;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
/**
* In... | <?php
declare(strict_types = 1);
/**
* /src/Entity/Interfaces/UserGroupAwareInterface.php
*
* @author TLe, Tarmo Leppänen <tarmo.leppanen@pinja.com>
*/
namespace App\Entity\Interfaces;
use App\Entity\UserGroup;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
/**
* In... |
Refactor test to use user | from django.test import TestCase, Client
from django.contrib.auth.models import User
from billjobs.models import Bill, Service
from billjobs.settings import BILLJOBS_BILL_ISSUER
class BillingTestCase(TestCase):
''' Test billing creation and modification '''
fixtures = ['dev_data.json']
def setUp(self):
... | from django.test import TestCase, Client
from django.contrib.auth.models import User
from billjobs.models import Bill, Service
from billjobs.settings import BILLJOBS_BILL_ISSUER
class BillingTestCase(TestCase):
''' Test billing creation and modification '''
fixtures = ['dev_data.json']
def setUp(self):
... |
Add missing value check to Rating model's beforeBulkCreate | const _ = require('lodash')
const createError = require('http-errors')
module.exports = function (sequelize, DataTypes) {
const Rating = sequelize.define('Rating', {
id: {
primaryKey: true,
type: DataTypes.UUID,
defaultValue: DataTypes.UUIDV4
},
value: {
type: DataTypes.INTEGER,
... | module.exports = function (sequelize, DataTypes) {
const Rating = sequelize.define('Rating', {
id: {
primaryKey: true,
type: DataTypes.UUID,
defaultValue: DataTypes.UUIDV4
},
value: {
type: DataTypes.INTEGER,
allowNull: false,
validate: {
min: 0
}
},
... |
Disable groups update until next year | 'use strict';
var tablesUpdater = require('./tablesUpdater');
var resultsUpdater = require('./resultsUpdater');
var tournamentsUpdater = require('./tournamentsUpdater');
// var groupsUpdater = require('./groupsUpdater');
var scorersUpdater = require('./scorersUpdater');
var assistsUpdater = require('./assistsUp... | 'use strict';
var tablesUpdater = require('./tablesUpdater');
var resultsUpdater = require('./resultsUpdater');
var tournamentsUpdater = require('./tournamentsUpdater');
var groupsUpdater = require('./groupsUpdater');
var scorersUpdater = require('./scorersUpdater');
var assistsUpdater = require('./assistsUpdat... |
Fix test_tk under OS X with Tk 8.4. Patch by Ned Deily.
This should fix some buildbot failures. | import unittest
import tkinter
from tkinter import font
from test.support import requires, run_unittest
import tkinter.test.support as support
requires('gui')
class FontTest(unittest.TestCase):
def setUp(self):
support.root_deiconify()
def tearDown(self):
support.root_withdraw()
def tes... | import unittest
import tkinter
from tkinter import font
from test.support import requires, run_unittest
import tkinter.test.support as support
requires('gui')
class FontTest(unittest.TestCase):
def setUp(self):
support.root_deiconify()
def tearDown(self):
support.root_withdraw()
def tes... |
Fix logging for system commands in CI | ''' Provide common utils to validators '''
import subprocess
import sys
# Run cli command. By default, exit when an error occurs
def run_cli_cmd(cmd, exit_on_fail=True):
'''Run a command and return its output'''
print "Running system command: " + " ".join(cmd)
proc = subprocess.Popen(cmd, bufsize=-1, stder... | ''' Provide common utils to validators '''
import subprocess
import sys
# Run cli command. By default, exit when an error occurs
def run_cli_cmd(cmd, exit_on_fail=True):
'''Run a command and return its output'''
print "Running system command: " + cmd
proc = subprocess.Popen(cmd, bufsize=-1, stderr=subproce... |
Set the stride to scale | """Example experiment."""
from functools import partial
from toolbox.data import load_set
from toolbox.models import compile
from toolbox.models import fsrcnn
from toolbox.experiment import FSRCNNExperiment
# Model
scale = 3
model = compile(fsrcnn(c=1, d=56, s=12, m=4, k=scale))
model.summary()
# Data
train_set = '... | """Example experiment."""
from functools import partial
from toolbox.data import load_set
from toolbox.models import compile
from toolbox.models import fsrcnn
from toolbox.experiment import FSRCNNExperiment
# Model
scale = 3
model = compile(fsrcnn(c=1, d=56, s=12, m=4, k=3))
model.summary()
# Data
train_set = '91-i... |
Fix imports for renamed transformations | from .compute import (sum, product, scale, orthogonalize, threshold, and_, or_,
not_, demean, convolve)
from .munge import (split, rename, assign, copy, factor, filter, select,
delete, replace, to_dense)
__all__ = [
'and_',
'assign',
'convolve',
'copy',
'de... | from .compute import (sum, product, scale, orthogonalize, threshold, and_, or_,
not_, demean, convolve_HRF)
from .munge import (split, rename, assign, copy, factor, filter, select,
remove, replace, to_dense)
__all__ = [
'and_',
'assign',
'convolve_HRF',
'copy',... |
Clean up method names, variable names, and refine methods. | module.exports = (function(){
function collectParams(url) {
return require("../../helpers").paramsForUrl(url);
}
function constructUrl(params) {
url = "http://twitter-capsul.herokuapp.com/tweets?";
url += "lat" + "=" + params["lat"] + "&";
url += "lng" + "=" + params["lng"] + "&";
url += "time" + "=... | module.exports = (function(){
function collectParams(url) {
var helper = require("../../helpers");
var params = helper.paramsForUrl(url);
return params
}
function constructUrl(params) {
url = "http://twitter-capsul.herokuapp.com/tweets?";
url += "lat" + "=" + params["lat"] + "&";
url += "lng" + "="... |
Add explicit use strict for node v4 | /**
* @file stat.js
* @license MIT
* @copyright 2017 Karim Alibhai.
*/
'use strict'
const fs = require('fs')
const chalk = require('chalk')
const solver = require('solver')
const tools = process.env.TOOLS.split(',')
const results = {}
const colors = {
gulp: 'magenta',
grunt: 'yellow',
fly: 'blue',
brunch... | /**
* @file stat.js
* @license MIT
* @copyright 2017 Karim Alibhai.
*/
const fs = require('fs')
const chalk = require('chalk')
const solver = require('solver')
const tools = process.env.TOOLS.split(',')
const results = {}
const colors = {
gulp: 'magenta',
grunt: 'yellow',
fly: 'blue',
brunch: 'green'
}
l... |
Prepare for 0.0.1 release to PyPI | #!/usr/bin/env python
from setuptools import setup
setup(name='tap-awin',
version='0.0.1',
description='Singer.io tap for extracting data from the Affiliate Window API',
author='Onedox',
url='https://github.com/onedox/tap-awin',
download_url = 'https://github.com/onedox/tap-awin/archive/... | #!/usr/bin/env python
from setuptools import setup
setup(name='tap-awin',
version='0.0.1',
description='Singer.io tap for extracting data from the Affiliate Window API',
author='Onedox',
url='https://onedox.com',
classifiers=['Programming Language :: Python :: 3 :: Only'],
py_modul... |
Resolve URLs in Stylus files | const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
context: __dirname + '/src',
entry: './bootstrapper',
output: {
path: __dirname + '/public',
filename: 'bundle.js'
},
resolve: {
extensions: ['', '.js', '.jsx']
},
module: {
loaders: [
{
test: /\.(p... | const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
context: __dirname + '/src',
entry: './bootstrapper',
output: {
path: __dirname + '/public',
filename: 'bundle.js'
},
resolve: {
extensions: ['', '.js', '.jsx']
},
module: {
loaders: [
{
test: /\.(p... |
Fix page ID for sanity check page...
git-svn-id: a243b28a2a52d65555a829a95c8c333076d39ae1@1730 44740490-163a-0410-bde0-09ae8108e29a | <?php
$config = SimpleSAML_Configuration::getInstance();
$sconfig = SimpleSAML_Configuration::getConfig('config-sanitycheck.php');
$info = array();
$errors = array();
$hookinfo = array(
'info' => &$info,
'errors' => &$errors,
);
SimpleSAML_Module::callHooks('sanitycheck', $hookinfo);
if (isset($_REQUEST['output... | <?php
$config = SimpleSAML_Configuration::getInstance();
$sconfig = SimpleSAML_Configuration::getConfig('config-sanitycheck.php');
$info = array();
$errors = array();
$hookinfo = array(
'info' => &$info,
'errors' => &$errors,
);
SimpleSAML_Module::callHooks('sanitycheck', $hookinfo);
if (isset($_REQUEST['output... |
Add indication of what None means | import socket
import pytest
import portend
def socket_infos():
"""
Generate addr infos for connections to localhost
"""
host = None # all available interfaces
port = portend.find_available_local_port()
family = socket.AF_UNSPEC
socktype = socket.SOCK_STREAM
return socket.getaddrinfo(host, port, family, soc... | import socket
import pytest
import portend
def socket_infos():
"""
Generate addr infos for connections to localhost
"""
host = None
port = portend.find_available_local_port()
family = socket.AF_UNSPEC
socktype = socket.SOCK_STREAM
return socket.getaddrinfo(host, port, family, socktype)
def id_for_info(inf... |
Use the BRANCH property in the built-in class template | /**
* Generated by Mavanagaiata ${MAVANAGAIATA_VERSION} at ${TIMESTAMP}
*/
package ${PACKAGE_NAME};
public final class ${CLASS_NAME} {
public static final String BRANCH = "${BRANCH}";
public static final String COMMIT_ABBREV = "${COMMIT_ABBREV}";
public static final String COMMIT_SHA = "${COMMIT_SHA}... | /**
* Generated by Mavanagaiata ${MAVANAGAIATA_VERSION} at ${TIMESTAMP}
*/
package ${PACKAGE_NAME};
public final class ${CLASS_NAME} {
public static final String COMMIT_ABBREV = "${COMMIT_ABBREV}";
public static final String COMMIT_SHA = "${COMMIT_SHA}";
public static final String DESCRIBE = "${DESCR... |
fix: Use filename for Pipeline name
See also: #72 | # Foremast - Pipeline Tooling
#
# Copyright 2016 Gogo, 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | # Foremast - Pipeline Tooling
#
# Copyright 2016 Gogo, 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... |
Fix for broken job submission in apache | # Copyright (C) 2015, University of Notre Dame
# All rights reserved
from django.utils import timezone
from django.conf import settings
import subprocess
import sys
import os
from data_services import models as data_models
def submit(simulation_group):
"""
Run a simulation group on a local machine in backgrou... | # Copyright (C) 2015, University of Notre Dame
# All rights reserved
from django.utils import timezone
import subprocess
import sys
import os
from data_services import models as data_models
def submit(simulation_group):
"""
Run a simulation group on a local machine in background.
Raises RuntimeError if th... |
Fix in toTitle to allow heroku deploy | import Ember from 'ember';
import layout from '../templates/components/uni-horizontal-tabs';
const { Component, computed, isEmpty, observer } = Ember;
export default Component.extend({
layout,
classNames: ['uni-horizontal-tabs'],
options: [],
currentTab: 0,
/**
* @public
* @param {Option} option The... | import Ember from 'ember';
import layout from '../templates/components/uni-horizontal-tabs';
const { Component, computed, isEmpty, observer } = Ember;
export default Component.extend({
layout,
classNames: ['uni-horizontal-tabs'],
options: [],
currentTab: 0,
/**
* @public
* @param {Option} option The... |
Remove blank space at beginning | """Encodes a json representation of the business's hours into the 5-bit binary
representation used by the merge business hours turing machine. It takes input
from stdin and outputs the initial tape."""
import json
import sys
from vim_turing_machine.constants import BITS_PER_NUMBER
def encode_hours(hours, num_bits=BI... | """Encodes a json representation of the business's hours into the 5-bit binary
representation used by the merge business hours turing machine. It takes input
from stdin and outputs the initial tape."""
import json
import sys
from vim_turing_machine.constants import BITS_PER_NUMBER
from vim_turing_machine.constants imp... |
Update the default twitter query since it's been flooded by movie tweets. | """
Default settings for the ``mezzanine.twitter`` app. Each of these can be
overridden in your project's settings module, just like regular
Django settings. The ``editable`` argument for each controls whether
the setting is editable via Django's admin.
Thought should be given to how a setting is actually used before
... | """
Default settings for the ``mezzanine.twitter`` app. Each of these can be
overridden in your project's settings module, just like regular
Django settings. The ``editable`` argument for each controls whether
the setting is editable via Django's admin.
Thought should be given to how a setting is actually used before
... |
Add a space before install command
see
https://github.com/ForbesLindesay/spawn-sync/commit/b3d17f770571bd38fb66
f0206d9bf549e165e58c#commitcomment-11172494 | 'use strict';
var fs = require('fs');
var cp = require('child_process');
var assert = require('assert');
var partialDependencies = {
"concat-stream": "^1.4.7",
"os-shim": "^0.1.2"
};
var fullDependencies = {
"concat-stream": "^1.4.7",
"os-shim": "^0.1.2",
"try-thread-sleep": "^1.0.0"
};
var REQUIRES_UPDATE... | 'use strict';
var fs = require('fs');
var cp = require('child_process');
var assert = require('assert');
var partialDependencies = {
"concat-stream": "^1.4.7",
"os-shim": "^0.1.2"
};
var fullDependencies = {
"concat-stream": "^1.4.7",
"os-shim": "^0.1.2",
"try-thread-sleep": "^1.0.0"
};
var REQUIRES_UPDATE... |
Remove cancelled from default status | /*
* Copyright 2016 Timothy Brooks
*
* 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 to i... | /*
* Copyright 2016 Timothy Brooks
*
* 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 to i... |
Add alternative undefined season which some media has | package com.proxerme.library.parameters;
import android.support.annotation.IntDef;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Class of the SeasonParameter. This includes the possible yearly se... | package com.proxerme.library.parameters;
import android.support.annotation.IntDef;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Class of the SeasonParameter. This includes the possible yearly se... |
Add pagination link for previous page | <?php
$url = app('Flarum\Http\UrlGenerator');
?>
<div class="container">
<h2>{{ $translator->trans('core.views.index.all_discussions_heading') }}</h2>
<ul>
@foreach ($document->data as $discussion)
<li>
<a href="{{ $url->to('forum')->route('discussion', [
... | <?php
$url = app('Flarum\Http\UrlGenerator');
?>
<div class="container">
<h2>{{ $translator->trans('core.views.index.all_discussions_heading') }}</h2>
<ul>
@foreach ($document->data as $discussion)
<li>
<a href="{{ $url->to('forum')->route('discussion', [
... |
Fix api usage in script parse test. | 'use strict';
let assert = require('assert'),
path = require('path'),
parser = require('../lib/support/browserScript');
const TEST_SCRIPTS_FOLDER = path.resolve(__dirname, 'browserscripts', 'testscripts');
describe('#parseBrowserScripts', function() {
it('should parse valid scripts', function() {
return pa... | 'use strict';
let assert = require('assert'),
path = require('path'),
parser = require('../lib/support/browserScript');
const TEST_SCRIPTS_FOLDER = path.resolve(__dirname, 'browserscripts', 'testscripts');
describe('#parseBrowserScripts', function() {
it('should parse valid scripts', function() {
return pa... |
Add paragraphIds method to Item model. | define([
'underscore',
'jquery',
'models/resource',
'collections/bullet',
'collections/paragraph'
], function (_, $, Resource, BulletCollection, ParagraphCollection) {
'use strict';
var ItemModel = Resource.extend({
defaults: {
name: '',
title: '',
heading: ''
},
resource: ... | define([
'underscore',
'jquery',
'models/resource',
'collections/bullet',
'collections/paragraph'
], function (_, $, Resource, BulletCollection, ParagraphCollection) {
'use strict';
var ItemModel = Resource.extend({
defaults: {
name: '',
title: '',
heading: ''
},
resource: ... |
Fix PHPDoc wrong type annotation | <?php
/*
* This file is part of the PhpTabs package.
*
* Copyright (c) landrok at github.com/landrok
*
* For the full copyright and license information, please see
* <https://github.com/stdtabs/phptabs/blob/master/LICENSE>.
*/
namespace PhpTabs\Music;
class Scale
{
private $notes = array(); // 12
private ... | <?php
/*
* This file is part of the PhpTabs package.
*
* Copyright (c) landrok at github.com/landrok
*
* For the full copyright and license information, please see
* <https://github.com/stdtabs/phptabs/blob/master/LICENSE>.
*/
namespace PhpTabs\Music;
class Scale
{
private $notes = array(); // 12
private ... |
Add PATROL and RAID entity spawn reasons | package com.laytonsmith.abstraction.enums;
import com.laytonsmith.annotations.MEnum;
@MEnum("com.commandhelper.SpawnReason")
public enum MCSpawnReason {
BREEDING,
BUILD_IRONGOLEM,
BUILD_SNOWMAN,
BUILD_WITHER,
/**
* Deprecated as of 1.14, no longer used.
*/
CHUNK_GEN,
/**
* Spawned by plugins
*/
CUSTOM... | package com.laytonsmith.abstraction.enums;
import com.laytonsmith.annotations.MEnum;
@MEnum("com.commandhelper.SpawnReason")
public enum MCSpawnReason {
BREEDING,
BUILD_IRONGOLEM,
BUILD_SNOWMAN,
BUILD_WITHER,
/**
* Deprecated as of 1.14, no longer used.
*/
CHUNK_GEN,
/**
* Spawned by plugins
*/
CUSTOM... |
Use multibyte str functions in maxlength filter | <?php
class CM_Usertext_Filter_MaxLength implements CM_Usertext_Filter_Interface {
/** @var int|null */
private $_lengthMax = null;
/**
* @param int|null $lengthMax
*/
function __construct($lengthMax = null) {
if (null !== $lengthMax) {
$this->_lengthMax = (int) $lengthMax;
}
}
public function tran... | <?php
class CM_Usertext_Filter_MaxLength implements CM_Usertext_Filter_Interface {
/** @var int|null */
private $_lengthMax = null;
/**
* @param int|null $lengthMax
*/
function __construct($lengthMax = null) {
if (null !== $lengthMax) {
$this->_lengthMax = (int) $lengthMax;
}
}
public function tran... |
Return empty map if Json metadatafile does not exist | package org.rundeck.storage.data.file;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.File;
import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
/**
* $INTERFACE is ... User: greg Date: 2/18/14 Time: 11:12 AM
*/
public class JsonMetadataMappe... | package org.rundeck.storage.data.file;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.File;
import java.io.IOException;
import java.util.Map;
/**
* $INTERFACE is ... User: greg Date: 2/18/14 Time: 11:12 AM
*/
public class JsonMetadataMapper implements MetadataMapper {
private ObjectMapper o... |
Make the class package private | package info.u_team.u_team_core.data;
import java.io.IOException;
import java.util.Arrays;
import net.minecraft.resources.*;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.fml.loading.FMLLoader;
class ExistingFileHelperWithForge extends... | package info.u_team.u_team_core.data;
import java.io.IOException;
import java.util.Arrays;
import net.minecraft.resources.*;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.fml.loading.FMLLoader;
public class ExistingFileHelperWithForge ... |
Add group fetching from AD | import ldap
validEditAccessGroups = ['Office Assistants', 'Domain Admins']
def checkCredentials(username, password):
if password == "":
return 'Empty Password'
controller = 'devdc'
domainA = 'dev'
domainB = 'devlcdi'
domain = domainA + '.' + domainB
ldapServer = 'ldap://' + controller + '.' + domain
ldap... | import ldap
def checkCredentials(username, password):
if password == "":
return 'Empty Password'
controller = 'devdc'
domainA = 'dev'
domainB = 'devlcdi'
domain = domainA + '.' + domainB
ldapServer = 'ldap://' + controller + '.' + domain
ldapUsername = username + '@' + domain
ldapPassword = password
b... |
Add error messages to the asserts | import os
import sys
import json
def main():
prefix = os.environ['PREFIX']
info_file = os.path.join(prefix, 'conda-meta',
'always_include_files_regex-0.1-0.json')
with open(info_file, 'r') as fh:
info = json.load(fh)
if sys.platform == 'darwin':
assert set... | import os
import sys
import json
def main():
prefix = os.environ['PREFIX']
info_file = os.path.join(prefix, 'conda-meta',
'always_include_files_regex-0.1-0.json')
with open(info_file, 'r') as fh:
info = json.load(fh)
if sys.platform == 'darwin':
assert set... |
Make worker executor to FixedThreadPoolExecutor. | package com.amebame.triton.server;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import javax.inject.Inject;
import javax.inject.Singleton;
import com.amebame.triton.config.TritonServerConfiguration;
import com.amebame.triton.util.NamedThreadFactory;
@Singleton
public class Tri... | package com.amebame.triton.server;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import javax.inject.Inject;
import javax.inject.Singleton;
import com.amebame.triton.config.TritonServ... |
Add example for sending a E-mail when a Error is logged by Application | <?php
//--------------------------------------------------------------------------
// Application Error Logger
//--------------------------------------------------------------------------
Log::useFiles(storage_path() .'Logs' .DS .'error.log');
// Send a E-Mail to administrator when a Error is logged by Application.
... | <?php
//--------------------------------------------------------------------------
// Application Error Logger
//--------------------------------------------------------------------------
Log::useFiles(storage_path() .'Logs' .DS .'error.log');
//-----------------------------------------------------------------------... |
Add about/phpinfo for debugging (admin only) | <?php
class aboutActions extends sfActions
{
public function executeIndex()
{
$this->forward('about', 'about');
}
public function executeAbout()
{
$response = $this->getResponse();
// test et preuve pour HostGator après l'attaque 2014/02/19
$throttler = new RequestThrottler($this->getUser(),... | <?php
class aboutActions extends sfActions
{
public function executeIndex()
{
$this->forward('about', 'about');
}
public function executeAbout()
{
$response = $this->getResponse();
// test et preuve pour HostGator après l'attaque 2014/02/19
$throttler = new RequestThrottler($this->getUser(),... |
Fix error - transparent not defined |
var postcss = require('postcss'),
color = require('color');
module.exports = postcss.plugin('postcss-lowvision', function () {
return function (css) {
css.walkDecls('color', function (decl) {
var val = decl.value;
var rgb = color(val);
rgb = rgb.rgbArray();
... |
var postcss = require('postcss'),
color = require('color');
module.exports = postcss.plugin('postcss-lowvision', function () {
return function (css) {
css.walkDecls('color', function (decl) {
var val = decl.value;
var rgb = color(val);
rgb = rgb.rgbArray();
... |
Read the intput file specified on the command line. | import argparse
import sys
import hybridJaccard as hj
def main():
"Command line testinterface."
parser = argparse.ArgumentParser()
parser.add_argument('-c','--configFile', help="Configuration file (JSON).", required=False)
parser.add_argument('-i','--input', help="Input file of phrases to test.", requ... | import argparse
import sys
import hybridJaccard as hj
def main():
"Command line testinterface."
parser = argparse.ArgumentParser()
parser.add_argument('-c','--configFile', help="Configuration file (JSON).", required=False)
parser.add_argument('-i','--input', help="Input file of phrases to test.", requ... |
Fix missing GitlabResourceOwner namespace use | <?php
/*
* OAuth2 Client Bundle
* Copyright (c) KnpUniversity <http://knpuniversity.com/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace KnpU\OAuth2ClientBundle\Client\Provider;
use KnpU\OAuth2ClientBundle\Client\OAuth... | <?php
/*
* OAuth2 Client Bundle
* Copyright (c) KnpUniversity <http://knpuniversity.com/>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace KnpU\OAuth2ClientBundle\Client\Provider;
use KnpU\OAuth2ClientBundle\Client\OAuth... |
Use const and let keywords | 'use strict';
const minimatch = require('minimatch');
module.exports = function(env, callback) {
function list(contents) {
let entries = [];
for (let key in contents._) {
if (contents._.hasOwnProperty(key)) {
const value = contents._[key];
switch (key) {
case 'directories':... | 'use strict';
var minimatch = require('minimatch');
module.exports = function(env, callback) {
function list(contents) {
var entries = [];
for (var key in contents._) {
if (contents._.hasOwnProperty(key)) {
var value = contents._[key];
switch (key) {
case 'directories':
... |
Add .filter() call on this.props.children
I was encountering a problem, where if a null value was passed as a child to Component, it threw a few errors.
This .filter() removes all falsey values from this.props.children, preventing the errors, and returning the correct result. | /* @flow */
'use strict';
import React from 'react';
import NativeBaseComponent from '../Base/NativeBaseComponent';
import computeProps from '../../Utils/computeProps';
import ScrollableTabView from './../vendor/react-native-scrollable-tab-view';
export default class TabNB extends NativeBaseComponent {
propTypes... | /* @flow */
'use strict';
import React from 'react';
import NativeBaseComponent from '../Base/NativeBaseComponent';
import computeProps from '../../Utils/computeProps';
import ScrollableTabView from './../vendor/react-native-scrollable-tab-view';
export default class TabNB extends NativeBaseComponent {
propTypes... |
Include a modification time on resource creation | package com.dtolabs.rundeck.core.storage;
import com.dtolabs.rundeck.plugins.storage.StorageConverterPlugin;
import org.rundeck.storage.api.HasInputStream;
import org.rundeck.storage.api.Path;
import java.util.Date;
/**
* StorageTimestamperConverter sets modification and creation timestamp metadata for updated/crea... | package com.dtolabs.rundeck.core.storage;
import com.dtolabs.rundeck.plugins.storage.StorageConverterPlugin;
import org.rundeck.storage.api.HasInputStream;
import org.rundeck.storage.api.Path;
import java.util.Date;
/**
* StorageTimestamperConverter sets modification and creation timestamp metadata for updated/crea... |
Add newline at end of file | import sys
try:
from django.conf import settings
settings.configure(
DEBUG=True,
USE_TZ=True,
DATABASES={
"default": {
"ENGINE": "django.db.backends.sqlite3",
}
},
ROOT_URLCONF="watchman.urls",
INSTALLED_APPS=[
... | import sys
try:
from django.conf import settings
settings.configure(
DEBUG=True,
USE_TZ=True,
DATABASES={
"default": {
"ENGINE": "django.db.backends.sqlite3",
}
},
ROOT_URLCONF="watchman.urls",
INSTALLED_APPS=[
... |
Remove page, add offset and limit to filtered filters | import React, { Component } from 'react'
import { isArray, forEach } from 'lodash'
import qs from 'qs'
import Datasets from './Datasets'
const DISABLED_FILTERS = [ 'q', 'offset', 'limit' ]
export function _extractFilters(query) {
let filters = []
forEach(query, function(value, key) {
if (DISABLED_FILTERS.incl... | import React, { Component } from 'react'
import { isArray, forEach } from 'lodash'
import qs from 'qs'
import Datasets from './Datasets'
const DISABLED_FILTERS = ['q', 'page', ]
export function _extractFilters(query) {
let filters = []
forEach(query, function(value, key) {
if (DISABLED_FILTERS.includes(key)) ... |
Update error method to allow for new Error objects | var LogEmitter = function (source) {
this.source = source;
};
LogEmitter.prototype.info = function (message) {
process.emit("gulp:log", { level: "info", message: message, source: this.source });
};
LogEmitter.prototype.warn = function (message) {
process.emit("gulp:log", { level: "warn", message: message, source: ... | var LogEmitter = function (source) {
this.source = source;
};
LogEmitter.prototype.info = function (message) {
process.emit("gulp:log", { level: "info", message: message, source: this.source });
};
LogEmitter.prototype.warn = function (message) {
process.emit("gulp:log", { level: "warn", message: message, source: ... |
Comment did not make sense anymore | /*
* Copyright (c) OSGi Alliance (2008, 2009). 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 req... | /*
* Copyright (c) OSGi Alliance (2008, 2009). 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 req... |
Change timeout 55s to 30s | package controller
import (
"net/http"
"time"
"github.com/utahta/momoclo-channel/appengine/lib/crawler"
"github.com/utahta/momoclo-channel/appengine/lib/reminder"
"github.com/utahta/momoclo-channel/appengine/lib/ustream"
"golang.org/x/net/context"
)
// Notify reminder
func CronReminder(w http.ResponseWriter, r... | package controller
import (
"net/http"
"time"
"github.com/utahta/momoclo-channel/appengine/lib/crawler"
"github.com/utahta/momoclo-channel/appengine/lib/reminder"
"github.com/utahta/momoclo-channel/appengine/lib/ustream"
"golang.org/x/net/context"
)
// Notify reminder
func CronReminder(w http.ResponseWriter, r... |
Clarify that options takes a database parameter
Hi,
First, many thanks for putting this together.
I just got (stupidly) stuck on this for a bit until I read the docs a bit more closely and realized that the DB name is part of the options object. I figured I would add a couple of lines to this to clarify even fu... | var Connection = require('../lib/tedious').Connection;
var Request = require('../lib/tedious').Request;
var config = {
server: '192.168.1.212',
userName: 'test',
password: 'test'
/*
,options: {
debug: {
packet: true,
data: true,
payload: true,
token: false,
log: true
},
... | var Connection = require('../lib/tedious').Connection;
var Request = require('../lib/tedious').Request;
var config = {
server: '192.168.1.212',
userName: 'test',
password: 'test'
/*
,options: {
debug: {
packet: true,
data: true,
payload: true,
token: false,
log: true
}
... |
Fix the assumption that options.vcf_file is a string. | #!/usr/bin/python
import vcf
import os
from optparse import OptionParser
parser = OptionParser()
parser.add_option("--vcf", dest="vcf_file", help="Path to VCF to convert", default="")
#parser.add_option("--conf", dest="config_file", help="Path to DataBase config file", default=False)
(options, args) = parse... | #!/usr/bin/python
import vcf
import os
from optparse import OptionParser
parser = OptionParser()
parser.add_option("--vcf", dest="vcf_file", help="Path to VCF to convert", default=False)
#parser.add_option("--conf", dest="config_file", help="Path to DataBase config file", default=False)
(options, args) = pa... |
Remove port file on kill | #!/usr/bin/env node
'use strict';
var net = require('net');
var fs = require('fs');
var eslint = require('eslint');
var engine = new eslint.CLIEngine();
var formatter = engine.getFormatter('compact');
var server = net.createServer({
allowHalfOpen: true
}, function (con) {
var data = '';
con.on('data', function... | #!/usr/bin/env node
'use strict';
var net = require('net');
var fs = require('fs');
var eslint = require('eslint');
var engine = new eslint.CLIEngine();
var formatter = engine.getFormatter('compact');
var server = net.createServer({
allowHalfOpen: true
}, function (con) {
var data = '';
con.on('data', function... |
Add a header to the movie reviews single file. | <div class="page-header">
<h1>Movie Reviews</h1>
</div>
<article <?php post_class('row'); ?>>
<figure class="movie-review-poster col-md-3">
<?php the_post_thumbnail('movie-poster'); ?>
</figure>
<section class="movie-review-snippet col-md-9">
<header class="clearfix">
<div class="mov... | <article <?php post_class('row'); ?>>
<figure class="movie-review-poster col-md-3">
<?php the_post_thumbnail('movie-poster'); ?>
</figure>
<section class="movie-review-snippet col-md-9">
<header class="clearfix">
<div class="movie-review-rating col-sm-1 <?php the_field('movie_grade'); ... |
Use a GET request instead | from flask import Flask, request
import requests
from urllib import urlencode
app = Flask(__name__)
@app.route("/")
def meme():
slackbot = request.args["slackbot"]
text = request.args["text"]
channel = request.args["channel_name"]
text = text[:-1] if text[-1] == ";" else text
params = text.split(... | from flask import Flask, request
import requests
from urllib import urlencode
app = Flask(__name__)
@app.route("/", methods=['POST'])
def meme():
form = request.form.to_dict()
slackbot = form["slackbot"]
text = form["text"]
channel = form["channel_name"]
text = text[:-1] if text[-1] == ";" else ... |
Update player creation test to verify POST status code. | from webtest import TestApp
import dropshot
def test_create_player():
app = TestApp(dropshot.app)
params = {'username': 'chapmang',
'password': 'deadparrot',
'email': 'chapmang@dropshot.com'}
expected = {'count': 1,
'offset': 0,
'players': [
... | from webtest import TestApp
import dropshot
def test_create_player():
app = TestApp(dropshot.app)
params = {'username': 'chapmang',
'password': 'deadparrot',
'email': 'chapmang@dropshot.com'}
expected = {'count': 1,
'offset': 0,
'players': [
... |
Fix the cancelled key bug | domready(function() {
var UP = "up";
var DOWN = "down";
var current = 0;
var height = document.body.clientHeight;
var number = document.querySelectorAll('body > section').length;
var running = false;
var duration = parseFloat(getComputedStyle(document.body).transitionDuration) * 1000;
function slide(direction)... | domready(function() {
var UP = "up";
var DOWN = "down";
var current = 0;
var height = document.body.clientHeight;
var number = document.querySelectorAll('body > section').length;
var running = false;
var duration = parseFloat(getComputedStyle(document.body).transitionDuration) * 1000;
function slide(direction)... |
Remove some nasty imports to avoid cyclic import issues. | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... | # Licensed to the StackStorm, Inc ('StackStorm') under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use th... |
Make lib/net.MeasuringDialer.Dial() conform to Dialer.Dial(). | package net
import (
"net"
"time"
)
func newMeasuringDialer(dialer Dialer) *MeasuringDialer {
return &MeasuringDialer{dialer: dialer}
}
func (d *MeasuringDialer) Dial(network, address string) (net.Conn, error) {
startTime := time.Now()
netConn, err := d.dialer.Dial(network, address)
d.cumulativeDialTime += tim... | package net
import (
"time"
)
func newMeasuringDialer(dialer Dialer) *MeasuringDialer {
return &MeasuringDialer{dialer: dialer}
}
func (d *MeasuringDialer) Dial(network, address string) (
*MeasuringConnection, error) {
startTime := time.Now()
netConn, err := d.dialer.Dial(network, address)
d.cumulativeDialTime... |
Change from resourceId to id | package model.job.metadata;
import java.util.List;
import org.joda.time.DateTime;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
@JsonInclude(I... | package model.job.metadata;
import java.util.List;
import org.joda.time.DateTime;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
@JsonInclude(I... |
Switch version to semantic versioning. | #!/usr/bin/env python
# coding=utf8
import os
from setuptools import setup, find_packages
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(name='legitfs',
version='0.4.0.0dev',
description=('A read-only FUSE-based filesystem allowing you to browse '
... | #!/usr/bin/env python
# coding=utf8
import os
from setuptools import setup, find_packages
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(name='legitfs',
version='0.4.dev1',
description=('A read-only FUSE-based filesystem allowing you to browse '
... |
Remove irrelvant methods in the test model | <?php
class MockJsonModel extends Illuminate\Database\Eloquent\Model
{
use \ModelJsonColumn\JsonColumnTrait;
protected $json_columns;
public function __construct(array $attributes = [])
{
static::$booted[get_class($this)] = true;
parent::__construct($attributes);
}
public fun... | <?php
class MockJsonModel extends Illuminate\Database\Eloquent\Model
{
use \ModelJsonColumn\JsonColumnTrait;
protected $json_columns;
public function __construct(array $attributes = [])
{
static::$booted[get_class($this)] = true;
parent::__construct($attributes);
}
public fun... |
Add sourcemaps for easier debugging | var path = require('path');
var webpack = require('webpack');
var BundleTracker = require('webpack-bundle-tracker');
module.exports = {
context: __dirname,
entry: './scrappyr/static/js/index',
output: {
path: path.resolve('./scrappyr/static/webpack_bundles/'),
filename: "[name]-[hash].js"
},
devt... | var path = require('path');
var webpack = require('webpack');
var BundleTracker = require('webpack-bundle-tracker');
module.exports = {
context: __dirname,
entry: './scrappyr/static/js/index',
output: {
path: path.resolve('./scrappyr/static/webpack_bundles/'),
filename: "[name]-[hash].js"
},
plug... |
Use variables to cache values | import React from 'react';
export class Checkbox extends React.PureComponent {
handleToggle = () => {
const { node, handleToggle } = this.props;
handleToggle(node);
}
render() {
const { node, handleToggle } = this.props;
if (node.childKeys && node.childKeys.length) {
let nodeList = node.c... | import React from 'react';
export class Checkbox extends React.PureComponent {
handleToggle = () => {
this.props.handleToggle(this.props.node);
}
render() {
if (this.props.node.childKeys && this.props.node.childKeys.length) {
let nodeList = this.props.node.childKeys.map(childNode => {
ret... |
Allow cursor to be executed directly | module.exports = function(schema, options) {
options || (options = {});
options.path || (options.path = '_acl');
// Fields
var fields = {};
if (!schema.paths[options.path]) {
fields[options.path] = {};
}
schema.add(fields);
// Methods
schema.methods.setAccess = function... | module.exports = function(schema, options) {
options || (options = {});
options.path || (options.path = '_acl');
// Fields
var fields = {};
if (!schema.paths[options.path]) {
fields[options.path] = {};
}
schema.add(fields);
// Methods
schema.methods.setAccess = function... |
Use "id" instead of "plot_id"
For the fake utf grid | from django.conf.urls import patterns, include, url
from django.http import HttpResponse
from opentreemap import urls
testing_id = 1
def full_utf8_grid(request):
"""
Creates a big utf8 grid where every entry is 'turned on'
to point to whatever plot id is the currently assigned value
of testing_id
... | from django.conf.urls import patterns, include, url
from django.http import HttpResponse
from opentreemap import urls
testing_id = 1
def full_utf8_grid(request):
"""
Creates a big utf8 grid where every entry is 'turned on'
to point to whatever plot id is the currently assigned value
of testing_id
... |
Add Ember 1.12 and 1.13 to tests | /*jshint node:true*/
module.exports = {
scenarios: [
{
name: 'default',
dependencies: { }
},
{
name: 'ember-1.12',
dependencies: {
'ember': '1.12'
}
},
{
name: 'ember-1.13',
dependencies: {
'ember': '1.13'
}
},
{
name: '... | /*jshint node:true*/
module.exports = {
scenarios: [
{
name: 'default',
dependencies: { }
},
{
name: 'ember-release',
dependencies: {
'ember': 'components/ember#release'
},
resolutions: {
'ember': 'release'
}
},
{
name: 'ember-beta',
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.