text stringlengths 17 1.47k | positive stringlengths 673 4.43k | negative stringlengths 677 2.81k |
|---|---|---|
Fix typo preventing the Django/Datadog integration from starting | from django.core.management.base import BaseCommand
from spinach.const import DEFAULT_QUEUE, DEFAULT_WORKER_NUMBER
from spinach.contrib.datadog import register_datadog_if_module_patched
from ...apps import spin
class Command(BaseCommand):
help = 'Run Spinach workers'
def add_arguments(self, parser):
... | from django.core.management.base import BaseCommand
from spinach.const import DEFAULT_QUEUE, DEFAULT_WORKER_NUMBER
from spinach.contrib.datadog import register_datadog_if_module_patched
from ...apps import spin
class Command(BaseCommand):
help = 'Run Spinach workers'
def add_arguments(self, parser):
... |
Change cartridge conf of advaced search dynamically | import { isFunction } from 'lodash';
import { setHeader } from 'focus-core/application';
module.exports = {
/**
* Updates the cartridge using the cartridgeConfiguration.
*/
_registerCartridge(props = this.props) {
const cartridgeConfiguration = this.cartridgeConfiguration || props.cartridge... | import {isFunction, isUndefined} from 'lodash/lang';
import {setHeader} from 'focus-core/application';
import {component as Empty} from '../../common/empty';
module.exports = {
/**
* Updates the cartridge using the cartridgeConfiguration.
*/
_registerCartridge() {
this.cartridgeConfiguration... |
Fix shared event manager when used in ZF3 | <?php
namespace JwPersistentUser;
use JwPersistentUser\Service\CookieAuthenticationService;
use Zend\EventManager\EventInterface;
use Zend\EventManager\EventManager;
use Zend\ModuleManager\Feature;
use Zend\ServiceManager\ServiceManager;
class Module implements
Feature\ConfigProviderInterface,
Feature\Bootst... | <?php
namespace JwPersistentUser;
use JwPersistentUser\Service\CookieAuthenticationService;
use Zend\EventManager\EventInterface;
use Zend\EventManager\EventManager;
use Zend\ModuleManager\Feature;
use Zend\ServiceManager\ServiceManager;
class Module implements
Feature\ConfigProviderInterface,
Feature\Bootst... |
Allow injecting of cache through factory | <?php
namespace Addr;
use Alert\Reactor,
LibDNS\Decoder\DecoderFactory,
LibDNS\Encoder\EncoderFactory,
LibDNS\Messages\MessageFactory,
LibDNS\Records\QuestionFactory;
class ResolverFactory
{
/**
* Create a new resolver instance
*
* @param Reactor $reactor
* @param string $serv... | <?php
namespace Addr;
use Alert\Reactor,
LibDNS\Decoder\DecoderFactory,
LibDNS\Encoder\EncoderFactory,
LibDNS\Messages\MessageFactory,
LibDNS\Records\QuestionFactory;
class ResolverFactory
{
/**
* Create a new resolver instance
*
* @param Reactor $reactor
* @param string $serv... |
Add Javadoc to the generated private c-tor | /*
* Copyright 2020, TeamDev. All rights reserved.
*
* Redistribution and use in source and/or binary forms, with or without
* modification, must retain the above copyright notice and the following
* disclaimer.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR... | /*
* Copyright 2020, TeamDev. All rights reserved.
*
* Redistribution and use in source and/or binary forms, with or without
* modification, must retain the above copyright notice and the following
* disclaimer.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR... |
Fix error `AttributeError: 'module' object has no attribute 'PY2'` | from setuptools import setup
setup(
name='django-cacheops',
version='1.2',
author='Alexander Schepanovski',
author_email='suor.web@gmail.com',
description='A slick ORM cache with automatic granular event-driven invalidation for Django.',
long_description=open('README.rst').read(),
url='htt... | from setuptools import setup
setup(
name='django-cacheops',
version='1.2',
author='Alexander Schepanovski',
author_email='suor.web@gmail.com',
description='A slick ORM cache with automatic granular event-driven invalidation for Django.',
long_description=open('README.rst').read(),
url='htt... |
Remove conditional in at rules | const MiniCSSExtractPlugin = require('mini-css-extract-plugin');
const styleFunctions = require('../../src/styles/functions/index.js');
module.exports = (env) => {
const styleLoaders = {
production: MiniCSSExtractPlugin.loader,
development: 'style-loader'
};
return {
test: /\.css$/,
exclude: /n... | const MiniCSSExtractPlugin = require('mini-css-extract-plugin');
const styleFunctions = require('../../src/styles/functions/index.js');
module.exports = (env) => {
const styleLoaders = {
production: MiniCSSExtractPlugin.loader,
development: 'style-loader'
};
return {
test: /\.css$/,
exclude: /n... |
Change default user image (when user is logged in) | define('app/views/user_menu', ['text!app/templates/user_menu.html', 'ember'],
/**
* User Menu View
*
* @returns Class
*/
function(user_menu_html) {
return Ember.View.extend({
/**
* Properties
*/
isNotCore: !IS_CORE,
a... | define('app/views/user_menu', ['text!app/templates/user_menu.html', 'ember'],
/**
* User Menu View
*
* @returns Class
*/
function(user_menu_html) {
return Ember.View.extend({
/**
* Properties
*/
isNotCore: !IS_CORE,
a... |
Change random for inset color | package com.jpardogo.android.listbuddies.models;
import android.content.Context;
import com.jpardogo.android.listbuddies.R;
import com.jpardogo.android.listbuddies.adapters.CustomizeSpinnersAdapter;
/**
* Created by jpardogo on 22/02/2014.
*/
public class KeyValuePair {
private String key;
private Object v... | package com.jpardogo.android.listbuddies.models;
import android.content.Context;
import android.graphics.Color;
import com.jpardogo.android.listbuddies.R;
import com.jpardogo.android.listbuddies.adapters.CustomizeSpinnersAdapter;
import java.util.Random;
/**
* Created by jpardogo on 22/02/2014.
*/
public class Ke... |
Update user list when reaping. | #!/usr/bin/python
from redis import Redis
import time
from messages import addSystemMessage
STARTTIME = 1302231346
PING_PERIOD = 10
SEARCH_PERIOD = 1
def getTime():
return time.time() - STARTTIME
def getD(db, session, key, defaultValue=''):
v = db.hget("session-"+session, key)
if v is not None:
... | #!/usr/bin/python
from redis import Redis
import time
from messages import addSystemMessage
STARTTIME = 1302231346
PING_PERIOD = 10
SEARCH_PERIOD = 1
def getTime():
return time.time() - STARTTIME
def getD(db, session, key, defaultValue=''):
v = db.hget("session-"+session, key)
if v is not None:
... |
Update migration file to lose dependency from discarded migration file | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wagtaildocs', '0007_merge'),
('resources', '0006_add_field_for_absolute_slideshare_url'),
]
... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wagtaildocs', '0007_merge'),
('core', '0026_auto_20180306_1150'),
('resources', '0006_add_fi... |
Use setElement to set the view's element properly. | //----------------------------------------------------------------------------
// Copyright (C) 2013 The IPython Development Team
//
// Distributed under the terms of the BSD License. The full license is in
// the file COPYING, distributed as part of this software.
//------------------------------------------------... | //----------------------------------------------------------------------------
// Copyright (C) 2013 The IPython Development Team
//
// Distributed under the terms of the BSD License. The full license is in
// the file COPYING, distributed as part of this software.
//------------------------------------------------... |
Add tokenization and part of speech to the plugin.reply args dict. | define(
[
'jquery',
'pos'
], function(jquery, pos) {
var jQuery = jquery,
Pos = pos;
console.log("Pos",Pos);
return {
responsePlugins: [],
persistentStorage: {},
sessionStorage: {},
initializePlugins: function(pluginNames) {
var that = this;
... | define(
['jquery'], function(jquery) {
var jQuery = jquery;
return {
responsePlugins: [],
persistentStorage: {},
sessionStorage: {},
initializePlugins: function(pluginNames) {
var that = this;
// Walk through the list of plugins passed in and load it int... |
Fix memory cache lookup handling | <?php
namespace Addr;
class MemoryCache implements Cache
{
/**
* Mapped names stored in the cache
*
* @var array
*/
private $data = [
AddressModes::INET4_ADDR => [],
AddressModes::INET6_ADDR => [],
];
/**
* Look up an entry in the cache
*
* @param st... | <?php
namespace Addr;
class MemoryCache implements Cache
{
/**
* Mapped names stored in the cache
*
* @var array
*/
private $data = [
AddressModes::INET4_ADDR => [],
AddressModes::INET6_ADDR => [],
];
/**
* Look up an entry in the cache
*
* @param st... |
Add dismiss method for progress dialog on builder | package com.kogimobile.android.baselibrary.app.busevents;
/**
* @author Julian Cardona on 7/11/14.
*/
public class EventProgressDialog {
public static Builder getBuilder() {
return new Builder();
}
private boolean show = true;
private String progressDialogMessage = "";
private EventPro... | package com.kogimobile.android.baselibrary.app.busevents;
/**
* @author Julian Cardona on 7/11/14.
*/
public class EventProgressDialog {
public static Builder getBuilder() {
return new Builder();
}
private boolean show = false;
private String progressDialogMessage = "";
private EventPr... |
Set content type of api response to JSON. | var helpers = require('./helpers');
var db = helpers.db;
/* /users */
exports.getAllUsers = function(req, res) {
helpers.getRequestingUser(req, function(err, user) {
if ( err ) {
res.status(500).end();
console.log("getAllUsers:", err);
} else {
if ( !user ) {
res.status(... | var helpers = require('./helpers');
var db = helpers.db;
/* /users */
exports.getAllUsers = function(req, res) {
helpers.getRequestingUser(req, function(err, user) {
if ( err ) {
res.status(500).end();
console.log("getAllUsers:", err);
} else {
if ( !user ) {
res.status(... |
Change if...else statement to switch for better code organization | (function () {
angular
.module("ng-geocoder")
.factory("ngGeocoderService", ngGeocoderService);
ngGeocoderService.$inject = ["$q"];
function ngGeocoderService ($q) {
var geocoder = new google.maps.Geocoder();
var service = {
"geocodeById": geocodeById,
"geocodeByQuery": geocodeByQue... | (function () {
angular
.module("ng-geocoder")
.factory("ngGeocoderService", ngGeocoderService);
ngGeocoderService.$inject = ["$q"];
function ngGeocoderService ($q) {
var geocoder = new google.maps.Geocoder();
var service = {
"geocodeById": geocodeById,
"geocodeByQuery": geocodeByQue... |
Add valid http url validation | <?php
class BotController extends ControllerBase {
public function update( $boturl = '' ) {
require_once 'models/curl.php';
require_once 'models/grader/bot.php';
if ( empty( $boturl ) ) {
go( 'bot', 'update', [ 'boturl_empty' => true ] );
}
... | <?php
class BotController extends ControllerBase {
public function update( $boturl = '' ) {
require_once 'models/curl.php';
require_once 'models/grader/bot.php';
if ( empty( $boturl ) ) {
go( 'bot', 'update', [ 'boturl_empty' => true ] );
}
... |
Fix user picker search request
The users API controller expects the search params to be contains in a
`q` node. | $.fn.userAutocomplete = function () {
'use strict';
function formatUser(user) {
return Select2.util.escapeMarkup(user.email);
}
this.select2({
minimumInputLength: 1,
multiple: true,
initSelection: function (element, callback) {
Spree.ajax({
url: Spree.routes.users_api,
da... | $.fn.userAutocomplete = function () {
'use strict';
function formatUser(user) {
return Select2.util.escapeMarkup(user.email);
}
this.select2({
minimumInputLength: 1,
multiple: true,
initSelection: function (element, callback) {
Spree.ajax({
url: Spree.routes.users_api,
da... |
Remove other Google Analytics reference | // =============================================
//
// WWW.QUIS.CC
// ---------------------------------------------
//
// By Chris Hill-Scott, except where noted.
//
// =============================================
$(function() {
for (var module in QUIS) {
if (QUIS[module].init) QUIS[mo... | // =============================================
//
// WWW.QUIS.CC
// ---------------------------------------------
//
// By Chris Hill-Scott, except where noted.
//
// =============================================
$(function() {
for (var module in QUIS) {
if (QUIS[module].init) QUIS[mo... |
Fix lint build error from Fonts patch.
Reviewed at https://reviews.apache.org/r/63129/ | import React from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter as Router, Route } from 'react-router-dom';
import SchedulerClient from 'client/scheduler-client';
import Navigation from 'components/Navigation';
import Home from 'pages/Home';
import Instance from 'pages/Instance';
import Job from 'p... | import React from 'react';
import ReactDOM from 'react-dom';
import { BrowserRouter as Router, Route } from 'react-router-dom';
import SchedulerClient from 'client/scheduler-client';
import Navigation from 'components/Navigation';
import Home from 'pages/Home';
import Instance from 'pages/Instance';
import Job from 'p... |
[DEV] Return only "operators" without the leading `$` in order to make them less harmful if you want to log them or even store them in a database. | var mongoOperators = require('./operators');
var operatorRegEx = new RegExp(/(\$\w+)/g);
var replacer = '_';
var invalidReplaceChars = ['$'];
module.exports = {
checkStr: function checkStr (str) {
var strType = typeof str;
var injections = [];
var escaped;
if (strType === 'string') {
escaped =... | var mongoOperators = require('./operators');
var operatorRegEx = new RegExp(/(\$\w+)/g);
var replacer = '_';
var invalidReplaceChars = ['$'];
module.exports = {
checkStr: function checkStr (str) {
var strType = typeof str;
var injections = [];
var escaped;
if (strType === 'string') {
escaped =... |
Patch job scheduler avoiding possibilities for concurrent runs of the same | # -*- coding: UTF-8
# jobs/base
# *********
#
# Base class for implement the scheduled tasks
import sys
from twisted.internet import task
from twisted.python.failure import Failure
from globaleaks.utils.utility import log
from globaleaks.utils.mailutils import mail_exception
class GLJob(task.LoopingCall):
d... | # -*- coding: UTF-8
# jobs/base
# *********
#
# Base class for implement the scheduled tasks
import sys
from twisted.internet import task
from twisted.python.failure import Failure
from globaleaks.utils.utility import log
from globaleaks.utils.mailutils import mail_exception
class GLJob(task.LoopingCall):
d... |
Fix header in facilities view | (function (angular) {
"use strict";
angular.module("mfl.facilities.base", [
"ui.router"
])
.config(["$stateProvider", function ($stateProvider) {
$stateProvider
.state("facilities", {
url: "/facilities",
views: {
"main": {
... | (function (angular) {
"use strict";
angular.module("mfl.facilities.base", [
"ui.router"
])
.config(["$stateProvider", function ($stateProvider) {
$stateProvider
.state("facilities", {
url: "/facilities",
views: {
"main": {
... |
Add ability to delete earnings from earnings' index view | @extends('layout')
@section('title', __('general.earnings'))
@section('body')
<div class="wrapper my-3">
<h2>{{ __('general.earnings') }}</h2>
<div class="box mt-3">
@if (count($earnings))
@foreach ($earnings as $earning)
<div class="box__section row... | @extends('layout')
@section('title', __('general.earnings'))
@section('body')
<div class="wrapper my-3">
<h2>{{ __('general.earnings') }}</h2>
<div class="box mt-3">
@if (count($earnings))
@foreach ($earnings as $earning)
<div class="box__section row... |
Add key for elements rendered by map | import { View } from 'react-native';
import Button from '../Button';
import React, { Component, PropTypes } from 'react';
const propTypes = {
actions: PropTypes.array.isRequired,
onActionPress: PropTypes.func.isRequired,
};
const defaultStyles = {
dialogContainer: {
flexDirection: 'row',
},
... | import { View } from 'react-native';
import Button from '../Button';
import React, { Component, PropTypes } from 'react';
const propTypes = {
actions: PropTypes.array.isRequired,
onActionPress: PropTypes.func.isRequired,
};
const defaultStyles = {
dialogContainer: {
flexDirection: 'row',
},
... |
Add a watch grunt task to use karma's autoWatch | module.exports = function (grunt) {
'use strict';
var initConfig;
// Loading external tasks
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-karma');
// Project configuration.
initConfig = {
bower: 'bower_components',
pkg: grunt.... | module.exports = function (grunt) {
'use strict';
var initConfig;
// Loading external tasks
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-karma');
// Project configuration.
initConfig = {
bower: 'bower_components',
pkg: grunt.... |
Test fixed for CategoryService
Test updated for UrlObject after change | <?php
/*
* This file is part of the ONGR package.
*
* (c) NFQ Technologies UAB <info@nfq.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace ONGR\ContentBundle\Tests\Unit\Document;
use ONGR\ContentBundle\Document\UrlO... | <?php
/*
* This file is part of the ONGR package.
*
* (c) NFQ Technologies UAB <info@nfq.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace ONGR\ContentBundle\Tests\Unit\Document;
use ONGR\ContentBundle\Document\UrlO... |
Initialize bolt progress bar widget | /**
* Main mixin for the Bolt buic module.
*
* @mixin
* @namespace Bolt.buic
*
* @param {Object} bolt - The Bolt module.
* @param {Object} $ - jQuery.
*/
(function (bolt, $) {
'use strict';
/**
* Bolt.buic mixin container.
*
* @private
* @type {Object}
*/
var buic = {};
... | /**
* Main mixin for the Bolt buic module.
*
* @mixin
* @namespace Bolt.buic
*
* @param {Object} bolt - The Bolt module.
* @param {Object} $ - jQuery.
*/
(function (bolt, $) {
'use strict';
/**
* Bolt.buic mixin container.
*
* @private
* @type {Object}
*/
var buic = {};
... |
Fix bad initial count in slug creation helper | from django.db import IntegrityError
from django.template.defaultfilters import slugify
def save_obj_with_slug(obj, attribute='title', **kwargs):
obj.slug = slugify(getattr(obj, attribute))
return save_obj_unique(obj, 'slug', **kwargs)
def save_obj_unique(obj, attr, count=0, postfix_format='-{count}'):
... | from django.db import IntegrityError
from django.template.defaultfilters import slugify
def save_obj_with_slug(obj, attribute='title', **kwargs):
obj.slug = slugify(getattr(obj, attribute))
return save_obj_unique(obj, 'slug', **kwargs)
def save_obj_unique(obj, attr, count=0, postfix_format='-{count}'):
... |
Fix for reference line point projection | var cornerstoneTools = (function ($, cornerstone, cornerstoneTools) {
"use strict";
if(cornerstoneTools === undefined) {
cornerstoneTools = {};
}
if(cornerstoneTools.referenceLines === undefined) {
cornerstoneTools.referenceLines = {};
}
// projects a patient point to an image... | var cornerstoneTools = (function ($, cornerstone, cornerstoneTools) {
"use strict";
if(cornerstoneTools === undefined) {
cornerstoneTools = {};
}
if(cornerstoneTools.referenceLines === undefined) {
cornerstoneTools.referenceLines = {};
}
// projects a patient point to an image... |
Make compatible with Python <2.7
The argparse module was added in Python 2.7, but the Python bundled
with Inkscape is 2.6. Switching to optparse makes this extension
compatible with the Python bundled with Inkscape. | #!/usr/bin/env python
import csv
import optparse
import shutil
import subprocess
import sys
if __name__ == '__main__':
parser = optparse.OptionParser(description="Chain together Inkscape extensions",
usage="%prog [options] svgpath")
parser.add_option('--id', dest='ids', acti... | #!/usr/bin/env python
import argparse
import csv
import shutil
import subprocess
import sys
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="Chain together Inkscape extensions")
parser.add_argument('--id', type=str, action='append', dest='ids', default=[],
help=... |
Fix images not included in assets.json | var path = require('path'),
grunt = require('grunt');
module.exports = {
scripts: {
files: [{
'build/js/jquery.min.map': 'client/components/jquery/dist/jquery.min.map'
}]
},
images: {
files: [{
expand: true,
cwd: 'client/img',
src:... | var path = require('path'),
grunt = require('grunt');
module.exports = {
scripts: {
files: [{
'build/js/jquery.min.map': 'client/components/jquery/dist/jquery.min.map'
}]
},
images: {
files: [{
expand: true,
cwd: 'client/img',
src:... |
Make `grunt test` not invoke jenkins tests as well
This makes running tests directly on the commandline more responsive
since it isn't running the sets twice with less useful reporters the
second time. | module.exports = function(grunt){
'use strict';
require('load-grunt-tasks')(grunt);
grunt.loadNpmTasks('grunt-contrib-jshint');
var jsFiles = ['npactweb/static/js/**/*.js'];
grunt.initConfig({
jshint: {
options: {
jshintrc: true
},
all: jsFiles,
jenkins: {
files: {... | module.exports = function(grunt){
'use strict';
require('load-grunt-tasks')(grunt);
grunt.loadNpmTasks('grunt-contrib-jshint');
var jsFiles = ['npactweb/static/js/**/*.js'];
grunt.initConfig({
jshint: {
options: {
jshintrc: true
},
all: jsFiles,
jenkins: {
files: {... |
Extend display product details to show product number in the list | <?php
namespace App\Catalog\Category;
use Moltin\SDK\Facade\Moltin as Moltin;
use Moltin\SDK\Facade\Product as Product;
class CategoryList
{
/**
* @var \Psr\Http\Message\ResponseInterface
*/
private $response;
public function __invoke(
\Psr\Http\Message\ServerRequestInterface $request,... | <?php
namespace App\Catalog\Category;
use Moltin\SDK\Facade\Moltin as Moltin;
use Moltin\SDK\Facade\Product as Product;
class CategoryList
{
private $response;
public function __invoke(
\Psr\Http\Message\ServerRequestInterface $request,
\Psr\Http\Message\ResponseInterface $response
) {
... |
Fix augmented system form interface type selection | $(document).ready(function() {
var form = document.getElementById('inner-form');
var interface_type = document.getElementsByName('interface_type');
var static_form = document.getElementById('static-form');
var static_clone = static_form.cloneNode(true);
static_clone.id ="static_clone";
$(static_... | $(document).ready(function() {
var form = document.getElementById('inner-form');
var interface_type = document.getElementsByName('interface_type');
var static_form = document.getElementById('static-form');
var static_clone = static_form.cloneNode(true);
static_clone.id ="static_clone";
$(static_... |
Remove default locale for prefix_except_default strategy | <?php
namespace Umpirsky\I18nRoutingBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Processor;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjec... | <?php
namespace Umpirsky\I18nRoutingBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Processor;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjec... |
Return 404 if questionnaire does not exist | <?php
namespace Api\Controller;
use Zend\View\Model\JsonModel;
class QuestionController extends AbstractRestfulController
{
protected function getJsonConfig($questionnaire = null)
{
return array(
'name',
'category' => array(
'name',
'parent' =>... | <?php
namespace Api\Controller;
use Zend\View\Model\JsonModel;
class QuestionController extends AbstractRestfulController
{
protected function getJsonConfig($questionnaire = null)
{
return array(
'name',
'category' => array(
'name',
'parent' =>... |
Handle a zero result set for a query in the JSONResponseHandler
Turns out that when a query has no results the response document does
not have a key named after the object that contains an empty array. It
simply does not have the key. | <?php
namespace HGG\Pardot\ResponseHandler;
use HGG\Pardot\Exception\RuntimeException;
use HGG\Pardot\Exception\AuthenticationErrorException;
/**
* JsonResponseHandler
*
* @author Henning Glatter-Götz <henning@glatter-gotz.com>
*/
class JsonResponseHandler extends AbstractResponseHandler
{
/**
* parse
... | <?php
namespace HGG\Pardot\ResponseHandler;
use HGG\Pardot\Exception\RuntimeException;
use HGG\Pardot\Exception\AuthenticationErrorException;
/**
* JsonResponseHandler
*
* @author Henning Glatter-Götz <henning@glatter-gotz.com>
*/
class JsonResponseHandler extends AbstractResponseHandler
{
/**
* parse
... |
Make setup.py test honor migrations
Kudos to django-setuptest project | # This file mainly exists to allow python setup.py test to work.
import os
import sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'nodeconductor.server.test_settings'
test_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.dirname(__file__)), '..'))
sys.path.insert(0, test_dir)
from django.test.utils import get_ru... | # This file mainly exists to allow python setup.py test to work.
import os
import sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'nodeconductor.server.test_settings'
test_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.dirname(__file__)), '..'))
sys.path.insert(0, test_dir)
from django.test.utils import get_ru... |
Use one regex instead of 3 |
var http = require('http');
var cheerio = require('cheerio');
exports.translate = function(text, lang, trans, cb){
http.get('http://tyda.se/search/'+text+'?lang%5B0%5D='+lang+'&lang%5B1%5D='+trans, function(res){
var body = '';
res.on('data', function(d){
body+= d;
});
res.on('end'... |
var http = require('http');
var cheerio = require('cheerio');
exports.translate = function(text, lang, trans, cb){
http.get('http://tyda.se/search/'+text+'?lang%5B0%5D='+lang+'&lang%5B1%5D='+trans, function(res){
var body = '';
res.on('data', function(d){
body+= d;
});
res.on('end'... |
Make usage of parse_str() cleaner | <?php
/*
* This file is part of the Purl package, a project by Jonathan H. Wage.
*
* (c) 2013 Jonathan H. Wage
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Purl;
/**
* Query represents the part of a Url after the q... | <?php
/*
* This file is part of the Purl package, a project by Jonathan H. Wage.
*
* (c) 2013 Jonathan H. Wage
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Purl;
/**
* Query represents the part of a Url after the q... |
Revert "Made a sexist comment more PC."
This reverts commit 3632fc802ba9c537653e633b12d9430c7ed3f0b6. | # First bug quest tile.
from weatbag import words
import weatbag
class Tile:
def __init__(self):
self.bug_is_here = True
self.first_visit = True
self.hasnt_gone_south = True
pass
def describe(self):
print("There is a stream here. "
"It runs from South to Nor... | # First bug quest tile.
from weatbag import words
import weatbag
class Tile:
def __init__(self):
self.bug_is_here = True
self.first_visit = True
self.hasnt_gone_south = True
pass
def describe(self):
print("There is a stream here. "
"It runs from South to Nor... |
Remove usage of deprecated `Ember.keys` | import { beforeEach, afterEach, describe } from 'mocha';
import Ember from 'ember';
import { getContext } from 'ember-test-helpers';
export function createModule(Constructor, name, description, callbacks, tests, method) {
var module;
if (!tests) {
if (!callbacks) {
tests = description;
callbacks =... | import { beforeEach, afterEach, describe } from 'mocha';
import Ember from 'ember';
import { getContext } from 'ember-test-helpers';
export function createModule(Constructor, name, description, callbacks, tests, method) {
var module;
if (!tests) {
if (!callbacks) {
tests = description;
callbacks =... |
Fix Spring CORS Filter impl | package com.porterhead.filter.spring;
import com.porterhead.filter.BaseCORSFilter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jav... | package com.porterhead.filter.spring;
import com.porterhead.filter.BaseCORSFilter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jav... |
Load blog data from command line | from blogtrans.ui.MainWindow import *
import sys, traceback
import getopt
import wx
# Importers / Exporters
from blogtrans.wretch.WretchImporter import WretchImporter
from blogtrans.mt import *
from blogtrans.blogger.BloggerExporter import *
from blogtrans.blogger.BloggerImporter import *
def trap_error(func) :
... | from blogtrans.ui.MainWindow import *
import sys, traceback
import getopt
import wx
# Importers / Exporters
from blogtrans.wretch.WretchImporter import WretchImporter
from blogtrans.mt import *
from blogtrans.blogger.BloggerExporter import *
from blogtrans.blogger.BloggerImporter import *
def trap_error(func) :
... |
Simplify the code: while sorting the ends are placed before the starts |
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
public class CallAggregator {
private static class CallPart {
private long ts;
private boolean isStart;
public CallPart(long ts, boolean isStart) {
this.ts = ts;
this.isStart = isStar... |
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
public class CallAggregator {
private static class CallPart {
private long ts;
private boolean isStart;
public CallPart(long ts, boolean isStart) {
this.ts = ts;
this.isStart = isStar... |
Increase number of Kociemba test iterations to 100 | from src.Move import Move
from src.NaiveCube import NaiveCube
from src.Cubie import Cube
from src.Solver import Kociemba
import timeout_decorator
import unittest
class TestKociembaSolver(unittest.TestCase):
@timeout_decorator.timeout(300)
def _test_solution(self, c):
solver = Kociemba.KociembaSolver(c... | from src.Move import Move
from src.NaiveCube import NaiveCube
from src.Cubie import Cube
from src.Solver import Kociemba
import timeout_decorator
import unittest
class TestKociembaSolver(unittest.TestCase):
@timeout_decorator.timeout(300)
def _test_solution(self, c):
solver = Kociemba.KociembaSolver(c... |
Comment for info of save btn | package com.codemagic.powerhour;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;
public class Dashboard extends Activity {
Preferences myPrefs;
@Override
protected void onCreate(Bundle s... | package com.codemagic.powerhour;
import android.app.Activity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;
public class Dashboard extends Activity {
Preferences myPrefs;
@Override
protected void onCreate(Bundle s... |
Set data default to array | <?php
namespace Jenky\LaravelNotification\Providers;
use Jenky\LaravelNotification\Contracts\Provider as ProviderContract;
abstract class AbstractProvider implements ProviderContract
{
/**
* Config key
*
* @var string
*/
protected $config;
/**
* @var string
*/
pro... | <?php
namespace Jenky\LaravelNotification\Providers;
use Jenky\LaravelNotification\Contracts\Provider as ProviderContract;
abstract class AbstractProvider implements ProviderContract
{
/**
* Config key
*
* @var string
*/
protected $config;
/**
* @var string
*/
pro... |
FIX Remove some js references | <?php
/**
* @author marcus@silverstripe.com.au
* @license BSD License http://silverstripe.org/bsd-license/
*/
class SiteDashboardPage extends Page
{
}
class SiteDashboardPage_Controller extends DashboardController
{
private static $dependencies = array(
'dataService' => '%$DataService',
);
... | <?php
/**
* @author marcus@silverstripe.com.au
* @license BSD License http://silverstripe.org/bsd-license/
*/
class SiteDashboardPage extends Page
{
}
class SiteDashboardPage_Controller extends DashboardController
{
private static $dependencies = array(
'dataService' => '%$DataService',
);
... |
Fix parsing of fragments without HTML elements. | """Shared utility functions"""
from django.conf import settings
from django.template.defaultfilters import slugify as django_slugify
from django.utils.translation import ugettext_lazy as _
def get_language_name(language_code):
"""Convert a language code into its full (localized) name"""
languages = dict(setti... | """Shared utility functions"""
from django.conf import settings
from django.template.defaultfilters import slugify as django_slugify
from django.utils.translation import ugettext_lazy as _
def get_language_name(language_code):
"""Convert a language code into its full (localized) name"""
languages = dict(setti... |
Add convenience methods for creating/deleting all tables, for bootstrapping/testing use
Signed-off-by: Joonas Bergius <9be13466ab086d7a8db93edb14ffb6760790b15e@gmail.com> | from __future__ import unicode_literals
import os
import pdb
from sqlalchemy import create_engine, MetaData
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, scoped_session
class Model(object):
def __repr__(self):
cols = self.__mapper__.c.keys()
class... | from __future__ import unicode_literals
import os
import pdb
from sqlalchemy import create_engine, MetaData
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker, scoped_session
class Model(object):
def __repr__(self):
cols = self.__mapper__.c.keys()
class... |
Remove multiline for node users | const through = require('through2');
const path = require('path');
const util = require('util');
function injectReact() {
return '' +
';const scope = window.__hmr = (window.__hmr || {});' +
'(function() {' +
'if (typeof window === \'undefined\') return;' +
'if (!scope.initialized) {' +
'r... | const through = require('through2');
const path = require('path');
const util = require('util');
function injectReact() {
return `
;const scope = window.__hmr = (window.__hmr || {});
(function() {
if (typeof window === 'undefined') return;
if (!scope.initialized) {
require('browserify-re... |
Remove "utility.hmac.hmac_creation" which causes circular imports
Hacky but re-implement `hmac_creation` as `create_hmac` | """This module contains gn2 decorators"""
import hashlib
import hmac
from flask import current_app, g
from typing import Dict
from functools import wraps
import json
import requests
def create_hmac(data: str, secret: str) -> str:
return hmac.new(bytearray(secret, "latin-1"),
bytearray(data, "... | """This module contains gn2 decorators"""
from flask import g
from typing import Dict
from functools import wraps
from utility.hmac import hmac_creation
from utility.tools import GN_PROXY_URL
import json
import requests
def edit_access_required(f):
"""Use this for endpoints where admins are required"""
@wrap... |
Use INFOSYSTEM enviroment for Queue | import flask
from pika import BlockingConnection, PlainCredentials, ConnectionParameters
class RabbitMQ:
def __init__(self):
self.url = flask.current_app.config['INFOSYSTEM_QUEUE_URL']
self.port = flask.current_app.config['INFOSYSTEM_QUEUE_PORT']
self.virtual_host = \
flask.cu... | import flask
from pika import BlockingConnection, PlainCredentials, ConnectionParameters
class RabbitMQ:
def __init__(self):
self.url = flask.current_app.config['ORMENU_QUEUE_URL']
self.port = flask.current_app.config['ORMENU_QUEUE_PORT']
self.virtual_host = \
flask.current_ap... |
Update Complete checkpoint 7 Services Part 2 |
(function() {
function SongPlayer() {
var SongPlayer = {};
var currentSong = null;
var currentBuzzObject = null;
/**
* @function setSong
* @desc Stops currently playing song and loads new audio file as currentBuzzObject
* @param {Object} song
... |
(function() {
function SongPlayer() {
var SongPlayer = {};
var currentSong = null;
var currentBuzzObject = null;
var setSong = function(song) {
if (currentBuzzObject) {
currentBuzzObject.stop();
currentSong.playing = null... |
Fix ambiguity in field of worker | <?php
require_once '../svg.php';
include '../init.php';
if (isset($_GET['id'])) {
$sql = "SELECT `wm_workers`.`id` as `woker_id`, `user_id`, ".
"`worker_name`, `wm_workers`.`description`, `url`, ".
"`latest_heartbeat`, ".
"`display_name` ".
"FROM `wm_workers` ".
... | <?php
require_once '../svg.php';
include '../init.php';
if (isset($_GET['id'])) {
$sql = "SELECT `wm_workers`.`id` as `woker_id`, `user_id`, ".
"`worker_name`, `description`, `url`, `latest_heartbeat`, ".
"`display_name` ".
"FROM `wm_workers` ".
"JOIN `wm_users` ON `user... |
Make open_fred an optional dependency | import os
from setuptools import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name="feedinlib",
version="0.1.0rc3",
description="Creating time series from pv or wind power plants.",
url="http://github.com/oemof/feedinlib",
author="oemof dev... | import os
from setuptools import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name="feedinlib",
version="0.1.0rc3",
description="Creating time series from pv or wind power plants.",
url="http://github.com/oemof/feedinlib",
author="oemof dev... |
Remove unused "use statement" from the test | <?php
namespace Asmaster\EquipTwig\Tests;
use Asmaster\EquipTwig\TwigFormatter;
use Equip\Adr\PayloadInterface;
use PHPUnit_Framework_TestCase as TestCase;
use Twig_Environment as TwigEnvironment;
use Twig_Loader_Filesystem as TwigLoaderFilesystem;
class TwigFormatterTest extends TestCase
{
/**
* @var TwigF... | <?php
namespace Asmaster\EquipTwig\Tests;
use Asmaster\EquipTwig\TwigFormatter;
use Equip\Adr\PayloadInterface;
use Lukasoppermann\Httpstatus\Httpstatus;
use PHPUnit_Framework_TestCase as TestCase;
use Twig_Environment as TwigEnvironment;
use Twig_Loader_Filesystem as TwigLoaderFilesystem;
class TwigFormatterTest ex... |
Add add function taking a functor as input to process connected primitives | """@package Primitive
This module provides an abstraction of the relationGraph using networkX
"""
import networkx as nx
import packages.primitive as primitive
class RelationGraph(object):
def __init__(self,primArray, assignArray):
self.G=nx.Graph()
self.indexedPrimArray = {}
# Fi... | """@package Primitive
This module provides an abstraction of the relationGraph using networkX
"""
import networkx as nx
import packages.primitive as primitive
class RelationGraph(object):
def __init__(self,primArray, assignArray):
self.G=nx.Graph()
# First create the nodes
for p ... |
Update `git status` to use machine output -z. | /*jshint node: true */
var _ = require('underscore');
var _s = require('underscore.string');
var exec = require('shelljs').exec;
var fs = require('fs');
var cachedFileList;
module.exports = {
all: function() {
var list;
var response;
// Return cache if we have one
if (cachedFileL... | /*jshint node: true */
var _ = require('underscore');
var _s = require('underscore.string');
var exec = require('shelljs').exec;
var fs = require('fs');
var cachedFileList;
module.exports = {
all: function() {
var list;
var response;
// Return cache if we have one
if (cachedFileL... |
Make it compatible with old browsers | /* eslint-env amd */
(function (name, definition) {
if (typeof define === 'function') {
// AMD
define(definition)
} else if (typeof module !== 'undefined' && module.exports) {
// Node.js
module.exports = definition()
} else {
// Browser
window[name] = definition()
}
})('nullPrune', funct... | /* eslint-env amd */
(function (name, definition) {
if (typeof define === 'function') {
// AMD
define(definition)
} else if (typeof module !== 'undefined' && module.exports) {
// Node.js
module.exports = definition()
} else {
// Browser
window[name] = definition()
}
})('nullPrune', funct... |
Use location.pathname as a key for transition | import React from 'react';
import Transition from 'react-transition-group/CSSTransitionGroup';
import {
BrowserRouter as Router,
Route,
Switch,
} from 'react-router-dom';
import Header from './Header';
import HomePage from './HomePage';
import BlogPage from './BlogPage';
import PostContainer from './PostContainer... | import React from 'react';
import Transition from 'react-transition-group/CSSTransitionGroup';
import {
BrowserRouter as Router,
Route,
Switch,
} from 'react-router-dom';
import Header from './Header';
import HomePage from './HomePage';
import BlogPage from './BlogPage';
import PostContainer from './PostContainer... |
Fix call id parameter name | 'use strict';
/*
* Module for juggling call state.
*/
angular.module('call', [])
.factory('callFactory', function (apiFactory) {
var callStates = {
error: 'error',
not_answered: 'not_answered',
succeeded: 'succeeded'
};
var currentCallID = null;
var initiateCall = function ... | 'use strict';
/*
* Module for juggling call state.
*/
angular.module('call', [])
.factory('callFactory', function (apiFactory) {
var callStates = {
error: 'error',
not_answered: 'not_answered',
succeeded: 'succeeded'
};
var currentCallID = null;
var initiateCall = function ... |
Implement feedback from rhys' comments | /*
* Copyright (C) 2016 IBM Corp. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable l... | package com.cloudant.sync.query;
/**
* Created by tomblench on 28/09/2016.
*/
public class FieldSort {
public final String field;
public final Direction sort;
public FieldSort(String field) {
this.field = field;
this.sort = Direction.ASCENDING;
}
public FieldSort(String field,... |
Add checks against invalid search input | var minimatch = require('minimatch');
var is = require('annois');
var fp = require('annofp');
var zip = require('annozip');
module.exports = function(model, query, cb) {
if(!is.object(query) || fp.count(query) === 0) {
return is.fn(cb)? cb(null, model._data): query(null, model._data);
}
var fields... | var minimatch = require('minimatch');
var is = require('annois');
var fp = require('annofp');
var zip = require('annozip');
module.exports = function(model, query, cb) {
if(!is.object(query) || fp.count(query) === 0) {
return is.fn(cb)? cb(null, model._data): query(null, model._data);
}
var fields... |
Remove let until upstream Ember-CLI issue is fixed | /* jshint node: true */
'use strict';
var request = require('request');
var BasePlugin = require('ember-cli-deploy-plugin');
module.exports = {
name: 'ember-cli-deploy-cdnify-purge-cache',
createDeployPlugin: function(options) {
var DeployPlugin = BasePlugin.extend({
name: options.name,
requiredCo... | /* jshint node: true */
'use strict';
var request = require('request');
var BasePlugin = require('ember-cli-deploy-plugin');
module.exports = {
name: 'ember-cli-deploy-cdnify-purge-cache',
createDeployPlugin: function(options) {
var DeployPlugin = BasePlugin.extend({
name: options.name,
requiredCo... |
Add iscroll reference into the element in order to allow the element to manipulate if (for instance the refresh) NOT REALY NICE WAY DO TO THAT, BUT SIMPLE |
vinisketch.directive ('vsScrollable', function () {
return {
replace: false,
restrict: 'A',
link: function (scope, element, attr) {
// default options
var options = {
// scroll only vertically
scrollX: false,
scrollY: true,
// paint scrollbars
scroll... |
vinisketch.directive ('vsScrollable', function () {
return {
replace: false,
restrict: 'A',
link: function (scope, element, attr) {
// default options
var options = {
// scroll only vertically
scrollX: false,
scrollY: true,
// paint scrollbars
scroll... |
Write buyer ID when converting delivery logs. | package com.pinterest.secor.io.impl;
import com.pinterest.secor.common.SecorConfig;
import com.pinterest.secor.io.AdgearReader;
import com.pinterest.secor.io.KeyValue;
import net.minidev.json.JSONObject;
import net.minidev.json.JSONValue;
// Converts delivery JSON to Beh TSV
public class AdgearDeliveryJsonReader imp... | package com.pinterest.secor.io.impl;
import com.pinterest.secor.common.SecorConfig;
import com.pinterest.secor.io.AdgearReader;
import com.pinterest.secor.io.KeyValue;
import net.minidev.json.JSONObject;
import net.minidev.json.JSONValue;
// Converts delivery JSON to Beh TSV
public class AdgearDeliveryJsonReader imp... |
Handle SystemExit errors and add exit_code | # -*- coding: utf-8 -*-
import pytest
from cookiecutter.main import cookiecutter
class Cookies(object):
"""Class to provide convenient access to the cookiecutter API."""
exception = None
exit_code = 0
project = None
def __init__(self, template, output_dir):
self._template = template
... | # -*- coding: utf-8 -*-
import pytest
from cookiecutter.main import cookiecutter
class Cookies(object):
"""Class to provide convenient access to the cookiecutter API."""
error = None
project = None
def __init__(self, template, output_dir):
self._template = template
self._output_dir ... |
Add name function in query | const express = require('express')
const router = express.Router()
const models = require('../models')
const response = require('./response')
router.post('/', function (req, res) {
const team = req.body
response.create(res, models.Team.create(
team, {
include: [{
model: models.Player,
as:... | const express = require('express')
const router = express.Router()
const models = require('../models')
const response = require('./response')
router.post('/', function (req, res) {
const team = req.body
response.create(res, models.Team.create(
team, {
include: [{
model: models.Player,
as:... |
Use stricter regex to validate date in DDMMYY | package seedu.utask.model.task;
import seedu.address.commons.exceptions.IllegalValueException;
/**
* Represents a Person's phone number in the address book.
* Guarantees: immutable; is valid as declared in {@link #isValidDeadline(String)}
*/
public class Deadline {
public static final String MESSAGE_DEADLINE_... | package seedu.utask.model.task;
import seedu.address.commons.exceptions.IllegalValueException;
/**
* Represents a Person's phone number in the address book.
* Guarantees: immutable; is valid as declared in {@link #isValidDeadline(String)}
*/
public class Deadline {
public static final String MESSAGE_DEADLINE_... |
Add logging for docker debugging | let config = {
"url": process.env.CRN_SERVER_URL,
"port": 8111,
"location": process.env.CRN_SERVER_LOCATION,
"headers": {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET, POST, OPTIONS, PUT, PATCH, DELETE",
"Access-Control-Allow-Headers": "content-type, A... | export default {
"url": process.env.CRN_SERVER_URL,
"port": 8111,
"location": process.env.CRN_SERVER_LOCATION,
"headers": {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET, POST, OPTIONS, PUT, PATCH, DELETE",
"Access-Control-Allow-Headers": "content-type,... |
Make sure the returned results will contained LinkedIn count | /*
* Ping test suite
*/
var
vows = require('vows'),
assert = require('assert');
var
quero = {},
urls = [
'http://google.com',
'http://facebook.com',
'http://odesk.com',
'http://elance.com',
'http://parse.com',
'http://github.com',
'http://nodejs.org',
'http://npmjs.org'
];
function checkQue... | /*
* Ping test suite
*/
var
vows = require('vows'),
assert = require('assert');
var
quero = {},
urls = [
'http://google.com',
'http://facebook.com',
'http://odesk.com',
'http://elance.com',
'http://parse.com',
'http://github.com',
'http://nodejs.org',
'http://npmjs.org'
];
function checkQue... |
Remove unneeded initialization of gMap | /**
* @fileoverview Define the map component of the map module.
*/
'use strict';
angular.module('map').component('mapComponent', {
templateUrl: 'map/map.template.html',
controller: function($scope) {
//Define some hard-coded markers to be shown on the map
$scope.markers = [{
city... | /**
* @fileoverview Define the map component of the map module.
*/
'use strict';
angular.module('map').component('mapComponent', {
templateUrl: 'map/map.template.html',
controller: function($scope) {
//Define some hard-coded markers to be shown on the map
$scope.markers = [{
city... |
Fix basic methods not assgin into vm | import pluck from './pluck';
import {
ref,
refs,
noop,
mixin,
insertCss,
emptyTemplate,
computedAll,
pureComputedAll
} from '../util/';
const modulePolyfill = {
constructor: noop,
defaults: {},
template: emptyTemplate
};
// Transform transiton component module to native com... | import pluck from './pluck';
import {
ref,
refs,
noop,
mixin,
insertCss,
emptyTemplate,
computedAll,
pureComputedAll
} from '../util/';
const modulePolyfill = {
constructor: noop,
defaults: {},
template: emptyTemplate
};
// Transform transiton component module to native com... |
Remove @package & restart travis | <?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
namespace ... | <?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Z... |
Use import instead of require | /** @babel */
import {Disposable, CompositeDisposable} from 'atom'
const ViewURI = 'atom://deprecation-cop'
let DeprecationCopView
class DeprecationCopPackage {
activate () {
this.disposables = new CompositeDisposable()
this.disposables.add(atom.workspace.addOpener((uri) => {
if (uri === ViewURI) {
... | /** @babel */
const {Disposable, CompositeDisposable} = require('atom')
const ViewURI = 'atom://deprecation-cop'
let DeprecationCopView
class DeprecationCopPackage {
activate () {
this.disposables = new CompositeDisposable()
this.disposables.add(atom.workspace.addOpener((uri) => {
if (uri === ViewURI)... |
Copy application specific cordova config.xml on build. | #!/usr/bin/env node
var cordova = require(process.env.framework + '/bin/cli-cordova');
var global = require(process.env.framework + '/bin/cli-global');
var shell = require('shelljs');
module.exports = {
/**
* @method build
*/
build: function() {
if (this.isInstalled()) {
cordova.... | #!/usr/bin/env node
var cordova = require(process.env.framework + '/bin/cli-cordova');
var global = require(process.env.framework + '/bin/cli-global');
var shell = require('shelljs');
module.exports = {
/**
* @method build
*/
build: function() {
if (this.isInstalled()) {
cordova.... |
Use seed as the js interpreter. | import subprocess
from distutils.core import setup
from distutils.command.sdist import sdist
class SignedSDistCommand(sdist):
"""Sign the source archive with a detached signature."""
description = "Sign the source archive after it is generated."
def run(self):
sdist.run(self)
gpg_args =... | import subprocess
from distutils.core import setup
from distutils.command.sdist import sdist
class SignedSDistCommand(sdist):
"""Sign the source archive with a detached signature."""
description = "Sign the source archive after it is generated."
def run(self):
sdist.run(self)
gpg_args =... |
Put URL config option on the disk to make it obvious how to customize. | <?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. T... | <?php
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. T... |
Remove unused parameter in no-op closure | <?php
namespace League\Tactician;
use League\Tactician\Exception\InvalidCommandException;
use League\Tactician\Exception\InvalidMiddlewareException;
/**
* Receives a command and sends it through a chain of middleware for processing.
*
* @final
*/
class CommandBus
{
/**
* @var callable
*/
privat... | <?php
namespace League\Tactician;
use League\Tactician\Exception\InvalidCommandException;
use League\Tactician\Exception\InvalidMiddlewareException;
/**
* Receives a command and sends it through a chain of middleware for processing.
*
* @final
*/
class CommandBus
{
/**
* @var callable
*/
privat... |
Add limit (relevant for gods) | // Module Route(s)
DevAAC.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/highscores', {
// When a module contains multiple routes, use 'moduleName/viewName' in PageUrl function.
templateUrl: PageUrl('highscores'),
controller: 'HighscoresController',
resolve: ... | // Module Route(s)
DevAAC.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/highscores', {
// When a module contains multiple routes, use 'moduleName/viewName' in PageUrl function.
templateUrl: PageUrl('highscores'),
controller: 'HighscoresController',
resolve: ... |
Fix bug in chain creation | # -*- coding: utf-8 -*-
from pollirio.reactors import expose
from pollirio import conf, choose_dest
import random
def create_chains(lines):
markov_chain = {}
has_prev = False
for line in lines:
for cur_word in line.split():
if cur_word != '':
cur_word = cur_word.lower(... | # -*- coding: utf-8 -*-
from pollirio.reactors import expose
from pollirio import conf, choose_dest
import random
def create_chains(lines):
markov_chain = {}
hasPrev = False
for line in lines:
for curword in line.split():
if curword != '':
curword = curword.lower()
... |
Make test stricter to be safe. | import copy
import pytest
from ..core import Document, NotMutable
def test_immutable():
d = Document({'a': 1})
with pytest.raises(NotMutable):
# Update existing key
d['a'] = 2
with pytest.raises(NotMutable):
# Add new key
d['b'] = 2
with pytest.raises(NotMutable):
... | import copy
import pytest
from ..core import Document, NotMutable
def test_immutable():
d = Document({'a': 1})
with pytest.raises(NotMutable):
# Update existing key
d['a'] = 2
with pytest.raises(NotMutable):
# Add new key
d['b'] = 2
with pytest.raises(NotMutable):
... |
Fix bug in hasNext when no result for a key is returned | /**
* This class will instill 'normal' iterator behavior to a ColumnFamilyResult.
* Simply instantiate this class while passing your ColumnFamilyResult as a
* constructor argument.
*
* Ex.
*
* ColumnFamilyResultIterator myResultsInterator =
* new ColumnFamilyResultIterator(someColumnFamilyResult);
*
... | /**
* This class will instill 'normal' iterator behavior to a ColumnFamilyResult.
* Simply instantiate this class while passing your ColumnFamilyResult as a
* constructor argument.
*
* Ex.
*
* ColumnFamilyResultIterator myResultsInterator =
* new ColumnFamilyResultIterator(someColumnFamilyResult);
*
... |
REmove python 3 (not ready yet) | #!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.md') as readme_file:
readme = readme_file.read()
with open('HISTORY.md') as history_file:
history = history_file.read().replace('.. :changelog:', ''... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('README.md') as readme_file:
readme = readme_file.read()
with open('HISTORY.md') as history_file:
history = history_file.read().replace('.. :changelog:', ''... |
Add logging for health check | from django.core.management.base import BaseCommand, CommandError
import time
from django_celery_beat.models import PeriodicTask
from django.utils import timezone
from datetime import timedelta
from atlas.prodtask.views import send_alarm_message
class Command(BaseCommand):
args = 'None'
help = 'Check celery... | from django.core.management.base import BaseCommand, CommandError
import time
from django_celery_beat.models import PeriodicTask
from django.utils import timezone
from datetime import timedelta
from atlas.prodtask.views import send_alarm_message
class Command(BaseCommand):
args = 'None'
help = 'Check celery... |
Allow username, password and scheme for solr | <?php
/*
* This file is part of the Integrated package.
*
* (c) e-Active B.V. <integrated@e-active.nl>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Integrated\Bundle\SolrBundle\DependencyInjection;
use Symfony\Component\Co... | <?php
/*
* This file is part of the Integrated package.
*
* (c) e-Active B.V. <integrated@e-active.nl>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Integrated\Bundle\SolrBundle\DependencyInjection;
use Symfony\Component\Co... |
_BaseEnumField: Make run_validators method a no-op
See the comment in this commit-- I can't see value in allowing custom
validators on EnumFields and the implementation in the superclass causes
warnings in RichEnum.__eq__.
Arguably those warnings aren't useful (warning against []/falsy compare).
In that case, we can ... | from abc import ABCMeta
from abc import abstractmethod
from django import forms
class _BaseEnumField(forms.TypedChoiceField):
__metaclass__ = ABCMeta
def __init__(self, enum, *args, **kwargs):
self.enum = enum
kwargs.setdefault('empty_value', None)
if 'choices' in kwargs:
... | from abc import ABCMeta
from abc import abstractmethod
from django import forms
class _BaseEnumField(forms.TypedChoiceField):
__metaclass__ = ABCMeta
def __init__(self, enum, *args, **kwargs):
self.enum = enum
kwargs.setdefault('empty_value', None)
if 'choices' in kwargs:
... |
Fix the MySQL issue with not nullable timestamp | <?php
use Arcanesoft\Blog\Bases\Migration;
use Illuminate\Database\Schema\Blueprint;
/**
* Class CreateBlogPostsTable
*
* @author ARCANEDEV <arcanedev.maroc@gmail.com>
*
* @see \Arcanesoft\Blog\Models\Post
*/
class CreateBlogPostsTable extends Migration
{
/* -------------------------------------------... | <?php
use Arcanesoft\Blog\Bases\Migration;
use Illuminate\Database\Schema\Blueprint;
/**
* Class CreateBlogPostsTable
*
* @author ARCANEDEV <arcanedev.maroc@gmail.com>
*
* @see \Arcanesoft\Blog\Models\Post
*/
class CreateBlogPostsTable extends Migration
{
/* -------------------------------------------... |
Add missing slash so that Forward config error is rendered properly
Closes centerforopenscience/openscienceframework.org#941 | # -*- coding: utf-8 -*-
"""Forward addon routes."""
from framework.routing import Rule, json_renderer
from website.routes import OsfWebRenderer
from website.addons.forward import views
api_routes = {
'rules': [
Rule(
[
'/project/<pid>/forward/config/',
'/proje... | # -*- coding: utf-8 -*-
"""Forward addon routes."""
from framework.routing import Rule, json_renderer
from website.routes import OsfWebRenderer
from website.addons.forward import views
api_routes = {
'rules': [
Rule(
[
'/project/<pid>/forward/config/',
'/proje... |
Fix a typo setting the port | const
express = require('express'),
bodyParser = require('body-parser');
const
{mongoose} = require('./db/mongoose'),
dbHandler = require('./db/dbHandler');
let app = express();
let port = process.env.PORT || 3000;
app.use(bodyParser.json());
app.route('/todos')
.get((req, res) => {
dbHandler.findTodo... | const
express = require('express'),
bodyParser = require('body-parser');
const
{mongoose} = require('./db/mongoose'),
dbHandler = require('./db/dbHandler');
let app = express();
let port = porcess.env.PORT || 3000;
app.use(bodyParser.json());
app.route('/todos')
.get((req, res) => {
dbHandler.findTodo... |
Add tests for admin client models | /* global ic */
var ajax = function () {
return ic.ajax.request.apply(null, arguments);
};
// Used in API request fail handlers to parse a standard api error
// response json for the message to display
function getRequestErrorMessage(request, performConcat) {
var message,
msgDetail;
// Can't real... | /* global ic */
var ajax = window.ajax = function () {
return ic.ajax.request.apply(null, arguments);
};
// Used in API request fail handlers to parse a standard api error
// response json for the message to display
function getRequestErrorMessage(request, performConcat) {
var message,
msgDetail;
... |
Set minimum pyop version to v3.4.0 to ensure the needed methods are available
Signed-off-by: Ivan Kanakarakis <f60d6943d72436645c4304926eeeac2718a1142c@gmail.com> | """
setup.py
"""
from setuptools import setup, find_packages
setup(
name='SATOSA',
version='8.1.0',
description='Protocol proxy (SAML/OIDC).',
author='DIRG',
author_email='satosa-dev@lists.sunet.se',
license='Apache 2.0',
url='https://github.com/SUNET/SATOSA',
packages=find_packages('s... | """
setup.py
"""
from setuptools import setup, find_packages
setup(
name='SATOSA',
version='8.1.0',
description='Protocol proxy (SAML/OIDC).',
author='DIRG',
author_email='satosa-dev@lists.sunet.se',
license='Apache 2.0',
url='https://github.com/SUNET/SATOSA',
packages=find_packages('s... |
Fix vertical scrolling on race details activity on older devices
When the Google Maps workaround is needed on older devices, the
vertical scrolling was also inadvertently disabled.
Signed-off-by: Greg Meiste <8a8f45e57c045ec63dc7e56e5eda862ea8c7cd4f@gmail.com> | /*
* Copyright (C) 2014-2015 Gregory S. Meiste <http://gregmeiste.com>
*
* 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... | /*
* Copyright (C) 2014 Gregory S. Meiste <http://gregmeiste.com>
*
* 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 requ... |
Add missing argument specification for cwd argument. | import os
import sys
from boto.utils import ShellCommand, get_ts
import boto
import boto.utils
class ScriptBase:
def __init__(self, config_file=None):
self.instance_id = boto.config.get('Instance', 'instance-id', 'default')
self.name = self.__class__.__name__
self.ts = get_ts()
if ... | import os
import sys
from boto.utils import ShellCommand, get_ts
import boto
import boto.utils
class ScriptBase:
def __init__(self, config_file=None):
self.instance_id = boto.config.get('Instance', 'instance-id', 'default')
self.name = self.__class__.__name__
self.ts = get_ts()
if ... |
Use print() function to fix install on python 3
clint 0.3.2 can't be installed on python 3.3 because of a print statement. | # -*- coding: utf8 -*-
"""
clint.textui.prompt
~~~~~~~~~~~~~~~~~~~
Module for simple interactive prompts handling
"""
from __future__ import absolute_import, print_function
from re import match, I
def yn(prompt, default='y', batch=False):
# A sanity check against default value
# If not y/n then y is assum... | # -*- coding: utf8 -*-
"""
clint.textui.prompt
~~~~~~~~~~~~~~~~~~~
Module for simple interactive prompts handling
"""
from __future__ import absolute_import
from re import match, I
def yn(prompt, default='y', batch=False):
# A sanity check against default value
# If not y/n then y is assumed
if defau... |
Fix bew 'No info available' | # -*- coding: utf-8 -*-
__author__ = 'nickl-'
from aero.__version__ import __version__
from .base import BaseAdapter
class Brew(BaseAdapter):
"""
Homebrew adapter.
"""
adapter_command = 'brew'
def search(self, query):
response = self._execute_command(self.adapter_command, ['search', quer... | # -*- coding: utf-8 -*-
__author__ = 'nickl-'
from aero.__version__ import __version__
from .base import BaseAdapter
class Brew(BaseAdapter):
"""
Homebrew adapter.
"""
adapter_command = 'brew'
def search(self, query):
response = self._execute_command(self.adapter_command, ['search', quer... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.