text stringlengths 17 1.47k | positive stringlengths 673 4.43k | negative stringlengths 677 2.81k |
|---|---|---|
III-1783: Remove unnecessary dependency on Monolog | <?php
namespace CultuurNet\UDB3\Log;
use Psr\Log\LoggerInterface;
use Psr\Log\LogLevel;
class ContextEnrichingLoggerTest extends \PHPUnit_Framework_TestCase
{
/**
* @test
*/
public function it_passes_additional_context_to_the_decorated_logger()
{
/** @var LoggerInterface|\PHPUnit_Framew... | <?php
/**
* @file
*/
namespace CultuurNet\UDB3\Log;
use Monolog\Logger;
use Psr\Log\LoggerInterface;
class ContextEnrichingLoggerTest extends \PHPUnit_Framework_TestCase
{
/**
* @test
*/
public function it_passes_additional_context_to_the_decorated_logger()
{
/** @var LoggerInterface|... |
Increase taskList performance by reducing queries | <?php
namespace AppBundle\Repository;
use Doctrine\ORM\EntityRepository;
/**
* TaskListsRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class TaskListsRepository extends EntityRepository
{
public function findAll()
{
$today = new \DateTime... | <?php
namespace AppBundle\Repository;
use Doctrine\ORM\EntityRepository;
/**
* TaskListsRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class TaskListsRepository extends EntityRepository
{
public function findAll()
{
$today = new \DateTime... |
Add a NONE order option to sort order. | /*
* Copyright 2013 Franklin Bristow <franklin.bristow@phac-aspc.gc.ca>.
*
* 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
*
* Unles... | /*
* Copyright 2013 Franklin Bristow <franklin.bristow@phac-aspc.gc.ca>.
*
* 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
*
* Unles... |
Add some tests for stringport | """
Unittests for opal.utils
"""
from django.test import TestCase
from django.db.models import ForeignKey, CharField
from opal import utils
class StringportTestCase(TestCase):
def test_import(self):
import collections
self.assertEqual(collections, utils.stringport('collections'))
def test_im... | """
Unittests for opal.utils
"""
from django.test import TestCase
from django.db.models import ForeignKey, CharField
from opal import utils
class StringportTestCase(TestCase):
def test_import(self):
import collections
self.assertEqual(collections, utils.stringport('collections'))
class Itersubc... |
Add function name for debugging | "use strict";
module.exports = function(opts) {
opts.dbname = opts.dbname || 'yamb';
if (!opts.storage) {
// TODO: fix error message
throw new Error('error with storage');
}
const Yamb = require('./yamb')(opts);
return {
create: function create(data) {
let post = new Yamb();
return... | "use strict";
module.exports = function(opts) {
opts.dbname = opts.dbname || 'yamb';
if (!opts.storage) {
// TODO: fix error message
throw new Error('error with storage');
}
const Yamb = require('./yamb')(opts);
return {
create: function(data) {
let post = new Yamb();
return post.u... |
Fix bug in handling arguments
Signed-off-by: Stefan Marr <46f1a0bd5592a2f9244ca321b129902a06b53e03@stefan-marr.de> | package som;
import java.util.Arrays;
public class VMOptions {
public static final String STANDARD_PLATFORM_FILE = "core-lib/Platform.som";
public static final String STANDARD_KERNEL_FILE = "core-lib/Kernel.som";
public String platformFile = STANDARD_PLATFORM_FILE;
public String kernelFile = STANDAR... | package som;
import java.util.Arrays;
public class VMOptions {
public static final String STANDARD_PLATFORM_FILE = "core-lib/Platform.som";
public static final String STANDARD_KERNEL_FILE = "core-lib/Kernel.som";
public String platformFile = STANDARD_PLATFORM_FILE;
public String kernelFile = STANDAR... |
Change marathon endpoint to groups | import ActionTypes from '../constants/ActionTypes';
var AppDispatcher = require('./AppDispatcher');
var Config = require('../config/Config');
var RequestUtil = require('../utils/RequestUtil');
module.exports = {
fetchApps: RequestUtil.debounceOnError(
Config.getRefreshRate(),
function (resolve, reject) {
... | import ActionTypes from '../constants/ActionTypes';
var AppDispatcher = require('./AppDispatcher');
var Config = require('../config/Config');
var RequestUtil = require('../utils/RequestUtil');
module.exports = {
fetchApps: RequestUtil.debounceOnError(
Config.getRefreshRate(),
function (resolve, reject) {
... |
Add setting about server port | /**
* Created by dell on 2015/7/20.
* This is gulp init
*/
(function(){
"use strict";
var gulp = require('gulp');
var loadPlugins = require('gulp-load-plugins');
var plugins = loadPlugins();
var Browsersync = require('browser-sync').create();
var del = require('del');
v... | /**
* Created by dell on 2015/7/20.
* This is gulp init
*/
(function(){
"use strict";
var gulp = require('gulp');
var loadPlugins = require('gulp-load-plugins');
var plugins = loadPlugins();
var Browsersync = require('browser-sync').create();
var del = require('del');
v... |
Use double quotes to quote command arguments. The Windows command
parser doesn't recognize single quotes. | import sys
import os
import time
try:
import subprocess
except ImportError:
# use private copy for old Python versions
import MonetDBtesting.subprocess26 as subprocess
def server():
s = subprocess.Popen('%s "--dbinit=include sql;" --set gdk_readonly=yes' % os.getenv('MSERVER'),
... | import sys
import os
import time
try:
import subprocess
except ImportError:
# use private copy for old Python versions
import MonetDBtesting.subprocess26 as subprocess
def server():
s = subprocess.Popen("%s --dbinit='include sql;' --set gdk_readonly=yes" % os.getenv('MSERVER'),
... |
oss: Fix overquoting of thrift paths
Summary: This overquotes the paths in travis builds. This will fix the opensource broken builds
Reviewed By: snarkmaster
Differential Revision: D5923131
fbshipit-source-id: 1ff3e864107b0074fc85e8a45a37455430cf4ba3 | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
'fbcode_builder steps to build & test Bistro'
import specs.fbthrift as fbthrift
import specs.folly as folly
import specs.proxygen as proxygen
from ... | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
'fbcode_builder steps to build & test Bistro'
import specs.fbthrift as fbthrift
import specs.folly as folly
import specs.proxygen as proxygen
from ... |
Update js to bust compressor cache. |
'use strict';
(function() {
angular.module('fireStation.homeController', [])
.controller('home', function($scope, map, $filter) {
var homeMap = map.initMap('map', {scrollWheelZoom: false});
homeMap.setView([40, -90], 4);
var headquartersIcon = L.FireCARESMarkers.headquartersmarker();
... |
'use strict';
(function() {
angular.module('fireStation.homeController', [])
.controller('home', function($scope, map, $filter) {
var homeMap = map.initMap('map', {scrollWheelZoom: false});
homeMap.setView([40, -90], 4);
var headquartersIcon = L.FireCARESMarkers.headquarte... |
Update gui on receiving CLIENTLIST message | package lanchat.client;
import java.io.IOException;
import java.util.ArrayList;
import javafx.application.Platform;
import lanchat.common.ServerMessage;
import lanchat.common.ServerMessageType;
import lanchat.gui.ClientGUI;
public class MessageListener extends Thread{
private Client client;
private boolean runn... | package lanchat.client;
import java.io.IOException;
import java.util.ArrayList;
import javafx.application.Platform;
import lanchat.common.ServerMessage;
import lanchat.common.ServerMessageType;
import lanchat.gui.ClientGUI;
public class MessageListener extends Thread{
private Client client;
private boolean runn... |
Fix emoticon-related parsing issues for chat messages | package pro.beam.api.resource.chat.events.data;
import java.util.List;
import pro.beam.api.resource.BeamUser;
import pro.beam.api.resource.chat.AbstractChatEvent;
import com.google.common.base.Function;
import com.google.common.base.Joiner;
import com.google.common.collect.Iterators;
import com.google.gson.annotatio... | package pro.beam.api.resource.chat.events.data;
import java.util.List;
import pro.beam.api.resource.BeamUser;
import pro.beam.api.resource.chat.AbstractChatEvent;
import com.google.common.base.Function;
import com.google.common.base.Joiner;
import com.google.common.collect.Iterators;
import com.google.gson.annotatio... |
Use const for requirements, constants and variables that are initialized once | const BaseDataview = require('./base');
const TYPE = 'list';
const listSqlTpl = ctx => `select ${ctx._columns} from (${ctx._query}) as _cdb_list`;
/**
{
type: 'list',
options: {
columns: ['name', 'description']
}
}
*/
module.exports = class List extends BaseDataview{
constructor (query, optio... | var BaseDataview = require('./base');
var TYPE = 'list';
var listSqlTpl = ctx => `select ${ctx._columns} from (${ctx._query}) as _cdb_list`;
/**
{
type: 'list',
options: {
columns: ['name', 'description']
}
}
*/
module.exports = class List extends BaseDataview{
constructor (query, options = {... |
Fix значение файла из php.ini конвертируем в килобайты | <?php
namespace SleepingOwl\Admin\Traits;
trait MaxFileSizeTrait
{
/**
* @var number
*/
protected $maxFileSize;
/**
* Возвращает максимальный размер загружаемого файла из конфигурации php.ini
*
* @return number Максимальный размер загружаемого файла в килобайтах
*/
publi... | <?php
namespace SleepingOwl\Admin\Traits;
trait MaxFileSizeTrait
{
/**
* @var number
*/
protected $maxFileSize;
/**
* @return number
*/
public function getMaxFileSize()
{
if (! $this->maxFileSize) {
try {
$this->maxFileSize = $this->convertM... |
Fix typo in `scarlarToString` method name.
This is a protected function and is not called anywhere else but this class, so this is safe to rename. | <?php
namespace Flint\Config\Normalizer;
use Pimple;
/**
* @package Flint
*/
class PimpleAwareNormalizer extends \Flint\PimpleAware implements NormalizerInterface
{
const PLACEHOLDER = '{%%|%([a-z0-9_.]+)%}';
/**
* @param Pimple $pimple
*/
public function __construct(Pimple $pimple = null)
... | <?php
namespace Flint\Config\Normalizer;
use Pimple;
/**
* @package Flint
*/
class PimpleAwareNormalizer extends \Flint\PimpleAware implements NormalizerInterface
{
const PLACEHOLDER = '{%%|%([a-z0-9_.]+)%}';
/**
* @param Pimple $pimple
*/
public function __construct(Pimple $pimple = null)
... |
Add stopwatch to log output and a finished message | package com.axiomalaska.sos.injector.db;
import java.util.concurrent.TimeUnit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.axiomalaska.sos.SosInjector;
import com.google.common.base.Stopwatch;
public class DatabaseSosInjector {
private static final Logger LOGGER = LoggerFactory.getLogger... | package com.axiomalaska.sos.injector.db;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.axiomalaska.sos.SosInjector;
public class DatabaseSosInjector {
private static final Logger LOGGER = LoggerFactory.getLogger(DatabaseSosInjector.class);
private static final String MOCK = "mock";
... |
Remove enabled filter on clusterTemplates that caused js error
rancher/rancher#20268 | import Controller from '@ember/controller';
import { computed, get } from '@ember/object';
import { inject as service } from '@ember/service';
export default Controller.extend({
router: service(),
clusterTemplateRevisionId: null,
actions: {
save() {
if (this.clusterTemplateRevisionId) {
this.... | import Controller from '@ember/controller';
import { computed, get } from '@ember/object';
import { inject as service } from '@ember/service';
export default Controller.extend({
router: service(),
clusterTemplateRevisionId: null,
actions: {
save() {
if (this.clusterTemplateRevisionId) {
this.... |
Refactor FefPopup to work with dynamic links | const DEFAULT_HEIGHT = 600,
DEFAULT_WIDTH= 944,
DEFAULT_MEDIA_QUERY = 'screen';
export function init() {
$(document).on('click', '.js-popup', (event) => {
let popup = new FefPopup($(event.currentTarget));
popup.openPopup(event);
});
}
class FefPopup {
/**
* @param $element jQ... | const DEFAULT_HEIGHT = 600,
DEFAULT_WIDTH= 944,
DEFAULT_MEDIA_QUERY = 'screen';
export function init() {
$('.js-popup').each((index, elem) => {
new FefPopup($(elem));
});
}
export class FefPopup {
/**
* @param $element jQuery.element
*/
constructor ($element) {
this.... |
Remove unused field from game form | from crispy_forms.bootstrap import FormActions
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, HTML, Submit, Button, Fieldset
from django.forms import ModelForm, Textarea
from core.models import Game
class GameForm(ModelForm):
class Meta:
model = Game
exclude = [... | from crispy_forms.bootstrap import FormActions
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, HTML, Submit, Button, Fieldset
from django.forms import ModelForm, Textarea
from core.models import Game
class GameForm(ModelForm):
class Meta:
model = Game
exclude = [... |
Switch left/right mouse buttons, remove zoom on middle | 'use strict';
define(
['three', 'OrbitControls'],
function(THREE) {
return class Camera {
// ##############################################
// # Constructor ################################
// ##############################################
co... | 'use strict';
define(
['three', 'OrbitControls'],
function(THREE) {
return class Camera {
// ##############################################
// # Constructor ################################
// ##############################################
co... |
Make plugin loader more robust | class PluginLoader:
def load(self, directory):
ret = []
for plugin in directory.children:
plugin_file = plugin.find(name=plugin.name, type='py')
if not plugin_file:
continue
plugin_class = plugin_file.classes.get(plugin.name)
if n... | class PluginLoader:
def load(self, directory):
ret = []
for plugin in directory.children:
plugin_file = plugin.find(name=plugin.name, type='py')
if not plugin_file:
continue
plugin_class = plugin_file.classes[plugin.name]
... |
fix: Add style to required radio button group | import styles from './input.css'
export default ({ className, onCommit, property, value }) => {
function getValue(checked, newValue) {
if (!property.isArray) {
return newValue
}
const values = [...value]
if (checked) {
values.push(newValue)
}
else {
values.splice(values.in... | export default ({ className, onCommit, property, value }) => {
function getValue(checked, newValue) {
if (!property.isArray) {
return newValue
}
const values = [...value]
if (checked) {
values.push(newValue)
}
else {
values.splice(values.indexOf(newValue), 1)
}
ret... |
Add development version and correct url to github | """
Flask-MongoKit
--------------
Flask-MongoKit simplifies to use MongoKit, a powerful MongoDB ORM in Flask
applications.
Links
`````
* `documentation <http://packages.python.org/Flask-MongoKit>`_
* `development version <http://github.com/jarus/flask-mongokit/zipball/master#egg=Flask-MongoKit-dev>`_
* `MongoK... | """
Flask-MongoKit
--------------
Flask-MongoKit simplifies to use MongoKit, a powerful MongoDB ORM in Flask
applications.
Links
`````
* `documentation <http://packages.python.org/Flask-MongoKit>`_
* `sourcecode <http://bitbucket.org/Jarus/flask-mongokit/>`_
* `MongoKit <http://namlook.github.com/mongokit/>`_
... |
Add test reporting debug logging | var request = require('superagent');
module.exports = {
"Load front page": function(browser) {
browser
.url("http://localhost:44199")
.waitForElementVisible('body', 1000)
.assert.containsText('.login', 'Sign in')
.end();
},
tearDown: function(done) {... | var request = require('superagent');
module.exports = {
"Load front page": function(browser) {
browser
.url("http://localhost:44199")
.waitForElementVisible('body', 1000)
.assert.containsText('.login', 'Sign in')
.end();
},
tearDown: function(done) {... |
Put root URL the way it was. | <?php
namespace Trotch\Renderer;
use Trotch\Container;
use Trotch\Renderer;
class GeoLike extends Renderer
{
/**
* @var string
*/
protected $template = 'like.php';
/**
*
*/
protected function pre()
{
if (isset($_GET['token']) && isset($_SESSION['token']) && $_GET['t... | <?php
namespace Trotch\Renderer;
use Trotch\Container;
use Trotch\Renderer;
class GeoLike extends Renderer
{
/**
* @var string
*/
protected $template = 'like.php';
/**
*
*/
protected function pre()
{
if (isset($_GET['token']) && isset($_SESSION['token']) && $_GET['t... |
Make fallback XML root element be in correct namespace | <?php
namespace PharIo\Phive {
abstract class XmlRepository {
/**
* @var string
*/
private $filename = '';
/**
* @var \DOMDocument
*/
private $dom;
/**
* @var \DOMXPath
*/
private $xPath;
/**
... | <?php
namespace PharIo\Phive {
abstract class XmlRepository {
/**
* @var string
*/
private $filename = '';
/**
* @var \DOMDocument
*/
private $dom;
/**
* @var \DOMXPath
*/
private $xPath;
/**
... |
Add hack to allow specifying newlines in scripts | class InstructionBase(object):
BEFORE=None
AFTER=None
def __init__(self, search_string):
self.search_string = search_string
@property
def search_string(self):
return self._search_string
@search_string.setter
def search_string(self, value):
if value.startswith(self.... | class InstructionBase(object):
BEFORE=None
AFTER=None
def __init__(self, search_string):
self.search_string = search_string
@property
def search_string(self):
return self._search_string
@search_string.setter
def search_string(self, value):
if value.startswith(self.... |
Allow keyword arguments in GeneralStoreManager.create_item method | from graphene.storage.id_store import *
class GeneralStoreManager:
"""
Handles the creation/deletion of nodes to the NodeStore with ID recycling
"""
def __init__(self, store):
"""
Creates an instance of the GeneralStoreManager
:param store: Store to manage
:return: Ge... | from graphene.storage.id_store import *
class GeneralStoreManager:
"""
Handles the creation/deletion of nodes to the NodeStore with ID recycling
"""
def __init__(self, store):
"""
Creates an instance of the GeneralStoreManager
:param store: Store to manage
:return: Ge... |
Add my name to user list. | module.exports = {
users: [ // ADD YOUR USERNAME AT THE TOP
'julbaxter'
'mattclaw',
'crankeye',
'cgroner',
'tejohnso',
'sp1d3rx',
'evsie001',
'msied',
'd7p',
'kasperlewau',
'kennethrapp',
'briansoule',
'qguv',
... | module.exports = {
users: [ // ADD YOUR USERNAME AT THE TOP
'mattclaw',
'crankeye',
'cgroner',
'tejohnso',
'sp1d3rx',
'evsie001',
'msied',
'd7p',
'kasperlewau',
'kennethrapp',
'briansoule',
'qguv',
'ianwalter',
... |
Remove LICENCE inclusion from package | #!/usr/bin/env python
import sys
from setuptools import setup, find_packages
if sys.version_info < (3, 3):
sys.exit('Sorry, Python < 3.3 is not supported')
setup(
name='pyecore',
version='0.5.6-dev',
description=('A Python(ic) Implementation of the Eclipse Modeling '
'Framework (EMF/... | #!/usr/bin/env python
import sys
from setuptools import setup, find_packages
if sys.version_info < (3, 3):
sys.exit('Sorry, Python < 3.3 is not supported')
setup(
name='pyecore',
version='0.5.6-dev',
description=('A Python(ic) Implementation of the Eclipse Modeling '
'Framework (EMF/... |
Allow to conceal expert section from create form
- Workaround for cases when fields are duplicated in a details view | import template from './expert-contract-form.html';
const expertContract = {
template,
bindings: {
model: '=',
form: '<',
contractTemplate: '<',
expert: '<',
errors: '<',
},
controller: class ExpertContractController {
$onInit() {
this.loading = true;
let sortedOptions = {}... | import template from './expert-contract-form.html';
const expertContract = {
template,
bindings: {
model: '=',
form: '<',
contractTemplate: '<',
expert: '<',
errors: '<',
},
controller: class ExpertContractController {
$onInit() {
this.loading = true;
let sortedOptions = {}... |
Make test names lower case prefix | import unittest
import src
import sys
from io import StringIO
class TestConfigFileLoading(unittest.TestCase):
filepath_prefix = ''
@classmethod
def setUpClass(cls):
if sys.argv[0].endswith('nosetests'):
cls.filepath_prefix = "./resources/config/"
else:
cls.filepat... | import unittest
import src
import sys
from io import StringIO
class TestConfigFileLoading(unittest.TestCase):
filepath_prefix = ''
@classmethod
def setUpClass(cls):
if sys.argv[0].endswith('nosetests'):
cls.filepath_prefix = "./resources/config/"
else:
cls.filepat... |
Add __completion and updatedAt to 'Vie scolaire' | 'use strict';
angular.module('impactApp')
.config(function($stateProvider) {
var index = 'espace_perso.mes_profils.profil.vie_scolaire';
$stateProvider
.state(index, {
url: '/vie_scolaire',
templateUrl: 'app/espace_perso/mes_profils/profil/section.html',
controller: 'SectionCtrl... | 'use strict';
angular.module('impactApp')
.config(function($stateProvider) {
var index = 'espace_perso.mes_profils.profil.vie_scolaire';
$stateProvider
.state(index, {
url: '/vie_scolaire',
templateUrl: 'app/espace_perso/mes_profils/profil/section.html',
controller: 'SectionCtrl... |
Fix checkAuth to make it work with componentWillReceiveProps | import React from 'react';
import {connect} from 'react-redux';
import {pushState} from 'redux-router';
export function requireAuthentication(Component) {
class AuthenticatedComponent extends React.Component {
componentWillMount () {
this.checkAuth(this.props.isAuthenticated);
}
... | import React from 'react';
import {connect} from 'react-redux';
import {pushState} from 'redux-router';
export function requireAuthentication(Component) {
class AuthenticatedComponent extends React.Component {
componentWillMount () {
this.checkAuth();
}
componentWillReceivePr... |
Delete recursive root path input | <?php
namespace CalendarReminder;
use PHPUnit\Framework\TestCase;
class ReminderFileRepositoryTest extends TestCase
{
const REMINDERS_ROOT_PATH = 'tests/reminders';
/** @var ReminderFileRepository */
public $reminderRepository;
protected function setUp()
{
$this->reminderRepository = ne... | <?php
namespace CalendarReminder;
use PHPUnit\Framework\TestCase;
class ReminderFileRepositoryTest extends TestCase
{
const REMINDERS_ROOT_PATH = 'tests/reminders';
/** @var ReminderFileRepository */
public $reminderRepository;
protected function setUp()
{
$this->reminderRepository = ne... |
Fix classname in scoreboard parser | from HTMLParser import HTMLParser
class ScoreboardParser(HTMLParser):
def __init__(self):
HTMLParser.__init__(self)
self.scores = []
self.cur_game = None
self.get_data = False
self.get_name = False
def handle_starttag(self, tag, attrs):
if tag == 'table'... | from HTMLParser import HTMLParser
class ScoreboardParser(HTMLParser):
def __init__(self):
HTMLParser.__init__(self)
self.scores = []
self.cur_game = None
self.get_data = False
self.get_name = False
def handle_starttag(self, tag, attrs):
if tag == 'table'... |
Allow consumers to provide options that are forwarded to tape | 'use strict';
var tape = require('tape');
var through = require('through2');
var PluginError = require('gulp-util').PluginError;
var requireUncached = require('require-uncached');
var PLUGIN_NAME = 'gulp-tape';
var gulpTape = function(opts) {
opts = opts || {};
var outputStream = opts.outputStream || process.st... | 'use strict';
var tape = require('tape');
var through = require('through2');
var PluginError = require('gulp-util').PluginError;
var requireUncached = require('require-uncached');
var PLUGIN_NAME = 'gulp-tape';
var gulpTape = function(opts) {
opts = opts || {};
var outputStream = opts.outputStream || process.st... |
Make KQMLString subclass of KQMLObject. | from io import BytesIO
from kqml import KQMLObject
from .util import safe_decode
class KQMLString(KQMLObject):
def __init__(self, data=None):
if data is None:
self.data = ''
else:
self.data = safe_decode(data)
def __len__(self):
return len(self.data)
def c... | from io import BytesIO
from kqml import KQMLObject
from .util import safe_decode
class KQMLString(object):
def __init__(self, data=None):
if data is None:
self.data = ''
else:
self.data = safe_decode(data)
def __len__(self):
return len(self.data)
def char_a... |
Reset error bag on file upload hydration
This helps get rid of error messages between file uploads so you don't see an error message if the file was uploaded successfully. | <?php
namespace App\Http\Livewire\Files;
use App\Models\File;
use Livewire\Component;
use Livewire\WithFileUploads;
class UploadFileModalForm extends Component
{
use WithFileUploads;
/**
* Determines if the modal should be shown to the user.
*
* @var boolean
*/
public $showModal = fa... | <?php
namespace App\Http\Livewire\Files;
use App\Models\File;
use Livewire\Component;
use Livewire\WithFileUploads;
class UploadFileModalForm extends Component
{
use WithFileUploads;
/**
* Determines if the modal should be shown to the user.
*
* @var boolean
*/
public $showModal = fa... |
Fix test for Python 3 | import unittest
from jip.repository import MavenFileSystemRepos
from jip.maven import Artifact
from contextlib import contextmanager
import shutil
import tempfile
import errno
import os
@contextmanager
def tmpdir():
dirname = tempfile.mkdtemp()
try:
yield dirname
finally:
shutil.rmtre... | import unittest
from jip.repository import MavenFileSystemRepos
from jip.maven import Artifact
from contextlib import contextmanager
import shutil
import tempfile
import errno
import os
@contextmanager
def tmpdir():
dirname = tempfile.mkdtemp()
try:
yield dirname
finally:
shutil.rmtre... |
Clean imports and remove unnecessary toString() | package uk.ac.ebi.atlas.commons.writers;
import org.springframework.context.annotation.Scope;
import uk.ac.ebi.atlas.commons.writers.impl.TsvWriterImpl;
import javax.inject.Named;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.text.Mes... | package uk.ac.ebi.atlas.commons.writers;
import org.springframework.context.annotation.Scope;
import uk.ac.ebi.atlas.commons.readers.TsvReader;
import uk.ac.ebi.atlas.commons.readers.impl.TsvReaderImpl;
import uk.ac.ebi.atlas.commons.writers.impl.TsvWriterImpl;
import javax.inject.Named;
import java.io.*;
import jav... |
Use gtk ui by default | # Copyright (c) 2012 John Reese
# Licensed under the MIT License
from __future__ import absolute_import, division
engine = None
ui = None
def async_engine_command(command, network=None, params=None):
"""Send a command to the current backend engine."""
return engine.async_command(command, network, params)
de... | # Copyright (c) 2012 John Reese
# Licensed under the MIT License
from __future__ import absolute_import, division
engine = None
ui = None
def async_engine_command(command, network=None, params=None):
"""Send a command to the current backend engine."""
return engine.async_command(command, network, params)
de... |
Add get request method function | <?php
namespace Acd;
/**
* Request Class
* @author Acidvertigo MIT Licence
*/
class Request
{
private $headers = [];
/**
* Check HTTP request headers
* @return array list of response headers
* @throws InvalidArgumentException if header is null
*/
public function getRequestHeaders... | <?php
namespace Acd;
/**
* Request Class
* @author Acidvertigo MIT Licence
*/
class Request
{
private $headers = [];
/**
* Check HTTP request headers
* @return array list of response headers
* @throws InvalidArgumentException if header is null
*/
public function getRequestHeaders... |
Set attributes via prototype & remove custom toJSON | "use strict";
var util = require("util");
var AbstractError = require("./AbstractError.js"),
defaultRenderer = require("./defaultRenderer.js");
/**
* generate Error-classes based on AbstractError
*
* @param error
* @returns {Function}
*/
function erroz(error) {
var errorFn = function (data) {
... | "use strict";
var util = require("util");
var AbstractError = require("./AbstractError.js"),
defaultRenderer = require("./defaultRenderer.js");
/**
* generate Error-classes based on AbstractError
*
* @param error
* @returns {Function}
*/
function erroz(error) {
var errorFn = function (data) {
... |
Fix redirect after deleting of faq feedback | <?php
namespace Backend\Modules\Faq\Actions;
/*
* This file is part of Fork CMS.
*
* For the full copyright and license information, please view the license
* file that was distributed with this source code.
*/
use Backend\Core\Engine\Base\ActionDelete as BackendBaseActionDelete;
use Backend\Core\Engine\Model a... | <?php
namespace Backend\Modules\Faq\Actions;
/*
* This file is part of Fork CMS.
*
* For the full copyright and license information, please view the license
* file that was distributed with this source code.
*/
use Backend\Core\Engine\Base\ActionDelete as BackendBaseActionDelete;
use Backend\Core\Engine\Model a... |
Make cryptography an optional install dependency | """
Flask-JWT-Extended
-------------------
Flask-Login provides jwt endpoint protection for Flask.
"""
from setuptools import setup
setup(name='Flask-JWT-Extended',
version='1.5.0',
url='https://github.com/vimalloc/flask-jwt-extended',
license='MIT',
author='Landon Gilbert-Bland',
author_... | """
Flask-JWT-Extended
-------------------
Flask-Login provides jwt endpoint protection for Flask.
"""
from setuptools import setup
setup(name='Flask-JWT-Extended',
version='1.5.0',
url='https://github.com/vimalloc/flask-jwt-extended',
license='MIT',
author='Landon Gilbert-Bland',
author_... |
Fix use of a deprecated API | package io.zucchiniui.backend.support.websocket;
import io.dropwizard.Configuration;
import io.dropwizard.ConfiguredBundle;
import io.dropwizard.setup.Bootstrap;
import io.dropwizard.setup.Environment;
import org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer;
import org.slf4j.Logger;... | package io.zucchiniui.backend.support.websocket;
import io.dropwizard.Configuration;
import io.dropwizard.ConfiguredBundle;
import io.dropwizard.setup.Bootstrap;
import io.dropwizard.setup.Environment;
import org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer;
import org.slf4j.Logger;... |
Add environmental settings for basic authentication. | import sys
from colour_runner.django_runner import ColourRunnerMixin
from django.conf import settings
settings.configure(
# Core environmental settings
INSTALLED_APPS=(
# Put contenttypes before auth to work around test issue.
# See: https://code.djangoproject.com/ticket/10827#comment:12
... | import sys
from colour_runner.django_runner import ColourRunnerMixin
from django.conf import settings
settings.configure(
INSTALLED_APPS=(
# Put contenttypes before auth to work around test issue.
# See: https://code.djangoproject.com/ticket/10827#comment:12
'django.contrib.contenttypes',... |
Fix when using multiple entity managers.
As per doctrine 2.4 default entity manager is referenced by doctrine.orm.entity_manager. | <?php
namespace Tbbc\MoneyBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
class StorageC... | <?php
namespace Tbbc\MoneyBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
class StorageC... |
Make all lines shorter than 80 characters | import os
import re
class OratioIgnoreParser():
def __init__(self):
self.ignored_paths = ["oratiomodule.tar.gz"]
def load(self, oratio_ignore_path):
with open(oratio_ignore_path, "r") as f:
self.ignored_paths.extend([line.strip() for line in f])
def should_be_ignored(self, fi... | import os
import re
class OratioIgnoreParser():
def __init__(self):
self.ignored_paths = ["oratiomodule.tar.gz"]
def load(self, oratio_ignore_path):
with open(oratio_ignore_path, "r") as f:
self.ignored_paths.extend([line.strip() for line in f])
def should_be_ignored(self, fi... |
Use string "null" if default driver is set to NULL | <?php
namespace Laravel\Scout;
use Illuminate\Support\Manager;
use AlgoliaSearch\Client as Algolia;
use Laravel\Scout\Engines\NullEngine;
use Laravel\Scout\Engines\AlgoliaEngine;
use AlgoliaSearch\Version as AlgoliaUserAgent;
class EngineManager extends Manager
{
/**
* Get a driver instance.
*
* @... | <?php
namespace Laravel\Scout;
use Illuminate\Support\Manager;
use AlgoliaSearch\Client as Algolia;
use Laravel\Scout\Engines\NullEngine;
use Laravel\Scout\Engines\AlgoliaEngine;
use AlgoliaSearch\Version as AlgoliaUserAgent;
class EngineManager extends Manager
{
/**
* Get a driver instance.
*
* @... |
Improve Route model binding query for Paste | <?php
namespace Wdi\Providers;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Route;
use Wdi\Entities\Language;
use Wdi\Entities\Paste;
/**
* Class RouteServiceProvider
*
* @package Wdi\Providers
*/
final class RouteServiceProvider extends ServiceProvider
{
/** {@in... | <?php
namespace Wdi\Providers;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Route;
use Wdi\Entities\Language;
use Wdi\Entities\Paste;
/**
* Class RouteServiceProvider
*
* @package Wdi\Providers
*/
final class RouteServiceProvider extends ServiceProvider
{
/** {@in... |
Remove broken authorization header code
The authorization header generation code in receipt.py was setting
the authorization header to a byte stream rather than a string
(b'...'). As requests provides a way to generate basic auth headers
using the auth param it makes more sense to use that. | from app import settings
import logging
from structlog import wrap_logger
import base64
import os
from jinja2 import Environment, FileSystemLoader
env = Environment(loader=FileSystemLoader('%s/templates/' % os.path.dirname(__file__)))
logger = wrap_logger(logging.getLogger(__name__))
def get_receipt_endpoint(decryp... | from app import settings
import logging
from structlog import wrap_logger
import base64
import os
from jinja2 import Environment, FileSystemLoader
env = Environment(loader=FileSystemLoader('%s/templates/' % os.path.dirname(__file__)))
logger = wrap_logger(logging.getLogger(__name__))
def get_receipt_endpoint(decryp... |
Return empty array if value is empty | import React, { Component } from 'react';
import { Creatable } from 'react-select';
import R from 'ramda';
import './TagSelect.css';
class TagSelect extends Component {
state = {
multi: true,
multiValue: [],
options: this.props.options,
}
componentWillReceiveProps = nextProps => {... | import React, { Component } from 'react';
import { Creatable } from 'react-select';
import R from 'ramda';
import './TagSelect.css';
class TagSelect extends Component {
state = {
multi: true,
multiValue: [],
options: this.props.options,
}
componentWillReceiveProps = nextProps => {... |
Add conf to coverage source setting. | const gulp = require('gulp');
const spawn = require('child_process').spawn;
gulp.task('test', (cb) => {
const command = [ 'run', 'python', 'manage.py', 'test' ];
const args = process.argv;
if (args[3] == '--test' && args[4]) {
command.push(args[4]);
}
spawn(
'pipenv',
co... | const gulp = require('gulp');
const spawn = require('child_process').spawn;
gulp.task('test', (cb) => {
const command = [ 'run', 'python', 'manage.py', 'test' ];
const args = process.argv;
if (args[3] == '--test' && args[4]) {
command.push(args[4]);
}
spawn(
'pipenv',
co... |
Improve doc related to “isMultiTenantSupportInstalled” | import knex from 'knex';
import PromiseAsyncCache from 'promise-async-cache';
import * as knexTenantSupport from './knex-tenant-support';
const debug = require('./debug')('tenant');
/**
* Defines whenever the tenant monkey patch on knex has been installed
*/
let isMultiTenantSupportInstalled = false;
/**
* Kee... | import knex from 'knex';
import PromiseAsyncCache from 'promise-async-cache';
import * as knexTenantSupport from './knex-tenant-support';
const debug = require('./debug')('tenant');
let isMultiTenantSupportInstalled = false;
/**
* Keep knex tenants in memory and handle race conditions
*/
const cache = new Promise... |
Add comment about work to be completed | /*
* 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... |
Fix script to save output to script’s directory. | #!/usr/bin/env python3
from os import scandir
from sys import argv
from platform import uname
from pathlib import Path
filename_template = """
# -------------------------------------------------------------------------------
# filename: {filename}
# -------------------------------------------------------------------... | #!/usr/bin/env python3
from os import scandir
from sys import argv
from platform import uname
from pathlib import Path
filename_template = """
# -------------------------------------------------------------------------------
# filename: {filename}
# -------------------------------------------------------------------... |
Improve logs and change delete pos | # -*- coding: utf-8 -*-
import logging
from base import BaseStep
from logical.models import Database
import datetime
LOG = logging.getLogger(__name__)
class BuildDatabase(BaseStep):
def __unicode__(self):
return "Creating logical database..."
def do(self, workflow_dict):
try:
... | # -*- coding: utf-8 -*-
import logging
from base import BaseStep
from logical.models import Database
LOG = logging.getLogger(__name__)
class BuildDatabase(BaseStep):
def __unicode__(self):
return "Creating logical database..."
def do(self, workflow_dict):
try:
if not workflow_... |
Call to config helper function instead of an instance of the container | <?php
namespace GearHub\LaravelEnhancementSuite\Repositories;
use GearHub\LaravelEnhancementSuite\Contracts\Repositories\RepositoryFactory as RepositoryFactoryContract;
class RepositoryFactory implements RepositoryFactoryContract
{
/**
* Mapping keys to repositories. Takes precidence over the dynamic resolu... | <?php
namespace GearHub\LaravelEnhancementSuite\Repositories;
use GearHub\LaravelEnhancementSuite\Contracts\Repositories\RepositoryFactory as RepositoryFactoryContract;
class RepositoryFactory implements RepositoryFactoryContract
{
/**
* Mapping keys to repositories. Takes precidence over the dynamic resolu... |
Move requirements to separate file | #!/usr/bin/env python
import sys
from os.path import join, dirname
from setuptools import setup
CURDIR = dirname(__file__)
with open(join(CURDIR, 'requirements.txt')) as f:
REQUIREMENTS = f.read().splitlines()
sys.path.append(join(CURDIR, 'src'))
filename = join(CURDIR, 'src', 'BrowserMobProxyLibrary', 'versio... | #!/usr/bin/env python
import sys
from os.path import join, dirname
from setuptools import setup
sys.path.append(join(dirname(__file__), 'src'))
execfile(join(dirname(__file__), 'src', 'BrowserMobProxyLibrary', 'version.py'))
DESCRIPTION = """
BrowserMobProxyLibrary is a Robot Framework library ro interface with Bro... |
Remove border from dialpad-button to hide the button style on ubuntu | /*
* Jitsi, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.impl.gui.main;
import java.awt.*;
import java.awt.event.*;
import javax.swing.BorderFactory;
import net.java.sip.communicator.impl.gui.... | /*
* Jitsi, the OpenSource Java VoIP and Instant Messaging client.
*
* Distributable under LGPL license.
* See terms of license at gnu.org.
*/
package net.java.sip.communicator.impl.gui.main;
import java.awt.*;
import java.awt.event.*;
import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.commun... |
Convert read data to unicode.
The NamedTemporaryFile is in binary mode by default, so the read returns raw
bytes. | import os
import sys
import tempfile
from twisted.trial import unittest
from twisted.python import util
from comet.icomet import IHandler
from comet.handler import SpawnCommand
SHELL = '/bin/sh'
class DummyEvent(object):
def __init__(self, text=None):
self.text = text or u""
class SpawnCommandProtocolT... | import os
import sys
import tempfile
from twisted.trial import unittest
from twisted.python import util
from comet.icomet import IHandler
from comet.handler import SpawnCommand
SHELL = '/bin/sh'
class DummyEvent(object):
def __init__(self, text=None):
self.text = text or u""
class SpawnCommandProtocolT... |
Change Karma port to 8081
This change makes Karma compatible with Cloud9,
because the latter supports only ports 808x. | // Karma configuration file, see link for more information
// https://karma-runner.github.io/0.13/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular/cli'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-... | // Karma configuration file, see link for more information
// https://karma-runner.github.io/0.13/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular/cli'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-... |
Fix res returned on delegate | # -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: David Coninckx <david@coninckx.com>
#
# The licence is in the file __ope... | # -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: David Coninckx <david@coninckx.com>
#
# The licence is in the file __ope... |
Set title style and disabled color | package com.quemb.qmbform.view;
import com.quemb.qmbform.R;
import com.quemb.qmbform.descriptor.RowDescriptor;
import android.content.Context;
import android.widget.TextView;
/**
* Created by tonimoeckel on 15.07.14.
*/
public class FormTitleFieldCell extends FormBaseCell {
private TextView mTextView;
pub... | package com.quemb.qmbform.view;
import com.quemb.qmbform.R;
import com.quemb.qmbform.descriptor.RowDescriptor;
import android.content.Context;
import android.widget.TextView;
/**
* Created by tonimoeckel on 15.07.14.
*/
public class FormTitleFieldCell extends FormBaseCell {
private TextView mTextView;
pub... |
Use a scroll pane for the scroll bar test. | package com.seaglasslookandfeel.demo;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
public class TestScrollBars {
public static... | package com.seaglasslookandfeel.demo;
import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollBar;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
public class TestScrollBars {
public static void main(String[] args... |
Add FA icons to buttons | @extends('crudapi::layouts.master')
@section('content')
<h1>{{ $model }}<button class="btn btn-sm btn-success pull-right"><i class="fa fa-plus"></i> Insert {{ $model }}</button></h1>
<table class="table">
<tr>
@foreach($fields as $f)
<th>{{ ucfirst($f) }}</th>
@endforeach
... | @extends('crudapi::layouts.master')
@section('content')
<h1>{{ $model }}<button class="btn btn-sm btn-success pull-right">Insert {{ $model }}</button></h1>
<table class="table">
<tr>
@foreach($fields as $f)
<th>{{ ucfirst($f) }}</th>
@endforeach
<th>Created At</th>
... |
Fix bug if no voting | @extends('main')
@section('head')
<style>
.row
{
margin-top: 5%;
}
#meme
{
display: block;
margin-left: auto;
margin-right: auto;
}
#progress
{
margin-top: 1%;
}
</style>
@endsection
@section('content')
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<div class="jumbotron">
... | @extends('main')
@section('head')
<style>
.row
{
margin-top: 5%;
}
#meme
{
display: block;
margin-left: auto;
margin-right: auto;
}
#progress
{
margin-top: 1%;
}
</style>
@endsection
@section('content')
<div class="row">
<div class="col-sm-10 col-sm-offset-1">
<div class="jumbotron">
... |
Add a generic load method for routes
Signed-off-by: Kaustav Das Modak <ba1ce5b1e09413a89404909d8d270942c5dadd14@yahoo.co.in> | 'use strict';
/**
* Finder Model - Main model that uses FinderJS
*
* @constructor
*/
var FinderModel = function (arg) {
// Assign `this` through `riot.observable()`
var self = riot.observable(this);
// Store args
self.args = arg;
// Create an instance of `Applait.Finder`
self.finder = ne... | 'use strict';
/**
* Finder Model - Main model that uses FinderJS
*
* @constructor
*/
var FinderModel = function (arg) {
// Assign `this` through `riot.observable()`
var self = riot.observable(this);
// Store args
self.args = arg;
// Create an instance of `Applait.Finder`
self.finder = ne... |
Put in a max for how many entities will be generated | var chance = require('./fake-extension.js'),
glimpse = require('glimpse'),
maxEvents = chance.integerRange(25, 35),
currentEvent = 0;
function publishEntry() {
var mvc = chance.mvc(),
serverLowerTime = chance.integerRange(5, 10),
serverUpperTime = chance.integerRange(60, 100),
... | var chance = require('./fake-extension.js'),
glimpse = require('glimpse');
function publishEntry() {
var mvc = chance.mvc(),
serverLowerTime = chance.integerRange(5, 10),
serverUpperTime = chance.integerRange(60, 100),
networkTime = chance.integerRange(0, 15),
clientTime = cha... |
Move created from construct to create | <?php
class Game extends ActiveRecordBase {
public $id;
public $created;
public $width;
public $height;
public $rounds;
public function __construct( $id = false ) {
if ( $id ) {
$this->exists = true;
$game_info = dbSelectOn... | <?php
class Game extends ActiveRecordBase {
public $id;
public $created;
public $width;
public $height;
public $rounds;
public function __construct( $id = false ) {
if ( $id ) {
$this->exists = true;
$game_info = dbSelectOn... |
Add button full component to shopping list | import React, {Component} from 'react';
import { View, Text, ScrollView } from 'react-native';
import { Button } from 'native-base';
import axios from 'axios';
import colors from '../config/colors';
import { UserItem } from '../components/UserItem';
class ShoppingList extends Component {
constructor(props) {
... | import React, {Component} from 'react';
import { View, Text, ScrollView, Button } from 'react-native';
import axios from 'axios';
import colors from '../config/colors';
import { UserItem } from '../components/UserItem';
class ShoppingList extends Component {
constructor(props) {
super(props);
this.state =... |
Change Avatar Title and Sub-Title strings | import React, { PropTypes, Component } from 'react'
import classes from './PostItem.scss'
import { ListItem } from 'material-ui/List'
import Delete from 'material-ui/svg-icons/action/delete'
import {Card, CardActions, CardHeader, CardMedia, CardTitle, CardText} from 'material-ui/Card';
import FlatButton from 'material-... | import React, { PropTypes, Component } from 'react'
import classes from './PostItem.scss'
import { ListItem } from 'material-ui/List'
import Delete from 'material-ui/svg-icons/action/delete'
import {Card, CardActions, CardHeader, CardMedia, CardTitle, CardText} from 'material-ui/Card';
import FlatButton from 'material-... |
Remove enum to gain flexibility | <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateBusinessesTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('businesses', function(Blueprint $table)
{
... | <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateBusinessesTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('businesses', function(Blueprint $table)
{
... |
Enable CORS ignore orgin header | const Hapi = require('@hapi/hapi');
const routes = require('./routes');
const auth = require('./auth');
module.exports = async (elastic, config, cb) => {
const server = new Hapi.Server({ port: config.port, routes: { cors: { origin: "ignore" }, log: { collect: true } } });
server.route(routes(elastic, config));
... | const Hapi = require('@hapi/hapi');
const routes = require('./routes');
const auth = require('./auth');
module.exports = async (elastic, config, cb) => {
const server = new Hapi.Server({ port: config.port, routes: { cors: true, log: { collect: true } } });
server.route(routes(elastic, config));
if (config.auth... |
Refactor parser again to remove use of exceptions | define(function() {
'use strict';
/**
* @class
*/
function CurrencyParser() { }
/**
* Array of recognised currency formats, each with a regex pattern
* and a parser function which receives the first matched group.
*/
var formats = [
{
// Just pence, wit... | define(function() {
'use strict';
/**
* @class
*/
function CurrencyParser() { }
function ParseError() { }
var penceOnlyParser = function (str) {
var found = str.match(/^(\d+)p?$/);
if (found === null)
throw new ParseError();
else
return pa... |
Add 'use strict' for javascript's spec | /**
* Created by Victor Avendano on 1/10/15.
* avenda@gmail.com
*/
'use strict';
(function(){
var mod = angular.module('routeScripts', ['ngRoute']);
mod.directive('routeScripts', ['$rootScope','$compile',
function($rootScope, $compile){
return {
restrict: 'A',
lin... | /**
* Created by Victor Avendano on 1/10/15.
* avenda@gmail.com
*/
(function(){
var mod = angular.module('routeScripts', ['ngRoute']);
mod.directive('routeScripts', ['$rootScope','$compile',
function($rootScope, $compile){
return {
restrict: 'A',
link: function (sc... |
Add TEMPLATES configuration for Django v1.10 purposes. | import sys
import django
from django.conf import settings
settings.configure(
DEBUG=True,
DATABASES={
'default': {
'ENGINE': 'django.db.backends.sqlite3',
}
},
INSTALLED_APPS=(
'django.contrib.auth',
'django.contrib.contenttypes',
'shopify_auth',
... | import sys
import django
from django.conf import settings
settings.configure(
DEBUG=True,
DATABASES={
'default': {
'ENGINE': 'django.db.backends.sqlite3',
}
},
INSTALLED_APPS=(
'django.contrib.auth',
'django.contrib.contenttypes',
'shopify_auth',
... |
refactor: Move the issue details over to using $modal. | var mod = angular.module('Trestle.issue', []);
mod.controller('IssueCtrl', function($scope, $modal, $rootScope) {
// init
$scope.$id = "IssueCtrl_" + $scope.$id;
_.extend(this, {
init: function(issue) {
this.issue = issue;
},
isPullRequest: function() {
return this.issue.... | var mod = angular.module('Trestle.issue', []);
mod.controller('IssueCtrl', function($scope, $dialog) {
// init
$scope.$id = "IssueCtrl_" + $scope.$id;
_.extend(this, {
init: function(issue) {
this.issue = issue;
},
isPullRequest: function() {
return this.issue.pull_reques... |
Remove border from search input | import React from 'react';
import styled, { css } from 'styled-components';
import PropTypes from 'prop-types';
import { transitionOpacity } from 'mixins';
import HeaderButton from 'components/HeaderButton';
import theme from 'theme';
const StyledContainer = styled.div`
display: flex;
position: absolute;
w... | import React from 'react';
import styled, { css } from 'styled-components';
import PropTypes from 'prop-types';
import { transitionOpacity } from 'mixins';
import HeaderButton from 'components/HeaderButton';
import theme from 'theme';
const StyledContainer = styled.div`
display: flex;
position: absolute;
w... |
Update to match changes in ob-airtable | import os
from luigi import Parameter
from ob_airtable import AirtableClient
AIRTABLE_EXPT_TABLE = 'Genomics%20Expt'
AIRTABLE_SAMPLE_TABLE = 'Genomics%20Sample'
S3_BUCKET = os.environ.get('S3_BUCKET')
client = AirtableClient()
def get_samples(expt_id):
expt = client.get_record_by_name(expt_id, AIRTABLE_EXPT_TA... | import os
from luigi import Parameter
from ob_airtable import get_record_by_name, get_record
AIRTABLE_EXPT_TABLE = 'Genomics%20Expt'
AIRTABLE_SAMPLE_TABLE = 'Genomics%20Sample'
S3_BUCKET = os.environ.get('S3_BUCKET')
def get_samples(expt_id):
expt = get_record_by_name(expt_id, AIRTABLE_EXPT_TABLE)
sample_k... |
Add visit counter for rooms. | Meteor.methods({
userAddVisitedRoom: function(roomId) {
var rooms = Rooms.find({
_id: roomId
}, {
_id: 1
});
if (rooms.count() === 0) {
throw new Meteor.Error(422, 'Room does not exist');
}
var users = Meteor.users.find({
... | Meteor.methods({
userAddVisitedRoom: function(roomId) {
var rooms = Rooms.find({
_id: roomId
}, {
_id: 1
});
if (rooms.count() === 0) {
throw new Meteor.Error(422, 'Room does not exist');
}
var users = Meteor.users.find({
... |
Update path fonts gulp task | // imports
var gulp = require('gulp');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var uglify = require('gulp-uglify');
var buffer = require('vinyl-buffer');
// build src
gulp.task('browserify', function(cb){
return browserify('./src/app.js', {
debug: ... | // imports
var gulp = require('gulp');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var uglify = require('gulp-uglify');
var buffer = require('vinyl-buffer');
// build src
gulp.task('browserify', function(cb){
return browserify('./src/app.js', {
debug: ... |
Normalize in the other direction. | <?php
namespace mcordingley\Regression\Algorithm\GradientDescent\Gradient;
final class Linear implements Gradient
{
/** @var int */
private $power;
/**
* @param int $power
*/
public function __construct($power = 2)
{
$this->power = $power;
}
/**
* @param array $coe... | <?php
namespace mcordingley\Regression\Algorithm\GradientDescent\Gradient;
final class Linear implements Gradient
{
/** @var int */
private $power;
/**
* @param int $power
*/
public function __construct($power = 2)
{
$this->power = $power;
}
/**
* @param array $coe... |
Update Tabs to use S selectors | /*jslint unparam: true, browser: true, indent: 2 */
;(function ($, window, document, undefined) {
'use strict';
Foundation.libs.tab = {
name : 'tab',
version : '5.1.0',
settings : {
active_class: 'active',
callback : function () {}
},
init : function (scope, method, options) {
... | /*jslint unparam: true, browser: true, indent: 2 */
;(function ($, window, document, undefined) {
'use strict';
Foundation.libs.tab = {
name : 'tab',
version : '5.0.3',
settings : {
active_class: 'active',
callback : function () {}
},
init : function (scope, method, options) {
... |
Update how filter query is applied | import Ember from 'ember';
import config from '../config/environment';
export default Ember.Service.extend({
host: config.HOST,
namespace: 'solr',
core: 'dina',
parseResponse (data) {
return data.response.docs.mapBy('primary_id');
},
select (query, {entityType, fq, rows}) {
... | import Ember from 'ember';
import config from '../config/environment';
export default Ember.Service.extend({
host: config.HOST,
namespace: 'solr',
core: 'dina',
parseResponse (data) {
return data.response.docs.mapBy('primary_id');
},
select (query, {entityType, fq, rows}) {
... |
Remove test covering module creation from alpha version | 'use strict';
var _ = require('lodash');
function testProperties(BBY) {
expect(BBY.options).not.toBe(undefined);
expect(BBY.options.key).toBe(process.env.BBY_API_KEY);
expect(BBY.availability instanceof Function).toBe(true);
expect(BBY.openBox instanceof Function).toBe(true);
expect(BBY.categories ... | 'use strict';
var _ = require('lodash');
function testProperties(BBY) {
expect(BBY.options).not.toBe(undefined);
expect(BBY.options.key).toBe(process.env.BBY_API_KEY);
expect(BBY.availability instanceof Function).toBe(true);
expect(BBY.openBox instanceof Function).toBe(true);
expect(BBY.categories ... |
Validate user is in conversation on create message | from rest_framework import serializers
from foodsaving.conversations.models import Conversation, ConversationMessage
class ConversationSerializer(serializers.ModelSerializer):
class Meta:
model = Conversation
fields = [
'id',
'participants',
'created_at'
... | from rest_framework import serializers
from foodsaving.conversations.models import Conversation, ConversationMessage
class ConversationSerializer(serializers.ModelSerializer):
class Meta:
model = Conversation
fields = [
'id',
'participants',
'created_at'
... |
Use a broad-brush filter for the signal handlers | # -*- coding: utf-8 -*-
from django.db.models.signals import post_save, pre_delete
from django.dispatch import receiver
from django.core.exceptions import ImproperlyConfigured
from cms.exceptions import PluginAlreadyRegistered, PluginNotRegistered
from .segment_pool import segment_pool
from ..models import SegmentBas... | # -*- coding: utf-8 -*-
from django.db.models.signals import post_save, pre_delete
from django.dispatch import receiver
from django.core.exceptions import ImproperlyConfigured
from cms.exceptions import PluginAlreadyRegistered, PluginNotRegistered
from .segment_pool import segment_pool
@receiver(post_save)
def regi... |
Fix Python version detection for Python 2.6 | import sys
from setuptools import setup, find_packages
py26_dependency = []
if sys.version_info <= (2, 6):
py26_dependency = ["argparse >= 1.2.1"]
setup(
name='dataset',
version='0.3.14',
description="Toolkit for Python-based data processing.",
long_description="",
classifiers=[
"Deve... | import sys
from setuptools import setup, find_packages
py26_dependency = []
if sys.version_info.major == 2 and sys.version_info.minor < 7:
py26_dependency = ["argparse >= 1.2.1"]
setup(
name='dataset',
version='0.3.14',
description="Toolkit for Python-based data processing.",
long_description="",... |
Move BAE secret into try catch block | ##################################
# Added for BAE
##################################
try:
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': const.CACHE_ADDR,
'TIMEOUT': 60,
}
}
except:
pass
try:
fr... | ##################################
# Added for BAE
##################################
try:
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': const.CACHE_ADDR,
'TIMEOUT': 60,
}
}
except:
pass
try:
fro... |
Update Android registration code snippet | package com.push.pushapplication;
import android.util.Log;
import android.app.Application;
import org.jboss.aerogear.android.core.Callback;
import org.jboss.aerogear.android.unifiedpush.PushRegistrar;
import org.jboss.aerogear.android.unifiedpush.RegistrarManager;
import org.jboss.aerogear.android.unifiedpush.gcm.Aer... | package com.push.pushapplication;
import java.net.URI;
import java.net.URISyntaxException;
import org.jboss.aerogear.android.unifiedpush.PushConfig;
import org.jboss.aerogear.android.unifiedpush.PushRegistrar;
import org.jboss.aerogear.android.unifiedpush.Registrations;
import android.app.Application;
public class ... |
Remove updating the schema when it already exists
In some cases (I can't really pinpoint it) it removed all the tables except for those we tried to install | <?php
namespace Common\Doctrine\Entity;
use Doctrine\DBAL\Exception\TableExistsException;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Tools\SchemaTool;
use Doctrine\ORM\Tools\ToolsException;
class CreateSchema
{
/** @var EntityManager */
private $entityManager;
/**
* @param EntityManager $enti... | <?php
namespace Common\Doctrine\Entity;
use Doctrine\DBAL\Exception\TableExistsException;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Tools\SchemaTool;
use Doctrine\ORM\Tools\ToolsException;
class CreateSchema
{
/** @var EntityManager */
private $entityManager;
/**
* @param EntityManager $enti... |
Use Python file objects directly as input
- fix wrong separator between path and filename
Signed-off-by: Stefan Marr <46f1a0bd5592a2f9244ca321b129902a06b53e03@stefan-marr.de> | import os
from StringIO import StringIO
def compile_class_from_file(path, filename, system_class, universe):
return _SourcecodeCompiler().compile(path, filename, system_class, universe)
def compile_class_from_string(stmt, system_class, universe):
return _SourcecodeCompiler().compile_class_string(stmt, system_... | import os
def compile_class_from_file(path, filename, system_class, universe):
return _SourcecodeCompiler().compile(path, filename, system_class, universe)
def compile_class_from_string(stmt, system_class, universe):
return _SourcecodeCompiler().compile_class_string(stmt, system_class, universe)
class _Sourc... |
[cleanup] Fix bad default case statement | import GeometryResourceDescriptor from './GeometryResourceDescriptor';
import PropTypes from 'react/lib/ReactPropTypes';
import THREE from 'three.js';
class ShapeGeometryResourceDescriptor extends GeometryResourceDescriptor {
constructor(react3RendererInstance) {
super(react3RendererInstance);
this.hasProp(... | import GeometryResourceDescriptor from './GeometryResourceDescriptor';
import PropTypes from 'react/lib/ReactPropTypes';
import THREE from 'three.js';
class ShapeGeometryResourceDescriptor extends GeometryResourceDescriptor {
constructor(react3RendererInstance) {
super(react3RendererInstance);
this.hasProp(... |
Fix one last linting error | <?php
/**
* abstract compiler pass for extref things
*/
namespace Graviton\DocumentBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* @author List of contributors <https://github.com/lib... | <?php
/**
* abstract compiler pass for extref things
*/
namespace Graviton\DocumentBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
/**
* @author List of contributors <https://github.com/lib... |
Add warning icons to some alerts | @if (App::environment() !== 'production')
<div class="alert alert-warning">
<p><i class="icon fa fa-warning"></i> This installation of OpenDominion is running on <b>{{ App::environment() }}</b> environment and is not meant for production purposes. Any data you register and actions you take on this instance ... | @if (App::environment() !== 'production')
<div class="alert alert-warning">
<p>This installation of OpenDominion is running on <b>{{ App::environment() }}</b> environment and is not meant for production purposes. Any data you register and actions you take on this instance might be wiped without notice.</p>
... |
Fix issue with listing users due to removed 'subuserOf' method | <?php
namespace Pterodactyl\Repositories\Eloquent;
use Pterodactyl\Models\User;
use Illuminate\Support\Collection;
use Pterodactyl\Repositories\Concerns\Searchable;
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
use Pterodactyl\Contracts\Repository\UserRepositoryInterface;
class UserRepository extends Elo... | <?php
namespace Pterodactyl\Repositories\Eloquent;
use Pterodactyl\Models\User;
use Illuminate\Support\Collection;
use Pterodactyl\Repositories\Concerns\Searchable;
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
use Pterodactyl\Contracts\Repository\UserRepositoryInterface;
class UserRepository extends Elo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.