text stringlengths 17 1.47k | positive stringlengths 673 4.43k | negative stringlengths 677 2.81k |
|---|---|---|
Add freezegun requirement for tests. | # import multiprocessing to avoid this bug (http://bugs.python.org/issue15881#msg170215)
import multiprocessing
assert multiprocessing
import re
from setuptools import setup, find_packages
def get_version():
"""
Extracts the version number from the version.py file.
"""
VERSION_FILE = 'entity_emailer/v... | # import multiprocessing to avoid this bug (http://bugs.python.org/issue15881#msg170215)
import multiprocessing
assert multiprocessing
import re
from setuptools import setup, find_packages
def get_version():
"""
Extracts the version number from the version.py file.
"""
VERSION_FILE = 'entity_emailer/v... |
Add support for stopBit encoded small decimal. | package net.openhft.chronicle.bytes;
import net.openhft.chronicle.core.Maths;
import org.junit.Test;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.util.Random;
import static junit.framework.TestCase.assertEquals;
public class StopBitDecimalTest {
@Test
pub... | package net.openhft.chronicle.bytes;
import net.openhft.chronicle.core.Maths;
import org.junit.Test;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.nio.ByteBuffer;
import java.util.Random;
import static junit.framework.TestCase.assertEquals;
public class StopBitDecimalTest {
@Test
pub... |
Use shorter timestamps for log messages | <?php
class CbLogger
{
const PRIORITY_DEBUG = 1;
const PRIORITY_INFO = 2;
const PRIORITY_WARN = 3;
const PRIORITY_ERROR = 4;
const PRIORITY_DEFAULT = 99;
protected static $priorities = array(
self::PRIORITY_DEBUG => 'DEBUG',
self::PRIORITY_INFO => 'INFO',
self::P... | <?php
class CbLogger
{
const PRIORITY_DEBUG = 1;
const PRIORITY_INFO = 2;
const PRIORITY_WARN = 3;
const PRIORITY_ERROR = 4;
const PRIORITY_DEFAULT = 99;
protected static $priorities = array(
self::PRIORITY_DEBUG => 'DEBUG',
self::PRIORITY_INFO => 'INFO',
self::P... |
Fix broken NSG create command (duplicate --name parameter) | # pylint: disable=no-self-use,too-many-arguments
from azure.mgmt.network.models import Subnet, SecurityRule
from ._factory import _network_client_factory
def create_update_subnet(resource_group_name, subnet_name, virtual_network_name, address_prefix):
'''Create or update a virtual network (VNet) subnet'''
subn... | # pylint: disable=no-self-use,too-many-arguments
from azure.mgmt.network.models import Subnet, SecurityRule
from ._factory import _network_client_factory
def create_update_subnet(resource_group_name, subnet_name, virtual_network_name, address_prefix):
'''Create or update a virtual network (VNet) subnet'''
subn... |
Fix api call: pagesize is now limit | 'use strict';
var RecentLocationsDirective = function (apiService, assetPath, configuration) {
return {
restrict: 'A',
scope: {
region: '=',
pageSize: '='
},
templateUrl: assetPath + 'partials/_recent_locations.html',
link: function (scope, elem, attr... | 'use strict';
var RecentLocationsDirective = function (apiService, assetPath, configuration) {
return {
restrict: 'A',
scope: {
region: '=',
pageSize: '='
},
templateUrl: assetPath + 'partials/_recent_locations.html',
link: function (scope, elem, attr... |
Add end-to-end integration testing for all compression types | import pytest
from kafka import KafkaConsumer, KafkaProducer
from test.conftest import version
from test.testutil import random_string
@pytest.mark.skipif(not version(), reason="No KAFKA_VERSION set")
@pytest.mark.parametrize("compression", [None, 'gzip', 'snappy', 'lz4'])
def test_end_to_end(kafka_broker, compressi... | import pytest
from kafka import KafkaConsumer, KafkaProducer
from test.conftest import version
from test.testutil import random_string
@pytest.mark.skipif(not version(), reason="No KAFKA_VERSION set")
def test_end_to_end(kafka_broker):
connect_str = 'localhost:' + str(kafka_broker.port)
producer = KafkaProdu... |
Add version number to parameter meta data | from xml.dom.minidom import getDOMImplementation
import codecs
class XMLOutput():
def __init__(self, groups):
impl = getDOMImplementation()
xml_document = impl.createDocument(None, "parameters", None)
xml_parameters = xml_document.documentElement
xml_version = xml_document.createEle... | from xml.dom.minidom import getDOMImplementation
import codecs
class XMLOutput():
def __init__(self, groups):
impl = getDOMImplementation()
xml_document = impl.createDocument(None, "parameters", None)
xml_parameters = xml_document.documentElement
for group in groups:
xml... |
Revert "Progressing dots to show test is running"
Breaks tests; https://travis-ci.org/wikimedia/pywikibot-core/builds/26752150
This reverts commit 93379dbf499c58438917728b74862f282c15dba4.
Change-Id: Iacb4cc9e6999d265b46c558ed3999c1198f87de0 | # -*- coding: utf-8 -*-
#
# (C) Pywikibot team, 2014
#
# Distributed under the terms of the MIT license.
#
__version__ = '$Id$'
from tests.utils import unittest
from pywikibot import date
class TestDate(unittest.TestCase):
"""Test cases for date library"""
def testMapEntry(self):
"""Test the validi... | # -*- coding: utf-8 -*-
#
# (C) Pywikibot team, 2014
#
# Distributed under the terms of the MIT license.
#
__version__ = '$Id$'
from tests.utils import unittest
from pywikibot import date
class TestDate(unittest.TestCase):
"""Test cases for date library"""
def __init__(self, formatname):
super(Test... |
Fix error - rm test dir command is not executed in correct branch. | #!/usr/bin/env python3
from passwd_change import passwd_change, shadow_change, mails_delete
from unittest import TestCase, TestLoader, TextTestRunner
import os
import subprocess
class PasswdChange_Test(TestCase):
def setUp(self):
"""
Preconditions
"""
subprocess.call(['mkdir', 't... | #!/usr/bin/env python3
from passwd_change import passwd_change, shadow_change, mails_delete
from unittest import TestCase, TestLoader, TextTestRunner
import os
import subprocess
class PasswdChange_Test(TestCase):
def setUp(self):
"""
Preconditions
"""
subprocess.call(['mkdir', 't... |
Update the default application name | /*global angular: true, appInsights: true */
(function () {
"use strict";
angular.module('angular-appinsights', [])
.provider('insights', function () {
var _appId,
_appName;
this.start = function (appId, appName) {
_appId = appId;
... | /*global angular: true, appInsights: true */
(function () {
"use strict";
angular.module('angular-appinsights', [])
.provider('insights', function () {
var _appId,
_appName;
this.start = function (appId, appName) {
_appId = appId;
... |
Undo change that makes client-side issue. Will need another way to get sub-items | package net.machinemuse.numina.recipe;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import java.util.HashMap;
import java.util.Map;
/**
* Author: MachineMuse (Claire Semple)
* Created: 5:06 PM, 11/4/13
*/
public class ItemNameMappings {
private static ... | package net.machinemuse.numina.recipe;
import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Author: MachineMuse (C... |
Disable every single test that uses clustering. | package com.codingchili.core.protocol;
import io.vertx.core.Vertx;
import io.vertx.core.VertxOptions;
import io.vertx.ext.unit.Async;
import io.vertx.ext.unit.TestContext;
import io.vertx.ext.unit.junit.VertxUnitRunner;
import org.junit.After;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.Run... | package com.codingchili.core.protocol;
import io.vertx.core.Vertx;
import io.vertx.core.VertxOptions;
import io.vertx.ext.unit.Async;
import io.vertx.ext.unit.TestContext;
import io.vertx.ext.unit.junit.VertxUnitRunner;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import static com.... |
Add help message comment to env command | <?php
namespace PhpBrew\Command;
use PhpBrew\Config;
use PhpBrew\Utils;
class EnvCommand extends \CLIFramework\Command
{
public function brief()
{
return 'Export environment variables';
}
public function execute($buildName = NULL)
{
// get current version
if (!$buildName) ... | <?php
namespace PhpBrew\Command;
use PhpBrew\Config;
use PhpBrew\Utils;
class EnvCommand extends \CLIFramework\Command
{
public function brief()
{
return 'Export environment variables';
}
public function execute($buildName = NULL)
{
// get current version
if (!$buildName) ... |
Switch to Request filled() method
Behaviour of Request has() method changed in Laravel 5.5. filled() now
has the old behaviour.
https://laravel.com/docs/5.5/requests#retrieving-input | <?php
namespace RadDB\Http\Requests;
use Illuminate\Http\Request;
use Illuminate\Foundation\Http\FormRequest;
class StoreRecommendationRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
... | <?php
namespace RadDB\Http\Requests;
use Illuminate\Http\Request;
use Illuminate\Foundation\Http\FormRequest;
class StoreRecommendationRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
... |
Add simple test for config builder
Signed-off-by: Michal Kuffa <005ee1c97edba97d164343c993afee612ac25a0c@gmail.com> | import io
import os
from textwrap import dedent
from pg_bawler import bawlerd
class TestBawlerdConfig:
def test_build_config_location_list(self):
assert not bawlerd.conf.build_config_location_list(locations=())
user_conf = os.path.join(
os.path.expanduser('~'),
bawlerd.c... | import io
import os
from textwrap import dedent
from pg_bawler import bawlerd
class TestBawlerdConfig:
def test_build_config_location_list(self):
assert not bawlerd.conf.build_config_location_list(locations=())
user_conf = os.path.join(
os.path.expanduser('~'),
bawlerd.c... |
Store the Etherpad API key as a secret.
Currently, the Etherpad API key were public, with the rationale the
installation is a public one, everybody can anonymously or with a name
make edits, destroy pads, create new pads, etc.
Nasqueron is interested to get the potential to integrate other applications
with Etherpad,... | <?php
require '../_includes/SecurityData.php';
/**
* Gets the pads
*
* @return Array the pads list
*/
function get_pads () {
$key = SecurityData::getSecret('etherpad.api.key');
$url = "http://pad.wolfplex.be/api/1.2.1/listAllPads?apikey=" . $key;
$api_reply = jso... | <?php
/**
* Gets the pads
*
* @return Array the pads list
*/
function get_pads () {
//TODO: move API key in config
$url = "http://pad.wolfplex.be/api/1.2.1/listAllPads?apikey=U67yKTUDzz19fEHyrAuNN4zUnKxbOJZu";
$api_reply = json_decode(file_get_contents($url));
... |
Drop support for wordpress forum | <?php
if (!defined('ABSPATH')) {
exit('restricted access');
}
?>
<h3
><span><?php _e('Need Help ?', 'woo-poly-integration'); ?></span>
</h3>
<div class="inside">
<p>
<?php
_e('Need help , Want to ask for new feature ?
please contact using one of the following methods', 'woo-... | <?php
if (!defined('ABSPATH')) {
exit('restricted access');
}
?>
<h3
><span><?php _e('Need Help ?', 'woo-poly-integration'); ?></span>
</h3>
<div class="inside">
<p>
<?php
_e('Need help , Want to ask for new feature ?
please contact using one of the following methods', 'woo-... |
Fix lint issues with Login component | import React from 'react';
export default class Login extends React.Component {
static get displayName() {
return 'Login';
}
render() {
return (
<form>
<div
className="form-group"
>
<label
... | import React from 'react';
export default class Login extends React.Component {
render() {
return (
<form>
<div className="form-group">
<label htmlFor="username">{'Name'}</label>
<input
className="form-control"
... |
[client] Fix error: notifications didn't show | // npm packages
import React, {PropTypes} from 'react';
import {connect} from 'react-redux';
import {push} from 'react-router-redux';
// our components
import {Navbar} from '../../components';
import Footer from '../../components/footer';
const mapStateToProps = state => ({
actualPath: state.routing.locationBeforeT... | // npm packages
import React, {PropTypes} from 'react';
import {connect} from 'react-redux';
import {push} from 'react-router-redux';
// our components
import {Navbar} from '../../components';
const mapStateToProps = state => ({
actualPath: state.routing.locationBeforeTransitions && state.routing.locationBeforeTran... |
CRM-442: Add imap related fields to User view and edit pages
- remove not needed id field | <?php
namespace Oro\Bundle\ImapBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
class ConfigurationType extends AbstractType
{
const NAME = 'oro_imap_configuration';
/**
* {@inheri... | <?php
namespace Oro\Bundle\ImapBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
class ConfigurationType extends AbstractType
{
const NAME = 'oro_imap_configuration';
/**
* {@inheri... |
Include brand name when finding product | <?
include '../scat.php';
$term= $_REQUEST['term'];
$products= array();
if (!$term) {
die_jsonp([ 'error' => "Need to supply some search terms.",
'results' => [] ]);
}
$products= Model::factory('Product')
->select("product.*")
->select("department.name", "department_name")
... | <?
include '../scat.php';
$term= $_REQUEST['term'];
$products= array();
if (!$term) {
die_jsonp([ 'error' => "Need to supply some search terms.",
'results' => [] ]);
}
$products= Model::factory('Product')
->select("product.*")
->select("department.name", "department_name")
... |
Create new object with default mutator | import { loop, isLoop, getEffect, getModel } from './loop';
import { batch, none } from './effects';
function optimizeBatch(effects) {
switch(effects.length) {
case 0:
return none();
case 1:
return effects[0];
default:
return batch(effects);
}
}
const defaultAccessor = (state, key) =... | import { loop, isLoop, getEffect, getModel } from './loop';
import { batch, none } from './effects';
function optimizeBatch(effects) {
switch(effects.length) {
case 0:
return none();
case 1:
return effects[0];
default:
return batch(effects);
}
}
const defaultAccessor = (state, key) =... |
Fix inline phone number form | # from wtforms import Form
from flask.ext.babel import gettext as _
from flask.ext.wtf import Form
from wtforms import SubmitField, RadioField, StringField
from wtforms.ext.sqlalchemy.orm import model_form
from wtforms.validators import AnyOf, Required
from .constants import PHONE_NUMBER_TYPE
from .models import Phone... | # from wtforms import Form
from flask.ext.babel import gettext as _
from flask.ext.wtf import Form
from wtforms import SubmitField, RadioField, StringField
from wtforms.ext.sqlalchemy.orm import model_form
from wtforms.validators import AnyOf, Required
from .constants import PHONE_NUMBER_TYPE
from .models import Phone... |
Add version check for importing django.contrib.postgres.fields.ArrayField | from __future__ import unicode_literals
from django import VERSION
from django.db import migrations, models
if VERSION >= (1, 8):
from django.contrib.postgres.fields import ArrayField
chapters_field = ArrayField(base_field=models.CharField(max_length=100), default=list, size=None)
else:
chapters_field = mo... | # -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-06-09 10:26
from __future__ import unicode_literals
import django.contrib.postgres.fields
from django.db import migrations, models
class PostgresOnlyCreateModel(migrations.CreateModel):
def database_forwards(self, app_label, schema_editor, from_state, t... |
Modify CSS Exclusions to CSS Shapes, since we split up the specification. Update references. | /*!
{
"name": "CSS Shapes",
"property": "shapes",
"tags": ["css"],
"notes": [{
"name": "CSS Shapes W3C specification",
"href": "http://www.w3.org/TR/css-shapes"
},{
"name": "Examples from Adobe",
"href": "http://html.adobe.com/webplatform/layout/shapes"
}, {
"name": "Samples showcasing u... | /*!
{
"name": "CSS Shapes",
"property": "shapes",
"tags": ["css"],
"notes": [{
"name": "CSS Shapes W3C specification",
"href": "http://www.w3.org/TR/css-shapes"
},{
"name": "Examples from Adobe",
"href": "http://html.adobe.com/webplatform/layout/shapes"
}, {
"name": "Samples showcasing u... |
Add trailing slash to forward and reverse url resolutions | # coding: utf-8
from django.utils.module_loading import import_string
def _load(module):
return import_string(module) if isinstance(module, str) else module
class view():
def __init__(self, model, view, slug_field):
self.model = _load(model)
self.view = _load(view)
self.slug_field = ... | # coding: utf-8
from django.utils.module_loading import import_string
def _load(module):
return import_string(module) if isinstance(module, str) else module
class view():
def __init__(self, model, view, slug_field):
self.model = _load(model)
self.view = _load(view)
self.slug_field = ... |
Load docopt lazily (so that setup.py works) | """Dispatch from command-line arguments to functions."""
import re
from collections import OrderedDict
__all__ = ('dispatch', 'DispatchError')
__author__ = 'Vladimir Keleshev <vladimir@keleshev.com>'
__version__ = '0.0.0'
__license__ = 'MIT'
__keywords__ = 'docopt dispatch function adapter kwargs'
__url__ = 'https://... | """Dispatch from command-line arguments to functions."""
import re
from collections import OrderedDict
from docopt import docopt
__all__ = ('dispatch', 'DispatchError')
__author__ = 'Vladimir Keleshev <vladimir@keleshev.com>'
__version__ = '0.0.0'
__license__ = 'MIT'
__keywords__ = 'docopt dispatch function adapter ... |
Add shutdown callback support to Action | from bot.api.api import Api
from bot.multithreading.scheduler import SchedulerApi
from bot.storage import Config, State, Cache
class Action:
def __init__(self):
pass
def get_name(self):
return self.__class__.__name__
def setup(self, api: Api, config: Config, state: State, cache: Cache, s... | from bot.api.api import Api
from bot.multithreading.scheduler import SchedulerApi
from bot.storage import Config, State, Cache
class Action:
def __init__(self):
pass
def get_name(self):
return self.__class__.__name__
def setup(self, api: Api, config: Config, state: State, cache: Cache, s... |
Update the docs on twimport and imwiki to indicate that imwiki is deprecated. | """
TiddlyWebWiki-specific twanager commands
"""
from tiddlyweb.store import Store
from tiddlyweb.manage import make_command, usage
from tiddlywebwiki.tiddlywiki import import_wiki_file
from tiddlywebwiki.importer import import_list
def init(config):
@make_command()
def update(args):
"""Update all ... | """
TiddlyWebWiki-specific twanager commands
"""
from tiddlyweb.store import Store
from tiddlyweb.manage import make_command, usage
from tiddlywebwiki.tiddlywiki import import_wiki_file
from tiddlywebwiki.importer import import_list
def init(config):
@make_command()
def update(args):
"""Update all ... |
Use token and not data | //////////////////////////////////////
// User buys one ticket for himself //
//////////////////////////////////////
'use strict';
var Promise = require('bluebird');
module.exports = function (db, config) {
var logger = require('../../lib/log')(config);
var rest = require('../../lib/rest'... | //////////////////////////////////////
// User buys one ticket for himself //
//////////////////////////////////////
'use strict';
var Promise = require('bluebird');
module.exports = function (db, config) {
var logger = require('../../lib/log')(config);
var rest = require('../../lib/rest'... |
Use grunt.util.spawn to execute the grunt task. This makes sure grunt configuration set via grunt.option is properly read again | var grunt = require('grunt');
var makeOptions = function (options) {
var baseOptions = {
base: null,
prefix: 'grunt-',
verbose: false
};
if (options) {
for (var key in options) {
if (options.hasOwnProperty(key)) {
baseOptions[key] = options[key]... | var grunt = require('grunt');
var makeOptions = function (options) {
var baseOptions = {
base: null,
prefix: 'grunt-',
verbose: false
};
if (options) {
for (var key in options) {
if (options.hasOwnProperty(key)) {
baseOptions[key] = options[key]... |
Fix new user command password hashing | <?php
namespace Suitcoda\Console\Commands;
use Illuminate\Console\Command;
class NewUserCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'user:new-superuser {username} {name} {email} {password}';
/**
* The c... | <?php
namespace Suitcoda\Console\Commands;
use Illuminate\Console\Command;
class NewUserCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'user:new-superuser {username} {name} {email} {password}';
/**
* The c... |
Remove expected file override in test | package com.box.l10n.mojito.cli.command;
import com.box.l10n.mojito.cli.CLITestBase;
import org.junit.Test;
public class SimpleFileEditorCommandTest extends CLITestBase {
@Test
public void jsonIndent() {
getL10nJCommander().run("simple-file-editor",
"-i", getInputResourcesTestDir().ge... | package com.box.l10n.mojito.cli.command;
import com.box.l10n.mojito.cli.CLITestBase;
import org.junit.Test;
public class SimpleFileEditorCommandTest extends CLITestBase {
@Test
public void jsonIndent() {
getL10nJCommander().run("simple-file-editor",
"-i", getInputResourcesTestDir().ge... |
Fix link headers on the example | 'use strict';
const url = require('url');
module.exports = (fragmentName, fragmentUrl) => (request, response) => {
const pathname = url.parse(request.url).pathname;
switch (pathname) {
case '/fragment.js':
// serve fragment's JavaScript
response.writeHead(200, {'Content-Type': '... | 'use strict';
const url = require('url');
module.exports = (fragmentName, fragmentUrl) => (request, response) => {
const pathname = url.parse(request.url).pathname;
switch (pathname) {
case '/fragment.js':
// serve fragment's JavaScript
response.writeHead(200, {'Content-Type': '... |
Fix gemm calls in Softmax | from .affine import Affine
from ... import describe
from ...describe import Dimension, Synapses, Biases
from ...check import has_shape
from ... import check
@describe.attributes(
W=Synapses("Weights matrix",
lambda obj: (obj.nO, obj.nI),
lambda W, ops: None)
)
class Softmax(Affine):
name = 'so... | from .affine import Affine
from ... import describe
from ...describe import Dimension, Synapses, Biases
from ...check import has_shape
from ... import check
@describe.attributes(
W=Synapses("Weights matrix",
lambda obj: (obj.nO, obj.nI),
lambda W, ops: None)
)
class Softmax(Affine):
name = 'so... |
Add logic to install for all installers | <?php
namespace BudgeIt\ComposerBuilder;
use Composer\Composer;
use Composer\IO\IOInterface;
use Composer\Package\PackageInterface;
class Runner
{
/**
* @var Composer
*/
private $composer;
/**
* @var IOInterface
*/
private $io;
/**
* @var InstallerInterface[]
*/
... | <?php
namespace BudgeIt\ComposerBuilder;
use Composer\Composer;
use Composer\IO\IOInterface;
use Composer\Package\PackageInterface;
class Runner
{
/**
* @var Composer
*/
private $composer;
/**
* @var IOInterface
*/
private $io;
/**
* @var InstallerInterface[]
*/
... |
Remove tagName and class from PillChoiceView | // qgr-cntrl-pills
define(function (require) {
var $ = require('jquery');
var _ = require('underscore');
var Backbone = require('backbone');
var Handlebars = require('handlebars');
var pills_tmpl = require('text!tmpl/pills.html');
var PillChoice = Backbone.Model.extend({
// Has attr choice_val
i... | // qgr-cntrl-pills
define(function (require) {
var $ = require('jquery');
var _ = require('underscore');
var Backbone = require('backbone');
var Handlebars = require('handlebars');
var pills_tmpl = require('text!tmpl/pills.html');
var PillChoice = Backbone.Model.extend({
// Has attr choice_val
i... |
Rewrite Navigation bar as a stateless function | import React from 'react';
import { Link } from 'react-router';
import { Nav, Navbar, NavItem } from 'react-bootstrap';
import { LinkContainer } from 'react-router-bootstrap';
const MENU_ITEMS = [
{ link: '/home', title: 'Home' },
{ link: '/current', title: 'Current' },
{ link: '/recent', title: 'Recent' ... | import React from 'react';
import { Link } from 'react-router';
import { Nav, Navbar, NavItem } from 'react-bootstrap';
import { LinkContainer } from 'react-router-bootstrap';
const NAV_LINKS = {
home: { link: '/home', title: 'Home' },
current: { link: '/current', title: 'Current' },
recent: { link: '/rec... |
Modules(rooms): Remove unique constraint on configurations subdocuments | 'use strict';
/**
* Module dependencies
*/
var mongoose = require('mongoose'),
Schema = mongoose.Schema;
/**
* Room Schema
*/
var RoomSchema = new Schema({
code: {
type: String,
required: 'Please fill in the code of the room.',
trim: true,
unique: true
},
name: {
type: String,
trim... | 'use strict';
/**
* Module dependencies
*/
var mongoose = require('mongoose'),
Schema = mongoose.Schema;
/**
* Room Schema
*/
var RoomSchema = new Schema({
code: {
type: String,
required: 'Please fill in the code of the room.',
trim: true,
unique: true
},
name: {
type: String,
trim... |
Fix typo in package description | import os
import shutil
from setuptools import setup, find_packages, Command
import oscrypto
class CleanCommand(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
folder = os.path.dirname(os.path.abspath(__file__... | import os
import shutil
from setuptools import setup, find_packages, Command
import oscrypto
class CleanCommand(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
folder = os.path.dirname(os.path.abspath(__file__... |
Enable deleting the search query from the box to clear it | /**
*
* SearchInput
*
*/
import React from 'react';
import FontAwesome from 'react-fontawesome';
import { Button, Form, FormGroup, FormControl } from 'react-bootstrap';
import { withClientState } from '../../components/Apollo/LocalStateDecorator'
class SearchInput extends React.Component { // eslint-disable-line rea... | /**
*
* SearchInput
*
*/
import React from 'react';
import FontAwesome from 'react-fontawesome';
import { Button, Form, FormGroup, FormControl } from 'react-bootstrap';
import { withClientState } from '../../components/Apollo/LocalStateDecorator'
class SearchInput extends React.Component { // eslint-disable-line rea... |
Fix for some error messages that were split into several messages
The exception handler expects the error to be a list on line 33. In my
case they were a string, which lead to the split of the string into
multiple errors containing one character | from django.utils import encoding
from django.utils.translation import ugettext_lazy as _
from rest_framework import status
from rest_framework.exceptions import APIException
from rest_framework.views import exception_handler as drf_exception_handler
from rest_framework_json_api.utils import format_value
def excepti... | from django.utils import encoding
from django.utils.translation import ugettext_lazy as _
from rest_framework import status
from rest_framework.exceptions import APIException
from rest_framework.views import exception_handler as drf_exception_handler
from rest_framework_json_api.utils import format_value
def excepti... |
Make $notification available in routeNotificationForFcm | <?php
namespace Benwilkins\FCM;
use GuzzleHttp\Client;
use Illuminate\Notifications\Notification;
/**
* Class FcmChannel.
*/
class FcmChannel
{
/**
* @const The API URL for Firebase
*/
const API_URI = 'https://fcm.googleapis.com/fcm/send';
/**
* @var Client
*/
private $client;
... | <?php
namespace Benwilkins\FCM;
use GuzzleHttp\Client;
use Illuminate\Notifications\Notification;
/**
* Class FcmChannel.
*/
class FcmChannel
{
/**
* @const The API URL for Firebase
*/
const API_URI = 'https://fcm.googleapis.com/fcm/send';
/**
* @var Client
*/
private $client;
... |
Use BUILD_STATE_SCHEDULED and BUILD_STATE_RUNNING enums | import React from 'react';
import Relay from 'react-relay';
import Navigation from './layout/Navigation';
import Footer from './layout/Footer';
class Main extends React.Component {
static propTypes = {
children: React.PropTypes.node.isRequired,
viewer: React.PropTypes.object.isRequired,
organization: Re... | import React from 'react';
import Relay from 'react-relay';
import Navigation from './layout/Navigation';
import Footer from './layout/Footer';
class Main extends React.Component {
static propTypes = {
children: React.PropTypes.node.isRequired,
viewer: React.PropTypes.object.isRequired,
organization: Re... |
Update dependency to work on conda
requests_oauthlib dependency name will only install from pip, requests-oauthlib works on both conda and pip | #!/usr/bin/env python
# encoding=utf-8
from __future__ import print_function
import os
import sys
from setuptools import setup
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.md')).read()
needs_pytest = set(['pytest', 'test', 'ptr']).intersection(sys.argv)
pytest_runner = ['... | #!/usr/bin/env python
# encoding=utf-8
from __future__ import print_function
import os
import sys
from setuptools import setup
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.md')).read()
needs_pytest = set(['pytest', 'test', 'ptr']).intersection(sys.argv)
pytest_runner = ['... |
Remove Q in the question number. | /**
* @module Question
* question text
**/
// CSS
import styles from './style.css';
import React, { PropTypes } from 'react';
import PureComponent from 'react-pure-render/component';
import I18Next from 'i18next';
import classNames from 'classnames';
class Question extends PureComponent {
render() {
... | /**
* @module Question
* question text
**/
// CSS
import styles from './style.css';
import React, { PropTypes } from 'react';
import PureComponent from 'react-pure-render/component';
import I18Next from 'i18next';
import classNames from 'classnames';
class Question extends PureComponent {
render() {
... |
Enable multi-element selectors for hideOtherLinks | /*global $ */
/*jslint
white: true,
vars: true,
indent: 2
*/
(function($) {
"use strict";
$.fn.hideOtherLinks = function() {
$(this).each(function(i, elm){
var $el = $(elm),
showHide = $('<span class="other-content" />'),
shownElements = [],
hiddenElements = [],
... | /*global $ */
/*jslint
white: true,
vars: true,
indent: 2
*/
(function($) {
"use strict";
$.fn.hideOtherLinks = function() {
var $el = $(this),
showHide = $('<span class="other-content" />'),
shownElements = [],
hiddenElements = [],
currentlyAppending = shownElements;
$($... |
Add cachetools to install reqs. | #!/usr/bin/env python
import os
try:
import setuptools
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup
NAME = 'chash'
VERSION = '0.1.0'
AUTHOR = 'Lev Givon'
AUTHOR_EMAIL = 'lev@columbia.edu'
URL = 'http... | #!/usr/bin/env python
import os
try:
import setuptools
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup
NAME = 'chash'
VERSION = '0.1.0'
AUTHOR = 'Lev Givon'
AUTHOR_EMAIL = 'lev@columbia.edu'
URL = 'http... |
Remove theme specific code from inlaylist template | <?php
global $post;
$items = get_field('items', $module->ID);
?>
<div class="grid">
<div class="grid-lg-12">
<div class="box box-panel">
<h4 class="box-title"><?php echo $module->post_title; ?></h4>
<ul>
<?php foreach ($items as $item) : ?>
... | <?php
global $post;
$items = get_field('items', $module->ID);
$class = '';
switch ($args['id']) {
case 'content-area':
$class = 'box-panel-secondary';
break;
default:
$class = 'box-panel-primary';
break;
}
?>
<div class="grid">
... |
Fix false positive user helper test | const expect = require('chai').expect;
const config = require('getconfig');
const UserHelper = require('../../app/util/user-helper');
describe('User Helper', () => {
const userHelper = new UserHelper(config.MC_SERVER_PATH);
describe('Details', () => {
it('should return expected values', () => {
const e... | const expect = require('chai').expect;
const config = require('getconfig');
const UserHelper = require('../../app/util/user-helper');
describe('User Helper', () => {
const userHelper = new UserHelper(config.MC_SERVER_PATH);
describe('Details', () => {
it('should return expected values', () => {
const e... |
Fix a tab reset issue in Menu | var Menu = {
refresh: function() {
var items = document.querySelectorAll('ul#menu_wrapper li, #post_widget ul.card li');
var i = 0;
while(i < items.length)
{
if(items[i].id != 'history') {
items[i].onclick = function(e) {
if(this.datas... | var Menu = {
refresh: function() {
var items = document.querySelectorAll('#menu_widget ul li, #post_widget ul.card li');
var i = 0;
while(i < items.length)
{
if(items[i].id != 'history') {
items[i].onclick = function(e) {
if(this.datas... |
Add ability to get calibre db | from django.core.exceptions import ObjectDoesNotExist
from django.core.management.base import NoArgsCommand
from django.conf import settings
from django_dropbox.storage import DropboxStorage
from dropbox.rest import ErrorResponse
from calibre_books.calibre.models import Book, Data
class Command(NoArgsCommand):
... | from django.core.exceptions import ObjectDoesNotExist
from django.core.management.base import NoArgsCommand
from django.conf import settings
from django_dropbox.storage import DropboxStorage
from dropbox.rest import ErrorResponse
from calibre_books.calibre.models import Book, Data
class Command(NoArgsCommand):
... |
Remove unused LOG in websocket
Change-Id: Ic45e5e4353dd816fd5416b880aa47df8542b2e02 | # Copyright 2017 Linaro Limited
#
# 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 2017 Linaro Limited
#
# 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 ... |
Fix to check match object for null and to set a recurring alarm. | function printError(e) {
chrome.alarms.clearAll();
webkitNotifications.createNotification('',
e, '').show();
}
function setCheckAlarm() {
chrome.alarms.create({'periodInMinutes': 1, 'delayInMinutes': 1});
}
function checkMail() {
var xhr = new XMLHttpRequest();
xhr.onreadystatecha... | function printError(e) {
chrome.alarms.clearAll();
webkitNotifications.createNotification('',
e, '').show();
}
function checkMail() {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState != 4) {
return;
}
if (xhr.response... |
Write new page parent select box bug fixed | $.jlm.component('WriteNew', 'wild_posts.wf_index, wild_posts.wf_edit, wild_pages.wf_index, wild_pages.wf_edit', function() {
$('#sidebar .add').click(function() {
var buttonEl = $(this);
var formAction = buttonEl.attr('href');
var templatePath = 'posts/new_post';
var pa... | $.jlm.component('WriteNew', 'wild_posts.wf_index, wild_posts.wf_edit, wild_pages.wf_index, wild_pages.wf_edit', function() {
$('#sidebar .add').click(function() {
var buttonEl = $(this);
var formAction = buttonEl.attr('href');
var templatePath = 'posts/new_post';
var pa... |
Use source maps in developer mode. | var path = require('path');
var CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
entry: [
'./js/index.js'
],
output: {
path: path.join(__dirname, 'dist'),
filename: 'app.js'
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
l... | var path = require('path');
var CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
entry: [
'./js/index.js'
],
output: {
path: path.join(__dirname, 'dist'),
filename: 'app.js'
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
l... |
Hide the links that aren't selectable yet so you can't tab to them | var Flickity = require('flickity');
(function(Flickity) {
"use strict";
if(document.querySelector('.rotate') !== null) {
new Flickity('.rotate', {
on: {
ready: function() {
// Get the height of the first image that loaded and dynamically set the height
... | var Flickity = require('flickity');
(function(Flickity) {
"use strict";
if(document.querySelector('.rotate') !== null) {
new Flickity('.rotate', {
on: {
ready: function() {
// Get the height of the first image that loaded and dynamically set the height
... |
Revert per user API rate limit
It was changed from per user to per application in ced3e50bca279f5a499a6d513fcdfd2a020c28ce | <?php
namespace App\Providers;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvide... | <?php
namespace App\Providers;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvide... |
Use defaultValue for section name as we're only taking it onBlur | require('./Section.css')
var React = require('react')
var Button = require('./Button')
var MarkdownArea = require('./MarkdownArea')
var IdeasStore = require('../store')
var Section = React.createClass({
handleBlur(e) {
var {name, value} = e.target
if (value !== this.props[name]) {
IdeasStore.editSect... | require('./Section.css')
var React = require('react')
var Button = require('./Button')
var MarkdownArea = require('./MarkdownArea')
var IdeasStore = require('../store')
var Section = React.createClass({
handleBlur(e) {
var {name, value} = e.target
if (value !== this.props[name]) {
IdeasStore.editSect... |
Add note about Windows icon format | '''
Notification
===========
The :class:`Notification` provides access to public methods to create
notifications.
Simple Examples
---------------
To send notification::
>>> from plyer import notification
>>> title = 'plyer'
>>> message = 'This is an example.'
>>> notification.notify(title=title, mes... | '''
Notification
===========
The :class:`Notification` provides access to public methods to create
notifications.
Simple Examples
---------------
To send notification::
>>> from plyer import notification
>>> title = 'plyer'
>>> message = 'This is an example.'
>>> notification.notify(title=title, mes... |
Make "every" the default aggregate option | define('app/models/rule', ['ember'],
//
// Rule Model
//
// @returns Class
///
function () {
'use strict';
return Ember.Object.extend({
//
//
// Properties
//
//
id: null,
unit: null,
... | define('app/models/rule', ['ember'],
//
// Rule Model
//
// @returns Class
///
function () {
'use strict';
return Ember.Object.extend({
//
//
// Properties
//
//
id: null,
unit: null,
... |
Fix 6547 php file instructions | <?php
header("Set-Cookie: issue6547=Hello Firebug user!; Max-Age=0");
?>
<!DOCTYPE html>
<html>
<head>
<title>Issue 6547: Show cookie Max-Age when attribute is <= 0</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link href="https://getfirebug.com/tests/head/... | <?php
header("Set-Cookie: issue6547=Hello Firebug user!; Max-Age=0");
?>
<!DOCTYPE html>
<html>
<head>
<title>Issue 6547: Show cookie Max-Age when attribute is <= 0</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<link href="https://getfirebug.com/tests/head/... |
Store colgroup in ui hash | define(['underscore', 'backbone.marionette', './LessonView'],
function(_, Marionette, LessonView) {
'use strict';
return Marionette.CollectionView.extend({
el: $('#timetable'),
childView: LessonView,
childViewOptions: function () {
return {
parentView: this,
timetable: this.coll... | define(['underscore', 'backbone.marionette', './LessonView'],
function(_, Marionette, LessonView) {
'use strict';
return Marionette.CollectionView.extend({
el: $('#timetable'),
childView: LessonView,
childViewOptions: function () {
return {
parentView: this,
timetable: this.coll... |
Return commonness instead of raw counts | from collections import defaultdict
import operator
import six
from semanticizest._util import ngrams_with_pos, tosequence
class Semanticizer(object):
def __init__(self, link_count, N=7):
commonness = defaultdict(list)
for (target, anchor), count in six.iteritems(link_count):
common... | from collections import defaultdict
import operator
import six
from semanticizest._util import ngrams_with_pos, tosequence
class Semanticizer(object):
def __init__(self, link_count, N=7):
commonness = defaultdict(list)
for (target, anchor), count in six.iteritems(link_count):
common... |
Fix typo inside of LANGUAGES_SUPPORTED. | # -*- encoding: utf-8 -*-
#
# In here we shall keep track of all variables and objects that should be
# instantiated only once and be common to pieces of GLBackend code.
__version__ = '2.24.16'
DATABASE_VERSION = 6
# Add here by hand the languages supported!
# copy paste format from 'grunt makeTranslations'
LANGUAGES... | # -*- encoding: utf-8 -*-
#
# In here we shall keep track of all variables and objects that should be
# instantiated only once and be common to pieces of GLBackend code.
__version__ = '2.24.16'
DATABASE_VERSION = 6
# Add here by hand the languages supported!
# copy paste format from 'grunt makeTranslations'
LANGUAGES... |
Use relative path instead of only filename | import pytest
import inspect
import os.path
def pytest_namespace():
def assume(expr, msg=''):
if not expr:
# get filename, line, and context
(filename, line, funcname, contextlist) = inspect.stack()[1][1:5]
filename = os.path.relpath(filename)
context = conte... | import pytest
import inspect
import os.path
def pytest_namespace():
def assume(expr, msg=''):
if not expr:
# get filename, line, and context
(filename, line, funcname, contextlist) = inspect.stack()[1][1:5]
filename = os.path.basename(filename)
context = cont... |
Update Date for 2017 Festival | $(function() {
var riverbendStart = moment('2016-06-10T17:00:00-04:00');
var riverbendEnd = moment('2016-06-18T23:30:00-04:00');
var futureEventStart = moment('2017-06-10T17:00:00-04:00');
function formatDateDiff(start, end, opts) {
opts = opts || {};
opts.long = opts.long || false;
... | $(function() {
var riverbendStart = moment('2016-06-10T17:00:00-04:00');
var riverbendEnd = moment('2016-06-18T23:30:00-04:00');
var futureEventStart = moment('2016-06-10T17:00:00-04:00');
function formatDateDiff(start, end, opts) {
opts = opts || {};
opts.long = opts.long || false;
... |
Fix hide model on clicking | import React, { Component } from 'react'
import { Modal } from '../../components'
import { Button } from 'react-bootstrap'
class TestModal extends Component {
constructor () {
super()
this.state = {
show: false
}
}
hideModal () {
this.setState({show: false})
}
showModal () {
this.... | import React, { Component } from 'react'
import { Modal } from '../../components'
import { Button } from 'react-bootstrap'
class TestModal extends Component {
constructor () {
super()
this.state = {
show: false
}
}
hideModal () {
console.info('test')
this.setState({show: false})
}
... |
Make Amazon keys non required | import os
from functools import partial
import boto3
from decouple import config
from serenata_toolbox import log
from serenata_toolbox.datasets.contextmanager import status_message
class RemoteDatasets:
def __init__(self):
self.client = None
self.credentials = {
'aws_access_key_id'... | import os
from functools import partial
import boto3
from decouple import config
from serenata_toolbox import log
from serenata_toolbox.datasets.contextmanager import status_message
class RemoteDatasets:
def __init__(self):
self.client = None
self.credentials = {
'aws_access_key_id'... |
Add a loader while loading repositories | import React, { Component, PropTypes } from 'react';
import Progress from 'material-ui/CircularProgress';
import { Table, TableBody, TableHeader, TableHeaderColumn, TableRow } from 'material-ui/Table';
import { getRepositories } from '../../installer/github';
import Repository from './Repository';
import Pagination f... | import React, { Component, PropTypes } from 'react';
import { Table, TableBody, TableHeader, TableHeaderColumn, TableRow } from 'material-ui/Table';
import { getRepositories } from '../../installer/github';
import Repository from './Repository';
import Pagination from './Pagination';
const accessToken = window.local... |
Add removeInstance API for tests | package jfdi.storage;
import java.nio.file.InvalidPathException;
import jfdi.storage.exceptions.ExistingFilesFoundException;
/**
* This class serves as the facade of the Storage component.
*
* @author Thng Kai Yuan
*/
public class FileStorage implements IStorage {
// The singleton instance of FileStorage
... | package jfdi.storage;
import java.nio.file.InvalidPathException;
import jfdi.storage.exceptions.ExistingFilesFoundException;
/**
* This class serves as the facade of the Storage component.
*
* @author Thng Kai Yuan
*/
public class FileStorage implements IStorage {
// The singleton instance of FileStorage
... |
Use loader to load driver | <?php
include (SYSTEM_PATH . 'db/IDriver.php');
class DB
{
private $dbDriver;
public function __construct()
{
$config =& loadClass('Config', 'Core');
$cfg = $config->load('DB');
if ($cfg !== false)
{
$this->driver($c... | <?php
include (SYSTEM_PATH . 'db/IDriver.php');
class DB
{
private $dbDriver;
public function __construct()
{
$config =& loadClass('Config', 'Core');
$cfg = $config->load('DB');
if ($cfg !== false)
{
$this->driver($c... |
Update for api change with linter_configs. | from imhotep.tools import Tool
from collections import defaultdict
import re
class JSL(Tool):
regex = re.compile(
r'^(?P<type>[WE]) '
r'(?P<filename>.*?) L(?P<line_number>\d+): (?P<message>.*)$')
def invoke(self, dirname, filenames=set(), linter_configs=set()):
retval = defaultdict(la... | from imhotep.tools import Tool
from collections import defaultdict
import re
class JSL(Tool):
regex = re.compile(
r'^(?P<type>[WE]) '
r'(?P<filename>.*?) L(?P<line_number>\d+): (?P<message>.*)$')
def invoke(self, dirname, filenames=set()):
retval = defaultdict(lambda: defaultdict(list... |
Allow Django 1.6 install while preventing 1.3.X | #!/usr/bin/env python
from setuptools import setup, find_packages
from mutant import __version__
github_url = 'https://github.com/charettes/django-mutant'
long_desc = open('README.md').read()
setup(
name='django-mutant',
version='.'.join(str(v) for v in __version__),
description='Dynamic model definition... | #!/usr/bin/env python
from setuptools import setup, find_packages
from mutant import __version__
github_url = 'https://github.com/charettes/django-mutant'
long_desc = open('README.md').read()
setup(
name='django-mutant',
version='.'.join(str(v) for v in __version__),
description='Dynamic model definition... |
Fix String endsWith prototype shadowing | // =================================================================================================
// Core.js | String Functions
// (c) 2014 Mathigon / Philipp Legner
// =================================================================================================
(function() {
M.extend(String.prototype, {
... | // =================================================================================================
// Core.js | String Functions
// (c) 2014 Mathigon / Philipp Legner
// =================================================================================================
(function() {
M.extend(String.prototype, {
... |
Fix namespace on solid ajax. | <?php
namespace Solid\Ajax;
use Illuminate\Routing\Controller as BaseController;
class Controller extends BaseController
{
/**
* Execute an action on the controller.
*
* @param string $method
* @param array $parameters
* @return \Symfony\Component\HttpFoundation\Response
*/
... | <?php
namespace Solid\Ajax\Controllers;
use Illuminate\Routing\Controller as BaseController;
class Controller extends BaseController
{
/**
* Execute an action on the controller.
*
* @param string $method
* @param array $parameters
* @return \Symfony\Component\HttpFoundation\Response... |
Add additinonalFields support to GetServices | 'use strict';
angular.module('adagios.live')
.constant('filterSuffixes', { contains: '__contains',
has_fields: '__has_field',
startswith: '__startswith',
endswith: '__endswith',
... | 'use strict';
angular.module('adagios.live')
.constant('filterSuffixes', { contains: '__contains',
has_fields: '__has_field',
startswith: '__startswith',
endswith: '__endswith',
... |
Fix watchify by enabling poll option
https://github.com/substack/watchify/issues/216#issuecomment-104284044 | var browserify = require('browserify');
var watchify = require('watchify');
var gulp = require('gulp');
var gutil = require('gulp-util');
var source = require('vinyl-source-stream');
var reactify = require('reactify');
function bundle(b) {
gutil.log('Retranspiling source code');
return b.bundle()
.p... | var browserify = require('browserify');
var watchify = require('watchify');
var gulp = require('gulp');
var gutil = require('gulp-util');
var source = require('vinyl-source-stream');
var reactify = require('reactify');
function bundle(b) {
gutil.log('Retranspiling source code');
return b.bundle()
.p... |
Check for input to be array | /**
* Created by sandeshkumar on 4/5/16.
*/
function flattenArray(arr) {
if(Array.isArray(arr)) {
//return flatIterative(arr);
//return flatRecursive(arr, []);
return flatFunctional(arr);
}
return false;
}
function flatRecursive(arr, arr2) {
var flattenedArr = arr2;
for( ... | /**
* Created by sandeshkumar on 4/5/16.
*/
function flattenArray(arr) {
if(Array.isArray(arr)) {
//return flatIterative(arr);
//return flatRecursive(arr, []);
return flatFunctional(arr);
}
return [];
}
function flatRecursive(arr, arr2) {
var flattenedArr = arr2;
for( var... |
Make sure we don't expose translator as global | import six
from autotranslate.compat import importlib
from django.conf import settings
def perform_import(val, setting_name):
"""
If the given setting is a string import notation,
then perform the necessary import or imports.
Credits: https://github.com/tomchristie/django-rest-framework/blob/master/r... | import six
from autotranslate.compat import importlib
from django.conf import settings
def perform_import(val, setting_name):
"""
If the given setting is a string import notation,
then perform the necessary import or imports.
Credits: https://github.com/tomchristie/django-rest-framework/blob/master/r... |
Change display from updatedAt.toDateString to pushedAt.toTimeString | import React from 'react';
import GithubAPI from '../../api/githubAPI';
class HomePage extends React.Component {
constructor(props, context) {
super(props, context);
this.state = {
showResult: "l"
};
this.invokeGitHubAPI = this.invokeGitHubAPI.bind(this);
}
invokeGitHubAPI(){
Github... | import React from 'react';
import GithubAPI from '../../api/githubAPI';
class HomePage extends React.Component {
constructor(props, context) {
super(props, context);
this.state = {
showResult: "l"
};
this.invokeGitHubAPI = this.invokeGitHubAPI.bind(this);
}
invokeGitHubAPI(){
Github... |
Comment the code that duplicates the files | 'use strict';
var pkg = require('./package');
var gutil = require('gulp-util');
var through = require('through2');
var path = require('path');
var File = require('vinyl');
// consts
module.exports = function(out, options) {
options = options || {};
var files = [];
var fileList = [];
return through.obj(funct... | 'use strict';
var pkg = require('./package');
var gutil = require('gulp-util');
var through = require('through2');
var path = require('path');
var File = require('vinyl');
// consts
module.exports = function(out, options) {
options = options || {};
var files = [];
var fileList = [];
return through.obj(funct... |
Make sure the paradrop.pdlog retry when the log file does not exist | import sys
import argparse
import json
import urllib
import subprocess
from time import sleep
LOG_FILE = "/var/snap/paradrop-daemon/common/logs/log"
def parseLine(line):
try:
data = json.loads(line)
msg = urllib.unquote(data['message'])
print(msg)
except:
pass
def runTail(log... | import sys
import argparse
import json
import urllib
import subprocess
LOG_FILE = "/var/snap/paradrop-daemon/common/logs/log"
def parseLine(line):
try:
data = json.loads(line)
msg = urllib.unquote(data['message'])
print(msg)
except:
pass
def runTail(logFile):
cmd = ['tail... |
[master] Add a grunt dev task for css only, without js | 'use strict()';
var config= {
port: 3000
};
module.exports = function(grunt) {
// Load grunt tasks automatically
require('load-grunt-tasks')(grunt);
// Time how long tasks take. Can help when optimizing build times
require('time-grunt')(grunt);
var options = {
config: {
... | 'use strict()';
var config= {
port: 3000
};
module.exports = function(grunt) {
// Load grunt tasks automatically
require('load-grunt-tasks')(grunt);
// Time how long tasks take. Can help when optimizing build times
require('time-grunt')(grunt);
var options = {
config: {
... |
Change task name (plato -> analyze) | var gulp = require('gulp');
var ts = require('gulp-typescript');
var tslint = require('gulp-tslint');
var jade = require('gulp-jade');
var plato = require('gulp-plato');
var espower = require('gulp-espower');
var karma = require('karma').server;
gulp.task('jade', function () {
return gulp.src('./src/views/*.jade')... | var gulp = require('gulp');
var ts = require('gulp-typescript');
var tslint = require('gulp-tslint');
var jade = require('gulp-jade');
var plato = require('gulp-plato');
var espower = require('gulp-espower');
var karma = require('karma').server;
gulp.task('jade', function () {
return gulp.src('./src/views/*.jade')... |
Allow Django Evolution to install along with Django >= 1.7.
As we're working toward some degree of compatibility with newer versions
of Django, we need to ease up on the version restriction. Now's a good
time to do so. Django Evolution no longer has an upper bounds on the
version range. | #!/usr/bin/env python
#
# Setup script for Django Evolution
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
from setuptools.command.test import test
from django_evolution import get_package_version, VERSION
def run_tests(*args):
import os
os.system('tests/ru... | #!/usr/bin/env python
#
# Setup script for Django Evolution
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
from setuptools.command.test import test
from django_evolution import get_package_version, VERSION
def run_tests(*args):
import os
os.system('tests/ru... |
Make dependency check more stringent | from setuptools import setup
from subprocess import check_output, CalledProcessError
try:
num_gpus = len(check_output(['nvidia-smi', '--query-gpu=gpu_name',
'--format=csv']).decode().strip().split('\n'))
tf = 'tensorflow-gpu' if num_gpus > 1 else 'tensorflow'
except CalledProce... | from setuptools import setup
from subprocess import check_output, CalledProcessError
try:
num_gpus = len(check_output(['nvidia-smi', '--query-gpu=gpu_name',
'--format=csv']).decode().strip().split('\n'))
tf = 'tensorflow-gpu' if num_gpus > 1 else 'tensorflow'
except CalledProce... |
Convert Eloquent models to entities when performing an action | <?php
namespace Nwidart\Modules\Repositories;
use Nwidart\Modules\Exceptions\Repositories\ActionFailed;
use Nwidart\Modules\Exceptions\Repositories\NoRecordsFound;
trait PerformsActions
{
/**
* Validate a database action such as create, update, or delete.
*
* @param string $action
* @param mi... | <?php
namespace Nwidart\Modules\Repositories;
use Nwidart\Modules\Exceptions\Repositories\ActionFailed;
use Nwidart\Modules\Exceptions\Repositories\NoRecordsFound;
trait PerformsActions
{
/**
* Validate a database action such as create, update, or delete.
*
* @param string $action
* @param mi... |
Fix being able to put bank item in bank | package me.eddiep.minecraft.ls.game.shop.impl;
import me.eddiep.minecraft.ls.Lavasurvival;
import me.eddiep.minecraft.ls.game.shop.Shop;
import me.eddiep.minecraft.ls.game.shop.ShopManager;
import me.eddiep.minecraft.ls.ranks.UserInfo;
import me.eddiep.minecraft.ls.ranks.UserManager;
import org.bukkit.entity.Pl... | package me.eddiep.minecraft.ls.game.shop.impl;
import me.eddiep.minecraft.ls.Lavasurvival;
import me.eddiep.minecraft.ls.game.shop.Shop;
import me.eddiep.minecraft.ls.game.shop.ShopManager;
import me.eddiep.minecraft.ls.ranks.UserInfo;
import me.eddiep.minecraft.ls.ranks.UserManager;
import org.bukkit.entity.Pl... |
Remove old thing in gtu search map | <?php echo '<?xml version="1.0" encoding="UTF-8"?>';?>
<kml xmlns="http://earth.google.com/kml/2.0">
<Document>
<?php foreach($items as $item):?>
<Placemark>
<name><?php echo $item->getCode();?></name>
<description><![CDATA[
<div class="map_result_id_<?php echo $i... | <?php echo '<?xml version="1.0" encoding="UTF-8"?>';?>
<kml xmlns="http://earth.google.com/kml/2.0">
<Document>
<?php foreach($items as $item):?>
<Placemark>
<name><?php echo count( $items);?>-<?php echo $item->getCode();?></name>
<description><![CDATA[
<div class... |
Add parent ID validation rule. | <?php
namespace common\models\comments;
use yii\base\Exception;
use yii\db\ActiveRecord;
use yii\behaviors\TimestampBehavior;
use yii\behaviors\BlameableBehavior;
abstract class Comment extends ActiveRecord
{
public static function commentClassName()
{
return AdjacencyListComment::className();
}
... | <?php
namespace common\models\comments;
use yii\base\Exception;
use yii\db\ActiveRecord;
use yii\behaviors\TimestampBehavior;
use yii\behaviors\BlameableBehavior;
abstract class Comment extends ActiveRecord
{
public static function commentClassName()
{
return AdjacencyListComment::className();
}
... |
Use correct Provider interface for global components | // Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.config.server.rpc.security;
import com.google.inject.Inject;
import com.yahoo.cloud.config.ConfigserverConfig;
import com.yahoo.config.provision.security.NodeIdentifier;
import com.y... | // Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.config.server.rpc.security;
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.yahoo.cloud.config.ConfigserverConfig;
import com.yahoo.config.provision.se... |
Add Jake's name to top of file | import pygame
#WRITEN BY JACOB PANIKULAM
class Text_Box(object):
'''Text_Box()
You never have to initialize this! Just call Text_Box.draw(display, pos, color, text)
It draws the same way a pygame primitive would.
'''
pygame.font.init()
font = pygame.font.SysFont("monospace", 15)
@classmeth... | import pygame
class Text_Box(object):
'''Text_Box()
You never have to initialize this! Just call Text_Box.draw(display, pos, color, text)
It draws the same way a pygame primitive would.
'''
pygame.font.init()
font = pygame.font.SysFont("monospace", 15)
@classmethod
def draw(self, disp... |
Remove @package & restart travis | <?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
namespace ... | <?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @package Z... |
Add refresh to trades view. | "use strict";
(function () {
angular
.module("argo")
.factory("streamService", streamService);
streamService.$inject = ["ngSocket", "quotesService",
"activityService", "tradesService"];
function streamService(ngSocket, quotesService,
activity... | "use strict";
(function () {
angular
.module("argo")
.factory("tradesService", tradesService);
tradesService.$inject = ["$http", "$q", "sessionService"];
function tradesService($http, $q, sessionService) {
var trades = [],
service = {
getTrades: getTrade... |
Check UUID column is empty
If the UUID column has already been populated when creating the model, the package should not attempt to overwrite it. This takes into consideration JSON API-compatible APIs, which allows for client-generated IDs. | <?php
namespace Emadadly\LaravelUuid;
use Ramsey\Uuid\Uuid;
use Illuminate\Database\Eloquent\ModelNotFoundException;
trait Uuids
{
/**
* Boot function from laravel.
*/
protected static function boot()
{
parent::boot();
static::creating(function ($model) {
if (!$model... | <?php
namespace Emadadly\LaravelUuid;
use Ramsey\Uuid\Uuid;
use Illuminate\Database\Eloquent\ModelNotFoundException;
trait Uuids
{
/**
* Boot function from laravel.
*/
protected static function boot()
{
parent::boot();
static::creating(function ($model) {
$model->{co... |
Add journal watcher unit to pod rules | from pathlib import Path
import shipyard2.rules.pods
OPS_DB_PATH = Path('/srv/operations/database/v1')
shipyard2.rules.pods.define_pod(
name='database',
apps=[
shipyard2.rules.pods.App(
name='database',
exec=[
'python3',
*('-m', 'g1.operations.d... | from pathlib import Path
import shipyard2.rules.pods
OPS_DB_PATH = Path('/srv/operations/database/v1')
shipyard2.rules.pods.define_pod(
name='database',
apps=[
shipyard2.rules.pods.App(
name='database',
exec=[
'python3',
*('-m', 'g1.operations.d... |
Update the 'send' parameter to work with the actual API spec | package com.tozny.sdk.realm.methods.email_challenge;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.tozny.sdk.ToznyApiRequest;
import javax.annotation.Nullable;
/**
* Constructs a Request for invoking the "realm.email_challenge" method.
*/
@... | package com.tozny.sdk.realm.methods.email_challenge;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.tozny.sdk.ToznyApiRequest;
import javax.annotation.Nullable;
/**
* Constructs a Request for invoking the "realm.email_challenge" method.
*/
@... |
Fix license header getting removed | /*
* Copyright 2012, Board of Regents of the University of
* Wisconsin System. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Board of Regents of the University of Wisconsin
* System licenses this file to you under the Apache License,
* Version 2.0 (the "Lic... | define(['angular'], function(angular) {
var config = angular.module('app-config', []);
config
.constant('SERVICE_LOC', {
'sessionInfo' : 'json/sessionsample.json',
'sidebarInfo' : 'samples/sidebar.json',
'notificationsURL' : 'samples/notifications.json',
... |
Remove call to realPath for output file | /**
* Main styleguide grunt task
*/
module.exports = function(grunt) {
'use strict';
var fs = require('fs'),
nunjucks = require('nunjucks');
grunt.registerMultiTask('styleguide', 'Generate a static HTML style guide', function() {
var context = this.data,
partials = fs.realpathSync(c... | /**
* Main styleguide grunt task
*/
module.exports = function(grunt) {
'use strict';
var fs = require('fs'),
nunjucks = require('nunjucks');
grunt.registerMultiTask('styleguide', 'Generate a static HTML style guide', function() {
var context = this.data,
output = fs.realpathSync(con... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.