text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Use a 'with' statement instead of manual resource management strategy | # -*- coding: utf-8 -*-
from __future__ import with_statement
from setuptools import setup
from urwid_stackedwidget import __version__
def readme():
with open('README.rst') as f:
return f.read()
setup(
name='urwid-stackedwidget',
version=__version__,
license='MIT',
author='Sumin Byeon',
... | # -*- coding: utf-8 -*-
from __future__ import with_statement
from setuptools import setup
from urwid_stackedwidget import __version__
def readme():
try:
f = open('README.rst')
content = f.read()
f.close()
return content
except Exception:
pass
setup(
name='urwid-st... |
Update atol on precision at k test. | import numpy as np
import pytest
import tensorflow as tf
from tensorflow_similarity.retrieval_metrics import PrecisionAtK
testdata = [
(
"micro",
tf.constant(0.583333333),
),
(
"macro",
tf.constant(0.5),
),
]
@pytest.mark.parametrize("avg, expected", testdata, ids=["m... | import numpy as np
import pytest
import tensorflow as tf
from tensorflow_similarity.retrieval_metrics import PrecisionAtK
testdata = [
(
"micro",
tf.constant(0.583333333),
),
(
"macro",
tf.constant(0.5),
),
]
@pytest.mark.parametrize("avg, expected", testdata, ids=["m... |
Fix declaring extra constants when `intl` is loaded | <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Symfony\Polyfill\Php54 as p;
if (PHP_VERSION_ID >= 50400) {
return;
}
if... | <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Symfony\Polyfill\Php54 as p;
if (PHP_VERSION_ID < 50400) {
if (!function_... |
Change User ID to use the JSON (hex) representation throughout the site | var wompt = require("./includes");
function MetaUser(doc){
var me = this;
this.clients = new wompt.ClientPool();
this.doc = doc;
this.visible = !!doc;
this.readonly = !doc;
this.touch();
this.clients.on('added', function(client){
me.clients.broadcast({
action: 'new_client',
channel: client.meta_data.c... | var wompt = require("./includes");
function MetaUser(doc){
var me = this;
this.clients = new wompt.ClientPool();
this.doc = doc;
this.visible = !!doc;
this.readonly = !doc;
this.touch();
this.clients.on('added', function(client){
me.clients.broadcast({
action: 'new_client',
channel: client.meta_data.c... |
Remove version 1.9.6 from test of PhanthomJS versions | /*
* (C) Copyright 2016 Boni Garcia (http://bonigarcia.github.io/)
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser General Public License
* (LGPL) version 2.1 which accompanies this distribution, and is available at
* http://www.gnu.org/l... | /*
* (C) Copyright 2016 Boni Garcia (http://bonigarcia.github.io/)
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser General Public License
* (LGPL) version 2.1 which accompanies this distribution, and is available at
* http://www.gnu.org/l... |
Update the Chrome extension more aggressively
Request a chrome update when the extension starts and reload the
extension when it's installed. | (function () {
'use strict';
var browserExtension = new h.HypothesisChromeExtension({
chromeTabs: chrome.tabs,
chromeBrowserAction: chrome.browserAction,
extensionURL: function (path) {
return chrome.extension.getURL(path);
},
isAllowedFileSchemeAccess: function (fn) {
return chrome... | (function () {
'use strict';
var browserExtension = new h.HypothesisChromeExtension({
chromeTabs: chrome.tabs,
chromeBrowserAction: chrome.browserAction,
extensionURL: function (path) {
return chrome.extension.getURL(path);
},
isAllowedFileSchemeAccess: function (fn) {
return chrome... |
Revert using input event, change seems good enough | "use strict";
if (typeof localStorage !== "undefined"){
for(var key in localStorage){
if (localStorage.hasOwnProperty(key) && key != "debug") exports[key] = localStorage[key];
}
}
exports.register = function(opt, ele, nopersist){
var field = ele.type == "checkbox" ? "checked" : "value";
if (exports[opt]) ele[fiel... | "use strict";
if (typeof localStorage !== "undefined"){
for(var key in localStorage){
if (localStorage.hasOwnProperty(key) && key != "debug") exports[key] = localStorage[key];
}
}
exports.register = function(opt, ele, nopersist){
var field = ele.type == "checkbox" ? "checked" : "value";
if (exports[opt]) ele[fiel... |
Handle no snr information in snr file. (for fake simualtions mainly) | import os
import simulators
import numpy as np
import json
import warnings
"""Calculate Errors on the Spectrum.
For a first go using an fixed SNR of 200 for all observations.
"""
def get_snrinfo(star, obs_num, chip):
"""Load SNR info from json file."""
snr_file = os.path.join(simulators.paths["spectra"],... | import os
import simulators
import numpy as np
import json
"""Calculate Errors on the Spectrum.
For a first go using an fixed SNR of 200 for all observations.
"""
def get_snrinfo(star, obs_num, chip):
"""Load SNR info from json file."""
snr_file = os.path.join(simulators.paths["spectra"], "detector_snrs.... |
Correct author to oemof developER group | import os
from setuptools import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(name='windpowerlib',
version='0.1.2dev',
description='Creating time series of wind power plants.',
url='http://github.com/wind-python/windpowerlib',
author='oe... | import os
from setuptools import setup
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(name='windpowerlib',
version='0.1.2dev',
description='Creating time series of wind power plants.',
url='http://github.com/wind-python/windpowerlib',
author='oe... |
Use newer twilio API to fix 160 character limit
See http://stackoverflow.com/questions/22028278/send-sms-of-more-than-160-characters-in-python-using-twilio | #-*- coding: utf-8 -*-
"""
this backend requires the twilio python library: http://pypi.python.org/pypi/twilio/
"""
from twilio.rest import TwilioRestClient
from django.conf import settings
from sendsms.backends.base import BaseSmsBackend
TWILIO_ACCOUNT_SID = getattr(settings, 'SENDSMS_TWILIO_ACCOUNT_SID', '')
TWILIO_... | #-*- coding: utf-8 -*-
"""
this backend requires the twilio python library: http://pypi.python.org/pypi/twilio/
"""
from twilio.rest import TwilioRestClient
from django.conf import settings
from sendsms.backends.base import BaseSmsBackend
TWILIO_ACCOUNT_SID = getattr(settings, 'SENDSMS_TWILIO_ACCOUNT_SID', '')
TWILIO_... |
Add of getPrompt function to redisplay the prompt when search field is empty.
git-svn-id: 36dcc065b18e9ace584b1c777eaeefb1d96b1ee8@290116 13f79535-47bb-0310-9956-ffa450edef68 | /*
* Copyright 2002-2004 The Apache Software Foundation or its licensors,
* as applicable.
*
* 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
*... | /*
* Copyright 2002-2004 The Apache Software Foundation or its licensors,
* as applicable.
*
* 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
*... |
Use display.show instead of display.animate | from microbit import *
hands = Image.ALL_CLOCKS
#A centre dot of brightness 2.
ticker_image = Image("2\n").crop(-2,-2,5,5)
#Adjust these to taste
MINUTE_BRIGHT = 0.1111
HOUR_BRIGHT = 0.55555
#Generate hands for 5 minute intervals
def fiveticks():
fivemins = 0
hours = 0
while True:
yield hands[f... | from microbit import *
hands = Image.ALL_CLOCKS
#A centre dot of brightness 2.
ticker_image = Image("2\n").crop(-2,-2,5,5)
#Adjust these to taste
MINUTE_BRIGHT = 0.1111
HOUR_BRIGHT = 0.55555
#Generate hands for 5 minute intervals
def fiveticks():
fivemins = 0
hours = 0
while True:
yield hands[f... |
Use a separate lock path | from subprocess import getoutput
from random import randrange
from filelock import FileLock
LOCK_PATH = '/tmp/ifixit_dict.lock'
DICT_PATH = './dict.txt'
OOPS_SEEK_TOO_FAR = 48
DICT_LENGTH = 61973
# don't run on OS X
def randomize():
out = getoutput('sort -R ' + DICT_PATH)
with FileLock(LOCK_PATH):
... | from subprocess import getoutput
from random import randrange
from filelock import FileLock
DICT_PATH = './dict.txt'
OOPS_SEEK_TOO_FAR = 48
DICT_LENGTH = 61973
# don't run on OS X
def randomize():
out = getoutput('sort -R ' + DICT_PATH)
with FileLock(DICT_PATH):
with open(DICT_PATH, 'w') as f:
... |
Fix default value for dropdown field (when no value matches) | <?php
namespace Craft;
use Cake\Utility\Hash as Hash;
class DropdownFeedMeFieldType extends BaseFeedMeFieldType
{
// Templates
// =========================================================================
// Public Methods
// ====================================================================... | <?php
namespace Craft;
use Cake\Utility\Hash as Hash;
class DropdownFeedMeFieldType extends BaseFeedMeFieldType
{
// Templates
// =========================================================================
// Public Methods
// ====================================================================... |
Switch sort direction of index in order to improve performance | exports.index = function (collection) {
collection.getIndexes(function(err, indexes) {
if (err) {
if (err.code === 26) {
// MongoError: no collection
return;
}
return console.log(err);
}
dropIndex('status_1_queue_1_enqueu... | exports.index = function (collection) {
collection.getIndexes(function(err, indexes) {
if (err) {
if (err.code === 26) {
// MongoError: no collection
return;
}
return console.log(err);
}
dropIndex('status_1_queue_1_enqueu... |
Duplicate binding names are allowed in param lists | import Term from "./terms";
import { CloneReducer } from "shift-reducer";
import { gensym } from "./symbol";
import { VarBindingTransform } from "./transforms";
export default class ScopeApplyingReducer extends CloneReducer {
constructor(scope, context, phase = 0) {
super();
this.context = context;
this.... | import Term from "./terms";
import { CloneReducer } from "shift-reducer";
import { gensym } from "./symbol";
import { VarBindingTransform } from "./transforms";
export default class ScopeApplyingReducer extends CloneReducer {
constructor(scope, context, phase = 0) {
super();
this.context = context;
this.... |
Disable querystring auth for s3 | from default_settings import *
import dj_database_url
DATABASES = {
'default': dj_database_url.config(),
}
SECRET_KEY = os.environ['SECRET_KEY']
STATICFILES_STORAGE = 's3storage.S3HashedFilesStorage'
AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY', '')
AWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_KEY... | from default_settings import *
import dj_database_url
DATABASES = {
'default': dj_database_url.config(),
}
SECRET_KEY = os.environ['SECRET_KEY']
STATICFILES_STORAGE = 's3storage.S3HashedFilesStorage'
AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY', '')
AWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_KEY... |
Rename method all to getAll on repository interface. | <?php
namespace Enzyme\Axiom\Repositories;
use Enzyme\Axiom\Instances\InstanceInterface;
use Enzyme\Axiom\Atoms\AtomInterface;
/**
* Manages a collection of instances.
*/
interface RepositoryInterface
{
/**
* Get a collection of all instances for this type.
*
* @return array
*/
public f... | <?php
namespace Enzyme\Axiom\Repositories;
use Enzyme\Axiom\Instances\InstanceInterface;
use Enzyme\Axiom\Atoms\AtomInterface;
/**
* Manages a collection of instances.
*/
interface RepositoryInterface
{
/**
* Get a collection of all instances for this type.
*
* @return array
*/
public f... |
Refactor HttpThrottlingView to be defined inside an anonymous namespace.
BUG=90857
Review URL: http://codereview.chromium.org/7544009
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@94909 0039d316-1c4b-4281-b951-d872f2087c98 | // Copyright (c) 2011 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.
/**
* This view displays information related to HTTP throttling.
*/
var HttpThrottlingView = (function() {
// IDs for special HTML elements in ht... | // Copyright (c) 2011 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.
/**
* This view displays information related to HTTP throttling.
* @constructor
*/
function HttpThrottlingView() {
const mainBoxId = 'http-thrott... |
Update the comment spelling :-p
git-svn-id: 8aef34885c21801cc977f98956a081c938212632@12 1678c8a9-8d33-0410-b0a4-d546c816ed44 | package org.jsmpp.session;
import org.jsmpp.bean.DeliverSm;
import org.jsmpp.extra.ProcessMessageException;
/**
* This listener will listen to every incoming short message, recognized by
* deliver_sm command. The logic on this listener should be accomplish in a
* short time, because the deliver_sm_resp will be pro... | package org.jsmpp.session;
import org.jsmpp.bean.DeliverSm;
import org.jsmpp.extra.ProcessMessageException;
/**
* This listener will listen to every incomming short message, recognized by
* deliver_sm command. The logic on this listener should be accomplish in a
* short time, because the deliver_sm_resp will be pr... |
Update the query time indicator to indicate when queries are in progress. | if (pulse === undefined)
{
var pulse = {};
}
pulse.dataPointsQuery = function (metricQuery, callback) {
var startTime = new Date();
var $queryTime = $("#queryTime");
$queryTime.html("");
$queryTime.html("<i>in progress...</i>");
$.ajax({
type: "POST",
url: "/api/v1/datapoints/query",
headers: { 'Content-... | if (pulse === undefined)
{
var pulse = {};
}
pulse.dataPointsQuery = function (metricQuery, callback) {
var startTime = new Date();
$.ajax({
type: "POST",
url: "/api/v1/datapoints/query",
headers: { 'Content-Type': ['application/json']},
data: JSON.stringify(metricQuery),
dataType: 'json',
success: func... |
Use auto generated celery queues | # -*- coding: utf-8 -*-
"""Asynchronous task queue module."""
from celery import Celery
from celery.utils.log import get_task_logger
from raven import Client
from raven.contrib.celery import register_signal
from website import settings
app = Celery()
# TODO: Hardcoded settings module. Should be set using framework... | # -*- coding: utf-8 -*-
"""Asynchronous task queue module."""
from celery import Celery
from celery.utils.log import get_task_logger
from kombu import Exchange, Queue
from raven import Client
from raven.contrib.celery import register_signal
from website import settings
app = Celery()
# TODO: Hardcoded settings mod... |
Upgrade Beaker 1.6.4 => 1.8.1 | from setuptools import setup
setup(
name='tangled.session',
version='0.1a3.dev0',
description='Tangled session integration',
long_description=open('README.rst').read(),
url='http://tangledframework.org/',
download_url='https://github.com/TangledWeb/tangled.session/tags',
author='Wyatt Bald... | from setuptools import setup
setup(
name='tangled.session',
version='0.1a3.dev0',
description='Tangled session integration',
long_description=open('README.rst').read(),
url='http://tangledframework.org/',
download_url='https://github.com/TangledWeb/tangled.session/tags',
author='Wyatt Bald... |
Move chickens to other app | from django.conf.urls import patterns, url
from django.views.generic import TemplateView
from .views import (
PizzaCreateView, PizzaDeleteView, PizzaDetailView, PizzaListView,
PizzaUpdateView
)
urlpatterns = patterns('', # NOQA
url(r'^$', PizzaListView.as_view(), name='list'),
url(r'^create/$', Pizz... | from django.conf.urls import patterns, url
from django.views.generic import TemplateView
from .views import (
PizzaCreateView, PizzaDeleteView, PizzaDetailView, PizzaListView,
PizzaUpdateView,
ChickenWingsListView
)
urlpatterns = patterns('', # NOQA
url(r'^$', PizzaListView.as_view(), name='list'),
... |
Add newline in file to keep github happy | /**
* Return an array of function of the form x => { type, payload = x }
*/
export function createActions(...types) {
return types.map(createAction)
}
/**
* Create a single action of the form x => { type, payload = x }
*
* @returns {Array}
*/
export function createAction(type) {
return (payload, error) => (O... | /**
* Return an array of function of the form x => { type, payload = x }
*/
export function createActions(...types) {
return types.map(createAction)
}
/**
* Create a single action of the form x => { type, payload = x }
*/
export function createAction(type) {
return (payload, error) => (Object.assign({ type }, ... |
Make scheduler do primary reads only | from tapiriik.database import db
from tapiriik.messagequeue import mq
from tapiriik.sync import Sync
from datetime import datetime
from pymongo.read_preferences import ReadPreference
import kombu
import time
Sync.InitializeWorkerBindings()
producer = kombu.Producer(Sync._channel, Sync._exchange)
while True:
queuein... | from tapiriik.database import db
from tapiriik.messagequeue import mq
from tapiriik.sync import Sync
import kombu
from datetime import datetime
import time
Sync.InitializeWorkerBindings()
producer = kombu.Producer(Sync._channel, Sync._exchange)
while True:
queueing_at = datetime.utcnow()
users = db.users.find(
... |
Refactor monkey-patch to include less duplication. | (function() {
function componentHasBeenReopened(Component, className) {
return Component.prototype.classNames.indexOf(className) > -1;
}
function reopenComponent(_Component, className) {
var Component = _Component.reopen({
classNames: [className]
});
return Component;
}
function ensur... | Ember.ComponentLookup.reopen({
lookupFactory: function(name) {
var Component = this._super.apply(this, arguments);
if (!Component) { return; }
name = name.replace(".","/");
if (Component.prototype.classNames.indexOf(Ember.COMPONENT_CSS_LOOKUP[name]) > -1){
return Component;
}
return C... |
Add test to ensure err returned for missing files | package prefer
import (
"strings"
"testing"
)
func TestLoadCreatesNewConfiguration(t *testing.T) {
type Mock struct {
Name string `json:"name"`
Age int `json:"age"`
}
mock := Mock{}
configuration, err := Load("share/fixtures/example", &mock)
checkTestError(t, err)
file_path_index := strings.Index(co... | package prefer
import (
"strings"
"testing"
)
func TestLoadCreatesNewConfiguration(t *testing.T) {
type Mock struct {
Name string `json:"name"`
Age int `json:"age"`
}
mock := Mock{}
configuration, err := Load("share/fixtures/example", &mock)
checkTestError(t, err)
file_path_index := strings.Index(c... |
Add long_description field to avoid PyPi page error. | #!/bin/env python
from setuptools import setup
# Load module version from ovr/version.py
exec(open('src/openvr/version.py').read())
setup(
name='openvr',
version=__version__,
author='Christopher Bruns and others',
author_email='cmbruns@rotatingpenguin.com',
description='Valve OpenVR SDK python bi... | #!/bin/env python
from setuptools import setup
# Load module version from ovr/version.py
exec(open('src/openvr/version.py').read())
setup(
name='openvr',
version=__version__,
author='Christopher Bruns and others',
author_email='cmbruns@rotatingpenguin.com',
description='Valve OpenVR SDK python bi... |
Check RSS feed on startup | $(function(){
readFileIntoBuffer(batotoJSONFile, function(buffer){
if (buffer){
batotoJSON = JSON.parse(buffer);
if ('chapters' in batotoJSON){
$.each(batotoJSON.chapters, function(index, val) {
addRowToTable(val);
});
}
}
$("#urlEntry").keypress(function (e) {
if (e.which == 13){
... | $(function(){
readFileIntoBuffer(batotoJSONFile, function(buffer){
if (buffer){
batotoJSON = JSON.parse(buffer);
if ('chapters' in batotoJSON){
$.each(batotoJSON.chapters, function(index, val) {
addRowToTable(val);
});
}
}
$("#urlEntry").keypress(function (e) {
if (e.which == 13){
... |
Add title for code list selection within single response | import React, { PropTypes } from 'react'
import CodeListSelector from './code-list-selector'
import VisHintPicker from './vis-hint-picker'
import {
updateSingle, newCodeListSingle
} from '../actions/response-format'
import { connect } from 'react-redux'
function SingleResponseFormatEditor(
{ id, qrId, format: { ... | import React, { PropTypes } from 'react'
import CodeListSelector from './code-list-selector'
import VisHintPicker from './vis-hint-picker'
import {
updateSingle, newCodeListSingle
} from '../actions/response-format'
import { connect } from 'react-redux'
function SingleResponseFormatEditor(
{ id, qrId, format: { ... |
Return null for injected prestations | var _ = require('lodash');
var periods = require('./periods');
var PRESTATIONS = require('../prestations');
module.exports = function reverseMap(openFiscaFamille, date, injectedRessources) {
var period = periods.map(date);
var injectedPrestations = _.intersection(_.keys(PRESTATIONS), injectedRessources)
... | var _ = require('lodash');
var periods = require('./periods');
var PRESTATIONS = require('../prestations');
module.exports = function reverseMap(openFiscaFamille, date, injectedRessources) {
var period = periods.map(date);
var prestationsToDisplay = _.cloneDeep(PRESTATIONS);
var injectedPrestations = _.i... |
Fix bug with storing locked buildings | /**
* This function toggle the locked state of a building
* @param {number} index Index of the row to change
*/
export default function toggleBuildingLock(index) {
if (l(`productLock${index}`).innerHTML === 'Lock') {
// Add to storing array
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.lockedM... | /**
* This function toggle the locked state of a building
* @param {number} index Index of the row to change
*/
export default function toggleBuildingLock(index) {
if (l(`productLock${index}`).innerHTML === 'Lock') {
Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.lockedMinigames.push(
index.t... |
Add v prefix to version. | /**
* exported PageHeader
*
* A page header component.
*
**/
var React = require('react');
var PropTypes = require('prop-types'); // ES5 with npm
var createReactClass = require('create-react-class');
exports.PageHeader = createReactClass({
propTypes: {
title: PropTypes.string,
version: PropTypes.string
},... | /**
* exported PageHeader
*
* A page header component.
*
**/
var React = require('react');
var PropTypes = require('prop-types'); // ES5 with npm
var createReactClass = require('create-react-class');
exports.PageHeader = createReactClass({
propTypes: {
title: PropTypes.string,
version: PropTypes.string
},... |
Fix irregular whitespace linter error. | import React, {PropTypes, Component} from 'react'
import Dropdown from 'shared/components/Dropdown'
import {showDatabases} from 'shared/apis/metaQuery'
import showDatabasesParser from 'shared/parsing/showDatabases'
class DatabaseDropdown extends Component {
constructor(props) {
super(props)
this.state = {
... | import React, {PropTypes, Component} from 'react'
import Dropdown from 'shared/components/Dropdown'
import {showDatabases} from 'shared/apis/metaQuery'
import showDatabasesParser from 'shared/parsing/showDatabases'
class DatabaseDropdown extends Component {
constructor(props) {
super(props)
this.state = {
... |
Correct default value of attribute 'enabled'. | <?php
/**
* @link https://github.com/thinker-g/yii2-ishtar-gate
* @copyright Copyright (c) Thinker_g (Jiyan.guo@gmail.com)
* @author Thinker_g
* @license MIT
*
* This file return a sample configuration array with all supported options and their default values.
* You may use this as a template to customize your ... | <?php
/**
* @link https://github.com/thinker-g/yii2-ishtar-gate
* @copyright Copyright (c) Thinker_g (Jiyan.guo@gmail.com)
* @author Thinker_g
* @license MIT
*
* This file return a sample configuration array with all supported options and their default values.
* You may use this as a template to customize your ... |
Fix bug: if code cannot be formatted the format returns null | package org.eclipse.incquery.examples.cps.m2t.proto.distributed.generator.utils;
import org.eclipse.incquery.examples.cps.m2t.proto.distributed.generator.exceptions.CPSGeneratorException;
import org.eclipse.jdt.core.ToolFactory;
import org.eclipse.jdt.core.formatter.CodeFormatter;
import org.eclipse.jface.text.BadLoca... | package org.eclipse.incquery.examples.cps.m2t.proto.distributed.generator.utils;
import org.eclipse.incquery.examples.cps.m2t.proto.distributed.generator.exceptions.CPSGeneratorException;
import org.eclipse.jdt.core.ToolFactory;
import org.eclipse.jdt.core.formatter.CodeFormatter;
import org.eclipse.jface.text.BadLoca... |
Fix NullPointerException when searched text is not set via a system property | package com.github.sulir.runtimesearch.shared;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
public class SearchOptions implements Serializable {
public static final String PROPERTY_PREFIX = "runtimesearch.";
private static final long serialVersionUI... | package com.github.sulir.runtimesearch.shared;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
public class SearchOptions implements Serializable {
public static final String PROPERTY_PREFIX = "runtimesearch.";
private static final long serialVersionUI... |
Replace react-apollo with redux compose | import React from "react";
import { compose } from "redux";
import hoistStatics from "hoist-non-react-statics";
import BaseProvider from "../components/BaseProvider";
import applyRedirect from "../router/applyRedirect";
import withCookies from "../cookies/withCookiesPage";
import withLocale from "../i18n/withLocalePage... | import React from "react";
import { compose } from "react-apollo";
import hoistStatics from "hoist-non-react-statics";
import BaseProvider from "../components/BaseProvider";
import applyRedirect from "../router/applyRedirect";
import withCookies from "../cookies/withCookiesPage";
import withLocale from "../i18n/withLoc... |
Add name to differentiate R and RW on quads/datatset. | /**
* 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... |
Add test for collapsed text | import ExpandablePanelModule from "./expandablePanel";
const { module } = angular.mock;
describe("ExpandablePanel", () => {
beforeEach(module(ExpandablePanelModule));
let $log;
beforeEach(inject(($injector) => {
$log = $injector.get("$log");
$log.reset();
}));
afterEach(() => {
$log.assertEmpty... | import ExpandablePanelModule from "./expandablePanel";
const { module } = angular.mock;
describe("ExpandablePanel", () => {
beforeEach(module(ExpandablePanelModule));
let $log;
beforeEach(inject(($injector) => {
$log = $injector.get("$log");
$log.reset();
}));
afterEach(() => {
$log.assertEmpty... |
Allow team num players column to be ordered | from django.contrib import admin
from django.db.models import Count
from .models import Team
from nucleus.admin import TeamMemberInline
class TeamAdmin(admin.ModelAdmin):
inlines = (TeamMemberInline, )
raw_id_fields = ('captain', 'creator', )
list_display = (
'name',
'get_player_count',
... | from django.contrib import admin
from .models import Team
from nucleus.admin import TeamMemberInline
class TeamAdmin(admin.ModelAdmin):
inlines = (TeamMemberInline, )
raw_id_fields = ('captain', 'creator', )
list_display = (
'name',
'get_player_count',
'get_player_list',
'... |
Switch login flow a little | $(document).ready(function(){
facebookSdk(loginLink);
sphere();
nav();
$("#os-phrases > h2").lettering('words').children("span").lettering().children("span").lettering();
$('.stopButton').on( "click", function() {
var playing = true;
var music = document.getElementById("Drone");
if(playing... | $(document).ready(function(){
facebookSdk(loginLink);
sphere();
nav();
$("#os-phrases > h2").lettering('words').children("span").lettering().children("span").lettering();
$('.stopButton').on( "click", function() {
var playing = true;
var music = document.getElementById("Drone");
if(playing... |
Change version from 2.2 to 2.3 | <?php
require_once dirname(__FILE__).'/omise-plugin/helpers/charge.php';
require_once dirname(__FILE__).'/omise-plugin/helpers/currency.php';
require_once dirname(__FILE__).'/omise-plugin/helpers/transfer.php';
// Define version of Omise-OpenCart
if (!defined('OMISE_OPENCART_VERSION'))
define('OMISE_OPENCART_VERS... | <?php
require_once dirname(__FILE__).'/omise-plugin/helpers/charge.php';
require_once dirname(__FILE__).'/omise-plugin/helpers/currency.php';
require_once dirname(__FILE__).'/omise-plugin/helpers/transfer.php';
// Define version of Omise-OpenCart
if (!defined('OMISE_OPENCART_VERSION'))
define('OMISE_OPENCART_VERS... |
Use next to propagate err | import User from 'src/models/UserModel';
import jwt from 'jsonwebtoken';
export const list = (req, res, next) => User.find({})
.then(data => res.json(data))
.catch(err => next(err));
export const getUser = (req, res) => {
res.json(req.user);
}
export const registerUser = (req, res, next) => {
const { email, ... | import User from 'src/models/UserModel';
import jwt from 'jsonwebtoken';
export const list = (req, res, next) => User.find({})
.then(data => res.json(data))
.catch(err => next(err));
export const getUser = (req, res) => {
res.json(req.user);
}
export const registerUser = (req, res, next) => {
const { email, ... |
Change the comments about jQuery and require.js | document.addEventListener("DOMContentLoaded", function() {
var acosAplusResizeIframe = function($, window, document, undefined) {
var exerciseWrapper = $('#exercise-page-content'); // A+ adds this around exercise content
var newWidth = Math.max(exerciseWrapper.width(), 500); // full width of the exercise area... | document.addEventListener("DOMContentLoaded", function() {
var acosAplusResizeIframe = function($, window, document, undefined) {
var exerciseWrapper = $('#exercise-page-content'); // A+ adds this around exercise content
var newWidth = Math.max(exerciseWrapper.width(), 500); // full width of the exercise area... |
Remove default params for fetchThread | import Axios from 'axios';
import {
THREAD_REQUEST,
THREAD_LOADED,
THREAD_DESTROY,
THREAD_POST_LOAD
} from '../constants';
function requestThread(threadID) {
console.log("Action RequestThread wth ID:", threadID);
return {
type: THREAD_REQUEST,
threadID
}
}
function receiveT... | import Axios from 'axios';
import {
THREAD_REQUEST,
THREAD_LOADED,
THREAD_DESTROY,
THREAD_POST_LOAD
} from '../constants';
function requestThread(threadID) {
console.log("Action RequestThread wth ID:", threadID);
return {
type: THREAD_REQUEST,
threadID
}
}
function receiveT... |
Fix error with generate URL | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from flask import Flask, request, json
from flask.ext.cors import CORS
import database
import rsser
# Update data before application is allowed to start
database.update_database()
app = Flask(__name__)
CORS(app)
@app.route('/speakercast/speakers')
def speakers():
... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from flask import Flask, request, json
from flask.ext.cors import CORS
import database
import rsser
# Update data before application is allowed to start
database.update_database()
app = Flask(__name__)
CORS(app)
@app.route('/speakercast/speakers')
def speakers():
... |
Tests: Improve error message for Promise rejections | 'use strict';
const path = require('path');
const fs = require('fs');
const noop = () => {};
before('initialization', function () {
process.on('unhandledRejection', err => {
// I'd throw the err, but we have a heisenbug on our hands and I'd
// rather not have it screw with Travis in the interim
console.log(er... | 'use strict';
const path = require('path');
const fs = require('fs');
const noop = () => {};
before('initialization', function () {
// Load and override configuration before starting the server
let config;
try {
require.resolve('../config/config');
} catch (err) {
if (err.code !== 'MODULE_NOT_FOUND' && err.c... |
Add validation check before renting parking space | <?php
namespace App\Http\Controllers;
class ParkingController
{
public function getAll()
{
return Response::json('success', $this->table()->get());
}
public function get($id)
{
$parking = $this->table()->where('id', $id)->get();
return Response::json('success', $parking);... | <?php
namespace App\Http\Controllers;
class ParkingController
{
public function getAll()
{
return Response::json('success', $this->table()->get());
}
public function get($id)
{
$parking = $this->table()->where('id', $id)->get();
return Response::json('success', $parking);... |
Fix error that prevented scrolling | import Ember from 'ember';
import layout from '../../templates/components/power-select/options';
export default Ember.Component.extend({
layout: layout,
tagName: 'ul',
attributeBindings: ['role', 'aria-controls'],
role: 'listbox',
init() {
this._super(...arguments);
this._touchMoveHandler = this._to... | import Ember from 'ember';
import layout from '../../templates/components/power-select/options';
export default Ember.Component.extend({
layout: layout,
tagName: 'ul',
attributeBindings: ['role', 'aria-controls'],
role: 'listbox',
init() {
this._super(...arguments);
this._touchMoveHandler = this._to... |
refactor: Reset input values in controller when clear button clicked | import Ember from 'ember';
// import $ from 'jquery';
export default Ember.Component.extend({
expense: {
sum: '',
category: '',
name: ''
},
currency: '£',
expenseCategories: [
'Charity',
'Clothing',
'Education',
'Events',
'Food',
'Gifts',
'Healthcare',
'Household',
... | import Ember from 'ember';
// import $ from 'jquery';
export default Ember.Component.extend({
expense: {
sum: null,
category: '',
name: ''
},
currency: '£',
expenseCategories: [
'Charity',
'Clothing',
'Education',
'Events',
'Food',
'Gifts',
'Healthcare',
'Household',... |
Disable logging on test runner process | import logging
import mock
import oauth2u
import oauth2u.server.log
def teardown_function(func):
logging.disable(logging.INFO)
def test_should_have_optional_port():
server = oauth2u.Server()
assert 8000 == server.port
def test_should_accept_custom_port():
server = oauth2u.Server(8888)
assert 8... | import logging
import mock
import oauth2u
import oauth2u.server.log
def test_should_have_optional_port():
server = oauth2u.Server()
assert 8000 == server.port
def test_should_accept_custom_port():
server = oauth2u.Server(8888)
assert 8888 == server.port
def test_should_configure_log_with_default... |
Use TeX magic to allow bulder override | 'use babel'
import _ from 'lodash'
import fs from 'fs-plus'
import path from 'path'
import MagicParser from './parsers/magic-parser'
export default class BuilderRegistry {
getBuilder (filePath) {
const builders = this.getAllBuilders()
const candidates = builders.filter((builder) => builder.canProcess(filePa... | 'use babel'
import fs from 'fs-plus'
import path from 'path'
export default class BuilderRegistry {
getBuilder (filePath) {
const builders = this.getAllBuilders()
const candidates = builders.filter((builder) => builder.canProcess(filePath))
switch (candidates.length) {
case 0: return null
ca... |
Fix for $.ajaxSetup not working in Chrome. Usage is not recommended.
This caused changes to custom request headers to be ignored. Calling ajaxSetup wasn't updating the headers used by the next AJAX call. The jQuery docs recommend not using ajaxSetup. | HAL.Http.Client = function(opts) {
this.vent = opts.vent;
this.defaultHeaders = { 'Accept': 'application/hal+json, application/json, */*; q=0.01' };
};
HAL.Http.Client.prototype.get = function(url) {
var self = this;
this.vent.trigger('location-change', { url: url });
var jqxhr = $.ajax({
url: url,
d... | HAL.Http.Client = function(opts) {
this.vent = opts.vent;
$.ajaxSetup({ headers: { 'Accept': 'application/hal+json, application/json, */*; q=0.01' } });
};
HAL.Http.Client.prototype.get = function(url) {
var self = this;
this.vent.trigger('location-change', { url: url });
var jqxhr = $.ajax({
url: url,
... |
Update library version to 0.1.0 | Package.describe({
name: 'toystars:elasticsearch-sync',
version: '0.1.0',
// Brief, one-line summary of the package.
summary: 'ElasticSearch utility wrapper for mongoDB integration and sync',
// URL to the Git repository containing the source code for this package.
git: 'https://github.com/toystars/elastics... | Package.describe({
name: 'toystars:elasticsearch-sync',
version: '0.0.9',
// Brief, one-line summary of the package.
summary: 'ElasticSearch utility wrapper for mongoDB integration and sync',
// URL to the Git repository containing the source code for this package.
git: 'https://github.com/toystars/elastics... |
Correct name for the shopping search api | #!/usr/bin/python2.4
# -*- coding: utf-8 -*-
#
# Copyright 2010 Google Inc. All Rights Reserved.
"""Simple command-line example for The Google Search
API for Shopping.
Command-line application that does a search for products.
"""
__author__ = 'jcgregorio@google.com (Joe Gregorio)'
from apiclient.discovery import bu... | #!/usr/bin/python2.4
# -*- coding: utf-8 -*-
#
# Copyright 2010 Google Inc. All Rights Reserved.
"""Simple command-line example for The Google Shopping API.
Command-line application that does a search for products.
"""
__author__ = 'jcgregorio@google.com (Joe Gregorio)'
from apiclient.discovery import build
import... |
Add a version sanity check | import sys
if sys.version < '3.4':
print('Sorry, this is not a compatible version of Python. Use 3.4 or later.')
exit(1)
import ez_setup
ez_setup.use_setuptools()
from setuptools import setup, find_packages
with open('README.md') as f:
description = f.read()
setup(name='WebShack',
version='0.0.1'... | import ez_setup
ez_setup.use_setuptools()
from setuptools import setup, find_packages
with open('README.md') as f:
description = f.read()
setup(name='WebShack',
version='0.0.1',
description='Web Component/Polymer distribution system',
author='Alistair Lynn',
author_email='arplynn@gmail.co... |
Test commit, magnus tok ikke feil | package models;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToO... | package models;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToO... |
Allow "-" as a char in a filename | '''Constants used by TRender.
:copyright: 2015, Jeroen van der Heijden (Transceptor Technology)
'''
LINE_IF = 1
LINE_ELSE = 2
LINE_ELIF = 4
LINE_END = 8
LINE_MACRO = 16
LINE_COMMENT = 32
LINE_BLOCK = 64
LINE_FOR = 128
LINE_PASTE = 256
LINE_TEXT = 512
LINE_INCLUDE = 1024
LINE_EXTEND = 2048
LINE_EMPTY = 4096
EOF_TEXT ... | '''Constants used by TRender.
:copyright: 2015, Jeroen van der Heijden (Transceptor Technology)
'''
LINE_IF = 1
LINE_ELSE = 2
LINE_ELIF = 4
LINE_END = 8
LINE_MACRO = 16
LINE_COMMENT = 32
LINE_BLOCK = 64
LINE_FOR = 128
LINE_PASTE = 256
LINE_TEXT = 512
LINE_INCLUDE = 1024
LINE_EXTEND = 2048
LINE_EMPTY = 4096
EOF_TEXT ... |
Fix support of custom background on icons | import React from 'react';
import IconSVG from './IconSVG';
import { iconClass } from './util';
import { prefixable } from '../../decorators';
export const Icon = (props) => {
const { sprite, icon, title, circle, background, size, div, prefix } = props;
const backgroundClass = !background ? `icon-${sprite}-${icon... | import React from 'react';
import IconSVG from './IconSVG';
import { iconClass } from './util';
import { prefixable } from '../../decorators';
export const Icon = (props) => {
const { sprite, icon, title, circle, background, size, div, prefix } = props;
const backgroundClass = !background ? `icon-${sprite}-${icon... |
Fix to typing of loop variables |
important: Set[str] = {"Albert Einstein" , "Alan Turing"}
texts: Dict[str, str] = input() # {"<author >" : "<t e x t >"}
freqdict: Dict[str, int] = {} # defaultdict(int) err: int recognized as varId #initialized to 0
a: str = "" #necessary?
b: str = ""
for a, b in texts.items():
if a in important: #t... |
important: Set[str] = {"Albert Einstein" , "Alan Turing"}
texts: Dict[str, str] = input() # {"<author >" : "<t e x t >"}
freqdict: Dict[str, int] = {} # defaultdict(int) err: int recognized as varId #initialized to 0
a: str = "" #necessary?
b: str = ""
for a, b in texts.items():
if a in important: #... |
Fix theme lookup in OTU form module
Was causing application crash. | import React from "react";
import styled from "styled-components";
import { ModalBody, ModalFooter, Input, InputError, InputGroup, InputLabel, SaveButton } from "../../base";
const OTUFormBody = styled(ModalBody)`
display: grid;
grid-template-columns: 9fr 4fr;
grid-column-gap: ${props => props.theme.gap.co... | import React from "react";
import styled from "styled-components";
import { ModalBody, ModalFooter, Input, InputError, InputGroup, InputLabel, SaveButton } from "../../base";
const OTUFormBody = styled(ModalBody)`
display: grid;
grid-template-columns: 9fr 4fr;
grid-column-gap: ${props => props.gap.column};... |
Use the replacement data source | package org.bridgedb.examples;
import org.bridgedb.BridgeDb;
import org.bridgedb.IDMapper;
import org.bridgedb.IDMapperException;
import org.bridgedb.Xref;
import org.bridgedb.bio.BioDataSource;
public class ChebiPubchemExample
{
public static void main (String[] args) throws ClassNotFoundException, IDMapperExcept... | package org.bridgedb.examples;
import org.bridgedb.BridgeDb;
import org.bridgedb.IDMapper;
import org.bridgedb.IDMapperException;
import org.bridgedb.Xref;
import org.bridgedb.bio.BioDataSource;
public class ChebiPubchemExample
{
public static void main (String[] args) throws ClassNotFoundException, IDMapperExcept... |
Create intermidate dirs if they do not exist when moving files | """
Script to move corrupt images to 'dirty' directory
Reads list of images to move. Does not verify that images are corrupt -
Simply moves to 'dirty' directory of appropriate data-release creating
the required directory structure
"""
import os
import argparse
parser = argparse.ArgumentParser(
... | """
Script to move corrupt images to 'dirty' directory
Reads list of images to move. Does not verify that images are corrupt -
Simply moves to 'dirty' directory of appropriate data-release creating
the required directory structure
"""
import os
import argparse
parser = argparse.ArgumentParser(
... |
Add simple tests for matrix operands for distance measure. | import numpy as np
import nearpy.distances
class MatrixCosineDistance(nearpy.distances.CosineDistance):
"""
A distance measure for calculating the cosine distance between matrices.
"""
def distance(self, x, y):
if len(x.shape) <= 1:
return super(MatrixCosineDistance, self).distan... | import numpy as np
import nearpy.distances
class MatrixCosineDistance(nearpy.distances.CosineDistance):
"""
A distance measure for calculating the cosine distance between matrices.
"""
def distance(self, x, y):
if len(x.shape) <= 1:
return super(MatrixCosineDistance, self).distance(x, y)
... |
Add support for "egulias/email-validator" 2.x | <?php
/*
* This file is part of Respect/Validation.
*
* (c) Alexandre Gomes Gaigalas <alexandre@gaigalas.net>
*
* For the full copyright and license information, please view the "LICENSE.md"
* file that was distributed with this source code.
*/
namespace Respect\Validation\Rules;
use Egulias\EmailValidator\Em... | <?php
/*
* This file is part of Respect/Validation.
*
* (c) Alexandre Gomes Gaigalas <alexandre@gaigalas.net>
*
* For the full copyright and license information, please view the "LICENSE.md"
* file that was distributed with this source code.
*/
namespace Respect\Validation\Rules;
use Egulias\EmailValidator\Em... |
Update stream name to Replay | from index import app
from flask import render_template, request
from config import BASE_URL
from query import get_callout, get_billboard
SHEET_ID = 'tzE2PsqJoWRpENlMr-ZlS8A'
#SHEET_ID = 'tIk5itVcfOHUmakkmpjCcxw' # Demo sheet
@app.route('/')
def index():
page_url = BASE_URL + request.path
page_title = 'Audi... | from index import app
from flask import render_template, request
from config import BASE_URL
from query import get_callout, get_billboard
SHEET_ID = 'tzE2PsqJoWRpENlMr-ZlS8A'
#SHEET_ID = 'tIk5itVcfOHUmakkmpjCcxw' # Demo sheet
#@app.route('/')
#def index():
# page_url = BASE_URL + request.path
# page_title = '... |
Delete store purchases when the related store is deleted | <?php
class Kohana_Model_Store extends Jam_Model {
/**
* @codeCoverageIgnore
*/
public static function initialize(Jam_Meta $meta)
{
$meta
->behaviors(array(
'paranoid' => Jam::behavior('paranoid'),
))
->associations(array(
'store_purchases' => Jam::association('hasmany', array(
'inverse... | <?php
class Kohana_Model_Store extends Jam_Model {
/**
* @codeCoverageIgnore
*/
public static function initialize(Jam_Meta $meta)
{
$meta
->behaviors(array(
'paranoid' => Jam::behavior('paranoid'),
))
->associations(array(
'store_purchases' => Jam::association('hasmany', array(
'inverse... |
Fix typo on job module | import sys
import time
import logging
logging.basicConfig(level=logging.DEBUG)
from redis import StrictRedis
from rq import Queue
from apscheduler.schedulers.blocking import BlockingScheduler
from d1lod import jobs
conn = StrictRedis(host='redis', port='6379')
q = Queue(connection=conn)
sched = BlockingScheduler()
... | import sys
import time
import logging
logging.basicConfig(level=logging.DEBUG)
from redis import StrictRedis
from rq import Queue
from apscheduler.schedulers.blocking import BlockingScheduler
from d1lod import jobs
conn = StrictRedis(host='redis', port='6379')
q = Queue(connection=conn)
sched = BlockingScheduler()
... |
Disable fires in the last 7 days on map | import { fetchFireAlertsByGeostore } from 'services/analysis';
import {
POLITICAL_BOUNDARIES_DATASET,
FIRES_VIIRS_DATASET,
} from 'data/datasets';
import {
DISPUTED_POLITICAL_BOUNDARIES,
POLITICAL_BOUNDARIES,
FIRES_ALERTS_VIIRS,
} from 'data/layers';
import getWidgetProps from './selectors';
export default... | import { fetchFireAlertsByGeostore } from 'services/analysis';
import {
POLITICAL_BOUNDARIES_DATASET,
FIRES_VIIRS_DATASET,
} from 'data/datasets';
import {
DISPUTED_POLITICAL_BOUNDARIES,
POLITICAL_BOUNDARIES,
FIRES_ALERTS_VIIRS,
} from 'data/layers';
import getWidgetProps from './selectors';
export default... |
Send result as json instead of plaintext | import flask
import json
from flask import jsonify
from donut.modules.groups import blueprint, helpers
@blueprint.route("/1/groups/")
def get_groups_list():
# Create a dict of the passed in attribute which are filterable
filterable_attrs = ["group_id", "group_name", "group_desc", "type"]
attrs = {
... | import flask
import json
from flask import jsonify
from donut.modules.groups import blueprint, helpers
@blueprint.route("/1/groups/")
def get_groups_list():
# Create a dict of the passed in attribute which are filterable
filterable_attrs = ["group_id", "group_name", "group_desc", "type"]
attrs = {
... |
Update testing frontend a bit | /* global: io */
const socket = io.connect('http://localhost:3000');
socket.on('connection', () => {});
socket.on('meeting', (data) => {
let title = 'Ingen aktiv generalforsamling.';
if (data && data.title) {
title = data.title;
}
document.getElementById('meeting-title').innerHTML = title;
socket.emit('... | /* global: io */
const socket = io.connect('http://localhost:3000');
socket.on('connection', () => {});
socket.on('meeting', (data) => {
let title = 'Ingen aktiv generalforsamling.';
if (data && data.title) {
title = data.title;
}
document.getElementById('meeting-title').innerHTML = title;
socket.emit('... |
Enable building hybrid capsule/non-capsule packages (CNY-3271) | #
# Copyright (c) 2009 rPath, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.rpath.com/permanent/... | #
# Copyright (c) 2009 rPath, Inc.
#
# This program is distributed under the terms of the Common Public License,
# version 1.0. A copy of this license should have been distributed with this
# source file in a file called LICENSE. If it is not present, the license
# is always available at http://www.rpath.com/permanent/... |
Cover direct mailer with stub fn | var assert = require('chai').assert;
var Promise = require('bluebird');
var sinon = require('sinon');
var DirectMailer = require('../lib/DirectMailer');
describe('DirectMailer', function () {
it('Should properly export', function () {
assert.isFunction(DirectMailer);
});
it('Should properly instantiate', fu... | var assert = require('chai').assert;
var Promise = require('bluebird');
var sinon = require('sinon');
var DirectMailer = require('../lib/DirectMailer');
describe('DirectMailer', function () {
it('Should properly export', function () {
assert.isFunction(DirectMailer);
});
it('Should properly instantiate', fu... |
Disable session for api modules | <?php
namespace app\modules\api;
use yii\base\BootstrapInterface;
class Api extends \yii\base\Module implements BootstrapInterface
{
public $controllerNamespace = 'app\modules\api\controllers';
private static $_defaultVersion = 'v1';
public static function getDefaultVersion()
{
return self... | <?php
namespace app\modules\api;
use yii\base\BootstrapInterface;
class Api extends \yii\base\Module implements BootstrapInterface
{
public $controllerNamespace = 'app\modules\api\controllers';
private static $_defaultVersion = 'v1';
public static function getDefaultVersion()
{
return self... |
Fix goto simple sections at sidebar | import ServerboardView from 'app/components/project'
import store from 'app/utils/store'
import { projects_update_info } from 'app/actions/project'
var Project=store.connect({
state(state){
if (state.project.current != "/" && localStorage.last_project != state.project.current){
localStorage.last_project = ... | import ServerboardView from 'app/components/project'
import store from 'app/utils/store'
import { projects_update_info } from 'app/actions/project'
var Project=store.connect({
state(state){
if (state.project.current != "/" && localStorage.last_project != state.project.current){
localStorage.last_project = ... |
Correct the translation domain for loading messages
Change-Id: If7fa8fd1915378bda3fc6e361049c2d90cdec8af | # Copyright 2014 Mirantis 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 ... | # Copyright 2014 Mirantis 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 ... |
Remove all children of a folder when it is deleted | import syncClient from '../db/sync_client';
import { DELETE_BOOKMARK, DELETE_FOLDER } from '../constants';
export function deleteBookmark(id) {
return (dispatch) => {
syncClient
.bookmarks
.delete(id)
.then(() => {
dispatch({
type: DELETE_BOOKMARK,
payload: id,
... | import syncClient from '../db/sync_client';
import { DELETE_BOOKMARK, DELETE_FOLDER } from '../constants';
export function deleteBookmark(id) {
return (dispatch) => {
syncClient
.bookmarks
.delete(id)
.then(() => {
dispatch({
type: DELETE_BOOKMARK,
payload: id,
... |
Use jQuery directly instead of $ in plugin | /**
* Initialize Pattern builder plugin.
*/
;(function () {
var pluginName = 'patternMaker',
pluginDefaults = {
palette: []
};
/**
* Constructor.
*
* @param {dom} element Drawing board
* @param {object} options Plugin options
*/
function ... | /**
* Initialize Pattern builder plugin.
*/
;(function ($) {
var pluginName = 'patternMaker',
pluginDefaults = {
palette: []
};
/**
* Constructor.
*
* @param {dom} element Drawing board
* @param {object} options Plugin options
*/
function... |
Add comments to solution to better understand | // Sieve of Eratosthenes
/*RULES:
Function takes one parameter
Return an array of all prime numbers from 0-parameter
*/
/*PSEUDOCODE:
1) Find square root of parameter
2) Create an array of numbers from 0-parameter
3) Loop through numbers, but stop until square root (if a float, stop after number rounded up?... | // Sieve of Eratosthenes
/*RULES:
Function takes one parameter
Return an array of all prime numbers from 0-parameter
*/
/*PSEUDOCODE:
1) Find square root of parameter
2) Create an array of numbers from 0-parameter
3) Loop through numbers, but stop until square root (if a float, stop after number rounded up?... |
Change command prefix to $, so that's like a tip. | #!/usr/bin/python3
import asyncio
import configparser
import discord
import os
from discord.ext import commands
# Parse the config and stick in global "config" var
config = configparser.ConfigParser()
for inifile in [os.path.expanduser('~')+'/.bayohwoolph.ini','bayohwoolph.local.ini','bayohwoolph.ini']:
if os.path... | #!/usr/bin/python3
import asyncio
import configparser
import discord
import os
from discord.ext import commands
# Parse the config and stick in global "config" var
config = configparser.ConfigParser()
for inifile in [os.path.expanduser('~')+'/.bayohwoolph.ini','bayohwoolph.local.ini','bayohwoolph.ini']:
if os.path... |
Use div instead of h1 for site title | <?php
/**
* Header top template
*
* @package ZnWP Bootstrap Theme
*/
global $znwp_theme;
?>
<div class="container">
<div class="row">
<div class="<?php echo $znwp_theme->get_full_width_class(); ?>">
<?php if ($znwp_theme->display_header_text()): ?>
... | <?php
/**
* Header top template
*
* @package ZnWP Bootstrap Theme
*/
global $znwp_theme;
?>
<div class="container">
<div class="row">
<div class="<?php echo $znwp_theme->get_full_width_class(); ?>">
<?php if ($znwp_theme->display_header_text()): ?>
... |
Resolve some error messages due to unnecessarily retrieved data |
module.exports = function(grunt) {
grunt.registerTask('bundleEPUB', function() {
var done = this.async();
grunt.config.requires('akasha');
// grunt.config.requires('config');
var akasha = grunt.config('akasha');
// var config = grunt.config('config');
var epubversion... |
module.exports = function(grunt) {
grunt.registerTask('bundleEPUB', function() {
var done = this.async();
grunt.config.requires('akasha');
grunt.config.requires('config');
var akasha = grunt.config('akasha');
var config = grunt.config('config');
var epubversion = "ep... |
Remove invalid value of parameter | <?php
declare(strict_types = 1);
/*
* This file is part of the FiveLab Resource package
*
* (c) FiveLab
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code
*/
namespace FiveLab\Component\Resource\Resource;
use FiveLab\Component\Resourc... | <?php
declare(strict_types = 1);
/*
* This file is part of the FiveLab Resource package
*
* (c) FiveLab
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code
*/
namespace FiveLab\Component\Resource\Resource;
use FiveLab\Component\Resourc... |
Handle the new signature of will-navigate | import { remote } from 'electron';
const webview = document.querySelector('webview');
if (webview) {
let once = true;
webview.addEventListener('did-start-loading', () => {
if (once) {
once = false;
webview.src = Settings.get('lastPage', 'https://play.google.com/music/listen');
document.body.... | import { remote } from 'electron';
const webview = document.querySelector('webview');
if (webview) {
let once = true;
webview.addEventListener('did-start-loading', () => {
if (once) {
once = false;
webview.src = Settings.get('lastPage', 'https://play.google.com/music/listen');
document.body.... |
Use Ember.observer over named properties
The named properties are a convenience but makes it harder to overload
later on. It is better to use observers and in the case of an addon the
Ember.observer() pattern | import Ember from 'ember';
import SelectPickerMixin from 'ember-cli-select-picker/mixins/select-picker';
var I18nProps = (Ember.I18n && Ember.I18n.TranslateableProperties) || {};
var SelectPickerComponent = Ember.Component.extend(
SelectPickerMixin, I18nProps, {
selectAllLabel: 'All',
selectNoneLabel: 'None',... | import Ember from 'ember';
import SelectPickerMixin from 'ember-cli-select-picker/mixins/select-picker';
var I18nProps = (Ember.I18n && Ember.I18n.TranslateableProperties) || {};
var SelectPickerComponent = Ember.Component.extend(
SelectPickerMixin, I18nProps, {
selectAllLabel: 'All',
selectNoneLabel: 'None',... |
Adjust event to match the doc | 'use strict';
var uuid = require('uuid');
/**
* Handle the socket connections.
*
* @class
* @param {Socket.io} io - The listening object
*/
function SocketHandler(io) {
/**
* The states of all the users.
*/
var states = {
players: {}
};
// send the users position on a regular time basis
... | 'use strict';
var uuid = require('uuid');
/**
* Handle the socket connections.
*
* @class
* @param {Socket.io} io - The listening object
*/
function SocketHandler(io) {
/**
* The states of all the users.
*/
var states = {};
// send the users position on a regular time basis
setInterval(functio... |
Add more detail to initialize include.
Change-Id: I339e8e2a19e783dcf0b252e37b70b54910e55cc8 | // [START initialize_firebase_in_sw]
// Give the service worker access to Firebase Messaging.
// Note that you can only use Firebase Messaging here, other Firebase libraries
// are not available in the service worker.
importScripts('https://www.gstatic.com/firebasejs/3.5.0/firebase-app.js');
importScripts('https://www.... | // Give the service worker access to Firebase Messaging.
// Note that you can only use Firebase Messaging here, other Firebase libraries
// are not available in the service worker.
importScripts('https://www.gstatic.com/firebasejs/3.5.0/firebase.js');
// [START initialize_firebase_in_sw]
// Initialize the Firebase app... |
Use a lambda as a proxy. | import asyncore
import util
try:
import simplejson as json
except ImportError:
import json
class ChannelServer(asyncore.dispatcher):
def __init__(self, sock, dest):
asyncore.dispatcher.__init__(self, sock)
self.dest = dest
dest.register('close', lambda x, y: self.close())
def handle_accept(self):
clie... | import asyncore
import util
try:
import simplejson as json
except ImportError:
import json
class ChannelServer(asyncore.dispatcher):
def __init__(self, sock, dest):
asyncore.dispatcher.__init__(self, sock)
self.dest = dest
dest.register('close', self.closehook)
def handle_accept(self):
client = self.... |
Refactor test to use cool py.test's fixture | # 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
# distributed under t... | # 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
# distributed under t... |
Improve error reporting in client. | package client
import (
"github.com/ibrt/go-oauto/oauto/api"
"net/http"
"fmt"
"encoding/json"
"github.com/go-errors/errors"
"bytes"
"io/ioutil"
)
func Authenticate(baseURL string, request *api.AuthenticateRequest) (*api.AuthenticateResponse, error) {
body, err := json.Marshal(request)
if err != nil {
retur... | package client
import (
"github.com/ibrt/go-oauto/oauto/api"
"net/http"
"fmt"
"encoding/json"
"github.com/go-errors/errors"
"bytes"
"io/ioutil"
)
func Authenticate(baseURL string, request *api.AuthenticateRequest) (*api.AuthenticateResponse, error) {
body, err := json.Marshal(request)
if err != nil {
retur... |
Fix update progress pane with correct overlay method | package ui
import (
"image"
"image/color"
"image/draw"
"github.com/ninjasphere/go-gestic"
"github.com/ninjasphere/sphere-go-led-controller/util"
)
type UpdateProgressPane struct {
progressImage util.Image
loopingImage util.Image
progress float64
}
func NewUpdateProgressPane(progressImage string, loopi... | package ui
import (
"image"
"image/draw"
"github.com/ninjasphere/go-gestic"
"github.com/ninjasphere/sphere-go-led-controller/util"
)
type UpdateProgressPane struct {
progressImage util.Image
loopingImage util.Image
progress float64
}
func NewUpdateProgressPane(progressImage string, loopingImage string)... |
Add dumpStack for cleanupStorage in java tests. | package org.hyperledger.indy.sdk.utils;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;
public class StorageUtils {
private static void cleanDirectory(File path) throws IOException {
if (path.isDirectory()) {
FileUtils.cleanDirectory(path);
}
}
public static void... | package org.hyperledger.indy.sdk.utils;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.io.IOException;
public class StorageUtils {
private static void cleanDirectory(File path) throws IOException {
if (path.isDirectory()) {
FileUtils.cleanDirectory(path);
}
}
public static void... |
Integrate the hashtable Unit testcases.
* tests/AllTests.java (suite): added HashtableTests
git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@841027 13f79535-47bb-0310-9956-ffa450edef68 | package org.tigris.subversion.lib;
/**
* ====================================================================
* Copyright (c) 2000-2001 CollabNet. All rights reserved.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are ... | package org.tigris.subversion.lib;
/**
* ====================================================================
* Copyright (c) 2000-2001 CollabNet. All rights reserved.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are ... |
Add environmental config for root repo | var queue = require('queue-async');
var express = require('express');
var request = require('request');
var app = express();
app.use(express.static(__dirname + '/static'));
function renderStargazes(req, res, next) {
var q = queue();
for (var i=1; i<=10; i++) {
q.defer(request,{
url:'https://api.github.c... | var queue = require('queue-async');
var express = require('express');
var request = require('request');
var app = express();
app.use(express.static(__dirname + '/static'));
app.get('/:owner/:repo', function(req, res, next) {
var q = queue();
var repoName = req.params.owner + '/' + req.params.repo;
res.locals.re... |
[auth] Allow Authenticate package function to take multiple Methods.
R=ef4933a197ef7b4b3f55f1bec4942aead3637a2a@chromium.org, vadimsh@chromium.org
Bug: 782460
Change-Id: I288d88d184cd7411d5df084407a11864e1d2a18a
Reviewed-on: https://chromium-review.googlesource.com/803672
Reviewed-by: Nodir Turakulov <ef4933a197ef7b4... | // Copyright 2017 The LUCI 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... | // Copyright 2017 The LUCI 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... |
scripts: Print names of missing migrations in compatibility check.
This will make it much easier to debug any situations where this
happens. | #!/usr/bin/env python3
import logging
import os
import sys
ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.insert(0, ZULIP_PATH)
from scripts.lib.setup_path import setup_path
from scripts.lib.zulip_tools import DEPLOYMENTS_DIR, assert_not_running_as_root, parse_versio... | #!/usr/bin/env python3
import logging
import os
import sys
ZULIP_PATH = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.insert(0, ZULIP_PATH)
from scripts.lib.setup_path import setup_path
from scripts.lib.zulip_tools import DEPLOYMENTS_DIR, assert_not_running_as_root, parse_versio... |
Use faster password hasher in sqlite tests
Fixed #18163 | # This is an example test settings file for use with the Django test suite.
#
# The 'sqlite3' backend requires only the ENGINE setting (an in-
# memory database will be used). All other backends will require a
# NAME and potentially authentication information. See the
# following section in the docs for more informatio... | # This is an example test settings file for use with the Django test suite.
#
# The 'sqlite3' backend requires only the ENGINE setting (an in-
# memory database will be used). All other backends will require a
# NAME and potentially authentication information. See the
# following section in the docs for more informatio... |
Add another optional=false for the description refset member. | package org.ihtsdo.otf.mapping.rf2.jpa;
import org.hibernate.search.annotations.ContainedIn;
import com.fasterxml.jackson.annotation.JsonBackReference;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlIDR... | package org.ihtsdo.otf.mapping.rf2.jpa;
import org.hibernate.search.annotations.ContainedIn;
import com.fasterxml.jackson.annotation.JsonBackReference;
import javax.persistence.ManyToOne;
import javax.persistence.MappedSuperclass;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlIDR... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.