text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Check worker's FQDN against username. | # -*- coding: utf-8 -*-
import socket
from django.core.exceptions import PermissionDenied, SuspiciousOperation
from kobo.decorators import decorator_with_args
from kobo.django.xmlrpc.decorators import *
def validate_worker(func):
def _new_func(request, *args, **kwargs):
if not request.user.is_authentic... | # -*- coding: utf-8 -*-
from django.core.exceptions import PermissionDenied, SuspiciousOperation
from kobo.decorators import decorator_with_args
from kobo.django.xmlrpc.decorators import *
def validate_worker(func):
def _new_func(request, *args, **kwargs):
if not request.user.is_authenticated():
... |
PI-27: Disable debug_toolbar from catching http redirects...pretty annoying | # Grab the base settings
from .base import *
# Override at will!
# Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
ALLOWED_HOSTS = ['*']
##
#
##
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.m... | # Grab the base settings
from .base import *
# Override at will!
# Hosts/domain names that are valid for this site; required if DEBUG is False
# See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
ALLOWED_HOSTS = ['*']
##
#
##
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.m... |
Use nonsense board name, no localStorage | import Firebase from 'firebase'
import Vue from 'vue'
import VueRouter from 'vue-router'
import nonsense from './nonsense'
import App from './App.vue'
window.randomSet = nonsense.randomSet
window.randomNumber = nonsense.randomNumber
Vue.use(VueRouter)
let router = new VueRouter({
hashboang: false,
history: true... | import Firebase from 'firebase'
import Vue from 'vue'
import VueRouter from 'vue-router'
import App from './App.vue'
Vue.use(VueRouter)
let router = new VueRouter({
hashboang: false,
history: true,
})
let MEGAKanban = Vue.extend({})
let Redirect = Vue.extend({
ready() {
let boardName = localStorage.getI... |
Fix app title link not working with ‘source’ query paremeter | import Ember from 'ember';
import OsfAgnosticAuthControllerMixin from 'ember-osf/mixins/osf-agnostic-auth-controller';
import {
getAuthUrl
} from 'ember-osf/utils/auth';
export default Ember.Controller.extend(OsfAgnosticAuthControllerMixin,{
toast: Ember.inject.service(),
authUrl: getAuthUrl(),
actio... | import Ember from 'ember';
import OsfAgnosticAuthControllerMixin from 'ember-osf/mixins/osf-agnostic-auth-controller';
import {
getAuthUrl
} from 'ember-osf/utils/auth';
export default Ember.Controller.extend(OsfAgnosticAuthControllerMixin,{
toast: Ember.inject.service(),
authUrl: getAuthUrl(),
actio... |
Rename console entry point from __main__ to cli | from setuptools import setup, find_packages
setup(name='pyscores',
version='0.2',
description='Football (soccer) scores in your command line',
url='https://github.com/conormag94/pyscores',
author='Conor Maguire',
author_email='conormag94@gmail.com',
license='MIT',
packages=fin... | from setuptools import setup, find_packages
setup(name='pyscores',
version='0.2',
description='Football (soccer) scores in your command line',
url='https://github.com/conormag94/pyscores',
author='Conor Maguire',
author_email='conormag94@gmail.com',
license='MIT',
packages=fin... |
Fix the Redis client connection to actually work
It previously lied. | import txredisapi as redis
from twisted.internet import defer, reactor
import config
connection = None
def run_redis_client(on_started):
df = redis.makeConnection(config.redis['host'],
config.redis['port'],
config.redis['db'],
... | import txredisapi as redis
from twisted.internet import defer, reactor
import config
connection = None
@defer.inlineCallbacks
def run_redis_client(on_started):
pony = yield redis.makeConnection(config.redis['host'],
config.redis['port'],
... |
Add test for setting a property on a model | <?php
use PhilipBrown\CapsuleCRM\Connection;
class ModelTest extends PHPUnit_Framework_TestCase {
public function setUp()
{
$this->model = new ModelStub(new Connection('', ''), ['name' => 'Philip Brown']);
}
public function testConnectionMethodHasConnection()
{
$this->assertInstanceOf('PhilipBrown... | <?php
use PhilipBrown\CapsuleCRM\Connection;
class ModelTest extends PHPUnit_Framework_TestCase {
public function setUp()
{
$this->model = new ModelStub(new Connection('', ''), ['name' => 'Philip Brown']);
}
public function testConnectionMethodHasConnection()
{
$this->assertInstanceOf('PhilipBrown... |
Add support for save on Ctrl/Cmd+S | import React, { Component } from 'react';
import AceEditor from 'react-ace';
import githubTheme from 'brace/theme/github';
import markdownSyntax from 'brace/mode/markdown';
import styles from './CodeEditor.styl';
export default ({ file, onCodeChange, onSave }) => {
if (!file) return <div />;
const onLoad = (edit... | import React, { Component } from 'react';
import AceEditor from 'react-ace';
import githubTheme from 'brace/theme/github';
import markdownSyntax from 'brace/mode/markdown';
import styles from './CodeEditor.styl';
export default ({ file, onCodeChange, onSave }) => {
if (!file) return <div />;
const onLoad = (edit... |
Remove language pair from counts | var _ = require('underscore'),
SHORT = _.template('Languages: jw.org: <%= jworg.total %>, <%= jworg.hasWebContent %> L1+, <%= jworg.isSign %> SLs, <%= jworg.isRTL %> RTL, <%= jworg.isSignWithWeb %> L1+ SLs; jwb: <%= jwb.web.total %>, <%= jwb.web.isSign %> SLs, <%= jwb.appletv.total %> AppleTV, <%= jwb.roku.total %>... | var _ = require('underscore'),
SHORT = _.template('Languages: jw.org: <%= jworg.total %>, <%= jworg.hasWebContent %> L1+, <%= jworg.isSign %> SLs, <%= jworg.isRTL %> RTL, <%= jworg.isSignWithWeb %> L1+ SLs; jwb: <%= jwb.web.total %>, <%= jwb.web.isSign %> SLs, <%= jwb.appletv.total %> AppleTV, <%= jwb.roku.total %>... |
Remove unnecessary logging and increase timeout. | "use strict";
var fs = require('fs');
var should = require('chai').should();
var pdf2img = require('../index.js');
var input = __dirname + '/test.pdf';
pdf2img.setOptions({
outputdir: __dirname + '/output',
targetname: 'test'
});
describe('Split and covert pdf into images', function() {
it ('Create pn... | "use strict";
var fs = require('fs');
var should = require('chai').should();
var pdf2img = require('../index.js');
var input = __dirname + '/test.pdf';
pdf2img.setOptions({
outputdir: __dirname + '/output',
targetname: 'test'
});
describe('Split and covert pdf into images', function() {
it ('Create pn... |
Change output data structure to support faster rsync | import numpy as np
import os
import glob
import mdtraj as md
import fahmunge
import pandas as pd
projects = pd.read_csv("./projects.csv", index_col=0)
output_path = "/data/choderalab/fah/munged/"
for (project, location, pdb) in projects.itertuples():
print(project, location, pdb)
allatom_output_path = os.path... | import numpy as np
import os
import glob
import mdtraj as md
import fahmunge
import pandas as pd
projects = pd.read_csv("./projects.csv", index_col=0)
output_path = "/data/choderalab/fah/munged/"
for (project, location, pdb) in projects.itertuples():
print(project, location, pdb)
allatom_output_path = os.path... |
Order secret behind folder breadcrumb in filtered views | import React, { PropTypes } from 'react';
import SecretListItemFolderSecret from 'components/secrets/SecretListItem/Secret';
import SecretListBreadcrumb from 'components/secrets/SecretListBreadcrumb';
const propTypes = {
folder: PropTypes.any,
};
function SecretListFolderInfo({ folder }) {
return (
<tbody cl... | import React, { PropTypes } from 'react';
import SecretListItemFolderSecret from 'components/secrets/SecretListItem/Secret';
import SecretListBreadcrumb from 'components/secrets/SecretListBreadcrumb';
const propTypes = {
folder: PropTypes.any,
};
function SecretListFolderInfo({ folder }) {
return (
<tbody cl... |
Load module language files using package and module name. | <?php
/**
* @version $Id$
* @package Nooku_Server
* @subpackage Pages
* @copyright Copyright (C) 2011 - 2012 Timble CVBA and Contributors. (http://www.timble.net).
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
* @link http://www.nooku.org
*/
/**
* Modules Html View Class
* ... | <?php
/**
* @version $Id$
* @package Nooku_Server
* @subpackage Pages
* @copyright Copyright (C) 2011 - 2012 Timble CVBA and Contributors. (http://www.timble.net).
* @license GNU GPLv3 <http://www.gnu.org/licenses/gpl.html>
* @link http://www.nooku.org
*/
/**
* Modules Html View Class
* ... |
Support __in as operator for backwards comp |
EQUALS = 'equals'
GT = 'gt'
LT = 'lt'
IN = 'in'
OPERATOR_SEPARATOR = '__'
REVERSE_ORDER = '-'
ALL_OPERATORS = {EQUALS: 1, GT: 1, LT: 1, IN: 1}
def split_to_field_and_filter_type(filter_name):
filter_split = filter_name.split(OPERATOR_SEPARATOR)
filter_type = filter_split[-1] if len(filter_split) > 0 else N... |
EQUALS = 'equals'
GT = 'gt'
LT = 'lt'
OPERATOR_SEPARATOR = '__'
REVERSE_ORDER = '-'
ALL_OPERATORS = {EQUALS: 1, GT: 1, LT: 1}
def split_to_field_and_filter_type(filter_name):
filter_split = filter_name.split(OPERATOR_SEPARATOR)
filter_type = filter_split[-1] if len(filter_split) > 0 else None
if filte... |
Test if new conosle command is causing travis issues | <?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
Commands\Secu... | <?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
Commands\Secu... |
Enable connection to Heroku/ClearDB database | <?php
/**
* Created by PhpStorm.
* User: raynald
* Date: 7/29/15
* Time: 4:54 PM
*/
// This file contains the database access information.
// This file also establishes a connection to MySQL,
// selects the database, and sets the encoding.
if (!LIVE) {
// for local/development mysql server
$url = parse_url('... | <?php
/**
* Created by PhpStorm.
* User: raynald
* Date: 7/29/15
* Time: 4:54 PM
*/
// This file contains the database access information.
// This file also establishes a connection to MySQL,
// selects the database, and sets the encoding.
if (!LIVE) {
// for local/development mysql server
$url = parse_url('... |
Add constants for sound synthesis. | package framework;
import java.util.ArrayList;
import framework.editors.SoundEditor;
/**
* Represents a sound entity.
*
* A sound is represented basically by a frequency and a duration.
* It can then be modified by adding different modifiers.
* It is the core of the model in our MVC design pattern implementation... | package framework;
import java.util.ArrayList;
import framework.editors.SoundEditor;
/**
* Represents a sound entity.
*
* A sound is represented basically by a frequency and a duration.
* It can then be modified by adding different modifiers.
* It is the core of the model in our MVC design pattern implementation... |
Remove useless named return value
This cleans up the useless named return value stopCh at
SetupSignalHandler(). | /*
Copyright 2017 The Kubernetes Authors.
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 in writing, ... | /*
Copyright 2017 The Kubernetes Authors.
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 in writing, ... |
Change %default to %(default)s for removing warning | # -*- coding: utf-8 -*-
from pytest import fixture
from iamport import Iamport
DEFAULT_TEST_IMP_KEY = 'imp_apikey'
DEFAULT_TEST_IMP_SECRET = (
'ekKoeW8RyKuT0zgaZsUtXXTLQ4AhPFW3ZGseDA6b'
'kA5lamv9OqDMnxyeB9wqOsuO9W3Mx9YSJ4dTqJ3f'
)
def pytest_addoption(parser):
parser.addoption(
'--imp-key',
... | # -*- coding: utf-8 -*-
from pytest import fixture
from iamport import Iamport
DEFAULT_TEST_IMP_KEY = 'imp_apikey'
DEFAULT_TEST_IMP_SECRET = ('ekKoeW8RyKuT0zgaZsUtXXTLQ4AhPFW3ZGseDA6bkA5lamv9O'
'qDMnxyeB9wqOsuO9W3Mx9YSJ4dTqJ3f')
def pytest_addoption(parser):
parser.addoption('--imp-ke... |
Drop the [security] descriptor from requests; it's soon deprecated | from setuptools import find_packages, setup
from valohai_cli import __version__
setup(
name='valohai-cli',
version=__version__,
entry_points={'console_scripts': ['vh=valohai_cli.cli:cli']},
author='Valohai',
author_email='hait@valohai.com',
license='MIT',
install_requires=[
'click>... | from setuptools import find_packages, setup
from valohai_cli import __version__
setup(
name='valohai-cli',
version=__version__,
entry_points={'console_scripts': ['vh=valohai_cli.cli:cli']},
author='Valohai',
author_email='hait@valohai.com',
license='MIT',
install_requires=[
'click>... |
Fix alias in update query | <?php
namespace Lensky\PerformanceBundle\Entity;
use Doctrine\ORM\EntityRepository;
/**
* PostRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class PostRepository extends EntityRepository
{
/**
* Find all posts with authors
*
* @... | <?php
namespace Lensky\PerformanceBundle\Entity;
use Doctrine\ORM\EntityRepository;
/**
* PostRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class PostRepository extends EntityRepository
{
/**
* Find all posts with authors
*
* @... |
Bump deps to match d3m==v2020.5.18 | from setuptools import setup, find_packages
__version__ = '0.6.0'
setup(
name = 'metalearn',
packages = find_packages(include=['metalearn', 'metalearn.*']),
version = __version__,
description = 'A package to aid in metalearning',
author = 'Roland Laboulaye, Brandon Schoenfeld, Casey Davis',
au... | from setuptools import setup, find_packages
__version__ = '0.6.0'
setup(
name = 'metalearn',
packages = find_packages(include=['metalearn', 'metalearn.*']),
version = __version__,
description = 'A package to aid in metalearning',
author = 'Roland Laboulaye, Brandon Schoenfeld, Casey Davis',
au... |
Correct mistaken assertTrue() -> assertEquals() | from core.models import Category
from django.test.testcases import TestCase
from django.urls import reverse
class ExportViewMixinTest(TestCase):
def setUp(self):
self.url = reverse('export-category')
self.cat1 = Category.objects.create(name='Cat 1')
self.cat2 = Category.objects.create(na... | from core.models import Category
from django.test.testcases import TestCase
from django.urls import reverse
class ExportViewMixinTest(TestCase):
def setUp(self):
self.url = reverse('export-category')
self.cat1 = Category.objects.create(name='Cat 1')
self.cat2 = Category.objects.create(na... |
Check the type of the IndexInput rather than the Directory to detect
native implementation. This is a simpler and more correct test. It
also permits the Directory to return a mixture of native and
non-native IndexInput implementations.
git-svn-id: 4c5078813df38efa56971a28e09a55254294f104@150604 13f79535-47bb-0310-9... | package org.apache.lucene.index;
/**
* Copyright 2004 The Apache Software Foundation
*
* 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... | package org.apache.lucene.index;
/**
* Copyright 2004 The Apache Software Foundation
*
* 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... |
Update paths and remove dupl. plugins from front prod | const merge = require('webpack-merge');
const webpack = require('webpack');
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const frontConfig = require('./front.config');
const devConfig = merge(frontConfig, {
output: {... | const merge = require('webpack-merge');
const webpack = require('webpack');
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const ManifestPlugin = require('webpack-manifest-plugin');
const baseConfig = require('./base.config... |
Use debug logs in karma | module.exports = config => {
const browser = process.env.BROWSER || 'chrome';
config.set({
basePath: '',
frameworks: ['browserify', 'jasmine'],
files: [
'https://static.opentok.com/v2/js/opentok.js',
'test/**/*.js'
],
preprocessors: {
'src/**/*.js': ['babel', 'browserify'],
... | module.exports = config => {
const browser = process.env.BROWSER || 'chrome';
config.set({
basePath: '',
frameworks: ['browserify', 'jasmine'],
files: [
'https://static.opentok.com/v2/js/opentok.js',
'test/**/*.js'
],
preprocessors: {
'src/**/*.js': ['babel', 'browserify'],
... |
Revert "increase timeout for server notices room" | /*
Copyright 2018 New Vector Ltd
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 in writing, softw... | /*
Copyright 2018 New Vector Ltd
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 in writing, softw... |
Fix early cache resolve bug | var Q = require('q');
var _ = require('lodash');
var spawn = require('child_process').spawn;
module.exports = function(args, options) {
var deferred = Q.defer();
options = options || {};
var defaults = {
cwd: process.cwd(),
verbose: false
};
options = _.extend({}, defaults, options)... | var Q = require('q');
var _ = require('lodash');
var spawn = require('child_process').spawn;
module.exports = function(args, options) {
var deferred = Q.defer();
options = options || {};
var defaults = {
cwd: process.cwd(),
verbose: false
};
options = _.extend({}, defaults, options)... |
FIX: Remove leading space that caused the pages tab to break | <?php
/**
* Defines the SupportingProjectPage page type - initial code created by ss generator
*/
class PageWithImage extends Page implements RenderableAsPortlet {
static $has_one = array(
'MainImage' => 'Image'
);
// for rendering thumbnail when linked in facebook
function getOGImage() {
return... | <?php
/**
* Defines the SupportingProjectPage page type - initial code created by ss generator
*/
class PageWithImage extends Page implements RenderableAsPortlet {
static $has_one = array(
'MainImage' => 'Image'
);
// for rendering thumbnail when linked in facebook
function getOGImage() {
retur... |
Update static file directory to /public subfolder | var bodyParser = require('body-parser');
var db = require('../models/index');
module.exports = function (app, express) {
//Handle CORS
app.use(function(req, res, next) {
res.header('Access-Control-Allow-Origin', 'http://localhost:3000/');
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OP... | var bodyParser = require('body-parser');
var db = require('../models/index');
module.exports = function (app, express) {
//Handle CORS
app.use(function(req, res, next) {
res.header('Access-Control-Allow-Origin', 'http://localhost:3000/');
res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OP... |
Move subprocess stuff to an execution module for Pelican. | import salt.exceptions
import subprocess
def build_site(name, output="/srv/www"):
# /srv/salt/_states/pelican.py
# Generates static site with pelican -o $output $name
# Sorry.
# -- Jadon Bennett, 2015
ret = {'name': name, 'changes': {}, 'result': False, 'comment': ''}
current_state = __salt__... | import salt.exceptions
import subprocess
def build_site(name, output="/srv/www"):
# /srv/salt/_states/pelican.py
# Generates static site with pelican -o $output $name
# Sorry.
# -- Jadon Bennett, 2015
ret = {'name': name, 'changes': {}, 'result': False, 'comment': ''}
# I don't know how to ma... |
Add pending error code to service-integration-sdk | /*
* Copyright 2017 AppDirect, Inc. and/or its affiliates
* 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 ... | /*
* Copyright 2017 AppDirect, Inc. and/or its affiliates
* 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 ... |
Fix lowercase conflict on previous test | var assert = require('assert');
var filename = require('../').filename;
describe('Filename normalization', function() {
it('should normalize spaces', function() {
assert.equal(filename('1 2 3'), '1_2_3');
});
it('should ignore trailing spaces', function() {
assert.equal(filename('a b c '... | var assert = require('assert');
var filename = require('../').filename;
describe('Filename normalization', function() {
it('should normalize spaces', function() {
assert.equal(filename('1 2 3'), '1_2_3');
});
it('should ignore trailing spaces', function() {
assert.equal(filename('a b c '... |
Use the new get_minion_data function | # -*- coding: utf-8 -*-
'''
Functions to interact with the pillar compiler on the master
'''
# Import salt libs
import salt.pillar
import salt.utils.minions
def show_top(minion=None, saltenv='base'):
'''
Returns the compiled top data for pillar for a specific minion. If no
minion is specified, we use th... | # -*- coding: utf-8 -*-
'''
Functions to interact with the pillar compiler on the master
'''
# Import salt libs
import salt.pillar
import salt.utils.minions
def show_top(minion=None, saltenv='base'):
'''
Returns the compiled top data for pillar for a specific minion. If no
minion is specified, we use th... |
Change active tags button layout. | import React, { Component, PropTypes } from 'react';
import { Button, ButtonGroup } from 'react-bootstrap';
export default class ActiveTags extends Component {
removeTag(tag) {
const { filterObject, position, setFilter } = this.props;
const temp = filterObject[position];
temp.delete(tag);
const newFi... | import React, { Component, PropTypes } from 'react';
import { Button, ButtonGroup } from 'react-bootstrap';
export default class ActiveTags extends Component {
removeTag(tag) {
const { filterObject, position, setFilter } = this.props;
const temp = filterObject[position];
temp.delete(tag);
const newFi... |
Update TestFX test in contacts module to fix compile error | package de.saxsys.mvvmfx.contacts;
import static org.testfx.api.FxAssert.verifyThat;
import static org.testfx.matcher.control.TableViewMatchers.hasTableCell;
import org.junit.Before;
import org.junit.Test;
import org.testfx.api.FxRobot;
import org.testfx.api.FxToolkit;
public class AppTestFxIT extends FxRobot {
@... | package de.saxsys.mvvmfx.contacts;
import javafx.geometry.VerticalDirection;
import javafx.scene.Parent;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.loadui.testfx.Assertions;
import org.loadui.testfx.GuiTest;
import org.testfx.api.FxRobot;
import org.testfx.api.FxToolkit;
... |
Update magic 8 ball syntax | package io.github.skepter.skepbot.modules;
import java.util.concurrent.ThreadLocalRandom;
public class Magic8 extends Module {
String[] responses = { "It is certain", "It is decidedly so", "Without a doubt", "Yes definitely",
"You may rely on it", "As I see it, yes", "Most likely", "Outlook good", "Yes", ... | package io.github.skepter.skepbot.modules;
import java.util.concurrent.ThreadLocalRandom;
public class Magic8 extends Module {
String[] responses = { "It is certain", "It is decidedly so", "Without a doubt", "Yes definitely",
"You may rely on it", "As I see it, yes", "Most likely", "Outlook good", "Yes", ... |
Fix test to check for the correct version | <?php namespace Rollbar;
use \Mockery as m;
use Rollbar\Payload\Notifier;
class NotifierTest extends BaseRollbarTest
{
public function testName()
{
$name = "rollbar-php";
$notifier = new Notifier($name, "0.1");
$this->assertEquals($name, $notifier->getName());
$name2 = "Rollba... | <?php namespace Rollbar;
use \Mockery as m;
use Rollbar\Payload\Notifier;
class NotifierTest extends BaseRollbarTest
{
public function testName()
{
$name = "rollbar-php";
$notifier = new Notifier($name, "0.1");
$this->assertEquals($name, $notifier->getName());
$name2 = "Rollba... |
Put js at the end of the `<body>` tag.` | <!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="/favicon.ico">
<?php foreach($config->styles as $file) echo "\n\t<link type='text/css' href='$file' rel='stylesheet' />"; ?>
<title>Gr... | <!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" href="/favicon.ico">
<?php foreach($config->styles as $file) echo "\n\t<link type='text/css' href='$file' rel='stylesheet' />"; ?>
<?ph... |
Add default init for Team Class | from sqlalchemy import Column, Integer, String
from sqlalchemy.orm import relationship
from scoring_engine.models.base import Base
class Team(Base):
__tablename__ = 'teams'
id = Column(Integer, primary_key=True)
name = Column(String(20), nullable=False)
color = Column(String(10), nullable=False)
... | from sqlalchemy import Column, Integer, String
from sqlalchemy.orm import relationship
from scoring_engine.models.base import Base
class Team(Base):
__tablename__ = 'teams'
id = Column(Integer, primary_key=True)
name = Column(String(20), nullable=False)
color = Column(String(10), nullable=False)
... |
(server): Change request headers to prefer JSON | export default {
headers: {
"Host": "a.4cdn.org",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0",
"Accept": "application/json,text/html,application/xml;q=0.9,*/*;q=0.8",
"Accept-Language": "en-GB,en;q=0.5",
"Accept-Encoding": "gzip, ... | export default {
headers: {
"Host": "a.4cdn.org",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
"Accept-Language": "en-GB,en;q=0.5",
"Accept-Encoding": "g... |
Switch encoding to UTF-8 from latin1
This change was originally made in PR #53, but may no longer be required
(and may cause issues with comments in IR that use non-latin1
characters). | import atexit
def _encode_string(s):
encoded = s.encode('utf-8')
return encoded
def _decode_string(b):
return b.decode('utf-8')
_encode_string.__doc__ = """Encode a string for use by LLVM."""
_decode_string.__doc__ = """Decode a LLVM character (byte)string."""
_shutting_down = [False]
def _at_shut... | import atexit
def _encode_string(s):
encoded = s.encode('latin1')
return encoded
def _decode_string(b):
return b.decode('latin1')
_encode_string.__doc__ = """Encode a string for use by LLVM."""
_decode_string.__doc__ = """Decode a LLVM character (byte)string."""
_shutting_down = [False]
def _at_sh... |
Clear the cookie after logout
git-svn-id: 5a74b5304d8e7e474561603514f78b697e5d94c4@981321 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... | /*
* 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... |
Use widget and progress component | import { Component } from 'react'
import 'isomorphic-fetch'
import Progress from '../../progress'
import Widget from '../../widget'
export default class PageSpeedInsights extends Component {
static defaultProps = {
filter_third_party_resources: true,
locale: 'de_DE',
strategy: 'desktop'
}
state = {
... | import { Component } from 'react'
import 'isomorphic-fetch'
export default class PageSpeedInsights extends Component {
static defaultProps = {
filter_third_party_resources: true,
locale: 'de_DE',
strategy: 'desktop'
}
state = {
score: 0
}
async componentDidMount () {
let url = 'https://... |
Use ',' to separate style names. | /*global define*/
/*jslint unparam:true*/
define(function () {
'use strict';
return {
load: function (name, req, onLoad, config) {
var names = name.match(/([^,]+)/g) || [];
names = names.map(function (n) {
if (n.indexOf('/') === -1) {
... | /*global define*/
/*jslint unparam:true*/
define(function () {
'use strict';
return {
load: function (name, req, onLoad, config) {
var names = name.match(/([\w\-]+)/g) || [];
names = names.map(function (n) {
if (n.indexOf('/') === -1) {
... |
Remove features added in last version | module.exports = function ({target, store, component, diff, raf}) {
raf = raf != null ? raf : window.requestAnimationFrame
let state = store()
let rafCalled = false
return function (init) {
init({target, dispatch})
}
function dispatch () {
const args = (arguments.length === 1 ? [arguments[0]] : A... | module.exports = function ({target, store, component, diff, options, raf}) {
raf = raf != null ? raf : window.requestAnimationFrame
if (options != null) {
options.dispatch = dispatch
options.next = next
} else {
options = {dispatch, next}
}
let stores = !Array.isArray(store) ? [store] : store
... |
Write default config to JSON for Jigsaw, not docs config | const argv = require('yargs').argv
const command = require('node-cmd')
const mix = require('laravel-mix')
const OnBuild = require('on-build-webpack')
const Watch = require('webpack-watch')
const tailwind = require('./../lib/index.js')
const config = require('./../defaultConfig.js')
const fs = require('fs')
fs.writeFil... | const argv = require('yargs').argv
const command = require('node-cmd')
const mix = require('laravel-mix')
const OnBuild = require('on-build-webpack')
const Watch = require('webpack-watch')
const tailwind = require('./../lib/index.js')
const config = require('./../defaultConfig.js')
const fs = require('fs')
fs.writeFil... |
Add TODO in Google Provider | import google from 'googleapis';
import nconf from '../config';
import User from '../models/user';
const OAuth2 = google.auth.OAuth2;
export default class GoogleProvider {
constructor(token, dce) {
this.dce = dce;
this.authLevel = nconf.get('permissions:levels:high');
this.token = token;
this.clien... | import google from 'googleapis';
import nconf from '../config';
import User from '../models/user';
const OAuth2 = google.auth.OAuth2;
export default class GoogleProvider {
constructor(token, dce) {
this.dce = dce;
this.authLevel = nconf.get('permissions:levels:high');
this.token = token;
this.clien... |
Include plot title to plots | from flask_restplus import Namespace, Resource, fields, abort
import cea.config
import cea.plots.cache
api = Namespace('Dashboard', description='Dashboard plots')
LAYOUTS = ['row', 'grid', 'map']
CATEGORIES = {c.name: {'label': c.label, 'plots': [{'id': p.id(), 'name': p.name} for p in c.plots]}
for c... | from flask_restplus import Namespace, Resource, fields, abort
import cea.config
import cea.plots.cache
api = Namespace('Dashboard', description='Dashboard plots')
LAYOUTS = ['row', 'grid', 'map']
CATEGORIES = {c.name: {'label': c.label, 'plots': [{'id': p.id(), 'name': p.name} for p in c.plots]}
for c... |
Create dummy password on null | package io.core9.module.auth.standard;
import io.core9.plugin.database.repository.AbstractCrudEntity;
import io.core9.plugin.database.repository.Collection;
import io.core9.plugin.database.repository.CrudEntity;
import java.math.BigInteger;
import java.security.SecureRandom;
import java.util.Set;
import org.apache.s... | package io.core9.module.auth.standard;
import io.core9.plugin.database.repository.AbstractCrudEntity;
import io.core9.plugin.database.repository.Collection;
import io.core9.plugin.database.repository.CrudEntity;
import java.util.Set;
import org.apache.shiro.crypto.hash.Sha256Hash;
@Collection("core.users")
public c... |
Fix javadoc typo in id factory. | // Copyright 2016 Google Inc. 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... | // Copyright 2016 Google Inc. 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... |
Fix scope issue, fix project dir. | /* globals require */
module.exports = function(gulp) {
'use strict';
const fs = require('fs');
const path = require('path');
const yaml = require('js-yaml');
const _ = require('lodash');
let projectDir = path.join(__dirname, '../../');
let projectConfig = {};
// Load config from project.yml.
try ... | /* globals require */
function initEnv(projectConfig) {
let defaults = _.get(projectConfig, 'env.default', {});
_.forIn(projectConfig.env, function (vars, env) {
let envVars = _.defaultsDeep(projectConfig.env[env], defaults);
_.forIn(envVars, function (value, key) {
process.env['ENV_' + env.toUpper... |
Fix setting of custom MPI command | MPI_COMMAND = 'mpirun -n {n_proc} {executable}'
def set_mpi_command(command):
"""
Set the MPI Command to use.
This should contain {n_proc} to indicate the number of processes, and
{executable} to indicate the name of the executable.
Parameters
----------
command: str
The M... | MPI_COMMAND = 'mpirun -n {n_proc} {executable}'
def set_mpi_command(command):
"""
Set the MPI Command to use.
This should contain {n_proc} to indicate the number of processes, and
{executable} to indicate the name of the executable.
Parameters
----------
command: str
The M... |
Fix resize proportions on window resize | document.addEventListener('DOMContentLoaded', onDocumentReady, false);
function onDocumentReady() {
var aside = document.querySelector('aside');
var section = document.querySelector('section');
var resizer = document.querySelector('.vertical-resizer');
resizer.addEventListener('mousedown', startDrag, false);
... | document.addEventListener('DOMContentLoaded', onDocumentReady, false);
function onDocumentReady() {
var aside = document.querySelector('aside');
var section = document.querySelector('section');
var resizer = document.querySelector('.vertical-resizer');
resizer.addEventListener('mousedown', startDrag, false);
... |
Remove default http status messages from swagger documentation. | package uk.ac.ebi.quickgo.rest.controller;
import com.google.common.base.Predicates;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import springfox.documentation.builders.PathSelectors;
impo... | package uk.ac.ebi.quickgo.rest.controller;
import com.google.common.base.Predicates;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import springfox.documentation.builders.PathSelectors;
impo... |
Update Counter test to no relying on initial values for event handlers | /** @jsx createElement */
const {createElement, createEventHandler, render} = Yolk
function Counter () {
const handlePlus = createEventHandler(1)
const handleMinus = createEventHandler(-1)
const count = handlePlus.merge(handleMinus).scan((x, y) => x+y, 0).startWith(0)
return (
<div>
<button id="plu... | /** @jsx createElement */
const {createElement, createEventHandler, render} = Yolk
function Counter () {
const handlePlus = createEventHandler(1, 0)
const handleMinus = createEventHandler(-1, 0)
const count = handlePlus.merge(handleMinus).scan((x, y) => x+y, 0)
return (
<div>
<button id="plus" onCl... |
Swap IndexError for AttributeError as a result of the swap from HVAD to MT | __copyright__ = "Copyright 2017 Birkbeck, University of London"
__author__ = "Martin Paul Eve & Andy Byers"
__license__ = "AGPL v3"
__maintainer__ = "Birkbeck Centre for Technology and Publishing"
from django.utils.translation import ugettext_lazy as _
from utils.setting_handler import get_plugin_setting
from core.ho... | __copyright__ = "Copyright 2017 Birkbeck, University of London"
__author__ = "Martin Paul Eve & Andy Byers"
__license__ = "AGPL v3"
__maintainer__ = "Birkbeck Centre for Technology and Publishing"
from django.utils.translation import ugettext_lazy as _
from utils.setting_handler import get_plugin_setting
from core.ho... |
Make the last one a bit difficult. | // 9: object-literals - basics
// To do: make all tests pass, leave the asserts unchanged!
describe('new shorthands for objects', () => {
const x = 1;
const y = 2;
describe('with variables', () => {
it('use the variables name as key', () => {
assert.deepEqual({x}, {y: y});
});
it('works with ... | // 9: object-literals - basics
// To do: make all tests pass, leave the asserts unchanged!
describe('new shorthands for objects', () => {
const x = 1;
const y = 2;
describe('with variables', () => {
it('use the variables name as key', () => {
assert.deepEqual({x}, {y: y});
});
it('works with ... |
Access token fix take 2 | var ncApp = angular.module('ncApp', []);
ncApp.controller('GhCtrl', function($scope, $http) {
var userName = 'novicell',
userType = 'orgs',
str1 = '0a1fde2db5ef80ea6d7f',
str2 = '3b643be67f8269a3a6c1',
token = str1 + str2;
// Get repo data
$http.get('https://api.github.com/' + userType +... | var ncApp = angular.module('ncApp', []);
ncApp.controller('GhCtrl', function($scope, $http) {
var userName = 'novicell',
userType = 'orgs',
str1 = '0a1fde2db5ef80ea6d7f',
str2 = '3b643be67f8269a3a6c1',
token = str1 + str2;
// Get repo data
$http.get('https://api.github.com/' + userType +... |
Fix ScreenSquish message to show when the right information arrived | TouchUI.prototype.plugins.screenSquish = function(softwareUpdateViewModel, pluginManagerViewModel) {
var shown = false;
pluginManagerViewModel.plugins.items.subscribe(function() {
var ScreenSquish = pluginManagerViewModel.plugins.getItem(function(elm) {
return (elm.key === "ScreenSquish");
}, true) ||... | TouchUI.prototype.plugins.screenSquish = function(softwareUpdateViewModel, pluginManagerViewModel) {
softwareUpdateViewModel.versions.items.subscribe(function(changes) {
var ScreenSquish = pluginManagerViewModel.plugins.getItem(function(elm) {
return (elm.key === "ScreenSquish");
}, true) || false;
... |
Prepare branch for section 2.4 tutorial | var express = require('express');
var router = express.Router();
var JsonDB = require('node-json-db');
var _ = require('lodash');
// Escape a string for regexp use
function escapeRegExp(string) {
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
}
// Recipes listing
router.get('/', function (req, res, next) {
... | var express = require('express');
var router = express.Router();
var JsonDB = require('node-json-db');
var _ = require('lodash');
// Recipes listing
router.get('/', function (req, res, next) {
var db = new JsonDB('db', false, false);
var recipes = db.getData('/recipes');
// Expand requested resources if they ex... |
Make tests read from the right dir | // Native
import path from 'path'
// Packages
import test from 'ava'
import {transformFile} from 'babel-core'
// Ours
import plugin from '../dist/babel'
import read from './_read'
const transform = file => (
new Promise((resolve, reject) => {
transformFile(path.resolve(__dirname, file), {
plugins: [
... | // Native
import path from 'path'
// Packages
import test from 'ava'
import {transformFile} from 'babel-core'
// Ours
import plugin from '../babel'
import read from './_read'
const transform = file => (
new Promise((resolve, reject) => {
transformFile(path.resolve(__dirname, file), {
plugins: [
p... |
Set default options object after checking for callback | const parseStack = require('./lib/parse-stack')
const fetchSourcemaps = require('./lib/fetch-sourcemaps')
const translateFrames = require('./lib/translate-frames')
module.exports = function(rawStack, opts, callback) {
if (typeof opts === 'function') {
callback = opts
opts = {}
}
opts = opts || {}
if (... | const parseStack = require('./lib/parse-stack')
const fetchSourcemaps = require('./lib/fetch-sourcemaps')
const translateFrames = require('./lib/translate-frames')
module.exports = function(rawStack, opts, callback) {
opts = opts || {}
if (typeof opts === 'function') {
callback = opts
opts = {}
}
if (... |
Fix for travis php5.4 falling | <?php
namespace Purekid\Mongodm\Test\TestCase;
use Phactory\Mongo\Phactory;
use Purekid\Mongodm\MongoDB;
/**
* Test Case Base Class for using Phactory *
*/
abstract class PhactoryTestCase extends \PHPUnit_Framework_TestCase
{
protected static $db;
protected static $phactory;
public static function setUpBef... | <?php
namespace Purekid\Mongodm\Test\TestCase;
use Phactory\Mongo\Phactory;
use Purekid\Mongodm\MongoDB;
/**
* Test Case Base Class for using Phactory *
*/
abstract class PhactoryTestCase extends \PHPUnit_Framework_TestCase
{
protected static $db;
protected static $phactory;
public static function setUpBef... |
Add fall back to source code when built code is not available. | /*
Copyright (c) 2015-2018 Claude Petit
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribu... | /*
Copyright (c) 2015-2018 Claude Petit
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribu... |
Remove whitespace in speed formatter | var moment = require('moment');
var _floor = function(val) {
return Math.floor(val);
};
var Formatters = {
speed: function(speed) {
var str;
speed *= 8;
if (speed > 1024 * 1024) str = _floor(speed * 10 / (1024 * 1024)) / 10 + ' Mbps';
else if (speed > 1024) str = _floor(speed *... | var moment = require('moment');
var _floor = function(val) {
return Math.floor(val);
};
var Formatters = {
speed: function(speed) {
var str;
speed *= 8;
if (speed > 1024 * 1024) str = _floor(speed * 10 / (1024 * 1024)) / 10 + ' Mbps';
else if (speed > 1024) str = _floor(speed *... |
Change default naming strating to use fixture name with underscore | <?php
/*
* This file is part of the FixtureDumper library.
*
* (c) Martin Parsiegla <martin.parsiegla@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sp\FixtureDumper\Generator;
use Doctrine\Common\Persisten... | <?php
/*
* This file is part of the FixtureDumper library.
*
* (c) Martin Parsiegla <martin.parsiegla@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sp\FixtureDumper\Generator;
use Doctrine\Common\Persisten... |
Set the max cores/max procs per job to a reasonable value. | package com.breakersoft.plow.dispatcher;
import java.util.concurrent.atomic.AtomicBoolean;
public class DispatchConfig {
/*
* Maximum number of processes to start on a single
* dispatching pass for a given node.
*/
public static int MAX_PROCS_PER_JOB = 4;
/*
* Maximum number of cores... | package com.breakersoft.plow.dispatcher;
import java.util.concurrent.atomic.AtomicBoolean;
public class DispatchConfig {
/*
* Maximum number of processes to start on a single
* dispatching pass for a given node.
*/
public static int MAX_PROCS_PER_JOB = 16;
/*
* Maximum number of core... |
Reduce the wait time before re-sending a message. | // Copyright 2017 Google 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... | // Copyright 2017 Google 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in... |
Fix up disgraceful benchmark code | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Standalone benchmark runner
"""
import cProfile
import pstats
import profile
import numpy as np
print("Running Rust, Python, and C++ benchmarks. 100 points, 50 runs.\n")
# calibrate
print("Calibrating system")
pr = profile.Profile()
calibration = np.mean([pr.calibrat... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Standalone benchmark runner
"""
import cProfile
import pstats
import profile
import numpy as np
print("Running Rust, Python, and C++ benchmarks. 100 points, 50 runs.\n")
# calibrate
pr = profile.Profile()
calibration = np.mean([pr.calibrate(10000) for x in xrange(5)]... |
Drop Installpath controller, whilst it's single option. | # Copyright 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 as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distribute... | # Copyright 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 as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distribute... |
Use updated response from wings | <?php
namespace Pterodactyl\Transformers\Api\Client;
use Illuminate\Support\Arr;
class StatsTransformer extends BaseClientTransformer
{
public function getResourceName(): string
{
return 'stats';
}
/**
* Transform stats from the daemon into a result set that can be used in
* the cl... | <?php
namespace Pterodactyl\Transformers\Api\Client;
use Illuminate\Support\Arr;
class StatsTransformer extends BaseClientTransformer
{
public function getResourceName(): string
{
return 'stats';
}
/**
* Transform stats from the daemon into a result set that can be used in
* the cl... |
Revert 273986 "Remove failing expectations for pixel tests."
Re-enable the failing expectations for the Pixel.CSS3DBlueBox test.
The <meta viewport> tag added to this test is causing failures on some
desktop bots. See Issue 368495.
> Remove failing expectations for pixel tests.
>
> This is a follow-up patch for r273... | # 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.
from telemetry.page import test_expectations
# Valid expectation conditions are:
#
# Operating systems:
# win, xp, vista, win7, mac, leopard, snowleopar... | # 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.
from telemetry.page import test_expectations
# Valid expectation conditions are:
#
# Operating systems:
# win, xp, vista, win7, mac, leopard, snowleopar... |
Use argument list instead of lhs/rhs pari in ArithmeticOperation | from thinglang.common import ObtainableValue
from thinglang.parser.tokens import BaseToken
class ArithmeticOperation(BaseToken, ObtainableValue):
OPERATIONS = {
"+": lambda rhs, lhs: rhs + lhs,
"*": lambda rhs, lhs: rhs * lhs,
"-": lambda rhs, lhs: rhs - lhs,
"/": lambda rhs, lhs: ... | from thinglang.common import ObtainableValue
from thinglang.parser.tokens import BaseToken
class ArithmeticOperation(BaseToken, ObtainableValue):
OPERATIONS = {
"+": lambda rhs, lhs: rhs + lhs,
"*": lambda rhs, lhs: rhs * lhs,
"-": lambda rhs, lhs: rhs - lhs,
"/": lambda rhs, lhs: ... |
Tag description change for AUTO_PAY_OFF | /*
* Copyright 2010-2011 Ning, Inc.
*
* Ning licenses this file to you 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 a... | /*
* Copyright 2010-2011 Ning, Inc.
*
* Ning licenses this file to you 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 a... |
Use tag instance variable; add query keywords: tag | Template.taggedCourses.onCreated(function(){
// Get reference to template instance
var instance = this;
// Accessing the Iron.controller to invoke getParams method of Iron Router.
var router = Router.current();
// Getting Params of the URL
instance.tag = router.params.tag;
// Subscribe to courses tagge... | Template.taggedCourses.onCreated(function(){
// Get reference to template instance
var instance = this;
// Accessing the Iron.controller to invoke getParams method of Iron Router.
var router = Router.current();
// Getting Params of the URL
instance.tag = router.params.tag;
// Subscribe to courses tagge... |
Change test to using JenkinsRule | package org.jenkinsci.plugins.github.status.sources;
import hudson.model.FreeStyleProject;
import hudson.model.Run;
import hudson.model.TaskListener;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.jvnet.hudson.test.JenkinsRule;
import org.mockito.Answers;
import org.mockito.M... | package org.jenkinsci.plugins.github.status.sources;
import hudson.model.Run;
import hudson.model.TaskListener;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Answers;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoRule... |
[MISC] Test all grunt tasks on Travis CI | var config = require('./Build/Config');
module.exports = function(grunt) {
'use strict';
// Display the execution time of grunt tasks
require('time-grunt')(grunt);
// Load all grunt-tasks in 'Build/Grunt-Options'.
var gruntOptionsObj = require('load-grunt-configs')(grunt, {
config : {
src: "Build/Grunt-Opt... | var config = require('./Build/Config');
module.exports = function(grunt) {
'use strict';
// Display the execution time of grunt tasks
require('time-grunt')(grunt);
// Load all grunt-tasks in 'Build/Grunt-Options'.
var gruntOptionsObj = require('load-grunt-configs')(grunt, {
config : {
src: "Build/Grunt-Opt... |
Add cellNumber as alias for en_GB mobileNumber method | <?php
namespace Faker\Provider\en_GB;
class PhoneNumber extends \Faker\Provider\PhoneNumber
{
protected static $formats = array(
'+44(0)##########',
'+44(0)#### ######',
'+44(0)#########',
'+44(0)#### #####',
'0##########',
'0#########',
'0#### ######',
... | <?php
namespace Faker\Provider\en_GB;
class PhoneNumber extends \Faker\Provider\PhoneNumber
{
protected static $formats = array(
'+44(0)##########',
'+44(0)#### ######',
'+44(0)#########',
'+44(0)#### #####',
'0##########',
'0#########',
'0#### ######',
... |
Add lightweight method for detecting duplicate search nodes. | package com.github.dieterdepaepe.jsearch.search.statespace;
/**
* A node encountered in the search graph while solving a problem.
* <p>
* There is a subtle but important difference between a {@code SearchNode} and a search space state. A search space
* state represents the result from a set of chosen actions. A {@... | package com.github.dieterdepaepe.jsearch.search.statespace;
/**
* A node encountered in the search graph while solving a problem.
* <p>
* There is a subtle but important difference between a {@code SearchNode} and a search space state. A search space
* state represents the result from a set of chosen actions. A {@... |
Change to go with the change. | package "go-age"
import (
"testing"
"time"
)
type AgeTestCandidate struct {
BirthDate time.Time
CheckingTime time.Time
ExpectedAge int
}
var AgeTestCandidates = []AgeTestCandidate{
{time.Date(2000, 3, 14, 0, 0, 0, 0, time.UTC), time.Date(2010, 3, 14, 0, 0, 0, 0, time.UTC), 10},
{time.Date(2001, 3, 14, 0, ... | package goage
import (
"testing"
"time"
)
type AgeTestCandidate struct {
BirthDate time.Time
CheckingTime time.Time
ExpectedAge int
}
var AgeTestCandidates = []AgeTestCandidate{
{time.Date(2000, 3, 14, 0, 0, 0, 0, time.UTC), time.Date(2010, 3, 14, 0, 0, 0, 0, time.UTC), 10},
{time.Date(2001, 3, 14, 0, 0, ... |
Add explicit visibility for method getOrder
Add explicit visibility following PSR-2 | <?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS B... | <?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS B... |
Use relative href on 503 font path | <html>
<head>
<link href='//fonts.googleapis.com/css?family=Lato:100' rel='stylesheet' type='text/css'>
<style>
body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
color: #B0BEC5;
display: table;
font-weight: 100;
font-family: 'Lato';
}
.container {
text-align: c... | <html>
<head>
<link href='http://fonts.googleapis.com/css?family=Lato:100' rel='stylesheet' type='text/css'>
<style>
body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
color: #B0BEC5;
display: table;
font-weight: 100;
font-family: 'Lato';
}
.container {
text-ali... |
Fix ./activator dist for the scaladoc | package controllers;
import play.mvc.Controller;
import services.configuration.ConfigurationService;
import utils.json.JsonHelper;
import com.google.inject.Singleton;
@Singleton
public class AbstractController extends Controller {
protected static final String _TITLE = "Reactive AngularApp's - Elasticsearch 1.4... | package controllers;
import play.mvc.Controller;
import services.configuration.ConfigurationService;
import utils.json.JsonHelper;
import com.google.inject.Singleton;
@Singleton
public class AbstractController extends Controller {
protected static final String _TITLE = "Reactive AngularApp's - Elasticsearch 1.4... |
Allow app.json without templateType key
The v2 app.json should not have a templateType key in it. MeshInteraction
does require that it is constructed with that key, at least until we
refactor it, so pass a blank string when the app.json does not contain
a templateType key.
https://phabricator.endlessm.com/T11064 | const EvinceDocument = imports.gi.EvinceDocument;
const Gio = imports.gi.Gio;
const ModuleFactory = imports.app.moduleFactory;
const Utils = imports.app.utils;
let create_interaction = function (application, resource_path) {
// Initialize libraries
EvinceDocument.init();
let app_resource = Gio.Resource.l... | const EvinceDocument = imports.gi.EvinceDocument;
const Gio = imports.gi.Gio;
const ModuleFactory = imports.app.moduleFactory;
const Utils = imports.app.utils;
let create_interaction = function (application, resource_path) {
// Initialize libraries
EvinceDocument.init();
let app_resource = Gio.Resource.l... |
Introduce cache clear logic through GoogleDrive webhook endpoint. | # -*- encoding:utf8 -*-
import httplib2
from flask import Blueprint, redirect, request, Response, abort
from model.cache import Cache
from model.oauth import OAuth
from model.utils import Utils
drive = Blueprint('drive', __name__, url_prefix='/drive')
@drive.route("/auth", methods=['GET'])
def hookauth():
flo... | # -*- encoding:utf8 -*-
import httplib2
from flask import Blueprint, redirect, request, Response, abort
from model.oauth import OAuth
from model.utils import Utils
drive = Blueprint('drive', __name__, url_prefix='/drive')
@drive.route("/auth", methods=['GET'])
def hookauth():
flow = OAuth().get_flow()
if ... |
Fix test run failures with double-registration on ICEkitURLField
Use the new `ICEkitURLField.register_model_once` method available in
django-icekit to safely register base events for `ICEkitURLField`
without the risk that they will be re-registered (and therefore fail)
because of the way the unit tests reload this app... | """
App configuration for ``icekit_events`` app.
"""
# Register signal handlers, but avoid interacting with the database.
# See: https://docs.djangoproject.com/en/1.8/ref/applications/#django.apps.AppConfig.ready
from django.apps import AppConfig
from django.utils.module_loading import autodiscover_modules
from any_... | """
App configuration for ``icekit_events`` app.
"""
# Register signal handlers, but avoid interacting with the database.
# See: https://docs.djangoproject.com/en/1.8/ref/applications/#django.apps.AppConfig.ready
from django.apps import AppConfig
from django.utils.module_loading import autodiscover_modules
from any_... |
Print end as "nothing" instead of "no any object" | // --------------------------------------------------------------------
// Imports
// --------------------------------------------------------------------
var common = require('./common.js');
var pexprs = require('./pexprs.js');
var awlib = require('awlib');
var printString = awlib.stringUtils.printString;
var makeSt... | // --------------------------------------------------------------------
// Imports
// --------------------------------------------------------------------
var common = require('./common.js');
var pexprs = require('./pexprs.js');
var awlib = require('awlib');
var printString = awlib.stringUtils.printString;
var makeSt... |
Change to filters now that can-has prebaked | $(document).ready(function() {
function NavBarModel() {
var self = this;
self.filters = ko.observableArray();
};
var nbm = new NavBarModel();
ko.applyBindings(nbm);
/* TODO: Figure out how to stuff filters into a
computed observable so this function gets called
on fil... | $(document).ready(function() {
function NavBarModel() {
var self = this;
self.filters = ko.observableArray();
};
var nbm = new NavBarModel();
ko.applyBindings(nbm);
/* TODO: Figure out how to stuff filters into a
computed observable so this function gets called
on fil... |
Fix wrong import from UploadHandler | import os
from src.data.Track import UploadHandler
from src.data.Track.Tracks import YoutubeTrack
class YoutubeUploadHandler(UploadHandler):
def __init__(self, workingDir):
super().__init__(workingDir)
self.attributes.update({
"URL": ["string", "required", "url"]
})
def... | import os
from data.Track.UploadHandler import UploadHandler
from src.data.Track.Tracks import YoutubeTrack
class YoutubeUploadHandler(UploadHandler):
def __init__(self, workingDir):
super().__init__(workingDir)
self.attributes.update({
"URL": ["string", "required", "url"]
... |
[Bitbay] Use compact JSON instead of replacing whitespaces in String | package org.knowm.xchange.bitbay.v3.service;
import java.io.IOException;
import java.util.UUID;
import org.knowm.xchange.Exchange;
import org.knowm.xchange.bitbay.v3.dto.trade.BitbayUserTrades;
import org.knowm.xchange.bitbay.v3.dto.trade.BitbayUserTradesQuery;
import org.knowm.xchange.exceptions.ExchangeException;
im... | package org.knowm.xchange.bitbay.v3.service;
import java.io.IOException;
import java.util.UUID;
import java.util.regex.Pattern;
import org.knowm.xchange.Exchange;
import org.knowm.xchange.bitbay.v3.dto.trade.BitbayUserTrades;
import org.knowm.xchange.bitbay.v3.dto.trade.BitbayUserTradesQuery;
import org.knowm.xchange.... |
Use UTF-8 as default encoding. | # -*- coding: utf-8 -*-
# Copyright (c) 2013-2015, Sebastian Linke
# Released under the Simplified BSD license
# (see LICENSE file for details).
"""
Constants that are used by `shcol` in many places. This is meant to modified (if
needed) only *before* running `shcol`, since most of these constants are only
read durin... | # -*- coding: utf-8 -*-
# Copyright (c) 2013-2015, Sebastian Linke
# Released under the Simplified BSD license
# (see LICENSE file for details).
"""
Constants that are used by `shcol` in many places. This is meant to modified (if
needed) only *before* running `shcol`, since most of these constants are only
read durin... |
Stop the socket from warning (for now)
It was constantly giving an "Ignoring unmatched topic "authorized:lobby"
warning to the console. | /* This javascript was taken from the PhoenixGuardian Project */
/*
import {Socket} from "deps/phoenix/web/static/js/phoenix";
const authSocket = new Socket("/socket");
authSocket.connect();
const token = $('meta[name="guardian_token"]').attr('content');
const channel = authSocket.channel("authorized:lobby", {guardi... | /* This javascript was taken from the PhoenixGuardian Project */
import {Socket} from "deps/phoenix/web/static/js/phoenix";
const authSocket = new Socket("/socket");
authSocket.connect();
const token = $('meta[name="guardian_token"]').attr('content');
const channel = authSocket.channel("authorized:lobby", {guardian... |
Make sure we pass in the segments if this is not instanceof Message | var _ = require('underscore')
, utils = require('./utils')
module.exports = Message
function Message(segments) {
if (!(this instanceof Message))
return new Message(segments)
if (segments && Array.isArray(segments)) {
this.segments = segments
this.segmentTypes = _.unique(
_.pluck(this.segments,... | var _ = require('underscore')
, utils = require('./utils')
module.exports = Message
function Message(segments) {
if (!(this instanceof Message))
return new Message()
if (segments && Array.isArray(segments)) {
this.segments = segments
this.segmentTypes = _.unique(
_.pluck(this.segments, 'Segmen... |
Change letter from capitalize to lowercase | <?php
/*
* BlueCloud PHP MVC
* Bluecloud is a simple PHP MVC app made using PHP
* MIT Licensed Project
* Copyright (c) 2017 Kel Novi
* github.com/novhex
*/
use Router\Router;
use Routes\Routes;
class Bootstrap {
public function __construct(){
self::loadControllers();
self::loadGenericFunctions();
self::lo... | <?php
/*
* BlueCloud PHP MVC
* Bluecloud is a simple PHP MVC app made using PHP
* MIT Licensed Project
* Copyright (c) 2017 Kel Novi
* github.com/novhex
*/
use Router\Router;
use Routes\Routes;
class Bootstrap {
public function __construct(){
self::loadControllers();
self::loadGenericFunctions();
self::lo... |
Change of variables of Estatisitca | package br.com.MDSGPP.ChamadaParlamentar.model;
import java.util.ArrayList;
public class Estatistica {
private String name;
private String numberOfSession;
private String totalSessao;
private String percentage;
private ArrayList<String> lista = new ArrayList<String>();
public Estatistica(){
}
public St... | package br.com.MDSGPP.ChamadaParlamentar.model;
import java.util.ArrayList;
public class Estatistica {
private String nome;
private String numeroSessao;
private String totalSessao;
private String porcentagem;
private ArrayList<String> lista = new ArrayList<String>();
public Estatistica(){
}
public Stri... |
Correct the class name.
[ci skip] | import Ember from 'ember';
/**
* @module ivy-tree
*/
/**
* @class IvyTreeGroupComponent
* @namespace IvyTree
* @extends Ember.Component
*/
export default Ember.Component.extend({
attributeBindings: ['aria-hidden', 'role'],
classNames: ['ivy-tree-group'],
tagName: 'ul',
init: function() {
this._supe... | import Ember from 'ember';
/**
* @module ivy-tree
*/
/**
* @class IvyTreeComponent
* @namespace IvyTree
* @extends Ember.Component
*/
export default Ember.Component.extend({
attributeBindings: ['aria-hidden', 'role'],
classNames: ['ivy-tree-group'],
tagName: 'ul',
init: function() {
this._super();
... |
Fix method name to conform to tests | class CheckBrackets:
OPENERS = {'{': '}',
'[': ']',
'(': ')'}
CLOSERS = set(OPENERS.values())
def __init__(self, inp):
self.check_brackets = self.build_stack(inp)
def build_stack(self, inp):
stack = []
for char in list(inp):
if char in ... | class CheckBrackets:
OPENERS = {'{': '}',
'[': ']',
'(': ')'}
CLOSERS = set(OPENERS.values())
def __init__(self, inp):
self.check_brackets = self.build_stack(inp)
def build_stack(self, inp):
stack = []
for char in list(inp):
if char in ... |
:new: Set tabindex on panel messages to allow text selection | 'use babel'
/* @flow */
/** @jsx React.h */
import { CompositeDisposable } from 'atom'
import React from 'preact'
import Message from './message'
import { sortMessages } from '../helpers'
import type { Linter$Message } from '../types'
type Messages$State = { messages: Array<Linter$Message>, showProviderName: boolean... | 'use babel'
/* @flow */
/** @jsx React.h */
import { CompositeDisposable } from 'atom'
import React from 'preact'
import Message from './message'
import { sortMessages } from '../helpers'
import type { Linter$Message } from '../types'
type Messages$State = { messages: Array<Linter$Message>, showProviderName: boolean... |
Fix not execution flash object
In Chrome 60 -, removed the final exception for PPS(Plugin Power Saver).
Ref: https://www.chromium.org/flash-roadmap (PPS Tiny - No Same
Origin Exceptions (Target: Chrome 60 - Aug 2017)) | import swfobject from 'swfobject';
const TIMEOUT = 1000;
const ID = '__flash_detector';
const CALLBACK = `${ID}_call`;
function clear(el) {
document.body.removeChild(el);
delete window[CALLBACK];
}
/**
* Detects if Adobe Flash is actually alive in a browser
* @param {string} swfPath - The path to FlashDetector... | import swfobject from 'swfobject';
const TIMEOUT = 1000;
const ID = '__flash_detector';
const CALLBACK = `${ID}_call`;
function clear(el) {
document.body.removeChild(el);
delete window[CALLBACK];
}
/**
* Detects if Adobe Flash is actually alive in a browser
* @param {string} swfPath - The path to FlashDetector... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.