text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Add hybrid (XEP-0126 & XEP-0186) service to initial presence test. | """
Tests setting your own presence before calling Connect(), allowing the user to
sign in as Busy/Invisible/whatever rather than available.
"""
from twisted.words.xish import domish
from gabbletest import exec_test
from servicetest import EventPattern, assertEquals, assertNotEquals
import ns
import constants as cs
f... | """
Tests setting your own presence before calling Connect(), allowing the user to
sign in as Busy/Invisible/whatever rather than available.
"""
from twisted.words.xish import domish
from gabbletest import exec_test
from servicetest import EventPattern, assertEquals, assertNotEquals
import ns
import constants as cs
f... |
Remove "Duration -" from duration string.
Remove leading zero on hour in duration string. | /*
* Copyright 2011 Intel Corporation.
*
* This program is licensed under the terms and conditions of the
* Apache License, version 2.0. The full text of the Apache License is at
* http://www.apache.org/licenses/LICENSE-2.0
*/
function getCallStatusText (agent) {
switch(agent.callStatus) {
case CallAge... | /*
* Copyright 2011 Intel Corporation.
*
* This program is licensed under the terms and conditions of the
* Apache License, version 2.0. The full text of the Apache License is at
* http://www.apache.org/licenses/LICENSE-2.0
*/
function getCallStatusText (agent) {
switch(agent.callStatus) {
case CallAge... |
Add new lines here because they are added by some editors(vim for
example) | package com.nikolavp.approval.reporters;
import com.nikolavp.approval.Approval;
import org.junit.Assume;
import org.junit.Ignore;
import org.junit.Test;
import java.awt.*;
import java.nio.file.FileSystems;
/**
*
* User: nikolavp
* Date: 26/02/14
* Time: 14:28
*/
@Ignore
public class ReportersExamplesIT {
@... | package com.nikolavp.approval.reporters;
import com.nikolavp.approval.Approval;
import org.junit.Assume;
import org.junit.Test;
import java.awt.*;
import java.nio.file.FileSystems;
/**
*
* User: nikolavp
* Date: 26/02/14
* Time: 14:28
*/
public class ReportersExamplesIT {
@Test
public void testGvimApp... |
Fix bug not letting default values through in ${} templates | (function registerStackProcessor() {
widget.parser.register( 'stack', {
prefix: '$',
doc: {
name: "${<i>variable</i>}"
},
recursive: true,
processor: decode
});
function decode( token, context )
{
var sep = token.indexOf( ',' );
var path;
if( sep > -1 )
{
va... | (function registerStackProcessor() {
widget.parser.register( 'stack', {
prefix: '$',
doc: {
name: "${<i>variable</i>}"
},
recursive: true,
processor: decode
});
function decode( token, context )
{
var sep = token.indexOf( ',' );
if( sep > -1 )
{
var dbName = tok... |
Update control panel test for fetch | import httpretty
from paystackapi.tests.base_test_case import BaseTestCase
from paystackapi.cpanel import ControlPanel
class TestPage(BaseTestCase):
@httpretty.activate
def test_fetch_payment_session_timeout(self):
"""Method defined to test fetch payment session timeout."""
httpretty.registe... | import httpretty
from paystackapi.tests.base_test_case import BaseTestCase
from paystackapi.cpanel import ControlPanel
class TestPage(BaseTestCase):
@httpretty.activate
def test_fetch_payment_session_timeout(self):
"""Method defined to test fetch payment session timeout."""
httpretty.registe... |
[minor] Use ~ operator to check for -1
This is mainly a style change as other expressjs modules use this.
Performance is mostly indifferent.
However, this tests specifically for -1. | module.exports = compressible
compressible.specs =
compressible.specifications = require('./specifications.json')
compressible.regex =
compressible.regexp = /json|text|javascript|dart|ecmascript|xml/
compressible.get = get
function compressible(type) {
if (!type || typeof type !== "string") return false
var i =... | module.exports = compressible
compressible.specs =
compressible.specifications = require('./specifications.json')
compressible.regex =
compressible.regexp = /json|text|javascript|dart|ecmascript|xml/
compressible.get = get
function compressible(type) {
if (!type || typeof type !== "string") return false
var i =... |
refactor: Remove old imports from main | #! /usr/bin/env python
import os
import time
from slackclient import SlackClient
import pyrebase
import linkatos.firebase as fb
# starterbot environment variables
BOT_ID = os.environ.get("BOT_ID")
SLACK_BOT_TOKEN = os.environ.get("SLACK_BOT_TOKEN")
# instantiate Slack clients
slack_client = SlackClient(SLACK_BOT_TOKE... | #! /usr/bin/env python
import os
import time
from slackclient import SlackClient
import pyrebase
import linkatos.parser as parser
import linkatos.confirmation as confirmation
import linkatos.printer as printer
import linkatos.utils as utils
import linkatos.firebase as fb
# starterbot environment variables
BOT_ID = os.... |
Switch to use database for image ui | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from flask import render_template, Blueprint, json
from zhihudaily.cache import cache
from zhihudaily.models import Zhihudaily
from zhihudaily.utils import Date
image_ui = Blueprint('image_ui', __name__, templat... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import datetime
from flask import render_template, Blueprint
from zhihudaily.utils import make_request
from zhihudaily.cache import cache
image_ui = Blueprint('image_ui', __name__, template_folder='templates')
... |
Remove active key since is deprecated | # -*- coding: utf-8 -*-
#
#
# Copyright (C) 2013-15 Agile Business Group sagl
# (<http://www.agilebg.com>)
#
# 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 ... | # -*- coding: utf-8 -*-
#
#
# Copyright (C) 2013-15 Agile Business Group sagl
# (<http://www.agilebg.com>)
#
# 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 ... |
Add import path for sass files on Mac OS | <?php
/**
*
* PHP.Gt (http://php.gt)
* @copyright Copyright Ⓒ 2014 Bright Flair Ltd. (http://brightflair.com)
* @license Apache Version 2.0, January 2004. http://www.apache.org/licenses
*/
namespace Gt\ClientSide;
use \Gt\Core\Path;
use \Gt\Response\Response;
use \scssc as ScssParser;
class Compiler {
/**
* Pa... | <?php
/**
*
* PHP.Gt (http://php.gt)
* @copyright Copyright Ⓒ 2014 Bright Flair Ltd. (http://brightflair.com)
* @license Apache Version 2.0, January 2004. http://www.apache.org/licenses
*/
namespace Gt\ClientSide;
use \Gt\Response\Response;
use \scssc as ScssParser;
class Compiler {
/**
* Parses a source file ... |
Add a requires on python-six 1.4.0 ( for add_metaclass )
This also mean that this doesn't run on RHEL 7 as of today. | #!/usr/bin/env python
import sys
from ansible import __version__
try:
from setuptools import setup, find_packages
except ImportError:
print("Ansible now needs setuptools in order to build. Install it using"
" your package manager (usually python-setuptools) or via pip (pip"
" install s... | #!/usr/bin/env python
import sys
from ansible import __version__
try:
from setuptools import setup, find_packages
except ImportError:
print("Ansible now needs setuptools in order to build. Install it using"
" your package manager (usually python-setuptools) or via pip (pip"
" install s... |
Fix url to use new homepage | from setuptools import setup, find_packages
import sys, os
from applib import __version__
setup(name='applib',
version=__version__,
description="Cross-platform application utilities",
long_description="""\
""",
classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_class... | from setuptools import setup, find_packages
import sys, os
from applib import __version__
setup(name='applib',
version=__version__,
description="Cross-platform application utilities",
long_description="""\
""",
classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_class... |
Fix airflow.utils deprecation warning code being Python 3 incompatible
See https://docs.python.org/3.0/whatsnew/3.0.html#operators-and-special-methods | # -*- coding: utf-8 -*-
#
# 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, software
... | # -*- coding: utf-8 -*-
#
# 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, software
... |
Fix bug with alloy deployed to dialog | import React, {Component, PropTypes} from 'react';
import AlloyEditor from 'alloyeditor';
export default class AlloyEditorComponent extends Component {
componentDidMount() {
this._editor = AlloyEditor.editable(this.props.container, this.props.alloyEditorConfig);
this._nativeEditor = this._editor.ge... | import React, {Component, PropTypes} from 'react';
import AlloyEditor from 'alloyeditor';
export default class AlloyEditorComponent extends Component {
componentDidMount() {
this._editor = AlloyEditor.editable(this.props.container, this.props.alloyEditorConfig);
this._nativeEditor = this._editor.ge... |
Add exception for definitions ending in etc.
Fixes wordset/wordset#64 | import Ember from 'ember';
import Base from 'ember-validations/validators/base';
export default Base.extend({
call: function() {
var prop = this.model.get(this.property);
var backtick = "`";
var endingPunctuation = [".", "?", "!"];
if (Ember.isBlank(prop)) {
this.errors.pushObject("We need som... | import Ember from 'ember';
import Base from 'ember-validations/validators/base';
export default Base.extend({
call: function() {
var prop = this.model.get(this.property);
var backtick = "`";
var endingPunctuation = [".", "?", "!"];
if (Ember.isBlank(prop)) {
this.errors.pushObject("We need som... |
Add reference tests for created objects | import {load} from "Injector";
import A from "example/A";
import D from "example/D";
import assert from "./assert";
import Context from "./di/Context";
const d = load(D, {name:'injected instance'});
const context = new Context({[D]: d});
const a1 = load(A, context);
const a2 = load(A, context);
const a3 = load(A, {[D... | import {load} from "Injector";
import A from "example/A";
import D from "example/D";
import assert from "./assert";
import Context from "./di/Context";
const d = load(D, {name:'injected instance'});
const context = new Context({[D]: d});
const a1 = load(A, context);
const a2 = load(A, context);
const a3 = load(A, {[D... |
Make the enum element comparison strict
The current check is matching numeric strings that are not equal ( like "604.1" == "604.10" because of PHP's == behavior that converts numeric strings to numbers and then performs a numeric comparison), even if type is checked before the comparison, the value should be identic | <?php
/*
* This file is part of the JsonSchema package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace JsonSchema\Constraints;
/**
* The Enum Constraints, validates an element against a given set of possibilities
*
*... | <?php
/*
* This file is part of the JsonSchema package.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace JsonSchema\Constraints;
/**
* The Enum Constraints, validates an element against a given set of possibilities
*
*... |
Fix locales for windows and unix
Signed-off-by: Josua Grawitter <c028c213ed5efcf30c3f4fc7361dbde0c893c5b7@greyage.org> | <?php
require_once('config.inc.php');
require_once('misc.inc.php');
require_once('db.inc.php');
require_once('html.inc.php');
date_default_timezone_set('Europe/Berlin');
setlocale(LC_TIME, 'de_DE.utf8', 'deu');
session_start();
// Actual content generation:
$db = new db();
switch ($_GET['view']) {
case 'print':
... | <?php
require_once('config.inc.php');
require_once('misc.inc.php');
require_once('db.inc.php');
require_once('html.inc.php');
date_default_timezone_set('Europe/Berlin');
setlocale(LC_TIME, 'deu');
session_start();
// Actual content generation:
$db = new db();
switch ($_GET['view']) {
case 'print':
authenticate... |
Allow one field payload on method links. | var $ = require('jquery');
$(document).ready(function() {
var $body = $('body');
// Allow links to specify a HTTP method using `data-method`
$('[data-method]').on('click', function(event) {
event.preventDefault();
var url = $(this).attr('href');
var method = $(this).data('method');
var formIte... | var $ = require('jquery');
$(document).ready(function() {
var $body = $('body');
// Allow links to specify a HTTP method using `data-method`
$('[data-method]').on('click', function(event) {
event.preventDefault();
var url = $(this).attr('href');
var method = $(this).data('method');
var csrfTok... |
FIX css path in treeForVendor | /* jshint node: true */
'use strict';
var path = require('path');
var fs = require('fs');
var Funnel = require('broccoli-funnel');
process.setMaxListeners(0);
module.exports = {
name: 'ember-enterprise-core',
included: function(app) {
this._super.included(app);
var useScss = app.options['emberEnterprise.... | /* jshint node: true */
'use strict';
var path = require('path');
var fs = require('fs');
var Funnel = require('broccoli-funnel');
var log = require('broccoli-stew').log;
process.setMaxListeners(0);
module.exports = {
name: 'ember-enterprise-core',
included: function(app) {
this._super.included(app);
var... |
Add defer to ensure that logger will be called after serve http. | package mux
import (
"log"
"net/http"
"time"
)
type WrapperFunc func(handlerFunc http.Handler) http.Handler
// Wraps handler func with slice of wrapper functions one by one.
func Wrap(h http.Handler, wrappers ...WrapperFunc) http.Handler {
for _, w := range wrappers {
h = w(h)
}
return h
}
// Logs requests
... | package mux
import (
"log"
"net/http"
"time"
)
type WrapperFunc func(handlerFunc http.Handler) http.Handler
// Wraps handler func with slice of wrapper functions one by one.
func Wrap(h http.Handler, wrappers ...WrapperFunc) http.Handler {
for _, w := range wrappers {
h = w(h)
}
return h
}
// Logs requests
... |
Fix link click handling - some regular links were erroneously caught | debug_log("Creating click handler");
$("body").on("click", "a", function(event) {
debug_log("Click handler activated.")
var url = $(this).prop("href");
debug_log("URL: "+url)
if (ExtensionConfig.handle_magnets) {
debug_log("Handling magnets enabled");
if (url.indexOf("magnet:") == 0) {
debug_log("Detected li... | debug_log("Creating click handler");
$("body").on("click", "a", function(event) {
debug_log("Click handler activated.")
var url = $(this).prop("href");
debug_log("URL: "+url)
if (ExtensionConfig.handle_magnets) {
debug_log("Handling magnets enabled");
if (url.indexOf("magnet:") == 0) {
debug_log("Detected li... |
Insert Script Tag at Foot of the `<head>` Tag
Ensures we're less likely to inflict damage to people's performance due
to tag ordering. | /* jshint node: true */
'use strict';
module.exports = {
name: 'ember-cli-trackjs',
contentFor: function (type, config) {
var trackOpts;
var trackConfig;
var trackConfiguration;
var trackBoilerPlate;
var addonConfig;
if (type === 'head-footer') {
trackOpts = config.trackJs || {};
... | /* jshint node: true */
'use strict';
module.exports = {
name: 'ember-cli-trackjs',
contentFor: function (type, config) {
var trackOpts;
var trackConfig;
var trackConfiguration;
var trackBoilerPlate;
var addonConfig;
if (type === 'head') {
trackOpts = config.trackJs || {};
tra... |
Allow to override progress property of backdrop-content | import Ember from "ember";
const {
Component,
computed,
String: { htmlSafe },
computed: { oneWay },
inject: { service },
get,
} = Ember;
export default Component.extend({
sideMenu: service(),
progress: oneWay("sideMenu.progress"),
attributeBindings: ["style"],
classNames: ["c... | import Ember from "ember";
const {
Component,
computed,
String: { htmlSafe },
computed: { alias },
inject: { service },
get,
} = Ember;
export default Component.extend({
sideMenu: service(),
progress: alias("sideMenu.progress"),
attributeBindings: ["style"],
classNames: ["con... |
Make sure current date is late enough | integration_test = True
timeout = 2
SLEEP_INTERVAL = int(100e6)
MIN_TIME = 1451606400000000000 # 2016-1-1 0:0:0.0 UTC
def check_state(state):
import re
from functools import partial
from operator import is_not
r = re.compile('^(\d+) \[.*\] Hello World!')
lines = map(r.match, state.console.split(... | integration_test = True
timeout = 2
SLEEP_INTERVAL = int(100e6)
def check_state(state):
import re
from functools import partial
from operator import is_not
r = re.compile('^(\d+) \[.*\] Hello World!')
lines = map(r.match, state.console.split('\n'))
lines = filter(partial(is_not, None), lines... |
Fix test config import issues | "use strict";
let path = require('path'),
fs = require('fs');
// ========================================
// Load global modules
// ========================================
global._ = require('lodash');
global.winston = require('winston');
// ========================================
// Load configuration values
/... | "use strict";
let path = require('path'),
fs = require('fs');
// ========================================
// Load global modules
// ========================================
global._ = require('lodash');
global.winston = require('winston');
// ========================================
// Load configuration values
/... |
Change Auth\Guard to use Guard Contract | <?php namespace GeneaLabs\LaravelMixpanel\Providers;
use GeneaLabs\LaravelMixpanel\LaravelMixpanel;
use GeneaLabs\LaravelMixpanel\Listeners\LaravelMixpanelEventHandler;
use GeneaLabs\LaravelMixpanel\Listeners\LaravelMixpanelUserObserver;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Support\Facades\Event;
use Il... | <?php namespace GeneaLabs\LaravelMixpanel\Providers;
use GeneaLabs\LaravelMixpanel\LaravelMixpanel;
use GeneaLabs\LaravelMixpanel\Listeners\LaravelMixpanelEventHandler;
use GeneaLabs\LaravelMixpanel\Listeners\LaravelMixpanelUserObserver;
use Illuminate\Auth\Guard;
use Illuminate\Support\Facades\Event;
use Illuminate\H... |
[Federation] Fix the comments on FederationNameAnnotation | /*
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 2016 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, ... |
Remove exit from start event payload | 'use strict';
const { mapValues, omit, pSetTimeout } = require('../utilities');
const { logEvent } = require('../log');
const { getDefaultDuration } = require('../perf');
// Create event when all protocol-specific servers have started
const emitStartEvent = async function ({ protocols, config, measures }) {
const m... | 'use strict';
const { mapValues, omit, pSetTimeout } = require('../utilities');
const { logEvent } = require('../log');
const { getDefaultDuration } = require('../perf');
// Create event when all protocol-specific servers have started
const emitStartEvent = async function ({
protocols,
config,
gracefulExit,
m... |
Add real XP value to ChracterStatusDialog.
Still need real MaxXP | ui.CharacterStatusDialog = function(template, character) {
ui.Dialog.call(this, template);
this.name = ui.label(this, '.label.name');
this.hp = ui.progressbar(this, '.progressbar.health');
this.mp = ui.progressbar(this, '.progressbar.mana');
this.xp = ui.progressbar(this, '.progressbar.exp');
if (... | ui.CharacterStatusDialog = function(template, character) {
ui.Dialog.call(this, template);
this.name = ui.label(this, '.label.name');
this.hp = ui.progressbar(this, '.progressbar.health');
this.mp = ui.progressbar(this, '.progressbar.mana');
this.xp = ui.progressbar(this, '.progressbar.exp');
if (... |
Fix mari pointing to dead dir | /*
* itsjoke.js - It's Joke!.
*
* Contributed by Capuccino and Ovyerus.
*/
/* eslint-env node */
const fs = require('fs');
const files = fs.readdirSync(`${__baseDir}/assets/itsjoke`);
exports.commands = [
'mari'
];
exports.mari = {
desc: "It's joke!",
longDesc: "Send a random picture of the it's jo... | /*
* itsjoke.js - It's Joke!.
*
* Contributed by Capuccino and Ovyerus.
*/
/* eslint-env node */
const fs = require('fs');
const files = fs.readdirSync(`${__baseDir}/res/itsjoke`);
exports.commands = [
'mari'
];
exports.mari = {
desc: "It's joke!",
longDesc: "Send a random picture of the it's joke ... |
Add way to debug lambda function end 2 end | """
Entry point for lambda
"""
from _ebcf_alexa import interaction_model, incoming_types, speechlet
import logging
LOG = logging.getLogger()
LOG.setLevel(logging.DEBUG)
ALEXA_SKILL_ID = 'amzn1.ask.skill.d6f2f7c4-7689-410d-9c35-8f8baae37969'
def lambda_handler(event_dict: dict, context) -> dict:
""" Route the inc... | """
Entry point for lambda
"""
from _ebcf_alexa import interaction_model, incoming_types, speechlet
import logging
LOG = logging.getLogger()
LOG.setLevel(logging.DEBUG)
ALEXA_SKILL_ID = 'amzn1.ask.skill.d6f2f7c4-7689-410d-9c35-8f8baae37969'
def lambda_handler(event_dict: dict, context) -> dict:
""" Route the inc... |
Clean up runloop now that it's always on | import {
TICK,
} from './ActionTypes';
class RunLoop {
constructor() {
this.store = null;
this._listeners = [];
this._lastTickMs = Date.now();
window.requestAnimationFrame(this._runLoop.bind(this));
}
_runLoop() {
const now = Date.now();
const dt = now - this._lastTickMs;
this._l... | import {
TICK,
} from './ActionTypes';
class RunLoop {
constructor() {
this.store = null;
this._listeners = [];
let prev = Date.now();
let runLoop = () => {
const now = Date.now();
const dt = now - prev;
prev = now;
this.store.dispatch({
type: TICK,
dt,
... |
Add that nifty closing parenthesis | var _ = require('lodash');
if (process.env.NODE_ENV === 'production') {
var twilio = require('twilio')(process.env.TWILIO_ACCOUNT_ID, process.env.TWILIO_AUTH_TOKEN);
var phoneNumber = process.env.TWILIO_PHONE_NUMBER;
module.exports = {
send: function (number, message) {
var messages = [];
mes... | var _ = require('lodash');
if (process.env.NODE_ENV === 'production') {
var twilio = require('twilio')(process.env.TWILIO_ACCOUNT_ID, process.env.TWILIO_AUTH_TOKEN);
var phoneNumber = process.env.TWILIO_PHONE_NUMBER;
module.exports = {
send: function (number, message) {
var messages = [];
mes... |
Fix Checkstyle issues: First sentence should end with a period.
git-svn-id: c455d203a03ec41bf444183aad31e7cce55db786@1352225 13f79535-47bb-0310-9956-ffa450edef68 | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
Add more to test for selection in create hook. | var tape = require("tape"),
jsdom = require("jsdom"),
d3 = Object.assign(require("../"), require("d3-selection"));
/*************************************
************ Components *************
*************************************/
// Leveraging create hook with selection as first argument.
var checkboxHTML ... | var tape = require("tape"),
jsdom = require("jsdom"),
d3 = Object.assign(require("../"), require("d3-selection"));
/*************************************
************ Components *************
*************************************/
// Leveraging create hook with selection as first argument.
var checkboxHTML ... |
Add missing implementation in StaticAccessControl | <?php
/**
* This file is part of the Imbo package
*
* (c) Christer Edvartsen <cogo@starzinger.net>
*
* For the full copyright and license information, please view the LICENSE file that was
* distributed with this source code.
*/
use Imbo\Auth\AccessControl\Adapter\AdapterInterface,
Imbo\Auth\AccessControl\A... | <?php
/**
* This file is part of the Imbo package
*
* (c) Christer Edvartsen <cogo@starzinger.net>
*
* For the full copyright and license information, please view the LICENSE file that was
* distributed with this source code.
*/
use Imbo\Auth\AccessControl\Adapter\AdapterInterface,
Imbo\Auth\AccessControl\A... |
Update guide url to shuup-guide.readthedocs.io
Refs SHUUP-3188 | # This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
#: ReadtheDocs API URL
#:
#: URL for fetching search results via ReadtheDocs API.
SHUUP_GUIDE_API_U... | # This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
#: ReadtheDocs API URL
#:
#: URL for fetching search results via ReadtheDocs API.
SHUUP_GUIDE_API_U... |
Rename alg value for easybox/secretbox | 'use strict';
var _ = require('lodash');
var algos = {
'eddsa': 'eddsa',
'curve25519': 'curve25519',
'triplesec-v3': 'triplesec-v3',
'scrypt': 'scrypt',
'nacl easybox': 'easybox',
'nacl secretbox': 'secretbox',
};
algos.name = function(b) {
b = ''+b; // coerce to string
var found = _.findKey(algos, fu... | 'use strict';
var _ = require('lodash');
var algos = {
'eddsa': 'eddsa',
'curve25519': 'curve25519',
'triplesec-v3': 'triplesec-v3',
'scrypt': 'scrypt',
'nacl easybox': 'nacl-easybox',
'nacl secretbox': 'nacl-secretbox',
};
algos.name = function(b) {
b = ''+b; // coerce to string
var found = _.findKey... |
Fix typo retrieving vendor prefix
Properly get the OSCAR_SAGEPAY_TX_CODE_PREFIX from the project settings | from django.conf import settings
VPS_PROTOCOL = getattr(settings, 'OSCAR_SAGEPAY_VPS_PROTOCOL', '3.0')
VENDOR = settings.OSCAR_SAGEPAY_VENDOR
TEST_MODE = getattr(settings, 'OSCAR_SAGEPAY_TEST_MODE', True)
if TEST_MODE:
VPS_REGISTER_URL = 'https://test.sagepay.com/Simulator/VSPDirectGateway.asp'
VPS_AUTHORISE... | from django.conf import settings
VPS_PROTOCOL = getattr(settings, 'OSCAR_SAGEPAY_VPS_PROTOCOL', '3.0')
VENDOR = settings.OSCAR_SAGEPAY_VENDOR
TEST_MODE = getattr(settings, 'OSCAR_SAGEPAY_TEST_MODE', True)
if TEST_MODE:
VPS_REGISTER_URL = 'https://test.sagepay.com/Simulator/VSPDirectGateway.asp'
VPS_AUTHORISE... |
Test exception on queue plugin manager validation | <?php
namespace SlmQueueTest\Queue;
use PHPUnit_Framework_TestCase as TestCase;
use SlmQueue\Queue\QueuePluginManager;
use SlmQueueTest\Util\ServiceManagerFactory;
use Zend\ServiceManager\ServiceManager;
class QueuePluginManagerTest extends TestCase
{
/**
* @var ServiceManager
*/
protected $service... | <?php
namespace SlmQueueTest\Queue;
use PHPUnit_Framework_TestCase as TestCase;
use SlmQueueTest\Util\ServiceManagerFactory;
use Zend\ServiceManager\ServiceManager;
class QueuePluginManagerTest extends TestCase
{
/**
* @var ServiceManager
*/
protected $serviceManager;
public function setUp()
... |
Exclude Proxy code from production build | import { DEBUG } from '@glimmer/env';
let exportedWindow;
let _setCurrentHandler;
if (DEBUG) {
// this Proxy handler will be used to preserve the unaltered behavior of the window global by default
const doNothingHandler = {
get(target, prop) {
const value = Reflect.get(target, prop);
// make sure... | // this Proxy handler will be used to preserve the unaltered behavior of the window global by default
const doNothingHandler = {
get(target, prop) {
const value = Reflect.get(target, prop);
// make sure the function receives the original window as the this context! (e.g. alert will throw an invalid invocatio... |
Add some explanation of logging options. | """Configuration file for harness.py
Author: Ian Huston
For license and copyright information see LICENSE.txt which was distributed with this file.
The main configuration options are for logging. By changing _debug to 1 (default
is 0) much more debugging information will be added to the log files.
The overall loggin... | """Configuration file for harness.py
Author: Ian Huston
For license and copyright information see LICENSE.txt which was distributed with this file.
"""
import logging
##################################################
# debug logging control
# 0 for off, 1 for on
##################################################
_... |
Clean the sandbox after the last test
Otherwise there can be some weird test pollution | (function(){
function mochaSinon(sinon){
if (typeof beforeEach !== "function") {
throw "mocha-sinon relies on mocha having been loaded.";
}
beforeEach(function() {
if (null == this.sinon) {
if (sinon.createSandbox) {
// Sinon 2+ (sinon.sandbox.create triggers a deprecation warning in Sinon... | (function(){
function mochaSinon(sinon){
if (typeof beforeEach !== "function") {
throw "mocha-sinon relies on mocha having been loaded.";
}
beforeEach(function() {
if (null == this.sinon) {
if (sinon.createSandbox) {
// Sinon 2+ (sinon.sandbox.create triggers a deprecation warning in Sinon... |
Move logic for fetching md files to it's own function
* wqflask/wqflask/markdown_routes.py
(render_markdown): New function.
(glossary): use render_markdown function. | """Markdown routes
Render pages from github, or if they are unavailable, look for it else where
"""
import os
import requests
import mistune
from flask import Blueprint
from flask import render_template
glossary_blueprint = Blueprint('glossary_blueprint', __name__)
def render_markdown(file_name):
"""Try to fet... | """Markdown routes
Render pages from github, or if they are unavailable, look for it else where
"""
import requests
import mistune
from flask import Blueprint
from flask import render_template
glossary_blueprint = Blueprint('glossary_blueprint', __name__)
@glossary_blueprint.route('/')
def glossary():
markdown... |
Fix fake db service API | 'use strict';
function FakeDatabaseService() {
}
module.exports = FakeDatabaseService;
FakeDatabaseService.prototype = {
run: function(query, callback) {
return callback(null, {});
},
createCacheTable: function(node, callback) {
return callback(null, true);
},
registerAnalysisI... | 'use strict';
function FakeDatabaseService() {
}
module.exports = FakeDatabaseService;
FakeDatabaseService.prototype = {
run: function(query, callback) {
return callback(null, {});
},
createCacheTable: function(node, callback) {
return callback(null, true);
},
registerAnalysisI... |
Add valid key for .map'd FeaturedGene components | import React from "react"
import PropTypes from "prop-types"
import styled from "styled-components"
import FeaturedGene from "./FeaturedGene"
const propTypes = {
featuredGeneLinks: PropTypes.array,
}
const Layout = styled.div`
display: none;
@media (min-width: 768px) {
display: block;
padding-top: 1em... | import React from "react"
import PropTypes from "prop-types"
import styled from "styled-components"
import FeaturedGene from "./FeaturedGene"
const propTypes = {
featuredGeneLinks: PropTypes.array,
}
const Layout = styled.div`
display: none;
@media (min-width: 768px) {
display: block;
padding-top: 1em... |
Tweak PHPDocs in the extension configuration files | <?php
namespace Symfony\Bundle\DoctrineMigrationsBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
/**
* DoctrineMigrationsExtension configuration structure.
*
* @author Lukas Kahwe Smith <smith@pooteeweet.org>
*/
class Configuration
{
/**
* Generates the configura... | <?php
namespace Symfony\Bundle\DoctrineMigrationsBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
/**
* DoctrineMigrationsExtension configuration structure.
*
* @author Lukas Kahwe Smith <smith@pooteeweet.org>
*/
class Configuration
{
/**
* Generates the configura... |
Check that expected title exists in the actual title, not the other way round | # (c) Crown Owned Copyright, 2016. Dstl.
import os
import unittest
from splinter import Browser
class TestLoginPage (unittest.TestCase):
def setUp(self):
self.browser = Browser('phantomjs')
def test_login_page_appears(self):
# This needs to come from an environment variable at some point
... | # (c) Crown Owned Copyright, 2016. Dstl.
import os
import unittest
from splinter import Browser
class TestLoginPage (unittest.TestCase):
def setUp(self):
self.browser = Browser('phantomjs')
def test_login_page_appears(self):
# This needs to come from an environment variable at some point
... |
Add assertion for issue gh-1089 | import os
from .. import run_nbgrader
from .base import BaseTestApp
class TestNbGraderGenerateConfig(BaseTestApp):
def test_help(self):
"""Does the help display without error?"""
run_nbgrader(["generate_config", "--help-all"])
def test_generate_config(self):
"""Is the config file pr... | import os
from .. import run_nbgrader
from .base import BaseTestApp
class TestNbGraderGenerateConfig(BaseTestApp):
def test_help(self):
"""Does the help display without error?"""
run_nbgrader(["generate_config", "--help-all"])
def test_generate_config(self):
"""Is the config file pr... |
Return the config, don't hit the callback | var http = require('http');
var yaml = require('js-yaml');
var fs = require('fs');
var spawn = require('child_process').spawn;
var chimneypot = require('chimneypot');
(function() {
function readConfig() {
var doc = yaml.safeLoad(fs.readFileSync('.deploy.yml', 'utf8'));
if (doc.config !== undefined && doc.co... | var http = require('http');
var yaml = require('js-yaml');
var fs = require('fs');
var spawn = require('child_process').spawn;
var chimneypot = require('chimneypot');
(function() {
function readConfig(callback) {
var doc = yaml.safeLoad(fs.readFileSync('.deploy.yml', 'utf8'));
if (doc.config !== undefined &... |
Fix `APP_ENV` not set in some runtime contexts | <?php
namespace Outlandish\Wpackagist\EventListener;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
class ExceptionListener
{
public function onKernelException(ExceptionEvent $event)
{
... | <?php
namespace Outlandish\Wpackagist\EventListener;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
class ExceptionListener
{
public function onKernelException(ExceptionEvent $event)
{
... |
Add one more if to speed up | # Remove Element https://oj.leetcode.com/problems/remove-element/
# Given an array and a value, remove all instances of that value in place and return the new length.
# The order of elements can be changed. It doesn't matter what you leave beyond the new length.
#Arrays
# Xilin SUN
# Jan 8 2015
# Don't forget to ret... | # Remove Element https://oj.leetcode.com/problems/remove-element/
# Given an array and a value, remove all instances of that value in place and return the new length.
# The order of elements can be changed. It doesn't matter what you leave beyond the new length.
#Arrays
# Xilin SUN
# Jan 8 2015
# Don't forget to ret... |
Add a backref from Link to LinkAttribute | # Copyright (c) 2014 Lukas Lalinsky, Wieland Hoffmann
# License: MIT, see LICENSE for details
from mbdata.models import Area, Artist, Label, LinkAttribute, Recording, ReleaseGroup, Work
from sqlalchemy import exc as sa_exc
from sqlalchemy.orm import relationship
from warnings import simplefilter
# Ignore SQLAlchemys w... | # Copyright (c) 2014 Lukas Lalinsky, Wieland Hoffmann
# License: MIT, see LICENSE for details
from mbdata.models import Area, Artist, Label, Recording, ReleaseGroup, Work
from sqlalchemy import exc as sa_exc
from sqlalchemy.orm import relationship
from warnings import simplefilter
# Ignore SQLAlchemys warnings that we... |
Return instance of Client rather than ClientBuilder | <?php
namespace Orphans\ElasticSearch\App\Providers;
use Illuminate\Support\Facades\App;
use Illuminate\Support\ServiceProvider;
use Elasticsearch\ClientBuilder;
class ElasticSearchServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
pub... | <?php
namespace Orphans\ElasticSearch\App\Providers;
use Illuminate\Support\Facades\App;
use Illuminate\Support\ServiceProvider;
use Elasticsearch\ClientBuilder;
class ElasticSearchServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
pub... |
Rename tests with more sensible names | package fgis.server.support.geojson;
import org.geolatte.geom.Geometry;
import org.testng.annotations.Test;
import static org.testng.Assert.*;
public final class GjGeometryTest
extends AbstractGjElementTest
{
@Test
public void basic()
throws Exception
{
final Geometry geometry = fromWkT( "POINT (1 1)"... | package fgis.server.support.geojson;
import org.geolatte.geom.Geometry;
import org.testng.annotations.Test;
import static org.testng.Assert.*;
public final class GjGeometryTest
extends AbstractGjElementTest
{
@Test
public void geometry()
throws Exception
{
final Geometry geometry = fromWkT( "POINT (1 ... |
Change list copy to list() | """
Solution to code eval interrupted bubble sort:
https://www.codeeval.com/open_challenges/158/
"""
import sys
def bubble_sort(inputL):
"""One iteration of bubble sort."""
for num in xrange(len(inputL)-1):
if inputL[num+1] < inputL[num]:
inputL[num+1], inputL[num] = inputL[num], inputL[nu... | """
Solution to code eval interrupted bubble sort:
https://www.codeeval.com/open_challenges/158/
"""
import sys
def bubble_sort(inputL):
"""One iteration of bubble sort."""
for num in xrange(len(inputL)-1):
if inputL[num+1] < inputL[num]:
inputL[num+1], inputL[num] = inputL[num], inputL[nu... |
Clean up config in constructor | 'use strict';
const colors = require('ansicolors');
const fs = require('fs');
const pluralize = require('pluralize');
const CLIEngine = require('eslint').CLIEngine;
class ESLinter {
constructor(brunchConfig) {
this.config = (brunchConfig && brunchConfig.plugins && brunchConfig.plugins.eslint) || {};
this.... | 'use strict';
const colors = require('ansicolors');
const fs = require('fs');
const pluralize = require('pluralize');
const CLIEngine = require('eslint').CLIEngine;
class ESLinter {
constructor(brunchConfig) {
this.config = brunchConfig || {};
const config = brunchConfig.plugins && brunchConfig.plugins.esli... |
Fix polymorphic type handling when loading test data. | package poussecafe.test;
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping;
imp... | package poussecafe.test;
import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
import com.fasterxml.jackson.annotation.PropertyAccessor;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping;
imp... |
Change toString() serializations for debug | package ru.agentlab.maia.event;
import java.util.Objects;
import ru.agentlab.maia.IEvent;
public abstract class Event<T> implements IEvent<T> {
protected final T payload;
public Event(T payload) {
this.payload = payload;
}
@Override
public T getPayload() {
return payload;
}
@Override
public boolean e... | package ru.agentlab.maia.event;
import java.util.Objects;
import ru.agentlab.maia.IEvent;
public abstract class Event<T> implements IEvent<T> {
protected final T payload;
public Event(T payload) {
this.payload = payload;
}
@Override
public T getPayload() {
return payload;
}
@Override
public boolean e... |
Correct version number for sk-video | # -*- coding: utf-8 -*-
"""
image analysis group tools
"""
from setuptools import setup
setup(
name='image-analysis',
version='0.0.1',
url='https://github.com/CoDaS-Lab/image-analysis',
license='BSD',
author='CoDaSLab http://shaftolab.com/',
author_email='s@sophiaray.info',
description='A ... | # -*- coding: utf-8 -*-
"""
image analysis group tools
"""
from setuptools import setup
setup(
name='image-analysis',
version='0.0.1',
url='https://github.com/CoDaS-Lab/image-analysis',
license='BSD',
author='CoDaSLab http://shaftolab.com/',
author_email='s@sophiaray.info',
description='A ... |
Add dummy user with known credentials, some of the seed objects will be randomly assigned to it | <?php
use Illuminate\Database\Seeder;
use Bdgt\Resources\User;
class UserSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$faker = Faker\Factory::create();
User::create([
'id' => null,
'username' ... | <?php
use Illuminate\Database\Seeder;
use Bdgt\Resources\User;
class UserSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$faker = Faker\Factory::create();
for ($i = 0; $i < 30; $i++) {
User::create([
... |
Fix static path in production | // Static file helpers
import { canUseDOM } from 'react/lib/ExecutionEnvironment';
const PRODUCTION_STATIC_ROOT = 'http://static.tonikarttunen.com/static/';
const DEVELOPMENT_STATIC_ROOT = 'http://127.0.0.1:8888/';
const getStaticRootUrl = () => {
if (canUseDOM) {
const HOST_BASE_URL =
window.location.orig... | // Static file helpers
import { canUseDOM } from 'react/lib/ExecutionEnvironment';
const os = require('os');
const PRODUCTION_STATIC_ROOT = 'http://static.tonikarttunen.com/static/';
const DEVELOPMENT_STATIC_ROOT = 'http://127.0.0.1:8888/';
const getStaticRootUrl = () => {
if (canUseDOM) {
const HOST_BASE_URL... |
Revert "Allow only name, url keys for win32."
This reverts commit 9ea03c29ffc1dac7f04f094433c9e47c2ba1c5ad. | var spawn = require('child_process').spawn;
var path = require('path');
module.exports = function (options) {
options = options || {};
options.url = options.url || 'http://nodejs.org';
options.name = options.name || 'nodejs';
var client;
switch (process.platform) {
case 'win32':
client... | var spawn = require('child_process').spawn;
var path = require('path');
module.exports = function (options) {
options = options || {};
options.url = options.url || 'http://nodejs.org';
options.name = options.name || 'nodejs';
var client;
switch (process.platform) {
case 'win32':
client... |
Fix no id property for RadioStation | import time
from rootio.radio.models import Station
from call_handler import CallHandler
from program_handler import ProgramHandler
from community_menu import CommunityMenu
class RadioStation:
def run(self):
self.__program_handler.run()
while True:
time.sleep(1)
return
... | import time
from rootio.radio.models import Station
from call_handler import CallHandler
from program_handler import ProgramHandler
from community_menu import CommunityMenu
class RadioStation:
def run(self):
self.__program_handler.run()
while True:
time.sleep(1)
return
... |
Remove this test for now | """geohash unit tests."""
import unittest
import os
import json
import gtfs
class TestGTFSReader(unittest.TestCase):
test_gtfs = os.path.join('examples', 'sample-feed.zip')
def test_readcsv(self):
expect = {
'stop_lat': '36.425288',
'zone_id': '',
'stop_lon': '-117.133162',
'stop... | """geohash unit tests."""
import unittest
import os
import json
import gtfs
class TestGTFSReader(unittest.TestCase):
test_gtfs = os.path.join('examples', 'sample-feed.zip')
def test_readcsv(self):
expect = {
'stop_lat': '36.425288',
'zone_id': '',
'stop_lon': '-117.133162',
'stop... |
Resolve promises with one argument | import url from "url";
import mixin from "merge-descriptors";
import wildcard from "wildcard-named";
export default {
callbacks : {},
when( uri ) {
return new Promise( resolve => {
this.callbacks[ url.resolve( this.base, uri ) ] = resolve;
} );
},
check( uri, req, ... | import url from "url";
import mixin from "merge-descriptors";
import wildcard from "wildcard-named";
export default {
callbacks : {},
when( uri ) {
return new Promise( resolve => {
this.callbacks[ url.resolve( this.base, uri ) ] = resolve;
} );
},
check( uri, req, ... |
Add protractor test function to click after an element is loaded | "use strict";
var UserPages = require("./UserPages.js");
var MailParser = require("mailparser").MailParser;
var fs = require("fs");
var EC = protractor.ExpectedConditions;
var restUrl = "http://localhost:9080/";
var hasClass = function (element, cls) {
return element.getAttribute("class").then(function (classes... | "use strict";
var UserPages = require("./UserPages.js");
var MailParser = require("mailparser").MailParser;
var fs = require("fs");
var restUrl = "http://localhost:9080/";
var hasClass = function (element, cls) {
return element.getAttribute("class").then(function (classes) {
return classes.split(" ").in... |
Add watched-canvases api in mirage | export default function sharedConfig() { // eslint-ignore-line no-empty-function
}
export function testConfig() {
this.namespace = '/v1';
this.get('/account', _ => {
return this.create('account');
});
this.get('/teams', schema => {
return schema.teams.all();
});
this.get('/comments', schema => {... | export default function sharedConfig() { // eslint-ignore-line no-empty-function
}
export function testConfig() {
this.namespace = '/v1';
this.get('/account', _ => {
return this.create('account');
});
this.get('/teams', schema => {
return schema.teams.all();
});
this.get('/comments', schema => {... |
Use new way of defining phonegap plugins. | cordova.define("cordova/plugin/applicationpreferences", function(require, exports, module) {
var exec = require("cordova/exec");
var AppPreferences = function () {};
var AppPreferencesError = function(code, message) {
this.code = code || null;
this.message = message || '';
};
AppPreferencesError.NO_P... | var AppPreferences = function () {};
var AppPreferencesError = function(code, message) {
this.code = code || null;
this.message = message || '';
};
AppPreferencesError.NO_PROPERTY = 0;
AppPreferencesError.NO_PREFERENCE_ACTIVITY = 1;
AppPreferences.prototype.get = function(key,success,fail) {
cordova.exec... |
Change access modifier for builder attributes.
Made fields protected so it can be accessed by subclasses. This is for if a custom subclass of SimpleAdapter is needed.
Signed-off-by: Jhun Mag-atas <81e4780f037db3a872190957a49473577f0839d0@teamcodeflux.com> | /*
* Copyright 2011 CodeFlux, Inc <info@teamcodeflux.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by a... | /*
* Copyright 2011 CodeFlux, Inc <info@teamcodeflux.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by a... |
Move RedisSessionFactory into its own module | #!/usr/bin/env python
from twisted.web.server import Site
from webtest.session_factory import RedisSessionFactory
from webtest.request import RedisRequest
from webtest import log
logger = log.get_logger()
class RedisSite(Site):
sessionFactory = RedisSessionFactory
requestFactory = RedisRequest
def makeS... | #!/usr/bin/env python
from twisted.web.server import Site
from webtest.session import RedisSessionFactory
from webtest.request import RedisRequest
from webtest import log
logger = log.get_logger()
class RedisSite(Site):
sessionFactory = RedisSessionFactory
requestFactory = RedisRequest
def makeSession(s... |
Check http origin for Websocket | package websocket
import (
"net/http"
"github.com/gorilla/websocket"
"github.com/spring1843/chat-server/src/chat"
"github.com/spring1843/chat-server/src/shared/logs"
)
var (
chatServerInstance *chat.Server
upgrader = websocket.Upgrader{
ReadBufferSize: 1024,
WriteBufferSize: 1024,
CheckOrigin:... | package websocket
import (
"net/http"
"github.com/gorilla/websocket"
"github.com/spring1843/chat-server/src/chat"
"github.com/spring1843/chat-server/src/shared/logs"
)
var (
chatServerInstance *chat.Server
upgrader = websocket.Upgrader{
ReadBufferSize: 1024,
WriteBufferSize: 1024,
}
)
// Handl... |
Change clean by isClean in check_clamav task | from __future__ import absolute_import
from celery import shared_task
from documents.models import Document
import clamd
@shared_task
def compile_tex(document_id):
document = Document.objects.get(pk=document_id)
print(document)
@shared_task
def check_clamav(document_id):
document = Document.objects.ge... | from __future__ import absolute_import
from celery import shared_task
from documents.models import Document
import clamd
@shared_task
def compile_tex(document_id):
document = Document.objects.get(pk=document_id)
print(document)
@shared_task
def check_clamav(document_id):
document = Document.objects.ge... |
Add some topics for next deploy | import os
from setuptools import setup, find_packages
def read(*paths):
"""Build a file path from *paths* and return the contents."""
with open(os.path.join(*paths), 'r') as f:
return f.read()
setup(
name='sumproduct',
version='0.0.1',
description='The sum-product algorithm. Belief propag... | import os
from setuptools import setup, find_packages
def read(*paths):
"""Build a file path from *paths* and return the contents."""
with open(os.path.join(*paths), 'r') as f:
return f.read()
setup(
name='sumproduct',
version='0.0.1',
description='The sum-product algorithm. Belief propag... |
Remove giphy since it doesn't work | 'use strict';
var mongoose = require('mongoose');
var slack = require('./slack.js');
var Rejection = mongoose.model('Rejection');
exports.help = help;
exports.reject = reject;
function help(args, message) {
var channel = slack.getChannelGroupOrDMByID(message.channel);
channel.send('I\'m codybot! \n\n\
Usage... | 'use strict';
var mongoose = require('mongoose');
var slack = require('./slack.js');
var Rejection = mongoose.model('Rejection');
exports.help = help;
exports.reject = reject;
function help(args, message) {
var channel = slack.getChannelGroupOrDMByID(message.channel);
channel.send('I\'m codybot! \n\n\
Usage... |
Change this test to not expect an error. | import unittest
from flask import Flask
from flask_selfdoc import Autodoc
class TestErrorHandling(unittest.TestCase):
def test_app_not_initialized(self):
app = Flask(__name__)
autodoc = Autodoc()
with app.app_context():
self.assertRaises(RuntimeError, lambda: autodoc.html())
... | import unittest
from flask import Flask
from flask_selfdoc import Autodoc
class TestErrorHandling(unittest.TestCase):
def test_app_not_initialized(self):
app = Flask(__name__)
autodoc = Autodoc()
with app.app_context():
self.assertRaises(RuntimeError, lambda: autodoc.html())
... |
Make sure to match pre and textarea without any attributes | <?php // @codeCoverageIgnoreStart
/*
* This file is part of HtmlCompress.
*
** (c) 2014 Cees-Jan Kiewiet
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace WyriHaximus\HtmlCompress;
/**
* Class Patterns
*
* @package Wyr... | <?php // @codeCoverageIgnoreStart
/*
* This file is part of HtmlCompress.
*
** (c) 2014 Cees-Jan Kiewiet
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace WyriHaximus\HtmlCompress;
/**
* Class Patterns
*
* @package Wyr... |
Add glob for test-specific configuration files | <?php
use Zend\ServiceManager\ServiceManager;
use Zend\Mvc\Service\ServiceManagerConfiguration;
use CdliTwoStageSignupTest\Framework\TestCase;
chdir(__DIR__);
$previousDir = '.';
while (!file_exists('config/application.config.php')) {
$dir = dirname(getcwd());
if($previousDir === $dir) {
throw new Ru... | <?php
use Zend\ServiceManager\ServiceManager;
use Zend\Mvc\Service\ServiceManagerConfiguration;
use CdliTwoStageSignupTest\Framework\TestCase;
chdir(__DIR__);
$previousDir = '.';
while (!file_exists('config/application.config.php')) {
$dir = dirname(getcwd());
if($previousDir === $dir) {
throw new Ru... |
Use put instead of add
Updated setKeyValue to use put instead of add (was crashing), with some other minor updates. | package com.ccsoft.plugin;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.json.JSONArray;
import org.json.JSONException;
import android.util.Log;
import com.parse.ParseInstallation;
public class CordovaParse extends CordovaPlugin {
private final String TAG = "Cordo... | package com.ccsoft.plugin;
import java.util.Dictionary;
import java.util.Hashtable;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.json.JSONArray;
import org.json.JSONException;
import android.util.Log;
import com.parse.ParseInstallation;
public class CordovaParse ex... |
Check for the existence of document before accessing it.
Since document is referenced within getDefaultProps which unlike
componentDidMount is run in both browser and node environments we need
to make sure we check it exists before accessing it. | import React from './react-es6';
export default = {
propTypes: {
container: React.PropTypes.object.isRequired
},
getDefaultProps: function () {
return {
container: typeof document !== 'undefined' ? document.body : null
};
},
componentWillUnmount: function () {
this._unrenderOverlay();... | import React from './react-es6';
export default = {
propTypes: {
container: React.PropTypes.object.isRequired
},
getDefaultProps: function () {
return {
container: document.body
};
},
componentWillUnmount: function () {
this._unrenderOverlay();
this.getContainerDOMNode()
.re... |
Remove jsondata variable to simplify the code | # coding=utf-8
import urllib2
import json
import re
# album_url = 'http://www.ximalaya.com/7712455/album/6333174'
album_url = 'http://www.ximalaya.com/7712455/album/4474664'
headers = {'User-Agent': 'Safari/537.36'}
resp = urllib2.urlopen(urllib2.Request(album_url, headers=headers))
ids = re.search('sound_ids=\"(.*)\... | # coding=utf-8
import urllib2
import json
import re
# album_url = 'http://www.ximalaya.com/7712455/album/6333174'
album_url = 'http://www.ximalaya.com/7712455/album/4474664'
headers = {'User-Agent': 'Safari/537.36'}
resp = urllib2.urlopen(urllib2.Request(album_url, headers=headers))
ids = re.search('sound_ids=\"(.*)\... |
Change from rpc to amqp backend
Otherwise retrieving result are problematic | from kombu import Exchange, Queue
import os
BROKER_URL = os.environ['CELERY_BROKER']
CELERY_RESULT_BACKEND='amqp://'
CELERY_RESULT_PERSISTENT = True
CELERY_DISABLE_RATE_LIMITS = True
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_ACCEPT_CONTENT = ['json']
imputation_exchange = Exchange('impu... | from kombu import Exchange, Queue
import os
BROKER_URL = os.environ['CELERY_BROKER']
CELERY_RESULT_BACKEND='rpc://'
CELERY_RESULT_PERSISTENT = True
CELERY_DISABLE_RATE_LIMITS = True
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
CELERY_ACCEPT_CONTENT = ['json']
imputation_exchange = Exchange('imput... |
Set tocify scrollTo property to offset top banner | /**
* User: powerumc
* Date: 2014. 5. 18.
*/
$(function() {
$(function () {
$.ajax({
url: "README.md",
type: "GET",
success: function (data) {
var html = marked(data);
$("#preview").html(html);
var toc = $("#toc").tocify({
context: "#preview",
selectors: "h1, h2, h3, h4, h5, h6",... | /**
* User: powerumc
* Date: 2014. 5. 18.
* Time: ������ 8:39
*/
$(function() {
$(function () {
$.ajax({
url: "README.md",
type: "GET",
success: function (data) {
var html = marked(data);
$("#preview").html(html);
var toc = $("#toc").tocify({
context: "#preview",
selectors: "h1,... |
Return error message and print stack trace via try/catch | import generateFramework from '../generators/framework/generateFramework';
import generateTemplateEngine from '../generators/template-engine/generateTemplateEngine';
import generateCssFramework from '../generators/css-framework/generateCssFramework';
import generateCssPreprocessor from '../generators/css-preprocessor/g... | import generateFramework from '../generators/framework/generateFramework';
import generateTemplateEngine from '../generators/template-engine/generateTemplateEngine';
import generateCssFramework from '../generators/css-framework/generateCssFramework';
import generateCssPreprocessor from '../generators/css-preprocessor/g... |
Handle the weird field names from the new version of the API
As part of the switch to cordova, we moved to a newer version of the google
play API. Unfortunately, this meant that the weird field names for the
confidence and type changed to a different set of weird field names. We should
really use a standard wrapper cl... | import logging
import emission.core.wrapper.motionactivity as ecwa
import emission.net.usercache.formatters.common as fc
import attrdict as ad
def format(entry):
formatted_entry = ad.AttrDict()
formatted_entry["_id"] = entry["_id"]
formatted_entry.user_id = entry.user_id
metadata = entry.metadata
... | import logging
import emission.core.wrapper.motionactivity as ecwa
import emission.net.usercache.formatters.common as fc
import attrdict as ad
def format(entry):
formatted_entry = ad.AttrDict()
formatted_entry["_id"] = entry["_id"]
formatted_entry.user_id = entry.user_id
metadata = entry.metadata
... |
Add link to vpc in console | class Resource {
constructor(region, id, tagMap) {
this._region = region;
this._id = id;
this._tagMap = tagMap || new Map();
}
get region() { return this._region; }
get id() { return this._id; }
get tagMap() { return this._tagMap; }
get title() { return null; }
get link() { return null; }
}
... | class Resource {
constructor(region, id, tagMap) {
this._region = region;
this._id = id;
this._tagMap = tagMap || new Map();
}
get region() { return this._region; }
get id() { return this._id; }
get tagMap() { return this._tagMap; }
get title() { return null; }
get link() { return null; }
}
... |
Allow for path to renderer to be provided instead of just the classname. Removed headers set before rendering, instead they should be handled in the renderer | <?php
define('DOCROOT', rtrim(dirname(__FILE__), '\\/'));
define('DOMAIN', rtrim(rtrim($_SERVER['HTTP_HOST'], '\\/') . dirname($_SERVER['PHP_SELF']), '\\/'));
require(DOCROOT . '/symphony/bundle.php');
function renderer($handle){
if(file_exists(realpath($handle))){
$path = realpath($handle);
}
els... | <?php
define('DOCROOT', rtrim(dirname(__FILE__), '\\/'));
define('DOMAIN', rtrim(rtrim($_SERVER['HTTP_HOST'], '\\/') . dirname($_SERVER['PHP_SELF']), '\\/'));
require(DOCROOT . '/symphony/bundle.php');
function renderer($handle){
if(!file_exists(LIB . "/class.{$handle}.php")){
throw new Exception('Invalid S... |
Fix hostname answer issue in catalog
https://github.com/rancher/rancher/issues/17058 | import Component from '@ember/component';
import { get, set, observer } from '@ember/object'
import layout from './template';
import { inject as service } from '@ember/service';
import C from 'shared/utils/constants';
export default Component.extend({
settings: service(),
layout,
value: '',
mode: 'automatic... | import Component from '@ember/component';
import { next } from '@ember/runloop';
import { get, set, observer } from '@ember/object'
import layout from './template';
import { inject as service } from '@ember/service';
import C from 'shared/utils/constants';
export default Component.extend({
settings: service(),
la... |
Revert "Revert "🐛 Fix issues with mobx and class properties""
This reverts commit 3f24504d9d5e61efff40ea18c3b6d9e06dffee8a. | module.exports = function (context, opts = {}) {
const env = process.env.BABEL_ENV || process.env.NODE_ENV
const isDevelopment = env === 'development'
return {
presets: [
// Browsers are taken from the browserslist field in package.json
[require('@babel/preset-env').default, {
modules: fa... | module.exports = function (context, opts = {}) {
const env = process.env.BABEL_ENV || process.env.NODE_ENV
const isDevelopment = env === 'development'
return {
presets: [
// Browsers are taken from the browserslist field in package.json
[require('@babel/preset-env').default, {
modules: fa... |
Clear local Storage on cancel | function something()
{
var x = window.localStorage.getItem('bbb');
x = x * 1 + 1;
window.localStorage.setItem('bbb', x);
alert(x);
}
function add_to_cart(id)
{
var key = 'product_' + id;
var x = window.localStorage.getItem(key);
x = x * 1 + 1;
window.localStorage.setItem(key, x);
update_orders_inpu... | function something()
{
var x = window.localStorage.getItem('bbb');
x = x * 1 + 1;
window.localStorage.setItem('bbb', x);
alert(x);
}
function add_to_cart(id)
{
var key = 'product_' + id;
var x = window.localStorage.getItem(key);
x = x * 1 + 1;
window.localStorage.setItem(key, x);
update_orders_inpu... |
[bug] Fix bug on cartridge handler | var builder = require('focus').component.builder;
var React = require('react');
var applicationStore = require('focus').application.builtInStore();
var cartridgeMixin = {
getDefaultProps: function getCartridgeDefaultProps(){
return {
style: {}
};
},
/** @inheriteddoc */
getInitialState: function ... | var builder = require('focus').component.builder;
var React = require('react');
var applicationStore = require('focus').application.builtInStore();
var cartridgeMixin = {
getDefaultProps: function getCartridgeDefaultProps(){
return {
style: {}
};
},
/** @inheriteddoc */
getInitialState: function ... |
Change my email to avoid Yahoo, which decided to brake my scraper script recently. | #!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
from setuptools import setup
setup(
name = 'TracMasterTickets',
version = '2.1.1',
packages = ['mastertickets'],
package_data = { 'mastertickets': ['templates/*.html', 'htdocs/*.js', 'htdocs/*.css' ] },
author = "Noah Kantrowitz",
author_emai... | #!/usr/bin/env python
# -*- coding: iso-8859-1 -*-
from setuptools import setup
setup(
name = 'TracMasterTickets',
version = '2.1.1',
packages = ['mastertickets'],
package_data = { 'mastertickets': ['templates/*.html', 'htdocs/*.js', 'htdocs/*.css' ] },
author = "Noah Kantrowitz",
author_emai... |
Align Exception test to coding style for test suite | <?php
/**
* League.Csv (https://csv.thephpleague.com)
*
* (c) Ignace Nyamagana Butera <nyamsprod@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace LeagueTest\Csv;
use League\Csv\CannotInsertRecord;
use League\... | <?php
/**
* League.Csv (https://csv.thephpleague.com)
*
* (c) Ignace Nyamagana Butera <nyamsprod@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace LeagueTest\Csv;
use League\Csv\CannotInsertRecord;
use League\... |
Add Draft of Karma Handler. | package main
import (
"fmt"
"github.com/danryan/hal"
_ "github.com/danryan/hal/adapter/slack"
_ "github.com/danryan/hal/store/memory"
"os"
)
var canYouHandler = hal.Hear("(Tim|tim).*can you.*", func(res *hal.Response) error {
return res.Send("on it!")
})
var karmaHandler = hal.Hear(".*(\\w+)(\\+\\+|\\-\\-).*",... | package main
import (
"github.com/danryan/hal"
_ "github.com/danryan/hal/adapter/shell"
_ "github.com/danryan/hal/adapter/slack"
_ "github.com/danryan/hal/store/memory"
"os"
)
var canYouHandler = hal.Hear("(Tim|tim).*can you.*", func(res *hal.Response) error {
return res.Send("on it!")
})
var echoHandler = hal... |
Set defaults for karma server | module.exports = function(config){
config.set({
basePath : '../',
files : [
'app/bower_components/angular/angular.js',
'app/bower_components/angular-route/angular-route.js',
'app/bower_components/angular-mocks/angular-mocks.js',
'app/js/**/*.js',
'test/unit/**/*.js'
],
... | module.exports = function(config){
config.set({
basePath : '../',
files : [
'app/bower_components/angular/angular.js',
'app/bower_components/angular-route/angular-route.js',
'app/bower_components/angular-mocks/angular-mocks.js',
'app/js/**/*.js',
'test/unit/**/*.js'
],
... |
Handle missing INCAR files gracefully | from django.shortcuts import render_to_response
from django.template import RequestContext
import os
from qmpy.models import Calculation
from ..tools import get_globals
from bokeh.embed import components
def calculation_view(request, calculation_id):
calculation = Calculation.objects.get(pk=calculation_id)
d... | from django.shortcuts import render_to_response
from django.template import RequestContext
import os.path
from qmpy.models import Calculation
from ..tools import get_globals
from bokeh.embed import components
def calculation_view(request, calculation_id):
calculation = Calculation.objects.get(pk=calculation_id)
... |
Remove commented developer tools code | const electron = require('electron');
// Module to control application life.
const app = electron.app;
// Module to create native browser window.
const BrowserWindow = electron.BrowserWindow;
const ipcMain = electron.ipcMain;
// Keep a global reference of the window object, if you don't, the window will
// be closed ... | const electron = require('electron');
// Module to control application life.
const app = electron.app;
// Module to create native browser window.
const BrowserWindow = electron.BrowserWindow;
const ipcMain = electron.ipcMain;
// Keep a global reference of the window object, if you don't, the window will
// be closed ... |
Add the original body field to the replies table. | <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateRepliesTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('replies', function(Blueprint $table)
{
$table->increments('id');
$table-... | <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateRepliesTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('replies', function(Blueprint $table)
{
$table->increments('id');
$table-... |
CHANGE number max of posts
Add argument to the function to allow 9 posts per page | <?php
/**
* Template Name: Gallery
* The template for displaying the galleries.
*
* @package Pu-ente
*/
get_header(); ?>
<!-- page-gallery.php -->
<div id="primary" class="content-area">
<main id="main" class="site-main clear" role="main">
<?php
global $post;
$slug = get_post( $post )->post_name;
$args... | <?php
/**
* Template Name: Gallery
* The template for displaying the galleries.
*
* @package Pu-ente
*/
get_header(); ?>
<!-- page-gallery.php -->
<div id="primary" class="content-area">
<main id="main" class="site-main clear" role="main">
<?php
global $post;
$slug = get_post( $post )->post_name;
$args... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.