text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Change file name to logger name in example settings | """
Example settings module.
This should be copied as `settings.py` and the values modified there.
That file is ignored by the repo, since it will contain environment
specific and sensitive information (like passwords).
"""
import logging
import os
import re
import yaml
from imap import EmailCheckError, EmailServe... | """
Example settings module.
This should be copied as `settings.py` and the values modified there.
That file is ignored by the repo, since it will contain environment
specific and sensitive information (like passwords).
"""
import logging
import os
import re
import yaml
from imap import EmailCheckError, EmailServe... |
Add comments to gulp file | var git = require('gulp-git');
var gulp = require('gulp');
/*
* Release Tasks
*/
// Git Tag
gulp.task('publish:tag', function(done) {
// get the version from package.json
var pkg = JSON.parse(require('fs').readFileSync('./package.json'));
// prepend the 'v'
var v = 'v' + pkg.version;
// Tag message
va... | var git = require('gulp-git');
var gulp = require('gulp');
/**
* Release Tasks
*/
gulp.task('publish:tag', function(done) {
var pkg = JSON.parse(require('fs').readFileSync('./package.json'));
var v = 'v' + pkg.version;
var message = 'Release ' + v;
git.tag(v, message, function (err) {
if (err) throw er... |
Save request in new m2m filed | from .models import Campaign, InformationObject
def connect_info_object(sender, **kwargs):
reference = kwargs.get('reference')
if not reference:
return
if not reference.startswith('campaign:'):
return
namespace, campaign_value = reference.split(':', 1)
try:
campaign, slug =... | from .models import Campaign, InformationObject
def connect_info_object(sender, **kwargs):
reference = kwargs.get('reference')
if not reference:
return
if not reference.startswith('campaign:'):
return
namespace, campaign_value = reference.split(':', 1)
try:
campaign, slug =... |
Use project member email if given | # -*- coding: utf-8 -*-
"""
folivora.utils.notification
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Framework for user/project notifications.
"""
from django.conf import settings
from django.template import loader
from django.core.mail import send_mail
def route_notifications(*log_entries):
for entry in log_entries:... | # -*- coding: utf-8 -*-
"""
folivora.utils.notification
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Framework for user/project notifications.
"""
from django.conf import settings
from django.template import loader
from django.core.mail import send_mail
def route_notifications(*log_entries):
for entry in log_entries:... |
Remove silly stylism for "( document )" | /**
* Interactive features for the external menus functionality
*
* This piece of JS is loaded on both the list view app for the
* epfl-external-menu custom post type, and in the Appearance -> Menus
* screen (although at the moment it does nothing on the latter).
*/
/**
* Activate the app on the epfl-external-m... | /**
* Interactive features for the external menus functionality
*
* This piece of JS is loaded on both the list view app for the
* epfl-external-menu custom post type, and in the Appearance -> Menus
* screen (although at the moment it does nothing on the latter).
*/
/**
* Activate the app on the epfl-external-m... |
Return a 404 response when a blog post isn't found. | package uk.co.todddavies.website.blog;
import com.google.common.collect.ImmutableMap;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.google.template.soy.jbcsrc.api.SoySauce;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.... | package uk.co.todddavies.website.blog;
import com.google.common.collect.ImmutableMap;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.google.template.soy.jbcsrc.api.SoySauce;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.... |
Change default timeout value to 2 minutes. JM-1002
git-svn-id: 4206c2c2bb40b5782672a0d03c2c381094954de9@7557 b35dd754-fafc-0310-a699-88a17e54d16e | /**
* $Revision: $
* $Date: $
*
* Copyright (C) 2007 Jive Software. All rights reserved.
*
* This software is published under the terms of the GNU Public License (GPL),
* a copy of which is included in this distribution.
*/
package org.jivesoftware.wildfire.nio;
import org.apache.mina.common.IoSes... | /**
* $Revision: $
* $Date: $
*
* Copyright (C) 2007 Jive Software. All rights reserved.
*
* This software is published under the terms of the GNU Public License (GPL),
* a copy of which is included in this distribution.
*/
package org.jivesoftware.wildfire.nio;
import org.apache.mina.common.IoSes... |
Test export email return an HttpResponse | from django.test import TestCase
from django.http import HttpResponse
from django.contrib.admin.sites import AdminSite
from django.contrib.auth.models import User
from billjobs.admin import UserAdmin
class EmailExportTestCase(TestCase):
""" Tests for email account export """
def test_method_is_avaible(self):
... | from django.test import TestCase
from django.contrib.admin.sites import AdminSite
from billjobs.admin import UserAdmin
class EmailExportTestCase(TestCase):
""" Tests for email account export """
def test_method_is_avaible(self):
""" Test admin can select the action in dropdown list """
self.as... |
Revert "added jquery 4 bence"
This reverts commit 036c16bdaeac0d5c4dc3105dcff35f9e61857ca3. | <?
//Start of index.php
require_once('engine/require.php');
require_once('engine/includes/motor.php');
?>
<!DOCTYPE HTML>
<html><head>
<meta charset="utf-8">
<title>VPG Blog</title>
<link rel="stylesheet" type="text/css" href="./assets/style/style.css" />
</head><body>
<div id="fejlecKontener">
<header>
<h1... | <?
//Start of index.php
require_once('engine/require.php');
require_once('engine/includes/motor.php');
?>
<!DOCTYPE HTML>
<html><head>
<meta charset="utf-8">
<title>VPG Blog</title>
<link rel="stylesheet" type="text/css" href="./assets/style/style.css" />
</head><body onload="JSL('assets/style/main.js');">
<s... |
Load plugins from entry point | """Statistical models for biomolecular dynamics"""
from __future__ import print_function, absolute_import, division
import sys
from ..cmdline import App
from ..commands import *
from ..version import version
# the commands register themselves when they're imported
# Load external commands which register themselves
# w... | """Statistical models for biomolecular dynamics"""
from __future__ import print_function, absolute_import, division
import sys
from ..cmdline import App
from ..commands import *
from ..version import version
# the commands register themselves when they're imported
class MSMBuilderApp(App):
def _subcommands(self):... |
Mark this test as a known failure to return the bots to blue | # TestREPLPOReplType.py
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See http://swift.org/LICENSE.txt for license information
# See http://swift.org/CONTRIB... | # TestREPLPOReplType.py
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See http://swift.org/LICENSE.txt for license information
# See http://swift.org/CONTRIB... |
Decrease reset delay to 10 seconds. | /*global CpuSolver GpuSolver Maze */
var RESET_DELAY = 10 * 1000;
function nearest(dim, scale) {
var floor = Math.floor(dim / scale);
return (floor % 2 == 0) ? floor - 1 : floor;
}
var solver = null;
function init() {
var canvas = $('#display')[0],
scale = 14,
w = nearest(canvas.width, sc... | /*global CpuSolver GpuSolver Maze */
var RESET_DELAY = 30 * 1000;
function nearest(dim, scale) {
var floor = Math.floor(dim / scale);
return (floor % 2 == 0) ? floor - 1 : floor;
}
var solver = null;
function init() {
var canvas = $('#display')[0],
scale = 14,
w = nearest(canvas.width, sc... |
Format expected checkin as Y-m-d in form | <!-- Purchase Date -->
<div class="form-group {{ $errors->has('purchase_date') ? ' has-error' : '' }}">
<label for="purchase_date" class="col-md-3 control-label">{{ trans('general.purchase_date') }}</label>
<div class="input-group col-md-3">
<div class="input-group date" data-provide="datepicker" data-dat... | <!-- Purchase Date -->
<div class="form-group {{ $errors->has('purchase_date') ? ' has-error' : '' }}">
<label for="purchase_date" class="col-md-3 control-label">{{ trans('general.purchase_date') }}</label>
<div class="input-group col-md-3">
<div class="input-group date" data-provide="datepicker" data-dat... |
Make the status data migration optional | # -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-08-15 14:58
from __future__ import unicode_literals
from django.db import migrations
def update_status_names(apps, schema_editor):
ProjectPhase = apps.get_model('bb_projects', 'ProjectPhase')
updates = {
'plan-new': 'Plan - Draft',
... | # -*- coding: utf-8 -*-
# Generated by Django 1.9.6 on 2016-08-15 14:58
from __future__ import unicode_literals
from django.db import migrations
def update_status_names(apps, schema_editor):
ProjectPhase = apps.get_model('bb_projects', 'ProjectPhase')
updates = {
'plan-new': 'Plan - Draft',
... |
Allow comma-separated values for --previewAttr. | #!/usr/bin/env node
/**
* Parse and insert all log lines in a path.
*/
'use strict';
var program = require('commander');
var splitCsv = function(list) {
return list.split(',');
}
// Support all attributes normally defined by config.js.
program
.option('-p, --parser <name>', 'Ex. nginx_access')
.option('-P,... | #!/usr/bin/env node
/**
* Parse and insert all log lines in a path.
*/
'use strict';
var program = require('commander');
// Support all attributes normally defined by config.js.
program
.option('-p, --parser <name>', 'Ex. nginx_access')
.option('-P, --path <file>', 'Ex. /var/log/nginx/access.log')
.option('... |
Add a helper to iterate over all endpoint types in a context store
Unused for now.
Signed-off-by: Ian Campbell <a8db091655a7f47ecb9c39a2d278e9662e440dc0@docker.com> | package store
// TypeGetter is a func used to determine the concrete type of a context or
// endpoint metadata by returning a pointer to an instance of the object
// eg: for a context of type DockerContext, the corresponding TypeGetter should return new(DockerContext)
type TypeGetter func() interface{}
// NamedTypeGe... | package store
// TypeGetter is a func used to determine the concrete type of a context or
// endpoint metadata by returning a pointer to an instance of the object
// eg: for a context of type DockerContext, the corresponding TypeGetter should return new(DockerContext)
type TypeGetter func() interface{}
// NamedTypeGe... |
Change method order to match filters | import datetime
from tenyksservice import TenyksService, run_service
from ddate.base import DDate
class DiscordianDate(TenyksService):
direct_only = True
irc_message_filters = {
'date': [r'^(?i)(ddate|discordian) (?P<month>(.*)) (?P<day>(.*)) (?P<year>(.*))'],
'today': [r'^(?i)(ddate|discordian... | import datetime
from tenyksservice import TenyksService, run_service
from ddate.base import DDate
class DiscordianDate(TenyksService):
direct_only = True
irc_message_filters = {
'date': [r'^(?i)(ddate|discordian) (?P<month>(.*)) (?P<day>(.*)) (?P<year>(.*))'],
'today': [r'^(?i)(ddate|discordian... |
Fix brownie points not showing on react pages | import { Observable } from 'rx';
import { handleError, setUser, fetchUser } from './types';
export default ({ services }) => ({ dispatch }) => next => {
return function getUserSaga(action) {
if (action.type !== fetchUser) {
return next(action);
}
return services.readService$({ service: 'user' })
... | import { Observable } from 'rx';
import { handleError, setUser, fetchUser } from './types';
export default ({ services }) => ({ dispatch }) => next => {
return function getUserSaga(action) {
if (action.type !== fetchUser) {
return next(action);
}
return services.readService$({ service: 'user' })
... |
Use local etcd for testing | var _ = require('lodash');
var defaultConfig = {
database: {
backend: 'leveldown',
file: __dirname + '/data/baixs.db'
},
etcd: {
host: 'racktables.hupu.com',
port: '4001',
},
zabbix: {
url: '',
user: '',
password: '',
},
};
var config = {
development: function() {
return ... | var _ = require('lodash');
var defaultConfig = {
database: {
backend: 'leveldown',
file: __dirname + '/data/baixs.db'
},
etcd: {
host: 'racktables.hupu.com',
port: '4001',
},
zabbix: {
url: 'http://al.zabbix.hupu.com/api_jsonrpc.php',
user: 'admin',
password: '',
},
};
var conf... |
Fix jest env template value | module.exports = {
env: {
amd: <%= (moduleFormat === 'amd') %>,
commonjs: <%= (moduleFormat === 'commonjs') %>,
es6: true,
browser: true,
jquery: true,
mocha: <%= !useJest %>,
jest: <%= !!useJest %>
},
globals: {
sinon: true
},
extends:... | module.exports = {
env: {
amd: <%= (moduleFormat === 'amd') %>,
commonjs: <%= (moduleFormat === 'commonjs') %>,
es6: true,
browser: true,
jquery: true,
mocha: <%= !useJest %>,
jest: <%= useJest %>
},
globals: {
sinon: true
},
extends: '... |
Use json rather than simplejson | import json
from django.http import HttpResponse
class JSONResponseMixin(object):
"""
A Mixin that renders context as a JSON response
"""
def render_to_response(self, context):
"""
Returns a JSON response containing 'context' as payload
"""
return self.get_json_response... | import simplejson as json
from django.http import HttpResponse
class JSONResponseMixin(object):
"""
A Mixin that renders context as a JSON response
"""
def render_to_response(self, context):
"""
Returns a JSON response containing 'context' as payload
"""
return self.get... |
Make the example more informative | """
This example:
1. Connects to the current model
2. Deploy a bundle and waits until it reports itself active
3. Upgrades the charm with a local path
4. Destroys the units and applications
"""
from juju import jasyncio
from juju.model import Model
async def main():
model = Model()
print('Connecting to mode... | """
This example:
1. Connects to the current model
2. Deploy a bundle and waits until it reports itself active
3. Destroys the units and applications
"""
from juju import jasyncio
from juju.model import Model
async def main():
model = Model()
print('Connecting to model')
# Connect to current model with ... |
Fix scroll Component when the page is updated but the feature didn't change | import React from 'react'
import Card from '../util/View/Card'
import {PageTitle} from '../util/View/Title'
import {Meta} from '../util/View/Meta'
import FeatureList from '../Feature/List'
import Dependencies from './Dependencies'
const ComponentDetails = ({component}) => <Dependencies component={component} />
const ... | import React from 'react'
import Card from '../util/View/Card'
import {PageTitle} from '../util/View/Title'
import {Meta} from '../util/View/Meta'
import FeatureList from '../Feature/List'
import Dependencies from './Dependencies'
const ComponentDetails = ({component}) => <Dependencies component={component} />
const ... |
Fix Auth API key check causing error 500s | from django.http import HttpResponseForbidden
from django.contrib.auth.models import AnonymousUser
from api.models import AuthAPIKey
class APIKeyAuthentication(object):
def is_authenticated(self, request):
params = {}
for key,value in request.GET.items():
params[key.lower()] = value
... | from django.http import HttpResponseForbidden
from django.contrib.auth.models import AnonymousUser
from api.models import AuthAPIKey
class APIKeyAuthentication(object):
def is_authenticated(self, request):
params = {}
for key,value in request.GET.items():
params[key.lower()] = value
... |
:fire: Remove declaring non-interface public method | <?php
/**
* Vainyl
*
* PHP Version 7
*
* @package Core
* @license https://opensource.org/licenses/MIT MIT License
* @link https://vainyl.com
*/
declare(strict_types=1);
namespace Vainyl\Core\Renderer\Decorator;
use Vainyl\Core\AbstractIdentifiable;
use Vainyl\Core\IdentifiableInterface;
use Vainyl\Co... | <?php
/**
* Vainyl
*
* PHP Version 7
*
* @package Core
* @license https://opensource.org/licenses/MIT MIT License
* @link https://vainyl.com
*/
declare(strict_types=1);
namespace Vainyl\Core\Renderer\Decorator;
use Vainyl\Core\AbstractIdentifiable;
use Vainyl\Core\IdentifiableInterface;
use Vainyl\Co... |
ENH: Add Choose node to imported nodes | ################################################################################
# Copyright (C) 2011-2012 Jaakko Luttinen
#
# This file is licensed under the MIT License.
################################################################################
# Import some most commonly used nodes
from . import *
from .b... | ################################################################################
# Copyright (C) 2011-2012 Jaakko Luttinen
#
# This file is licensed under the MIT License.
################################################################################
# Import some most commonly used nodes
from . import *
from .b... |
Use request.defaults() to simplify testing | const app = require('../app');
const requestPromiseNative = require('request-promise-native');
const seeds = require('../lib/seeds');
const seedData = require('./seedData');
describe('app', () => {
const request = requestPromiseNative.defaults({ baseUrl: 'http://localhost:3000/' });
beforeAll(() => seeds(seedData... | const app = require('../app');
const request = require('request-promise-native');
const seeds = require('../lib/seeds');
const seedData = require('./seedData');
describe('app', () => {
beforeAll(() => seeds(seedData));
beforeAll(done => app.listen(3000, done));
describe('GET /', () => {
it('responds with su... |
Remove all jenkins-specific bits and bobs | <?php
use Doctrine\Common\Annotations\AnnotationRegistry;
$loader = require __DIR__.'/../vendor/autoload.php';
// intl
if (!function_exists('intl_get_error_code')) {
require_once __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php';
$loader->add('', __DIR__.'/../ve... | <?php
use Doctrine\Common\Annotations\AnnotationRegistry;
$loader = require __DIR__.'/../vendor/autoload.php';
// intl
if (!function_exists('intl_get_error_code')) {
require_once __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php';
$loader->add('', __DIR__.'/../ve... |
Fix invalid use of $this | <?php
/**
* Show a warning to an user about the SP requesting SSO a short time after
* doing it previously.
*
* @package SimpleSAMLphp
*/
if (!array_key_exists('StateId', $_REQUEST)) {
throw new \SimpleSAML\Error\BadRequest('Missing required StateId query parameter.');
}
$id = $_REQUEST['StateId'];
$state = ... | <?php
/**
* Show a warning to an user about the SP requesting SSO a short time after
* doing it previously.
*
* @package SimpleSAMLphp
*/
if (!array_key_exists('StateId', $_REQUEST)) {
throw new \SimpleSAML\Error\BadRequest('Missing required StateId query parameter.');
}
$id = $_REQUEST['StateId'];
$state = ... |
Make exception mapper more accurate on jax-rs internal error | package fr.insee.pogues.webservice.rest;
import org.apache.log4j.Logger;
import javax.ws.rs.NotFoundException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.ext.Provider;
/**
* Created by acord... | package fr.insee.pogues.webservice.rest;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.ext.Provider;
/**
* Created by acordier on 04/07/17.
*/
@Provider
public class GenericExceptionMapper impl... |
[DuckDB] Test DuckDB only with one thread due to multithreading issues | package sqlancer;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
public class TestMain {
private static final String NUM_QUERIES = "1000";
private static final String SECONDS = "300";
@Test
public void testDuckDB() {
// run with one thread du... | package sqlancer;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
public class TestMain {
private static final String NUM_QUERIES = "1000";
private static final String SECONDS = "300";
@Test
public void testDuckDB() {
assertEquals(0, Main.exec... |
Make the example test run without requiring local server | var util = require('util'),
webdriver = require('selenium-webdriver'),
chrome = require('selenium-webdriver/chrome'),
retry = require('./index.js');
// Assumes that there is a chromedriver binary in the same directory.
var driver = chrome.createDriver(
new webdriver.Capabilities({'browserName': 'chrome... | var util = require('util'),
webdriver = require('selenium-webdriver'),
chrome = require('selenium-webdriver/chrome'),
retry = require('./index.js');
var driver = chrome.createDriver(
new webdriver.Capabilities({'browserName': 'chrome'}),
new chrome.ServiceBuilder('./chromedriver').build());
driver... |
Use mirrored system images with "mirrored" prefix | package v3
import (
projectv3 "github.com/rancher/rancher/pkg/apis/project.cattle.io/v3"
)
var (
ToolsSystemImages = struct {
PipelineSystemImages projectv3.PipelineSystemImages
AuthSystemImages AuthSystemImages
}{
PipelineSystemImages: projectv3.PipelineSystemImages{
Jenkins: "rancher/pipeline-... | package v3
import (
projectv3 "github.com/rancher/rancher/pkg/apis/project.cattle.io/v3"
"github.com/rancher/rke/types/image"
)
var (
m = image.Mirror
ToolsSystemImages = struct {
PipelineSystemImages projectv3.PipelineSystemImages
AuthSystemImages AuthSystemImages
}{
PipelineSystemImages: projectv3.P... |
[HOUSEKEEPING] Use Factory class from module instead of from __init__ | # -*- coding: utf-8 -*-
import os
from infcommon.factory import Factory
from infcommon.postgres.postgres import PostgresClient
def postgres_client_from_connection_parameters(user, password, host, port, db_name):
connection_uri = 'postgresql://{user}:{password}@{host}:{port}/{db_name}'.format(user=user, password=... | # -*- coding: utf-8 -*-
import os
from infcommon import Factory
from infcommon.postgres.postgres import PostgresClient
def postgres_client_from_connection_parameters(user, password, host, port, db_name):
connection_uri = 'postgresql://{user}:{password}@{host}:{port}/{db_name}'.format(user=user, password=password... |
Fix wrong table preferrence for role_user | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateRoleUserTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('role_user', function (Blueprint $table)
{
... | <?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateRoleUserTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('role_user', function (Blueprint $table)
{
... |
Work around sometimes getting invalid coordinates | /**
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to... | /**
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to... |
Change default subcommand to "source random" | import sys
from redcmd.api import execute_commandline
def main():
from .db.manage.db import DB
db = DB()
response = db.check()
from util.printer import printer
response and printer.printf('program maintenance', response)
from .util import log
from .db.app.config import Config, ConfigError
from . import c... | import sys
from redcmd.api import execute_commandline
def main():
from .db.manage.db import DB
db = DB()
response = db.check()
from util.printer import printer
response and printer.printf('program maintenance', response)
from .util import log
from .db.app.config import Config, ConfigError
from . import c... |
Fix stats files language issues
- If you used forced_lang stats files were in this language which is bad.
- Force english! | <?php
// -----------------------------------------------------------------------------------------------------------
// Pokemons datas
// Total pokemon available
// -----------------------------------------------------------------------------------------------------------
// This file is used to rank by rarity
/... | <?php
// -----------------------------------------------------------------------------------------------------------
// Pokemons datas
// Total pokemon available
// -----------------------------------------------------------------------------------------------------------
// This file is used to rank by rarity
/... |
Add note that lazy-installed modules are once-off only. | var canihaz = require('canihaz'),
fs = require('fs'),
p = require('path');
/**
* Install dependency modules that are not yet installed, and needed for executing the tasks.
*
* @param {Array} depNames: an array of dependency module names
* @param {String} dir: application directory where node_modules dir is loc... | var canihaz = require('canihaz'),
fs = require('fs'),
p = require('path');
/**
* Install dependency modules that are not yet installed, and needed for executing the tasks.
*
* @param {Array} depNames: an array of dependency module names
* @param {String} dir: application directory where node_modules dir is loc... |
Add nose to tests dependencies | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(
name='OpenFisca-Country-Template',
version='0.1.0',
author='OpenFisca Team',
author_email='contact@openfisca.fr',
description=u'Template of a tax and benefit system for OpenFisca',
keywords='ben... | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(
name='OpenFisca-Country-Template',
version='0.1.0',
author='OpenFisca Team',
author_email='contact@openfisca.fr',
description=u'Template of a tax and benefit system for OpenFisca',
keywords='ben... |
Mark gateway as transparent redirect | <?php
namespace Omnipay\Eway;
use Omnipay\Common\AbstractGateway;
/**
* eWAY Rapid 3.0 Gateway
*/
class RapidGateway extends AbstractGateway
{
public $transparentRedirect = true;
public function getName()
{
return 'eWAY Rapid 3.0';
}
public function getDefaultParameters()
{
... | <?php
namespace Omnipay\Eway;
use Omnipay\Common\AbstractGateway;
/**
* eWAY Rapid 3.0 Gateway
*/
class RapidGateway extends AbstractGateway
{
public function getName()
{
return 'eWAY Rapid 3.0';
}
public function getDefaultParameters()
{
return array(
'apiKey' => '... |
Fix for unit test. Removed empty tests. | <?php
/**
* @package elemental
* @subpackage tests
*/
class ElementPageExtensionTests extends FunctionalTest {
protected static $fixture_file = 'elemental/tests/fixtures.yml';
public function setUp() {
parent::setUp();
Page::add_extension('ElementPageExtension');
}
public functio... | <?php
/**
* @package elemental
* @subpackage tests
*/
class ElementPageExtensionTests extends FunctionalTest {
protected static $fixture_file = 'elemental/tests/fixtures.yml';
public function setUp() {
parent::setUp();
Page::add_extension('ElementPageExtension');
}
public functio... |
Adjust for TED urls without html suffix | <?php
/**
* Ted.php
*
* @package Providers
* @author Michael Pratt <pratt@hablarmierda.net>
* @link http://www.michael-pratt.com/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Embera\Providers;
/**
* The ted.com ... | <?php
/**
* Ted.php
*
* @package Providers
* @author Michael Pratt <pratt@hablarmierda.net>
* @link http://www.michael-pratt.com/
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Embera\Providers;
/**
* The ted.com ... |
Add windows 10 to browserstack tests | const base = require('./karma.base.conf');
module.exports = function(config) {
config.set(Object.assign(base, {
browserStack: {
username: process.env.BROWSERSTACK_USERNAME,
accessKey: process.env.BROWSERSTACK_ACCESS_KEY
},
customLaunchers: {
bs_safari_mac: {
base: 'BrowserStack',
browser: 'saf... | const base = require('./karma.base.conf');
module.exports = function(config) {
config.set(Object.assign(base, {
browserStack: {
username: process.env.BROWSERSTACK_USERNAME,
accessKey: process.env.BROWSERSTACK_ACCESS_KEY
},
customLaunchers: {
bs_safari_mac: {
base: 'BrowserStack',
browser: 'saf... |
Update logic in getBaseUrl determining if SSL is being used, to match http hook | /**
* Module dependencies
*/
var _ = require ('lodash');
/**
* Calculate the base URL (useful in emails, etc.)
* @return {String} [description]
*/
module.exports = function getBaseurl() {
var sails = this;
var usingSSL = sails.config.ssl === true || (sails.config.ssl && ((sails.config.ssl.key && sails.c... | /**
* Module dependencies
*/
var _ = require ('lodash');
/**
* Calculate the base URL (useful in emails, etc.)
* @return {String} [description]
*/
module.exports = function getBaseurl() {
var sails = this;
var usingSSL = sails.config.ssl && sails.config.ssl.key && sails.config.ssl.cert;
var host = sai... |
Validate date filter for event | <?php
namespace App\Http\Controllers;
use App\Event;
use Carbon\Carbon;
use Illuminate\Http\Request;
class EventsController extends Controller
{
public function show(Event $event)
{
return view('events.show', compact('event'));
}
public function index(Request $request)
{
$this->validate($request, ... | <?php
namespace App\Http\Controllers;
use App\Event;
use Carbon\Carbon;
use Illuminate\Http\Request;
class EventsController extends Controller
{
public function show(Event $event)
{
return view('events.show', compact('event'));
}
public function index(Request $request)
{
$before = $request->get('b... |
Change rollbarLogger & sentryLogger to be conditionally used | const winston = require('winston');
const util = require('util');
const transports = [new winston.transports.Console()];
if (process.env.SENTRY_DSN) {
const Raven = require('raven');
const sentryLogger = winston.transports.CustomLogger = function () {
this.name = 'sentryLogger';
this.level = 'error';
};
... | const winston = require('winston');
const util = require('util');
const transports = [new winston.transports.Console()];
const Rollbar = require('rollbar');
const rollbar = new Rollbar('ff3ef8cca74244eabffb17dc2365e7bb');
const rollbarLogger = winston.transports.CustomLogger = function () {
this.name = 'rollbarLogg... |
Make sure to install the tap. | import os
from setuptools import find_packages, setup
from great import __url__
with open(os.path.join(os.path.dirname(__file__), "README.rst")) as readme:
long_description = readme.read()
classifiers = [
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: MIT License",
"Operating System... | import os
from setuptools import find_packages, setup
from great import __url__
with open(os.path.join(os.path.dirname(__file__), "README.rst")) as readme:
long_description = readme.read()
classifiers = [
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: MIT License",
"Operating System... |
Use requests built-in .json(), pass verify=False. | import requests
import logging
from glanerbeard import show
log = logging.getLogger(__name__)
class Server:
def __init__(self, name, url, apikey):
self.name = name
self.url = url
self.apikey = apikey
def requestJson(self, path):
url = '{url}/api/{apikey}{path}'.format(url=self.url,apikey=self.apikey,path=pa... | import requests
import json
import logging
from glanerbeard import show
log = logging.getLogger(__name__)
class Server:
def __init__(self, name, url, apikey):
self.name = name
self.url = url
self.apikey = apikey
def requestJson(self, path):
url = '{url}/api/{apikey}{path}'.format(url=self.url,apikey=self.ap... |
Allow int(msg) and float(msg) calls | # The main message class that the AuthChannel operate on
class AuthenticatedMessage(object):
def __init__(self, sender, msg, session=None):
self.sender = sender
self.msg = msg
self.session = session
def __str__(self):
return self.msg
def __int__(self):
return int(s... | # The main message class that the AuthChannel operate on
class AuthenticatedMessage(object):
def __init__(self, sender, msg, session=None):
self.sender = sender
self.msg = msg
self.session = session
def __str__(self):
return self.msg
class NutsError(Exception):
""" General... |
Fix add to cart JS for compatibility with group buy | /**
* Update the price on the product details page in real time when the variant or the quantity are changed.
**/
$(document).ready(function() {
// Product page with variant choice
$("#product-variants input[type='radio']").change(products_update_price_with_variant);
$("#quantity").change(products_update_price... | /**
* Update the price on the product details page in real time when the variant or the quantity are changed.
**/
$(document).ready(function() {
// Product page with variant choice
$("#product-variants input[type='radio']").change(products_update_price_with_variant);
$("#quantity").change(products_update_price... |
Add doc string to prescriptSummaryRow | /* eslint-disable react/forbid-prop-types */
/**
* mSupply Mobile
* Sustainable Solutions (NZ) Ltd. 2019
*/
import React from 'react';
import { View, StyleSheet } from 'react-native';
import PropTypes from 'prop-types';
import { NumberLabelRow } from './NumberLabelRow';
import { DetailRow } from './DetailRow';
impo... | /* eslint-disable react/forbid-prop-types */
/**
* mSupply Mobile
* Sustainable Solutions (NZ) Ltd. 2019
*/
import React from 'react';
import { View, StyleSheet } from 'react-native';
import PropTypes from 'prop-types';
import { NumberLabelRow } from './NumberLabelRow';
import { DetailRow } from './DetailRow';
impo... |
Add classes to run ./configure | #
# Copyright (c) 2004 Specifix, Inc.
# All rights reserved
#
import os
import shutil
import util
class ManualConfigure:
def doBuild(self, dir):
os.system("cd %s; ./configure %s" % (dir, self.extraflags))
def __init__(self, extraflags=""):
self.extraflags = extraflags
class Configure:
def doBu... | #
# Copyright (c) 2004 Specifix, Inc.
# All rights reserved
#
import os
import shutil
import util
class Make:
def doBuild(self, dir):
os.system("cd %s; make" % dir)
class MakeInstall:
def doInstall(self, dir, root):
os.system("cd %s; make %s=%s install" % (dir, self.rootVar, root))
def __init__(self,... |
Set an initial selection area of 115 by 115 pixels. Added minimum (115 by 115 pixels) and maximum (300 by 300 pixels) sizes for cropping images | /* $This file is distributed under the terms of the license in /doc/license.txt$ */
(function($) {
$(window).load(function(){
var jcrop_api = $.Jcrop('#cropbox',{
onChange: showPreview,
onSelect: showPreview,
setSelect: [ 0, 0, 115, 115 ],
minSize: [115,115],
maxSize: [300,300],
aspectRatio: 1... | /* $This file is distributed under the terms of the license in /doc/license.txt$ */
(function($) {
$(window).load(function(){
var jcrop_api = $.Jcrop('#cropbox',{
onChange: showPreview,
onSelect: showPreview,
aspectRatio: 1
});
var bounds = jcrop_api.getBounds();
var boundx = bounds[0];
var boun... |
Add confLoaded event to ArethusaCtrl spec | "use strict";
describe('ArethusaCtrl', function() {
beforeEach(module('arethusa'));
it('sets scope values after conf has been loaded', inject(function($controller, $rootScope) {
var scope = $rootScope.$new();
var state = {
init: function() {},
allLoaded: false
};
var mainCtrlInits = ... | "use strict";
describe('ArethusaCtrl', function() {
beforeEach(module('arethusa'));
it('sets scope values', inject(function($controller, $rootScope) {
var scope = $rootScope.$new();
var state = {
init: function() {},
allLoaded: false
};
var mainCtrlInits = {
$scope: scope,
... |
Fix phpdoc for created_at and updated_at properties | <?php
namespace Isswp101\Persimmon\Traits;
use Carbon\Carbon;
trait Timestampable
{
/**
* @var string
*/
public $created_at;
/**
* @var string
*/
public $updated_at;
/**
* @return Carbon
*/
public function getCreatedAt()
{
return Carbon::parse($this... | <?php
namespace Isswp101\Persimmon\Traits;
use Carbon\Carbon;
trait Timestampable
{
/**
* @var Carbon
*/
public $created_at;
/**
* @var Carbon
*/
public $updated_at;
/**
* @return Carbon
*/
public function getCreatedAt()
{
return Carbon::parse($this... |
Use a faster blank object creator
http://justin.ridgewell.name/browser-benchmark/blank-object/index.html
Creation is 2-10x faster (depends on the browser), and access is the
same for both existent and non-existent properties. | /**
* Copyright 2015 The Incremental DOM 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 ... | /**
* Copyright 2015 The Incremental DOM 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 ... |
Fix race condition on containers retrieval
Signed-off-by: Carlos Pérez-Aradros Herce <a9fe7a739a79c3eddb29e5b128a9f0360449da12@gmail.com> | package project
import (
"fmt"
"sync"
"golang.org/x/net/context"
"github.com/docker/libcompose/project/events"
)
// Containers lists the containers for the specified services. Can be filter using
// the Filter struct.
func (p *Project) Containers(ctx context.Context, filter Filter, services ...string) ([]string... | package project
import (
"fmt"
"golang.org/x/net/context"
"github.com/docker/libcompose/project/events"
)
// Containers lists the containers for the specified services. Can be filter using
// the Filter struct.
func (p *Project) Containers(ctx context.Context, filter Filter, services ...string) ([]string, error)... |
DOC: Fix unicode in citation (again) | """
Define citations for ESPEI
"""
ESPEI_CITATION = "B. Bocklund, R. Otis, A. Egorov, A. Obaied, I. Roslyakova, Z.-K. Liu, ESPEI for efficient thermodynamic database development, modification, and uncertainty quantification: application to Cu-Mg, MRS Commun. (2019) 1-10. doi:10.1557/mrc.2019.59."
ESPEI_BIBTEX = """@ar... | """
Define citations for ESPEI
"""
ESPEI_CITATION = "B. Bocklund, R. Otis, A. Egorov, A. Obaied, I. Roslyakova, Z.-K. Liu, ESPEI for efficient thermodynamic database development, modification, and uncertainty quantification: application to Cu-Mg, MRS Commun. (2019) 1–10. doi:10.1557/mrc.2019.59."
ESPEI_BIBTEX = """@ar... |
Use "Walker" class instead of traverse()
for Ember 1.13 compat | /* eslint-env node */
var TEST_SELECTOR_PREFIX = /data-test-.*/;
function TransformTestSelectorParamsToHashPairs() {
this.syntax = null;
}
function isTestSelectorParam(param) {
return param.type === 'PathExpression'
&& TEST_SELECTOR_PREFIX.test(param.original);
}
TransformTestSelectorParamsToHashPairs.protot... | /* eslint-env node */
var TEST_SELECTOR_PREFIX = /data-test-.*/;
function TransformTestSelectorParamsToHashPairs() {
this.syntax = null;
}
function isTestSelectorParam(param) {
return param.type === 'PathExpression'
&& TEST_SELECTOR_PREFIX.test(param.original);
}
TransformTestSelectorParamsToHashPairs.protot... |
Add default encoding parameter to configure subcommand | #!/usr/bin/env python
# encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from __future__ import absolute_import
from __future__ import unicode_literals
import appconfigpy
from ._const import PROGRAM_NAME
class ConfigKey(object):
DEFAULT_ENCODING = "default_encoding"
... | #!/usr/bin/env python
# encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from __future__ import absolute_import
from __future__ import unicode_literals
import appconfigpy
from ._const import PROGRAM_NAME
class ConfigKey(object):
PROXY_SERVER = "proxy_server"
GS_CREDE... |
Load translator module with a relative path | var nroonga = require('nroonga');
var translator = require('./translator');
var Deferred = require('jsdeferred').Deferred;
function Processor(options) {
this.databasePath = options.databasePath;
this.domain = options.domain;
this.initialize();
}
Processor.prototype = {
initialize: function() {
this.databa... | var nroonga = require('nroonga');
var translator = require('translator');
var Deferred = require('jsdeferred').Deferred;
function Processor(options) {
this.databasePath = options.databasePath;
this.domain = options.domain;
this.initialize();
}
Processor.prototype = {
initialize: function() {
this.database... |
Update test to new package structure | import unittest
from datetime import datetime, timedelta
import sys
sys.path.append(r"../..")
from daymetpy import daymet_timeseries
class TimeseriesTest(unittest.TestCase):
def setUp(self):
pass
def test_ornl_df(self):
ornl_lat, ornl_long = 35.9313167, -84.3104124
df =... | import unittest
from datetime import datetime, timedelta
import sys
sys.path.append(r"..")
from daymetpy import download_Daymet
class TimeseriesTest(unittest.TestCase):
def setUp(self):
pass
def test_ornl_df(self):
ornl_lat, ornl_long = 35.9313167, -84.3104124
df = down... |
Handle REG_MULTI_SZ.toString when there the value is null (i.e., raw data is a single \0, not a double \0\0). | // Copyright (C) 2011 jOVAL.org. All rights reserved.
// This software is licensed under the AGPL 3.0 license available at http://www.joval.org/agpl_v3.txt
package org.joval.os.windows.registry;
import org.joval.intf.windows.registry.IKey;
import org.joval.intf.windows.registry.IMultiStringValue;
/**
* Re... | // Copyright (C) 2011 jOVAL.org. All rights reserved.
// This software is licensed under the AGPL 3.0 license available at http://www.joval.org/agpl_v3.txt
package org.joval.os.windows.registry;
import org.joval.intf.windows.registry.IKey;
import org.joval.intf.windows.registry.IMultiStringValue;
/**
* Re... |
Add user role restriction to the app abstract state | 'use strict';
angular.module('module.core').config(function($stateProvider, USER_ROLES) {
$stateProvider
.state('app', {
abstract: true,
url: '/app',
templateUrl: 'modules/core/views/layouts/app.html',
controller: 'AppCtrl as app',
data: {
authorizedRoles: [USER_ROLES.regist... | 'use strict';
angular.module('module.core').config(function($stateProvider, USER_ROLES) {
$stateProvider
.state('app', {
abstract: true,
url: '/app',
templateUrl: 'modules/core/views/layouts/app.html',
controller: 'AppCtrl as app',
})
.state('page', {
abstract: true,
u... |
Convert two .set() calls into one .update() | "use strict";
var db = require("./firebase");
// Ensure the updated timestamp is always accurate-ish
module.exports = function(ref) {
ref.on("child_changed", function(snap) {
var key = snap.key(),
auth;
// Avoid looping forever
if(key === "updated_at" || key === "updat... | "use strict";
var db = require("./firebase");
// Ensure the updated timestamp is always accurate-ish
module.exports = function(ref) {
ref.on("child_changed", function(snap) {
var key = snap.key(),
auth;
// Avoid looping forever
if(key === "updated_at" || key === "updat... |
Make sure we can search names with ' | import re
from django.contrib.postgres.search import SearchQuery, SearchRank
from django.db.models import Count, F
from people.models import Person
def search_person_by_name(name, synonym=True):
name = name.lower()
name = re.sub(r"[^a-z ]", " ", name)
name = " ".join(name.strip().split())
and_name =... | import re
from django.contrib.postgres.search import SearchQuery, SearchRank
from django.db.models import Count, F
from people.models import Person
def search_person_by_name(name, synonym=True):
name = name.lower()
name = re.sub(r"[^a-z ]", "", name)
name = " ".join(name.strip().split())
and_name = ... |
Disable Firefox specs because the runner consistently crashes | // Karma configuration
// Generated on Fri Dec 05 2014 16:49:29 GMT-0500 (EST)
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['jspm', 'jasmine'],
jspm: {
loadFiles: ['test/helpers.js', 'src/**/*.js', 'test/**/*.js']
},
files: [
'src/**/*.html', 'src/**/*.css', 'test/**/*.h... | // Karma configuration
// Generated on Fri Dec 05 2014 16:49:29 GMT-0500 (EST)
module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['jspm', 'jasmine'],
jspm: {
loadFiles: ['test/helpers.js', 'src/**/*.js', 'test/**/*.js']
},
files: [
'src/**/*.html', 'src/**/*.css', 'test/**/*.h... |
Add test for invalid bearer token | from oauth2_consumer.middleware import AuthenticationMiddleware
from .test_cases import MiddlewareTestCase
class TestMiddleware(MiddlewareTestCase):
def test_no_token(self):
request = self.factory.get("/")
AuthenticationMiddleware().process_request(request)
self.asse... | from oauth2_consumer.middleware import AuthenticationMiddleware
from .test_cases import MiddlewareTestCase
class TestMiddleware(MiddlewareTestCase):
def test_no_token(self):
request = self.factory.get("/")
AuthenticationMiddleware().process_request(request)
self.asse... |
Fix not waiting for paper key approval | /* @flow */
import React, {Component} from 'react'
import {connect} from 'react-redux'
import HiddenString from '../../../util/hidden-string'
import {sawPaperKey} from '../../../actions/signup'
import Render from './index.render'
class Success extends Component {
render () {
return (
<Render
titl... | /* @flow */
import React, {Component} from 'react'
import {connect} from 'react-redux'
import HiddenString from '../../../util/hidden-string'
import {sawPaperKey} from '../../../actions/signup'
import Render from './index.render'
class Success extends Component {
render () {
return (
<Render
titl... |
Fix issue where pandas.Index doesn't have str method
(Index.str was only introduced in pandas 0.19.2) | import pandas as pd
def load_datadict(filepath, trim_index=True, trim_all=False):
df = pd.read_csv(filepath, index_col=0)
if trim_index:
df.index = df.index.to_series().str.strip()
if trim_all:
df = df.applymap(lambda x: x.strip() if type(x) is str else x)
return df
def insert_rows_at(... | import pandas as pd
def load_datadict(filepath, trim_index=True, trim_all=False):
df = pd.read_csv(filepath, index_col=0)
if trim_index:
df.index = df.index.str.strip()
if trim_all:
df = df.applymap(lambda x: x.strip() if type(x) is str else x)
return df
def insert_rows_at(main_df, ind... |
Add file sorting in the example script | #!/bin/python
# installation:
# pip install pytz pyuploadcare~=2.1.0
import pytz
from datetime import timedelta, datetime
import time
from pyuploadcare import conf
from pyuploadcare.api_resources import FileList, FilesStorage
MAX_LIFETIME = 30 # days
conf.pub_key = 'demopublickey'
conf.secret = 'demoprivatekey'
... | #!/bin/python
# installation:
# pip install pytz pyuploadcare~=2.1.0
import pytz
from datetime import timedelta, datetime
import time
from pyuploadcare import conf
from pyuploadcare.api_resources import FileList, FilesStorage
MAX_LIFETIME = 30 # days
conf.pub_key = 'demopublickey'
conf.secret = 'demoprivatekey'
... |
ui: Use ViewPlaceholder instead of custom code
Instead of using a custom View with custom styles use the
ViewPlaceholder component. | /* @flow */
import React, { PureComponent } from 'react';
import connectWithActions from '../connectWithActions';
import type { Actions } from '../types';
import { Screen, ViewPlaceholder, ZulipButton } from '../common';
type Props = {
actions: Actions,
};
class WelcomeScreen extends PureComponent<Props> {
props... | /* @flow */
import React, { PureComponent } from 'react';
import { View, StyleSheet } from 'react-native';
import connectWithActions from '../connectWithActions';
import type { Actions } from '../types';
import { Screen, ZulipButton } from '../common';
const componentStyles = StyleSheet.create({
divider: {
heig... |
Send router back to DI
The routes set here are not actually being set, it just coincidentally works with a single demo module due to the "defaultNamespace" set in services.php | <?php
$router = $di->get("router");
foreach ($application->getModules() as $key => $module) {
$namespace = str_replace('Module','Controllers', $module["className"]);
$router->add('/'.$key.'/:params', array(
'namespace' => $namespace,
'module' => $key,
'controller' => 'index',
'... | <?php
$router = $di->get("router");
foreach ($application->getModules() as $key => $module) {
$namespace = str_replace('Module','Controllers', $module["className"]);
$router->add('/'.$key.'/:params', array(
'namespace' => $namespace,
'module' => $key,
'controller' => 'index',
'... |
Update logdir after config was moved | <?php
namespace Redports\Master;
/**
* Configuration class to store various static settings.
*
* @author Bernhard Froehlich <decke@bluelife.at>
* @copyright 2015 Bernhard Froehlich
* @license BSD License (2 Clause)
*
* @link https://freebsd.github.io/redports/
*/
class Config
{
prot... | <?php
namespace Redports\Master;
/**
* Configuration class to store various static settings.
*
* @author Bernhard Froehlich <decke@bluelife.at>
* @copyright 2015 Bernhard Froehlich
* @license BSD License (2 Clause)
*
* @link https://freebsd.github.io/redports/
*/
class Config
{
prot... |
Add ssl random bytes generator | <?php
/**
* Class Csrf
*
* @package Faulancer\Security
* @author Florian Knapp <office@florianknapp.de>
*/
namespace Faulancer\Security;
use Faulancer\Session\SessionManager;
/**
* Class Csrf
*/
class Csrf
{
/**
* Generates a token and save it to session
* @return string
*/
public stati... | <?php
/**
* Class Csrf
*
* @package Faulancer\Security
* @author Florian Knapp <office@florianknapp.de>
*/
namespace Faulancer\Security;
use Faulancer\Session\SessionManager;
/**
* Class Csrf
*/
class Csrf
{
/**
* Generates a token and save it to session
* @return string
*/
public stati... |
Set `canRetransform` flag to `false` in instrumentation.
We do not need to retransform classes once they are loaded.
All instrumentation byte-code is pushed at loading time.
This fixes a problem with Java 7 that was failing to add
a transformer because we did not declare retransformation
capability in `MANIFEST.MF` f... | /* NEST (New Scala Test)
* Copyright 2007-2013 LAMP/EPFL
* @author Grzegorz Kossakowski
*/
package scala.tools.partest.javaagent;
import java.lang.instrument.Instrumentation;
import java.lang.instrument.UnmodifiableClassException;
/**
* Profiling agent that instruments byte-code to insert calls to
* {@link scal... | /* NEST (New Scala Test)
* Copyright 2007-2013 LAMP/EPFL
* @author Grzegorz Kossakowski
*/
package scala.tools.partest.javaagent;
import java.lang.instrument.Instrumentation;
import java.lang.instrument.UnmodifiableClassException;
/**
* Profiling agent that instruments byte-code to insert calls to
* {@link scal... |
Use Optional and supplier to match the servlet filter | import com.google.common.base.Optional;
import com.google.common.base.Supplier;
import com.sun.jersey.api.client.ClientHandlerException;
import com.sun.jersey.api.client.ClientRequest;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.filter.ClientFilter;
import org.slf4j.MDC;
import ja... | import com.sun.jersey.api.client.ClientHandlerException;
import com.sun.jersey.api.client.ClientRequest;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.filter.ClientFilter;
import org.slf4j.MDC;
import java.util.UUID;
public class RequestTrackerClientFilter extends ClientFilter {
... |
Fix jshint and missing semicolon | import Ember from 'ember';
import {module, test} from 'qunit';
import startApp from 'unicodeparty/tests/helpers/start-app';
let application;
function getChars() {
return new Set(Ember.$('.emoji-char').toArray().map(el => el.innerText));
}
module('Acceptance | search', {
beforeEach() {
application = startApp(... | import Ember from 'ember';
import {module, test} from 'qunit';
import startApp from 'unicodeparty/tests/helpers/start-app';
let application;
function getChars() {
return new Set(Ember.$('.emoji-char').toArray().map(el => el.innerText));
}
module('Acceptance | search', {
beforeEach() {
application = startApp(... |
Send plugin_activated event on activation. | /**
* Activation component.
*
* This JavaScript loads on every admin page. Reserved for later.
*
* Site Kit by Google, Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the ... | /**
* Activation component.
*
* This JavaScript loads on every admin page. Reserved for later.
*
* Site Kit by Google, Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the ... |
Bump version number to 0.5 | from setuptools import setup
with open('README.rst') as f:
long_desc = f.read()
setup(
name='ttrss-python',
version='0.5',
description='A client library for the Tiny Tiny RSS web API',
long_description=long_desc,
url='https://github.com/Vassius/ttrss-python',
author... | from setuptools import setup
with open('README.rst') as f:
long_desc = f.read()
setup(
name='ttrss-python',
version='0.4',
description='A client library for the Tiny Tiny RSS web API',
long_description=long_desc,
url='https://github.com/Vassius/ttrss-python',
author... |
Fix not movable map after drag zoom (web) | export default function dragZoom(map) {
const $map = map._container;
let isDoubleTap = false;
let isDragging = false;
let startZoom = 0;
let startY = 0;
$map.addEventListener('touchstart', (e) => {
// Cancel drag zoom with multiple fingers.
if (e.touches.length > 1) return (isDragging = false);
... | export default function dragZoom(map) {
const $map = map._container;
let isDoubleTap = false;
let isDragging = false;
let startZoom = 0;
let startY = 0;
$map.addEventListener('touchstart', (e) => {
// Cancel drag zoom with multiple fingers.
if (e.touches.length > 1) return (isDragging = false);
... |
Create a global variable to select each main component in the DOM | /*-----------------------------------------------------------------
Modular - JS Extension
Made by @esr360
http://github.com/esr360/Modular/
-----------------------------------------------------------------*/
//-----------------------------------------------------------------
// Convert CSS config to JS
//---------... | /*-----------------------------------------------------------------
Modular - JS Extension
Made by @esr360
http://github.com/esr360/Modular/
-----------------------------------------------------------------*/
//-----------------------------------------------------------------
// Convert CSS config to JS
//---------... |
Make ARIA attrs actually update. | $(function() {
var panelContent = $('#panel-content');
/**
* Toggles the ARIA expanded and hidden attributes' state.
*
* @param Object elem The element on which to toggle the attribute.
*/
function toggleAria(elem) {
var expandedState = elem.attr('aria-expanded') === 'true' ? 'f... | $(function() {
var panelContent = $('#panel-content');
/**
* Toggles the ARIA expanded and hidden attributes' state.
*
* @param Object elem The element on which to toggle the attribute.
*/
function toggleAria(elem) {
var expandedState = elem.attr('aria-expanded') === 'true' ? 'f... |
fix: Make the card name more clear on a multiple result | const utilities = require('./utilities');
const limited = (card) => card.limited ? ' | limited' : '';
const unique = (card) => card.unique ? ' | unique' : '';
const points = (card) => `${card.points}pt${card.points > 1 ? 's': ''}`;
const multiCard = (card) => `\n• *${card.name}* (${card.slot}) use \`/card ${ca... | const utilities = require('./utilities');
const limited = (card) => card.limited ? ' | limited' : '';
const unique = (card) => card.unique ? ' | unique' : '';
const points = (card) => `${card.points}pt${card.points > 1 ? 's': ''}`;
const multiCard = (card) => `\n• ${card.name} (${card.slot}) use \`/card ${card... |
Make sure @Dependency is marked as final | package arez.doc.examples.at_dependency;
import arez.annotations.ArezComponent;
import arez.annotations.Dependency;
import arez.annotations.Observable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@ArezComponent
public abstract class PersonViewModel
{
@Nonnull
private final Person _person;
... | package arez.doc.examples.at_dependency;
import arez.annotations.ArezComponent;
import arez.annotations.Dependency;
import arez.annotations.Observable;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@ArezComponent
public abstract class PersonViewModel
{
@Nonnull
private final Person _person;
... |
Add styles for buttons and author | var getGradient = function () {
var red1 = Math.floor(Math.random() * 256);
var green1 = Math.floor(Math.random() * 256);
var blue1 = Math.floor(Math.random() * 256);
var red2 = Math.floor(Math.random() * 256);
var green2 = Math.floor(Math.random() * 256);
var blue2 = Math.floor(Math.random() *... | var getGradient = function () {
var red1 = Math.floor(Math.random() * 256);
var green1 = Math.floor(Math.random() * 256);
var blue1 = Math.floor(Math.random() * 256);
var red2 = Math.floor(Math.random() * 256);
var green2 = Math.floor(Math.random() * 256);
var blue2 = Math.floor(Math.random() *... |
Fix undefined index notice bug | <?php
namespace JoeTannenbaum\PHPushbullet;
class Device {
/**
* The fields that we want to retrieve for the device
*
* @var array $fields
*/
protected $fields = [
'nickname',
'iden',
'model',
'type',
'active',
'pushable',
'manufacturer',
'created',
... | <?php
namespace JoeTannenbaum\PHPushbullet;
class Device {
/**
* The fields that we want to retrieve for the device
*
* @var array $fields
*/
protected $fields = [
'nickname',
'iden',
'model',
'type',
'active',
'pushable',
'manufacturer',
'created',
... |
Use new api docs urls | package main
import (
"github.com/dynport/dgtk/cli"
"github.com/phrase/phraseapp-go/phraseapp"
)
func ApplyNonRestRoutes(r *cli.Router, cfg *phraseapp.Config) {
r.Register("pull", &PullCommand{Config: *cfg}, "Download locales from your PhraseApp project.\n You can provide parameters supported by the locales#downl... | package main
import (
"github.com/dynport/dgtk/cli"
"github.com/phrase/phraseapp-go/phraseapp"
)
func ApplyNonRestRoutes(r *cli.Router, cfg *phraseapp.Config) {
r.Register("pull", &PullCommand{Config: *cfg}, "Download locales from your PhraseApp project.\n You can provide parameters supported by the locales#downl... |
Support Native Props For Lists | import React from 'react';
import {
ListView,
} from 'react-native';
import { List, ListItem } from 'react-native-elements';
import EmptyView from '../EmptyView';
export default (props) => {
const { loading, loadSuccess, data, dataSource, loadingTip, loadFailTip, emptyTip, renderRow, containerStyle = {}, ...other... | import React from 'react';
import {
ListView,
} from 'react-native';
import { List, ListItem } from 'react-native-elements';
import EmptyView from '../EmptyView';
export default ({ loading, loadSuccess, data, dataSource, loadingTip, loadFailTip, emptyTip, renderRow, containerStyle = {} }) => {
if (loading) {
... |
Test 4.2: use the max frame size from the server's SETTINGS frame
The test now does a settings handshake and uses the server's settings
to determine the max frame size (then sends a frame 1 byte longer).
Previously the test used the value of the default setting. | package h2spec
import (
"github.com/bradfitz/http2"
"github.com/bradfitz/http2/hpack"
)
func FrameSizeTestGroup() *TestGroup {
tg := NewTestGroup("4.2", "Frame Size")
tg.AddTestCase(NewTestCase(
"Sends large size frame that exceeds the SETTINGS_MAX_FRAME_SIZE",
"The endpoint MUST send a FRAME_SIZE_ERROR erro... | package h2spec
import (
"github.com/bradfitz/http2"
"github.com/bradfitz/http2/hpack"
)
func FrameSizeTestGroup() *TestGroup {
tg := NewTestGroup("4.2", "Frame Size")
tg.AddTestCase(NewTestCase(
"Sends large size frame that exceeds the SETTINGS_MAX_FRAME_SIZE",
"The endpoint MUST send a FRAME_SIZE_ERROR erro... |
joystick: Replace tabs by space in example
Signed-off-by: Francois Berder <59eaf4bb0211c66c3d7532da6d77ecf42a779d82@outlook.fr> | #!/usr/bin/env python3
"""This example shows how to use the Joystick Click wrapper of the LetMeCreate.
It continuously reads the position of the joystick, prints it in the terminal
and displays a pattern on the LED's based on the x coordinate.
The Joystick Click must be inserted in Mikrobus 1 before running this prog... | #!/usr/bin/env python3
"""This example shows how to use the Joystick Click wrapper of the LetMeCreate.
It continuously reads the position of the joystick, prints it in the terminal
and displays a pattern on the LED's based on the x coordinate.
The Joystick Click must be inserted in Mikrobus 1 before running this prog... |
Add a fix for changing empty option of depencendy fieldset only if a value was set before | <?php
namespace DlcUseCase\Form;
use DlcUseCase\Form\BasePriority;
use Zend\Form\Element;
use Zend\Form\Form as ZendForm;
use Zend\Form\FormInterface;
class EditUseCase extends BaseUseCase
{
public function init()
{
parent::init();
$this->setLabel('Edit use case');
}
public function ... | <?php
namespace DlcUseCase\Form;
use DlcUseCase\Form\BasePriority;
use Zend\Form\Element;
use Zend\Form\Form as ZendForm;
use Zend\Form\FormInterface;
class EditUseCase extends BaseUseCase
{
public function init()
{
parent::init();
$this->setLabel('Edit use case');
}
public function ... |
Load test 170 per process | 'use strict';
const config = {};
/**
* Heroku makes it available to help calculate correct concurrency
* @see https://devcenter.heroku.com/articles/node-concurrency#tuning-the-concurrency-level
*/
config.memoryAvailable = parseInt(process.env.MEMORY_AVAILABLE, 10);
/**
* Expected MAX memory footprint of a single c... | 'use strict';
const config = {};
/**
* Heroku makes it available to help calculate correct concurrency
* @see https://devcenter.heroku.com/articles/node-concurrency#tuning-the-concurrency-level
*/
config.memoryAvailable = parseInt(process.env.MEMORY_AVAILABLE, 10);
/**
* Expected MAX memory footprint of a single c... |
Remove www from footer links | import React from 'react'
import './style.scss'
const Footer = () => {
return (
<div className="footer container">
<hr/>
<div className="grid">
<p className="left">
© 2013 - { new Date().getUTCFullYear() } IPv6-adresse.dk
<span className="sep">·</span>
<a hr... | import React from 'react'
import './style.scss'
const Footer = () => {
return (
<div className="footer container">
<hr/>
<div className="grid">
<p className="left">
© 2013 - { new Date().getUTCFullYear() } IPv6-adresse.dk
<span className="sep">·</span>
<a hr... |
Make no gui test random all tracks | package test
import (
"bufio"
"fmt"
"math/rand"
"os"
"strings"
"github.com/fabiofalci/sconsify/events"
"github.com/fabiofalci/sconsify/spotify"
ui "github.com/fabiofalci/sconsify/ui"
"github.com/howeyc/gopass"
sp "github.com/op/go-libspotify/spotify"
)
func main2() {
username, pass := credentials()
event... | package test
import (
"bufio"
"fmt"
"os"
"strings"
"github.com/fabiofalci/sconsify/events"
"github.com/fabiofalci/sconsify/spotify"
"github.com/howeyc/gopass"
)
func main2() {
username, pass := credentials()
events := events.InitialiseEvents()
go spotify.Initialise(username, pass, events)
playlists := <-... |
Fix compiling problem for runtime variables | from Helpers.string import *
def binop_aexp(commands, env, op, left, right):
left.compile_vm(commands, env)
right.compile_vm(commands, env)
if op == '+':
value = assemble(Add)
elif op == '-':
value = assemble(Sub)
elif op == '*':
value = assemble(Mul)
elif op == '/':
... | from Helpers.string import *
def binop_aexp(commands, env, op, left, right):
left.compile_vm(commands, env)
right.compile_vm(commands, env)
if op == '+':
value = assemble(Add)
elif op == '-':
value = assemble(Sub)
elif op == '*':
value = assemble(Mul)
elif op == '/':
... |
Update error in 3.7 release | import os
import re
import sys
import platform
import subprocess
import multiprocessing
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
from distutils.version import LooseVersion
cores = multiprocessing.cpu_count()*1.25
threads="-j" + str(int(cores))
class CMakeExtension... | import os
import re
import sys
import platform
import subprocess
import multiprocessing
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
from distutils.version import LooseVersion
cores = multiprocessing.cpu_count()*1.25
threads="-j" + str(int(cores))
class CMakeExtension... |
Add support for project assets like parallax and other files | const fs = require('fs');
const path = require('path');
const express = require('express');
const router = express.Router();
router.get('/', function (req, res) {
res.send('Add a Project or Owner id to the URL bar!');
});
router.get('/:owner', [
require('./owner-project-list'),
require('./redirect-to-project')... | const fs = require('fs');
const path = require('path');
const express = require('express');
const router = express.Router();
router.get('/', function (req, res) {
res.send('Add a Project or Owner id to the URL bar!');
});
router.get('/:owner', [
require('./owner-project-list'),
require('./redirect-to-project')... |
Update semantic version to 1.0
PiperOrigin-RevId: 258839428
Change-Id: Idac6ba6750e5fa2c53de0d9a56554d99cc8dcbb8 | # pylint: disable=g-bad-file-header
# Copyright 2019 The dm_env 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... | # pylint: disable=g-bad-file-header
# Copyright 2019 The dm_env 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.