text stringlengths 17 1.47k | positive stringlengths 673 4.43k | negative stringlengths 677 2.81k |
|---|---|---|
Remove unneded (copied for reference) code | import React from 'react';
class ImputationResults extends React.Component {
static propTypes = {
imputation_data: React.PropTypes.object,
biobank: React.PropTypes.string,
}
render() {
if (!this.props.imputation_data) {
return <div />;
}
const data = this... | import React from 'react';
class ImputationResults extends React.Component {
static propTypes = {
imputation_data: React.PropTypes.object,
biobank: React.PropTypes.string,
}
let analysis;
if (
hunt && hunt.length && hunt[0].genotyped ||
tromso && tromso.l... |
Add shutil dependency to get the terminal size | # -*- coding: utf-8 -*-
"""Utilities for Halo library.
"""
import platform
import six
import codecs
import shutil
from colorama import init, Fore
from termcolor import colored
init(autoreset=True)
def is_supported():
"""Check whether operating system supports main symbols or not.
Returns
-------
... | # -*- coding: utf-8 -*-
"""Utilities for Halo library.
"""
import platform
import six
import codecs
from colorama import init, Fore
from termcolor import colored
init(autoreset=True)
def is_supported():
"""Check whether operating system supports main symbols or not.
Returns
-------
boolean
... |
Use bigger image for user picture | import React, { PropTypes, Component } from 'react';
import { Link } from 'react-router';
import shouldPureComponentUpdate from 'react-pure-render/function';
import selectn from 'selectn';
export default class User extends Component {
static propTypes = {
user: PropTypes.object.isRequired
};
shoul... | import React, { PropTypes, Component } from 'react';
import { Link } from 'react-router';
import shouldPureComponentUpdate from 'react-pure-render/function';
import selectn from 'selectn';
export default class User extends Component {
static propTypes = {
user: PropTypes.object.isRequired
};
shoul... |
Set request user resolver when authentication is available.
Signed-off-by: Mior Muhammad Zaki <e1a543840a942eb68427510a8a483282a7bfeddf@gmail.com> | <?php
namespace Laravel\Lumen\Auth\Providers;
use Dingo\Api\Routing\Route;
use Illuminate\Http\Request;
use Illuminate\Auth\AuthManager;
use Dingo\Api\Auth\Provider\Authorization;
use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException;
class Guard extends Authorization
{
/**
* Illuminate authe... | <?php
namespace Laravel\Lumen\Auth\Providers;
use Dingo\Api\Routing\Route;
use Illuminate\Http\Request;
use Illuminate\Auth\AuthManager;
use Dingo\Api\Auth\Provider\Authorization;
use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException;
class Guard extends Authorization
{
/**
* Illuminate authe... |
Fix for broken zeroconf publishing. | import zeroconf
import socket
class Bonjour(object):
"""
"""
def __init__(self):
"""
"""
self.zeroconf = zeroconf.Zeroconf()
self.servers = {}
def publish(self, server):
"""
"""
if server in self.servers:
self.unpublish(server)
... | import zeroconf
import socket
class Bonjour(object):
"""
"""
def __init__(self):
"""
"""
self.zeroconf = zeroconf.Zeroconf()
self.servers = {}
def publish(self, server):
"""
"""
if server in self.servers:
self.unpublish(server)
... |
refactor: Declare now as a string | const notifications = {
namespaced: true,
state: {
isFetching: false,
isErrored: false,
error: [],
notifications: []
},
computed: {},
getters: {},
mutations: {
setNotifications (state, notifications) {
state.notifications = notifications;
state.isFetching = false;
stat... | const notifications = {
namespaced: true,
state: {
isFetching: false,
isErrored: false,
error: [],
notifications: []
},
computed: {},
getters: {},
mutations: {
setNotifications (state, notifications) {
state.notifications = notifications;
state.isFetching = false;
stat... |
Use doxx.template instead of default | 'use strict';
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
all: [
'Gruntfile.js',
'lib/*.js',
'test/*.js'
],
options: {
jshintrc: '.jshintr... | 'use strict';
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
all: [
'Gruntfile.js',
'lib/*.js',
'test/*.js'
],
options: {
jshintrc: '.jshintr... |
Reduce log level to avoid log polution | package org.pitest.cucumber;
import org.pitest.junit.CompoundTestUnitFinder;
import org.pitest.junit.JUnitCompatibleConfiguration;
import org.pitest.testapi.TestGroupConfig;
import org.pitest.testapi.TestUnitFinder;
import org.pitest.util.Log;
import java.util.List;
import static java.util.Arrays.asList;
public cl... | package org.pitest.cucumber;
import org.pitest.junit.CompoundTestUnitFinder;
import org.pitest.junit.JUnitCompatibleConfiguration;
import org.pitest.testapi.TestGroupConfig;
import org.pitest.testapi.TestUnitFinder;
import org.pitest.util.Log;
import java.util.List;
import static java.util.Arrays.asList;
public cl... |
Set java_home correctly for each OS | module.exports = (function() {
var path = require('path');
var ReadLine = require('readline');
var spawn = require('child_process').spawn;
var events = require('events');
var os = require('os');
return {
startNew: function() {
var url;
var hash;
var eventEmitter = new events.EventEmitter();
var ... | module.exports = (function() {
var path = require('path');
// var java_home = path.resolve(__dirname + '/../jre/Contents/Home');
// var java_home = path.resolve(__dirname + '/../jre');
var ReadLine = require('readline');
var spawn = require('child_process').spawn;
var events = require('events');
var os = requi... |
FIX BUILD: Unit test assumed polycom authid was first visible on page
git-svn-id: f26ccc5efe72c2bd8e1c40f599fe313f2692e4de@7583 a612230a-c5fa-0310-af8b-88eea846685b | /*
*
*
* Copyright (C) 2004 SIPfoundry Inc.
* Licensed by SIPfoundry under the LGPL license.
*
* Copyright (C) 2004 Pingtel Corp.
* Licensed to SIPfoundry under a Contributor Agreement.
*
* $
*/
package org.sipfoundry.sipxconfig.site.phone.polycom;
import junit.framework.Test;
import net.sourceforge.jweb... | /*
*
*
* Copyright (C) 2004 SIPfoundry Inc.
* Licensed by SIPfoundry under the LGPL license.
*
* Copyright (C) 2004 Pingtel Corp.
* Licensed to SIPfoundry under a Contributor Agreement.
*
* $
*/
package org.sipfoundry.sipxconfig.site.phone.polycom;
import junit.framework.Test;
import net.sourceforge.jweb... |
Update gulp dev task to no longer build scripts | var gulp = require('gulp');
var browserify = require('gulp-browserify');
var jshint = require('gulp-jshint');
var mocha = require('gulp-mocha');
var uglify = require('gulp-uglify');
var size = require('gulp-size');
var rename = require('gulp-rename');
gulp.task('scripts', function() {
gulp.src('index.js')
.pi... | var gulp = require('gulp');
var browserify = require('gulp-browserify');
var jshint = require('gulp-jshint');
var mocha = require('gulp-mocha');
var uglify = require('gulp-uglify');
var size = require('gulp-size');
var rename = require('gulp-rename');
gulp.task('scripts', function() {
gulp.src('index.js')
.pi... |
Update migration to fetch domains with applications using old location fixture | import json
from django.core.management.base import BaseCommand
from toggle.models import Toggle
from corehq.apps.locations.models import SQLLocation
from corehq.apps.domain.models import Domain
from corehq.toggles import HIERARCHICAL_LOCATION_FIXTURE, NAMESPACE_DOMAIN
class Command(BaseCommand):
help = """
... | from django.core.management.base import BaseCommand
from toggle.models import Toggle
from corehq.apps.locations.models import LocationFixtureConfiguration, SQLLocation
from corehq.toggles import FLAT_LOCATION_FIXTURE
class Command(BaseCommand):
help = """
To migrate to new flat fixture for locations. Update ... |
Add header to stats table. | import { ToastsComponent } from "../toasts/toasts.component.js";
export class StatsTemplate {
static update(render, { symbol = "" } = {}) {
if (!symbol) {
render`
<h2>Last Asset Stats</h2>
No stats available for last asset.
`;
return;
... | import { ToastsComponent } from "../toasts/toasts.component.js";
export class StatsTemplate {
static update(render, { symbol = "" } = {}) {
if (!symbol) {
render`
<h2>Last Asset Stats</h2>
No stats available for last asset.
`;
return;
... |
Make the initial shared secret less obnoxiously long | var bcrypt = require('bcrypt');
var crypto = require('crypto');
var passport = require('passport');
var request = require('request');
var SALT = process.env.SALT;
var SIGNUP_URL = process.env.LANDLINE_API + '/teams';
module.exports = function(router) {
router.get('/signup', function(req, res) {
res.render('sign... | var bcrypt = require('bcrypt');
var crypto = require('crypto');
var passport = require('passport');
var request = require('request');
var SALT = process.env.SALT;
var SIGNUP_URL = process.env.LANDLINE_API + '/teams';
module.exports = function(router) {
router.get('/signup', function(req, res) {
res.render('sign... |
Revert "update Guam to not show at zoom 2"
This reverts commit b12f1560f6b6284c9d26dab96a6c09eac1942424. | # -*- encoding: utf-8 -*-
from . import FixtureTest
class LowZoomPlacesTest(FixtureTest):
def test_zoom_1(self):
import dsl
z, x, y = (3, 7, 3)
self.generate_fixtures(
dsl.way(607976629, dsl.tile_centre_shape(z, x, y), {
"min_zoom": 1,
"__ne_m... | # -*- encoding: utf-8 -*-
from . import FixtureTest
class LowZoomPlacesTest(FixtureTest):
def test_zoom_1(self):
import dsl
z, x, y = (3, 7, 3)
self.generate_fixtures(
dsl.way(607976629, dsl.tile_centre_shape(z, x, y), {
"min_zoom": 1,
"__ne_m... |
Fix style issues in python test plugin
https://bugzilla.gnome.org/show_bug.cgi?id=678339 | # -*- coding: utf-8 -*-
# ex:set ts=4 et sw=4 ai:
from gi.repository import GObject, Introspection, Peas
class ExtensionPythonPlugin(GObject.Object, Peas.Activatable,
Introspection.Base, Introspection.Callable,
Introspection.PropertiesPrerequisite,
... | # -*- coding: utf-8 -*-
# ex:set ts=4 et sw=4 ai:
from gi.repository import GObject, Introspection, Peas
class ExtensionPythonPlugin(GObject.Object, Peas.Activatable,
Introspection.Base, Introspection.Callable,
Introspection.PropertiesPrerequisite,
... |
Improve handling of not found interfaces | package com.telerik.metadata.parsing;
import com.telerik.metadata.ClassRepo;
import com.telerik.metadata.desc.ClassDescriptor;
import com.telerik.metadata.desc.MethodDescriptor;
import java.util.HashSet;
import java.util.Set;
public final class ClassParser {
private final ClassDescriptor clazz;
private Cla... | package com.telerik.metadata.parsing;
import com.telerik.metadata.ClassRepo;
import com.telerik.metadata.desc.ClassDescriptor;
import com.telerik.metadata.desc.MethodDescriptor;
import java.util.HashSet;
import java.util.Set;
public final class ClassParser {
private final ClassDescriptor clazz;
private Cla... |
Hide pinning controls when embedded js-ipfs is active
- there's no pinning in js-ipfs yet
- closes #380 | 'use strict'
/* eslint-env browser, webextensions */
const browser = require('webextension-polyfill')
const html = require('choo/html')
const navItem = require('./nav-item')
module.exports = function contextActions ({
ipfsNodeType,
isIpfsContext,
isPinning,
isUnPinning,
isPinned,
isIpfsOnline,
onCopyIpf... | 'use strict'
/* eslint-env browser, webextensions */
const browser = require('webextension-polyfill')
const html = require('choo/html')
const navItem = require('./nav-item')
module.exports = function contextActions ({
isIpfsContext,
isPinning,
isUnPinning,
isPinned,
isIpfsOnline,
onCopyIpfsAddr,
onCopyP... |
Allow using redis-py 2.7.4 (lowest revision with set keyword arguments). | # -*- encoding: utf8 -*-
from setuptools import setup, find_packages
import os
setup(
name = "python-redis-lock",
version = "0.1.1",
url = 'https://github.com/ionelmc/python-redis-lock',
download_url = '',
license = 'BSD',
description = "Lock context manager implemented via redis SETNX/BLPOP."... | # -*- encoding: utf8 -*-
from setuptools import setup, find_packages
import os
setup(
name = "python-redis-lock",
version = "0.1.1",
url = 'https://github.com/ionelmc/python-redis-lock',
download_url = '',
license = 'BSD',
description = "Lock context manager implemented via redis SETNX/BLPOP."... |
Remove unreachable code. Use functools.wraps.
- Remove code that was unreachable. Thanks Jaskirat
(http://www.saltycrane.com/blog/2009/11/trying-out-retry-decorator-python/#c24691)
- Use functools.wraps to make the retry decorator "well behaved"
- Fix typo | import time
from functools import wraps
def retry(ExceptionToCheck, tries=4, delay=3, backoff=2, logger=None):
"""Retry calling the decorated function using an exponential backoff.
http://www.saltycrane.com/blog/2009/11/trying-out-retry-decorator-python/
original from: http://wiki.python.org/moin/PythonD... | import time
def retry(ExceptionToCheck, tries=4, delay=3, backoff=2, logger=None):
"""Retry calling the decorated function using an exponential backoff.
http://www.saltycrane.com/blog/2009/11/trying-out-retry-decorator-python/
original from: http://wiki.python.org/moin/PythonDecoratorLibrary#Retry
:p... |
Add missing alias for webpack-test | var path = require("path");
var tests = path.resolve(__dirname, "frontend/tests");
var js = path.resolve(__dirname, "frontend");
module.exports = {
entry: {
testsuite: path.resolve(tests, "testsuite.js")
},
output: {
path: path.resolve(tests, "dist"),
filename: "[name].js"
},
resolve: {
ext... | var path = require("path");
var tests = path.resolve(__dirname, "frontend/tests");
var js = path.resolve(__dirname, "frontend");
module.exports = {
entry: {
testsuite: path.resolve(tests, "testsuite.js")
},
output: {
path: path.resolve(tests, "dist"),
filename: "[name].js"
},
resolve: {
ext... |
Handle the case when result is undefined | export default class RocExportPlugin {
constructor(resolveRequest) {
this.resolveRequest = resolveRequest;
}
apply(compiler) {
// We assume that loaders will be managed in Webpack-land, that is we will not manage them in exports
compiler.plugin('normal-module-factory', (normalModule... | export default class RocExportPlugin {
constructor(resolveRequest) {
this.resolveRequest = resolveRequest;
}
apply(compiler) {
// We assume that loaders will be managed in Webpack-land, that is we will not manage them in exports
compiler.plugin('normal-module-factory', (normalModule... |
Work with array of NSE values | import React, { Component } from 'react';
import request from 'ajax-request';
export default class StockComponent extends Component {
constructor(props) {
super(props);
this.state = {
stocks: []
}
}
componentDidMount() {
//Not sure how we're going to pass the stock info here
var nseArr... | import React, { Component } from 'react';
import request from 'ajax-request';
export default class StockComponent extends Component {
constructor(props) {
super(props);
this.state = {
lastPrice: null,
dayLow: null,
dayHigh: null,
dayOpen: null,
change: null
}
}
componen... |
Fix assert for python 2.6 compatibility | from __future__ import unicode_literals
from unittest import TestCase
from wtforms import TextField, validators
from wtforms.ext.i18n.utils import get_translations
from wtforms.ext.i18n import form as i18n_form
class I18NTest(TestCase):
def test_failure(self):
self.assertRaises(IOError, get_translations,... | from __future__ import unicode_literals
from unittest import TestCase
from wtforms import TextField, validators
from wtforms.ext.i18n.utils import get_translations
from wtforms.ext.i18n import form as i18n_form
class I18NTest(TestCase):
def test_failure(self):
self.assertRaises(IOError, get_translations,... |
Drop "useAllScheme" option (no implementation) | <?php
namespace Mapbender\DigitizerBundle\Element\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class DigitizerAdminType extends AbstractType
{
public function configureOptions(OptionsResolver $resolver)
... | <?php
namespace Mapbender\DigitizerBundle\Element\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
class DigitizerAdminType extends AbstractType
{
public function configureOptions(OptionsResolver $resolver)
... |
Correct container name to data | 'use strict'
var pubsubangular = angular.module('pubsub.angular', []);
pubsubangular.factory('ps', function () {
var ps = window.PubSub;
if(!!ps===false){
throw new Error('Pubsub-js is a required dependency.');
}
return ps;
});
pubsubangular
.directive('psSubscribe', function (ps) {
... | 'use strict'
var pubsubangular = angular.module('pubsub.angular', []);
pubsubangular.factory('ps', function () {
var ps = window.PubSub;
if(!!ps===false){
throw new Error('Pubsub-js is a required dependency.');
}
return ps;
});
pubsubangular
.directive('psSubscribe', function (ps) {
... |
Simplify equals and hashCode given @NonNull | package mcjty.xnet.api.keys;
import mcjty.lib.varia.BlockPosTools;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import javax.annotation.Nonnull;
public class SidedPos {
private final BlockPos pos;
private final EnumFacing side;
/**
* A position of a connected block... | package mcjty.xnet.api.keys;
import mcjty.lib.varia.BlockPosTools;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import javax.annotation.Nonnull;
public class SidedPos {
private final BlockPos pos;
private final EnumFacing side;
/**
* A position of a connected block... |
Fix attachments state update when thesis is saved | const reducer = (state = [], action) => {
switch (action.type) {
case 'AGREEMENT_GET_ALL_SUCCESS':
// Attachments are attachments to agreement, so fetch them all.
return action.response.attachments
case 'THESIS_SAVE_ONE_SUCCESS':
// Saving thesis response has mult... | const reducer = (state = [], action) => {
switch (action.type) {
case 'AGREEMENT_GET_ALL_SUCCESS':
// Attachments are attachments to agreement, so fetch them all.
return action.response.attachments
case 'THESIS_SAVE_ONE_SUCCESS':
// Saving thesis response has mult... |
Allow code spans across newlines. | <?php
namespace FluxBB\Markdown\Parser\Inline;
use FluxBB\Markdown\Common\Text;
use FluxBB\Markdown\Node\Code;
use FluxBB\Markdown\Node\InlineNodeAcceptorInterface;
use FluxBB\Markdown\Parser\AbstractInlineParser;
class CodeSpanParser extends AbstractInlineParser
{
/**
* Parse the given content.
*
... | <?php
namespace FluxBB\Markdown\Parser\Inline;
use FluxBB\Markdown\Common\Text;
use FluxBB\Markdown\Node\Code;
use FluxBB\Markdown\Node\InlineNodeAcceptorInterface;
use FluxBB\Markdown\Parser\AbstractInlineParser;
class CodeSpanParser extends AbstractInlineParser
{
/**
* Parse the given content.
*
... |
Add form validator for icon_emoji | # -*- coding: utf-8 -*-
from baseframe import __
import baseframe.forms as forms
__all__ = ['LabelForm', 'LabelOptionForm']
class LabelForm(forms.Form):
name = forms.StringField(
"", widget=forms.HiddenInput(), validators=[forms.validators.Optional()]
)
title = forms.StringField(
__("Lab... | # -*- coding: utf-8 -*-
from baseframe import __
import baseframe.forms as forms
__all__ = ['LabelForm', 'LabelOptionForm']
class LabelForm(forms.Form):
name = forms.StringField(
"", widget=forms.HiddenInput(), validators=[forms.validators.Optional()]
)
title = forms.StringField(
__("Lab... |
Join threads or else the number of running threads increments by 5 at each request and will never stop until main process is killed | from multiprocessing.pool import ThreadPool
from django.shortcuts import render
from .forms import SearchForm
from source import view_models
def index(request):
if request.method == 'GET':
form = SearchForm(request.GET)
if form.is_valid():
title = request.GET.__getitem__('movie_title'... | from multiprocessing.pool import ThreadPool
from django.shortcuts import render
from .forms import SearchForm
from source import view_models
def index(request):
if request.method == 'GET':
form = SearchForm(request.GET)
if form.is_valid():
title = request.GET.__getitem__('movie_title'... |
Add support for arguments in request() in tests | import os
import tempfile
from flask import json
import tsserver
# If set to True, each time the test is run, new database is created as a
# temporary file. If the value is equal to False, tests will be using SQLite
# in-memory database.
USE_DB_TEMP_FILE = False
def before_scenario(context, scenario):
if USE_... | import os
import tempfile
from flask import json
import tsserver
# If set to True, each time the test is run, new database is created as a
# temporary file. If the value is equal to False, tests will be using SQLite
# in-memory database.
USE_DB_TEMP_FILE = False
def before_scenario(context, scenario):
if USE_... |
Add a proper exception type for failed conversion | package icepick.annotation;
import javax.lang.model.element.Element;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;
class IcicleField {
public final String name;
public final String typeCast;
public final String command;
IcicleFiel... | package icepick.annotation;
import javax.lang.model.element.Element;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.Elements;
import javax.lang.model.util.Types;
class IcicleField {
public final String name;
public final String typeCast;
public final String command;
IcicleFiel... |
Add some links for STS | // --------------------------------------------------------------------------------------------------------------------
//
// sts-config.js - config for AWS Security Token Service
//
// Copyright (c) 2012 AppsAttic Ltd - http://www.appsattic.com/
// Written by Andrew Chilton <chilts@appsattic.com>
//
// License: http:/... | // --------------------------------------------------------------------------------------------------------------------
//
// sts-config.js - config for AWS Security Token Service
//
// Copyright (c) 2012 AppsAttic Ltd - http://www.appsattic.com/
// Written by Andrew Chilton <chilts@appsattic.com>
//
// License: http:/... |
Allow set loadItems and onBeforeRequest with component props | import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import collectListInitialState from './collectListInitialState';
import * as actions from './actions';
export default function reduxFilterlist(ReduxFilterlistWrapper, {
listId,
...decoratorParams
}) {
if (!listId) {
throw ne... | import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import collectListInitialState from './collectListInitialState';
import * as actions from './actions';
export default function reduxFilterlist(ReduxFilterlistWrapper, {
listId,
loadItems,
onBeforeRequest,
...decoratorParams
})... |
Remove checking of null in compareTo method | package org.zanata.webtrans.shared.model;
import java.io.Serializable;
import com.google.gwt.user.client.rpc.IsSerializable;
//@Immutable
public class DocumentId implements Identifier<Long>, Comparable,
IsSerializable, Serializable {
private static final long serialVersionUID = 1L;
private Long id;
... | package org.zanata.webtrans.shared.model;
import java.io.Serializable;
import com.google.gwt.user.client.rpc.IsSerializable;
//@Immutable
public class DocumentId implements Identifier<Long>, Comparable,
IsSerializable, Serializable {
private static final long serialVersionUID = 1L;
private Long id;
... |
Fix a bug in load_tags function | import os
import json
from dtags.utils import halt, expand_path
TAGS = os.path.expanduser('~/.dtags')
def load_tags():
"""Load the tags from disk."""
if not os.path.exists(TAGS):
try:
with open(TAGS, "w") as config_file:
json.dump({}, config_file)
except (IOError,... | import os
import json
from dtags.utils import halt, expand_path
TAGS = os.path.expanduser('~/.dtags')
def load_tags():
"""Load the tags from disk."""
if not os.path.exists(TAGS):
try:
with open(TAGS, "w") as config_file:
json.dump({}, config_file)
except (IOError,... |
Return proper reponse in JSON layer | <?php
namespace Aztech\Layers\Elements;
use Aztech\Layers\Responses\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\HttpException;
class JsonRenderingLayer
{
private $callable;
public function __construct(c... | <?php
namespace Aztech\Layers\Elements;
use Aztech\Layers\Responses\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\HttpException;
class JsonRenderingLayer
{
private $callable;
public function __construct(c... |
Revert "revert data and layout role to be object"
This reverts commit 655508a7309da2bd89265c1ab469bae7034a56a4. | /**
* Copyright 2012-2021, Plotly, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
module.exports = {
_isLinkedToArray: 'frames_entry',
group: {
valType: 'string',
descri... | /**
* Copyright 2012-2021, Plotly, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
module.exports = {
_isLinkedToArray: 'frames_entry',
group: {
valType: 'string',
descri... |
Fix to the mapper related entities when null | <?php
namespace FS\SolrBundle\Doctrine\Mapper\Mapping;
use FS\SolrBundle\Doctrine\Annotation\Field;
use FS\SolrBundle\Doctrine\Mapper\MetaInformationInterface;
use Doctrine\Common\Collections\Collection;
/**
* command maps all fields of the entity
*
* uses parent method for mapping of document_name and id
*/
clas... | <?php
namespace FS\SolrBundle\Doctrine\Mapper\Mapping;
use FS\SolrBundle\Doctrine\Annotation\Field;
use FS\SolrBundle\Doctrine\Mapper\MetaInformationInterface;
use Doctrine\Common\Collections\Collection;
/**
* command maps all fields of the entity
*
* uses parent method for mapping of document_name and id
*/
clas... |
Set the timezone right after it gets activated. | from django.conf import settings
from django.utils import timezone
from pytz import UnknownTimeZoneError
from .models import TimezoneStore
class TimezonesMiddleware(object):
def process_request(self, request):
"""
Attempts to activate a timezone from a cookie or session
"""
if get... | from django.conf import settings
from django.utils import timezone
from pytz import UnknownTimeZoneError
from .models import TimezoneStore
class TimezonesMiddleware(object):
def process_request(self, request):
"""
Attempts to activate a timezone from a cookie or session
"""
if get... |
Allow spaces in path for project create | var ProjectList,
Project = require("../models/project"),
server = require("../server"),
storage = require("../storage");
ProjectList = Backbone.Collection.extend({
model: Project,
initialize: function () {
var collection = this,
projects = storage.readProjects(),
pro... | var ProjectList,
Project = require("../models/project"),
server = require("../server"),
storage = require("../storage");
ProjectList = Backbone.Collection.extend({
model: Project,
initialize: function () {
var collection = this,
projects = storage.readProjects(),
pro... |
Fix object class assertion bug | <?php
/**
* This file is part of the Axstrad library.
*
* (c) Dan Kempster <dev@dankempster.co.uk>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @author Dan Kempster <dev@dankempster.co.uk>
* @package Axstrad\DoctineExtensions... | <?php
/**
* This file is part of the Axstrad library.
*
* (c) Dan Kempster <dev@dankempster.co.uk>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @author Dan Kempster <dev@dankempster.co.uk>
* @package Axstrad\DoctineExtensions... |
Add UI for unknow exception | import React from 'react';
import { connect } from 'react-redux';
import Grid from 'react-bootstrap/lib/Grid';
import Errors from '../../constants/Errors';
import { removeError } from '../../actions/errorActions';
let ErrorList = ({ errors, dispatch }) => (
<Grid>
{errors.map((error) => (
<div
key=... | import React from 'react';
import { connect } from 'react-redux';
import Grid from 'react-bootstrap/lib/Grid';
import Errors from '../../constants/Errors';
import { removeError } from '../../actions/errorActions';
let ErrorList = ({ errors, dispatch }) => (
<Grid>
{errors.map((error) => (
<div
key=... |
Add missing null-checks for Neo4j session factory instantiation | package org.atlasapi.neo4j;
import org.neo4j.driver.v1.AuthToken;
import org.neo4j.driver.v1.Config;
import org.neo4j.driver.v1.Driver;
import org.neo4j.driver.v1.GraphDatabase;
import org.neo4j.driver.v1.Session;
import static com.google.common.base.Preconditions.checkNotNull;
public class Neo4jSessionFactory {
... | package org.atlasapi.neo4j;
import org.neo4j.driver.v1.AuthToken;
import org.neo4j.driver.v1.Config;
import org.neo4j.driver.v1.Driver;
import org.neo4j.driver.v1.GraphDatabase;
import org.neo4j.driver.v1.Session;
import static com.google.common.base.Preconditions.checkNotNull;
public class Neo4jSessionFactory {
... |
Add trailing slash for INVITE_ENDPOINT | package co.phoenixlab.discord.api;
/**
* Contains various useful API URLs and paths
*/
public class ApiConst {
/**
* Utility class
*/
private ApiConst() {
}
/**
* The base URL from which Discord runs
*/
public static final String BASE_URL = "https://discordapp.com/";
/**... | package co.phoenixlab.discord.api;
/**
* Contains various useful API URLs and paths
*/
public class ApiConst {
/**
* Utility class
*/
private ApiConst() {
}
/**
* The base URL from which Discord runs
*/
public static final String BASE_URL = "https://discordapp.com/";
/**... |
Update webservice to use array of ids | <?php
namespace fennecweb\ajax\details;
use \PDO as PDO;
/**
* Web Service.
* Returns a project according to the project ID.
*/
class Projects extends \fennecweb\WebService
{
/**
* @param $querydata[]
* @returns Array $result
* <code>
* array('project_id': {biomfile});
* </code>
*/
... | <?php
namespace fennecweb\ajax\details;
use \PDO as PDO;
/**
* Web Service.
* Returns a project according to the project ID.
*/
class Projects extends \fennecweb\WebService
{
/**
* @param $querydata[]
* @returns Array $result
* <code>
* array('project_id': {biomfile});
* </code>
*/
... |
Fix static and private combination | <?php
/**
* Part of CI PHPUnit Test
*
* @author Kenji Suzuki <https://github.com/kenjis>
* @license MIT License
* @copyright 2015 Kenji Suzuki
* @link https://github.com/kenjis/ci-phpunit-test
*/
$installer = new Installer();
$installer->install();
class Installer
{
public static function ins... | <?php
/**
* Part of CI PHPUnit Test
*
* @author Kenji Suzuki <https://github.com/kenjis>
* @license MIT License
* @copyright 2015 Kenji Suzuki
* @link https://github.com/kenjis/ci-phpunit-test
*/
$installer = new Installer();
$installer->install();
class Installer
{
public static function ins... |
Return verifier function, not None. Also reset the temporary file to the beginning before verifying it. | import zipfile
import tarfile
import shutil
import tempfile
from osgeo import gdal
def is_zip(tmp):
"""
Returns True if the NamedTemporaryFile given as the argument appears to be
a well-formed Zip file.
"""
try:
zip_file = zipfile.ZipFile(tmp.name, 'r')
test_result = zip_file.test... | import zipfile
import tarfile
import shutil
import tempfile
from osgeo import gdal
def is_zip(tmp):
"""
Returns True if the NamedTemporaryFile given as the argument appears to be
a well-formed Zip file.
"""
try:
zip_file = zipfile.ZipFile(tmp.name, 'r')
test_result = zip_file.test... |
Work around combobox not getting detected correctly
TODO: find proper solution | Ext2.namespace('Kwc.TextImage.ImageEnlarge');
Kwc.TextImage.ImageEnlarge.ImageUploadField = Ext2.extend(Kwc.Basic.ImageEnlarge.ImageUploadField, {
afterRender: function() {
Kwc.TextImage.ImageEnlarge.ImageUploadField.superclass.afterRender.call(this);
var actionField = this._findActionCombobox();
... | Ext2.namespace('Kwc.TextImage.ImageEnlarge');
Kwc.TextImage.ImageEnlarge.ImageUploadField = Ext2.extend(Kwc.Basic.ImageEnlarge.ImageUploadField, {
afterRender: function() {
Kwc.TextImage.ImageEnlarge.ImageUploadField.superclass.afterRender.call(this);
var actionField = this._findActionCombobox();
... |
Use startActivityForResult when creating the first Timetable | package com.satsumasoftware.timetable.ui;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import com.satsumasoftware.timetable.R;
import com.satsumasoftware.timetable.TimetableApplication;
import com.satsumasoftware.timetable.frame... | package com.satsumasoftware.timetable.ui;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import com.satsumasoftware.timetable.R;
import com.satsumasoftware.timetable.TimetableApplication;
import com.satsumasoftware.timetable.framework.Timetable;
public class... |
Change ping result error handling to return values instead of raise exception | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>
"""
from __future__ import absolute_import
from __future__ import unicode_literals
from collections import namedtuple
import platform
import dataproperty
PingResult = namedtuple("PingResult", "stdout stderr returncode")
class PingTrans... | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>
"""
from __future__ import absolute_import
from __future__ import unicode_literals
import platform
import dataproperty
class PingTransmitter(object):
def __init__(self):
self.destination_host = ""
self.waittime = 1
... |
Update DUA requirement to support Django 1.9 | import codecs
from os import path
from setuptools import find_packages, setup
def read(*parts):
filename = path.join(path.dirname(__file__), *parts)
with codecs.open(filename, encoding="utf-8") as fp:
return fp.read()
setup(
author="Pinax Team",
author_email="team@pinaxproject.com",
des... | import codecs
from os import path
from setuptools import find_packages, setup
def read(*parts):
filename = path.join(path.dirname(__file__), *parts)
with codecs.open(filename, encoding="utf-8") as fp:
return fp.read()
setup(
author="Pinax Team",
author_email="team@pinaxproject.com",
des... |
Support import was throwing exceptions | import React from 'react';
import {
View,
Text,
} from 'react-native';
// import { Actions } from 'react-native-router-flux';
import RoomView from './RoomView';
import { AppStyles, AppSizes } from '../../../theme/';
import Network from '../../../network';
import t from '../../../i18n';
export default class Suppor... | import React from 'react';
import {
View,
Text,
} from 'react-native';
// import { Actions } from 'react-native-router-flux';
import { RoomView } from './RoomView';
import { AppStyles, AppSizes } from '../../../theme/';
import Network from '../../../network';
import t from '../../../i18n';
export default class Su... |
Update clear cache to electron promise APIs | import { ipcRenderer, remote } from 'electron';
import du from 'du';
import { getServicePartitionsDirectory } from '../../helpers/service-helpers.js';
const debug = require('debug')('Franz:LocalApi');
const { session } = remote;
export default class LocalApi {
// Settings
getAppSettings(type) {
return new P... | import { ipcRenderer, remote } from 'electron';
import du from 'du';
import { getServicePartitionsDirectory } from '../../helpers/service-helpers.js';
const debug = require('debug')('Franz:LocalApi');
const { session } = remote;
export default class LocalApi {
// Settings
getAppSettings(type) {
return new P... |
WebRTC: Switch chromium.webrtc Linux builders to chromium recipe.
With https://codereview.chromium.org/1406253003/ landed this is the
first CL in a series of careful rollout to the new recipe.
BUG=538259
TBR=phajdan.jr@chromium.org
Review URL: https://codereview.chromium.org/1508933002
git-svn-id: 239fca9b83025a0b6... | # Copyright (c) 2015 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.
from buildbot.changes.filter import ChangeFilter
from buildbot.schedulers.basic import SingleBranchScheduler
from master.factory import annotator_factor... | # Copyright (c) 2015 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.
from buildbot.changes.filter import ChangeFilter
from buildbot.schedulers.basic import SingleBranchScheduler
from master.factory import annotator_factor... |
Revert "eos and UNK will be overwritten if they occur in the corpus, should always be 0 and 1"
Actually fine if there are weird values, as Nematus does not really use them.
This reverts commit 09eb3594fb395d43dd3f6c2a4dec85af683cbb30. | #!/usr/bin/python
import numpy
import json
import sys
import fileinput
from collections import OrderedDict
def main():
for filename in sys.argv[1:]:
print 'Processing', filename
word_freqs = OrderedDict()
with open(filename, 'r') as f:
for line in f:
words_in ... | #!/usr/bin/python
import numpy
import json
import sys
import fileinput
from collections import OrderedDict
def main():
for filename in sys.argv[1:]:
print 'Processing', filename
word_freqs = OrderedDict()
with open(filename, 'r') as f:
for line in f:
words_in ... |
Include Assinaturas ebook in Edit Start Page | import m from 'mithril';
import h from '../h';
import userVM from '../vms/user-vm';
import projectVM from '../vms/project-vm';
import youtubeLightbox from '../c/youtube-lightbox';
const I18nScope = _.partial(h.i18nScope, 'projects.dashboard_start');
const projectEditStart = {
controller(args) {
},
view(ct... | import m from 'mithril';
import h from '../h';
import userVM from '../vms/user-vm';
import projectVM from '../vms/project-vm';
import youtubeLightbox from '../c/youtube-lightbox';
const I18nScope = _.partial(h.i18nScope, 'projects.dashboard_start');
const projectEditStart = {
controller(args) {
},
view(ct... |
Apply site controller to the root state in embedded mode | 'use strict';
(function() {
angular
.module('app')
.config(['$stateProvider', '$urlRouterProvider', 'grEmbeddingParamsProvider',
function($stateProvider, $urlRouterProvider, grEmbeddingParamsProvider) {
$stateProvider
.state('site', {
abstract: true,
templateUr... | 'use strict';
(function() {
angular
.module('app')
.config(['$stateProvider', '$urlRouterProvider',
function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('site', {
abstract: true,
templateUrl: '/templates/site.html'
}).state('site.laws'... |
Remove the task only once | define([
'Backbone',
//Templates
'text!templates/project-page/closeGameTemplate.html'
], function(
Backbone,
//Template
closeGameTemplate
){
var GameController = Backbone.View.extend({
template: _.template(closeGameTemplate),
close: function(event){
var task = this.selectedTask.get('id... | define([
'Backbone',
//Templates
'text!templates/project-page/closeGameTemplate.html'
], function(
Backbone,
//Template
closeGameTemplate
){
var GameController = Backbone.View.extend({
template: _.template(closeGameTemplate),
close: function(event){
var task = this.selectedTask.get('id... |
Nick: Add working search function v1 | #!/usr/bin/env python
from __future__ import print_function
class Node(object):
def __init__(self, value):
self._val = value
self._next = None
@property
def next(self):
return self._next
@next.setter
def next(self, value):
self._next = value
@property
de... | #!/usr/bin/env python
from __future__ import print_function
class Node(object):
def __init__(self, value):
self._val = value
self._next = None
@property
def next(self):
return self._next
@next.setter
def next(self, value):
self._next = value
@property
de... |
Add option to start server passing lib path | #!/usr/bin/env python
"""
This is an example snap7 server. It doesn't do much, but accepts
connection. Usefull for running the python-snap7 test suite.
"""
import time
import logging
import snap7
def mainloop():
server = snap7.server.Server()
size = 100
data = (snap7.types.wordlen_to_ctypes[snap7.types.S7... | #!/usr/bin/env python
"""
This is an example snap7 server. It doesn't do much, but accepts
connection. Usefull for running the python-snap7 test suite.
"""
import time
import logging
import snap7
def mainloop():
server = snap7.server.Server()
size = 100
data = (snap7.types.wordlen_to_ctypes[snap7.types.S7... |
QS-1001: Access translated components by ref | import { default as React } from 'react';
import en from './en';
import es from './es';
const locales = {en, es};
export default function translate(key) {
return Component => {
class TranslationComponent extends React.Component {
componentWillMount() {
let strings = locales[th... | import { default as React } from 'react';
import en from './en';
import es from './es';
const locales = {en, es};
export default function translate(key) {
return Component => {
class TranslationComponent extends React.Component {
componentWillMount() {
let strings = locales[th... |
[fix] Add missing viewport tag. Responsive styles were setup, but weren't
taking effect. | const React = require('react');
const ReactGA = require('react-ga');
const Component = React.createClass({
render: function () {
return (
<html>
<head>
<meta name="description" content="Web application design, development, enterprise architecture, hiring, and training for Node.js and Re... | const React = require('react');
const ReactGA = require('react-ga');
const Component = React.createClass({
render: function () {
return (
<html>
<head>
<meta name="description" content="Web application design, development, enterprise architecture, hiring, and training for Node.js and Re... |
CRM-7032: Configure form extension for Customer entities
- Add Account column to customers grids
- Add Account column to customers views | <?php
namespace Oro\Bundle\DataGridBundle\Tools;
use Oro\Bundle\DataGridBundle\Datagrid\Common\DatagridConfiguration;
use Oro\Bundle\EntityBundle\ORM\EntityClassResolver;
class GridConfigurationHelper
{
/** @var EntityClassResolver */
protected $entityClassResolver;
/**
* @param EntityClassResolver... | <?php
namespace Oro\Bundle\DataGridBundle\Tools;
use Oro\Bundle\DataGridBundle\Datagrid\Common\DatagridConfiguration;
use Oro\Bundle\DataGridBundle\Datasource\Orm\OrmDatasource;
use Oro\Bundle\EntityBundle\ORM\EntityClassResolver;
use Oro\Bundle\SearchBundle\Datagrid\Datasource\SearchDatasource;
use Oro\Bundle\Search... |
Update validation-rules prop to accept Array in addition to String | import Validator from 'validatorjs';
export default {
props: {
valid: {
type: Boolean,
default: true,
twoWay: true
},
dirty: {
type: Boolean,
default: false,
twoWay: true
},
hideValidationErrors: {
... | import Validator from 'validatorjs';
export default {
props: {
valid: {
type: Boolean,
default: true,
twoWay: true
},
dirty: {
type: Boolean,
default: false,
twoWay: true
},
hideValidationErrors: {
... |
Use barbe to render dynamic fields. | "use strict";
const typpy = require("typpy")
, iterateObject = require("iterate-object")
, barbe = require("barbe")
;
/**
* Err
* Create a custom error object.
*
* @name Err
* @function
* @param {String|Error|Object} error The error message or an existing `Error`
* instance or the `data` object whe... | "use strict";
const typpy = require("typpy")
, iterateObject = require("iterate-object")
;
/**
* Err
* Create a custom error object.
*
* @name Err
* @function
* @param {String|Error|Object} error The error message or an existing `Error`
* instance or the `data` object where the `message` is the error m... |
Remove recording wait, works better | import io
import picamera
class Camera(object):
def __init__(self):
self.camera = picamera.PiCamera()
self.camera.resolution = (640, 480)
self.camera.rotation = 180
self.camera.led = False
self.recording = False
self.loopStream = picamera.PiCameraCircularIO(self.ca... | import io
import picamera
class Camera(object):
def __init__(self):
self.camera = picamera.PiCamera()
self.camera.resolution = (800, 600)
self.camera.framerate = 30
self.camera.rotation = 180
self.camera.led = False
self.recording = False
self.loopStream = ... |
Add timestamp when none present | <?php
/*
* This file is part of Raven.
*
* (c) Sentry Team
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Raven Breadcrumbs
*
* @package raven
*/
class Raven_Breadcrumbs
{
public function __construct($size = 100)
... | <?php
/*
* This file is part of Raven.
*
* (c) Sentry Team
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Raven Breadcrumbs
*
* @package raven
*/
class Raven_Breadcrumbs
{
public function __construct($size = 100)
... |
Fix sessionStorage name to retrieve token. | angular.module('MovnThereUI').factory('AuthFactory', function($http, $window, ServerUrl) {
'use strict';
var login = function(credentials) {
return $http
.post(ServerUrl + 'login', credentials)
.success(function(response) {
$window.sessionStorage.setItem('movnTh... | angular.module('MovnThereUI').factory('AuthFactory', function($http, $window, ServerUrl) {
'use strict';
var login = function(credentials) {
return $http
.post(ServerUrl + 'login', credentials)
.success(function(response) {
$window.sessionStorage.setItem('movnTh... |
Change Widget tag on SimultaneousAxes to TEXTINPUT | from annotypes import Anno, Array, Union, Sequence, add_call_types
from malcolm.core import Part, StringArrayMeta, Widget, config_tag, \
PartRegistrar, APartName
from ..hooks import ValidateHook, AAxesToMove
with Anno("Initial value for set of axes that can be moved at the same time"):
ASimultaneousAxes = Ar... | from annotypes import Anno, Array, Union, Sequence, add_call_types
from malcolm.core import Part, StringArrayMeta, Widget, config_tag, \
PartRegistrar, APartName
from ..hooks import ValidateHook, AAxesToMove
with Anno("Initial value for set of axes that can be moved at the same time"):
ASimultaneousAxes = Ar... |
Fix swapped dates on invoices | from django.core.management import BaseCommand
from spiff.membership.utils import monthRange
from spiff.membership.models import Member, RankLineItem
from spiff.payment.models import Invoice
class Command(BaseCommand):
help = 'Bills active members for the month'
def handle(self, *args, **options):
for member ... | from django.core.management import BaseCommand
from spiff.membership.utils import monthRange
from spiff.membership.models import Member, RankLineItem
from spiff.payment.models import Invoice
class Command(BaseCommand):
help = 'Bills active members for the month'
def handle(self, *args, **options):
for member ... |
Make it clear that the user must implement generate_from_int | # Copyright (c) 2017 The Regents of the University of Michigan.
# All Rights Reserved. Licensed according to the terms of the Revised
# BSD License. See LICENSE.txt for details.
class CheckDigitNumber:
def __init__ (self, number = None):
self.__set_number(number)
def generate_from_int (self, n):
... | # Copyright (c) 2017 The Regents of the University of Michigan.
# All Rights Reserved. Licensed according to the terms of the Revised
# BSD License. See LICENSE.txt for details.
class CheckDigitNumber:
def __init__ (self, number = None):
self.__set_number(number)
def get_check_digit (self):
i... |
examples: Update to use v_normals for color | FamousFramework.scene('famous-tests:webgl:custom-shader:fragment', {
behaviors: {
'.sphere': {
'size': [200, 200],
'align': [0.5, 0.5],
'mount-point': [0.5, 0.5],
'base-color': {
'name': 'sphereFragment',
'glsl': 'vec4((v_normal... | FamousFramework.scene('famous-tests:webgl:custom-shader:fragment', {
behaviors: {
'.sphere': {
'size': [200, 200],
'align': [0.5, 0.5],
'mount-point': [0.5, 0.5],
'base-color': {
'name': 'sphereFragment',
'glsl': 'vec4(0.0, 1.0,... |
Fix command to show parse logs and tail output | // Requires
var _ = require('underscore');
function setup(options, imports, register) {
var deploy = imports.deploy;
var shells = imports.shells;
/*
Documentation about parse command lien tool can be found at:
https://parse.com/docs/cloud_code_guide
*/
deploy.add({
id: "parse",
... | // Requires
var _ = require('underscore');
function setup(options, imports, register) {
var deploy = imports.deploy;
var shells = imports.shells;
/*
Documentation about parse command lien tool can be found at:
https://parse.com/docs/cloud_code_guide
*/
deploy.add({
id: "parse",
... |
Remove nullable() from wifi migration | <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Capsule\Manager as Capsule;
class Wifi extends Migration
{
public function up()
{
$capsule = new Capsule();
$capsule::schema()->create('wifi', function (Blueprint $table) {
... | <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Capsule\Manager as Capsule;
class Wifi extends Migration
{
public function up()
{
$capsule = new Capsule();
$capsule::schema()->create('wifi', function (Blueprint $table) {
... |
Use repr for assert failure | IRRELEVANT = object()
class ChangeWatcher(object):
def __init__(self, thing, *args, **kwargs):
self.thing = thing
self.args = args
self.kwargs = kwargs
self.expected_before = kwargs.pop('before', IRRELEVANT)
self.expected_after = kwargs.pop('after', IRRELEVANT)
def __... | IRRELEVANT = object()
class ChangeWatcher(object):
def __init__(self, thing, *args, **kwargs):
self.thing = thing
self.args = args
self.kwargs = kwargs
self.expected_before = kwargs.pop('before', IRRELEVANT)
self.expected_after = kwargs.pop('after', IRRELEVANT)
def __... |
Clean up the model a bit | var Q = require('Q');
var request = Q.denodeify(require('request'));
var _ = require('underscore');
function CampaignModel(name) {
// @todo Can probably clean this up?
_.bindAll.apply(_, [this].concat(_.functions(this)));
this.name = name;
this._request = null;
}
CampaignModel.get = f... | var Q = require('Q');
var request = Q.denodeify(require('request'));
var _ = require('underscore');
function CampaignModel(name) {
// @todo Can probably clean this up?
_.bindAll.apply(_, [this].concat(_.functions(this)));
this.name = name;
this._request = null;
}
CampaignModel.get = f... |
Return null on parse errors as per specification; Do not throw Exception | package org.crygier.graphql;
import java.math.BigInteger;
import java.text.DateFormat;
import java.text.ParseException;
import java.util.Date;
import graphql.language.IntValue;
import graphql.language.StringValue;
import graphql.schema.Coercing;
import graphql.schema.GraphQLScalarType;
import org.slf4j.Logger;
import... | package org.crygier.graphql;
import java.math.BigInteger;
import java.text.DateFormat;
import java.text.ParseException;
import java.util.Date;
import graphql.language.IntValue;
import graphql.language.StringValue;
import graphql.schema.Coercing;
import graphql.schema.GraphQLScalarType;
public class JavaScalars {
... |
Rewrite summary as late as possible.
Fixes issue where {filename} links would sometimes not work. | """
Summary Footnotes
-------------
Fix handling of footnote links inside article summaries.
Option to either remove them or make them link to the article page.
"""
from pelican import signals
from pelican.contents import Content, Article
from BeautifulSoup import BeautifulSoup
from six import text_type
def initiali... | """
Summary Footnotes
-------------
Fix handling of footnotes inside article summaries.
Option to either remove them or make them link to the article page.
"""
from pelican import signals
from pelican.contents import Content, Article
from BeautifulSoup import BeautifulSoup
from six import text_type
def summary_footn... |
Handle protocol errors and disconnect client | <?php
namespace Clue\Redis\React;
use Evenement\EventEmitter;
use React\Stream\Stream;
use Clue\Redis\Protocol\ProtocolInterface;
use Clue\Redis\Protocol\ParserException;
use React\Promise\Deferred;
class Client extends EventEmitter
{
private $stream;
private $protocol;
public function __construct(Strea... | <?php
namespace Clue\Redis\React;
use Evenement\EventEmitter;
use React\Stream\Stream;
use Clue\Redis\Protocol\ProtocolInterface;
use React\Promise\Deferred;
class Client extends EventEmitter
{
private $stream;
private $protocol;
public function __construct(Stream $stream, ProtocolInterface $protocol)
... |
Add return type declaration (TreeBuilder) | <?php
/**
* User: Simon Libaud
* Date: 12/03/2017
* Email: simonlibaud@gmail.com.
*/
namespace Sil\RouteSecurityBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* Class Configuration.
*/
class Configurati... | <?php
/**
* User: Simon Libaud
* Date: 12/03/2017
* Email: simonlibaud@gmail.com.
*/
namespace Sil\RouteSecurityBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* Class Configuration.
*/
class Configurati... |
Deal with exceptions more cleanly. | "use strict";
var t0 = Date.now();
var express = require("express"),
xhub = require('express-x-hub');
if (process.env.NODE_ENV === "dev") {
// Load local env variables
require("./env");
}
function logArgs() {
var args = arguments;
process.nextTick(function() {
console.log.apply(console, a... | "use strict";
var t0 = Date.now();
var express = require("express"),
xhub = require('express-x-hub');
if (process.env.NODE_ENV === "dev") {
// Load local env variables
require("./env");
}
function logArgs() {
var args = arguments;
process.nextTick(function() {
console.log.apply(console, a... |
Remove use of mocks since we can use functions on their own now | <?php
namespace Lily\Test\Application;
use Lily\Application\MiddlewareApplication;
use Lily\Util\Response;
class MiddlewareApplicationTest extends \PHPUnit_Framework_TestCase
{
public function testMiddlewareOrder()
{
$expectedCalledOrder = array(1, 2, 3);
$calledOrder = array();
$ha... | <?php
namespace Lily\Test\Application;
use Lily\Application\MiddlewareApplication;
use Lily\Mock\Application;
use Lily\Mock\Middleware;
class MiddlewareApplicationTest extends \PHPUnit_Framework_TestCase
{
public function testMiddlewareOrder()
{
$expectedCalledOrder = array(1, 2, 3);
$calledO... |
Add rarely, mostly and other alias | import random
in_percentage = lambda x: random.randint(1,100) <= x
"""
They've done studies, you know. 50% of the time,
it works every time.
"""
def sometimes(fn):
def wrapped(*args, **kwargs):
wrapped.x += 1
if wrapped.x % 2 == 1:
return fn(*args, **kwargs)
wrapped.x =... | import random
in_percentage = lambda x: random.randint(1,100) <= x
"""
They've done studies, you know. 50% of the time,
it works every time.
"""
def sometimes(fn):
def wrapped(*args, **kwargs):
wrapped.x += 1
if wrapped.x % 2 == 1:
return fn(*args, **kwargs)
return
... |
PIG-4268: Enable unit test "TestStreamingUDF" in spark (liyunzhang via praveen)
git-svn-id: d317905e1b1233abb7022f5914f79c3119e04b87@1645891 13f79535-47bb-0310-9956-ffa450edef68 | package org.apache.pig.test;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hdfs.MiniDFSCluster;
import org.apache.pig.ExecType;
import org.apache.pig.backend.hadoop.executionengine.spark.SparkExecType;
public cl... | package org.apache.pig.test;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hdfs.MiniDFSCluster;
import org.apache.pig.ExecType;
import org.apache.pig.backend.hadoop.executionengine.spark.SparkExecType;
public cl... |
Use template for postlinks to allow easy changes | <?php
/**
* Default template for displaying post content
*
* @package ZnWP Bootstrap Theme
*/
global $znwp_theme;
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h1 class="post-title">
<?php if (is_single()): ?>
<?php the_title(); ?>
... | <?php
/**
* Default template for displaying post content
*
* @package ZnWP Bootstrap Theme
*/
global $znwp_theme;
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h1 class="post-title">
<?php if (is_single()): ?>
<?php the_title(); ?>
... |
Define the public methods in the private space | var Gificiency = (function() {
'use strict';
var searchField = $('.search'),
items = $('li'),
links = $('a');
var search = function(filter) {
links.each(function() {
var elem = $(this);
if (elem.text().search( new RegExp(filter, 'i') ) < 0) {
elem.hide();
} else {
... | var Gificiency = (function() {
'use strict';
var searchField = $('.search');
var items = $('li');
var links = $('a');
var search = function(filter) {
links.each(function() {
var elem = $(this);
if (elem.text().search( new RegExp(filter, 'i') ) < 0) {
elem.hide();
} else {
... |
Rewrite to use mousewheel functions for detecting scroll direction, turning scroll on/off | var direction;
$(function(){
$('body').css('overflow', 'hidden');
$(document).on('mousewheel DOMMouseScroll MozMousePixelScroll', scrollFunctions);
});
$(window).load(function(){
$(window).scrollTop(0);
});
function scrollFunctions() {
getScrollDirection();
scrollOnScroll();
}
function scro... | var lastScrollTop;
$(function(){
var direction = 'down';
lastScrollTop = 0;
$(window).on('scroll', scrollOnScroll);
});
function scrollOnScroll() {
var windowTop = $(window).scrollTop();
var activeScrollSection = $('.scroll-target.active');
var scrollTarget = activeScrollSection.next('.sc... |
[Codeception] Move mailer hack to `loadApp` method to ensure it's always applied. | <?php
namespace Codeception\Module;
use Codeception\TestInterface;
use Symfony\Component\BrowserKit\CookieJar;
use Symfony\Component\HttpKernel\Client;
/**
* Change client to follow redirects and keep cookie jar between tests.
*
* @author Carson Full <carsonfull@gmail.com>
*/
class WorkingSilex extends Silex
{
... | <?php
namespace Codeception\Module;
use Codeception\TestInterface;
use Symfony\Component\BrowserKit\CookieJar;
use Symfony\Component\HttpKernel\Client;
/**
* Change client to follow redirects and keep cookie jar between tests.
*
* @author Carson Full <carsonfull@gmail.com>
*/
class WorkingSilex extends Silex
{
... |
Add metadata and resource distinction in DataManager | import logging
from collections import OrderedDict
from egpackager.datasources import GspreadDataSource, RasterDataSource
class DataManager(object):
def __init__(self, debug=False):
# Set up logging
if debug:
logging.basicConfig(level=logging.DEBUG)
else:
logging.... | import logging
from collections import OrderedDict
from egpackager.datasources import GspreadDataSource, RasterDataSource
class DataManager(object):
def __init__(self, debug=False):
# Set up logging
if debug:
logging.basicConfig(level=logging.DEBUG)
else:
logging.... |
:new: Add forecast dimensions to the dashboard | 'use strict';
angular
.module('report-editor')
.config(function ($stateProvider) {
$stateProvider
.state('dashboard.concepts.concept', {
url: '/:concepts/:label',
templateUrl: '/dashboard/concepts/concept/concept.html',
controller: 'DashboardC... | 'use strict';
angular
.module('report-editor')
.config(function ($stateProvider) {
$stateProvider
.state('dashboard.concepts.concept', {
url: '/:concepts/:label',
templateUrl: '/dashboard/concepts/concept/concept.html',
controller: 'DashboardC... |
Print "Geschaeftsprozessmodelle" when 'l' has been pressed | package rogue.creature;
import java.util.Collection;
import jade.fov.RayCaster;
import jade.fov.ViewField;
import jade.ui.Camera;
import jade.ui.Terminal;
import jade.util.datatype.ColoredChar;
import jade.util.datatype.Coordinate;
import jade.util.datatype.Direction;
public class Player extends Creature implements C... | package rogue.creature;
import java.util.Collection;
import jade.fov.RayCaster;
import jade.fov.ViewField;
import jade.ui.Camera;
import jade.ui.Terminal;
import jade.util.datatype.ColoredChar;
import jade.util.datatype.Coordinate;
import jade.util.datatype.Direction;
public class Player extends Creature implements C... |
Add quotes around date and time for python 2 | from django.db.backends.mysql.schema import DatabaseSchemaEditor \
as BaseDatabaseSchemaEditor
import datetime
import sys
class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
def execute(self, sql, params=()):
sql = str(sql)
if self.collect_sql:
ending = "" if sql.endswith(";") el... | from django.db.backends.mysql.schema import DatabaseSchemaEditor \
as BaseDatabaseSchemaEditor
import sys
class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
def execute(self, sql, params=()):
sql = str(sql)
if self.collect_sql:
ending = "" if sql.endswith(";") else ";"
... |
Fix some bugs in the list parser regex | package org.monospark.spongematchers.parser.element;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.monospark.spongematchers.util.PatternBuilder;
import com.google.common.collect.Lists;
public final class ListElementParser extends StringElementParser {
@Overri... | package org.monospark.spongematchers.parser.element;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.monospark.spongematchers.util.PatternBuilder;
import com.google.common.collect.Lists;
public final class ListElementParser extends StringElementParser {
@Overri... |
Change .complete to .always, as .complete has been deprecated since jQuery 1.8 | $(document).ready(function(){
'use strict';
function load_new_items(){
var sign = load_path.indexOf('?') >= 0 ? '&' : '?'
$.get(load_path + sign + 'page=' + (++page_num), function(data, e) {
if(data.length < 5) {
var page_num = 0;
return false;
}
data_container.append(dat... | $(document).ready(function(){
'use strict';
function load_new_items(){
var sign = load_path.indexOf('?') >= 0 ? '&' : '?'
$.get(load_path + sign + 'page=' + (++page_num), function(data, e) {
if(data.length < 5) {
var page_num = 0;
return false;
}
data_container.append(dat... |
Change Game form score input to select | from django import forms
from django_select2.forms import ModelSelect2MultipleWidget
from django_superform import ModelFormField, SuperForm
from .models import Team, Game
from .utils import clean_team_forms
from foosball.users.models import User
class MultiPlayerWidget(ModelSelect2MultipleWidget):
model = User
... | from django import forms
from django_select2.forms import ModelSelect2MultipleWidget
from django_superform import ModelFormField, SuperForm
from .models import Team, Game
from .utils import clean_team_forms
from foosball.users.models import User
class MultiPlayerWidget(ModelSelect2MultipleWidget):
model = User
... |
[LEADERBOARD/USERDATA] Add userinfo getter, fix typo in class name | const LEADERBOARD_SIZE = 10;
class Leaderboard {
constructor () {
this.db = fbApp.database();
}
refreshScores (callback) {
this.db.ref('leaderboard').orderByValue().limitToLast(LEADERBOARD_SIZE).once('value', (snapshot) => {
var board = [];
snapshot.forEach((data) ... | const LEADERBOARD_SIZE = 10;
class leaderboard {
constructor () {
this.db = fbApp.database();
}
refreshScores (callback) {
this.db.ref('leaderboard').orderByValue().limitToLast(LEADERBOARD_SIZE).once('value', (snapshot) => {
var board = [];
snapshot.forEach((data) ... |
Fix Load multiple JSON bug using array of promises | define([
'base/class',
'jquery',
'underscore',
'base/utils'
], function(Class, $, _, Util) {
var LocalJSONReader = Class.extend({
init: function(basepath) {
this.data = [];
this.basepath = basepath;
},
read: function(queries, language) {... | define([
'base/class',
'jquery',
'underscore',
'base/utils'
], function(Class, $, _, Util) {
var LocalJSONReader = Class.extend({
init: function(basepath) {
this.data = [];
this.basepath = basepath;
},
read: function(queries, language) {... |
Bump version to 0.0.3 for pip. | from setuptools import setup
import os
setup(
name = "conduit",
version = "0.0.3",
author = "Steve Leibman",
author_email = "sleibman@alum.mit.edu",
description = ("Framework for dataflow-style python programming"),
license = "MIT",
keywords = "dataflow distributed pipe flow programming",
... | from setuptools import setup
import os
setup(
name = "conduit",
version = "0.0.2",
author = "Steve Leibman",
author_email = "sleibman@alum.mit.edu",
description = ("Framework for dataflow-style python programming"),
license = "MIT",
keywords = "dataflow distributed pipe flow programming",
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.