text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Fix comment and improve readability | // Copyright (c) 2015, Peter Mrekaj. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE.txt file.
package heaps
// reverseInts reverse elements of an[i:j] in an.
func reverseInts(an []int, i, j int) {
for i < j {
an[i], an[j] = an[j], an[i]
i++
... | // Copyright (c) 2015, Peter Mrekaj. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE.txt file.
package heaps
// reverseInts reverse elements of an[i:j] in an.
func reverseInts(an []int, i, j int) {
for i < j {
an[i], an[j] = an[j], an[i]
i++
... |
Fix for regression test, since we rely on the formatter for std::vector in the test we need a libc++ category.
See differential https://reviews.llvm.org/D59847 for initial change that this fixes
git-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@357210 91177308-0d34-0410-b5e6-96231b3b80d8 | """
Test Expression Parser regression test to ensure that we handle enums
correctly, in this case specifically std::vector of enums.
"""
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestVectorOfEnums(TestBase):
mydir = TestBase... | """
Test Expression Parser regression test to ensure that we handle enums
correctly, in this case specifically std::vector of enums.
"""
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
class TestVectorOfEnums(TestBase):
mydir = TestBase... |
Mark UIExamples as a prototype
Summary: Ref T9103. This application is only useful for developing Phabricator, and in general is not kept "production ready". Mark it as a prototype.
Test Plan: visit /applications/, see it marked as prototype.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: Korvin
Manip... | <?php
final class PhabricatorUIExamplesApplication extends PhabricatorApplication {
public function getBaseURI() {
return '/uiexample/';
}
public function getShortDescription() {
return pht('Developer UI Examples');
}
public function getName() {
return pht('UIExamples');
}
public function... | <?php
final class PhabricatorUIExamplesApplication extends PhabricatorApplication {
public function getBaseURI() {
return '/uiexample/';
}
public function getShortDescription() {
return pht('Developer UI Examples');
}
public function getName() {
return pht('UIExamples');
}
public function... |
Convert to new bindShared method on container. | <?php namespace Illuminate\Validation;
use Illuminate\Support\ServiceProvider;
class ValidationServiceProvider extends ServiceProvider {
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = true;
/**
* Register the service provider.
*
* @return... | <?php namespace Illuminate\Validation;
use Illuminate\Support\ServiceProvider;
class ValidationServiceProvider extends ServiceProvider {
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = true;
/**
* Register the service provider.
*
* @return... |
Implement shutdown command for Windows | // Initial timer length in seconds
var timerCount = 15,
remote = require('electron').remote,
arguments = remote.getGlobal('sharedObject').prop1;
// debug mode ensures that computer doesnt shut down while testing
// npm start --debug
if (arguments[2] == '--debug') {
console.log('Debug mode enabled');
var de... | // Initial timer length in seconds
var timerCount = 15,
remote = require('electron').remote,
arguments = remote.getGlobal('sharedObject').prop1;
// debug mode ensures that computer doesnt shut down while testing
// npm start --debug
if (arguments[2] == '--debug') {
console.log('Debug mode enabled');
var de... |
Change nodelist.foreach to a normal for loop
This should bring much greater browser compatibility the the nodelist foreach allowing it to work on all the major browser vendors.
Fixes #95 | /* Cached Variables *******************************************************************************/
var context = sessionStorage.getItem('context');
var rowThumbnails = document.querySelector('.row-thumbnails');
/* Initialization *********************************************************************************/
rowTh... | /* Cached Variables *******************************************************************************/
var context = sessionStorage.getItem('context');
var rowThumbnails = document.querySelector('.row-thumbnails');
/* Initialization *********************************************************************************/
rowTh... |
Add //bindings_list = ['sidorares-nodejs-mysql-native'] for tests | #!/usr/bin/env node
/*
Copyright (C) 2010, Oleg Efimov <efimovov@gmail.com>
See license text in LICENSE file
*/
var
bindings_list = ['Sannis-node-mysql-libmysqlclient', 'felixge-node-mysql', /*'stevebest-node-mysql',*/ 'PHP-MySQL'],
//bindings_list = ['sidorares-nodejs-mysql-native'],
sys = require('sys'),
de... | #!/usr/bin/env node
/*
Copyright (C) 2010, Oleg Efimov <efimovov@gmail.com>
See license text in LICENSE file
*/
var
bindings_list = ['Sannis-node-mysql-libmysqlclient', 'felixge-node-mysql', /*'stevebest-node-mysql',*/ 'PHP-MySQL'],
sys = require('sys'),
default_factor = 1,
factor = default_factor,
cfg;
if... |
Update the startup command to use the new version of the rug
Change-Id: Ie014dcfb0974b048025aeff96b16a868f672b84a
Signed-off-by: Rosario Di Somma <73b2fe5f91895aea2b4d0e8942a5edf9f18fa897@dreamhost.com> | from setuptools import setup, find_packages
setup(
name='akanda-rug',
version='0.1.5',
description='Akanda Router Update Generator manages tenant routers',
author='DreamHost',
author_email='dev-community@dreamhost.com',
url='http://github.com/dreamhost/akanda-rug',
license='BSD',
instal... | from setuptools import setup, find_packages
setup(
name='akanda-rug',
version='0.1.5',
description='Akanda Router Update Generator manages tenant routers',
author='DreamHost',
author_email='dev-community@dreamhost.com',
url='http://github.com/dreamhost/akanda-rug',
license='BSD',
instal... |
Switch in/out degree for neighbor rank
Edges point in the direction of time, or influence. That means we're
concerned with outdegree (amount of nodes influenced by the current
node), not indegree (amount of nodes that influence the current node). | import networkx as nx
import util
def neighborrank(graph, n=100, neighborhood_depth=2):
"""Compute the NeighborRank of the top n nodes in graph, using the
specified neighborhood_depth."""
# Get top n nodes with highest outdegree (most often cited).
nodes = util.top_n_from_dict(graph.out_degree(), n=n)
... | import networkx as nx
import util
def neighborrank(graph, n=100, neighborhood_depth=2):
"""Compute the NeighborRank of the top n nodes in graph, using the
specified neighborhood_depth."""
# Get top n nodes with highest indegree (most often cited).
nodes = util.top_n_from_dict(graph.in_degree(), n=n)
... |
Rename angular-mocks path and shim | // requiring global requireJS config
require(['/base/config/require.conf.js'], function() {
'use strict';
// first require.config overload: Karma specific
require.config({
baseUrl: '/base/src',
paths: {
'angular-mocks': '../bower_components/angular-mocks/angular-mocks'
},
shim: {
'a... | // requiring global requireJS config
require(['/base/config/require.conf.js'], function() {
'use strict';
// first require.config overload: Karma specific
require.config({
baseUrl: '/base/src',
paths: {
'angularMocks': '../bower_components/angular-mocks/angular-mocks'
},
shim: {
'an... |
Put timestamp first in output | //! dnajs-smart-update-websockets ~ MIT License
const app = {
wsUrl: 'ws://localhost:7777/',
ws: null, //instance of WebSocket
wsSend: (message) => {
message = { timestamp: Date.now(), ...message };
app.log({ outgoing: message });
app.ws.send(JSON.stringify(message));
},
wsHandleMe... | //! dnajs-smart-update-websockets ~ MIT License
const app = {
wsUrl: 'ws://localhost:7777/',
ws: null, //instance of WebSocket
wsSend: (message) => {
message.timestamp = Date.now();
app.log({ outgoing: message });
app.ws.send(JSON.stringify(message));
},
wsHandleMessageEvent: (even... |
Update TreeBuilder instantiation - fixing 4.3 deprecation | <?php
namespace AshleyDawson\GlideBundle\DependencyInjection;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
/**
* Class Configuration
*
* @package AshleyDawson\GlideBundle\DependencyInjection
*/
class Configuration implements Configur... | <?php
namespace AshleyDawson\GlideBundle\DependencyInjection;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
/**
* Class Configuration
*
* @package AshleyDawson\GlideBundle\DependencyInjection
*/
class Configuration implements Configur... |
Remove languages from Pencil and update logo image | <div id="frame">
<header class="main">
<!--<div id="menu-idiomas">[ [COMPONENT name=MenuLanguages]]</div>-->
<div class="logo">[[COMPONENT name=Image id=logo style=height:60]]</div>
<h1><a href="/">[[COMPONENT name=Label text=Título id=title]]</a></h1>
<h2>[[COMPONENT name=Label text=Subtítulo id=subtitle]]</h... | <div id="frame">
<header class="main">
<div id="menu-idiomas">[ [COMPONENT name=MenuLanguages]]</div>
<div class="logo">[[COMPONENT name=Image style=height:60 id=1]]</div>
<h1><a href="/">[[COMPONENT name=Label text=Título id=title]]</a></h1>
<h2>[[COMPONENT name=Label text=Subtítulo id=subtitle]]</h2>
</head... |
Make sure Counter implementation expvar.Var | package metrics
import (
"strconv"
"sync/atomic"
)
type Counter interface {
Inc(delta int64)
Dec(delta int64)
Set(delta int64)
Count() int64
String() string
}
type atomicCounter int64
func NewCounter() Counter {
c := atomicCounter(int64(0))
return &c
}
func (c *atomicCounter) Inc(delta int64) {
atomic.Ad... | package metrics
import (
"strconv"
"sync/atomic"
)
type Counter interface {
Inc(delta int64)
Dec(delta int64)
Set(delta int64)
Count() int64
}
type atomicCounter int64
func NewCounter() Counter {
c := atomicCounter(int64(0))
return &c
}
func (c *atomicCounter) Inc(delta int64) {
atomic.AddInt64((*int64)(c... |
Add link to Code of Conduct in Menu | <?php
/*******************************************************************************
* Copyright (c) 2015 Eclipse Foundation and others.
* 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,... | <?php
/*******************************************************************************
* Copyright (c) 2015 Eclipse Foundation and others.
* 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,... |
Increase number of results to choose from | #! /usr/bin/env node
var http = require('http');
// http://www.reddit.com/r/jokes
//
var request = http.get('http://www.reddit.com/r/oneliners/hot.json?limit=50', function (response) {
var responseBody = '';
// concatenate data chunks to responseBody
response.on('data', function (dataChunk) {
responseBody ... | #! /usr/bin/env node
var http = require('http');
// http://www.reddit.com/r/jokes
//
var request = http.get('http://www.reddit.com/r/oneliners/hot.json?limit=10', function (response) {
var responseBody = '';
// concatenate data chunks to responseBody
response.on('data', function (dataChunk) {
responseBody ... |
Add player in the test data | package entities
import "time"
var (
timeStamp int64 = time.Date(2012, time.November, 10, 23, 0, 0, 0, time.UTC).UnixNano() / 1e6
mission Mission = Mission{
Color: Color{22, 22, 22},
Source: []int{100, 200},
Target: []int{800, 150},
Type: "Attack",
CurrentTime: timeStamp,
Star... | package entities
import "time"
var (
timeStamp int64 = time.Date(2012, time.November, 10, 23, 0, 0, 0, time.UTC).UnixNano() / 1e6
mission Mission = Mission{
Color: Color{22, 22, 22},
Source: []int{100, 200},
Target: []int{800, 150},
Type: "Attack",
CurrentTime: timeStamp,
Star... |
Use proper fixtures in project tests | const path = require('path');
const expect = require('chai').expect;
const getProjectConfig = require('../../src/config/android').projectConfig;
const mockFs = require('mock-fs');
const projects = require('../fixtures/projects');
describe('Config::getProjectConfig', () => {
before(() => {
mockFs({ testDir: proj... | const path = require('path');
const expect = require('chai').expect;
const getProjectConfig = require('../../src/config/android').projectConfig;
const mockFs = require('mock-fs');
const dependencies = require('../fixtures/dependencies');
describe('Config::getProjectConfig', () => {
before(() => {
mockFs({ testD... |
Fix tunnel provider connection temporization
The mechanism to wait several seconds between connection attempts to
provide a tunnel to PersistentRelayTunnel was totally broken.
Fix it to wait 5 seconds only before creating a new tunnel, except the
very first time. | package com.genymobile.gnirehtet;
import android.net.VpnService;
import java.io.IOException;
/**
* Provide a valid {@link RelayTunnel}, creating a new one if necessary.
*/
public class RelayTunnelProvider {
private final VpnService vpnService;
private RelayTunnel tunnel;
private boolean first = true;
... | package com.genymobile.gnirehtet;
import android.net.VpnService;
import java.io.IOException;
/**
* Provide a valid {@link RelayTunnel}, creating a new one if necessary.
*/
public class RelayTunnelProvider {
private final VpnService vpnService;
private RelayTunnel tunnel;
private boolean first;
pu... |
Fix crash on init of ap-npm | import commander from 'commander';
import containerInit from './init';
import fs from 'fs';
import path from 'path';
commander
.command('serve')
.alias('s')
.description('serve ap-npm')
.option('--config', "config file to use")
.action(function(config) {
let container;
if (fs.existsSync(config)) {
... | import commander from 'commander';
import containerInit from './init';
import fs from 'fs';
import path from 'path';
commander
.command('serve')
.alias('s')
.description('serve ap-npm')
.option('--config', "config file to use")
.action(function(config) {
let container;
if (fs.existsSync(config)) {
... |
Fix Loop dependency in OrbitControls
Former-commit-id: 8a856c3abacefad6dd5679baa714fe7bc24446ee | import {Vector3} from 'three';
import {Loop} from '../../core/Loop';
import {ThreeOrbitControls} from './lib/ThreeOrbitControls';
export class OrbitModule {
constructor(params = {}) {
this.params = Object.assign({
target: new Vector3(0, 0, 0),
follow: false
}, params);
}
manager(manager) {
... | import {Vector3} from 'three';
import {ThreeOrbitControls} from './lib/ThreeOrbitControls';
export class OrbitModule {
constructor(params = {}) {
this.params = Object.assign({
target: new Vector3(0, 0, 0),
follow: false
}, params);
}
manager(manager) {
this.controls = new ThreeOrbitContr... |
Add sample configuration for normalizing ID | /**
* The root component that wraps the main app component with all
* data-related components such as `ApolloProvider`.
* This component works on all platforms.
* @flow
*/
import React, { Component } from 'react';
import {
} from 'react-native';
import { createStore, combineReducers, applyMiddleware, compose } ... | /**
* The root component that wraps the main app component with all
* data-related components such as `ApolloProvider`.
* This component works on all platforms.
* @flow
*/
import React, { Component } from 'react';
import {
} from 'react-native';
import { createStore, combineReducers, applyMiddleware, compose } ... |
Fix ResolverIntercept to maintain full import path while still normalizing the path; fixes npm support in truffle since bug >4.1.3 | const path = require("path");
function ResolverIntercept(resolver) {
this.resolver = resolver;
this.cache = {};
};
ResolverIntercept.prototype.require = function(import_path) {
// Modify import_path so the cache key is consistently the same irrespective
// of whether a user explicated .sol extension
import_... | const path = require("path");
function ResolverIntercept(resolver) {
this.resolver = resolver;
this.cache = {};
};
ResolverIntercept.prototype.require = function(import_path) {
// Modify import_path so the cache key is consistently the same irrespective
// of whether a user explicated .sol extension
import_... |
Add complex queries support for boolean types in bill api (BRCD-1316) | <?php
/**
* @package Billing
* @copyright Copyright (C) 2012-2016 BillRun Technologies Ltd. All rights reserved.
* @license GNU Affero General Public License Version 3; see LICENSE.txt
*/
/**
* Boolean type translator
*
* @package Api
* @since 5.3
*/
class Api_Translator_BooleanMode... | <?php
/**
* @package Billing
* @copyright Copyright (C) 2012-2016 BillRun Technologies Ltd. All rights reserved.
* @license GNU Affero General Public License Version 3; see LICENSE.txt
*/
/**
* Boolean type translator
*
* @package Api
* @since 5.3
*/
class Api_Translator_BooleanMode... |
Update POST route request to be JSON | var express = require('express')
var bodyParser = require('body-parser')
var app = express()
var port = process.env.PORT || 3000
app.use(bodyParser.json())
app.get('/api/days/:day', function(request, response, next){
var daysOfWeek = {
monday: 1,
tuesday:2,
wednesday: 3,
thursday: 4,
friday: 5... | var express = require('express')
var bodyParser = require('body-parser')
var app = express()
var port = process.env.PORT || 3000
app.use(bodyParser.urlencoded({ extended: true }))
app.get('/api/days/:day', function(request, response, next){
var daysOfWeek = {
monday: 1,
tuesday:2,
wednesday: 3,
th... |
Exit with non-zero when error occurs | 'use strict';
const path = require('path');
const binBuild = require('bin-build');
const log = require('logalot');
const bin = require('.');
const args = [
'-copy',
'none',
'-optimize',
'-outfile',
path.join(__dirname, '../test/fixtures/test-optimized.jpg'),
path.join(__dirname, '../test/fixtures/test.jpg')
];
... | 'use strict';
const path = require('path');
const binBuild = require('bin-build');
const log = require('logalot');
const bin = require('.');
const args = [
'-copy',
'none',
'-optimize',
'-outfile',
path.join(__dirname, '../test/fixtures/test-optimized.jpg'),
path.join(__dirname, '../test/fixtures/test.jpg')
];
... |
Fix FieldsEnabled function & add 'enabled' argument | # -*- coding: utf-8 -*-
## \package globals.fieldtests
# MIT licensing
# See: LICENSE.txt
import wx
## Tests if a wx control/instance is enabled/disabled
#
# Function for compatibility between wx versions
# \param field
# \b \e wx.Window : the wx control to check
# \param enabled
# \b \e bool : Check i... | # -*- coding: utf-8 -*-
## \package globals.fieldtests
# MIT licensing
# See: LICENSE.txt
import wx
## Tests if a wx control/instance is enabled/disabled
#
# Function for compatibility between wx versions
# \param field
# \b \e wx.Window : the wx control to check
# \param enabled
# \b \e bool : Check i... |
Add some fields to the topics model. | <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateTopicsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('topics', function(Blueprint $table)
{
$table->increments('id');
$table->s... | <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateTopicsTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('topics', function(Blueprint $table)
{
$table->increments('id');
$table->s... |
Add pytest markers for cassandra tests | import mock
import pytest
from scrapi import settings
from scrapi import database
database._manager = database.DatabaseManager(keyspace='test')
settings.DEBUG = True
settings.CELERY_ALWAYS_EAGER = True
settings.CELERY_EAGER_PROPAGATES_EXCEPTIONS = True
@pytest.fixture(autouse=True)
def harvester(monkeypatch):
... | import mock
import pytest
from scrapi import settings
settings.DEBUG = True
settings.CELERY_ALWAYS_EAGER = True
settings.CELERY_EAGER_PROPAGATES_EXCEPTIONS = True
@pytest.fixture(autouse=True)
def harvester(monkeypatch):
import_mock = mock.MagicMock()
harvester_mock = mock.MagicMock()
import_mock.return... |
Stop is not called "move stop". Woops. |
/**
* Load all external dependencies
* We use var so it's global available : ) ( not let,const)
*/
var fs = require('fs');
var _ = require('lodash');
/**
* Load all internal dependencies
*/
const cfg = require('../config.js');
var pkg = require('../package.json');
var piJS = require('./modules... |
/**
* Load all external dependencies
* We use var so it's global available : ) ( not let,const)
*/
var fs = require('fs');
var _ = require('lodash');
/**
* Load all internal dependencies
*/
const cfg = require('../config.js');
var pkg = require('../package.json');
var piJS = require('./modules... |
Change jaro-winkler to cosine similarity | from pygraphc.preprocess.ParallelPreprocess import ParallelPreprocess
from pygraphc.similarity.CosineSimilarity import ParallelCosineSimilarity
from pygraphc.pruning.TrianglePruning import TrianglePruning
import networkx as nx
class CreateGraphModel(object):
def __init__(self, log_file):
self.log_file = l... | from pygraphc.preprocess.ParallelPreprocess import ParallelPreprocess
from pygraphc.similarity.JaroWinkler import JaroWinkler
from pygraphc.pruning.TrianglePruning import TrianglePruning
import networkx as nx
class CreateGraphModel(object):
def __init__(self, log_file):
self.log_file = log_file
se... |
Add debugging to update LED paths | package com.gmail.alexellingsen.g2skintweaks;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import de.robv.android.xposed.XposedBridge;
public class UpdateLedPaths extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent in... | package com.gmail.alexellingsen.g2skintweaks;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class UpdateLedPaths extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
SettingsHelper settings = ne... |
Revert local CDN location set by Jodok | # -*- coding: utf-8 -*-
# vim: set fileencodings=utf-8
__docformat__ = "reStructuredText"
import json
import datetime
from django.template.base import Library
from django.utils.safestring import mark_safe
register = Library()
CDN_URL = 'https://cdn.crate.io'
def media(context, media_url):
"""
Get the path... | # -*- coding: utf-8 -*-
# vim: set fileencodings=utf-8
__docformat__ = "reStructuredText"
import json
import datetime
from django.template.base import Library
from django.utils.safestring import mark_safe
register = Library()
#CDN_URL = 'https://cdn.crate.io'
CDN_URL = 'http://localhost:8001'
def media(context, m... |
Add timestamps column to database migration. | <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Schema;
use App\Realms\Server;
class CreateServersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::... | <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Schema;
use App\Realms\Server;
class CreateServersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::... |
Make sure that we are connected to the cluster | <?php
namespace ActiveCollab\Resistance\Test;
use ActiveCollab\Resistance;
/**
* @package ActiveCollab\Resistance\Test
*/
abstract class TestCase extends \PHPUnit_Framework_TestCase
{
/**
* Switch to test database
*/
public function setUp()
{
if (getenv('TEST_REDIS_CLUSTER'... | <?php
namespace ActiveCollab\Resistance\Test;
use ActiveCollab\Resistance;
/**
* @package ActiveCollab\Resistance\Test
*/
abstract class TestCase extends \PHPUnit_Framework_TestCase
{
/**
* Switch to test database
*/
public function setUp()
{
if (getenv('TEST_REDIS_CLUSTER'... |
Set indexKey once per row, not per column.
The performance improvement depends on the number of columns, but on a
real data set of 5000 rows and 11 resolved columns this improves
performance by 8.7%.
This does not change the result since the order of keys in the spread is
unchanged. | function resolve({
columns,
method = () => rowData => rowData,
indexKey = '_index'
}) {
if (!columns) {
throw new Error('resolve - Missing columns!');
}
return (rows = []) => {
const methodsByColumnIndex = columns.map(column => method({ column }));
return rows.map((rowData, rowIndex) => {
... | function resolve({
columns,
method = () => rowData => rowData,
indexKey = '_index'
}) {
if (!columns) {
throw new Error('resolve - Missing columns!');
}
return (rows = []) => {
const methodsByColumnIndex = columns.map(column => method({ column }));
return rows.map((rowData, rowIndex) => {
... |
Fix typo in table name | package org.ligoj.app.plugin.prov.model;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import javax.validation.constraints.NotNull;
import org.ligoj.app.api.NodeScoped;
import org.ligo... | package org.ligoj.app.plugin.prov.model;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import javax.validation.constraints.NotNull;
import org.ligoj.app.api.NodeScoped;
import org.ligo... |
Use six.moves to reference `reload`.
PiperOrigin-RevId: 253199825
Change-Id: Ifb9bf182572900a813ea1b0dbbda60f82495eac1 | # Copyright 2019 The Sonnet Authors. 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 applicable l... | # Copyright 2019 The Sonnet Authors. 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 applicable l... |
Swap from letters int to packages object | class Player extends Phaser.Sprite {
constructor (game, city, saved) {
super(game, city.x, city.y, 'city')
this.game.add.existing(this)
this.tint = 0x006600
this.name = 'Dumb Name'
this.city = city
this.stats = {
health: 50,
carryingCa... | class Player extends Phaser.Sprite {
constructor (game, city, saved) {
super(game, city.x, city.y, 'city')
this.game.add.existing(this)
this.tint = 0x006600
this.name = 'Dumb Name'
this.city = city
this.stats = {
health: 50,
carryingCa... |
Use attrs<19.2.0 to avoid pytest error | import codecs
from setuptools import find_packages
from setuptools import setup
import sys
install_requires = [
'cached-property',
'chainer>=2.0.0',
'future',
'gym>=0.9.7',
'numpy>=1.10.4',
'pillow',
'scipy',
]
test_requires = [
'pytest',
'attrs<19.2.0', # pytest does not run with... | import codecs
from setuptools import find_packages
from setuptools import setup
import sys
install_requires = [
'cached-property',
'chainer>=2.0.0',
'future',
'gym>=0.9.7',
'numpy>=1.10.4',
'pillow',
'scipy',
]
test_requires = [
'pytest',
]
if sys.version_info < (3, 2):
install_re... |
Reduce oauth api-delay to 1s. | import praw
from images_of import settings
class Reddit(praw.Reddit):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.config.api_request_delay = 1.0
def oauth(self, **kwargs):
self.set_oauth_app_info(
client_id = kwargs.get('client_id') or setti... | import praw
from images_of import settings
class Reddit(praw.Reddit):
def oauth(self, **kwargs):
self.set_oauth_app_info(
client_id = kwargs.get('client_id') or settings.CLIENT_ID,
client_secret = kwargs.get('client_secret') or settings.CLIENT_SECRET,
redirect_uri = kwa... |
Fix get tokenized card infos | <?php
namespace Zoop\Lib;
class ZoopTokens implements \Zoop\Contracts\ZoopTokens {
/**
* API Resource
*
* @var object
*/
protected $APIResource;
/**
* ZoopTokens constructor.
* @param APIResource $APIResource
*/
public function __construct(APIResource $APIResource)... | <?php
namespace Zoop\Lib;
class ZoopTokens implements \Zoop\Contracts\ZoopTokens {
/**
* API Resource
*
* @var object
*/
protected $APIResource;
/**
* ZoopTokens constructor.
* @param APIResource $APIResource
*/
public function __construct(APIResource $APIResource)... |
test: Test data was not used | package mireka.maildata;
import static org.junit.Assert.*;
import java.text.ParseException;
import org.junit.Test;
public class QEncodingParserTest extends QEncodingParser {
private String in1 = "hi";
private byte[] out1 = { 'h', 'i' };
private String in2 = "h=69_jon";
private byte[] out2 = { 'h',... | package mireka.maildata;
import static org.junit.Assert.*;
import java.text.ParseException;
import org.junit.Test;
public class QEncodingParserTest extends QEncodingParser {
private String in1 = "hi";
private byte[] out1 = { 'h', 'i' };
private String in2 = "h=69_jon";
private byte[] out2 = { 'h',... |
Fix versione nel Frame della gui | /*
Copyright 2011-2015 Stefano Cappa
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softw... | /*
Copyright 2011-2015 Stefano Cappa
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, softw... |
Improve efficiency to constant O(n) | package algorithms;
public class MaxPairwiseProduct {
static long getMaxPairwiseProduct(Integer[] numbers) {
if (numbers.length == 1) {
return 0;
}
Integer maxIndex1 = null;
Integer maxIndex2 = null;
for (int i = 0; i < numbers.length; ++i) {
if (maxIndex1 == null || numbers[i] > numbers[maxIndex1]) {... | package algorithms;
import java.util.Arrays;
public class MaxPairwiseProduct {
static long getMaxPairwiseProduct(Integer[] numbers) {
if (numbers.length == 1) {
return 0;
}
Arrays.sort(numbers, (x, y) -> x - y);
int lastIndex = numbers.length - 1;
long bigResult = (long) numbers[lastIndex] * numbers[las... |
Change pokeapi url to use https | var PokeApi = PokeApi || {};
PokeApi.apiUrl = "https://pokeapi.co/api/";
PokeApi.apiVersion = "v2";
PokeApi.getResource = function getResource(resource) {
return new Promise(function(resolve, reject) {
fetch(PokeApi.apiUrl + PokeApi.apiVersion + "/" + resource).then(function(response) {
// hand... | var PokeApi = PokeApi || {};
PokeApi.apiUrl = "http://pokeapi.co/api/";
PokeApi.apiVersion = "v2";
PokeApi.getResource = function getResource(resource) {
return new Promise(function(resolve, reject) {
fetch(PokeApi.apiUrl + PokeApi.apiVersion + "/" + resource).then(function(response) {
// handl... |
Tests/RN-native-nav: Use promise instead of callback for starting Bugsnag | /**
* @format
*/
import {Navigation} from 'react-native-navigation';
import HomeScreen from './screens/Home';
import DetailsScreen from './screens/Details';
import {NativeModules} from 'react-native';
import Bugsnag from '@bugsnag/react-native';
import BugsnagReactNativeNavigation from '@bugsnag/plugin-react-native-... | /**
* @format
*/
import {Navigation} from 'react-native-navigation';
import HomeScreen from './screens/Home';
import DetailsScreen from './screens/Details';
import {NativeModules} from 'react-native';
import Bugsnag from '@bugsnag/react-native';
import BugsnagReactNativeNavigation from '@bugsnag/plugin-react-native-... |
Use list comprehension instead of lambda function | try:
import mpmath as mp
except ImportError:
pass
try:
from sympy.abc import x # type: ignore[import]
except ImportError:
pass
def lagrange_inversion(a):
"""Given a series
f(x) = a[1]*x + a[2]*x**2 + ... + a[n-1]*x**(n - 1),
use the Lagrange inversion formula to compute a series
g... | try:
import mpmath as mp
except ImportError:
pass
try:
from sympy.abc import x # type: ignore[import]
except ImportError:
pass
def lagrange_inversion(a):
"""Given a series
f(x) = a[1]*x + a[2]*x**2 + ... + a[n-1]*x**(n - 1),
use the Lagrange inversion formula to compute a series
g... |
Exclude test suite from jsdoc | include('helma/webapp/response');
include('helma/jsdoc');
require('core/array');
var log = require('helma/logging').getLogger(module.id);
exports.index = function index(req, module) {
var repo = new ScriptRepository(require.paths.peek());
if (module && module != "/") {
var res = repo.getScriptResource... | include('helma/webapp/response');
include('helma/jsdoc');
require('core/array');
var log = require('helma/logging').getLogger(module.id);
exports.index = function index(req, module) {
var repo = new ScriptRepository(require.paths.peek());
if (module && module != "/") {
var res = repo.getScriptResource... |
Modify one of the indexes on the appointments table. | <?php
class Create_Appointments_Table {
/**
* Make changes to the database.
*
* @return void
*/
public function up()
{
//
Schema::table('appointments', function($table)
{
$table->create();
$table->increments('id');
$table->string('name')->nullable();
$table->integer('place_id')->unsigned(... | <?php
class Create_Appointments_Table {
/**
* Make changes to the database.
*
* @return void
*/
public function up()
{
//
Schema::table('appointments', function($table)
{
$table->create();
$table->increments('id');
$table->string('name')->nullable();
$table->integer('place_id')->unsigned(... |
Remove usage of deprecated class. | /*
* Java Genetic Algorithm Library (@__identifier__@).
* Copyright (c) @__year__@ Franz Wilhelmstötter
*
* 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/... | /*
* Java Genetic Algorithm Library (@__identifier__@).
* Copyright (c) @__year__@ Franz Wilhelmstötter
*
* 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/... |
Send alert ID to UI
This will allow alert detail page links on the alert list page to work again. | import { Paginator } from '../../utils';
import template from './alerts-list.html';
const stateClass = {
ok: 'label label-success',
triggered: 'label label-danger',
unknown: 'label label-warning',
};
class AlertsListCtrl {
constructor(Events, Alert) {
Events.record('view', 'page', 'alerts');
this.ale... | import { Paginator } from '../../utils';
import template from './alerts-list.html';
const stateClass = {
ok: 'label label-success',
triggered: 'label label-danger',
unknown: 'label label-warning',
};
class AlertsListCtrl {
constructor(Events, Alert) {
Events.record('view', 'page', 'alerts');
this.ale... |
Check metalanguage applicability in getAllBaseLanguageIdsWithAny()
GitOrigin-RevId: f76645e6ba0672f74059aa8b4ec97855d6a5527c | // Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.completion;
import com.intellij.lang.Language;
import com.intellij.lang.LanguageExtension;
import com.intellij.lang.MetaLanguage;
import gnu.trov... | // Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.codeInsight.completion;
import com.intellij.lang.Language;
import com.intellij.lang.LanguageExtension;
import com.intellij.lang.MetaLanguage;
import gnu.trov... |
Add dossier title to API | from rest_framework import serializers, viewsets
from document.models import Document, Kamerstuk, Dossier
class DossierSerializer(serializers.HyperlinkedModelSerializer):
documents = serializers.HyperlinkedRelatedField(read_only=True,
view_name='document-detail... | from rest_framework import serializers, viewsets
from document.models import Document, Kamerstuk, Dossier
class DossierSerializer(serializers.HyperlinkedModelSerializer):
documents = serializers.HyperlinkedRelatedField(read_only=True,
view_name='document-detail... |
Add check for all states | const resources_template = require("./templates/resources-simple.hbs");
/* parallax on blog posts with cover image */
var parallaxImage = document.getElementById('ParallaxImage');
var windowScrolled;
window.addEventListener('scroll', function windowScroll() {
windowScrolled = window.pageYOffset || document.document... | const resources_template = require("./templates/resources-simple.hbs");
/* parallax on blog posts with cover image */
var parallaxImage = document.getElementById('ParallaxImage');
var windowScrolled;
window.addEventListener('scroll', function windowScroll() {
windowScrolled = window.pageYOffset || document.document... |
Fix default newtab; optimize process to make page active |
function nt (newtab) {
function waitForURL(tabId, changeInfo, tab) {
if (changeInfo.title === '@NewTab') {
browser.storage.local.get('newtaburl').then(function (ntu) {
browser.tabs.onUpdated.removeListener(waitForURL);
if (ntu.newtaburl == null) {
browser.storage.local.set({
newtaburl: 'about:... |
function nt (newtab) {
function waitForURL(tabId, changeInfo, tab) {
console.log(changeInfo);
if (changeInfo.title === '@NewTab') {
browser.storage.local.get('newtaburl').then(function (ntu) {
browser.tabs.onUpdated.removeListener(waitForURL);
browser.storage.local.get('active').then(function (act) {
... |
Add python script for IPs discovery | #!/usr/bin/python
#
# Get private IPv4s for a given instance name.
#
import boto
import boto.ec2
import getopt
import sys
#
# Get the profile
#
def connect():
metadata = boto.utils.get_instance_metadata()
region = metadata['placement']['availability-zone'][:-1]
profile = metadata['iam']['info']['InstanceP... | #!/usr/bin/python
#
# Get private IPv4s for a given instance name.
#
import boto
import boto.ec2
import getopt
import sys
#
# Get the profile
#
def connect(region):
profile = metadata['iam']['info']['InstanceProfileArn']
profile = profile[profile.find('/') + 1:]
conn = boto.ec2.connection.EC2Connection(
... |
Improve error message and use correct status | var basicAuth = require('basic-auth');
/**
* Simple basic auth middleware for use with Express 4.x.
*
* Based on template found at: http://www.danielstjules.com/2014/08/03/basic-auth-with-express-4/
*
* @example
* app.use('/api-requiring-auth', utils.basicAuth('username', 'password'));
*
* @param {string} ... | var basicAuth = require('basic-auth');
/**
* Simple basic auth middleware for use with Express 4.x.
*
* Based on template found at: http://www.danielstjules.com/2014/08/03/basic-auth-with-express-4/
*
* @example
* app.use('/api-requiring-auth', utils.basicAuth('username', 'password'));
*
* @param {string} ... |
Add login to browsable API. | from django.conf.urls import include, url
from rest_framework.urlpatterns import format_suffix_patterns
from . import views
urlpatterns = [
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
url(r'^notes/$', views.NoteList.as_view()),
url(r'^notes/(?P<pk>[0-9]+)/$', views.Note... | from django.conf.urls import url
from rest_framework.urlpatterns import format_suffix_patterns
from . import views
urlpatterns = [
url(r'^notes/$', views.NoteList.as_view()),
url(r'^notes/(?P<pk>[0-9]+)/$', views.NoteDetail.as_view()),
url(r'^traits/$', views.TraitList.as_view()),
url(r'^traits/(?P<pk... |
Handle undefined sails.config.globals by using defaults. | /**
* Module dependencies.
*/
var _ = require('lodash');
var async = require('async');
/**
* exposeGlobals()
*
* Expose certain global variables
* (if config says so)
*
* @api private
*/
module.exports = function exposeGlobals() {
var sails = this;
sails.log.verbose('Exposing global variables... (you ... | /**
* Module dependencies.
*/
var _ = require('lodash');
var async = require('async');
/**
* exposeGlobals()
*
* Expose certain global variables
* (if config says so)
*
* @api private
*/
module.exports = function exposeGlobals() {
var sails = this;
sails.log.verbose('Exposing global variables... (you ... |
Hide facet if no filters are still inactive inside | import React, { Component } from 'react'
import Facet from './Facet'
import { isActive } from '../../helpers/manageFilters'
const styles = {
type: {
textTransform: 'capitalize',
fontSize: '1em',
fontWeight: 400,
marginBottom: '1em',
},
group: {
marginBottom: '1em',
}
}
class FacetsGroup ex... | import React, { Component } from 'react'
import Facet from './Facet'
import { isActive } from '../../helpers/manageFilters'
const styles = {
type: {
textTransform: 'capitalize',
fontSize: '1em',
fontWeight: 400,
marginBottom: '1em',
},
group: {
marginBottom: '1em',
}
}
class FacetsGroup ex... |
Support colours for rendering the layer view | from UM.View.View import View
from UM.View.Renderer import Renderer
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
from UM.Resources import Resources
class LayerView(View):
def __init__(self):
super().__init__()
self._material = None
def beginRendering(self):
scene... | from UM.View.View import View
from UM.View.Renderer import Renderer
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
from UM.Resources import Resources
class LayerView(View):
def __init__(self):
super().__init__()
self._material = None
def beginRendering(self):
scene... |
Add trailing newline since PyCharm stripped it | #!/usr/bin/env python
import setuptools
import os
setuptools.setup(
name='endpoints-proto-datastore',
version='0.9.0',
description='Google Cloud Endpoints Proto Datastore Library',
long_description=open(os.path.join(os.path.dirname(__file__), 'README.md')).read(),
url='https://github.com/GoogleClo... | #!/usr/bin/env python
import setuptools
import os
setuptools.setup(
name='endpoints-proto-datastore',
version='0.9.0',
description='Google Cloud Endpoints Proto Datastore Library',
long_description=open(os.path.join(os.path.dirname(__file__), 'README.md')).read(),
url='https://github.com/GoogleClo... |
Include credentials when entity search request is sent | import fetch from 'isomorphic-fetch'
export const REQUEST_ENTITIES = 'REQUEST_ENTITIES'
export const RECEIVE_ENTITIES = 'RECEIVE_ENTITIES'
function requestEntities() {
return {
type: REQUEST_ENTITIES
}
}
function receiveEntities(json) {
return {
type: RECEIVE_ENTITIES,
data: json.data,
received... | import fetch from 'isomorphic-fetch'
export const REQUEST_ENTITIES = 'REQUEST_ENTITIES'
export const RECEIVE_ENTITIES = 'RECEIVE_ENTITIES'
function requestEntities() {
return {
type: REQUEST_ENTITIES
}
}
function receiveEntities(json) {
return {
type: RECEIVE_ENTITIES,
data: json.data,
received... |
Fix sidebar start position considering navbar margin-bottom | window.onload = function() {
var headHeight = $("nav").height();
var mainHeight = $("main").height();
var sideHeight = $("#sidebar").height();
var footHeight = $("footer").height();
var totalHeight = headHeight + mainHeight + footHeight;
var w = $(window);
if ( w.width() > $("main").width() + $("#s... | window.onload = function() {
var headHeight = $("nav").height();
var mainHeight = $("main").height();
var sideHeight = $("#sidebar").height();
var footHeight = $("footer").height();
var totalHeight = headHeight + mainHeight + footHeight;
var w = $(window);
if ( w.width() > $("main").width() + $("#s... |
Revert "Ignore security token for guests"
Due to the age of this commit it's a bit unclear why exactly it was necessary
at that time, but records indicate that it was related to the URL based session
system (`?s=…`) in combination with with virtual sessions effectively changing
the session ID during login, the `SID` c... | <?php
namespace wcf\action;
use wcf\system\exception\InvalidSecurityTokenException;
use wcf\system\WCF;
/**
* Extends AbstractAction by a function to validate a given security token.
* A missing or invalid token will be result in a throw of a IllegalLinkException.
*
* @author Marcel Werk
* @copyright 2001-20... | <?php
namespace wcf\action;
use wcf\system\exception\InvalidSecurityTokenException;
use wcf\system\WCF;
/**
* Extends AbstractAction by a function to validate a given security token.
* A missing or invalid token will be result in a throw of a IllegalLinkException.
*
* @author Marcel Werk
* @copyright 2001-20... |
Disable moving after the game is over | const socket = require('socket.io-client')();
class Client {
constructor(board, boardElement) {
this.board = board;
this.boardElement = boardElement;
socket.on('login', ({id}) => {
this.board.selfNumber = id;
this.boardElement.update();
});
socket.on('update', (data) => {
this.board.fromData(data);... | const socket = require('socket.io-client')();
class Client {
constructor(board, boardElement) {
this.board = board;
this.boardElement = boardElement;
socket.on('login', ({id}) => {
this.board.selfNumber = id;
this.boardElement.update();
});
socket.on('update', (data) => {
this.board.fromData(data);... |
[feat]: Create second view linking to homepage | import React from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { Link } from 'react-router';
import goHomeActions from 'actions/goHome';
import RaisedButton from 'material-ui/lib/raised-button';
const map... | import React from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import { Link } from 'react-router';
import goHomeActions from 'actions/goHome';
import RaisedButton from 'material-ui/lib/raised-button';
const map... |
Refactor redirectUrl logic of page language selector | const toArray = nodelist => Array.prototype.slice.call(nodelist);
const things = ['method', 'case', 'organization'];
const languageSelect = {
redirectUrl: null,
isThingDetailsPageWithLanguageParam: false,
init(tracking) {
this.tracking = tracking;
this.generateRedirectPath();
const selectEls = docume... | const toArray = nodelist => Array.prototype.slice.call(nodelist);
const things = ['method', 'case', 'organization'];
const languageSelect = {
redirectUrl: null,
isThingDetailsPageWithLanguageParam: false,
init(tracking) {
this.tracking = tracking;
this.generateRedirectPath();
const selectEls = docume... |
Add hash parameter to forge decrypt. | var Algorithm = require("./abstract")("RSA-OAEP")
, RSA = require("./shared/RSA")
, forge = require("node-forge")
, types = Algorithm.types
, public = types.public.usage
, private = types.private.usage;
//attached shared RSA
RSA(Algorithm);
Algorithm.checkParams = checkParams;
public.enc... | var Algorithm = require("./abstract")("RSA-OAEP")
, RSA = require("./shared/RSA")
, forge = require("node-forge")
, types = Algorithm.types
, public = types.public.usage
, private = types.private.usage;
//attached shared RSA
RSA(Algorithm);
Algorithm.checkParams = checkParams;
public.enc... |
Remove hard coded 'engine' and 'lib' in coverage testing | #!/usr/bin/env python
import os
import subprocess
from lib import functional
from util import find_all
def coverage_module(package, module):
command = (
'coverage run --branch'
' --source=%s.%s tests/%s/%s_test.py')
print subprocess.check_output(
command % (package, module, package,... | #!/usr/bin/env python
import os
import subprocess
from lib import functional
from util import find_all
def coverage_module(package, module):
command = (
'coverage run --branch'
' --source=%s.%s tests/%s/%s_test.py')
print subprocess.check_output(
command % (package, module, package,... |
Drop down the fire rate | import AbstractTower from '../AbstractTower';
/**
* MasterChef class
* Master tower
*/
export default class MasterChef extends AbstractTower {
constructor() {
console.log('MasterChef -> constructor');
super({
stats: {
attack: 32,
precision: 0.7,
cost: 26,
distAttack... | import AbstractTower from '../AbstractTower';
/**
* MasterChef class
* Master tower
*/
export default class MasterChef extends AbstractTower {
constructor() {
console.log('MasterChef -> constructor');
super({
stats: {
attack: 32,
precision: 0.7,
cost: 26,
distAttack... |
Clean up file patterns in PIPELINE_CSS setting. | # Copyright (c) 2011-2014 Berkeley Model United Nations. All rights reserved.
# Use of this source code is governed by a BSD License (see LICENSE).
from os.path import join
from .roots import PROJECT_ROOT
PIPELINE_COMPILERS = (
'huxley.utils.pipeline.PySCSSCompiler',
'pipeline_browserify.compiler.Browserify... | # Copyright (c) 2011-2014 Berkeley Model United Nations. All rights reserved.
# Use of this source code is governed by a BSD License (see LICENSE).
from os.path import join
from .roots import PROJECT_ROOT
PIPELINE_COMPILERS = (
'huxley.utils.pipeline.PySCSSCompiler',
'pipeline_browserify.compiler.Browserify... |
[Bundle] Make getPath() less error prone by allowing both backward and forward slashes | <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\SwiftmailerBundle;
use Symfony\Compone... | <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bundle\SwiftmailerBundle;
use Symfony\Compone... |
Remove --harmony_collections & --harmony_iteration, their features are now on by default | 'use strict';
var findup = require('findup-sync');
var spawnSync = require('child_process').spawnSync;
var gruntPath = findup('node_modules/grunt-cli/bin/grunt', {cwd: __dirname});
process.title = 'grunth';
var harmonyFlags = [
'--harmony_scoping',
// '--harmony_modules', // We have `require` and ES6 modules ... | 'use strict';
var findup = require('findup-sync');
var spawnSync = require('child_process').spawnSync;
var gruntPath = findup('node_modules/grunt-cli/bin/grunt', {cwd: __dirname});
process.title = 'grunth';
var harmonyFlags = [
'--harmony_scoping',
// '--harmony_modules', // We have `require` and ES6 modules ... |
Disable profile complete check for user tags | preloadSubscriptions.push('usertags');
// Add our template to user profile viewing.
userProfileDisplay.push({template: "listUserTags", order: 2});
// Add our template to user profile editing.
userProfileEdit.push({template: "editUserTags", order: 2});
// Add our template to the finish-signup view.
userProfileFinishSig... | preloadSubscriptions.push('usertags');
// Add our template to user profile viewing.
userProfileDisplay.push({template: "listUserTags", order: 2});
// Add our template to user profile editing.
userProfileEdit.push({template: "editUserTags", order: 2});
// Add our template to the finish-signup view.
userProfileFinishSig... |
Add CorsService to service provider | <?php
/**
* CORS service provider
*
* @package phpnexus/cors-laravel
* @copyright Copyright (c) 2016 Mark Prosser
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
* @link https://github.com/phpnexus/cors-laravel
*/
namespace PhpNexus\CorsLaravel;
use Illuminate\Support\... | <?php
/**
* CORS middleware service provider
*
* @package phpnexus/cors-laravel
* @copyright Copyright (c) 2016 Mark Prosser
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
* @link https://github.com/phpnexus/cors-laravel
*/
namespace PhpNexus\CorsLaravel;
use Illumina... |
Remove unnecessary IIFE from Y class | const http = require('http');
const jsdom = require('jsdom');
const jQuery = require('jquery');
const Router = require('./router/index');
const body = require('./body/index');
/**
* The jQuerate Class
*
* Patches the emitter and listen handler
* to allow max jQuery gainz
*/
class Yttrium {
constructor(options) ... | const http = require('http');
const jsdom = require('jsdom');
const jQuery = require('jquery');
const Router = require('./router/index');
const body = require('./body/index');
/**
* The jQuerate Class
*
* Patches the emitter and listen handler
* to allow max jQuery gainz
*/
class Yttrium {
constructor(options) ... |
Fix code style for pm2 module | import express from 'express'
import session from 'express-session'
import cookieParser from 'cookie-parser'
import bodyParser from 'body-parser'
import morgan from 'morgan'
import passport from 'passport'
import routes from './api/routes'
import dotenv from 'dotenv'
import container from './dependency-container/contai... | import express from 'express'
import session from 'express-session'
import cookieParser from 'cookie-parser'
import bodyParser from 'body-parser'
import morgan from 'morgan'
import passport from 'passport'
import routes from './api/routes'
import dotenv from 'dotenv'
import container from './dependency-container/contai... |
Fix bug: list of all subs did not work.
Bug introduced in commit 08c68b5a85bc9ab42391c6b3bb65942d4c9dce6b. | package herd
import (
"fmt"
"net"
"net/http"
)
var httpdHerd *Herd
func (herd *Herd) startServer(portNum uint, daemon bool) error {
listener, err := net.Listen("tcp", fmt.Sprintf(":%d", portNum))
if err != nil {
return err
}
httpdHerd = herd
http.HandleFunc("/", statusHandler)
http.HandleFunc("/listSubs",... | package herd
import (
"fmt"
"net"
"net/http"
)
var httpdHerd *Herd
func (herd *Herd) startServer(portNum uint, daemon bool) error {
listener, err := net.Listen("tcp", fmt.Sprintf(":%d", portNum))
if err != nil {
return err
}
httpdHerd = herd
http.HandleFunc("/", statusHandler)
http.HandleFunc("/listSubs",... |
Add sleep, and prox_ground, prox_horizontal. | import os
import Pyro4
import subprocess
import signal
from pythymiodw import ThymioSimMR
import time
from pythymiodw.io import ProxGround
class ThymioMR():
def __init__(self):
self.pyro4daemon_proc=subprocess.Popen(['python -m pythymiodw.pyro.__main__'], stdout=subprocess.PIPE, shell=True, preexec_fn=os.setsid) ... | import os
import Pyro4
import subprocess
import signal
from pythymiodw import ThymioSimMR
class ThymioMR():
def __init__(self):
self.pyro4daemon_proc=subprocess.Popen(['python -m pythymiodw.pyro.__main__'], stdout=subprocess.PIPE, shell=True, preexec_fn=os.setsid)
self.robot = Pyro4.Proxy('PYRONAME:pythymiod... |
Enforce minimum PO value for supplier. | # -*- coding: utf-8 -*-
##############################################################################
#
# Set minimum order on suppliers
# Copyright (C) 2016 OpusVL (<http://opusvl.com/>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public Lic... | # -*- coding: utf-8 -*-
##############################################################################
#
# Set minimum order on suppliers
# Copyright (C) 2016 OpusVL (<http://opusvl.com/>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public Lic... |
Make sure that connection is timed out | package name.webdizz.jeeconf.fault.tolerance.timeout;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.conn.ConnectTimeoutException;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
imp... | package name.webdizz.jeeconf.fault.tolerance.timeout;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.conn.ConnectTimeoutException;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
imp... |
Add a set width function | var Controls = require('./controls');
function StompScreen(options) {
if(typeof options.el === 'string') {
options.el = document.querySelector(options.el);
}
this.el = options.el;
this.src = options.src;
this.width = options.width;
this.autoplay = options.autoplay;
this.setupScreen(this.el);
th... | var Controls = require('./controls');
function StompScreen(options) {
if(typeof options.el === 'string') {
options.el = document.querySelector(options.el);
}
this.el = options.el;
this.src = options.src;
this.width = options.width;
this.autoplay = options.autoplay;
this.setupScreen(this.el);
th... |
Make analytics work with require.js | define(['json!/api/v1/client-config'], function (config) {
if (!(config && config.ga_token)
|| (typeof window === 'undefined')
|| ("localhost" === window.location.hostname)) {
console.debug("Skipping analytics");
return function () {}; // NO-OP function.
}
(function(i,s,o,g,r,a,m){i['GoogleA... | define(['json!/api/v1/client-config'], function (config) {
if (!(config && config.ga_token)
|| "localhost" == window.location.hostname) {
console.debug("Skipping analytics");
return function () {}; // NO-OP function.
}
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
... |
Add support for new data structure | import _ from 'underscore';
import Levenshtein from 'levenshtein';
export function getStatusForResponse(response = {}) {
if (!response.feedback) {
return 4;
} else if (response.parent_id) {
return (response.optimal ? 2 : 3);
}
return (response.optimal ? 0 : 1);
}
export default function responsesWithS... | import _ from 'underscore';
import Levenshtein from 'levenshtein'
export function getStatusForResponse(response = {}) {
if (!response.feedback) {
return 4;
} else if (response.parentID) {
return (response.optimal ? 2 : 3);
}
return (response.optimal ? 0 : 1);
}
export default function responsesWithSta... |
Clone the element without using addons | let findApp = require('../core/findApp');
let { isArray, extend } = require('../mindash');
module.exports = function (React) {
let ApplicationContainer = React.createClass({
childContextTypes: {
app: React.PropTypes.object
},
getChildContext() {
return { app: findApp(this) };
},
rende... | let { isArray } = require('../mindash');
let findApp = require('../core/findApp');
module.exports = function (React) {
let ApplicationContainer = React.createClass({
childContextTypes: {
app: React.PropTypes.object
},
getChildContext() {
return { app: findApp(this) };
},
render() {
... |
Change version convention to conform to PEP428 | #!/usr/bin/env python
# coding: utf-8
from setuptools import setup, find_packages
setup(
name="bentoo",
description="Benchmarking tools",
version="0.20.dev",
packages=find_packages(),
scripts=["scripts/bentoo-generator.py", "scripts/bentoo-runner.py",
"scripts/bentoo-collector.py", "sc... | #!/usr/bin/env python
# coding: utf-8
from setuptools import setup, find_packages
setup(
name="bentoo",
description="Benchmarking tools",
version="0.20.0_dev",
packages=find_packages(),
scripts=["scripts/bentoo-generator.py", "scripts/bentoo-runner.py",
"scripts/bentoo-collector.py", "... |
Change github url in WebView | /*
* Copyright (C) 2015 The Android Open Source Project
*
* 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 ... | /*
* Copyright (C) 2015 The Android Open Source Project
*
* 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 ... |
Bump version to 0.3.3 & update mosca version to 2.1.0 | Package.describe({
name: 'metemq:metemq',
version: '0.3.3',
// Brief, one-line summary of the package.
summary: 'MeteMQ',
// URL to the Git repository containing the source code for this package.
git: '',
// By default, Meteor will default to using README.md for documentation.
// To avoid submitting doc... | Package.describe({
name: 'metemq:metemq',
version: '0.3.2',
// Brief, one-line summary of the package.
summary: 'MeteMQ',
// URL to the Git repository containing the source code for this package.
git: '',
// By default, Meteor will default to using README.md for documentation.
// To avoid submitting doc... |
Add reminder timer to the default mod list. |
var rModsList = [];
/* start ui_mod_list */
var global_mod_list = [
];
var scene_mod_list = {'connect_to_game': [
],'game_over': [
],
'icon_atlas': [
],
'live_game': [
//In game timer
'../../mods/dTimer/dTimer.css',
'../../mods/dTimer/dTimer.js',
//Mex/Energy Count
'../../mods/dMexCount/dMexCount.css',
'..... |
var rModsList = [];
/* start ui_mod_list */
var global_mod_list = [
];
var scene_mod_list = {'connect_to_game': [
],'game_over': [
],
'icon_atlas': [
],
'live_game': [
//In game timer
'../../mods/dTimer/dTimer.css',
'../../mods/dTimer/dTimer.js',
//Mex/Energy Count
'../../mods/dMexCount/dMexCount.css',
'..... |
Use old resource ID, so it's backward compatible with existing tokens. | /*
* Copyright 2014 Open mHealth
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to... | /*
* Copyright 2014 Open mHealth
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to... |
Adjust receiver class in connector module | import _ from 'lodash';
import errorer from '../../../errorer/errorer';
export default class {
constructor(instance, receiver, receiverConfigs, params) {
let {events = {}} = instance;
let method = events[receiver] || receiver;
_.extend(this, {data: {}, instance, method, receiverConfigs, params});
... | import _ from 'lodash';
import errorer from '../../../errorer/errorer';
export default class {
constructor(instance, receiver, receiverConfigs, params) {
let {events = {}} = instance;
let method = events[receiver] || receiver;
_.extend(this, {data: {}, instance, method, receiverConfigs, params});
... |
Update the url patterns to be compliant with Django 1.9 new formatting
so need to support Django < 1.8 because it is now deprecated for
security reasons | """URLs module"""
from django import VERSION
from django.conf import settings
from django.conf.urls import url
from social.apps.django_app import views
from social.utils import setting_name
extra = getattr(settings, setting_name('TRAILING_SLASH'), True) and '/' or ''
urlpatterns = (
# authentication / associati... | """URLs module"""
from django.conf import settings
try:
from django.conf.urls import patterns, url
except ImportError:
# Django < 1.4
from django.conf.urls.defaults import patterns, url
from social.utils import setting_name
extra = getattr(settings, setting_name('TRAILING_SLASH'), True) and '/' or ''
... |
Fix compilation error after core shifted
Core is slowly removing raw types. Slowly. And one such removal broke shield.
Original commit: elastic/x-pack-elasticsearch@aa1b668c63fba5c8af9e2dd984a456953b100a19 | /*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.marvel.shield;
import org.elasticsearch.action.Acti... | /*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.marvel.shield;
import org.elasticsearch.action.Acti... |
Add __str__ to Preprocessor class | import json
class Preprocessor:
def __init__(self):
self.reset()
def __str__(self):
return json.dumps(self.__dict__, indent=2, separators=(',', ': '))
def reset(self):
self.number_elements = 0
self.length_elements = []
self.E_elements = []
self.I_elements ... | import json
class Preprocessor:
def __init__(self):
self.reset()
def reset(self):
self.number_elements = 0
self.length_elements = []
self.E_elements = []
self.I_elements = []
self.loads = []
self.supports = []
def load_json(self, infile):
s... |
Use traits and MBID value in the model of an area. | <?php
namespace MusicBrainz\Value;
/**
* An area
*/
class Area
{
use Accessor\GetMBIDTrait;
use Accessor\GetNameTrait;
use Accessor\GetSortNameTrait;
/**
* Constructs an area.
*
* @param array $area Array of values
*/
public function __construct(array $area = [])
{
... | <?php
namespace MusicBrainz\Value;
/**
* An area
*/
class Area
{
/**
* The MusikBrainz Identifier for the area
*
* @var string
*/
private $id;
/**
* The area name
*
* @var Name
*/
private $name;
/**
* Sort index
*
* @var string
*/
... |
Handle one or more folders being inaccessible while listing | const path = require('path')
const stat = require('./stat')
const readdir = require('./readdir')
// based on http://stackoverflow.com/a/38314404/2533525
const getFolders = function (dir, filterFn) {
// default filter function accepts all folders
filterFn = filterFn || function () { return true }
return readdir(... | const path = require('path')
const stat = require('./stat')
const readdir = require('./readdir')
// based on http://stackoverflow.com/a/38314404/2533525
const getFolders = function (dir, filterFn) {
// default filter function accepts all folders
filterFn = filterFn || function () { return true }
return readdir(... |
Update cmd to pass context to request | package main
import (
"context"
"fmt"
"os"
"time"
"strings"
"github.com/hackebrot/go-librariesio/librariesio"
)
func loadFromEnv(keys ...string) (map[string]string, error) {
env := make(map[string]string)
for _, key := range keys {
v := os.Getenv(key)
if v == "" {
return nil, fmt.Errorf("environment... | package main
import (
"fmt"
"os"
"strings"
"github.com/hackebrot/go-librariesio/librariesio"
)
func loadFromEnv(keys ...string) (map[string]string, error) {
env := make(map[string]string)
for _, key := range keys {
v := os.Getenv(key)
if v == "" {
return nil, fmt.Errorf("environment variable %q is req... |
Align buffer_with_time_or_count signature with doc
According to docs, `buffer_with_time_or_count` has an optional scheduler
parameter but in reality it's mandatory. Let's make it optional for real
as passing `None` as third argument all the time is a bit inconvenient. | from rx import Observable
from rx.concurrency import timeout_scheduler
from rx.internal import extensionmethod
@extensionmethod(Observable)
def buffer_with_time_or_count(self, timespan, count, scheduler=None):
"""Projects each element of an observable sequence into a buffer that
is completed when either it's ... | from rx import Observable
from rx.concurrency import timeout_scheduler
from rx.internal import extensionmethod
@extensionmethod(Observable)
def buffer_with_time_or_count(self, timespan, count, scheduler):
"""Projects each element of an observable sequence into a buffer that
is completed when either it's full ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.