text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Return Response instances for fakeFetch | import queryString from 'query-string';
import pathMatch from 'path-match';
import parseUrl from 'parse-url';
const nativeFetch = window.fetch;
//TODO: Handle response headers
let fakeResponse = function(response = {}) {
const responseStr = JSON.stringify(response);
return new Response(responseStr);
};
export c... | import queryString from 'query-string';
import pathMatch from 'path-match';
import parseUrl from 'parse-url';
const nativeFetch = window.fetch;
export const fakeFetch = (serverRoutes) => {
return (url, options = {}) => {
const body = options.body || '';
const method = options.method || 'GET';
const hand... |
ListCommand: Remove options, the command does not take options. | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from optparse import make_option
from optparse import OptionParser
from scaffolder.core.commands import BaseCommand
from scaffolder.core.template import TemplateManager
class ListCommand(BaseCommand):
def __init__(self, name, help='', aliases=(), stdout=None, stderr=... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from optparse import make_option
from optparse import OptionParser
from scaffolder.core.commands import BaseCommand
from scaffolder.core.template import TemplateManager
class TemplateCommand(BaseCommand):
option_list = BaseCommand.option_list + (
make_option(
... |
Insert data into Images collection | Template.createBetForm.helpers({
photo: function(){
return Session.get("photo");
}
})
Template.createBetForm.events({
"submit .create-bet" : function(event){
event.preventDefault();
var title = event.target.betTitle.value,
wager = event.target.betWager.value,
user = Meteor.user(),
... | Template.createBetForm.helpers({
photo: function(){
return Session.get("photo");
}
})
Template.createBetForm.events({
"submit .create-bet" : function(event){
event.preventDefault();
var title = event.target.betTitle.value,
wager = event.target.betWager.value,
user = Meteor.user(),
... |
Access code lower-cased on submit. | /**
* Emerging Citizens
* Developed by Engagement Lab, 2015
* ==============
* Game player view controller.
*
* Help: http://keystonejs.com/docs/getting-started/#routesviews-firstview
*
* @class game
* @static
* @author Johnny Richardson
*
* ==========
*/
var keystone = require('keystone');
var _ = require... | /**
* Emerging Citizens
* Developed by Engagement Lab, 2015
* ==============
* Game player view controller.
*
* Help: http://keystonejs.com/docs/getting-started/#routesviews-firstview
*
* @class game
* @static
* @author Johnny Richardson
*
* ==========
*/
var keystone = require('keystone');
var _ = require... |
[test] Use new API in `simple/use-load` test | /*
* use-test.js: Basic tests for the carapace module
*
* (C) 2011 Nodejitsu Inc
* MIT LICENCE
*
*/
var assert = require('assert'),
vows = require('vows'),
helper = require('../helper/macros.js'),
carapace = require('../../lib/carapace');
vows.describe('carapace/simple/use-plugins').addBatch({
"W... | /*
* use-test.js: Basic tests for the carapace module
*
* (C) 2011 Nodejitsu Inc
* MIT LICENCE
*
*/
var assert = require('assert'),
vows = require('vows'),
helper = require('../helper/macros.js'),
carapace = require('../../lib/carapace');
var PORT = 5050;
vows.describe('carapace/simple/use-plu... |
Fix iDEAL test in demo app | package com.braintreepayments.demo.test;
import android.support.test.filters.SdkSuppress;
import android.support.test.runner.AndroidJUnit4;
import com.braintreepayments.demo.test.utilities.TestHelper;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import static com.lukekorth.device... | package com.braintreepayments.demo.test;
import android.support.test.filters.SdkSuppress;
import android.support.test.runner.AndroidJUnit4;
import com.braintreepayments.demo.test.utilities.TestHelper;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import static com.lukekorth.device... |
Allow to properly disable verification of SSL | """Python library to enable Axis devices to integrate with Home Assistant."""
import requests
from requests.auth import HTTPDigestAuth
class Configuration(object):
"""Device configuration."""
def __init__(self, *,
loop, host, username, password,
port=80, web_proto='http', v... | """Python library to enable Axis devices to integrate with Home Assistant."""
import requests
from requests.auth import HTTPDigestAuth
class Configuration(object):
"""Device configuration."""
def __init__(self, *,
loop, host, username, password,
port=80, web_proto='http', ve... |
Fix nick search missing from new standardised search function | 'use strict'
class API {
static createQueryFromRequest (request) {
let limit = parseInt(request.limit) || 25
delete request.limit
let offset = parseInt(request.offset) || 0
delete request.offset
let order = parseInt(request.order) || 'createdAt'
delete request.order
let direction = requ... | 'use strict'
class API {
static createQueryFromRequest (request) {
let limit = parseInt(request.limit) || 25
delete request.limit
let offset = parseInt(request.offset) || 0
delete request.offset
let order = parseInt(request.order) || 'createdAt'
delete request.order
let direction = requ... |
Emphasize that events fire just once | 'use strict';
const EventEmitter = require('events');
const devtools = require('./lib/devtools');
const Chrome = require('./lib/chrome');
module.exports = function (options, callback) {
if (typeof options === 'function') {
callback = options;
options = undefined;
}
const notifier = new Ev... | 'use strict';
const EventEmitter = require('events');
const devtools = require('./lib/devtools');
const Chrome = require('./lib/chrome');
module.exports = function (options, callback) {
if (typeof options === 'function') {
callback = options;
options = undefined;
}
const notifier = new Ev... |
Add a trailing separator to all sents | __author__ = 's7a'
# All imports
from parser import Parser
from breaker import Breaker
import re
# The Syntactic simplification class
class SyntacticSimplifier:
# Constructor for the Syntactic Simplifier
def __init__(self):
self.parser = Parser()
self.breaker = Breaker()
# Simplify cont... | __author__ = 's7a'
# All imports
from parser import Parser
from breaker import Breaker
import re
# The Syntactic simplification class
class SyntacticSimplifier:
# Constructor for the Syntactic Simplifier
def __init__(self):
self.parser = Parser()
self.breaker = Breaker()
# Simplify cont... |
Add search special status property | <?php
namespace MssPhp\Schema\Request;
use JMS\Serializer\Annotation\Type;
use JMS\Serializer\Annotation\XmlList;
class SearchSpecial {
/**
* @Type("array<integer>")
* @XmlList(inline = true, entry="offer_id")
*/
public $offer_id;
/**
* @Type("DateTime<'Y-m-d'>")
*/
public $da... | <?php
namespace MssPhp\Schema\Request;
use JMS\Serializer\Annotation\Type;
use JMS\Serializer\Annotation\XmlList;
class SearchSpecial {
/**
* @Type("array<integer>")
* @XmlList(inline = true, entry="offer_id")
*/
public $offer_id;
/**
* @Type("DateTime<'Y-m-d'>")
*/
public $da... |
Update is public access logic | var loopback = require('loopback'),
debug = require('debug')('openframe:isPublicOrOwner');
/**
* This mixin requires a model to have 'is_public: true' or the current user
* to be the object's owner in order to provide access.
*/
module.exports = function(Model, options) {
Model.observe('access', function(re... | var loopback = require('loopback'),
debug = require('debug')('openframe:isPublicOrOwner');
/**
* This mixin requires a model to have 'is_public: true' or the current user
* to be the object's owner in order to provide access.
*/
module.exports = function(Model, options) {
Model.observe('access', function(re... |
Make sure react-helmet styles are rendered | import React, { Component, PropTypes } from "react";
import Helmet from "react-helmet";
import { BodyAttributes } from "gluestick-shared";
import "assets/css/normalize.css";
/**
* The index html will be generated from this file. You can customize things as
* you see fit. `body` and `head` will be generated by the se... | import React, { Component, PropTypes } from "react";
import Helmet from "react-helmet";
import { BodyAttributes } from "gluestick-shared";
import "assets/css/normalize.css";
/**
* The index html will be generated from this file. You can customize things as
* you see fit. `body` and `head` will be generated by the se... |
Split up Flexbox guide into two parts to avoid running out of WebGL contexts in Chrome (max of 8 per page). | /* Copyright 2015-2016 Teeming Society. Licensed under the Apache License, Version 2.0 (the "License"); DreemGL is a collaboration between Teeming Society & Samsung Electronics, sponsored by Samsung and others.
You may not use this file except in compliance with the License. You may obtain a copy of the License at htt... | /* Copyright 2015-2016 Teeming Society. Licensed under the Apache License, Version 2.0 (the "License"); DreemGL is a collaboration between Teeming Society & Samsung Electronics, sponsored by Samsung and others.
You may not use this file except in compliance with the License. You may obtain a copy of the License at htt... |
Handle localStorage not being available on page load
You won't be able to log in, but you'll at least be able to browse the site!
Closes #47 | import Ember from 'ember';
export default Ember.Object.extend({
savedTransition: null,
isLoggedIn: false,
currentUser: null,
init: function() {
var isLoggedIn;
try {
isLoggedIn = localStorage.getItem('isLoggedIn') === '1';
} catch (e) {
isLoggedIn = fals... | import Ember from 'ember';
export default Ember.Object.extend({
savedTransition: null,
isLoggedIn: false,
currentUser: null,
init: function() {
this.set('isLoggedIn', localStorage.getItem('isLoggedIn') === '1');
this.set('currentUser', null);
},
loginUser: function(user) {
... |
Fix value should be given formatted | package de.retest.recheck.ui.descriptors;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlRootElement;
import de.retest.recheck.util.StringSimilarity;
@XmlRootElement
public class TextAttribute extends StringAttribute {
private static final long serialVersionUID = 1L;
// Used by JaxB
protected... | package de.retest.recheck.ui.descriptors;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlRootElement;
import de.retest.recheck.util.StringSimilarity;
@XmlRootElement
public class TextAttribute extends StringAttribute {
private static final long serialVersionUID = 1L;
// Used by JaxB
protected... |
site: Copy site into releases folder | const gulp = require('gulp')
const runSequence = require('run-sequence')
const harp = require('harp')
const webpackStream = require('webpack-stream')
const del = require('del')
const config = require('./config')
gulp.task('clean', () => {
return del(['./www'])
})
gulp.task('webpack:prod', () => {
return gulp.src... | const gulp = require('gulp')
const runSequence = require('run-sequence')
const harp = require('harp')
const webpackStream = require('webpack-stream')
const del = require('del')
const config = require('./config')
gulp.task('clean', () => {
return del(['./www'])
})
gulp.task('webpack:prod', () => {
return gulp.src... |
Fix the CoffeeScript and TOML dependency injection | /**
* Gray Matter
* Copyright (c) 2014 Jon Schlinkert, Brian Woodward, contributors.
* Licensed under the MIT license.
*/
'use strict';
// node_modules
var YAML = require('js-yaml'),
coffee,
toml;
// The module to export
var parse = module.exports = {};
parse.yaml = function(src) {
return YAML.load(src);... | /**
* Gray Matter
* Copyright (c) 2014 Jon Schlinkert, Brian Woodward, contributors.
* Licensed under the MIT license.
*/
'use strict';
// node_modules
var YAML = require('js-yaml');
var coffee = require('coffee-script');
var toml = require('toml');
// The module to export
var parse = module.exports = {};
par... |
Change particle restart test to check for output on stderr rather than checking the return status. | #!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
pwd = os.path.dirname(__file__)
def setup():
os.putenv('PWD', pwd)
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=PIPE, stdout=PIPE)
stdout, stderr = proc.communicate()
assert stderr != ''... | #!/usr/bin/env python
import os
from subprocess import Popen, STDOUT, PIPE
pwd = os.path.dirname(__file__)
def setup():
os.putenv('PWD', pwd)
os.chdir(pwd)
def test_run():
proc = Popen([pwd + '/../../src/openmc'], stderr=STDOUT, stdout=PIPE)
returncode = proc.wait()
print(proc.communicate()[0])... |
Fix problems to update image of publication | <?php
require_once __DIR__ . "/../class/autoload.php";
use \html\Page as Page;
use \html\AdministratorMenu as AdministratorMenu;
use \html\Forms as Forms;
use \configuration\Globals as Globals;
use \utilities\Session as Session;
Page::startHeader("Editar Página");
Page::styleSheet("use... | <?php
require_once __DIR__ . "/../class/autoload.php";
use \html\Page as Page;
use \html\AdministratorMenu as AdministratorMenu;
use \html\Forms as Forms;
use \configuration\Globals as Globals;
use \utilities\Session as Session;
Page::startHeader("Editar Página");
Page::styleSheet("use... |
Fix detection of QUnit version in QUnitAdapter. | import { inspect } from 'ember-utils';
import Adapter from './adapter';
/**
This class implements the methods defined by Ember.Test.Adapter for the
QUnit testing framework.
@class QUnitAdapter
@namespace Ember.Test
@extends Ember.Test.Adapter
@public
*/
export default Adapter.extend({
init() {
this.... | import { inspect } from 'ember-utils';
import Adapter from './adapter';
/**
This class implements the methods defined by Ember.Test.Adapter for the
QUnit testing framework.
@class QUnitAdapter
@namespace Ember.Test
@extends Ember.Test.Adapter
@public
*/
export default Adapter.extend({
init() {
this.... |
fix: Add missing Cost Center filter in cash flow statement | // Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.require("assets/erpnext/js/financial_statements.js", function() {
frappe.query_reports["Cash Flow"] = $.extend({},
erpnext.financial_statements);
// The last item in the array is the def... | // Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors
// For license information, please see license.txt
frappe.require("assets/erpnext/js/financial_statements.js", function() {
frappe.query_reports["Cash Flow"] = $.extend({},
erpnext.financial_statements);
// The last item in the array is the def... |
Update e2e tests in relation to latest ui changes | var utils = require('./utils.js');
describe('admin add users', function() {
it('should add new users', function(done) {
browser.setLocation('admin/users');
var add_user = function(role, roleSelector, name, address) {
return protractor.promise.controlFlow().execute(function() {
var deferred = p... | var utils = require('./utils.js');
describe('admin add users', function() {
it('should add new users', function(done) {
browser.setLocation('admin/users');
var add_user = function(username, role, roleSelector, name, address) {
return protractor.promise.controlFlow().execute(function() {
var de... |
Send a hostkeys-00@openssh.com request if the client is an OpenSSH version and we're pretenting to be one too | package main
import (
"log"
"net"
"strings"
"github.com/sirupsen/logrus"
"golang.org/x/crypto/ssh"
)
func handleConnection(conn net.Conn, sshServerConfig *ssh.ServerConfig) {
defer conn.Close()
defer logrus.WithField("remote_address", conn.RemoteAddr().String()).Infoln("Connection closed")
serverConn, newCha... | package main
import (
"log"
"net"
"github.com/sirupsen/logrus"
"golang.org/x/crypto/ssh"
)
func handleConnection(conn net.Conn, sshServerConfig *ssh.ServerConfig) {
defer conn.Close()
defer logrus.WithField("remote_address", conn.RemoteAddr().String()).Infoln("Connection closed")
serverConn, newChannels, requ... |
Rename findByDomainId's parameter to match new function name | <?php namespace Nord\Lumen\Core\Infrastructure;
use Doctrine\ORM\EntityRepository as BaseRepository;
use Nord\Lumen\Core\Domain\Model\Entity;
class EntityRepository extends BaseRepository
{
/**
* @param string $domainId
*
* @return Entity|null
*/
public function findByDomainId($domainId)
... | <?php namespace Nord\Lumen\Core\Infrastructure;
use Doctrine\ORM\EntityRepository as BaseRepository;
use Nord\Lumen\Core\Domain\Model\Entity;
class EntityRepository extends BaseRepository
{
/**
* @param string $objectId
*
* @return Entity|null
*/
public function findByDomainId($objectId)
... |
Create new method object generate
get riak bucket and generate tuple or list | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import riak
from wtforms.fields import TextField, TextAreaField, SelectField
from wtforms.validators import Required
from wtforms_tornado import Form
def ObjGenerate(bucket, key, value=None, _type=tuple):
myClient = riak.RiakClient(protocol='http',
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import riak
from wtforms.fields import TextField, TextAreaField, SelectField
from wtforms.validators import Required
from wtforms_tornado import Form
class ConnectionForm(Form):
name = TextField(validators=[Required()])
conection = TextField(validators=[Required(... |
Check to see if user already exists for email | <?php
require_once('../includes/config.php');
$errors = array();
$data = array();
if(isset($_POST['_csrf']) && session_csrf_check($_POST['_csrf'])) {
$recaptcha = new \ReCaptcha\ReCaptcha($config['captcha']['priv'], new \ReCaptcha\RequestMethod\CurlPost());
$resp = $recaptcha->verify($_POST['g-recaptcha-response'])... | <?php
require_once('../includes/config.php');
$errors = array();
$data = array();
if(isset($_POST['_csrf']) && session_csrf_check($_POST['_csrf'])) {
$recaptcha = new \ReCaptcha\ReCaptcha($config['captcha']['priv'], new \ReCaptcha\RequestMethod\CurlPost());
$resp = $recaptcha->verify($_POST['g-recaptcha-response'])... |
Fix bug when resizing terminal | // +build !windows
package gottyclient
import (
"encoding/json"
"fmt"
"golang.org/x/sys/unix"
"os"
"os/signal"
"syscall"
)
func notifySignalSIGWINCH(c chan<- os.Signal) {
signal.Notify(c, syscall.SIGWINCH)
}
func resetSignalSIGWINCH() {
signal.Reset(syscall.SIGWINCH)
}
func syscallTIOCGWINSZ() ([]byte, err... | // +build !windows
package gottyclient
import (
"encoding/json"
"fmt"
"golang.org/x/sys/unix"
"os"
"os/signal"
"syscall"
)
func notifySignalSIGWINCH(c chan<- os.Signal) {
signal.Notify(c, syscall.SIGWINCH)
}
func resetSignalSIGWINCH() {
signal.Reset(syscall.SIGWINCH)
}
func syscallTIOCGWINSZ() ([]byte, err... |
Update store to use new Vuex plugins.
Overall this feels like a much cleaner approach. | import Vue from 'vue';
import Vuex from 'vuex';
import undoRedo from '../plugins/undo-redo';
import shareMutations from '../plugins/share-mutations';
import shareDevTools from '../plugins/share-devtools';
import page from './modules/page';
import definition from './modules/definition';
import Config from 'classes/Confi... | import Vue from 'vue';
import Vuex from 'vuex';
import undoRedo from '../plugins/undo-redo';
import page from './modules/page';
import definition from './modules/definition';
/* global window */
Vue.use(Vuex);
const store = (
window.self === window.top ? {
state: {
over: {
x: 0,
y: 0
},
preview... |
Rebuild the query every time it's needed so that preseeded results display | var environment = require('../environment'),
offload = require('../../graphworker/standalone');
module.exports.search = function (options, recordcb, facetcb) {
if (typeof options.query !== 'undefined') {
options.query.plan = environment.querybuilder.build(options.query.ast);
options.query.offse... | var environment = require('../environment'),
offload = require('../../graphworker/standalone');
module.exports.search = function (options, recordcb, facetcb) {
if (typeof options.query !== 'undefined') {
if (typeof options.query.plan === 'undefined') {
options.query.plan = environment.query... |
Add test for Brazilian states count | <?php
use Galahad\LaravelAddressing\AdministrativeAreaCollection;
use Galahad\LaravelAddressing\Country;
/**
* Class AdministrativeAreaCollectionTest
*
* @author Junior Grossi <juniorgro@gmail.com>
*/
class AdministrativeAreaCollectionTest extends PHPUnit_Framework_TestCase
{
public function testCollectionCla... | <?php
use Galahad\LaravelAddressing\AdministrativeAreaCollection;
use Galahad\LaravelAddressing\Country;
/**
* Class AdministrativeAreaCollectionTest
*
* @author Junior Grossi <juniorgro@gmail.com>
*/
class AdministrativeAreaCollectionTest extends PHPUnit_Framework_TestCase
{
public function testCollectionCla... |
Add dataset upload_to attribute. Fix DateTimeField name. | from django.db import models
from django.contrib.auth.models import User
class DatasetLicence(models.Model):
title = models.CharField(max_length=255)
short_title = models.CharField(max_length=30)
url = models.URLField()
summary = models.TextField()
updated = models.DateTimeField(auto_now=True)
... | from django.db import models
from django.contrib.auth.models import User
class DatasetLicence(models.Model):
title = models.CharField(max_length=255)
short_title = models.CharField(max_length=30)
url = models.URLField()
summary = models.TextField()
updated = models.DatetimeField(auto_now=True)
... |
Add route for getting books | import React, { Component } from 'react';
import { Router, Route, Switch } from 'react-router-dom';
import { hot } from 'react-hot-loader';
import SignUpPage from './SignUp/SignUpPage';
import LoginPage from './Login/LoginPage';
import IndexPage from './Index';
import Books from './Books';
class App extends Component ... | import React, { Component } from 'react';
import { Router, Route, Switch } from 'react-router-dom';
import { hot } from 'react-hot-loader';
import SignUpPage from './SignUp/SignUpPage';
import LoginPage from './Login/LoginPage';
import IndexPage from './Index';
class App extends Component {
render() {
return (
... |
karma-mocha: Increase the timeout to 10s in an attempt to avoid random failures | module.exports = function(config) {
config.set({
frameworks: ['mocha'],
exclude: ['build/test/external.spec.js'],
files: [
'vendor/es5-shim.js',
'vendor/es5-sham.js',
'vendor/rsvp.js',
'vendor/unexpected-magicpen.min.js',
'build/test/promisePolyfill.js',
'unexpected.j... | module.exports = function(config) {
config.set({
frameworks: ['mocha'],
exclude: ['build/test/external.spec.js'],
files: [
'vendor/es5-shim.js',
'vendor/es5-sham.js',
'vendor/rsvp.js',
'vendor/unexpected-magicpen.min.js',
'build/test/promisePolyfill.js',
'unexpected.j... |
Allow Curve25519DH import to fail in crypto package
With the refactoring to avoid pylint warnings, a problem was introduced
in importing the crypto module when the curve25519 dependencies were
unavailable. This commit fixes that problem. | # Copyright (c) 2014-2015 by Ron Frederick <ronf@timeheart.net>.
# All rights reserved.
#
# This program and the accompanying materials are made available under
# the terms of the Eclipse Public License v1.0 which accompanies this
# distribution and is available at:
#
# http://www.eclipse.org/legal/epl-v10.html
#
#... | # Copyright (c) 2014-2015 by Ron Frederick <ronf@timeheart.net>.
# All rights reserved.
#
# This program and the accompanying materials are made available under
# the terms of the Eclipse Public License v1.0 which accompanies this
# distribution and is available at:
#
# http://www.eclipse.org/legal/epl-v10.html
#
#... |
Use a private RNG for guids. Avoids potential for trouble w/ the global instance. | """ Utility functions
"""
import random
import time
from . import constants
guid_rng = random.Random() # Uses urandom seed
def _service_url_from_hostport(secure, host, port):
"""
Create an appropriate service URL given the parameters.
`secure` should be a bool.
"""
if secure:
protocol =... | """ Utility functions
"""
import random
import time
from . import constants
def _service_url_from_hostport(secure, host, port):
"""
Create an appropriate service URL given the parameters.
`secure` should be a bool.
"""
if secure:
protocol = 'https://'
else:
protocol = 'http://'... |
Fix 'Do not access attributes directly.' error on Activity | var SharedModelMethods = require('mixins/shared_model_methods');
var Activity = module.exports = Backbone.Model.extend({
name: 'activity',
i18nScope: 'activerecord.attributes.',
timestampFormat: 'd mmm yyyy',
initialize: function(args) {
var data = args.activity;
this.i18nScope += data.subject_type... | var SharedModelMethods = require('mixins/shared_model_methods');
var Activity = module.exports = Backbone.Model.extend({
name: 'activity',
i18nScope: 'activerecord.attributes.',
timestampFormat: 'd mmm yyyy',
initialize: function(args) {
var attributes = this.attributes;
var data = args.activity;
... |
Test arities of 0 properly. | /* global describe it */
/*
* Ensure that storage providers are complete and consistent.
*/
var chai = require('chai');
var dirtyChai = require('dirty-chai');
chai.use(dirtyChai);
var expect = chai.expect;
var delegates = require('../src/storage').delegates;
var MemoryStorage = require('../src/storage/memory'... | /* global describe it */
/*
* Ensure that storage providers are complete and consistent.
*/
var chai = require('chai');
var dirtyChai = require('dirty-chai');
chai.use(dirtyChai);
var expect = chai.expect;
var delegates = require('../src/storage').delegates;
var MemoryStorage = require('../src/storage/memory'... |
Stop using the undocumented get_all_related_objects_with_model API | from django.db import models
from tournamentcontrol.competition.signals.custom import match_forfeit # noqa
from tournamentcontrol.competition.signals.ladders import ( # noqa
changed_points_formula,
scale_ladder_entry,
team_ladder_entry_aggregation,
)
from tournamentcontrol.competition.signals.matches imp... | from django.db import models
from tournamentcontrol.competition.signals.custom import match_forfeit # noqa
from tournamentcontrol.competition.signals.ladders import ( # noqa
changed_points_formula,
scale_ladder_entry,
team_ladder_entry_aggregation,
)
from tournamentcontrol.competition.signals.matches imp... |
Set default content type to text/html for WebAgents. | /**
* @license
* Copyright 2017 The FOAM Authors. All Rights Reserved.
* http://www.apache.org/licenses/LICENSE-2.0
*/
package foam.nanos.http;
import foam.core.*;
import foam.dao.*;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServle... | /**
* @license
* Copyright 2017 The FOAM Authors. All Rights Reserved.
* http://www.apache.org/licenses/LICENSE-2.0
*/
package foam.nanos.http;
import foam.core.*;
import foam.dao.*;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServle... |
Add support for single quoted multi-line strings in Python | Prism.languages.python= {
'comment': {
pattern: /(^|[^\\])#.*?(\r?\n|$)/g,
lookbehind: true
},
'string': /"""[\s\S]+?"""|'''[\s\S]+?'''|("|')(\\?.)*?\1/g,
'keyword' : /\b(as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|pass|print|raise|return|try|whil... | Prism.languages.python= {
'comment': {
pattern: /(^|[^\\])#.*?(\r?\n|$)/g,
lookbehind: true
},
'string': /"""[\s\S]+?"""|("|')(\\?.)*?\1/g,
'keyword' : /\b(as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|pass|print|raise|return|try|while|with|yield)\b... |
Add pytest-cov to test extras | from codecs import open as codecs_open
from setuptools import setup, find_packages
# Get the long description from the relevant file
with codecs_open('README.rst', encoding='utf-8') as f:
long_description = f.read()
setup(name='tile-stitcher',
version='0.0.1',
description=u"Stitch image tiles into c... | from codecs import open as codecs_open
from setuptools import setup, find_packages
# Get the long description from the relevant file
with codecs_open('README.rst', encoding='utf-8') as f:
long_description = f.read()
setup(name='tile-stitcher',
version='0.0.1',
description=u"Stitch image tiles into c... |
Increment `retries` variable in a way that pleases `jshint`. | 'use strict';
var net = require('net'),
utils = require('radiodan-client').utils,
logger = utils.logger(__filename);
function create(port, socket) {
var deferred = utils.promise.defer(),
retries = 0,
timeout = 1000;
socket = socket || new net.Socket();
socket.setTimeout(2500);
fun... | 'use strict';
var net = require('net'),
utils = require('radiodan-client').utils,
logger = utils.logger(__filename);
function create(port, socket) {
var deferred = utils.promise.defer(),
retries = 0,
timeout = 1000;
socket = socket || new net.Socket();
socket.setTimeout(2500);
fun... |
Add with back to dial, docstring | """Demonstration of setting up a conference call in Flask with Twilio."""
from flask import Flask, request
from twilio.twiml.voice_response import VoiceResponse, Dial
app = Flask(__name__)
# Update with your own phone number in E.164 format
MODERATOR = '+18005551212'
@app.route("/voice", methods=['GET', 'POST'])
de... | from flask import Flask, request
from twilio.twiml.voice_response import VoiceResponse, Dial
app = Flask(__name__)
# Update with your own phone number in E.164 format
MODERATOR = '+15558675309'
@app.route("/voice", methods=['GET', 'POST'])
def call():
"""Returns TwiML for a moderated conference call"""
# St... |
Fix a typo in the Django ConfigPropertyModel class. | # coding: utf-8
#
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | # coding: utf-8
#
# Copyright 2013 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... |
PLAT-8479: Add accessibility option to make accessibility feature enable on garnet sample
Add accessibility option, which is set to true.
https://jira2.lgsvl.com/browse/PLAT-8479
Enyo-DCO-1.1-Signed-off-by: Bongsub Kim <bongsub.kim@lgepartner.com>
Change-Id: I6017abad0e08c1796b615e2e4776c380dded92bb | require('enyo/options').accessibility = true;
var
ready = require('enyo/ready'),
kind = require('enyo/kind');
var
SampleList = require('../src/strawman/SampleList');
var
samples = {
Enyo: require('../src/enyo-samples'),
Garnet: require('./src'),
Layout: require('../src/layout-samples'),
Spotlight: requir... | var
ready = require('enyo/ready'),
kind = require('enyo/kind');
var
SampleList = require('../src/strawman/SampleList');
var
samples = {
Enyo: require('../src/enyo-samples'),
Garnet: require('./src'),
Layout: require('../src/layout-samples'),
Spotlight: require('../src/spotlight-samples'),
iLib: require(... |
Increase 503 retry strategy from 200ms to 2000ms, Nike+ was occasionally returning "429 Too Many Requests". | package com.awsmithson.tcx2nikeplus.http;
import com.google.common.base.Predicate;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.impl.client.HttpClientBuilder;
import javax.annotation.Nonnull;
import javax.annotation.... | package com.awsmithson.tcx2nikeplus.http;
import com.google.common.base.Predicate;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.impl.client.HttpClientBuilder;
import javax.annotation.Nonnull;
import javax.annotation.... |
Support provide a URI Object | 'use strict'
var parseURI = require('parse-uri')
var encode = require('punycode2/encode')
// Illegal characters (anything which is not in between the square brackets):
var ILLEGALS = /[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i
// Incomplete HEX escapes:
var HEX1 = /%[^0-9a-f]/i
var HEX2 = /%[0-9a-f](:... | 'use strict'
var parseURI = require('parse-uri')
var encode = require('punycode2/encode')
// Illegal characters (anything which is not in between the square brackets):
var ILLEGALS = /[^a-z0-9\:\/\?\#\[\]\@\!\$\&\'\(\)\*\+\,\;\=\.\-\_\~\%]/i
// Incomplete HEX escapes:
var HEX1 = /%[^0-9a-f]/i
var HEX2 = /%[0-9a-f](:... |
Store player name as owner by default. Should further help singleplayer ownership issues. | package com.carpentersblocks.util.protection;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
public class ProtectedObject {
public EntityPlayer entityPlayer;
public Protecte... | package com.carpentersblocks.util.protection;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
public class ProtectedObject {
public EntityPlayer entityPlayer;
public Protecte... |
Allow more zvals to be passed as ref | <?php
namespace PHPPHP\Engine\OpLines;
use PHPPHP\Engine\Zval;
class Send extends \PHPPHP\Engine\OpLine {
public function execute(\PHPPHP\Engine\ExecuteData $data) {
$ptr = null;
if($data->executor->executorGlobals->call->getFunction()->isArgByRef($this->op2)) {
if ($this->op1->isVar... | <?php
namespace PHPPHP\Engine\OpLines;
use PHPPHP\Engine\Zval;
class Send extends \PHPPHP\Engine\OpLine {
public function execute(\PHPPHP\Engine\ExecuteData $data) {
$ptr = null;
if($data->executor->executorGlobals->call->getFunction()->isArgByRef($this->op2)) {
if ($this->op1->isVar... |
Resolve an unassigned variable error. | <?php
if(!Utility::isBot()) {
if(!isset($sidebar)) {
$sidebar = false;
}
if($article) {
$advert = \FelixOnline\Core\Advert::randomPick('articles', $sidebar, $article->getCategory());
} elseif($category) {
$advert = \FelixOnline\Core\Advert::randomPick('categories', $sidebar, $category);
} else {
... | <?php
if(!Utility::isBot()) {
if(!$sidebar) {
$sidebar = false;
}
if($article) {
$advert = \FelixOnline\Core\Advert::randomPick('articles', $sidebar, $article->getCategory());
} elseif($category) {
$advert = \FelixOnline\Core\Advert::randomPick('categories', $sidebar, $category);
} else {
$adver... |
Disable info if both pagination and filter is disabled | <?php
$fields = json_decode(json_encode(get_fields($module->ID)));
$classes = '';
if (isset($fields->mod_table_classes) && is_array($fields->mod_table_classes)) {
$classes = implode(' ', $fields->mod_table_classes);
}
?>
<div class="box box-panel">
<h4 class="box-title"><?php echo $module->post_title; ?></h4>
... | <?php
$fields = json_decode(json_encode(get_fields($module->ID)));
$classes = '';
if (isset($fields->mod_table_classes) && is_array($fields->mod_table_classes)) {
$classes = implode(' ', $fields->mod_table_classes);
}
?>
<div class="box box-panel">
<h4 class="box-title"><?php echo $module->post_title; ?></h4>
... |
Make random IDs start with a letter | import string
import random
from django.conf import settings
def validate_settings():
assert settings.AWS, \
"No AWS settings found"
assert settings.AWS.get('ACCESS_KEY'), \
"AWS access key is not set in settings"
assert settings.AWS.get('SECRET_KEY'), \
"AWS secret key is not set ... | import string
import random
from django.conf import settings
def validate_settings():
assert settings.AWS, \
"No AWS settings found"
assert settings.AWS.get('ACCESS_KEY'), \
"AWS access key is not set in settings"
assert settings.AWS.get('SECRET_KEY'), \
"AWS secret key is not set ... |
Fix incorrect import for FxOS nav tests. | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import pytest
from pages.firefox.family_navigation import FirefoxPage
@pytest.mark.nondestructive
@pytest.mark.parame... | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import pytest
from pages.firefox.fxos_navigation import FirefoxPage
@pytest.mark.nondestructive
@pytest.mark.parametr... |
Replace index_to_column_id with iterative fx
The recursive one was neat but a bit too clever. | # -*- coding: utf-8 -*-
# Part of the masterfile package: https://github.com/njvack/masterfile
# Copyright (c) 2017 Board of Regents of the University of Wisconsin System
# Written by Nate Vack <njvack@wisc.edu> at the Center for Healthy Minds
# at the University of Wisconsin-Madison.
# Released under MIT licence; see... | # -*- coding: utf-8 -*-
# Part of the masterfile package: https://github.com/njvack/masterfile
# Copyright (c) 2017 Board of Regents of the University of Wisconsin System
# Written by Nate Vack <njvack@wisc.edu> at the Center for Healthy Minds
# at the University of Wisconsin-Madison.
# Released under MIT licence; see... |
Modify not to create message unless joining the thread. | define([
'underscore', 'controllers/ApplicationController', 'models/Thread', 'models/Message', 'utils/Utils'
], function(_, ApplicationController, Thread, Message, Utils) {
var MessageController = Utils.inherit(ApplicationController, function(networkAgent) {
ApplicationController.call(this, networkAgent);
});... | define([
'underscore', 'controllers/ApplicationController', 'models/Thread', 'models/Message', 'utils/Utils'
], function(_, ApplicationController, Thread, Message, Utils) {
var MessageController = Utils.inherit(ApplicationController, function(networkAgent) {
ApplicationController.call(this, networkAgent);
});... |
Check if file exists before reading. | <?php
require __DIR__ . '/../vendor/autoload.php';
$configfile = __DIR__.'/config.json';
$config = false;
if (file_exists($configfile)) {
$config = json_decode(file_get_contents(__DIR__.'/config.json'), true);
}
if ($config == false) {
$user = getenv('CP_USER');
$pass = getenv('CP_PASSWORD');
} else {
... | <?php
require __DIR__ . '/../vendor/autoload.php';
$config = json_decode(file_get_contents(__DIR__.'/config.json'), true);
if ($config == false) {
$user = getenv('CP_USER');
$pass = getenv('CP_PASSWORD');
} else {
$user = $config['CP_USER'];
$pass = $config['CP_PASSWORD'];
}
define('CP_USER', $user);
... |
Set max_workers the same as max_size. | # -*- coding: utf-8 -*-
from blackgate.executor import QueueExecutor
from tornado.ioloop import IOLoop
class ExecutorPools(object):
class PoolFull(Exception):
pass
class ExecutionTimeout(Exception):
pass
class ExecutionFailure(Exception):
pass
def __init__(self):
s... | # -*- coding: utf-8 -*-
from blackgate.executor import QueueExecutor
from tornado.ioloop import IOLoop
class ExecutorPools(object):
class PoolFull(Exception):
pass
class ExecutionTimeout(Exception):
pass
class ExecutionFailure(Exception):
pass
def __init__(self):
s... |
Add value for parameter "fiat" in method fetch_coin | import notify2
import Rates
def notify():
icon_path = "/home/dushyant/Desktop/Github/Crypto-Notifier/logo.jpg"
cryptocurrencies = ["bitcoin",
"ethereum",
"litecoin",
"monero",
"ripple",
"d... | import notify2
import Rates
def notify():
icon_path = "/home/dushyant/Desktop/Github/Crypto-Notifier/logo.jpg"
cryptocurrencies = ["bitcoin",
"ethereum",
"litecoin",
"monero",
"ripple",
"d... |
Fix license MIT to BSD | """A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'DESCRIPTION.rst'),... | """A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
from setuptools import setup, find_packages
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'DESCRIPTION.rst'),... |
Format go to the new design | from genes import apt, brew, pacman, http_downloader, checksum, msiexec
import platform
opsys = platform.system()
dist = platform.linux_distribution()
if platform == 'Linux' and dist == 'Arch':
pacman.update()
pacman.sync('go')
if platform == 'Linux' and (dist == 'Debian' or dist == 'Ubuntu'):
apt.upd... | from evolution_master.runners import pkg, download
# Install for Arch
with pkg.pacman() as pkg_man:
pkg_man.install('go')
# Install for Debian & Ubuntu
with pkg.apt() as pkg_man:
pkg_man.install('golang')
# TODO: make this a runner and require a switch to enable this
pkg_man.install('golang-go-darwin-... |
Add parenthesis around lambda arg | package com.bpedman.lambdas;
import java.util.Arrays;
import java.util.List;
import java.util.stream.IntStream;
/**
* @author Brandon Pedersen <bpedersen@getjive.com>
*/
public class Example_03
{
/**
* Less lines of code but you still need to read the predicate lambda to understand what is
* happening... | package com.bpedman.lambdas;
import java.util.Arrays;
import java.util.List;
import java.util.stream.IntStream;
/**
* @author Brandon Pedersen <bpedersen@getjive.com>
*/
public class Example_03
{
/**
* Less lines of code but you still need to read the predicate lambda to understand what is
* happening... |
Make default options map unmodifiable | package me.coley.recaf.decompile;
import me.coley.recaf.workspace.Workspace;
import java.util.*;
/**
* Decompiler base.
*
* @author Matt.
*/
public abstract class Decompiler<OptionType> {
private final Map<String, OptionType> defaultOptions = Collections.unmodifiableMap(generateDefaultOptions());
private Map<S... | package me.coley.recaf.decompile;
import me.coley.recaf.workspace.Workspace;
import java.util.Map;
/**
* Decompiler base.
*
* @author Matt.
*/
public abstract class Decompiler<OptionType> {
private final Map<String, OptionType> defaultOptions = generateDefaultOptions();
private Map<String, OptionType> options ... |
Clean up analytics index action test | <?php
namespace Backend\Modules\Analytics\Tests\Action;
use Backend\Core\Tests\BackendWebTestCase;
use Symfony\Bundle\FrameworkBundle\Client;
class IndexTest extends BackendWebTestCase
{
public function testAuthenticationIsNeeded(Client $client): void
{
$this->assertAuthenticationIsNeeded($client, '/... | <?php
namespace Backend\Modules\Analytics\Tests\Action;
use Backend\Core\Tests\BackendWebTestCase;
use Symfony\Bundle\FrameworkBundle\Client;
class IndexTest extends BackendWebTestCase
{
public function testAuthenticationIsNeeded(Client $client): void
{
$this->assertAuthenticationIsNeeded($client, '/... |
Fix db migration merge conflicts | """empty message
Revision ID: 0074_update_sms_rate
Revises: 0073_add_international_sms_flag
Create Date: 2017-04-24 12:10:02.116278
"""
import uuid
revision = '0074_update_sms_rate'
down_revision = '0073_add_international_sms_flag'
from alembic import op
def upgrade():
op.get_bind()
op.execute("INSERT IN... | """empty message
Revision ID: 0074_update_sms_rate
Revises: 0072_add_dvla_orgs
Create Date: 2017-04-24 12:10:02.116278
"""
import uuid
revision = '0074_update_sms_rate'
down_revision = '0072_add_dvla_orgs'
from alembic import op
def upgrade():
op.get_bind()
op.execute("INSERT INTO provider_rates (id, val... |
Use config file in import script | import MySQLdb
import json
# Download Guest List.csv from Facebook event page and copy it to a file named
# 'list.csv'. Remove the first line (column title) and the '"'s around each
# name (they cause trouble with MySQL)
filename = "list.csv"
data = open(filename, 'r')
guests = []
# Config Setup
config_file = open('c... | import MySQLdb
# Download Guest List.csv from Facebook event page and copy it to a file named
# 'list.csv'. Remove the first line (column title) and the '"'s around each
# name (they cause trouble with MySQL)
filename = "list.csv"
data = open(filename, 'r');
guests = [];
db_host = "" # Add your host
db_user = "" # Ad... |
Fix and ungodly number of linter errors | var jwt = require('jwt-simple');
module.exports = {
// Getus user from db, returns a promise of that user
applyToUser: function (user) {
if ((typeof user) === 'string') {
user = {username: user};
}
return findUser({username: username})
.then(function (user) {
if (!user) {
next(... | var jwt = require('jwt-simple');
module.exports = {
// Getus user from db, returns a promise of that user
applyToUser: function(user) {
if (typeof(user) === 'string') {
user = {username: user};
}
return findUser({username: username})
.then(function (user) {
if (!user) {
next(ne... |
Use project for monkey patch, instead of assuming NPM structure. | /* jshint node: true */
'use strict';
var VersionChecker = require('ember-cli-version-checker');
module.exports = {
name: 'ember-resolver',
init: function() {
var checker = new VersionChecker(this);
var dep = checker.for('ember-cli', 'npm');
if (!dep.satisfies('>= 2.0.0')) {
this.monkeyPatchVe... | /* jshint node: true */
'use strict';
var VersionChecker = require('ember-cli-version-checker');
module.exports = {
name: 'ember-resolver',
init: function() {
var checker = new VersionChecker(this);
var dep = checker.for('ember-cli', 'npm');
if (!dep.satisfies('>= 2.0.0')) {
this.monkeyPatchVe... |
Remove reference to old, bad migration that was in my local tree. | # -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-07-24 22:43
from __future__ import unicode_literals
import django.contrib.postgres.fields.jsonb
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('contentcuration', '0089_auto_20180706_2242'),
]
... | # -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2018-07-24 22:43
from __future__ import unicode_literals
import django.contrib.postgres.fields.jsonb
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('contentcuration', '0090_auto_20180724_1625'),
]
... |
Add null check for cancelled attempt too select profile file | package fortiss.gui.listeners.button;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import fortiss.components.Demand;
import fortiss.gui.Designer;
import fortiss.gui.listeners.helper.Chooser;
public class DBrowseListener extends MouseAdapter {
@Override
public void mouseClicked(MouseEvent ... | package fortiss.gui.listeners.button;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import fortiss.components.Demand;
import fortiss.gui.Designer;
import fortiss.gui.listeners.helper.Chooser;
public class DBrowseListener extends MouseAdapter {
@Override
public void mouseClicked(MouseEvent ... |
Remove user from connections upon disconnect | var models = require('../db/models.js');
var io;
var connections = {};
var events = {
//input: {userToken: string}
init: function(data) {
connections[data.userToken] = this;
this.emit('init');
},
//input: {userToken: string, messageId: string}
upvote: function(data) {
models.createVote(data)
... | var models = require('../db/models.js');
var io;
var connections = {};
var events = {
//input: {userToken: string}
init: function(data) {
connections[data.userToken] = this;
this.emit('init');
},
//input: {userToken: string, messageId: string}
upvote: function(data) {
models.createVote(data)
... |
Update the API URL to filter non-article contributions. | <?php
//language
if(!paramExists("lang")) {respond("missing parameter!");}
$language=$_REQUEST["lang"];
//username
if(!paramExists("user")) {respond("missing parameter!");}
$username=$_REQUEST["user"];
//create the request url
$apiUrl="http://$language.wikipedia.org/w/api.php?action=feedcontributions&namespace=0&form... | <?php
//language
if(!paramExists("lang")) {respond("missing parameter!");}
$language=$_REQUEST["lang"];
//username
if(!paramExists("user")) {respond("missing parameter!");}
$username=$_REQUEST["user"];
//create the request url
$apiUrl="http://$language.wikipedia.org/w/api.php?action=feedcontributions&format=xml&feedf... |
Move return to inside try
It is easy to understand if 'return' statement is moved
inside try clause and there is no need to initialize a value.
Follow-up minor fixes for review 276086
Change-Id: I3968e1702c0129ae02517e817da189ca137e7ab4 | # Copyright 2015-2016 NEC Corporation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | # Copyright 2015-2016 NEC Corporation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... |
Add dependencies, update for module name change | #! /usr/bin/env python
import os, glob
from distutils.core import setup
NAME = 'bacula_configuration'
VERSION = '0.1'
WEBSITE = 'http://gallew.org/bacula_configuration'
LICENSE = 'GPLv3 or later'
DESCRIPTION = 'Bacula configuration management tool'
LONG_DESCRIPTION = 'Bacula is a great backup tool, but ships with no w... | #! /usr/bin/env python
import os, glob
from distutils.core import setup
NAME = 'bacula_configuration'
VERSION = '0.1'
WEBSITE = 'http://gallew.org/bacula_configuration'
LICENSE = 'GPLv3 or later'
DESCRIPTION = 'Bacula configuration management tool'
LONG_DESCRIPTION = 'Bacula is a great backup tool, but ships with no w... |
Fix config path difference (W vs w) | <?php
namespace Hyperized\WeFact;
use Illuminate\Support\ServiceProvider;
class WefactServiceProvider extends ServiceProvider {
/**
* Indicates if loading of the provider is deferred.
*
* @var bool $defer
*/
protected $defer = false;
/**
* Bootstrap the application services.
*
* @return ... | <?php
namespace Hyperized\WeFact;
use Illuminate\Support\ServiceProvider;
class WefactServiceProvider extends ServiceProvider {
/**
* Indicates if loading of the provider is deferred.
*
* @var bool $defer
*/
protected $defer = false;
/**
* Bootstrap the application services.
*
* @return ... |
Add an explanation detailing behavior of doneCountBuilder. | window.respokeTestConfig = {
baseURL: 'http://testing.digiumlabs.com:3001'
};
respoke.log.setLevel('silent');
window.doneOnceBuilder = function (done) {
var called = false;
return function (err) {
if (!called) {
called = true;
done(err);
}
};
};
// build a functi... | window.respokeTestConfig = {
baseURL: 'http://testing.digiumlabs.com:3001'
};
respoke.log.setLevel('silent');
window.doneOnceBuilder = function (done) {
var called = false;
return function (err) {
if (!called) {
called = true;
done(err);
}
};
};
window.doneCountB... |
Fix imports for Django 1.6 and above | # Copyright (C) 2010-2012 Yaco Sistemas (http://www.yaco.es)
# Copyright (C) 2009 Lorenzo Gil Sanchez <lorenzo.gil.sanchez@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... | # Copyright (C) 2010-2012 Yaco Sistemas (http://www.yaco.es)
# Copyright (C) 2009 Lorenzo Gil Sanchez <lorenzo.gil.sanchez@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# ... |
Use the CAPI_DEVICE_PATH property in blockmap tests | /* IBM_PROLOG_BEGIN_TAG
* This is an automatically generated prolog.
*
* $Source: src/java/test/blockmap/com/ibm/research/blockmap/CapiTestSupport.java $
*
* IBM Data Engine for NoSQL - Power Systems Edition User Library Project
*
* Contributors Listed Below - COPYRIGHT 2015,2016,2017
* [+] International Busine... | /* IBM_PROLOG_BEGIN_TAG
* This is an automatically generated prolog.
*
* $Source: src/java/test/blockmap/com/ibm/research/blockmap/CapiTestSupport.java $
*
* IBM Data Engine for NoSQL - Power Systems Edition User Library Project
*
* Contributors Listed Below - COPYRIGHT 2015,2016,2017
* [+] International Busine... |
CC-5781: Upgrade script for new storage quota implementation | <?php
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../../install_minimal/../airtime_mvc/application'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
get_include_path(),
realpath(... | <?php
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../../install_minimal/../airtime_mvc/application'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
get_include_path(),
realpath(... |
Handle now returning Promise function | import {_string, _comment, p, pp} from '../universal/base';
import {_formatError} from './error';
window.console = window.console || {};
const _fnOrig = {};
function _interceptNativeConsoleFn(name) {
_fnOrig[name] = window.console[name];
const {map} = Array.prototype;
window.console[name] = function () {
l... | import {_string, _comment, p, pp} from '../universal/base';
import {_formatError} from './error';
window.console = window.console || {};
const _fnOrig = {};
function _interceptNativeConsoleFn(name) {
_fnOrig[name] = window.console[name];
const {map} = Array.prototype;
window.console[name] = function () {
l... |
Revert "[mh-14] "This import is ultimately just from django.contrib.auth.models import User - using that directly would probably address whatever circular import required that this import get put here, and make it clearer which model User is."-Dane"
This reverts commit 7350c56339acaef416d03b6d7ae0e818ab8db182. | import re
from django.core.exceptions import ValidationError
from django.core.validators import EmailValidator, RegexValidator
# First Name, Last Name: At least one alphanumeric character.
name_validator = RegexValidator(
regex=r'\w',
flags=re.U,
message='Please enter your name'
)
# Email: valid email add... | import re
from django.core.exceptions import ValidationError
from django.core.validators import EmailValidator, RegexValidator
from django.contrib.auth.models import User
# First Name, Last Name: At least one alphanumeric character.
name_validator = RegexValidator(
regex=r'\w',
flags=re.U,
message='Please ... |
bug: Remove description from Restaurant class | import sys
from sqlalchemy import Column, ForeignKey, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
from sqlalchemy import create_engine
Base = declarative_base()
class Restaurant(Base):
__tablename__ = 'restaurant'
name = Column(String(80),... | import sys
from sqlalchemy import Column, ForeignKey, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
from sqlalchemy import create_engine
Base = declarative_base()
class Restaurant(Base):
__tablename__ = 'restaurant'
name = Column(String(80),... |
Add Window functions to attempt partial sum |
# Knapsack 0-1 function wieights, values and size n.
import sys
import pyspark.sql.functions as func
from pyspark.sql.window import Window
from pyspark.sql import Row
from pyspark.sql.functions import lit
from pyspark.sql.functions import col
# Greedy implementation of 0-1 Knapsack algorithm.
def knapsack(knapsackDF... |
# Knapsack 0-1 function wieights, values and size n.
from pyspark.sql import Row
from pyspark.sql.functions import lit
from pyspark.sql.functions import col
# Greedy implementation of 0-1 Knapsack algorithm.
def knapsack(knapsackDF, W):
ratioDF = knapsackDF.withColumn("ratio", lit(knapsackDF.values / knapsackDF.w... |
Fix compression tests for legacy IE; make compression tests test for size rather than exact value stored | var { deepEqual } = require('../tests/util')
module.exports = {
plugin: require('./compression'),
setup: setup,
}
function setup(store) {
test('string compression size', function() {
var str = 'foo'
var serialized = store._serialize(str)
store.set('foo', str)
assert(store.raw.get('foo').length < serialized... | var { deepEqual } = require('../tests/util')
module.exports = {
plugin: require('./compression'),
setup: setup,
}
function setup(store) {
test('string compression', function() {
store.set('foo', 'baz')
assert(store.raw.get('foo') == 'ᄂゆ䀀', 'string should be lz compressed')
assert(store.get('foo') == 'baz', ... |
Add an entry in URLs configuration for image support. | from django.conf.urls import include, url
from django.conf import settings
from django.contrib import admin
from wagtail.wagtailadmin import urls as wagtailadmin_urls
from wagtail.wagtaildocs import urls as wagtaildocs_urls
from wagtail.wagtailcore import urls as wagtail_urls
from wagtail.wagtailimages import urls as... | from django.conf.urls import include, url
from django.conf import settings
from django.contrib import admin
from wagtail.wagtailadmin import urls as wagtailadmin_urls
from wagtail.wagtaildocs import urls as wagtaildocs_urls
from wagtail.wagtailcore import urls as wagtail_urls
urlpatterns = [
url(r'^django-admin/... |
FIX disable product supplier pricelist | # -*- coding: utf-8 -*-
{
'name': 'Product Supplier Pricelist',
'version': '1.0',
'category': 'Product',
'sequence': 14,
'summary': '',
'description': """
Product Supplier Pricelist
==========================
Add sql constraint to restrict:
1. That you can only add one supplier to a product pe... | # -*- coding: utf-8 -*-
{
'name': 'Product Supplier Pricelist',
'version': '1.0',
'category': 'Product',
'sequence': 14,
'summary': '',
'description': """
Product Supplier Pricelist
==========================
Add sql constraint to restrict:
1. That you can only add one supplier to a product pe... |
Include detail in "The listed user cannot be searched" message | let index = 0;
const logEntries = [];
for (let i = 0; i < 500; i++) {
logEntries.push(null);
}
export function getLog() {
return logEntries;
}
export function log(name, message) {
logEntries.shift();
logEntries.push({
index: index++,
date: (new Date()).toISOString(),
level: 'log',
name,
mes... | let index = 0;
const logEntries = [];
for (let i = 0; i < 500; i++) {
logEntries.push(null);
}
export function getLog() {
return logEntries;
}
export function log(name, message) {
logEntries.shift();
logEntries.push({
index: index++,
date: (new Date()).toISOString(),
level: 'log',
name,
mes... |
Remove unused keys from manifest. | # -*- coding: utf-8 -*-
# © 2015 Antiun Ingeniería S.L. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Set Snippet's Anchor",
"summary": "Allow to reach a concrete section in the page",
"version": "8.0.1.0.0",
"category": "Website",
"website": "http://... | # -*- coding: utf-8 -*-
# © 2015 Antiun Ingeniería S.L. - Jairo Llopis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Set Snippet's Anchor",
"summary": "Allow to reach a concrete section in the page",
"version": "8.0.1.0.0",
"category": "Website",
"website": "http://... |
Verify that type 4 fields are parsed correctly
See #13 | var assert = require("assert");
var parseApk = require("..");
describe("APK V24", function () {
var output = null;
before(function (done) {
parseApk(__dirname + "/samples/test_v24.apk", function (err, out) {
if (err) {
return done(err);
}
output = ou... | var assert = require("assert");
var parseApk = require("..");
describe("APK V24", function () {
var output = null;
before(function (done) {
parseApk(__dirname + "/samples/test_v24.apk", function (err, out) {
if (err) {
return done(err);
}
output = ou... |
Remove oversampling; use 20 percent instead | #!/usr/bin/env python
import random
from nott_params import *
num_samples = int(gridDim[0] * gridDim[1] * 0.2)
def generate_data(numx, numy):
stimulus = (random.randint(0, numx - 1), random.randint(0, numy - 1))
return stimulus
def print_header():
print("{0} {1} {2}".format(num_samples, num_inputs, num_... | #!/usr/bin/env python
import random
from nott_params import *
num_samples = int(gridDim[0] * gridDim[1] * 10)
def generate_data(numx, numy):
stimulus = (random.randint(0, numx - 1), random.randint(0, numy - 1))
return stimulus
def print_header():
print("{0} {1} {2}".format(num_samples, num_inputs, num_o... |
Set example logLevel to 'info' | const iris = require('../index');
const dock = require('./docks/http');
const handler = require('./handlers/handler1');
const inputHook = require('./hooks/hook1');
const outputHook = require('./hooks/hook2');
iris.config = {
threads: 4,
logLevel: 'info',
events: {
dispatcher: true,
docks: t... | const iris = require('../index');
const dock = require('./docks/http');
const handler = require('./handlers/handler1');
const inputHook = require('./hooks/hook1');
const outputHook = require('./hooks/hook2');
iris.config = {
threads: 4,
logLevel: 'silly',
events: {
dispatcher: true,
docks: ... |
Add .urban as Urban Dictionary alias. | from plumeria.command import commands, CommandError
from plumeria.util import http
from plumeria.util.ratelimit import rate_limit
@commands.register("urban", "urb", category="Search")
@rate_limit()
async def urban_dictionary(message):
"""
Search Urban Dictionary for a word.
"""
q = message.content.st... | from plumeria.command import commands, CommandError
from plumeria.util import http
from plumeria.util.ratelimit import rate_limit
@commands.register("urbandict", "urb", category="Search")
@rate_limit()
async def urban_dictionary(message):
"""
Search Urban Dictionary for a word.
"""
q = message.conten... |
EST-495: Add Electrical Substation and Land as unit type | /*
*
* Copyright 2012-2014 Eurocommercial Properties NV
*
*
* 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 req... | /*
*
* Copyright 2012-2014 Eurocommercial Properties NV
*
*
* 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 req... |
Fix enter key on Collaborative Room selection. | var mapSketcherClient;
jQuery(function() {
jQuery.getJSON('/config.json', function(config) {
config.hostname = window.location.hostname
mapSketcherClient = new MapSketcherClient(config);
mapSketcherClient.launch();
});
$("a[rel]").overlay({
mask: {
color: '#ebecff'
, loadSpeed: 200
, opaci... | var mapSketcherClient;
jQuery(function() {
jQuery.getJSON('/config.json', function(config) {
config.hostname = window.location.hostname
mapSketcherClient = new MapSketcherClient(config);
mapSketcherClient.launch();
});
$("a[rel]").overlay({
mask: {
color: '#ebecff'
, loadSpeed: 200
, opaci... |
refactor(createUserReducer): Add initial user redux state. | import update from 'immutability-helper'
// TODO: port user-specific code from the otp reducer.
function createUserReducer () {
const initialState = {
accessToken: null,
loggedInUser: null,
loggedInUserMonitoredTrips: null,
pathBeforeSignIn: null
}
return (state = initialState, action) => {
... | import update from 'immutability-helper'
// TODO: port user-specific code from the otp reducer.
function createUserReducer () {
const initialState = {}
return (state = initialState, action) => {
switch (action.type) {
case 'SET_CURRENT_USER': {
return update(state, {
accessToken: { $se... |
Fix paths to data files | package config
import (
"flag"
"github.com/vharitonsky/iniflags"
)
var (
Name = flag.String("name", "tad", "Nick to use in IRC")
Server = flag.String("server", "127.0.0.1:6668", "Host:Port to connect to")
Channels = flag.String("chan", "#tad", "Channels to join")
Ssl = flag.Bool("ssl", false, "Use S... | package config
import (
"flag"
"github.com/vharitonsky/iniflags"
)
var (
Name = flag.String("name", "tad", "Nick to use in IRC")
Server = flag.String("server", "127.0.0.1:6668", "Host:Port to connect to")
Channels = flag.String("chan", "#tad", "Channels to join")
Ssl = flag.Bool("ssl", false, "Use S... |
Check if dir exists before calling listdir
Changes along the way to how we clean up and detach after
copying an image to a volume exposed a problem in the cleanup
of the brick/initiator routines.
The clean up in the initiator detach was doing a blind listdir
of /dev/disk/by-path, however due to detach and cleanup bei... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apac... | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apac... |
Fix get_backend doesn't actually return a backend | from armstrong.utils.backends import GenericBackend
def get_template_names(blast, recipient_list, recipient):
return [
'tt_dailyemailblast/%s/%s/%s.html' % (blast.blast_type.slug,
recipient_list.slug, recipient.slug),
'tt_dailyemailblast/%s/%s.html' % (blast.blast_type.slug,
... | from armstrong.utils.backends import GenericBackend
def get_template_names(blast, recipient_list, recipient):
return [
'tt_dailyemailblast/%s/%s/%s.html' % (blast.blast_type.slug,
recipient_list.slug, recipient.slug),
'tt_dailyemailblast/%s/%s.html' % (blast.blast_type.slug,
... |
Enable source maps in demo | module.exports = {
entry: './docs/App.jsx',
output: {
filename: './docs/bundle.js'
},
devServer: {
inline: true
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel',
query: {
presets: [
'react',
... | module.exports = {
entry: './docs/App.jsx',
output: {
filename: './docs/bundle.js'
},
devServer: {
inline: true
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel',
query: {
presets: [
'react',
... |
Check that init is a function | var i = (function() {
'use strict';
return {
c: function(obj, args) {
if (arguments.length > 0) {
var newObj = Object.create(arguments[0]);
if ('init' in newObj && typeof newObj.init === 'function') {
if (arguments.length > 1) {
var args = [];
for (var i =... | var i = (function() {
'use strict';
return {
c: function(obj, args) {
if (arguments.length > 0) {
var newObj = Object.create(arguments[0]);
if ('init' in newObj) {
if (arguments.length > 1) {
var args = [];
for (var i = 1; i < arguments.length; i++) {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.