text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Upgrade to ew editor API | var CodeMirror = require('codemirror')
, bindCodemirror = require('gulf-codemirror')
module.exports = setup
module.exports.consumes = ['editor']
module.exports.provides = []
function setup(plugin, imports, register) {
var editor = imports.editor
var cmCssLink = document.createElement('link')
cmCssLink.setAttr... | var CodeMirror = require('codemirror')
, bindCodemirror = require('gulf-codemirror')
module.exports = setup
module.exports.consumes = ['editor']
module.exports.provides = []
function setup(plugin, imports, register) {
var editor = imports.editor
var cmCssLink = document.createElement('link')
cmCssLink.setAttr... |
Update Accordion to respect arbitrary user-defined props. | // @flow
import React, { Component, type ElementProps } from 'react';
import { Provider } from 'mobx-react';
import { createAccordionStore } from '../accordionStore/accordionStore';
type AccordionProps = ElementProps<'div'> & {
accordion: boolean,
onChange: Function,
};
class Accordion extends Component<Acco... | // @flow
import React, { Component, type Node } from 'react';
import { Provider } from 'mobx-react';
import { createAccordionStore } from '../accordionStore/accordionStore';
type AccordionProps = {
accordion: boolean,
children: Node,
className: string,
onChange: Function,
};
class Accordion extends C... |
Fix type error in the producers thread test, which was not a compiler error because Object.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=142185290 | /*
* Copyright (C) 2016 The Dagger 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 ag... | /*
* Copyright (C) 2016 The Dagger 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 ag... |
OAK-1847: Use SegmentMK for testing where possible
git-svn-id: 67138be12999c61558c3dd34328380c8e4523e73@1596603 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 ... |
Remove mutability of callback revision | package com.balancedpayments;
import com.balancedpayments.core.Resource;
import com.balancedpayments.core.ResourceCollection;
import com.balancedpayments.core.ResourceField;
import com.balancedpayments.core.ResourceQuery;
import com.balancedpayments.errors.HTTPError;
import java.util.Map;
public class Callback exten... | package com.balancedpayments;
import com.balancedpayments.core.Resource;
import com.balancedpayments.core.ResourceCollection;
import com.balancedpayments.core.ResourceField;
import com.balancedpayments.core.ResourceQuery;
import com.balancedpayments.errors.HTTPError;
import java.util.Map;
public class Callback exten... |
Fix pesky modal duplication issue... | Template.nav.onRendered(function() {
this.$('.button-collapse').sideNav({
closeOnClick: true
});
});
Template.nav.events({
'click .logout': function(e){
e.preventDefault();
Meteor.logout(function(){
sAlert.info('Logged out succesfully');
});
}
})
Template.userDropdown.onRendered(function... | Template.nav.onRendered(function() {
this.$('.button-collapse').sideNav({
closeOnClick: true
});
});
Template.nav.events({
'click .logout': function(e){
e.preventDefault();
Meteor.logout(function(){
sAlert.info('Logged out succesfully');
});
}
})
Template.userDropdown.onRendered(function... |
Use UMD for CLI; fix | #!/usr/bin/env node
const jsf = require('../dist/main.umd.js');
// FIXME: load faker/change on startup?
const sample = process.argv.slice(2)[0];
const { inspect } = require('util');
const { Transform } = require('stream');
const { readFileSync } = require('fs');
const pretty = process.argv.indexOf('--pretty') !== ... | #!/usr/bin/env node
const jsf = require('../dist/bundle.js');
// FIXME: load faker/change on startup?
const sample = process.argv.slice(2)[0];
const { inspect } = require('util');
const { Transform } = require('stream');
const { readFileSync } = require('fs');
const pretty = process.argv.indexOf('--pretty') !== -1... |
Clean error output when command is a string | import functools
import subprocess
from doit.exceptions import TaskFailed
def capture_subprocess_error(fn):
@functools.wraps(fn)
def wrapper(*args, **kwargs):
try:
return fn(*args, **kwargs)
except subprocess.CalledProcessError as e:
command_string = e.cmd if isinstanc... | import functools
import subprocess
from doit.exceptions import TaskFailed
def capture_subprocess_error(fn):
@functools.wraps(fn)
def wrapper(*args, **kwargs):
try:
return fn(*args, **kwargs)
except subprocess.CalledProcessError as e:
return TaskFailed(
... |
Allow passing cookies instance in client
This allows the client to add onSet/onRemove cookies | import { Component } from 'react';
import { instanceOf, node } from 'prop-types';
import Cookies from 'universal-cookie';
import { isNode } from 'universal-cookie/lib/utils';
export default class CookiesProvider extends Component {
static propTypes = {
children: node,
cookies: instanceOf(Cookies)
};
sta... | import { Component } from 'react';
import { instanceOf, node } from 'prop-types';
import Cookies from 'universal-cookie';
import { isNode } from 'universal-cookie/lib/utils';
export default class CookiesProvider extends Component {
static propTypes = {
children: node
};
static childContextTypes = {
cook... |
Remove logic on update remote | var fs = require('fs');
var moment = require('moment');
var rank = require('librank').rank;
// data backup path
var data_path = "./data/talks/";
// read all files in the database
var res = fs.readdirSync(data_path);
// current timestamp
var now = moment();
// calculate difference of hours between two timestamps
fun... | var fs = require('fs');
var moment = require('moment');
var rank = require('librank').rank;
// data backup path
var data_path = "./data/talks/";
// read all files in the database
var res = fs.readdirSync(data_path);
// current timestamp
var now = moment();
// calculate difference of hours between two timestamps
fun... |
Add a note about semantic versioning to |PEG.VERSION| comment | /*
* PEG.js @VERSION
*
* http://pegjs.majda.cz/
*
* Copyright (c) 2010-2012 David Majda
* Licensend under the MIT license.
*/
var PEG = (function(undefined) {
var PEG = {
/* PEG.js version (uses semantic versioning). */
VERSION: "@VERSION",
/*
* Generates a parser from a specified grammar and returns ... | /*
* PEG.js @VERSION
*
* http://pegjs.majda.cz/
*
* Copyright (c) 2010-2012 David Majda
* Licensend under the MIT license.
*/
var PEG = (function(undefined) {
var PEG = {
/* PEG.js version. */
VERSION: "@VERSION",
/*
* Generates a parser from a specified grammar and returns it.
*
* The grammar m... |
Fix the problem with Chute's API not returning correct Content-Type. | import Promise from 'bluebird';
import request from 'superagent';
import assign from 'lodash/object/assign';
const API_BASE = 'https://api.getchute.com/v2';
export default {
fetchAssets: (albumId, opts = {}) => {
return new Promise((resolve, reject) => {
const defs = {
'per_page': 20,
'pag... | import Promise from 'bluebird';
import request from 'superagent';
import assign from 'lodash/object/assign';
const API_BASE = 'https://api.getchute.com/v2';
export default {
fetchAssets: (albumId, opts = {}) => {
return new Promise((resolve, reject) => {
const defs = {
'per_page': 20,
'pag... |
Use a diamond operator where possible | package org.realityforge.replicant.client;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Nonnull;
/**
* Representation of a subscriptions that impact entity.
*/
public class EntitySubscriptionEntry
{
private final Map<GraphDescriptor, GraphSubscriptionEntry>... | package org.realityforge.replicant.client;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Nonnull;
/**
* Representation of a subscriptions that impact entity.
*/
public class EntitySubscriptionEntry
{
private final Map<GraphDescriptor, GraphSubscriptionEntry>... |
Use es6 syntax in get average score function | const colorRanges = {
95: 'brightgreen',
90: 'green',
75: 'yellowgreen',
60: 'yellow',
40: 'orange',
0: 'red',
};
const percentageToColor = (percentage) => {
let key = percentage;
while (!(key in colorRanges)) {
key -= 1;
}
return colorRanges[key];
};
const getAverageScore = async metrics => ... | const colorRanges = {
95: 'brightgreen',
90: 'green',
75: 'yellowgreen',
60: 'yellow',
40: 'orange',
0: 'red',
};
const percentageToColor = (percentage) => {
while(!(percentage in colorRanges)) {
percentage -= 1;
}
return colorRanges[percentage];
};
const getAverageScore = async (metrics) => {
... |
Test commit from JKP Info | <?php
/**
* Created by PhpStorm.
* User: stevan
* Date: 29.9.17.
* Time: 09.07
*/
namespace SalexUserBundle\EventListener;
// ...
use Avanzu\AdminThemeBundle\Event\MessageListEvent;
use FOS\UserBundle\Model\UserInterface;
use SalexUserBundle\Entity\User;
use SalexUserBundle\Model\MessageModel;
use Symfony\Compone... | <?php
/**
* Created by PhpStorm.
* User: stevan
* Date: 29.9.17.
* Time: 09.07
*/
namespace SalexUserBundle\EventListener;
// ...
use Avanzu\AdminThemeBundle\Event\MessageListEvent;
use FOS\UserBundle\Model\UserInterface;
use SalexUserBundle\Entity\User;
use SalexUserBundle\Model\MessageModel;
use Symfony\Compone... |
Undo BC-breaking change, restore 'import onnx' providing submodules.
Signed-off-by: Edward Z. Yang <dbd597f5635f432486c5d365e9bb585b3eaa1853@fb.com> | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from .onnx_ml_pb2 import * # noqa
from .version import version as __version__ # noqa
# Import common subpackages so they're available when you 'import onnx'
import onn... | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from .onnx_ml_pb2 import * # noqa
from .version import version as __version__ # noqa
import sys
def load(obj):
'''
Loads a binary protobuf that stores onnx gr... |
Make search for classifying tasks case insensitive. | const {TASKS_TYPES} = require('./conf/consts')
const getTaskType = (taskName) =>{
for (let task_type of TASKS_TYPES) {
for (let keyword of task_type.keywords) {
if(taskName..toUpperCase().includes(keyword.toUpperCase()))
return task_type.name
}
}
}
module.exports.formatTasks = (rawtasks,fro... | const {TASKS_TYPES} = require('./conf/consts')
const getTaskType = (taskName) =>{
for (let task_type of TASKS_TYPES) {
for (let keyword of task_type.keywords) {
if(taskName.includes(keyword))
return task_type.name
}
}
}
module.exports.formatTasks = (rawtasks,fromDate) => {
console.log('Fo... |
Remove bash_completition references in consumer-manager | from setuptools import setup
from kafka_info import __version__
setup(
name="kafka_info",
version=__version__,
author="Federico Giraud",
author_email="fgiraud@yelp.com",
description="Shows kafka cluster information and metrics",
packages=["kafka_info", "kafka_info.utils", "kafka_info.commands... | from setuptools import setup
from kafka_info import __version__
setup(
name="kafka_info",
version=__version__,
author="Federico Giraud",
author_email="fgiraud@yelp.com",
description="Shows kafka cluster information and metrics",
packages=["kafka_info", "kafka_info.utils", "kafka_info.commands... |
Update alowed paths for GGJ. | const routeRegex = /^\/(global-game-jam-2021|globalgamejam2021|ggj2021|ggj21)(?:\/.*)?$/;
const githubUrl = 'https://levilindsey.github.io/global-game-jam-2021';
// Attaches the route handlers for this app.
exports.attachRoutes = (server, appPath, config) => {
server.get(routeRegex, handleRequest);
// --- --- /... | const routeRegex = /^\/(global-game-jam-2021|ggj2021|ggj21)(?:\/.*)?$/;
const githubUrl = 'https://levilindsey.github.io/global-game-jam-2021';
// Attaches the route handlers for this app.
exports.attachRoutes = (server, appPath, config) => {
server.get(routeRegex, handleRequest);
// --- --- //
// Handles a ... |
Clean up namespace to get rid of sphinx warnings | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Access to Fermi Gamma-ray Space Telescope data.
http://fermi.gsfc.nasa.gov
http://fermi.gsfc.nasa.gov/ssc/data/
"""
from astropy.config import ConfigurationItem
FERMI_URL = ConfigurationItem('fermi_url',
['http://fermi.g... | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Access to Fermi Gamma-ray Space Telescope data.
http://fermi.gsfc.nasa.gov
http://fermi.gsfc.nasa.gov/ssc/data/
"""
from astropy.config import ConfigurationItem
FERMI_URL = ConfigurationItem('fermi_url',
['http://fermi.g... |
fix(ExampleBuilder): Fix example runner to support __BASE_PATH__ and serve the full vtk-js repo | module.exports = function buildConfig(name, relPath, destPath, root) {
return `
var loaders = require('../config/webpack.loaders.js');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var webpack = require('webpack');
module.exports = {
plugins: [
new HtmlWebpackPlugin({
inject: 'body',
}),
... | module.exports = function buildConfig(name, relPath, destPath, root) {
return `
var loaders = require('../config/webpack.loaders.js');
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
plugins: [
new HtmlWebpackPlugin({
inject: 'body',
}),
],
entry: '${relPath}',
output... |
Disable detailed certifications tests until bug fix
Movies and TV certifications are randomly returned for each other
See #1 | package tmdb
import (
. "gopkg.in/check.v1"
)
func (s *TmdbSuite) TestGetCertificationsMovieList(c *C) {
movieResult, err := s.tmdb.GetCertificationsMovieList()
s.baseTest(&movieResult, err, c)
usMovieCerts := movieResult.Certifications["US"]
c.Assert(usMovieCerts, NotNil)
// usMovieCertsOpts := "NR|G|PG|PG-13|... | package tmdb
import (
. "gopkg.in/check.v1"
)
func (s *TmdbSuite) TestGetCertificationsMovieList(c *C) {
movieResult, err := s.tmdb.GetCertificationsMovieList()
s.baseTest(&movieResult, err, c)
usMovieCerts := movieResult.Certifications["US"]
usMovieCertsOpts := "NR|G|PG|PG-13|R|NC-17"
for _, movieCert := range... |
Use yaml.safe_dump rather than yaml.dump. No more "!!python/unicode". | # (c) 2012, Jeroen Hoekx <jeroen@hoekx.be>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.... | # (c) 2012, Jeroen Hoekx <jeroen@hoekx.be>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.... |
Fix bad indentation in a pyximport test
The indentation was inadvertently broken when expanding tabs in
e908c0b9262008014d0698732acb5de48dbbf950.
Fixes:
$ python pyximport/test/test_reload.py
File "pyximport/test/test_reload.py", line 23
assert hello.x == 1
^
IndentationError: unexpecte... | from __future__ import absolute_import, print_function
import time, os, sys
from . import test_pyximport
if 1:
from distutils import sysconfig
try:
sysconfig.set_python_build()
except AttributeError:
pass
import pyxbuild
print(pyxbuild.distutils.sysconfig == sysconfig)
def test(... | from __future__ import absolute_import, print_function
import time, os, sys
from . import test_pyximport
if 1:
from distutils import sysconfig
try:
sysconfig.set_python_build()
except AttributeError:
pass
import pyxbuild
print(pyxbuild.distutils.sysconfig == sysconfig)
def test(... |
Remove unused _hydrating bubbling behavior (-8 B) | /**
* Find the closest error boundary to a thrown error and call it
* @param {object} error The thrown value
* @param {import('../internal').VNode} vnode The vnode that threw
* the error that was caught (except for unmounting when this parameter
* is the highest parent that was being unmounted)
*/
export function... | /**
* Find the closest error boundary to a thrown error and call it
* @param {object} error The thrown value
* @param {import('../internal').VNode} vnode The vnode that threw
* the error that was caught (except for unmounting when this parameter
* is the highest parent that was being unmounted)
*/
export function... |
Add check for invalid connection | // client start file
const Display = require('./interface.js');
const network = require('./network.js');
let dis = new Display();
// TODO: placeholder nick
let nick = "Kneelawk";
// TODO: placeholder server
let server = "http://localhost:8080";
let session;
network.login(server, nick).on('login', (body) => {
if (... | // client start file
const Display = require('./interface.js');
const network = require('./network.js');
let dis = new Display();
// TODO: placeholder nick
let nick = "Kneelawk";
// TODO: placeholder server
let server = "http://localhost:8080";
let session;
network.login(server, nick).on('login', (body) => {
sess... |
Make scrollbar size inversely relative to chat size. | package mnm.mods.tabbychat.gui;
import mnm.mods.tabbychat.core.GuiNewChatTC;
import mnm.mods.util.gui.GuiComponent;
import net.minecraft.client.gui.Gui;
public class Scrollbar extends GuiComponent {
private ChatArea chat;
public Scrollbar(ChatArea chat) {
this.chat = chat;
}
@Override
p... | package mnm.mods.tabbychat.gui;
import mnm.mods.tabbychat.core.GuiNewChatTC;
import mnm.mods.util.gui.GuiComponent;
import net.minecraft.client.gui.Gui;
public class Scrollbar extends GuiComponent {
private ChatArea chat;
public Scrollbar(ChatArea chat) {
this.chat = chat;
}
@Override
p... |
Return fail message if parking space do not exist | <?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();
if (empty($parking)) {
return R... | <?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);... |
Add non-promise based handling for notifications
Fix #8 | 'use strict'
exports.authorize = function () {
try {
return Notification.requestPermission()
.then(function (permission) {
if (permission === 'denied')
return
else if (permission === 'default')
return
// Do something with the granted permission, if needed.
... | 'use strict'
exports.authorize = function () {
return Notification.requestPermission()
.then(function (permission) {
if (permission === 'denied')
return
else if (permission === 'default')
return
// Do something with the granted permission, if needed.
})
}
exports.show = fun... |
ESLint: Allow async functions in tests | module.exports = {
parserOptions: {
'ecmaVersion': 2017,
},
env: {
'embertest': true
},
extends: [
'eslint:recommended',
'plugin:ember-suave/recommended'
],
globals: {
'$': true,
'addOfflineUsersForElectron': true,
'attachCustomForm': true,
'authenticateUser': true,
... | module.exports = {
env: {
'embertest': true
},
extends: [
'eslint:recommended',
'plugin:ember-suave/recommended'
],
globals: {
'$': true,
'addOfflineUsersForElectron': true,
'attachCustomForm': true,
'authenticateUser': true,
'checkCustomFormIsDisplayed': true,
'checkCust... |
Raise exception in case of config load error |
import os
import json
class JSONConfigLoader():
def __init__(self, base_path):
self.sources = [
os.path.dirname(os.getcwd()),
os.path.dirname(os.path.abspath(base_path)),
os.path.expanduser('~'),
'/etc',
]
def load(self, filename):
tries... |
import os
import json
class JSONConfigLoader():
def __init__(self):
self.sources = [
os.path.dirname(os.getcwd()),
os.path.dirname(os.path.abspath(__file__)),
os.path.expanduser('~'),
'/etc',
]
def load(self, filename):
for source in sel... |
Use uuid.hex instead of reinventing it. | # -*- coding: utf-8 -*-
# OpenFisca -- A versatile microsimulation software
# By: OpenFisca Team <contact@openfisca.fr>
#
# Copyright (C) 2011, 2012, 2013, 2014 OpenFisca Team
# https://github.com/openfisca
#
# This file is part of OpenFisca.
#
# OpenFisca is free software; you can redistribute it and/or modify
# it ... | # -*- coding: utf-8 -*-
# OpenFisca -- A versatile microsimulation software
# By: OpenFisca Team <contact@openfisca.fr>
#
# Copyright (C) 2011, 2012, 2013, 2014 OpenFisca Team
# https://github.com/openfisca
#
# This file is part of OpenFisca.
#
# OpenFisca is free software; you can redistribute it and/or modify
# it ... |
Update Oslo imports to remove namespace package
Change-Id: I4ec9b2a310471e4e07867073e9577731ac34027d
Blueprint: drop-namespace-packages | # Copyright 2014 IBM Corp.
#
# 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, s... | # Copyright 2014 IBM Corp.
#
# 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, s... |
Add HGTDIR to store hgt files inside a directory | import os
import json
import numpy as np
SAMPLES = 1201 # For SRTM3, use 3601 for SRTM1
HGTDIR = 'hgt' # All 'hgt' files will be kept here uncompressed
def get_elevation(lat, lon):
file = get_file_name(lat, lon)
if file:
return read_elevation_from_file(file, lat, lon)
# Treat it as data void as in... | import os
import json
import numpy as np
SAMPLES = 1201 # For SRTM3, use 3601 for SRTM1
def get_elevation(lat, lon):
file = get_file_name(lat, lon)
if file:
return read_elevation_from_file(file, lat, lon)
# Treat it as data void as in SRTM documentation
return -32768
def read_elevation_from... |
Fix unecessary call to automatic delivery of badges when this is a booking which is not checked-in | 'use strict';
var _ = require('lodash');
function saveApplication (args, callback) {
var seneca = this;
var ENTITY_NS = 'cd/applications';
var applicationsEntity = seneca.make$(ENTITY_NS);
var application = args.application;
delete application.emailSubject;
if (_.isEmpty(application)) return callback(nul... | 'use strict';
var _ = require('lodash');
function saveApplication (args, callback) {
var seneca = this;
var ENTITY_NS = 'cd/applications';
var applicationsEntity = seneca.make$(ENTITY_NS);
var application = args.application;
delete application.emailSubject;
if (_.isEmpty(application)) return callback(nul... |
Make the internal MatcherType of the BlockType MatcherType a constant | package org.monospark.spongematchers.type;
import java.util.Map;
import org.monospark.spongematchers.matcher.SpongeMatcher;
import org.monospark.spongematchers.matcher.sponge.BlockTypeMatcher;
import org.monospark.spongematchers.parser.SpongeMatcherParseException;
import org.monospark.spongematchers.parser.element.St... | package org.monospark.spongematchers.type;
import java.util.Map;
import org.monospark.spongematchers.matcher.SpongeMatcher;
import org.monospark.spongematchers.matcher.sponge.BlockTypeMatcher;
import org.monospark.spongematchers.parser.SpongeMatcherParseException;
import org.monospark.spongematchers.parser.element.St... |
Improve text suffix for days | module.exports = function(date) {
if(date === undefined) {
throw new Error('No date provided');
}
if((date instanceof Date) === false) {
throw new Error('Provided date is not an instance of a Date');
}
var now = new Date();
var result = "";
if(now.getFullYear() > date.getFullYear()) {
result = checkIsSin... | module.exports = function(date) {
if(date === undefined) {
throw new Error('No date provided');
}
if((date instanceof Date) === false) {
throw new Error('Provided date is not an instance of a Date');
}
var now = new Date();
var result = "";
if(now.getFullYear() > date.getFullYear()) {
result = checkIsSin... |
Allow null values in model collection. | <?php
/**
* Created by PhpStorm.
* User: daedeloth
* Date: 30/11/14
* Time: 18:49
*/
namespace Neuron\Collections;
use Neuron\Interfaces\Model;
/**
* Class TokenizedCollection
*
* @package Neuron\Collections
*/
class ModelCollection
extends Collection {
private $map = array ();
public function __constru... | <?php
/**
* Created by PhpStorm.
* User: daedeloth
* Date: 30/11/14
* Time: 18:49
*/
namespace Neuron\Collections;
use Neuron\Interfaces\Model;
/**
* Class TokenizedCollection
*
* @package Neuron\Collections
*/
class ModelCollection
extends Collection {
private $map = array ();
public function __constru... |
Use getParent() allows for some easier mocking | <?php
namespace BeBat\PolyTree\Relations;
use BeBat\PolyTree\Contracts\Node;
use BeBat\PolyTree\Exceptions\Cycle as CycleException;
class HasChildren extends Direct
{
public function __construct(Node $node)
{
$foreignKey = $node->getParentKeyName();
$otherKey = $node->getChildKeyName();
... | <?php
namespace BeBat\PolyTree\Relations;
use BeBat\PolyTree\Contracts\Node;
use BeBat\PolyTree\Exceptions\Cycle as CycleException;
class HasChildren extends Direct
{
public function __construct(Node $node)
{
$foreignKey = $node->getParentKeyName();
$otherKey = $node->getChildKeyName();
... |
Store a timeout value on the TaskWrapper, defaulting to no timeout.
Signed-off-by: Chris Lamb <711c73f64afdce07b7e38039a96d2224209e9a6c@thread.com> | from .job import Job
from .utils import get_backend
from . import app_settings
class task(object):
def __init__(self, queue='default', timeout=None):
self.queue = queue
self.timeout = timeout
app_settings.WORKERS.setdefault(self.queue, 1)
def __call__(self, fn):
return TaskWr... | from .job import Job
from .utils import get_backend
from . import app_settings
class task(object):
def __init__(self, queue='default'):
self.queue = queue
app_settings.WORKERS.setdefault(self.queue, 1)
def __call__(self, fn):
return TaskWrapper(fn, self.queue)
class TaskWrapper(obje... |
Use index name matching the current naming schema | """Added end_date to full text index events
Revision ID: 573faf4ac644
Revises: 342fa3076650
Create Date: 2015-03-06 17:26:54.718493
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = '573faf4ac644'
down_revision = '342fa3076650'
def upgrade():
op.alter_colum... | """Added end_date to full text index events
Revision ID: 573faf4ac644
Revises: 342fa3076650
Create Date: 2015-03-06 17:26:54.718493
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = '573faf4ac644'
down_revision = '342fa3076650'
def upgrade():
op.alter_colum... |
Fix a typo in the valid message | from pyisemail.diagnosis import BaseDiagnosis
class ValidDiagnosis(BaseDiagnosis):
"""A diagnosis indicating the address is valid for use.
"""
DESCRIPTION = "Address is valid."
MESSAGE = ("Address is valid. Please note that this does not mean "
"the address actually exists, nor even... | from pyisemail.diagnosis import BaseDiagnosis
class ValidDiagnosis(BaseDiagnosis):
"""A diagnosis indicating the address is valid for use.
"""
DESCRIPTION = "Address is valid."
MESSAGE = ("Address is valid. Please note that this does not mean "
"the address actually exists, nor even... |
Add check to ensure that we're in the same OS thread | import guv
guv.monkey_patch()
from guv import gyield, patcher
import threading
import greenlet
threading_orig = patcher.original('threading')
greenlet_ids = {}
def check_thread():
current = threading_orig.current_thread()
assert type(current) is threading_orig._MainThread
def debug(i):
print('{} gre... | import guv
guv.monkey_patch()
from guv import gyield, sleep
import threading
import greenlet
greenlet_ids = {}
def debug(i):
print('{} greenlet_ids: {}'.format(i, greenlet_ids))
def f():
greenlet_ids[1] = greenlet.getcurrent()
debug(2)
print('t: 1')
gyield()
print('t: 2')
gyield()
... |
Add functionality for filling in checkboxes | // ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***************************... | // ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***************************... |
Remove Google+ from Social Sharing Bundle (2)
Signed-off-by: Marius Blüm <38edb439dbcce85f0f597d90d338db16e5438073@lineone.io> | <?php
/**
* @copyright Copyright (c) 2017 Lukas Reschke <lukas@statuscode.ch>
*
* @author Lukas Reschke <lukas@statuscode.ch>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public Licens... | <?php
/**
* @copyright Copyright (c) 2017 Lukas Reschke <lukas@statuscode.ch>
*
* @author Lukas Reschke <lukas@statuscode.ch>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public Licens... |
Add Injection into __all__ list of top level package | """Dependency injector."""
from .catalog import AbstractCatalog
from .catalog import override
from .providers import Provider
from .providers import Delegate
from .providers import Factory
from .providers import Singleton
from .providers import ExternalDependency
from .providers import Class
from .providers import Ob... | """Dependency injector."""
from .catalog import AbstractCatalog
from .catalog import override
from .providers import Provider
from .providers import Delegate
from .providers import Factory
from .providers import Singleton
from .providers import ExternalDependency
from .providers import Class
from .providers import Ob... |
Replace host for testing by ->getHost() | <?php
namespace SLLH\HybridAuthBundle\Security\Http\Logout;
use Symfony\Component\Security\Http\Logout\LogoutHandlerInterface,
Symfony\Component\Security\Core\Authentication\Token\TokenInterface,
Symfony\Component\HttpFoundation\Response,
Symfony\Component\HttpFoundation\Request,
Symfony\Component\Htt... | <?php
namespace SLLH\HybridAuthBundle\Security\Http\Logout;
use Symfony\Component\Security\Http\Logout\LogoutHandlerInterface,
Symfony\Component\Security\Core\Authentication\Token\TokenInterface,
Symfony\Component\HttpFoundation\Response,
Symfony\Component\HttpFoundation\Request,
Symfony\Component\Htt... |
Fix Nodemon + Yarn integration problem | 'use strict';
const process = require('process');
const { promisify } = require('util');
const { watch, series, parallel } = require('gulp');
const FILES = require('../files');
// Returns a watch task
// E.g. with `tasks` `{ FORMAT: format }`, the `format` task will be fired
// everytime `FILES.FORMAT` is changed.
... | 'use strict';
const process = require('process');
const { promisify } = require('util');
const { watch, series, parallel } = require('gulp');
const FILES = require('../files');
// Returns a watch task
// E.g. with `tasks` `{ FORMAT: format }`, the `format` task will be fired
// everytime `FILES.FORMAT` is changed.
... |
Use inotify backend (auto detect) | <?php
namespace Kwf\FileWatcher;
use Kwf\FileWatcher\Backend as Backend;
class Watcher
{
/**
* Creates instance of best watcher backend for your system.
*/
public static function create($paths)
{
$backends = array(
new Backend\Inotifywait($paths),
new Backend\Watch... | <?php
namespace Kwf\FileWatcher;
use Kwf\FileWatcher\Backend as Backend;
class Watcher
{
/**
* Creates instance of best watcher backend for your system.
*/
public static function create($paths)
{
$backends = array(
new Backend\Inotifywait($paths),
new Backend\Watch... |
Set previous action after executing | """
St. George Game
main.py
Sage Berg, Skyler Berg
Created: 5 Dec 2014
"""
import places
from character import Character
from display import Display
from actions import AskAboutAssassins, BuyADrink, LeaveInAHuff, SingASong
def main():
display = Display()
display.enable()
character = Character()
chara... | """
St. George Game
main.py
Sage Berg, Skyler Berg
Created: 5 Dec 2014
"""
import places
from character import Character
from display import Display
from actions import AskAboutAssassins, BuyADrink, LeaveInAHuff, SingASong
def main():
display = Display()
display.enable()
character = Character()
chara... |
Check if memcache persistent connection not established before adding server to pool | <?php
class f_MemcachedProvider
{
private $memcachedInstance = null;
public function __construct($config)
{
$this->memcachedInstance = new Memcached('memcachedConnection');
// Check if memcached instance has no servers in it's pool yet (see http://www.php.net/manual/en/memcached.construct.php#93536)
if (!co... | <?php
class f_MemcachedProvider
{
private $memcachedInstance = null;
public function __construct($config)
{
$this->memcachedInstance = new Memcached('memcachedConnection');
if ($this->memcachedInstance->addServer($config["server"]["host"], $config["server"]["port"]) === false)
{
Framework::error("Memca... |
Fix wrong class in 'super()' call
Oops | class CommandException(Exception):
"""
This custom exception can be thrown by commands when something goes wrong during execution.
The parameter is a message sent to the source that called the command (a channel or a user)
"""
def __init__(self, displayMessage=None, shouldLogError=True):
"""
Create a new Comm... | class CommandException(Exception):
"""
This custom exception can be thrown by commands when something goes wrong during execution.
The parameter is a message sent to the source that called the command (a channel or a user)
"""
def __init__(self, displayMessage=None, shouldLogError=True):
"""
Create a new Comm... |
Allow error chance of 0 | /**
* Randomly generate a boolean based on an input probability.
* @private
* @param {Number} chance Value between 0 and 1 representing 0% and 100%
* probabilities of a true value, respectively
* @return {Boolean} Random value
*/
var pass = function (chance) {
return Math.random() < chance;
};
/**
* Generate... | /**
* Randomly generate a boolean based on an input probability.
* @private
* @param {Number} chance Value between 0 and 1 representing 0% and 100%
* probabilities of a true value, respectively
* @return {Boolean} Random value
*/
var pass = function (chance) {
return Math.random() < chance;
};
/**
* Generate... |
Fix validation of "hidden" checkbox not working | <?php
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Flarum\Tags;
use Flarum\Core\Validator\AbstractValidator;
class TagValidator extends ... | <?php
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Flarum\Tags;
use Flarum\Core\Validator\AbstractValidator;
class TagValidator extends ... |
Fix gas total is empty in fee details | import React from "react"
import ReactTooltip from "react-tooltip";
import { calculateGasFee } from "../../utils/converter";
const FeeDetail = (props) => {
const totalGas = props.totalGas ? props.totalGas : +calculateGasFee(props.gasPrice, props.gas);
return (
<div className="gas-configed theme__text-4">
... | import React from "react"
import ReactTooltip from "react-tooltip";
const FeeDetail = (props) => {
return (
<div className="gas-configed theme__text-4">
<div className={"title-fee theme__text-5"}>
{props.translate("transaction.transaction_fee") || 'Max Transaction Fee'}
<span className="com... |
Send and Connect frame tests | import unittest
from Decode import Decoder
import Frames
class TestDecoder(unittest.TestCase):
"""
"""
def setUp(self):
self.decoder = Decoder()
def test_decoder_get_frame_class(self):
command = 'SEND'
self.assertEquals(self.decoder.get_frame_class(command), Frames.SEND)
d... | import unittest
from Decode import Decoder
import Frames
class TestDecoder(unittest.TestCase):
def setUp(self):
self.decoder = Decoder()
def test_decoder_get_frame_class(self):
command = 'SEND'
self.assertEquals(self.decoder.get_frame_class(command), Frames.SEND)
def test_decoder_... |
Add partial and close server responses | var Hapi = require('hapi');
var server = Hapi.createServer('localhost', 8000);
server.route({
method: 'GET',
path: '/partial',
handler: function(request, reply) {
console.log(new Date(), 'partial');
request.raw.res.writeHead(200);
request.raw.res.socket.end();
reply.close();
}
});
server.rout... | var Hapi = require('hapi');
var server = Hapi.createServer('localhost', 8000);
server.route({
method: 'GET',
path: '/hang',
handler: function(request, reply) {
console.log(new Date(), 'hang');
if (request.query.duration) {
setTimeout(function() {
reply(new Hapi.response.Empty());
},... |
Fix fallback locale and fixtures | <?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Component\Translation\Provider;
/**
* @author Paweł Jędrzejewski <pawel@sylius.org>... | <?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Component\Translation\Provider;
/**
* @author Paweł Jędrzejewski <pawel@sylius.org>... |
Routes: Store a common reference to the DEBT app | module.exports = function( web ) {
var app = web.get( "debt" );
web.get( "/", function( request, response ) {
if ( app.state === "database-setup" ) {
return app.install(function( error ) {
if ( error ) {
return response.send( 500 );
}
app.state = "user-setup";
return response.redirect( "/install" ... | module.exports = function( web ) {
web.get( "/", function( request, response ) {
var app = web.get( "debt" );
if ( app.state === "database-setup" ) {
return app.install(function( error ) {
if ( error ) {
return response.send( 500 );
}
app.state = "user-setup";
return response.redirect( "/install"... |
Camel-file-watch: Use FileHash because HashCode has been removed | /*
* 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 ... |
Change to import gravity constant from constants file.
git-svn-id: acf0ef94bfce630b1a882387fc03ab8593ec6522@23 150532fb-1d5b-0410-a8ab-efec50f980d4 | #!/usr/bin/python
import numpy as N
def u_star(u,v,w):
'''
Compute the friction velocity, u_star, from the timeseries of the velocity \
components u, v, and w (an nD array)
'''
from metpy.bl.turb.fluxes import rs as R
rs = R(u,v,w)
uw = rs[3]
vw = rs[4]
us = N.power(N.power(uw,2)+N.power(v... | #!/usr/bin/python
import numpy as N
def u_star(u,v,w):
'''
Compute the friction velocity, u_star, from the timeseries of the velocity \
components u, v, and w (an nD array)
'''
from metpy.bl.turb.fluxes import rs as R
rs = R(u,v,w)
uw = rs[3]
vw = rs[4]
us = N.power(N.power(uw,2)+N.power(v... |
Correct for internal adjustment to block resistance in getter. | package org.pfaa.block;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
public abstract class CompositeBlock extends Block implements CompositeBlockAccessors {
public Composite... | package org.pfaa.block;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
public abstract class CompositeBlock extends Block implements CompositeBlockAccessors {
public Composite... |
Improve http request error reporting and metadata | var Bluebird = require('bluebird');
module.exports = issueRequest;
function issueRequest (request) {
return Bluebird.resolve(request)
.catch(normalizeResponseError)
.then(function (res) {
// Api compatibility
res.statusCode = res.status;
return res;
}... | var Bluebird = require('bluebird');
module.exports = issueRequest;
function issueRequest (request) {
return Bluebird.resolve(request)
.catch(function (err) {
throw new Error('Error communicating with the webtask cluster: '
+ err.message);
})
.then(function (re... |
Implement demo 'exercises' api method. | # Copyright 2016 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | # Copyright 2016 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
Check to see if the calendar type parameter is actually an existing class before adding it to the calendar factory. | <?php
namespace Plummer\Calendarful\Calendar;
class CalendarFactory implements CalendarFactoryInterface
{
private $calendarTypes = [];
public function addCalendarType($type, $calendarType)
{
if(is_string($calendarType) and !class_exists($calendarType)) {
throw new \InvalidArgumentException("Class {$calendarT... | <?php
namespace Plummer\Calendarful\Calendar;
class CalendarFactory implements CalendarFactoryInterface
{
private $calendarTypes = [];
public function addCalendarType($type, $calendarType)
{
if(!in_array('Plummer\Calendarful\Calendar\CalendarInterface', class_implements($calendarType))) {
throw new \InvalidA... |
Correct root resource link to real order_book route | package horizon
import (
"net/http"
"github.com/jagregory/halgo"
"github.com/stellar/go-horizon/render/hal"
)
// RootResource is the initial map of links into the api.
type RootResource struct {
halgo.Links
}
var globalRootResource = RootResource{
Links: halgo.Links{}.
Self("/").
Link("account", "/accounts... | package horizon
import (
"net/http"
"github.com/jagregory/halgo"
"github.com/stellar/go-horizon/render/hal"
)
// RootResource is the initial map of links into the api.
type RootResource struct {
halgo.Links
}
var globalRootResource = RootResource{
Links: halgo.Links{}.
Self("/").
Link("account", "/accounts... |
Update to use signals as use_for_related_fields does not work for all cases | # -*- coding: utf-8 -*-
import logging
import uuid
from django.db.models.signals import post_save, post_delete
from .model_cache_sharing.types import ModelCacheInfo
from .model_cache_sharing import model_cache_backend
"""
Signal receivers for django model post_save and post_delete. Used to evict a model cache when
a... | # -*- coding: utf-8 -*-
import logging
import uuid
from django.db.models.signals import post_save, post_delete
from .backends.sharing.types import ModelCacheInfo
from .backends.sharing import sharing_backend
from .cache_manager import CacheManager
"""
Signal receivers for django model post_save and post_delete. Used... |
Update to the loading dependencies...load the core rendering before the text rendering. | /* globals Demo, console, require */
Demo = {
input: {},
components: {},
renderer: {}
};
Demo.loader = (function() {
'use strict';
function loadScripts(sources, onComplete, message) {
require(sources, function() {
console.log(message);
onComplete();
});
}
function inputsComplete() {
loadScripts(... | /* globals Demo, console, require */
Demo = {
input: {},
components: {},
renderer: {}
};
Demo.loader = (function() {
'use strict';
function loadScripts(sources, onComplete, message) {
require(sources, function() {
onComplete(message);
});
}
function inputsComplete() {
loadScripts(['Components/Text'... |
Fix up following rebase, use array of strings rather than its own func | export default function(type) {
let url = null;
switch (type) {
case 'dc':
url = ['/v1/catalog/datacenters'];
break;
case 'service':
url = ['/v1/internal/ui/services', '/v1/health/service/'];
break;
case 'node':
url = ['/v1/internal/ui/nodes'];
break;
case 'kv':
... | export default function(type) {
let url = null;
switch (type) {
case 'dc':
url = ['/v1/catalog/datacenters'];
break;
case 'service':
url = ['/v1/internal/ui/services', '/v1/health/service/'];
break;
case 'node':
url = ['/v1/internal/ui/nodes'];
break;
case 'kv':
... |
Switch from hashHistory to browserHistory | import 'babel-polyfill';
import React from 'react';
import moment from 'moment';
import { render } from 'react-dom';
import { browserHistory } from 'react-router';
import { AppContainer } from 'react-hot-loader';
import { syncHistoryWithStore } from 'react-router-redux';
import configureStore from 'app/utils/configureS... | import 'babel-polyfill';
import React from 'react';
import moment from 'moment';
import { render } from 'react-dom';
import { hashHistory } from 'react-router';
import { AppContainer } from 'react-hot-loader';
import { syncHistoryWithStore } from 'react-router-redux';
import configureStore from 'app/utils/configureStor... |
Remove unnecessary ENT_HTML5 constant, which broke PHP 5.3 compatibility | <?php
namespace ColinODell\CommonMark\Util;
class UrlEncoder
{
protected static $dontEncode = array(
'%21' => '!',
'%23' => '#',
'%24' => '$',
'%26' => '&',
'%27' => '\'',
'%28' => '(',
'%29' => ')',
'%2A' => '*',
'%2B' => '+',
'%2C' ... | <?php
namespace ColinODell\CommonMark\Util;
class UrlEncoder
{
protected static $dontEncode = array(
'%21' => '!',
'%23' => '#',
'%24' => '$',
'%26' => '&',
'%27' => '\'',
'%28' => '(',
'%29' => ')',
'%2A' => '*',
'%2B' => '+',
'%2C' ... |
Allow any logged-in user to perform image searches. | from django.conf.urls import patterns, url
from django.views.generic import TemplateView
from core.auth import perm
import search.views
urlpatterns = patterns('',
url(r'^document/$', perm('any', search.views.DocumentSearchTemplate), name='search'),
url(r'^document/query/$',perm('any', search.views.Docum... | from django.conf.urls import patterns, url
from django.views.generic import TemplateView
from core.auth import perm
import search.views
urlpatterns = patterns('',
url(r'^document/$', perm('any', search.views.DocumentSearchTemplate), name='search'),
url(r'^document/query/$',perm('any', search.views.Docum... |
Fix minor bug with parsing JSON for play mode | var WORK = 0, PLAY = 1;
function createSession(start, end, tag) {
var session = new Object();
session.start = start;
session.end = end;
session.tag = tag;
return session;
}
Pebble.addEventListener('ready', function() {
console.log('PebbleKit JS Ready!');
});
Pebble.addEventListener('appmessage', function(e) {
... | var WORK = 0, PLAY = 1;
function createSession(start, end, tag) {
var session = new Object();
session.start = start;
session.end = end;
session.tag = tag;
return session;
}
Pebble.addEventListener('ready', function() {
console.log('PebbleKit JS Ready!');
});
Pebble.addEventListener('appmessage', function(e) {
... |
Refactor Chip8 to use a Memory instance. |
class Memory(object):
def __init__(self):
self._stream = [0x00] * 4096
def __len__(self):
return len(self._stream)
def read_byte(self, address):
return self._stream[address]
def write_byte(self, address, data):
self._stream[address] = data
def load(self, address... |
class Memory(object):
def __init__(self):
self._stream = [0x00] * 4096
def __len__(self):
return len(self._stream)
def read_byte(self, address):
return self._stream[address]
def write_byte(self, address, data):
self._stream[address] = data
def load(self, address... |
Update the maximum allowed length for file name in sanitizer test | from tempfile import TemporaryDirectory
from expects import expect
from hypothesis import given, assume, example
from hypothesis.strategies import text, characters
from mamba import description, it
from pathlib import Path
from crowd_anki.utils.filesystem.name_sanitizer import sanitize_anki_deck_name, \
invalid_f... | from tempfile import TemporaryDirectory
from expects import expect
from hypothesis import given, assume, example
from hypothesis.strategies import text, characters
from mamba import description, it
from pathlib import Path
from crowd_anki.utils.filesystem.name_sanitizer import sanitize_anki_deck_name, \
invalid_f... |
Update for to be for range.
It pleases the linter.
Signed-off-by: Stu Pollock <f92a33a5576f99e8c458f20aa3ed76c650ba4a5c@pivotal.io> | package main
import (
"fmt"
"os"
"strings"
"time"
)
func Usage() {
fmt.Fprintf(os.Stderr, "Usage: %s [STOP|START] [STOPFILE]\n", os.Args[0])
os.Exit(1)
}
func main() {
if len(os.Args) != 3 {
Usage()
}
mode := strings.ToLower(os.Args[1])
filename := os.Args[2]
switch mode {
case "start":
if _, err := ... | package main
import (
"fmt"
"os"
"strings"
"time"
)
func Usage() {
fmt.Fprintf(os.Stderr, "Usage: %s [STOP|START] [STOPFILE]\n", os.Args[0])
os.Exit(1)
}
func main() {
if len(os.Args) != 3 {
Usage()
}
mode := strings.ToLower(os.Args[1])
filename := os.Args[2]
switch mode {
case "start":
if _, err := ... |
Remove use of check_output (not in Py2.6) | from __future__ import absolute_import
import os.path
import pytest
import subprocess
from django.conf import settings
from raven.versioning import fetch_git_sha, fetch_package_version
from raven.utils import six
def has_git_requirements():
return os.path.exists(os.path.join(settings.PROJECT_ROOT, '.git', 'ref... | from __future__ import absolute_import
import os.path
import pytest
import subprocess
from django.conf import settings
from raven.versioning import fetch_git_sha, fetch_package_version
from raven.utils import six
def has_git_requirements():
return os.path.exists(os.path.join(settings.PROJECT_ROOT, '.git', 'ref... |
Fix AMD and CommonJS were mixed up | /**
* Disproperty: Disposable properties.
* Copyright (c) 2015 Vladislav Zarakovsky
* MIT license https://github.com/vlazar/disproperty/blob/master/LICENSE
*/
(function(root) {
function disproperty(obj, prop, value) {
return Object.defineProperty(obj, prop, {
configurable: true,
get: function() ... | /**
* Disproperty: Disposable properties.
* Copyright (c) 2015 Vladislav Zarakovsky
* MIT license https://github.com/vlazar/disproperty/blob/master/LICENSE
*/
(function(root) {
function disproperty(obj, prop, value) {
return Object.defineProperty(obj, prop, {
configurable: true,
get: function() ... |
Fix mistaken usage of require(reify/lib/runtime).enable.
Related fix in meteor-babel@0.24.4:
https://github.com/meteor/babel/commit/786194734c693aef91dc1ee3b9e7166d8c54fff6 | "use strict";
// Install ES2015-complaint polyfills for Object, Array, String, Function,
// Symbol, Map, Set, and Promise, patching the native implementations when
// they are available.
require("./install-promise.js");
const Module = module.constructor;
const Mp = Module.prototype;
// Enable the module.{watch,expor... | // Install ES2015-complaint polyfills for Object, Array, String, Function,
// Symbol, Map, Set, and Promise, patching the native implementations when
// they are available.
require("./install-promise.js");
// Enable the module.{watch,export,...} runtime API needed by Reify.
require("reify/lib/runtime").enable(module.c... |
Change url from relative to internal service endpoint | import json
from datetime import datetime
import requests
from .model.puzzleboard import pop_puzzleboard
class HuntwordsPuzzleBoardPopCommand(object):
'''Command class that processes puzzleboard-pop message'''
def run(self, jreq):
'''Command that processes puzzleboard-pop message'''
req = ... | import json
from datetime import datetime
import requests
from .model.puzzleboard import pop_puzzleboard
class HuntwordsPuzzleBoardPopCommand(object):
'''Command class that processes puzzleboard-pop message'''
def run(self, jreq):
'''Command that processes puzzleboard-pop message'''
req = ... |
Increase to 25 agents for iOS performance test. | angular.module('MyModule')
.controller('circlecontroller', function ($scope, $timeout, KineticService, UtilityService, AgentService) {
'use strict';
var stage = {};
function init() {
$scope.pageName = "CIRCLES";
stage = KineticService.createStage('container', 1024, 768);
... | angular.module('MyModule')
.controller('circlecontroller', function ($scope, $timeout, KineticService, UtilityService, AgentService) {
'use strict';
var stage = {};
function init() {
$scope.pageName = "CIRCLES";
stage = KineticService.createStage('container', 1024, 768);
... |
Change the wrong license headers | /*
* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.... | /*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/li... |
Make logged actions collapsed by default
This makes it lot easier to follow in the console what actions are fired. | import { compose, createStore, applyMiddleware } from 'redux';
import { apiMiddleware } from 'redux-api-middleware';
import rootReducer from 'reducers/index';
const isDevelopment = process.env.NODE_ENV !== 'production';
let finalCreateStore;
const storeEnhancers = [applyMiddleware(apiMiddleware)];
if (isDevelopment)... | import { compose, createStore, applyMiddleware } from 'redux';
import { apiMiddleware } from 'redux-api-middleware';
import rootReducer from 'reducers/index';
const isDevelopment = process.env.NODE_ENV !== 'production';
let finalCreateStore;
const storeEnhancers = [applyMiddleware(apiMiddleware)];
if (isDevelopment)... |
Add a little under-the-hood tests. | import {
assertThat, equalTo,
containsString, throws, returns,
} from 'hamjest';
describe('The core function, `assertThat()`', () => {
it('is a function', () => {
const typeOfAssertThat = typeof assertThat;
assertThat(typeOfAssertThat, equalTo('function'));
});
describe('requires at least two params'... | import { assertThat, equalTo, containsString } from 'hamjest';
describe('The core function, `assertThat()`', () => {
it('is a function', () => {
const typeOfAssertThat = typeof assertThat;
assertThat(typeOfAssertThat, equalTo('function'));
});
describe('requires at least two params', () => {
it('1st:... |
Add function calls and check for a night success function. | /*
* For reducing boilerplate on examine listeners.
*
* config object:
*
* poi : An array or object with points of interest.
* It can be an array of strings or an object with strings as the keys and
* functions as the values.
*
* action: Needed if poi is an array of strings,
* It is the functi... | /*
* For reducing boilerplate on examine listeners.
*
* config object:
*
* poi : An array or object with points of interest.
* It can be an array of strings or an object with strings as the keys and
* functions as the values.
*
* action: Needed if poi is an array of strings,
* It is the function ... |
Duplicate pages before other components
Is needed when components rely on pages (e.g. editableItems-Model) | <?php
class Kwc_Root_Category_Admin extends Kwc_Abstract_Admin
{
public function getDuplicateProgressSteps($source)
{
$ret = parent::getDuplicateProgressSteps($source);
//pages are not duplicated because they are not returned by 'inherit'=>false
//so duplicate them here
$s = arra... | <?php
class Kwc_Root_Category_Admin extends Kwc_Abstract_Admin
{
public function getDuplicateProgressSteps($source)
{
$ret = parent::getDuplicateProgressSteps($source);
//pages are not duplicated because they are not returned by 'inherit'=>false
//so duplicate them here
$s = arra... |
Fix thread reducer -> history | import initialState from './initialState';
import {
THREAD_LOADED,
THREAD_REQUESTED,
THREAD_DESTROYED
} from '../constants'
export default function (state = initialState.thread, action) {
switch (action.type) {
case THREAD_REQUESTED:
return Object.assign({}, state, {
... | import initialState from './initialState';
import {
THREAD_LOADED,
THREAD_REQUESTED,
THREAD_DESTROYED
} from '../constants'
export default function (state = initialState.thread, action) {
switch (action.type) {
case THREAD_REQUESTED:
return Object.assign({}, state, {
... |
Update array store to match. | <?php namespace Illuminate\Session;
use Illuminate\Cookie\CookieJar;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class ArrayStore extends CacheDrivenStore {
/**
* Load the session for the request.
*
* @param Illuminate\CookieJar $cookies
* @para... | <?php namespace Illuminate\Session;
use Illuminate\Cookie\CookieJar;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class ArrayStore extends CacheDrivenStore {
/**
* Load the session for the request.
*
* @param Illuminate\CookieJar $cookies
* @para... |
Set relations for workouts table | <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateWorkoutsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('workouts', fun... | <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateWorkoutsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('workouts', fun... |
Remove sticky menu for widths <500px
Used the built-in `min-width` setting from jQuery.pin. Chose 500px for breakpoint because that's where the menu style changes in CSS. | $(function() {
var share = new Share("#share-button-top", {
networks: {
facebook: {
app_id: "1604147083144211",
}
}
});
// This is still buggy and just a band-aid
$(window).on('resize', function(){
$('.navbar').attr('style', '').removeData('pin');
$('.navbar').pin({
mi... | $(function() {
var share = new Share("#share-button-top", {
networks: {
facebook: {
app_id: "1604147083144211",
}
}
});
var winWidth = $(window).width();
var stickyHeader = function () {
winWidth = $(window).width();
if (winWidth >= 768) {
$('.navbar').attr('style',... |
Add generic type to ArrayList | package fr.masciulli.drinks.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;
import fr.masciulli.drinks.R;
import ... | package fr.masciulli.drinks.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;
import fr.masciulli.drinks.R;
import ... |
Include `<` and `>` into BNF attributes | /*
Language: Backus–Naur Form
Author: Oleg Efimov <efimovov@gmail.com>
*/
function(hljs){
return {
contains: [
// Attribute
{
className: 'attribute',
begin: /</, end: />/
},
// Specific
{
begin: /::=/,
starts: {
end: /$/,
contai... | /*
Language: Backus–Naur Form
Author: Oleg Efimov <efimovov@gmail.com>
*/
function(hljs){
return {
contains: [
// Attribute
{
className: 'attribute',
begin: /</,
end: />/,
excludeBegin: true,
excludeEnd: true
},
// Specific
{
begin:... |
Make data.labels and data.series optional | import React from 'react';
import Chartist from 'chartist';
export default class Chart extends React.Component {
componentDidMount() {
this.updateChart(this.props);
}
componentWillReceiveProps(newProps) {
this.updateChart(newProps);
}
componentWillUnmount() {
this.chartist.detach();
}
rend... | import React from 'react';
import Chartist from 'chartist';
export default class Chart extends React.Component {
componentDidMount() {
this.updateChart(this.props);
}
componentWillReceiveProps(newProps) {
this.updateChart(newProps);
}
componentWillUnmount() {
this.chartist.detach();
}
rend... |
Add basic type equality checking to sum type | package org.hummingbirdlang.types.composite;
import org.hummingbirdlang.types.CompositeType;
import org.hummingbirdlang.types.Property;
import org.hummingbirdlang.types.PropertyNotFoundException;
import org.hummingbirdlang.types.Type;
/**
* Disjoint union type (aka. sum type): it is composed of members A and B.
* E... | package org.hummingbirdlang.types.composite;
import org.hummingbirdlang.types.CompositeType;
import org.hummingbirdlang.types.Property;
import org.hummingbirdlang.types.PropertyNotFoundException;
import org.hummingbirdlang.types.Type;
/**
* Disjoint union type (aka. sum type): it is composed of members A and B.
* E... |
Mark all notifications with the same subject as read | <?php
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Flarum\Core\Notifications\Commands;
use Flarum\Core\Notifications\Notification;
use Fla... | <?php
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Flarum\Core\Notifications\Commands;
use Flarum\Core\Notifications\Notification;
use Fla... |
Move call to parent constructor to top | <?php
namespace app;
class MyPhixApp extends \Phix\App
{
public function __construct($config = null)
{
parent::__construct($config);
$this
->viewsDir(__DIR__ . '/views')
->layout('layout')
->reg('site_title', 'My Application')
->get('/', functio... | <?php
namespace app;
class MyPhixApp extends \Phix\App
{
public function __construct($config = null)
{
$this
->viewsDir(__DIR__ . '/views')
->layout('layout')
->reg('site_title', 'My Application')
->get('/', function($app) {
$app->render(... |
Remove unnecessary override of getById
git-svn-id: 4b387fe5ada7764508e2ca96c335714e4c1692c6@1275 0d517254-b314-0410-acde-c619094fa49f | package edu.northwestern.bioinformatics.studycalendar.dao;
import org.springframework.transaction.annotation.Transactional;
import edu.northwestern.bioinformatics.studycalendar.domain.Study;
import edu.northwestern.bioinformatics.studycalendar.domain.StudyParticipantAssignment;
import java.util.List;
/**
* @author ... | package edu.northwestern.bioinformatics.studycalendar.dao;
import org.springframework.transaction.annotation.Transactional;
import edu.northwestern.bioinformatics.studycalendar.domain.Study;
import edu.northwestern.bioinformatics.studycalendar.domain.StudyParticipantAssignment;
import java.util.List;
/**
* @author ... |
Call onSelect event when a game is clicked. | import React from 'react';
import '../styles/games.css';
export default class GameList extends React.Component {
constructor(props) {
super(props);
this.state = {games: []};
}
componentWillReceiveProps(nextProps) {
let games = [];
nextProps.games.forEach(game => {
... | import React from 'react';
import '../styles/games.css';
export default class GameList extends React.Component {
constructor(props) {
super(props);
this.state = {games: []};
}
componentWillReceiveProps(nextProps) {
let games = [];
nextProps.games.forEach(game => {
... |
Simplify config helpers, add overwriteConfig option | 'use strict';
var fs = require('fs'),
_ = require('lodash');
//rsvp = require('rsvp');
var _save,
saveConfig,
overwriteConfig,
loadConfig,
deleteConfigKey;
_save = function(config, fileLocation) {
// TODO: convert _save to a promise
fs.writeFileSync(fileLocation, JSON.stringify(config, nu... | 'use strict';
var fs = require('fs'),
path = require('path'),
_ = require('lodash');
//rsvp = require('rsvp');
var _save,
saveConfig,
loadConfig,
deleteConfigKey;
_save = function(config, filePath, fileName) {
// TODO: convert _save to a promise
var fileName = path.join(filePath, fileName... |
Fix updating nodes: Use new $http API. | 'use strict';
angular.module('ffffng')
.controller('UpdateNodeCtrl', function ($scope, Navigator, NodeService, config) {
$scope.config = config;
$scope.node = undefined;
$scope.token = undefined;
$scope.saved = false;
$scope.hasData = function () {
return $scope.node !== undefined;
};
... | 'use strict';
angular.module('ffffng')
.controller('UpdateNodeCtrl', function ($scope, Navigator, NodeService, config) {
$scope.config = config;
$scope.node = undefined;
$scope.token = undefined;
$scope.saved = false;
$scope.hasData = function () {
return $scope.node !== undefined;
};
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.