text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Remove unneccesary / in url conf | """<project_name> URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Cl... | """<project_name> URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Cl... |
Add a pointer to the raw file for easier use and comparison | // From: https://raw.githubusercontent.com/chilts/umd-template/master/template.js
;(function (f) {
// module name and requires
var name = '';
var requires = [];
// CommonJS
if (typeof exports === "object" && typeof module !== "undefined") {
module.exports = f.apply(null, requires.map(function(r) { return... | ;(function (f) {
// module name and requires
var name = '';
var requires = [];
// CommonJS
if (typeof exports === "object" && typeof module !== "undefined") {
module.exports = f.apply(null, requires.map(function(r) { return require(r); }));
// RequireJS
} else if (typeof define === "function" && def... |
Include data file in package. | import setuptools
import pathlib
setuptools.setup(
name='crafter',
version='0.18.0',
description='Open world survival game for reinforcement learning.',
url='http://github.com/danijar/crafter',
long_description=pathlib.Path('README.md').read_text(),
long_description_content_type='text/markdown... | import setuptools
import pathlib
setuptools.setup(
name='crafter',
version='0.17.0',
description='Open world survival game for reinforcement learning.',
url='http://github.com/danijar/crafter',
long_description=pathlib.Path('README.md').read_text(),
long_description_content_type='text/markdown... |
Add response types for controllers and an option to not include the header and footer. | <?php
ob_start();
/**
* Initialize some variables
*/
$view_data = array();
$title = '';
$description = '';
$css_files = array('header' => array(), 'footer' => array());
$js_files = array('header' => array(), 'footer' => array());
include('config.php');
include('routing.php');
require('functions.php');
// Load t... | <?php
ob_start();
/**
* Initialize some variables
*/
$view_data = array();
$title = '';
$description = '';
$css_files = array('header' => array(), 'footer' => array());
$js_files = array('header' => array(), 'footer' => array());
include('config.php');
include('routing.php');
require('functions.php');
// Load t... |
Add short, domain, fqdn flags like hostname command. | package main
import (
"flag"
"fmt"
"net"
"regexp"
)
func revers(ip4 string, fqdn bool, short bool, domain bool) {
Hostname, err := net.LookupAddr(ip4)
if err == nil {
switch {
case domain:
regE := regexp.MustCompile("^[^.]*[.](.*)[.]$")
fmt.Printf("%s\n", regE.FindStringSubmatch(Hostname[0])[1])
cas... | package main
import (
"fmt"
"net"
"regexp"
)
func revers(ip4 string) {
regE := regexp.MustCompile("[-a-z0-9]*")
Hostname, err := net.LookupAddr(ip4)
if err == nil {
fmt.Printf("%s\n", regE.FindString(Hostname[0]))
}
}
func main() {
regS := regexp.MustCompile("[0-9.]*")
interfaces, _ := net.Interfaces()
... |
Set command description using translation key | <?php
/**
* @file
* Contains \Drupal\AppConsole\Command\ContainerDebugCommand.
*/
namespace Drupal\AppConsole\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class ContainerDebugCommand extends ContainerAwareCommand
{
protected function configu... | <?php
/**
* @file
* Contains \Drupal\AppConsole\Command\ContainerDebugCommand.
*/
namespace Drupal\AppConsole\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class ContainerDebugCommand extends ContainerAwareCommand
{
protected function configu... |
Add support for connecting to NCBI database | import os
import sys
import time
import math
import sqlite3
from contextlib import contextmanager
import meta
@contextmanager
def timeit_msg(msg):
print '{}...'.format(msg),
sys.stdout.flush()
start = time.time()
yield
stop = time.time()
print ' ({:1.3f} s)'.format((stop-start))
def get_file_size(fname):
fs... | import os
import sys
import time
import math
from contextlib import contextmanager
@contextmanager
def timeit_msg(msg):
print '{}...'.format(msg),
sys.stdout.flush()
start = time.time()
yield
stop = time.time()
print ' ({:1.3f} s)'.format((stop-start))
def get_file_size(fname):
fstats = os.stat(fname)
size ... |
Load the config as late as possible to avoid crashing when the configuration is not ready yet. Also this code is more reentrant | # Copyright (C) 2011 Yaco Sistemas (http://www.yaco.es)
#
# 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 applic... | # Copyright (C) 2011 Yaco Sistemas (http://www.yaco.es)
#
# 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 applic... |
Allow items to have actions | import Ember from 'ember';
import layout from './template';
import Registerable from '../../mixins/registerable';
export default Ember.Component.extend(Registerable, {
layout: layout,
tagName: 'flood-item',
attributeBindings: [
'tabIndex:tabindex',
'disabled:aria-disabled',
'disabled:disabled',
... | import Ember from 'ember';
import layout from './template';
import Registerable from '../../mixins/registerable';
export default Ember.Component.extend(Registerable, {
layout: layout,
tagName: 'flood-item',
attributeBindings: [
'tabIndex:tabindex',
'disabled:aria-disabled',
'disabled:disabled',
... |
Remove kerning adjustment from blank lines | var escape = require('escape-latex');
var quotes = require('../replace-quotes');
var preprocess = function(input) {
return escape(quotes(input));
};
var blankLine = (
'{\\leavevmode \\vbox{\\hrule width5\\parindent}}'
);
module.exports = function run(element, numberStyle, conspicuous) {
if (typeof element === ... | var escape = require('escape-latex');
var quotes = require('../replace-quotes');
var preprocess = function(input) {
return escape(quotes(input));
};
var blankLine = (
'{\\leavevmode \\kern.06em \\vbox{\\hrule width5\\parindent}}'
);
module.exports = function run(element, numberStyle, conspicuous) {
if (typeof ... |
Implement saving and loading the observer tau | # -*- coding: utf-8 -*-
import halospectra as hs
import randspectra as rs
import sys
snapnum=sys.argv[1]
sim=sys.argv[2]
#base="/n/hernquistfs1/mvogelsberger/projects/GFM/Production/Cosmo/Cosmo"+str(sim)+"_V6/L25n512/output/"
#savedir="/n/home11/spb/scratch/Cosmo/Cosmo"+str(sim)+"_V6_512/snapdir_"+str(snapnum).rjust(3... | # -*- coding: utf-8 -*-
import halospectra as hs
import randspectra as rs
import sys
snapnum=sys.argv[1]
sim=sys.argv[2]
#base="/n/hernquistfs1/mvogelsberger/projects/GFM/Production/Cosmo/Cosmo"+str(sim)+"_V6/L25n512/output/"
#savedir="/n/home11/spb/scratch/Cosmo/Cosmo"+str(sim)+"_V6_512/snapdir_"+str(snapnum).rjust(3... |
Move the open outside the try, since the finally is only needed once the file is successfully opened. | """Execute files of Python code."""
import imp, os, sys
def run_python_file(filename, args):
"""Run a python source file as if it were the main program on the python
command line.
`filename` is the path to the file to execute, must be a .py file.
`args` is the argument array to present as sys.arg... | """Execute files of Python code."""
import imp, os, sys
def run_python_file(filename, args):
"""Run a python source file as if it were the main program on the python
command line.
`filename` is the path to the file to execute, must be a .py file.
`args` is the argument array to present as sys.arg... |
Change 'read-write' scope to 'read+write'. | from datetime import timedelta
from django.conf import settings
CONFIDENTIAL = 0
PUBLIC = 1
CLIENT_TYPES = (
(CONFIDENTIAL, "Confidential (Web applications)"),
(PUBLIC, "Public (Native and JS applications)")
)
RESPONSE_TYPE_CHOICES = getattr(settings, 'OAUTH_RESPONSE_TYPE_CHOICES', ("code", "token"))
READ =... | from datetime import timedelta
from django.conf import settings
CONFIDENTIAL = 0
PUBLIC = 1
CLIENT_TYPES = (
(CONFIDENTIAL, "Confidential (Web applications)"),
(PUBLIC, "Public (Native and JS applications)")
)
RESPONSE_TYPE_CHOICES = getattr(settings, 'OAUTH_RESPONSE_TYPE_CHOICES', ("code", "token"))
READ =... |
Introduce triggerChange, use it on input/textarea change | /**
* @class CM_FormField_Text
* @extends CM_FormField_Abstract
*/
var CM_FormField_Text = CM_FormField_Abstract.extend({
_class: 'CM_FormField_Text',
/** @type Boolean */
_skipTriggerChange: false,
events: {
'blur input, textarea': function() {
this.trigger('blur');
},
'focus input, text... | /**
* @class CM_FormField_Text
* @extends CM_FormField_Abstract
*/
var CM_FormField_Text = CM_FormField_Abstract.extend({
_class: 'CM_FormField_Text',
/** @type Boolean */
_skipTriggerChange: false,
events: {
'blur input, textarea': function() {
this.trigger('blur');
},
'focus input, text... |
[UI] Allow all admins to view user profile | <?php
declare(strict_types=1);
/*
* 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/.
*/
namespace ParkManager\UI\Web\Action\Admin\User;
use ParkManager\Domain\User\... | <?php
declare(strict_types=1);
/*
* 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/.
*/
namespace ParkManager\UI\Web\Action\Admin\User;
use ParkManager\Domain\User\... |
Add notification count fields to the user table. | <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function(Blueprint $table)
{
$table->increments('id');
$table->str... | <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function(Blueprint $table)
{
$table->increments('id');
$table->str... |
Allow users from phishing website to continue | 'use strict';
angular.module('ddsApp').controller('HomepageCtrl', function($scope, $state, $sessionStorage, droitsDescription, $timeout, ABTestingService, phishingExpressions) {
[ 'prestationsNationales', 'partenairesLocaux' ].forEach(function(type) {
$scope[type] = droitsDescription[type];
$scope... | 'use strict';
angular.module('ddsApp').controller('HomepageCtrl', function($scope, $state, droitsDescription, $timeout, ABTestingService, phishingExpressions) {
[ 'prestationsNationales', 'partenairesLocaux' ].forEach(function(type) {
$scope[type] = droitsDescription[type];
$scope[type + 'Count'] ... |
Add search links to tag cloud terms | angular.module('chronontology.components')
.component('periodTypeTagCloud',{
templateUrl: '../../partials/period/type-tag-cloud.html',
controller: function ($http, chronontologySettings) {
this.tags = [];
var ctrl = this;
var uri = "/data/period/?size=0&facet=re... | angular.module('chronontology.components')
.component('periodTypeTagCloud',{
templateUrl: '../../partials/period/type-tag-cloud.html',
controller: function ($http, chronontologySettings) {
this.tags = [];
var ctrl = this;
var uri = "/data/period/?size=0&facet=re... |
Read textures from WebGL correctly encoding floats | // Read texture into Float array
//
// args:
// r -- registration object
// t -- texture to read
// w -- width of buffer
// h -- height of buffer
function read_texture ( r, t, w, h ) {
var gl = r.gl;
var out = new Float32Array(3*w*h);
for ( var index = 0; index < 3; index++ ) {
var pixels = n... | // Read texture into Float array
//
// args:
// r -- registration object
// t -- texture to read
// w -- width of buffer
// h -- height of buffer
function read_texture ( r, t, w, h ) {
var gl = r.gl;
var pixels = new Uint8Array(w*h * 4);
var tempBuffer = create_texture(r, w, h);
gl.bindFramebuffe... |
Disable the update server JSON test | import chai from 'chai';
import fetch from 'node-fetch';
import https from 'https';
chai.should();
describe('Update Server', () => {
it('should be online', (done) => {
https.get('https://update.gpmdp.xyz', () => done())
.on('error', () => done(new Error('Update server was unreachable')));
});
it.skip... | import chai from 'chai';
import fetch from 'node-fetch';
import https from 'https';
chai.should();
describe('Update Server', () => {
it('should be online', (done) => {
https.get('https://update.gpmdp.xyz', () => done())
.on('error', () => done(new Error('Update server was unreachable')));
});
it('sho... |
Initialize the correct variable in init | from mopidy.frontends.mpd.dispatcher import MpdDispatcher
from mopidy.frontends.mpd.process import MpdProcess
class MpdFrontend(object):
"""
The MPD frontend.
"""
def __init__(self):
self.process = None
self.dispatcher = None
def start_server(self, core_queue):
"""
... | from mopidy.frontends.mpd.dispatcher import MpdDispatcher
from mopidy.frontends.mpd.process import MpdProcess
class MpdFrontend(object):
"""
The MPD frontend.
"""
def __init__(self):
self.server = None
self.dispatcher = None
def start_server(self, core_queue):
"""
... |
ApiHelper: Make HTTP status available on failure as well | /*
* Copyright 2018 ThoughtWorks, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... | /*
* Copyright 2018 ThoughtWorks, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... |
Remove booleanfield from example app for now
We rather want a non required field for testing and should add a
NullBooleanField anyway | from django.db import models
import i18n
from i18n.models import TranslatableModel
class Document(TranslatableModel):
untranslated_charfield = models.CharField(max_length=50, blank=True)
charfield = i18n.LocalizedCharField(max_length=50)
textfield = i18n.LocalizedTextField(max_length=500, blank=True)
... | from django.db import models
import i18n
from i18n.models import TranslatableModel
class Document(TranslatableModel):
untranslated_charfield = models.CharField(max_length=50, blank=True)
charfield = i18n.LocalizedCharField(max_length=50)
textfield = i18n.LocalizedTextField(max_length=500, blank=True)
... |
Use `ui.writeWarnLine` instead of `console.warn`. | /* jshint node: true */
'use strict';
var VersionChecker = require('ember-cli-version-checker');
var hasBeenWarned = false;
module.exports = {
name: 'ember-factory-for-polyfill',
included: function() {
this._ensureThisImport();
var checker = new VersionChecker(this);
var emberVersion = checker.forEmb... | /* jshint node: true */
'use strict';
var VersionChecker = require('ember-cli-version-checker');
var hasBeenWarned = false;
module.exports = {
name: 'ember-factory-for-polyfill',
included: function() {
this._ensureThisImport();
var checker = new VersionChecker(this);
var emberVersion = checker.forEmb... |
Remove assertion in test that should not have made it in | """
Tests for staticsite.py - the static site generator
"""
import os.path
import pytest
from fantail.staticsite import StaticSite
def test_init(tmpdir, caplog):
# Verify path does not exist
path = str(tmpdir.join('test-site'))
assert not os.path.isdir(path)
# Create the site
site = StaticSite(p... | """
Tests for staticsite.py - the static site generator
"""
import os.path
import pytest
from fantail.staticsite import StaticSite
def test_init(tmpdir, caplog):
# Verify path does not exist
path = str(tmpdir.join('test-site'))
assert not os.path.isdir(path)
# Create the site
site = StaticSite(p... |
Change help text wording to follow WorkflowStateMixin | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('icekit_press_releases', '0008_auto_20161128_1049'),
]
operations = [
migrations.AddField(
model_name='pressrelea... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('icekit_press_releases', '0008_auto_20161128_1049'),
]
operations = [
migrations.AddField(
model_name='pressrelea... |
Use str_pad() and dechex() instead of sprint()
This is a micro-optimization that improves memory usage when generating
large quantities of UUIDs. See #159 and #160. | <?php
/**
* This file is part of the ramsey/uuid library
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
* @license http://opensource.org/licenses/MIT MIT
* @link https://be... | <?php
/**
* This file is part of the ramsey/uuid library
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @copyright Copyright (c) Ben Ramsey <ben@benramsey.com>
* @license http://opensource.org/licenses/MIT MIT
* @link https://be... |
GS-8956: Allow extracting Processing Unit Containers from a Compound Processing Unit Container
svn path=/trunk/openspaces/; revision=89106
Former-commit-id: acf333707ebb008757b03896f93f1d252dca2b62 | /*
* Copyright 2006-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by ap... | /*
* Copyright 2006-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by ap... |
Use correct version of antiscroll in blueprint | module.exports = {
normalizeEntityName: function() {},
afterInstall: function(options) {
// We assume that handlebars, ember, and jquery already exist
return this.addBowerPackagesToProject([
{
// Antiscroll seems to be abandoned by its original authors. We need
// two things: (1) a ve... | module.exports = {
normalizeEntityName: function() {},
afterInstall: function(options) {
// We assume that handlebars, ember, and jquery already exist
return this.addBowerPackagesToProject([
{
// Antiscroll seems to be abandoned by its original authors. We need
// two things: (1) a ve... |
Fix a bug when res.threads is undefined | 'use strict';
/**
* @file Retrieve threads from the account
*/
var googleapis = require('googleapis');
// Retrieve all threads associated with this user account,
// using refresh_token
// starting from message #`cursor`.
module.exports = function retrieveThreads(options, cursor, threads, cb) {
options.q = "-is:ch... | 'use strict';
/**
* @file Retrieve threads from the account
*/
var googleapis = require('googleapis');
// Retrieve all threads associated with this user account,
// using refresh_token
// starting from message #`cursor`.
module.exports = function retrieveThreads(options, cursor, threads, cb) {
options.q = "-is:ch... |
Make sure PureComponents don't use context | import React, {Component, PropTypes} from 'react';
import {GithubAuthProvider} from 'firebase/auth';
const AnonymousUser = ({onSignIn}) => (
<div>
<button onClick={onSignIn}>Sign In</button>
</div>
);
const AuthenticatedUser = ({user, onSignOut}) => (
<div>
{user.displayName}
<button onClick={onSign... | import React, {PureComponent, PropTypes} from 'react';
import {GithubAuthProvider} from 'firebase/auth';
const AnonymousUser = ({onSignIn}) => (
<div>
<button onClick={onSignIn}>Sign In</button>
</div>
);
const AuthenticatedUser = ({user, onSignOut}) => (
<div>
{user.displayName}
<button onClick={on... |
Enable right content types (based on file types) in compare editor opened from Synchronization view | /*******************************************************************************
* Copyright (c) 2005-2008 VecTrace (Zingo Andersen) 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 distrib... | /*******************************************************************************
* Copyright (c) 2005-2008 VecTrace (Zingo Andersen) 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 distrib... |
Fix wrong return phpdoc value | <?php
/**
* @title Provider Class
*
* @author Pierre-Henry Soria <ph7software@gmail.com>
* @copyright (c) 2012-2017, Pierre-Henry Soria. All Rights Reserved.
* @license GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
* @package ... | <?php
/**
* @title Provider Class
*
* @author Pierre-Henry Soria <ph7software@gmail.com>
* @copyright (c) 2012-2017, Pierre-Henry Soria. All Rights Reserved.
* @license GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
* @package ... |
Add missing github field to Author serializer. | # Author: Braedy Kuzma
from rest_framework import serializers
from dash.models import Post, Author, Comment, Category
class AuthorSerializer(serializers.ModelSerializer):
class Meta:
model = Author
fields = ('id', 'host', 'url', 'github')
def to_representation(self, author):
rv = seri... | # Author: Braedy Kuzma
from rest_framework import serializers
from dash.models import Post, Author, Comment, Category
class AuthorSerializer(serializers.ModelSerializer):
class Meta:
model = Author
fields = ('id', 'host', 'url')
def to_representation(self, author):
rv = serializers.Mo... |
Make specific tweet endpoint adhere to API schema | const Tweet = require('../models/tweet')
const config = require('../config')
const mongoose = require('mongoose')
const specificTweetsController = function (req, res) {
res.set('Access-Control-Allow-Origin', '*')
if (!req.params.name) {
res.status(400).send('Invalid trend name')
return
}
let query
... | const Tweet = require('../models/tweet')
const config = require('../config')
const mongoose = require('mongoose')
const specificTweetsController = function (req, res) {
res.set('Access-Control-Allow-Origin', '*')
if (!req.params.name) {
res.status(400).send('Invalid trend name')
return
}
let query
... |
Move message id generation to requestmanager | import json
class Jsonrpc(object):
def toPayload(self, reqid, method, params):
"""
Should be called to valid json create payload object
"""
if not method:
raise Exception("jsonrpc method should be specified!")
return json.dumps({
"jsonrpc": "2.0",
... | class Jsonrpc(object):
def __init__(self):
self.messageId = 0
@staticmethod
def getInstance():
return Jsonrpc()
def toPayload(self, method, params):
"""
Should be called to valid json create payload object
"""
if not method:
raise Exception(... |
Remove explicit commit as Solr will do a soft-commit already | <?php
class Asm_Solr_Model_Indexer_Cms extends Mage_Index_Model_Indexer_Abstract
{
protected function _construct()
{
$this->_init('solr/indexer_cms');
}
/**
* Get Indexer name
*
* @return string
*/
public function getName()
{
return Mage::helper('solr')->__('Solr CMS Search Index');
}
/**
* Ge... | <?php
class Asm_Solr_Model_Indexer_Cms extends Mage_Index_Model_Indexer_Abstract
{
protected function _construct()
{
$this->_init('solr/indexer_cms');
}
/**
* Get Indexer name
*
* @return string
*/
public function getName()
{
return Mage::helper('solr')->__('Solr CMS Search Index');
}
/**
* Ge... |
Format by removing extra new line. | package processor
import "github.com/materials-commons/mcstore/pkg/db/schema"
// fileProcess defines an interface for processing different
// types of files. Processing may include extracting data,
// conversion of the file to a different type, or whatever
// is deemed appropriate for the file type.
type Processor in... | package processor
import "github.com/materials-commons/mcstore/pkg/db/schema"
// fileProcess defines an interface for processing different
// types of files. Processing may include extracting data,
// conversion of the file to a different type, or whatever
// is deemed appropriate for the file type.
type Processor in... |
Use NodeJS environmental variables as configuration points for DB URL, user, and password values, rather than opening an external configuration file. | module.exports = function(app) {
var mongoose = require('mongoose'); // require mongoose (for mongodb integration
var db = require('./app_api/models/db'); // handles database connection open/close
var routesApi = require('./app_api/routes/index');
app.use('/api', routesApi); // provide routes in AP... | module.exports = function(app) {
var mongoose = require('mongoose'); // require mongoose (for mongodb integration
var fs = require('fs'); // necessary to read from files
var db = require('./app_api/models/db'); // handles database connection open/close
var routesApi = require('./app_api/routes/index');
app... |
Fix tagName selection for IE8 | (function () {
'use strict';
moj.Modules.SubmitOnce = {
el: '.js-SubmitOnce',
init: function () {
this.cacheEls();
this.bindEvents();
this.options = {
alt: this.$el.data('alt') || 'Please wait…'
};
},
cacheEls: function () {
this.$el = $(this.el);
this... | (function () {
'use strict';
moj.Modules.SubmitOnce = {
el: '.js-SubmitOnce',
init: function () {
this.cacheEls();
this.bindEvents();
this.options = {
alt: this.$el.data('alt') || 'Please wait…'
};
},
cacheEls: function () {
this.$el = $(this.el);
this... |
Use _.extend instead of Object.assign | var _ = require('lodash');
var fs = require('fs');
var archiver = require('./archiver');
var createServiceFile = require('./service');
var createSpecFile = require('./spec');
var files = require('./files');
function generateServiceFile(root, pkg) {
var serviceFileContents = createServiceFile(pkg);
var serviceFile... | var fs = require('fs');
var archiver = require('./archiver');
var createServiceFile = require('./service');
var createSpecFile = require('./spec');
var files = require('./files');
function generateServiceFile(root, pkg) {
var serviceFileContents = createServiceFile(pkg);
var serviceFilePath = files.serviceFile(ro... |
Save datetime in JSON as ISO | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
import json,os
from datetime import datetime
from scrapy.exporters import JsonLinesItemExporter
path = "downloads"
class Onl... | # -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
import json,os
from datetime import datetime
from scrapy.exporters import JsonLinesItemExporter
path = "downloads"
class Onl... |
Add Neil Fincham's Lighthouse server to the random rotation - lighthouseprojects.io
Fixes issue #144. | package lighthouse;
import com.google.common.collect.*;
import java.util.*;
/**
* Hard-coded list of project servers so the app can randomly pick between them and load balance the work.
*/
public class ServerList {
// This would be so much easier and less verbose with Kotlin ...
public static class Entry ... | package lighthouse;
import com.google.common.collect.*;
import java.util.*;
/**
* Hard-coded list of project servers so the app can randomly pick between them and load balance the work.
*/
public class ServerList {
// This would be so much easier and less verbose with Kotlin ...
public static class Entry ... |
Stop error messages (from TestPipedRDFIterators) appearing in the console output.
git-svn-id: bc509ec38c1227b3e85ea1246fda136342965d36@1444626 13f79535-47bb-0310-9956-ffa450edef68 | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you... | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you... |
Change login request to post | const LOGIN_URL = '/login'
export const USER_LOGIN_FAIL = 'USER_LOGIN_FAIL';
export const USER_LOGIN_SUCCESS = 'USER_LOGIN_SUCCESS';
export const USER_LOGOUT = 'USER_LOGOUT';
let userLogInSuccess = email => {
console.log('In userLogInSuccess, email=', email)
return {
type: USER_LOGIN_SUCCESS,
payload: ema... | const LOGIN_URL = '/login'
export const USER_LOGIN_FAIL = 'USER_LOGIN_FAIL';
export const USER_LOGIN_SUCCESS = 'USER_LOGIN_SUCCESS';
export const USER_LOGOUT = 'USER_LOGOUT';
let userLogInSuccess = email => {
console.log('In userLogInSuccess, email=', email)
return {
type: USER_LOGIN_SUCCESS,
payload: ema... |
Replace deprecated login/logout function-based views | """
Map puzzle URLs to views. Also maps the root URL to the latest puzzle.
"""
from django.conf.urls import include, url
from django.contrib.auth import views as auth_views
from puzzle import views
from puzzle.feeds import PuzzleFeed
urlpatterns = [ #pylint: disable=invalid-name
url(r'^$', views.latest, name='lat... | """
Map puzzle URLs to views. Also maps the root URL to the latest puzzle.
"""
from django.conf.urls import include, url
from django.contrib.auth import views as auth_views
from puzzle import views
from puzzle.feeds import PuzzleFeed
urlpatterns = [ #pylint: disable=invalid-name
url(r'^$', views.latest, name='lat... |
Support deprecated use of the interface property of Bond. | # Copyright 2015 Internap.
#
# 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, so... | # Copyright 2015 Internap.
#
# 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, so... |
Set date format leniency to false. | package org.jreform.types;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.jreform.InputDataType;
public final class DateType implements InputDataType<Date>
{
private DateFormat dateFormat;
private DateType(String dateFor... | package org.jreform.types;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.jreform.InputDataType;
public final class DateType implements InputDataType<Date>
{
private DateFormat dateFormat;
private DateType(String dateFor... |
Add in missing src to path. Add project root constant. | <?php
/*
* This file is part of the PhpJobQueue package.
*
* (c) Mark Fullbrook <mark.fullbrook@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require __DIR__.'/vendor/symfony/src/Symfony/Component/ClassLoader/Univers... | <?php
/*
* This file is part of the PhpJobQueue package.
*
* (c) Mark Fullbrook <mark.fullbrook@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require __DIR__.'/vendor/symfony/Symfony/Component/ClassLoader/UniversalCl... |
Extend the right TaxonomyChoiceType class | <?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\TaxonomiesBundle\Form\Type;
use Sylius\Bundle\TaxonomiesBundle\Form\Type\Taxo... | <?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\TaxonomiesBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
/**
* ... |
Ch20: Use login_required decorator in URL pattern. | from django.conf.urls import url
from django.contrib.auth.decorators import \
login_required
from ..views import (
TagCreate, TagDelete, TagDetail, TagList,
TagUpdate)
urlpatterns = [
url(r'^$',
TagList.as_view(),
name='organizer_tag_list'),
url(r'^create/$',
login_required... | from django.conf.urls import url
from ..views import (
TagCreate, TagDelete, TagDetail, TagList,
TagUpdate)
urlpatterns = [
url(r'^$',
TagList.as_view(),
name='organizer_tag_list'),
url(r'^create/$',
TagCreate.as_view(),
name='organizer_tag_create'),
url(r'^(?P<slug... |
Fix grammer within doc string example | """This example demonstrates how to perform different kinds of redirects using hug"""
import hug
@hug.get()
def sum_two_numbers(number_1: int, number_2: int):
"""I'll be redirecting to this using a variety of approaches below"""
return number_1 + number_2
@hug.post()
def internal_redirection_automatic(numbe... | """This example demonstrates how to perform different kinds of redirects using hug"""
import hug
@hug.get()
def sum_two_numbers(number_1: int, number_2: int):
"""I'll be redirecting to this using a variety of approaches below"""
return number_1 + number_2
@hug.post()
def internal_redirection_automatic(numbe... |
Fix for Quantities not working with numpy.linspace() in numpy 1.11 | from __future__ import absolute_import
import quantities as pq
# At least up to quantities 0.10.1 the additional arguments to the min and max
# function did not get passed along.
# A fix already exists:
# <https://github.com/dopplershift/python-quantities/commit/30e8812ac15f551c65311d808c2a004f53913a25>
# Also a pull... | from __future__ import absolute_import
import quantities as pq
# At least up to quantities 0.10.1 the additional arguments to the min and max
# function did not get passed along.
# A fix already exists:
# <https://github.com/dopplershift/python-quantities/commit/30e8812ac15f551c65311d808c2a004f53913a25>
# Also a pull... |
Modify mongo database server saved to .env |
let SakuyaBot = require('./src/SakuyaBot')
let SakuyaDb = require('./src/SakuyaDb')
let Twitter = require('twitter')
let TwitterClient = require('./src/TwitterClient')
let FollowCrawler = require('./src/FollowingCrawler')
let MongoDb = require('mongodb').Db
let MongoServer = require('mongodb').Server
// 環境変数よみこみ
requ... |
let SakuyaBot = require('./src/SakuyaBot')
let SakuyaDb = require('./src/SakuyaDb')
let Twitter = require('twitter')
let TwitterClient = require('./src/TwitterClient')
let FollowCrawler = require('./src/FollowingCrawler')
let MongoDb = require('mongodb').Db
let MongoServer = require('mongodb').Server
// 環境変数よみこみ
requ... |
Add numpy as an install requirement. | from setuptools import find_packages, setup
import versioneer
setup(
name="bmipy",
version=versioneer.get_version(),
description="Basic Model Interface for Python",
author="Eric Hutton",
author_email="huttone@colorado.edu",
url="http://csdms.colorado.edu",
classifiers=[
"Intended ... | from setuptools import find_packages, setup
import versioneer
setup(
name="bmipy",
version=versioneer.get_version(),
description="Basic Model Interface for Python",
author="Eric Hutton",
author_email="huttone@colorado.edu",
url="http://csdms.colorado.edu",
classifiers=[
"Intended ... |
Fix crash if no MOTD exists. | package irc
import (
"bufio"
"fmt"
"os"
"sync"
)
const (
motdHeader = "- %s Message of the day - "
motdFooter = "- End of /MOTD command"
)
var (
motdOnce sync.Once
motd []string
)
// sendMOTD will send the message of the day to a relay.
func sendMOTD(state state, sink sink) {
motdOnce.Do(func() { loadM... | package irc
import (
"bufio"
"fmt"
"os"
"sync"
)
const (
motdHeader = "- %s Message of the day - "
motdFooter = "- End of /MOTD command"
)
var (
motdOnce sync.Once
motd []string
)
// sendMOTD will send the message of the day to a relay.
func sendMOTD(state state, sink sink) {
motdOnce.Do(func() { loadM... |
Fix excess reason condition wrapping | /*global app, me, client*/
"use strict";
var _ = require('underscore');
var HumanModel = require('human-model');
var logger = require('andlog');
module.exports = HumanModel.define({
type: 'call',
initialize: function (attrs) {
this.contact.onCall = true;
},
session: {
contact: 'object... | /*global app, me, client*/
"use strict";
var _ = require('underscore');
var HumanModel = require('human-model');
var logger = require('andlog');
module.exports = HumanModel.define({
type: 'call',
initialize: function (attrs) {
this.contact.onCall = true;
},
session: {
contact: 'object... |
Add help text for program_end date.
Fixes 1411. | #!/usr/bin/env python2.5
#
# Copyright 2008 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | #!/usr/bin/env python2.5
#
# Copyright 2008 the Melange authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... |
Remove jspm scripts on build | const gulp = require('gulp');
const replace = require('gulp-replace');
const Builder = require('jspm').Builder;
const conf = require('../conf/gulp.conf');
gulp.task('systemjs', systemjs);
gulp.task('systemjs:html', updateIndexHtml);
function systemjs(done) {
const builder = new Builder('./', 'jspm.config.js');
... | const gulp = require('gulp');
const replace = require('gulp-replace');
const Builder = require('jspm').Builder;
const conf = require('../conf/gulp.conf');
gulp.task('systemjs', systemjs);
gulp.task('systemjs:html', updateIndexHtml);
function systemjs(done) {
const builder = new Builder('./', 'jspm.config.js');
... |
Use globals.json instead of conf.json | // tpl - a general purpose template cli
// (c) 2011 Paul Vorbach. Licensed under MIT.
;(function() {
var fs = require('fs');
var path = require('path');
var append = require('append');
var confdir = require('confdir');
module.exports = function (cb) {
confdir(process.cwd(), 'pub', function(err, dir) {
if (err)... | // tpl - a general purpose template cli
// (c) 2011 Paul Vorbach. Licensed under MIT.
;(function() {
var fs = require('fs');
var path = require('path');
var append = require('append');
var confdir = require('confdir');
module.exports = function (cb) {
confdir(process.cwd(), 'pub', function(err, dir) {
if (err)... |
Fix issue with phpunit and sessions | <?php
namespace Michaeljennings\Carpenter\Tests;
use Michaeljennings\Carpenter\Carpenter;
use PHPUnit_Framework_TestCase;
class TestCase extends PHPUnit_Framework_TestCase
{
public function __construct()
{
// Fixes error with session_start() and phpunit
ob_start();
}
public function set... | <?php
namespace Michaeljennings\Carpenter\Tests;
use Michaeljennings\Carpenter\Carpenter;
use PHPUnit_Framework_TestCase;
class TestCase extends PHPUnit_Framework_TestCase
{
public function __construct()
{
// Fixes error with session_start() and phpunit
ob_start();
}
protected function mak... |
Set scheduler to start at 8pm | import bottle
import waitress
import controller
import breathe
from pytz import timezone
from apscheduler.schedulers.background import BackgroundScheduler
bottle_app = bottle.app()
scheduler = BackgroundScheduler()
scheduler.configure(timezone=timezone('US/Pacific'))
breather = breathe.Breathe()
my_controller = contro... | import bottle
import waitress
import controller
import breathe
from pytz import timezone
from apscheduler.schedulers.background import BackgroundScheduler
bottle_app = bottle.app()
scheduler = BackgroundScheduler()
scheduler.configure(timezone=timezone('US/Pacific'))
breather = breathe.Breathe()
my_controller = contro... |
Make sure we actually exit when we fail on startup | import Promise from 'bluebird';
import process from 'process';
import util from 'util';
import { withRetries } from 'killrvideo-nodejs-common';
import { Scheduler } from './scheduler';
import * as availableTasks from './tasks';
import { initCassandraAsync } from './utils/cassandra';
import { initializeSampleDataAsync }... | import Promise from 'bluebird';
import process from 'process';
import util from 'util';
import { withRetries } from 'killrvideo-nodejs-common';
import { Scheduler } from './scheduler';
import * as availableTasks from './tasks';
import { initCassandraAsync } from './utils/cassandra';
import { initializeSampleDataAsync }... |
Update dataProvider on BitField structure | <?php
namespace Redtrine\Tests\Structure;
use Redtrine\Tests\RedtrineTestCase;
use Redtrine\Structure\BitField;
class BitFieldTest extends RedtrineTestCase
{
/**
* @var bitField
*/
protected $bit;
public function setUp()
{
parent::setUp();
$this->bit = new BitField('TestBi... | <?php
namespace Redtrine\Tests\Structure;
use Redtrine\Tests\RedtrineTestCase;
use Redtrine\Structure\BitField;
class BitFieldTest extends RedtrineTestCase
{
/**
* @var bitField
*/
protected $bit;
public function setUp()
{
parent::setUp();
$this->bit = new BitField('TestBi... |
Insert request method option storage driver URLFor
Docker-DCO-1.1-Signed-off-by: Josh Hawn <josh.hawn@docker.com> (github: jlhawn) | package storage
import (
"net/http"
"time"
"github.com/docker/distribution"
"github.com/docker/distribution/digest"
)
// layerReader implements Layer and provides facilities for reading and
// seeking.
type layerReader struct {
fileReader
digest digest.Digest
}
var _ distribution.Layer = &layerReader{}
func... | package storage
import (
"net/http"
"time"
"github.com/docker/distribution"
"github.com/docker/distribution/digest"
)
// layerReader implements Layer and provides facilities for reading and
// seeking.
type layerReader struct {
fileReader
digest digest.Digest
}
var _ distribution.Layer = &layerReader{}
func... |
Set locale/timezone correctly when in format | import moment from 'moment-timezone';
import AbstractFormat from './abstract';
export default class DateFormat extends AbstractFormat {
format(dateValue, dateFormat, locale, timezone) {
locale = locale || this._locale;
timezone = timezone || this._timezone;
return this
.moment(dateValue, locale, t... | import moment from 'moment-timezone';
import AbstractFormat from './abstract';
export default class DateFormat extends AbstractFormat {
format(dateValue, dateFormat, locale, timezone) {
return this
.moment(dateValue, locale, timezone)
.format(dateFormat);
}
moment(dateValue, locale, timezone) {
... |
Fix initial state of list subscribers table | import React, { PropTypes } from 'react';
import { BootstrapTable, TableHeaderColumn } from 'react-bootstrap-table';
import BSTyle from 'react-bootstrap-table/dist/react-bootstrap-table.min.css';
export default class ManageSubscribersTable extends React.Component {
constructor(props) {
super(props);
this.st... | import React, { PropTypes } from 'react';
import { BootstrapTable, TableHeaderColumn } from 'react-bootstrap-table';
import BSTyle from 'react-bootstrap-table/dist/react-bootstrap-table.min.css';
export default class ManageSubscribersTable extends React.Component {
constructor(props) {
super(props);
this.st... |
Add static field for texture in basic energy creator | package info.u_team.u_team_test.screen;
import info.u_team.u_team_core.gui.elements.EnergyStorageWidget;
import info.u_team.u_team_core.screen.UBasicContainerScreen;
import info.u_team.u_team_test.TestMod;
import info.u_team.u_team_test.container.BasicEnergyCreatorContainer;
import net.minecraft.entity.player.PlayerIn... | package info.u_team.u_team_test.screen;
import info.u_team.u_team_core.gui.elements.EnergyStorageWidget;
import info.u_team.u_team_core.screen.UBasicContainerScreen;
import info.u_team.u_team_test.TestMod;
import info.u_team.u_team_test.container.BasicEnergyCreatorContainer;
import net.minecraft.entity.player.PlayerIn... |
Remove unnescessary routes from registration parameters | 'use strict';
require('css/registrations.css');
var ko = require('knockout');
var $ = require('jquery');
var $osf = require('js/osfHelpers');
var RegistrationManager = require('js/registrationUtils').RegistrationManager;
var ctx = window.contextVars;
var node = window.contextVars.node;
$(document).ready(function() ... | 'use strict';
require('css/registrations.css');
var ko = require('knockout');
var $ = require('jquery');
var $osf = require('js/osfHelpers');
var RegistrationManager = require('js/registrationUtils').RegistrationManager;
var ctx = window.contextVars;
var node = window.contextVars.node;
$(document).ready(function() ... |
Improve equalizer fixes: avoid flickering | import $ from 'jquery';
import * as _ from 'lodash';
/**
* data-equalizer-ignore-class takes a string of classes that should be applied to an element that
* uses data-equalizer-watch, but which should be ignored while the height calculations are being
* performed.
*/
$('[data-equalizer-ignore-class]').each((index,... | import $ from 'jquery';
/**
* data-equalizer-ignore-class takes a string of classes that should be applied to an element that
* uses data-equalizer-watch, but which should be ignored while the height calculations are being
* performed.
*/
$('[data-equalizer-ignore-class]').each((index, element) => {
'use strict'... |
Make jsdoc the default task | var gulp = require('gulp'),
jsdoc = require('gulp-jsdoc'),
docsSrcDir = './assets/js/**/*.js',
docsDestDir = './docs/js',
jsDocTask;
jsDocTask = function() {
return gulp.src(docsSrcDir)
.pipe(
jsdoc(docsDestDir,
{
path: './node_modules/jaguarjs-jsdoc',
applicatio... | var gulp = require('gulp'),
jsdoc = require('gulp-jsdoc'),
docsSrcDir = './assets/js/**/*.js',
docsDestDir = './docs/js',
jsDocTask;
jsDocTask = function() {
return gulp.src(docsSrcDir)
.pipe(
jsdoc(docsDestDir,
{
path: './node_modules/jaguarjs-jsdoc',
applicatio... |
Revoke starting player from the board. | package game;
import static com.google.common.base.Preconditions.checkArgument;
import java.util.Optional;
/**
* Created by Dimitry on 14.05.2016.
*/
public class Board
{
private final int numberOfRows;
private final int numberOfColumns;
private Player[][] occupiers;
public Board(final int numberOfRows, f... | package game;
import static com.google.common.base.Preconditions.checkArgument;
import java.util.Optional;
/**
* Created by Dimitry on 14.05.2016.
*/
public class Board
{
private Player startingPlayer;
private final int numberOfRows;
private final int numberOfColumns;
private Player[][] occupiers;
publi... |
MP3: Replace hardcoded names with tracklist | #!/usr/bin/python3
import ID3
import os
import sys
def read_tracklist():
tracklist = []
for line in sys.stdin:
tracklist.append(line)
return tracklist
tracklist = read_tracklist()
mp3_extension = ".mp3"
files_all = os.listdir('.')
files = []
for f in files_all:
# Prune directories
if n... | #!/usr/bin/python3
import ID3
import os
import sys
mp3_extension = ".mp3"
names = ["final_name_1", "final_name_2", "final_name_3"]
files_all = os.listdir('.')
files = []
for f in files_all:
# Prune directories
if not os.path.isfile(f):
continue
# Prune non-MP3 files
filename, extension = o... |
Add fix for null images | import Ember from 'ember';
export default Ember.Object.extend({
posterDefaultSize: 2,
posterUrl: function() {
var posterPath = this.get('poster_path');
var config = this.get('tmdbConfig');
if (posterPath === undefined || posterPath === null) {
return 'https://d3a8mw37cqal2z.cloudfront.net/assets/... | import Ember from 'ember';
export default Ember.Object.extend({
posterDefaultSize: 2,
posterUrl: function() {
var posterPath = this.get('poster_path');
var config = this.get('tmdbConfig');
console.log('config',this,config);
if (posterPath === undefined) {
return 'https://d3a8mw37cqal2z.cloudf... |
Add gradient background to GraphScheme | # -*- coding: utf-8 -*-
from PySide import QtGui, QtCore
class GraphScheme( QtGui.QGraphicsScene):
""" Graph scheme drawing class
This class inherits from QtGui.QGraphicsScene and add functions
for manage GraphBlocks objects in scheme.
"""
def __init__(self ):
super... | # -*- coding: utf-8 -*-
from PySide import QtGui
class GraphScheme( QtGui.QGraphicsScene):
""" Graph scheme drawing class
This class inherits from QtGui.QGraphicsScene and add functions
for manage GraphBlocks objects in scheme.
"""
def __init__(self ):
super(GraphSc... |
Add case_sharing to saved_app view so that the case sharing warning will work | function(doc){
if((doc.doc_type == 'Application' || doc.doc_type == 'RemoteApp') && doc.copy_of != null) {
emit([doc.domain, doc.copy_of, doc.version], {
doc_type: doc.doc_type,
short_url: doc.short_url,
version: doc.version,
_id: doc._id,
name: do... | function(doc){
if((doc.doc_type == 'Application' || doc.doc_type == 'RemoteApp') && doc.copy_of != null) {
emit([doc.domain, doc.copy_of, doc.version], {
doc_type: doc.doc_type,
short_url: doc.short_url,
version: doc.version,
_id: doc._id,
name: do... |
FIX: Remove empty field, hangover from access keys module | <?php
class FacebookMetadataSiteConfig extends DataExtension {
static $db = array(
'SkipToMainContentAccessKey' => 'VarChar(1)'
);
static $has_one = array(
'FacebookLogo' => 'Image'
);
public function updateCMSFields(FieldList $fields) {
$fields->rename... | <?php
class FacebookMetadataSiteConfig extends DataExtension {
static $db = array(
'SkipToMainContentAccessKey' => 'VarChar(1)'
);
static $has_one = array(
'FacebookLogo' => 'Image'
);
public function updateCMSFields(FieldList $fields) {
$tf2 = new TextFie... |
Change default compiler and default compilers list. | const ALL_COMPILERS = ['clang-3.8', 'clang-3.9', 'clang-4.0', 'clang-5.0',
'clang-6.0', 'clang-7.0', 'clang-7.1', 'clang-8.0', 'clang-9.0',
'clang-10.0', 'clang-11.0', 'clang-11.1', 'clang-12.0', 'clang-13.0',
'gcc-5.5', 'gcc-6.4', 'gcc-6.5', 'gcc-7.2', 'gcc-7.3',
'gcc-7.4', 'gcc-7.5', 'gcc-8.1', 'gcc-8... | const ALL_COMPILERS = ['clang-3.8', 'clang-3.9', 'clang-4.0', 'clang-5.0',
'clang-6.0', 'clang-7.0', 'clang-7.1', 'clang-8.0', 'clang-9.0',
'clang-10.0', 'clang-11.0', 'clang-12.0', 'gcc-5.5', 'gcc-6.4', 'gcc-6.5', 'gcc-7.2', 'gcc-7.3',
'gcc-7.4', 'gcc-7.5', 'gcc-8.1', 'gcc-8.2', 'gcc-8.3', 'gcc-8.4',
'... |
Refactor algorithm to perform better | 'use strict'
var visit = require('unist-util-visit')
var toString = require('nlcst-to-string')
var posjs = require('pos')
module.exports = pos
var tagger = new posjs.Tagger()
function pos() {
return transformer
}
function transformer(tree) {
visit(tree, 'SentenceNode', visitor)
// Patch all words in `parent... | 'use strict'
var visit = require('unist-util-visit')
var toString = require('nlcst-to-string')
var posjs = require('pos')
module.exports = pos
var tagger = new posjs.Tagger()
function pos() {
return transformer
}
function transformer(tree) {
var queue = []
visit(tree, 'WordNode', visitor)
/* Gather a par... |
Update docs and license for python | #!/usr/bin/env python
# Very very very quick demo of how to recover the compressed payloads again.
# TODO - at least take the same command line arguments as mosq-squasher
# See LICENSE.txt
import zlib
import paho.mqtt.client as mqtt
# The callback for when the client receives a CONNACK response from the server.
def on... | #!/usr/bin/env python
import zlib
import paho.mqtt.client as mqtt
# The callback for when the client receives a CONNACK response from the server.
def on_connect(client, userdata, flags, rc):
print("Connected with result code "+str(rc))
# Subscribing in on_connect() means that if we lose the connection and
... |
Update not found page to fix command request link.
The new command label seems to have changed recently. This commit fixes the broken link. | //@flow
/*******************************************************************************
* Imports
*******************************************************************************/
import React from 'react'
import { Markdown, Cr } from 'tldr/components/Markdown'
import Link from 'tldr/components/Link'
import Tldr f... | //@flow
/*******************************************************************************
* Imports
*******************************************************************************/
import React from 'react'
import { Markdown, Cr } from 'tldr/components/Markdown'
import Link from 'tldr/components/Link'
import Tldr f... |
Remove testing from gulp watch | 'use strict';
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var util = require('gulp-util');
var wait = require('gulp-wait');
var runSequence = require('run-sequence');
var mocha = require('gulp-mocha');
var sourceFiles = [
'app.js',
'./controllers/*.js',
'./helpers/*.js',
'./models/*.js',
... | 'use strict';
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var util = require('gulp-util');
var wait = require('gulp-wait');
var runSequence = require('run-sequence');
var mocha = require('gulp-mocha');
var sourceFiles = [
'app.js',
'./controllers/*.js',
'./helpers/*.js',
'./models/*.js',
... |
fix: Add guard against empty stdin | // @flow
/* eslint-disable no-console */
import _ from 'lodash'
import stdin from 'get-stdin'
import Promise from 'bluebird'
import { parseOptions } from './cli'
import { checkFiles, checkString } from './checks'
import { formatOutput } from './formatters'
import { hasError } from './utils'
import { getDiffInformation... | // @flow
/* eslint-disable no-console */
import _ from 'lodash'
import stdin from 'get-stdin'
import Promise from 'bluebird'
import { parseOptions } from './cli'
import { checkFiles, checkString } from './checks'
import { formatOutput } from './formatters'
import { hasError } from './utils'
import { getDiffInformation... |
Remove text transformation on user account dropdown button | import {Dropdown} from 'reactjs-components';
import React from 'react';
class UserAccountDropdown extends React.Component {
handleItemSelection(item) {
if (item.onClick) {
item.onClick();
}
}
render() {
return (
<Dropdown buttonClassName="user-account-dropdown-button text-no-transform"
... | import {Dropdown} from 'reactjs-components';
import React from 'react';
class UserAccountDropdown extends React.Component {
handleItemSelection(item) {
if (item.onClick) {
item.onClick();
}
}
render() {
return (
<Dropdown buttonClassName="user-account-dropdown-button"
dropdownMen... |
[display] Rewrite component and pass all props to the children. | //Dependencies.
const builder = require('focus').component.builder;
const React = require('react');
const type = require('focus').component.types;
/**
* Input text mixin.
* @type {Object}
*/
const displayTextMixin = {
/** @inheritdoc */
getDefaultProps(){
return {
formatter: (data)=> data
};
},
... | //Dependencies.
var builder = require('focus').component.builder;
var React = require('react');
var type = require('focus').component.types;
/**
* Input text mixin.
* @type {Object}
*/
var displayTextMixin = {
/** @inheritdoc */
getDefaultProps: function getInputDefaultProps() {
return {
value: undefi... |
Fix missing filePath in Error and PluginError.
file.contents = … somehow resets file.path on error so we have to store
it. Also, React Error does not specify fileName, so add it if missing. | 'use strict';
var path = require('path');
var gutil = require('gulp-util');
var through = require('through2');
var react = require('react-tools');
module.exports = function (options) {
return through.obj(function (file, enc, cb) {
if (file.isNull()) {
this.push(file);
return cb();
}
if (file.isStream()) ... | 'use strict';
var path = require('path');
var gutil = require('gulp-util');
var through = require('through2');
var react = require('react-tools');
module.exports = function (options) {
return through.obj(function (file, enc, cb) {
if (file.isNull()) {
this.push(file);
return cb();
}
if (file.isStream()) ... |
Add test to verify storage check | import enhancer from '../src/enhancer'
import createMockStorage from './utils/testStorage'
describe('enhancer', () => {
it('returns enhanced store with initial storage state', () => {
const enhancedCreateStore = enhancer({ storage: createMockStorage() })
expect(enhancedCreateStore).toBeInstanceOf(Function)
... | import enhancer from '../src/enhancer'
import createMockStorage from './utils/testStorage'
describe('enhancer', () => {
it('returns enhanced store with initial storage state', () => {
const enhancedCreateStore = enhancer()
expect(enhancedCreateStore).toBeInstanceOf(Function)
})
it('sets up store with i... |
Fix needed after rename of method | package org.opencode4workspace.it;
import java.io.UnsupportedEncodingException;
import java.util.List;
import org.opencode4workspace.WWClient;
import org.opencode4workspace.WWException;
import org.opencode4workspace.endpoints.WWAuthenticationEndpoint;
import org.opencode4workspace.endpoints.WWGraphQLEndpoint;
import ... | package org.opencode4workspace.it;
import java.io.UnsupportedEncodingException;
import java.util.List;
import org.opencode4workspace.WWClient;
import org.opencode4workspace.WWException;
import org.opencode4workspace.endpoints.WWAuthenticationEndpoint;
import org.opencode4workspace.endpoints.WWGraphQLEndpoint;
import ... |
Fix potential panic in TimeoutAfter | package util
import (
"fmt"
"time"
)
// TimeoutError is error returned after timeout occured.
type TimeoutError struct {
after time.Duration
}
// Error implements the Go error interface.
func (t *TimeoutError) Error() string {
return fmt.Sprintf("calling the function timeout after %v", t.after)
}
// TimeoutAfte... | package util
import (
"fmt"
"time"
)
// TimeoutError is error returned after timeout occured.
type TimeoutError struct {
after time.Duration
}
// Error implements the Go error interface.
func (t *TimeoutError) Error() string {
return fmt.Sprintf("calling the function timeout after %v", t.after)
}
// TimeoutAfte... |
Correct relative link to the categories | <aside id="blog-sidebar">
<section class="latest-posts">
<h3>Latest Posts</h3>
<ul>
<?php
global $post;
$args = array( 'numberposts' => 5 );
$myposts = get_posts( $args );
foreach( $myposts as $post ) :
setup_postdata($post);
?>
<li>
<h4><a href="<?php the_permalink(); ?>"><?php the_title... | <aside id="blog-sidebar">
<section class="latest-posts">
<h3>Latest Posts</h3>
<ul>
<?php
global $post;
$args = array( 'numberposts' => 5 );
$myposts = get_posts( $args );
foreach( $myposts as $post ) :
setup_postdata($post);
?>
<li>
<h4><a href="<?php the_permalink(); ?>"><?php the_title... |
Add `pathfinder` to the library namespace | from .diagnostics import effective_sample_size as ess
from .diagnostics import potential_scale_reduction as rhat
from .kernels import (
adaptive_tempered_smc,
elliptical_slice,
ghmc,
hmc,
irmh,
mala,
meads,
mgrad_gaussian,
nuts,
orbital_hmc,
pathfinder,
pathfinder_adaptat... | from .diagnostics import effective_sample_size as ess
from .diagnostics import potential_scale_reduction as rhat
from .kernels import (
adaptive_tempered_smc,
elliptical_slice,
ghmc,
hmc,
irmh,
mala,
meads,
mgrad_gaussian,
nuts,
orbital_hmc,
pathfinder_adaptation,
rmh,
... |
Allow task third parameter to be optional | 'use strict';
var nomnom = require('nomnom');
var signal = require('./lib/signal');
var tree = require('./lib/tree');
var task = function (name, callback, options) {
options = options || [];
var command = nomnom.command(name);
options.forEach(function (option) {
command = command.option(option.... | 'use strict';
var nomnom = require('nomnom');
var signal = require('./lib/signal');
var tree = require('./lib/tree');
var task = function (name, callback, options) {
var command = nomnom.command(name);
options.forEach(function (option) {
command = command.option(option.name, {
abbr: opti... |
Remove assignment of non-existing member. | <?php
declare(strict_types = 1);
namespace Apha\Saga;
use Apha\Domain\Identity;
use Apha\EventHandling\EventHandler;
use Apha\Message\Event;
use Apha\Message\Events;
use JMS\Serializer\Annotation as Serializer;
abstract class Saga implements EventHandler
{
/**
* @Serializer\Type("Apha\Domain\Identity")
... | <?php
declare(strict_types = 1);
namespace Apha\Saga;
use Apha\Domain\Identity;
use Apha\EventHandling\EventHandler;
use Apha\Message\Event;
use Apha\Message\Events;
use JMS\Serializer\Annotation as Serializer;
abstract class Saga implements EventHandler
{
/**
* @Serializer\Type("Apha\Domain\Identity")
... |
Add timeout for the request and catch more exceptions and print them if debug enabled in the conf | import urllib.request
import os
import re
## Get HTML for given url
def getHtml( self, url, useragent):
try:
if useragent == True:
user_agent = "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)"
headers = { 'User-Agent' : user_agent }
req = urllib.request.Request(url, None, headers)
else:... | import urllib.request
import os
## Get HTML for given url
def getHtml( self, url, useragent):
try:
if useragent == True:
user_agent = "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; Trident/6.0)"
headers = { 'User-Agent' : user_agent }
req = urllib.request.Request(url, None, headers)
else:
req = ... |
Switch to python3 specifically in gephi mock script.
Can't change the docker image to make python==python3 right now because we need python2 on the image as it is used in the older branches that still support that version. CTR | #!/usr/bin/env python3
#
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
... | #!/usr/bin/env python
#
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... |
Check for nulls (fix nullpointer on newer OSX?) | package oslib.osx;
import java.io.Serializable;
import oslib.Arch;
import oslib.OperatingSystem;
import oslib.UnixOperatingSystem;
public class OSXOperatingSystem extends UnixOperatingSystem implements Serializable {
private static final long serialVersionUID = 1929142018487788734L;
private OSXVersion version;
... | package oslib.osx;
import java.io.Serializable;
import oslib.Arch;
import oslib.OperatingSystem;
import oslib.UnixOperatingSystem;
public class OSXOperatingSystem extends UnixOperatingSystem implements Serializable {
private static final long serialVersionUID = 1929142018487788734L;
private OSXVersion version;
... |
Make sure to set MySQL charset. | import aiomysql
from .. import config
from ..event import bus
from .migration import MigrationManager
host = config.create("storage", "host", fallback="localhost", comment="The database server host")
port = config.create("storage", "port", type=int, fallback=3306, comment="The database server port")
user = config.cre... | import aiomysql
from .. import config
from ..event import bus
from .migration import MigrationManager
host = config.create("storage", "host", fallback="localhost", comment="The database server host")
port = config.create("storage", "port", type=int, fallback=3306, comment="The database server port")
user = config.cre... |
Make bluebird as default promise overriding ES6 promise | import mongoose from 'mongoose';
import util from 'util';
import config from './config/server/env';
import app from './config/server/express';
const debug = require('debug')('express-mongoose-es6-rest-api:index');
// make bluebird default Promise
Promise = require('bluebird'); // eslint-disable-line no-global-assign
... | import Promise from 'bluebird';
import mongoose from 'mongoose';
import util from 'util';
import config from './config/server/env';
import app from './config/server/express';
const debug = require('debug')('express-mongoose-es6-rest-api:index');
// plugin bluebird promise in mongoose
mongoose.Promise = Promise;
// c... |
Fix typo in login_required decorator | from functools import update_wrapper
from flask import session, redirect, flash
import auth
def login_required(permission=None):
'''
Login required decorator. Requires user to be logged in. If a permission
is provided, then user must also have the appropriate permissions to
access the page.
'''
def decorat... | from functools import update_wrapper
from flask import session, redirect, flash
import auth
def login_required(permission=None):
'''
Login required decorator. Requires user to be logged in. If a permission
is provided, then user must also have the appropriate permissions to
access the page.
'''
def decorat... |
Make sure container is not marked as ghost when it starts | package docker
import (
"fmt"
"github.com/dotcloud/docker/utils"
"sync"
"time"
)
type State struct {
sync.Mutex
Running bool
Pid int
ExitCode int
StartedAt time.Time
Ghost bool
}
// String returns a human-readable description of the state
func (s *State) String() string {
if s.Running {
if ... | package docker
import (
"fmt"
"github.com/dotcloud/docker/utils"
"sync"
"time"
)
type State struct {
sync.Mutex
Running bool
Pid int
ExitCode int
StartedAt time.Time
Ghost bool
}
// String returns a human-readable description of the state
func (s *State) String() string {
if s.Running {
if ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.