text
stringlengths
16
4.96k
positive
stringlengths
321
2.24k
negative
stringlengths
310
2.21k
Change extended ASCII character in docstring Fix a – and replace it with a -
"""foo.py - a simple demo of importing a calss from C++""" import ctypes lib = ctypes.cdll.LoadLibrary('./libfoo.so') class Foo(object): """The Foo class supports two methods, bar, and foobar...""" def __init__(self, val): lib.Foo_new.argtypes = [ctypes.c_int] lib.Foo_new.restype = ctypes.c_vo...
"""foo.py – a simple demo of importing a calss from C++""" import ctypes lib = ctypes.cdll.LoadLibrary('./libfoo.so') class Foo(object): """The Foo class supports two methods, bar, and foobar...""" def __init__(self, val): lib.Foo_new.argtypes = [ctypes.c_int] lib.Foo_new.restype = ctypes.c_vo...
Change the energy creator container
package info.u_team.u_team_test.init; import info.u_team.u_team_core.containertype.UContainerType; import info.u_team.u_team_test.TestMod; import info.u_team.u_team_test.container.*; import net.minecraft.inventory.container.ContainerType; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml....
package info.u_team.u_team_test.init; import info.u_team.u_team_core.containertype.UContainerType; import info.u_team.u_team_test.TestMod; import info.u_team.u_team_test.container.*; import net.minecraft.inventory.container.ContainerType; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml....
Fix didTransition deprecation on Ember 3.6+
import { VERSION } from '@ember/version'; // Taken from ember-test-helpers function hasEmberVersion(major, minor) { const numbers = VERSION.split('-')[0].split('.'); const actualMajor = parseInt(numbers[0], 10); const actualMinor = parseInt(numbers[1], 10); return actualMajor > major || (actualMajor === major ...
export function initialize(appInstance) { // Support Ember 1.13+ const owner = appInstance.lookup ? appInstance : appInstance.container; const router = owner.lookup('router:main'); const segment = owner.lookup('service:segment'); router.on('didTransition', function() { const applicationRoute = owner.loo...
Add lang property to the html tag
import React, { PropTypes } from 'react' export default class Html extends React.Component { render ({ children, assets, title } = this.props) { return ( <html lang='en'> <head> <title>{title}</title> <meta name='viewport' content='width=device-width, initial-scale=1' /> ...
import React, { PropTypes } from 'react' export default class Html extends React.Component { render ({ children, assets, title } = this.props) { return ( <html> <head> <title>{title}</title> <meta name='viewport' content='width=device-width, initial-scale=1' /> <link t...
Change to open proto file from testdata
package generator import ( "fmt" "os" "testing" "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" "github.com/google/go-cmp/cmp" ) func TestGenerator_GenerateAllFiles(t *testing.T) { type fields struct { } tests := []struct { name string fields fields want ...
package generator import ( "io" "reflect" "testing" "github.com/golang/protobuf/proto" plugin "github.com/golang/protobuf/protoc-gen-go/plugin" ) func TestGenerator_GenerateAllFiles(t *testing.T) { type fields struct { w io.Writer } tests := []struct { name string fields fields want *plugin.CodeG...
Fix argument double encoding for HttpHead To follow #157 that fixed double encoding on file download
/** * A HTTP plugin for Cordova / Phonegap */ package com.synconset.cordovahttp; import java.net.SocketTimeoutException; import java.net.UnknownHostException; import javax.net.ssl.SSLHandshakeException; import org.apache.cordova.CallbackContext; import org.json.JSONException; import org.json.JSONObject; import co...
/** * A HTTP plugin for Cordova / Phonegap */ package com.synconset.cordovahttp; import java.net.SocketTimeoutException; import java.net.UnknownHostException; import javax.net.ssl.SSLHandshakeException; import org.apache.cordova.CallbackContext; import org.json.JSONException; import org.json.JSONObject; import co...
Rename 'pwd' field in windows shadow.info output This makes the field name consistent with the other shadow modules. Note that the passwd field is not used at all in Windows user management, so this is merely a cosmetic change.
''' Manage the shadow file ''' import salt.utils def __virtual__(): ''' Only works on Windows systems ''' if salt.utils.is_windows(): return 'shadow' return False def info(name): ''' Return information for the specified user This is just returns dummy data so that salt state...
''' Manage the shadow file ''' import salt.utils def __virtual__(): ''' Only works on Windows systems ''' if salt.utils.is_windows(): return 'shadow' return False def info(name): ''' Return information for the specified user This is just returns dummy data so that salt state...
Fix type issue between Application and Container ResourceFactory should take a Container, not an Application.
<?php namespace JDesrosiers\Resourceful\ResourcefulServiceProvider; use Pimple\Container; use Silex\Application; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; class ResourcesFactory { private $app; public function __construct(Container $app) { $this...
<?php namespace JDesrosiers\Resourceful\ResourcefulServiceProvider; use Silex\Application; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; class ResourcesFactory { private $app; public function __construct(Application $app) { $this->app = $app; } ...
Fix data handler first position crash
/* * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.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 required b...
/* * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.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 required b...
Change order that fields are updated
package io.undertow.server.handlers; import java.util.Date; import io.undertow.server.HttpHandler; import io.undertow.server.HttpServerExchange; import io.undertow.util.DateUtils; import io.undertow.util.Headers; /** * Class that adds the Date: header to a HTTP response. * * The current date string is cached, and...
package io.undertow.server.handlers; import java.util.Date; import io.undertow.server.HttpHandler; import io.undertow.server.HttpServerExchange; import io.undertow.util.DateUtils; import io.undertow.util.Headers; /** * Class that adds the Date: header to a HTTP response. * * The current date string is cached, and...
Change how PSNR is computed
import keras.backend as K import numpy as np def psnr(y_true, y_pred): """Peak signal-to-noise ratio averaged over samples.""" mse = K.mean(K.square(y_true - y_pred), axis=(-3, -2, -1)) return K.mean(20 * K.log(255 / K.sqrt(mse)) / np.log(10)) def ssim(y_true, y_pred): """structural similarity measu...
import keras.backend as K import numpy as np def psnr(y_true, y_pred): """Peak signal-to-noise ratio averaged over samples and channels.""" mse = K.mean(K.square(y_true - y_pred), axis=(1, 2)) return K.mean(20 * K.log(255 / K.sqrt(mse)) / np.log(10)) def ssim(y_true, y_pred): """structural similarit...
Add FT to test if angular is loaded
# -*- coding: utf-8 -*- import unittest from .base import FunctionalTestCase from .pages import game class HomePageTest(FunctionalTestCase): @unittest.skip def test_create_game(self): # Alice is a user who visits the website self.browser.get(self.live_server_url) # She sees that the tit...
# -*- coding: utf-8 -*- from .base import FunctionalTestCase from .pages import game class HomePageTest(FunctionalTestCase): def test_create_game(self): # Alice is a user who visits the website self.browser.get(self.live_server_url) # She sees that the title of the browser contains '18xx Ac...
Create a Serializer in the Constructor of Persistent Drivers Rather than creating it on demand (which is not as intuitive).
<?php /** * This file is part of PMG\Queue * * Copyright (c) PMG <https://www.pmg.com> * * For full copyright information see the LICENSE file distributed * with this source code. * * @license http://opensource.org/licenses/Apache-2.0 Apache-2.0 */ namespace PMG\Queue\Driver; use PMG\Queue\Envelope; use ...
<?php /** * This file is part of PMG\Queue * * Copyright (c) PMG <https://www.pmg.com> * * For full copyright information see the LICENSE file distributed * with this source code. * * @license http://opensource.org/licenses/Apache-2.0 Apache-2.0 */ namespace PMG\Queue\Driver; use PMG\Queue\Envelope; use ...
:bug: Use binary system instead of decimal for size error
export function isImage(file) { if (file.type.split('/')[0] === 'image') { return true; } } export function convertBytesToMbsOrKbs(filesize) { let size = ''; if (filesize >= 1048576) { size = (filesize / 1048576) + ' megabytes'; } else if (filesize >= 1024) { size = (filesiz...
export function isImage(file) { if (file.type.split('/')[0] === 'image') { return true; } } export function convertBytesToMbsOrKbs(filesize) { let size = ''; // I know, not technically correct... if (filesize >= 1000000) { size = (filesize / 1000000) + ' megabytes'; } else if (f...
Fix no default; .controller is r/o
"use strict"; import Controller from "./Controller"; import View from "./View"; // private properties const _controller = Symbol(); export default class ViewController extends View { constructor(options = {}) { super(options); let {view} = options; this[_controller] = new Controller(optio...
"use strict"; import Controller from "./Controller"; import View from "./View"; // private properties const _controller = Symbol(); export default class ViewController extends View { constructor(options) { super(options); let {view} = options; this[_controller] = new Controller(options); ...
Simplify datasets functions a bit
"""Downloads the FITS files that are used in image testing and for building documentation. """ from astropy.utils.data import download_file from astropy.io import fits URL = 'http://astrofrog.github.io/wcsaxes-datasets/' def get_hdu(filename, cache=True): path = download_file(URL + filename, cache=cache) re...
"""Downloads the FITS files that are used in image testing and for building documentation. """ from astropy.utils.data import download_file from astropy.io import fits def msx_hdu(cache=True): filename = download_file("http://astrofrog.github.io/wcsaxes-datasets/msx.fits", cache=cache) return fits.open(fil...
Bug: Make fullmatch work on python 2.7.
try: from io import StringIO except ImportError: from StringIO import StringIO try: from contextlib import redirect_stdout except ImportError: import sys import contextlib @contextlib.contextmanager def redirect_stdout(target): original = sys.stdout sys.stdout = target ...
try: from io import StringIO except ImportError: from StringIO import StringIO try: from contextlib import redirect_stdout except ImportError: import sys import contextlib @contextlib.contextmanager def redirect_stdout(target): original = sys.stdout sys.stdout = target ...
Change title of meta transactions page in docs sidebar
#!/usr/bin/env node const path = require('path'); const proc = require('child_process'); const startCase = require('lodash.startcase'); const baseDir = process.argv[2]; const files = proc.execFileSync( 'find', [baseDir, '-type', 'f'], { encoding: 'utf8' }, ).split('\n').filter(s => s !== ''); console.log('.API');...
#!/usr/bin/env node const path = require('path'); const proc = require('child_process'); const startCase = require('lodash.startcase'); const baseDir = process.argv[2]; const files = proc.execFileSync( 'find', [baseDir, '-type', 'f'], { encoding: 'utf8' }, ).split('\n').filter(s => s !== ''); console.log('.API');...
Add strict mode to support generation script
'use strict' var fs = require('fs'), words = require('./'); fs.writeFileSync('Supported-words.md', 'Supported Words:\n' + '=================\n' + '\n' + '| word | polarity | valence |\n' + '|:----:|:--------:|:-------:|\n' + Object.keys(words).map(function (word) { var valence = w...
var fs = require('fs'), words = require('./'); fs.writeFileSync('Supported-words.md', 'Supported Words:\n' + '=================\n' + '\n' + '| word | polarity | valence |\n' + '|:----:|:--------:|:-------:|\n' + Object.keys(words).map(function (word) { var valence = words[word]; ...
Add query param support for getAll users request
<?php namespace RIPS\Connector\Requests; class UserRequests extends BaseRequest { // @var string protected $uri = '/users'; /** * Get all users * * @param array $queryParams * @return array */ public function getAll(array $queryParams) { $response = $this->client-...
<?php namespace RIPS\Connector\Requests; class UserRequests extends BaseRequest { // @var string protected $uri = '/users'; /** * Get all users * * @return array */ public function getAll() { $response = $this->client->get($this->uri); return $this->handleResp...
Move process event listeners to top. Add 'exit' listener.
'use strict'; process.on('SIGINT', function() { logger.notice('SIGINT received. Express server shutting down'); process.exit(); }); process.on('exit', function(code){ logger.warn('Node.js server exiting with error code: ' + code); }); var express = require('express'), bodyParser = require('body-parser'), cooki...
'use strict'; var express = require('express'), bodyParser = require('body-parser'), cookieParser = require('cookie-parser'), timeout = require('connect-timeout'), port = process.env.PORT || 3000, constants = require('./app/config/constants'), config = require('./app/config/config'), middleware = require('./app...
Fix read the docs url.
#! /usr/bin/env python # encoding: utf-8 try: from setuptools import setup except ImportError: from distutils.core import setup REQUIREMENTS = [i.strip() for i in open("requirements.txt").readlines()] setup( name='pagseguro-sdk', version="0.1.0", description='SDK para utilização do PagSeguro em ...
#! /usr/bin/env python # encoding: utf-8 try: from setuptools import setup except ImportError: from distutils.core import setup REQUIREMENTS = [i.strip() for i in open("requirements.txt").readlines()] setup( name='pagseguro-sdk', version="0.1.0", description='SDK para utilização do PagSeguro em ...
Add check to print_layer_shapes to fail explicitely on model used connected to other models.
from __future__ import print_function import numpy as np import theano def print_layer_shapes(model, input_shape): """ Utility function that prints the shape of the output at each layer. Arguments: model: An instance of models.Model input_shape: The shape of the input you will provide to ...
from __future__ import print_function import numpy as np import theano def print_layer_shapes(model, input_shape): """ Utility function that prints the shape of the output at each layer. Arguments: model: An instance of models.Model input_shape: The shape of the input you will provide to ...
Add ball speed and change move function
var canvas = document.getElementById('game'); var context = canvas.getContext('2d'); var Ball = function(x, y, radius, context) { this.x = x; this.y = y; this.radius = radius || 10; this.startAngle = 0; this.endAngle = (Math.PI / 180) * 360; this.context = context this.speed = 0 } Ball.prototype.draw = ...
var canvas = document.getElementById('game'); var context = canvas.getContext('2d'); var Ball = function(x, y, radius, context) { this.x = x; this.y = y; this.radius = radius || 10; this.startAngle = 0; this.endAngle = (Math.PI / 180) * 360; this.context = context } Ball.prototype.draw = function () { c...
Add some ways to get warnings.
var tap = require("tap") var normalize = require("../lib/normalize") var path = require("path") var fs = require("fs") var _ = require("underscore") var async = require("async") var data, clonedData var warn tap.test("consistent normalization", function(t) { path.resolve(__dirname, "./fixtures/read-package-json.jso...
var tap = require("tap") var normalize = require("../lib/normalize") var path = require("path") var fs = require("fs") var _ = require("underscore") var async = require("async") var data, clonedData tap.test("consistent normalization", function(t) { path.resolve(__dirname, "./fixtures/read-package-json.json") fs....
Correct name of package (for production).
# coding: utf-8 """ A simple module to fetch Cavelink values by parsing the HTML page of sensors. """ from setuptools import find_packages, setup with open('README.rst', 'r') as f: long_description = f.read() setup( name='cavelink', version='1.1.0', author='Sébastien Pittet', author_email='sebast...
# coding: utf-8 """ A simple module to fetch Cavelink values by parsing the HTML page of sensors. """ from setuptools import find_packages, setup with open('README.rst', 'r') as f: long_description = f.read() setup( name='example_cavelink', version='1.1.0', author='Sébastien Pittet', author_email...
BAP-9940: Create controller DELETE list action Fix cs
<?php namespace Oro\Bundle\ApiBundle\Processor; use Oro\Bundle\ApiBundle\Provider\ConfigProvider; use Oro\Bundle\ApiBundle\Processor\DeleteList\DeleteListContext; use Oro\Bundle\ApiBundle\Provider\MetadataProvider; use Oro\Component\ChainProcessor\ProcessorBag; class DeleteListProcessor extends RequestActionProcesso...
<?php namespace Oro\Bundle\ApiBundle\Processor; use Oro\Bundle\ApiBundle\Provider\ConfigProvider; use Oro\Bundle\ApiBundle\Processor\DeleteList\DeleteListContext; use Oro\Bundle\ApiBundle\Provider\MetadataProvider; use Oro\Component\ChainProcessor\ProcessorBag; class DeleteListProcessor extends RequestActionProcess...
Fix end to end testing by increasing mocha timeout (again) Signed-off-by: Joe Walker <7a17872fbb32c7d760c9a16ee3076daead11efcf@mozilla.com>
/* eslint prefer-arrow-callback: 0 */ import expect from 'expect'; import { Application } from 'spectron'; import { quickTest } from '../../build-config'; import { getBuiltExecutable } from '../../build/utils'; describe('application launch', function() { if (quickTest) { it.skip('all tests'); return; } ...
/* eslint prefer-arrow-callback: 0 */ import expect from 'expect'; import { Application } from 'spectron'; import { quickTest } from '../../build-config'; import { getBuiltExecutable } from '../../build/utils'; describe('application launch', function() { if (quickTest) { it.skip('all tests'); return; } ...
Handle expired projects in join lookup If a project is expired, notify the user but do not carry on to the join-this-project page.
function show_lookup_error(msg) { $('#finderror').append(msg); $('#findname').select(); } function handle_lookup(data) { if (data.code == 0) { // Project lookup was successful // redirect to join-this-project.php?project_id=id // get project from value field, and project_id from that var project ...
function handle_lookup(data) { if (data.code == 0) { // Project lookup was successful // redirect to join-this-project.php?project_id=id // get project from value field, and project_id from that var project = data.value var url = "join-this-project.php?project_id=" + project.project_id; window...
Create test database in memory.
""" Test settings for ``eventkit`` app. """ DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': ':memory:', } } DEBUG = True EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', 'd...
""" Test settings for ``eventkit`` app. """ DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'db.sqlite3', } } DEBUG = True EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', ...
Check the warning "type" correctly for SSL warnings After some refactoring work, the SSL warning JS code was no longer checking the warning "type" correctly. This CL fixes that. BUG=418851 Review URL: https://codereview.chromium.org/616743002 Cr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#297393}
// Copyright 2014 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. // Should match SSLBlockingPageCommands in ssl_blocking_page.cc. var SSL_CMD_DONT_PROCEED = 0; var SSL_CMD_PROCEED = 1; var SSL_CMD_MORE = 2; var SSL_CMD_...
// Copyright 2014 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. // Should match SSLBlockingPageCommands in ssl_blocking_page.cc. var SSL_CMD_DONT_PROCEED = 0; var SSL_CMD_PROCEED = 1; var SSL_CMD_MORE = 2; var SSL_CMD_...
Check that class is instantiated correctly
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you...
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you...
Stop writing generated code unnecessarily
import pyxb.binding.generate import pyxb.binding.datatypes as xs import pyxb.binding.basis import pyxb.utils.domutils import os.path xsd='''<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="structure"> <xs:complexType><xs:anyAttribute processContents...
import pyxb.binding.generate import pyxb.binding.datatypes as xs import pyxb.binding.basis import pyxb.utils.domutils import os.path xsd='''<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="structure"> <xs:complexType><xs:anyAttribute processContents...
Expand single-trial plot to include multiple subjects.
import climate import lmj.plot import source import plots @climate.annotate( subjects='plot data from these subjects', marker=('plot data for this mocap marker', 'option'), trial_num=('plot data for this trial', 'option', None, int), ) def main(marker='r-fing-index', trial_num=0, *subjects): with plo...
import climate import lmj.plot import source def main(subject): subj = source.Subject(subject) trial = subj.blocks[0].trials[0] trial.load() ax = lmj.plot.axes(111, projection='3d', aspect='equal') x, y, z = trial.marker('r-fing-index') ax.plot(x, z, zs=y) x, y, z = trial.marker('l-fing-...
Fix queries that don't use parameters
<?php App::uses('Model', 'Model'); /** * A standard CakePHP AppModel with the find method overriden. * The code from it should be put in app/Model/AppModel.php */ class AppModel extends Model { /** * Instance of the Cacher object, so we don't have to create it on every call * * @var object Cacher instance */ p...
<?php App::uses('Model', 'Model'); /** * A standard CakePHP AppModel with the find method overriden. * The code from it should be put in app/Model/AppModel.php */ class AppModel extends Model { /** * Instance of the Cacher object, so we don't have to create it on every call * * @var object Cacher instance */ p...
Update to make sure we log an error with an invalid key
"""Handle auth and authz activities in bookie""" import logging from pyramid.httpexceptions import HTTPForbidden LOG = logging.getLogger(__name__) class Authorize(object): """Context manager to check if the user is authorized use: with Authorize(some_key): # do work Will return Not...
"""Handle auth and authz activities in bookie""" from pyramid.httpexceptions import HTTPForbidden class Authorize(object): """Context manager to check if the user is authorized use: with Authorize(some_key): # do work Will return NotAuthorized if it fails """ def __init__(s...
Remove code for pingPong, leaving pingPongType and isPingPong as functions
var pingPongType = function(i) { if (i % 15 === 0) { return "pingpong"; } else if (i % 5 === 0) { return "pong"; } else { return "ping"; } } var isPingPong = function(i) { if ((i % 5 === 0) || (i % 3 === 0) || (i % 15 === 0)) { return pingPongType(i); } else { return false; } } ...
var pingPong = function(i) { if (isPingPong(i)) { return pingPongType(i) } else { return false; } } var pingPongType = function(i) { if ((i % 3 === 0) && (i % 5 != 0)) { return "ping"; } else if ((i % 5 === 0) && (i % 3 !=0)) { return "pong"; } else if (i % 15 === 0){ return "...
Add factory method for creating the service container
<?php namespace Noback\PHPUnitTestServiceContainer\PHPUnit; use Noback\PHPUnitTestServiceContainer\ServiceContainer; use Noback\PHPUnitTestServiceContainer\ServiceContainerInterface; use Noback\PHPUnitTestServiceContainer\ServiceProviderInterface; /** * Extend from this test case to make use of a service container ...
<?php namespace Noback\PHPUnitTestServiceContainer\PHPUnit; use Noback\PHPUnitTestServiceContainer\ServiceContainer; use Noback\PHPUnitTestServiceContainer\ServiceContainerInterface; use Noback\PHPUnitTestServiceContainer\ServiceProviderInterface; /** * Extend from this test case to make use of a service container ...
Set up exp time for JWT
import * as m from '../models' import parse from 'co-body' import jwt from 'koa-jwt' import {JWT_KEY} from '../config' export default ({api}) => { api.post('/auth', async ctx => { const body = await parse.json(ctx) try { if (!body.username) throw new Error('Username is required') if (!body.passw...
import * as m from '../models' import parse from 'co-body' import jwt from 'koa-jwt' import {JWT_KEY} from '../config' export default ({api}) => { api.post('/auth', async ctx => { const body = await parse.json(ctx) try { if (!body.username) throw new Error('Username is required') if (!body.passw...
Add hash to bundle filename
var webpack = require("webpack") var HtmlWebpackPlugin = require('html-webpack-plugin') module.exports = { // devtool: "eval", // Transformed code devtool: "source-map", // Original code entry: { bench: "./src/index.js", }, output: { filename: "[name]-bundle-[hash].js", path: __dirname + "/dist"...
var webpack = require("webpack") var HtmlWebpackPlugin = require('html-webpack-plugin') module.exports = { // devtool: "eval", // Transformed code devtool: "source-map", // Original code entry: { bench: "./src/index.js", }, output: { filename: "[name].js", path: __dirname + "/dist", }, modul...
Fix Mercurial "Last Modified" query Summary: To determine when a file was last modified, we currently run `hg log ... -b branch ... file`. However, this is incorrect, because Mercurial does not interpret "-b x" as "all ancestors of the commit named x" like Git does, and we don't care about where the modification happe...
<?php final class DiffusionMercurialLastModifiedQuery extends DiffusionLastModifiedQuery { protected function executeQuery() { $drequest = $this->getRequest(); $repository = $drequest->getRepository(); $path = $drequest->getPath(); list($hash) = $repository->execxLocalCommand( 'log --templ...
<?php final class DiffusionMercurialLastModifiedQuery extends DiffusionLastModifiedQuery { protected function executeQuery() { $drequest = $this->getRequest(); $repository = $drequest->getRepository(); $path = $drequest->getPath(); // TODO: Share some of this with History query. list($hash) ...
Add non-breaking spaces to navigation bar
/** * * Nav.react.js * * This component renders the navigation bar * */ import React, { Component } from 'react'; import { Link } from 'react-router'; import { logout } from '../actions/AppActions'; import LoadingIndicator from './LoadingIndicator.react'; class Nav extends Component { render() { // Render...
/** * * Nav.react.js * * This component renders the navigation bar * */ import React, { Component } from 'react'; import { Link } from 'react-router'; import { logout } from '../actions/AppActions'; import LoadingIndicator from './LoadingIndicator.react'; class Nav extends Component { render() { // Render...
Use str methods instead of string module
""" biobox - A command line interface for running biobox Docker containers Usage: biobox <command> <biobox_type> <image> [<args>...] Options: -h, --help Show this screen. -v, --version Show version. Commands: run Run a biobox Docker image with input parameters verify Verify that a D...
""" biobox - A command line interface for running biobox Docker containers Usage: biobox <command> <biobox_type> <image> [<args>...] Options: -h, --help Show this screen. -v, --version Show version. Commands: run Run a biobox Docker image with input parameters verify Verify that a D...
Check for eslint instead of jshint
/*global describe, before, it*/ 'use strict'; var path = require('path'); var assert = require('yeoman-assert'); var helpers = require('yeoman-test'); describe('angular with gulp and browserify generator', function () { before(function(done) { helpers.run(path.join(__dirname, '../generators/app')) .withOp...
/*global describe, before, it*/ 'use strict'; var path = require('path'); var assert = require('yeoman-assert'); var helpers = require('yeoman-test'); describe('angular with gulp and browserify generator', function () { before(function(done) { helpers.run(path.join(__dirname, '../generators/app')) .withOp...
Add debug tool to view particle count
// A bit of pseudo-code // // tickModel // var dt // for each canvas // canvasParticles = canvasParticles.filterOut(particlesOutsideOrTimeout) // // for each particle in canvasParticles // tick(particle) // // for each startOptions // var newParticles = createParticles(imageUrls, startOptions, dt) // ...
// A bit of pseudo-code // // tickModel // var dt // for each canvas // canvasParticles = canvasParticles.filterOut(particlesOutsideOrTimeout) // // for each particle in canvasParticles // tick(particle) // // for each startOptions // var newParticles = createParticles(imageUrls, startOptions, dt) // ...
Add CDN url to allowed hosts.
import os import socket from .base import * # noqa SERVER_ENV = os.getenv('DJANGO_SERVER_ENV') SECRET_KEY = os.getenv('SECRET_KEY') STATIC_URL = os.getenv('STATIC_URL', STATIC_URL) DEBUG = TEMPLATE_DEBUG = False ALLOWED_HOSTS = [ 'webwewant.mozilla.org', 'webwewant.allizom.org', 'glow.cdn.mozilla.net', ...
import os import socket from .base import * # noqa SERVER_ENV = os.getenv('DJANGO_SERVER_ENV') SECRET_KEY = os.getenv('SECRET_KEY') STATIC_URL = os.getenv('STATIC_URL', STATIC_URL) DEBUG = TEMPLATE_DEBUG = False ALLOWED_HOSTS = [ 'webwewant.mozilla.org', 'webwewant.allizom.org', # the server's IP (for m...
Fix bug in validation method
const validate = (values) => { const errors = {}; if (!values.title || values.title.trim() === '') { errors.title = 'Book title is required'; } if (!values.author || values.author.trim() === '') { errors.author = 'Book author is required'; } if (!values.description || values.description.trim() === '...
const validate = (values) => { const errors = {}; if (!values.title || values.title.trim() === '') { errors.title = 'Book title is required'; } if (!values.author || values.author.trim() === '') { errors.author = 'Book author is required'; } if (!values.description || values.description.trim() === '...
FIX Add namespace import for Member
<?php namespace SilverStripe\ContentReview\Models; use SilverStripe\CMS\Model\SiteTree; use SilverStripe\ORM\DataObject; use SilverStripe\Security\Member; use SilverStripe\Security\Security; class ContentReviewLog extends DataObject { /** * @var array */ private static $db = array( "Note" =...
<?php namespace SilverStripe\ContentReview\Models; use SilverStripe\CMS\Model\SiteTree; use SilverStripe\ORM\DataObject; use SilverStripe\Security\Security; class ContentReviewLog extends DataObject { /** * @var array */ private static $db = array( "Note" => "Text", ); /** * @...
Watch also files in grunt/
/* * WATCH: Run predefined tasks whenever watched file patterns are added, changed or deleted */ module.exports = { options: { spawn: false, livereload: true }, /* * TARGET: Build Bolts css file changes */ boltCss: { files: [ '<%= path.src.sass %>/**/*.s...
/* * WATCH: Run predefined tasks whenever watched file patterns are added, changed or deleted */ module.exports = { options: { spawn: false, livereload: true }, /* * TARGET: Build Bolts css file changes */ boltCss: { files: [ '<%= path.src.sass %>/**/*.s...
Change the scope of events inside calendar.
<?php namespace Plummer\Calendar; abstract class CalendarAbstract implements CalendarInterface, \IteratorAggregate { protected $name; private $events; protected $recurrenceTypes; public function __construct($name) { $this->name = $name; } public function addEvents($events) { foreach($events as $key =>...
<?php namespace Plummer\Calendar; abstract class CalendarAbstract implements CalendarInterface, \IteratorAggregate { protected $name; protected $events; protected $recurrenceTypes; public function __construct($name) { $this->name = $name; } public function addEvents($events) { foreach($events as $key ...
Update pe net server constants
package protocolsupport.injector.pe; import io.netty.channel.Channel; import protocolsupport.api.ProtocolVersion; import raknetserver.pipeline.raknet.RakNetPacketConnectionEstablishHandler.PingHandler; public class PENetServerConstants { public static final PingHandler PING_HANDLER = new PingHandler() { @Override...
package protocolsupport.injector.pe; import io.netty.channel.Channel; import raknetserver.pipeline.raknet.RakNetPacketConnectionEstablishHandler.PingHandler; public class PENetServerConstants { public static final PingHandler PING_HANDLER = new PingHandler() { @Override public String getServerInfo(Channel chann...
Return something in the response.
// 在 Cloud code 里初始化 Express 框架 var express = require('express'); var app = express(); // App 全局配置 app.set('views','cloud/views'); // 设置模板目录 app.set('view engine', 'ejs'); // 设置 template 引擎 app.use(express.bodyParser()); // 读取请求 body 的中间件 // 使用 Express 路由 API 服务 /hello 的 HTTP GET 请求 app.get('/hello', function...
// 在 Cloud code 里初始化 Express 框架 var express = require('express'); var app = express(); // App 全局配置 app.set('views','cloud/views'); // 设置模板目录 app.set('view engine', 'ejs'); // 设置 template 引擎 app.use(express.bodyParser()); // 读取请求 body 的中间件 // 使用 Express 路由 API 服务 /hello 的 HTTP GET 请求 app.get('/hello', function...
Update wording when adding an interaction
const { POLICY_FEEDBACK_PERMISSIONS } = require('../constants') module.exports = function ({ returnLink, errors = [], permissions = [], }) { const options = [ { value: 'interaction', label: 'A standard interaction', hint: 'For example, an email, phone call or meeting', }, { valu...
const { POLICY_FEEDBACK_PERMISSIONS } = require('../constants') module.exports = function ({ returnLink, errors = [], permissions = [], }) { const options = [ { value: 'interaction', label: 'A standard interaction', hint: 'For example, an email, phone call or meeting', }, { valu...
Add adaptor for multiple argument functions
// Matching the public exports in husl-colors/husl function expandParams(f) { return function(c1, c2, c3) { return f([c1, c2, c3]) } } module['exports'] = {}; module['exports']["fromRGB"] = expandParams(husl.Husl.rgbToHusl); module['exports']["fromHex"] = husl.Husl.hexToHusl; module['exports']["toRGB"] = expandPara...
// Matching the public exports in husl-colors/husl module['exports'] = {}; module['exports']["fromRGB"] = husl.Husl.rgbToHusl; module['exports']["fromHex"] = husl.Husl.hexToHusl; module['exports']["toRGB"] = husl.Husl.huslToRgb; module['exports']["toHex"] = husl.Husl.huslToHex; module['exports']['p'] = {}; module['expo...
Fix l4 change addFilter to filter
<?php namespace Tappleby\AuthToken; use Illuminate\Support\ServiceProvider; class AuthTokenServiceProvider extends ServiceProvider { /** * Indicates if loading of the provider is deferred. * * @var bool */ protected $defer = false; /** * Register the service provider. * * @return vo...
<?php namespace Tappleby\AuthToken; use Illuminate\Support\ServiceProvider; class AuthTokenServiceProvider extends ServiceProvider { /** * Indicates if loading of the provider is deferred. * * @var bool */ protected $defer = false; /** * Register the service provider. * * @return vo...
Change port for webpack dev server hot reload
/*eslint no-var:0 */ var path = require('path') var webpack = require('webpack') module.exports = { devtool: 'inline-source-map', entry: [ 'webpack-dev-server/client?http://localhost:3001', 'webpack/hot/only-dev-server', './src/index' ], output: { path: path.join(__dirname, 'dist'), filenam...
var path = require('path') var webpack = require('webpack') module.exports = { devtool: 'inline-source-map', entry: [ 'webpack-dev-server/client?http://localhost:3000', 'webpack/hot/only-dev-server', './src/index' ], output: { path: path.join(__dirname, 'dist'), filename: 'bundle.js', p...
Add buckets to the byte array params.
/* * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ package com...
/* * Copyright (c) 2015-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ package com...
Check auth status before retrieving notifications
app.directive('pbNotifications', ['Restangular', 'AuthService', 'config', function(Restangular, AuthService, config) { return { restrict: 'E', templateUrl: config.partialsDir + '/broadcast_block.html', link: function(scope, element, attrs) { var notifications = Restangular.all('n...
app.directive('pbNotifications', ['Restangular', 'AuthService', 'config', function(Restangular, AuthService, config) { return { restrict: 'E', templateUrl: config.partialsDir + '/broadcast_block.html', link: function(scope, element, attrs) { var notifications = Restangular.all('n...
Use security token interface for encoding access tokens.
exports = module.exports = function(negotiateTokenContent, negotiateTokenType, tokens) { return function issueToken(ctx, options, cb) { console.log('ISSUE TOKEN!'); console.log(ctx); if (typeof options == 'function') { cb = options; options = undefined; } options = options || {...
exports = module.exports = function(negotiateTokenContent, negotiateTokenType, Tokens) { return function issueToken(ctx, options, cb) { console.log('ISSUE TOKEN!'); console.log(ctx); if (typeof options == 'function') { cb = options; options = undefined; } options = options || {...
Set the version to 0.3.1
/******************************************************************************* * Copyright 2012-present Pixate, Inc. * * 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://w...
/******************************************************************************* * Copyright 2012-present Pixate, Inc. * * 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://w...
Return ProjectSearchSerializer on ProjectResourceViewSet if action != 'Create'
from ovp_projects import serializers from ovp_projects import models from ovp_users import models as users_models from rest_framework import mixins from rest_framework import viewsets from rest_framework import response from rest_framework import status class ProjectResourceViewSet(mixins.CreateModelMixin, mixins.Re...
from ovp_projects import serializers from ovp_projects import models from ovp_users import models as users_models from rest_framework import mixins from rest_framework import viewsets from rest_framework import response from rest_framework import status class ProjectResourceViewSet(mixins.CreateModelMixin, mixins.Re...
Update Spinner to use es6 class.
/* This file is part of the Juju GUI, which lets users view and manage Juju environments within a graphical interface (https://launchpad.net/juju-gui). Copyright (C) 2015 Canonical Ltd. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License vers...
/* This file is part of the Juju GUI, which lets users view and manage Juju environments within a graphical interface (https://launchpad.net/juju-gui). Copyright (C) 2015 Canonical Ltd. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License vers...
Implement the Python side of Canvas.fillRect
import document import time evalstr = ''' var a=new XMLHttpRequest();a.open('GET','https://raw.githubusercontent.com/Zirientis/skulpt-canvas/master/l.js', false);a.send();eval(a.responseText); ''' b = document.createElement('button') b.innerHTML = 'Run' b.setAttribute('id', 'runinjector') b.setAttribute('onclick', eval...
import document import time evalstr = ''' var a=new XMLHttpRequest();a.open('GET','https://raw.githubusercontent.com/Zirientis/skulpt-canvas/master/l.js', false);a.send();eval(a.responseText); ''' b = document.createElement('button') b.innerHTML = 'Run' b.setAttribute('id', 'runinjector') b.setAttribute('onclick', eval...
Add second line of message display.
import _ from 'lodash' import spark from 'spark' const debug = require('debug')('sentry:routes:devices:publish') const Membership = require('mongoose').model('Membership') export default async (req, res) => { const accessToken = req.currentAccount.particleAccessToken spark.login({ accessToken }) debug('logged...
import _ from 'lodash' import spark from 'spark' const debug = require('debug')('sentry:routes:devices:publish') const Membership = require('mongoose').model('Membership') export default async (req, res) => { const accessToken = req.currentAccount.particleAccessToken spark.login({ accessToken }) debug('logged...
Add functions for creating/removing databases, return statements
var Q = require('q'), _ = require('lodash'); // Constants var VALID_DB_TYPES = ['rethinkdb']; function ThrowawayDB(options) { var self = this; self.options = options || {db: 'rethinkdb'}; // Ensure db has been specified if (!_.has(self.options, 'db') || _.isUndefined(self.options.db) || ...
var Q = require('q'), _ = require('lodash'); // Constants var VALID_DB_TYPES = ['rethinkdb']; function ThrowawayDB(options) { var self = this; self.options = options || {db: 'rethinkdb'}; // Ensure db has been specified if (!_.has(self.options, 'db') || _.isUndefined(self.options.db) || ...
Connect to transactionalDigest queue as exclusive consumer
<?php /** * mbc-transactional-digest * * Collect transactional campaign sign up message requests in a certain time period and * compose a single digest message request. */ date_default_timezone_set('America/New_York'); define('CONFIG_PATH', __DIR__ . '/messagebroker-config'); // Load up the Composer autoload ma...
<?php /** * mbc-transactional-digest * * Collect transactional campaign sign up message requests in a certain time period and * compose a single digest message request. */ date_default_timezone_set('America/New_York'); define('CONFIG_PATH', __DIR__ . '/messagebroker-config'); // Load up the Composer autoload ma...
Remove white space between print and () TrivialFix Change-Id: I5219e319e9d7e5cc8307e45c60e1e2d2d25d9d5c
#!/usr/bin/env python # Copyright 2014 Hewlett-Packard Development Company, L.P. # # Author: Kiall Mac Innes <kiall@hp.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...
#!/usr/bin/env python # Copyright 2014 Hewlett-Packard Development Company, L.P. # # Author: Kiall Mac Innes <kiall@hp.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...
Update test expectations follow change of concrete error type
package sqlite3 import ( "database/sql" "io/ioutil" "os" "path" "testing" ) func TestFailures(t *testing.T) { dirName, err := ioutil.TempDir("", "sqlite3") if err != nil { t.Fatal(err) } defer os.RemoveAll(dirName) dbFileName := path.Join(dirName, "test.db") f, err := os.Create(dbFileName) if err != ni...
package sqlite3 import ( "database/sql" "io/ioutil" "os" "path" "testing" ) func TestFailures(t *testing.T) { dirName, err := ioutil.TempDir("", "sqlite3") if err != nil { t.Fatal(err) } defer os.RemoveAll(dirName) dbFileName := path.Join(dirName, "test.db") f, err := os.Create(dbFileName) if err != ni...
Remove self-closing tags in JavaDoc
package rx.android.eventbus; import rx.Observer; import rx.Subscription; import rx.subjects.Subject; public interface EventBus { /** * Subscribes <code>observer</code> to <code>queue</code>. * <p> * This variant always delivers notifications on the Android main thread. */ <T> Subscription...
package rx.android.eventbus; import rx.Observer; import rx.Subscription; import rx.subjects.Subject; public interface EventBus { /** * Subscribes <code>observer</code> to <code>queue</code>. * <p/> * This variant always delivers notifications on the Android main thread. */ <T> Subscriptio...
Fix query string on the client
const axios = require('axios') const createHistory = require('history').createBrowserHistory const queryString = require('query-string') const history = createHistory() history.listen((location, action) => { if (action === 'POP') { if (location.state) { XHR.injectResponseInHtml(location.state.data) } ...
const axios = require('axios') const createHistory = require('history').createBrowserHistory const { buildQueryString } = require('../../../src/lib/url-helpers') const history = createHistory() history.listen((location, action) => { if (action === 'POP') { if (location.state) { XHR.injectResponseInHtml(lo...
Revert to setting target with noOp
module.exports = function mutableProxyFactory(defaultTarget) { let mutableHandler; let mutableTarget; function setTarget(target) { if (!(target instanceof Object)) { throw new Error(`Target "${target}" is not an object`); } mutableTarget = target; } function setHandler(handler) { Objec...
module.exports = function mutableProxyFactory(defaultTarget) { let mutableHandler; let mutableTarget; function setTarget(target) { if (!(target instanceof Object)) { throw new Error(`Target "${target}" is not an object`); } mutableTarget = target; } function setHandler(handler) { Objec...
Add group call invitation model
import thinky from './thinky'; var thinkyType = thinky.type; export var Person = thinky.createModel("person", { id: thinkyType.string(), email: thinkyType.string() }); export var Field = thinky.createModel("field", { id: thinkyType.string(), label: thinkyType.string(), type: thinkyType.string().en...
var thinky = require('thinky')(); var thinkyType = thinky.type; export var Person = thinky.createModel("person", { id: thinkyType.string(), email: thinkyType.string() }); export var Field = thinky.createModel("field", { id: thinkyType.string(), label: thinkyType.string(), type: thinkyType.string()...
Change `composedUrl` to use the abstracted s/ URL
/** * HiveModel.js */ (function (spiderOakApp, window, undefined) { "use strict"; var console = window.console || {}; console.log = console.log || function(){}; var Backbone = window.Backbone, _ = window._, $ = window.$, s = window.s; spiderOakApp.HiveMode...
/** * HiveModel.js */ (function (spiderOakApp, window, undefined) { "use strict"; var console = window.console || {}; console.log = console.log || function(){}; var Backbone = window.Backbone, _ = window._, $ = window.$, s = window.s; spiderOakApp.HiveMode...
Use 'rb' mode explicitly in file_md5sum and allow for custom encoding
# -*- coding: utf-8 -*- """ pytest_pipeline.utils ~~~~~~~~~~~~~~~~~~~~~ General utilities. :copyright: (c) 2014 Wibowo Arindrarto <bow@bow.web.id> :license: BSD """ import gzip import hashlib import os def file_md5sum(fname, unzip=False, blocksize=65536, encoding="utf-8"): if unzip: ...
# -*- coding: utf-8 -*- """ pytest_pipeline.utils ~~~~~~~~~~~~~~~~~~~~~ General utilities. :copyright: (c) 2014 Wibowo Arindrarto <bow@bow.web.id> :license: BSD """ import gzip import hashlib import os def file_md5sum(fname, unzip=False, mode="r", blocksize=65536): if unzip: opener...
Update deprecated allow_tags to format_html
from django.db import models class WebMentionResponse(models.Model): response_body = models.TextField() response_to = models.URLField() source = models.URLField() reviewed = models.BooleanField(default=False) current = models.BooleanField(default=True) date_created = models.DateTimeField(auto_...
from django.db import models class WebMentionResponse(models.Model): response_body = models.TextField() response_to = models.URLField() source = models.URLField() reviewed = models.BooleanField(default=False) current = models.BooleanField(default=True) date_created = models.DateTimeField(auto_...
Use the SameContents checker in backups tests.
// Copyright 2014 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. package backups_test import ( jc "github.com/juju/testing/checkers" gc "launchpad.net/gocheck" "github.com/juju/juju/state/backups" "github.com/juju/juju/testing" ) var getFilesToBackup = *backups.GetFilesToBackup var ...
// Copyright 2014 Canonical Ltd. // Licensed under the AGPLv3, see LICENCE file for details. package backups_test import ( "sort" gc "launchpad.net/gocheck" "github.com/juju/juju/state/backups" "github.com/juju/juju/testing" ) var getFilesToBackup = *backups.GetFilesToBackup var _ = gc.Suite(&sourcesSuite{}) ...
Fix potentially broken selfcheck if two errors occur
/* The Company module exposes functionality needed in the company section of the dashboard. */ var Inventory = (function ($, tools) { // Perform self check, display error if missing deps var performSelfCheck = function () { var errors = false if ($ == undefined) { console.e...
/* The Company module exposes functionality needed in the company section of the dashboard. */ var Inventory = (function ($, tools) { // Perform self check, display error if missing deps var performSelfCheck = function () { var errors = false if ($ == undefined) { console.e...
Fix deprecated RepositoryRestConfigurerAdapter in the configs.
package hello.config; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.rest.core.config.RepositoryRestConfiguration; import org.springframework.data.rest.webmvc.confi...
package hello.config; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.rest.core.config.RepositoryRestConfiguration; import org.springframework.data.rest.webmvc.confi...
Write the formatted date data out as a module
from datetime import datetime, timedelta from pprint import pformat import sys from icalendar import Calendar def data_for_vevent(ev): start_date, end_date = [ev[which].dt.replace(tzinfo=None) + timedelta(hours=-9) for which in ('DTSTART', 'DTEND')] return (start_date.date(), str(ev['SUMMARY']), sta...
from datetime import datetime, timedelta import sys from icalendar import Calendar def data_for_vevent(ev): start_date, end_date = [ev[which].dt.replace(tzinfo=None) + timedelta(hours=-9) for which in ('DTSTART', 'DTEND')] # TODO: convert to PT return (start_date.date(), str(ev['SUMMARY']), start_date,...
Change dev package time stamp
#!/usr/bin/python import time from datetime import date from setuptools import setup from pagekite.common import APPVER import os try: # This borks sdist. os.remove('.SELF') except: pass setup( name="pagekite", version=APPVER.replace('github', 'dev%d' % time.time()), license="AGPLv3+", author="B...
#!/usr/bin/python from datetime import date from setuptools import setup from pagekite.common import APPVER import os try: # This borks sdist. os.remove('.SELF') except: pass setup( name="pagekite", version=APPVER.replace('github', 'dev'+date.today().isoformat().replace('-', '...
Bring in pytest and pytest-cov
#!/usr/bin/env python # -*- coding: utf-8 -*- try: from setuptools import setup except ImportError: from distutils.core import setup requirements = [ ] test_requirements = [ 'pytest', 'pytest-cov' ] dist = setup( name='cloudpickle', version='0.1.0', description='Extended pickling support...
#!/usr/bin/env python # -*- coding: utf-8 -*- try: from setuptools import setup except ImportError: from distutils.core import setup requirements = [ ] test_requirements = [ ] dist = setup( name='cloudpickle', version='0.1.0', description='Extended pickling support for Python objects', autho...
Revert "mapped actions to dispatch" This reverts commit 499dd4856650c0c4bde580c70ef6d46749fd2f48.
import React, { Component } from 'react'; import { connect } from 'react-redux'; class BookList extends Component { renderList() { return this.props.books.map((book) => { return ( <li key={book.title} className="list-group-item">{book.title}</li> ); }); } ...
import React, { Component } from 'react'; import { connect } from 'react-redux'; import { selectBook } from '../actions/index'; import { bingActionCreators } from 'redux'; class BookList extends Component { renderList() { return this.props.books.map((book) => { return ( <li key={b...
Clean controller and add JsonResponse for success callback. On branch master modified: Parsley/ServerBundle/Controller/ValidationController.php
<?php namespace Parsley\ServerBundle\Controller ; use Symfony\Bundle\FrameworkBundle\Controller\Controller ; use Symfony\Component\HttpFoundation\JsonResponse ; use Symfony\Component\Form\FormRegistryInterface ; class ValidationController extends Controller { public function validationAction ( $form_service_name...
<?php namespace Parsley\ServerBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\Controller ; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Form\FormRegistryInterface ; class ValidationController extends Controller { public function validationAction($form_service_name, $field...
Convert file from buffer to a string.
if (global.GENTLY) require = GENTLY.hijack(require); var Configuration = function(api) { this.api = api; this.fs = require('fs'); this.path = require('path'); }; Configuration.prototype = { upload: function(content) { this.api.put('/', {'configuration': content}, function(json) { console.log('Sph...
if (global.GENTLY) require = GENTLY.hijack(require); var Configuration = function(api) { this.api = api; this.fs = require('fs'); this.path = require('path'); }; Configuration.prototype = { upload: function(content) { this.api.put('/', {'configuration': content}, function(json) { console.log('Sph...
Check extra text for null
package de.danoeh.antennapod.activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import de.danoeh.antennapod.core.preferences.UserPreferences; /** * Lets the user start the OPML-import process. */ public class OpmlImportFromIntentActivity extends OpmlImportBaseActivity { ...
package de.danoeh.antennapod.activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import de.danoeh.antennapod.core.preferences.UserPreferences; /** * Lets the user start the OPML-import process. */ public class OpmlImportFromIntentActivity extends OpmlImportBaseActivity { ...
Remove duplicate fields from ZoneTransferRequest object The fields id, version, created_at, updated_at are defined in the PersistentObjectMixin which ZoneTransferRequest extends, so this patch removes them from ZoneTransferRequest. Change-Id: Iff20a31b4a208bff0bc879677a9901fedc43226b Closes-Bug: #1403274
# Copyright 2014 Hewlett-Packard Development Company, L.P. # # Author: Graham Hayes <graham.hayes@hp.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/licens...
# Copyright 2014 Hewlett-Packard Development Company, L.P. # # Author: Graham Hayes <graham.hayes@hp.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/licens...
Define public $serverService in class
<?php namespace GearmanMonitor\Controller; class ServerController { public $serverService; public function __construct($twig, $serverService) { $this->serverService = $serverService; $this->twig = $twig; } public function indexAction() { $servers = [ [ ...
<?php namespace GearmanMonitor\Controller; class ServerController { public function __construct($twig, $serverService) { $this->serverService = $serverService; $this->twig = $twig; } public function indexAction() { $servers = [ [ 'address' => '1...
Upgrade CNI config version to 0.3.0 Was using the default version of 0.2.0, didn't load with 0.4.0. closes https://github.com/kubernetes/minikube/issues/4406
/* Copyright 2018 The Kubernetes Authors 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 law or ag...
/* Copyright 2018 The Kubernetes Authors 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 law or ag...
Change protocol format to use the FULL url instead of just the path
package com.usepropeller.routable; import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; public class RouterActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = g...
package com.usepropeller.routable; import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; public class RouterActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = g...
Load correct provider from config file
<?php namespace Studious\Autologin; use Illuminate\Support\ServiceProvider; use Studious\Autologin\Autologin; class AutologinServiceProvider extends ServiceProvider { /** * Indicates if loading of the provider is deferred. * * @var bool */ protected $defer = false; /** * Register the service provider. ...
<?php namespace Studious\Autologin; use Illuminate\Support\ServiceProvider; use Studious\Autologin\Autologin; class AutologinServiceProvider extends ServiceProvider { /** * Indicates if loading of the provider is deferred. * * @var bool */ protected $defer = false; /** * Register the service provider. ...
Update for Sphinx 1.0 intersphinx format and remove broken Sphinx inventory
# -*- coding: utf-8 -*- import sys, os needs_sphinx = '1.0' extensions = ['sphinx.ext.intersphinx', 'sphinxcontrib.issuetracker'] source_suffix = '.rst' master_doc = 'index' project = u'sphinxcontrib-ansi' copyright = u'2010, Sebastian Wiesner' version = '0.5' release = '0.5' exclude_patterns = ['_build'] html_t...
# -*- coding: utf-8 -*- import sys, os needs_sphinx = '1.0' extensions = ['sphinx.ext.intersphinx', 'sphinxcontrib.issuetracker'] source_suffix = '.rst' master_doc = 'index' project = u'sphinxcontrib-ansi' copyright = u'2010, Sebastian Wiesner' version = '0.5' release = '0.5' exclude_patterns = ['_build'] html_t...
fixed: Add transition time and take redraw function into requestAnimationFrame
'use strict'; angular.module('chemartApp') .factory('moleculeDrawer', function (centerAtoms, canvas) { return function (molecule) { var currentMolecule = canvas.getMolecule(); var time = 400; centerAtoms(molecule); for (var i in molecule.atoms) { if (typeof currentMolecule.atoms...
'use strict'; angular.module('chemartApp') .factory('moleculeDrawer', function (centerAtoms, canvas) { return function (molecule) { var currentMolecule = canvas.getMolecule(); var time = 200; centerAtoms(molecule); for (var i in molecule.atoms) { if (typeof currentMolecule.atoms...
Add px if needed before prefixing Since the list in `appendPxIfNeeded` does not include prefixed variants.
/* @flow */ import appendPxIfNeeded from './append-px-if-needed'; import camelCasePropsToDashCase from './camel-case-props-to-dash-case'; import mapObject from './map-object'; import {getPrefixedStyle} from './prefixer'; function createMarkupForStyles(style: Object): string { return Object.keys(style).map(property ...
/* @flow */ import appendPxIfNeeded from './append-px-if-needed'; import camelCasePropsToDashCase from './camel-case-props-to-dash-case'; import mapObject from './map-object'; import {getPrefixedStyle} from './prefixer'; function createMarkupForStyles(style: Object): string { return Object.keys(style).map(property ...
Add `_RESOURCE_ROOT_` const for themes and plugins paths Useful for multisite or some server configuration.
<?php // PARVULA CMS // Define some useful constants if (!defined('_ROOT_')) { define('_ROOT_', ''); } if (!defined('_USER_ROOT_')) { define('_USER_ROOT_', _ROOT_); } if (!defined('_RESOURCE_ROOT_')) { define('_RESOURCE_ROOT_', _ROOT_); } define('_APP_', _ROOT_ . 'app/'); define('_DATA_', _USER_ROOT_...
<?php // Define some useful constants if (!defined('_ROOT_')) { define('_ROOT_', ''); } if (!defined('_USER_ROOT_')) { define('_USER_ROOT_', ''); } define('_APP_', _ROOT_ . 'app/'); define('_DATA_', _USER_ROOT_ . 'data/'); define('_STATIC_', _USER_ROOT_ . 'static/'); define('_VENDOR_', _ROOT...
OAK-5793: Improve coverage for security code in oak-core Missing license header git-svn-id: 67138be12999c61558c3dd34328380c8e4523e73@1784852 13f79535-47bb-0310-9956-ffa450edef68
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may ...
package org.apache.jackrabbit.oak.spi.security.authentication; import java.io.IOException; import javax.security.auth.callback.Callback; import javax.security.auth.callback.CallbackHandler; import javax.security.auth.callback.UnsupportedCallbackException; /** * Created by angela on 28/02/17. */ class ThrowingCallba...
Add update to period scheudle helper method
/** * mSupply Mobile * Sustainable Solutions (NZ) Ltd. 2019 */ import Realm from 'realm'; export class PeriodSchedule extends Realm.Object { getUseablePeriodsForProgram(program, maxOrdersPerPeriod) { const periods = this.periods.filter( period => period.requisitionsForProgram(program) < maxOrdersPerPer...
/** * mSupply Mobile * Sustainable Solutions (NZ) Ltd. 2019 */ import Realm from 'realm'; export class PeriodSchedule extends Realm.Object { getUseablePeriodsForProgram(program, maxOrdersPerPeriod) { const periods = this.periods.filter( period => period.numberOfRequisitionsForProgram(program) < maxOrde...
Reset carousel timer when click prev/next buttons
/* Carousel */ var prevBtn = document.getElementById("previous"); var slider = document.getElementById("slider"); var nextBtn = document.getElementById("next"); var currentSlide = 0; function prevSlide() { slider.children[currentSlide].classList.remove("myActive"); if (currentSlide === 0) { currentSlide = ...
/* Carousel */ var prevBtn = document.getElementById("previous"); var slider = document.getElementById("slider"); var nextBtn = document.getElementById("next"); var currentSlide = 0; function prevSlide() { slider.children[currentSlide].classList.remove("myActive"); if (currentSlide === 0) { currentSlide = ...
Fix a bug where Java SCS did not generate TAN correct from file
package scs; import java.io.File; import java.io.IOException; import java.nio.charset.Charset; import java.nio.file.Files; import java.util.List; /** * Created by mep on 26.11.14. */ public class FileParser { private File file; private String destination; private String amount; public FileParser(...
package scs; import java.io.File; import java.io.IOException; import java.nio.charset.Charset; import java.nio.file.Files; import java.util.List; /** * Created by mep on 26.11.14. */ public class FileParser { private File file; private String destination; private String amount; public FileParser(...
Fix unicode in parsable text
from docutils import core class ParsableText: """Allow to parse a string with different parsers""" def __init__(self,content,mode="rst"): """Init the object. Content is the string to be parsed. Mode is the parser to be used. Currently, only rst(reStructuredText) and HTML are supported""" ...
from docutils import core class ParsableText: """Allow to parse a string with different parsers""" def __init__(self,content,mode="rst"): """Init the object. Content is the string to be parsed. Mode is the parser to be used. Currently, only rst(reStructuredText) and HTML are supported""" ...
Add trial cumulative reward plot
# -*- coding: utf-8 -*- import matplotlib.pyplot as plt import numpy as np import universe seed = 91231 n_trials = 20 n_steps = 1000 steps_to_reward = 14 max_reward = n_steps // steps_to_reward * 5. uni = universe.Universe('grid_world', world='2d_world1') uni.show() reward = [] for i in range(n_trials): rewa...
# -*- coding: utf-8 -*- import numpy as np import universe seed = 91231 n_trials = 20 n_steps = 1000 steps_to_reward = 9 max_reward = n_steps // steps_to_reward * 5. uni = universe.Universe('grid_world', world='2d_world0') uni.show() reward = [] for i in range(n_trials): np.random.seed(1234 + i) uni.res...