text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Add autoHide prop to pass down | import React, {Component, PropTypes} from 'react'
import classnames from 'classnames'
import {Scrollbars} from 'react-custom-scrollbars'
class FancyScrollbox extends Component {
constructor(props) {
super(props)
}
static defaultProps = {
autoHide: true,
}
render() {
const {autoHide, children, c... | import React, {Component, PropTypes} from 'react'
import {Scrollbars} from 'react-custom-scrollbars'
class FancyScrollbox extends Component {
constructor(props) {
super(props)
}
render() {
const {children, className} = this.props
return (
<Scrollbars
className={`fancy-scroll--containe... |
Add some more filters & methods | <?php
class Vocabulary extends Model {
public function get_set() {
return $this->belongs_to('Set');
}
public function get_human_due_date() {
// TODO
return $this->due;
}
/**
* Filters
*/
public static function active($orm) {
return $orm->where_gte('l... | <?php
class Vocabulary extends Model {
public function get_set() {
return $this->belongs_to('Set');
}
/**
* Filters
*/
public static function active($orm) {
return $orm->where_gte('level', 0)->order_by_asc('due');
}
public static function inactive($orm) {
re... |
Fix up the example to be proper XML.
Signed-off-by: Chris Lalancette <60b62644009db6b194cc0445b64e9b27bb26433a@redhat.com> | """
Class for automated operating system installation.
Oz is a set of classes to do automated operating system installation. It
has built-in knowledge of the proper things to do for each of the supported
operating systems, so the data that the user must provide is very minimal.
This data is supplied in the form of an... | """
Class for automated operating system installation.
Oz is a set of classes to do automated operating system installation. It
has built-in knowledge of the proper things to do for each of the supported
operating systems, so the data that the user must provide is very minimal.
This data is supplied in the form of an... |
Allow empty so we can force new build | import sys
import sh
from fabric import api as fab
sed = sh.sed.bake('-i bak -e')
TRAVIS_YAML = '.travis.yml'
REPLACE_LANGUAGE = 's/language: .*/language: {}/'
def is_dirty():
return "" != sh.git.status(porcelain=True).strip()
def release(language, message):
if is_dirty():
sys.exit("Repo must be i... | import sys
import sh
from fabric import api as fab
sed = sh.sed.bake('-i bak -e')
TRAVIS_YAML = '.travis.yml'
REPLACE_LANGUAGE = 's/language: .*/language: {}/'
def is_dirty():
return "" != sh.git.status(porcelain=True).strip()
def release(language, message):
if is_dirty():
sys.exit("Repo must be i... |
[Stitching] Enable type name conflict logging. | import { mergeSchemas, introspectSchema, makeRemoteExecutableSchema } from "graphql-tools"
import { createHttpLink } from "apollo-link-http"
import fetch from "node-fetch"
import localSchema from "./schema"
export default async function mergedSchema() {
const convectionLink = createHttpLink({
fetch,
uri: pr... | import { mergeSchemas, introspectSchema, makeRemoteExecutableSchema } from "graphql-tools"
import { createHttpLink } from "apollo-link-http"
import fetch from "node-fetch"
import localSchema from "./schema"
export default async function mergedSchema() {
const convectionLink = createHttpLink({
fetch,
uri: pr... |
Update unit tests to improve redis_import_error | #! /usr/bin/env python
# -*- coding: utf-8 -*-
from sys import modules, version_info
if version_info >= (3,):
from imp import reload
def test_redis_import_error():
"""Test that we can load FlaskMultiRedis even if redis module
is not available."""
import flask_multi_redis
modules['redis'] = None... | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys
sys.modules['redis'] = None
def test_redis_import_error():
"""Test that we can load FlaskMultiRedis even if redis module
is not available."""
from flask_multi_redis import FlaskMultiRedis
f = FlaskMultiRedis()
assert f.provider_class is ... |
Add delay to quit button | var player = {
init: function () {
this.hide();
this.initPlayer();
this.initPlayerToggle();
},
initPlayerToggle: function() {
},
initPlayer: function() {
var that = this;
$('.row a').on('tap', function() {
var control = $(this);
var command = control.attr('id');
var url =... | var player = {
init: function () {
this.hide();
this.initPlayer();
this.initPlayerToggle();
},
initPlayerToggle: function() {
},
initPlayer: function() {
var that = this;
$('.row a').on('tap', function() {
var control = $(this);
var command = control.attr('id');
var url =... |
Use os.walk() to find files to delete. | # Remove all the .pyc and .pyo files under ../Lib.
def deltree(root):
import os
from os.path import join
npyc = npyo = 0
for root, dirs, files in os.walk(root):
for name in files:
delete = False
if name.endswith('.pyc'):
delete = True
np... | # Remove all the .pyc and .pyo files under ../Lib.
def deltree(root):
import os
def rm(path):
os.unlink(path)
npyc = npyo = 0
dirs = [root]
while dirs:
dir = dirs.pop()
for short in os.listdir(dir):
full = os.path.join(dir, short)
if os.path.isdir(ful... |
Add callback for FaceBook function | 'use strict'
import FB from 'fb'
import { facebookKey } from '../etc/secret.json'
/**
* Отправить сообщение в Фейсбук
*
* @param { string } message - Текст сообщения, которое будет отправлено на
* страницу в Фейсбуке
*/
export default async function facebookIt (message, callback) {
... | 'use strict'
import FB from 'fb'
import { facebookKey } from '../etc/secret.json'
/**
* Отправить сообщение в Фейсбук
*
* @param { string } message - Текст сообщения, которое будет отправлено на
* страницу в Фейсбуке
*/
export default function facebookIt (message) {
FB.setAccessTo... |
Refactor NPS customer gauge code. | <?php
namespace Frontend\Modules\CigyWidgets\Widgets;
use Frontend\Core\Engine\Base\Widget as FrontendBaseWidget;
use Frontend\Modules\CigyWidgets\Services\CustomerGauge as FrontendCigyServicesCustomerGauge;
/**
* This is the detail widget.
*/
class Nps extends FrontendBaseWidget
{
public function execute(): v... | <?php
namespace Frontend\Modules\CigyWidgets\Widgets;
use Frontend\Core\Engine\Base\Widget as FrontendBaseWidget;
use Frontend\Modules\CigyWidgets\Engine\Model as FrontendCigyWidgetsModel;
use Frontend\Modules\CigyWidgets\Services\CustomerGauge as FrontendCigyServicesCustomerGauge;
/**
* This is the detail widget.
... |
Allow Node to Node connection. | from neb.api import TrinityResource
from neb.relationship import Relationship
from neb.statistic import NodeStatistic
class Node(TrinityResource):
def create(self, node_id, **kwargs):
params = dict(id=node_id, node=kwargs)
return self.post(self._node_path(), payload=params)
def connect(self, t... | from neb.api import TrinityResource
from neb.relationship import Relationship
from neb.statistic import NodeStatistic
class Node(TrinityResource):
def create(self, node_id, **kwargs):
params = dict(id=node_id, node=kwargs)
return self.post(self._node_path(), payload=params)
def connect(self, t... |
Fix exception caused by bound function | 'use babel';
/* eslint-disable no-multi-str, prefer-const, func-names */
let linkPaths;
const regex = new RegExp('\
((?:\\w:)?/?\
(?:[-\\w.]+/)*[-\\w.]+)\
:(\\d+)\
(?::(\\d+))?\
', 'g');
const template = '<a class="-linked-path" data-path="$1" data-line="$2" data-column="$3">$&</a>';
export default linkPaths = lines ... | 'use babel';
/* eslint-disable no-multi-str, prefer-const*/
let linkPaths;
const regex = new RegExp('\
((?:\\w:)?/?\
(?:[-\\w.]+/)*[-\\w.]+)\
:(\\d+)\
(?::(\\d+))?\
', 'g');
const template = '<a class="-linked-path" data-path="$1" data-line="$2" data-column="$3">$&</a>';
export default linkPaths = lines => lines.repl... |
FIX : increase test timer for buildbot in realtime | import threading
import time
import Queue
from mne.realtime import StimServer, StimClient
from nose.tools import assert_equal
def test_connection():
"""Test TCP/IP connection for StimServer <-> StimClient.
"""
# have to start a thread to simulate the effect of two
# different computers since stim_se... | import threading
import time
import Queue
from mne.realtime import StimServer, StimClient
from nose.tools import assert_equal
def test_connection():
"""Test TCP/IP connection for StimServer <-> StimClient.
"""
# have to start a thread to simulate the effect of two
# different computers since stim_se... |
Check for existince of uri | <?php
namespace Talk;
use Application\BaseCommentEntity;
use stdClass;
class TalkCommentEntity extends BaseCommentEntity
{
public function getUsername()
{
if (!isset($this->data->username)) {
return null;
}
return $this->data->username;
}
public function getTalkTi... | <?php
namespace Talk;
use Application\BaseCommentEntity;
use stdClass;
class TalkCommentEntity extends BaseCommentEntity
{
public function getUsername()
{
if (!isset($this->data->username)) {
return null;
}
return $this->data->username;
}
public function getTalkTi... |
Fix up various prop issues with IssueishBadge | import React from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
import Octicon from './octicon';
const typeAndStateToIcon = {
Issue: {
OPEN: 'issue-opened',
CLOSED: 'issue-closed',
},
PullRequest: {
OPEN: 'git-pull-request',
CLOSED: 'git-pull-request',
MERGED: 'gi... | import React from 'react';
import PropTypes from 'prop-types';
import cx from 'classnames';
import Octicon from './octicon';
const typeAndStateToIcon = {
Issue: {
OPEN: 'issue-opened',
CLOSED: 'issue-closed',
},
PullRequest: {
OPEN: 'git-pull-request',
CLOSED: 'git-pull-request',
MERGED: 'gi... |
Add ui-router and build site routes | (function(){
'use strict';
angular
.module('shareMark', ['ui.router', 'templates', 'ngclipboard'])
.config(function($stateProvider, $urlRouterProvider){
$urlRouterProvider.otherwise('/');
$stateProvider
.state('home', {
url: "/",
template: "<home></home>"
})
... | (function(){
'use strict';
angular
.module('shareMark', ['ui.router', 'templates', 'ngclipboard'])
.config(function($stateProvider, $urlRouterProvider){
$urlRouterProvider.otherwise('/');
$stateProvider
.state('home', {
url: "/",
template: "<home></home>"
})
... |
Fix infinite recursion bug in myReadCloser.Read() method. Simplify wrapper. | package objectclient
import (
"bytes"
"github.com/Symantec/Dominator/lib/hash"
"github.com/Symantec/Dominator/proto/objectserver"
"io"
)
type myReadCloser struct {
io.Reader
}
func (reader *myReadCloser) Close() error {
return nil
}
func (objSrv *ObjectClient) getObjectReader(hashVal hash.Hash) (uint64,
io.R... | package objectclient
import (
"bytes"
"github.com/Symantec/Dominator/lib/hash"
"github.com/Symantec/Dominator/proto/objectserver"
"io"
)
type myReadCloser struct {
reader io.Reader
}
func (reader *myReadCloser) Read(b []byte) (int, error) {
return reader.Read(b)
}
func (reader *myReadCloser) Close() error {
... |
Test commit: correct username now? | package hello;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import org.hibernate.annotations.GenericGenerator;
@Entity
public class Recipe {
@Id
@GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "uu... | package hello;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import org.hibernate.annotations.GenericGenerator;
@Entity
public class Recipe {
@Id
@GeneratedValue(generator = "system-uuid")
@GenericGenerator(name = "system-uuid", strategy = "uu... |
Add API to mark topic as reader | # -*- coding:utf-8 -*-
from flask import g, jsonify
from gather.api import need_auth, EXCLUDE_COLUMNS
from gather.extensions import api_manager
from gather.topic.models import Topic, Reply
bp = api_manager.create_api_blueprint(
Topic,
methods=["GET", "POST"],
preprocessors={
'POST': [need_auth],... | # -*- coding:utf-8 -*-
from gather.api import need_auth, EXCLUDE_COLUMNS
from gather.extensions import api_manager
from gather.topic.models import Topic, Reply
bp = api_manager.create_api_blueprint(
Topic,
methods=["GET", "POST"],
preprocessors={
'POST': [need_auth],
},
include_methods=[... |
Modify URLs for start and end | from flask import Flask, render_template, redirect
import json
app = Flask(__name__)
with open("modules.json", 'r') as fp:
layout = json.load(fp)
@app.route('/')
def main():
return redirect("start/", code=302)
@app.route('/start/')
def start():
return render_template("start.html", start_link = layout["st... | from flask import Flask, render_template, redirect
import json
app = Flask(__name__)
with open("modules.json", 'r') as fp:
layout = json.load(fp)
@app.route('/')
def main():
return redirect("content/start/", code=302)
@app.route('/content/start/')
def start():
return render_template("start.html", start_l... |
Remove return from redis object | 'use strict';
var redis = require('redis'),
parse = require('url').parse;
var RedisClient = function(connectionURL) {
var options = this.parseURL(connectionURL);
this.hostname = options.hostname;
this.port = options.port;
this.username = options.username;
this.password = options.password;
};
RedisCl... | 'use strict';
var redis = require('redis'),
parse = require('url').parse;
var RedisClient = function(connectionURL) {
var options = this.parseURL(connectionURL);
this.hostname = options.hostname;
this.port = options.port;
this.username = options.username;
this.password = options.password;
};
RedisCl... |
Update version and copyright year. | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from sphinx_celery import conf
globals().update(conf.build_config(
'kombu', __file__,
project='Kombu',
version_dev='4.4',
version_stable='4.3',
canonical_url='https://kombu.readthedocs.io/',
webdomain='kombu.readt... | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from sphinx_celery import conf
globals().update(conf.build_config(
'kombu', __file__,
project='Kombu',
version_dev='4.3',
version_stable='4.2',
canonical_url='https://kombu.readthedocs.io/',
webdomain='kombu.readt... |
Fix issue where lang was not parsed properly | import os
import requests
from django.utils.translation import get_language
from wagtailaltgenerator.translation_providers import get_current_provider
from wagtailaltgenerator.providers import DescriptionResult
def get_image_data(image_url):
'''
Load external image and return byte data
'''
image_dat... | import os
import requests
from django.utils.translation import get_language
from wagtailaltgenerator.translation_providers import get_current_provider
from wagtailaltgenerator.providers import DescriptionResult
def get_image_data(image_url):
'''
Load external image and return byte data
'''
image_dat... |
ENH: Add Beta and Binomial to automatically imported nodes | ######################################################################
# Copyright (C) 2011,2012 Jaakko Luttinen
#
# This file is licensed under Version 3.0 of the GNU General Public
# License. See LICENSE for a text of the license.
######################################################################
###############... | ######################################################################
# Copyright (C) 2011,2012 Jaakko Luttinen
#
# This file is licensed under Version 3.0 of the GNU General Public
# License. See LICENSE for a text of the license.
######################################################################
###############... |
Implement basic list slicing operations | export function* map(fn, iterable) {
for (const value of iterable) {
yield fn(value);
}
}
export function* filter(fn, iterable) {
for (const value of iterable) {
if (fn(value)) {
yield value;
}
}
}
export function* head(iterable) {
for (const value of iterable) {
yield value;
break... | export function* map(fn, iterable) {
for (const value of iterable) {
yield fn(value);
}
}
export function* filter(fn, iterable) {
for (const value of iterable) {
if (fn(value)) {
yield value;
}
}
}
export function* first(iterable) {
for (const value of iterable) {
yield value;
brea... |
Add logging to error output | ## module loader, goes to see which submodules have 'html' directories
## and declares them at the toplevel
import os,importlib,logging
def find_module_dirs():
curdir = os.path.dirname(os.path.abspath(__file__))
subdirs = [o for o in os.listdir(curdir) if os.path.exists(os.path.sep.join([curdir,o,'__init__.py... | ## module loader, goes to see which submodules have 'html' directories
## and declares them at the toplevel
import os,importlib
def find_module_dirs():
curdir = os.path.dirname(os.path.abspath(__file__))
subdirs = [o for o in os.listdir(curdir) if os.path.exists(os.path.sep.join([curdir,o,'__init__.py']))]
... |
Fix a critical bug where the project member query would return wrong members
Durch einen Fehler in der orWhere() Logik von Laravel konnte die project_id ignoriert werden | <?php
namespace EmergencyExplorer;
use Illuminate\Database\Eloquent\Model;
class Project extends Model
{
const PROJECT_ROLE_NONE = 0;
const PROJECT_ROLE_WATCHER = 1;
const PROJECT_ROLE_MEMBER = 2;
const PROJECT_ROLE_ADMIN = 3;
protected $fillable = [
'name', 'description', 'status', ... | <?php
namespace EmergencyExplorer;
use Illuminate\Database\Eloquent\Model;
class Project extends Model
{
const PROJECT_ROLE_NONE = 0;
const PROJECT_ROLE_WATCHER = 1;
const PROJECT_ROLE_MEMBER = 2;
const PROJECT_ROLE_ADMIN = 3;
protected $fillable = [
'name', 'description', 'status',
... |
Remove route-related stuff from test-bb/env | /* jshint strict:false */
/* global QUnit:false, Backbone:false */
// Taken from Backbone 1.1.2 test suite
// Routing-specific stuff commented out
(function() {
var sync = Backbone.sync;
var ajax = Backbone.ajax;
var emulateHTTP = Backbone.emulateHTTP;
var emulateJSON = Backbone.emulateJSON;
// var history... | /* jshint strict:false */
/* global QUnit:false, Backbone:false, window:false */
// Taken from Backbone 1.1.2 test suite
(function() {
var sync = Backbone.sync;
var ajax = Backbone.ajax;
var emulateHTTP = Backbone.emulateHTTP;
var emulateJSON = Backbone.emulateJSON;
var history = window.history;
var push... |
Fix incorrect indexes in alembic revision | """Add tracks
Revision ID: 11890f58b1df
Revises: 4d4b95748173
Create Date: 2016-08-16 16:48:27.441514
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = '11890f58b1df'
down_revision = '4d4b95748173'
def upgrade():
op.create_table(
'tracks',
s... | """Add tracks
Revision ID: 11890f58b1df
Revises: 4d4b95748173
Create Date: 2016-08-16 16:48:27.441514
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = '11890f58b1df'
down_revision = '4d4b95748173'
def upgrade():
op.create_table(
'tracks',
s... |
Fix AudioContext not define reference error. | /*
* Copyright (c) 2013 Csernik Flaviu Andrei
*
* See the file LICENSE.txt for copying permission.
*
*/
"use strict";
window.AudioContext = window.AudioContext || window.webkitAudioContext;
function PropertyNotInitialized(obj, propName) {
this.property = propName;
this.obj = obj;
}
PropertyNotInitial... | /*
* Copyright (c) 2013 Csernik Flaviu Andrei
*
* See the file LICENSE.txt for copying permission.
*
*/
"use strict";
function PropertyNotInitialized(obj, propName) {
this.property = propName;
this.obj = obj;
}
PropertyNotInitialized.prototype.toString = function () {
return this.obj + " : " + this.... |
Update path of slider images. | module.exports = function(grunt) {
grunt.config.merge({
imagemin: {
slider: {
files: [{
expand: true,
cwd: 'bower_components/cacao/modules/slider/images',
src: ['**/*.{png,jpg,gif}'],
dest: '<%= glob... | module.exports = function(grunt) {
grunt.config.merge({
imagemin: {
slider: {
files: [{
expand: true,
cwd: 'cacao/modules/slider/images',
src: ['**/*.{png,jpg,gif}'],
dest: '<%= global.dest %>/layout... |
Print out current message offset | 'use strict';
const co = require('co');
const chassis = require('../../');
const Events = chassis.events.Events;
co(function* init() {
const config = {
provider: 'kafka',
groupId: 'notify-listen',
clientId: 'notify-listen',
connectionString: 'localhost:9092',
protos: ['io/restorecommerce/notify.... | 'use strict';
const co = require('co');
const chassis = require('../../');
const Events = chassis.events.Events;
co(function* init() {
const config = {
provider: 'kafka',
groupId: 'notify-listen',
clientId: 'notify-listen',
connectionString: 'localhost:9092',
protos: ['io/restorecommerce/notify.... |
Replace `@\unlink()` with a check for file existence | <?php
namespace wcf\system\language\preload\command;
use wcf\data\language\Language;
/**
* Resets the preload cache for the requested language.
*
* @author Alexander Ebert
* @copyright 2001-2022 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @packa... | <?php
namespace wcf\system\language\preload\command;
use wcf\data\language\Language;
/**
* Resets the preload cache for the requested language.
*
* @author Alexander Ebert
* @copyright 2001-2022 WoltLab GmbH
* @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
* @packa... |
Delete old sqlite db before running tests. | package com.example.ollie;
import com.example.ollie.model.Note;
import com.example.ollie.shadows.PersistentShadowSQLiteOpenHelper;
import ollie.Ollie;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectri... | package com.example.ollie;
import com.example.ollie.model.Note;
import com.example.ollie.shadows.PersistentShadowSQLiteOpenHelper;
import ollie.Ollie;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;
impor... |
Add development mode error logging
Remove debug console.log() | /* eslint no-process-exit:0 */
import fsp from 'fs-promise';
import _ from 'lodash';
import * as issueHandler from './issue-handler';
import {findProjectKey} from './jira-operations';
import {getJiraAPI} from './jira-connection';
export function getIssueReference(msgToParse, prjKey) {
let pattern = RegExp(`${prjKey}... | /* eslint no-process-exit:0 */
import fsp from 'fs-promise';
import _ from 'lodash';
import * as issueHandler from './issue-handler';
import {findProjectKey} from './jira-operations';
import {getJiraAPI} from './jira-connection';
export function getIssueReference(msgToParse, prjKey) {
let pattern = RegExp(`${prjKey}... |
Update example to avoid walking entire project | /**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib 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 a... | /**
* @license Apache-2.0
*
* Copyright (c) 2018 The Stdlib 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 a... |
Make SecretServiceNotAvailableException a subclass of SecretStorageException | # SecretStorage module for Python
# Access passwords using the SecretService DBus API
# Author: Dmitry Shachnev, 2012
# License: BSD
"""All secretstorage functions may raise various exceptions when
something goes wrong. All exceptions derive from base
:exc:`SecretStorageException` class."""
class SecretStorageExcepti... | # SecretStorage module for Python
# Access passwords using the SecretService DBus API
# Author: Dmitry Shachnev, 2012
# License: BSD
"""All secretstorage functions may raise various exceptions when
something goes wrong. All exceptions derive from base
:exc:`SecretStorageException` class."""
class SecretStorageExcepti... |
Convert arrow functions to function markup
Without this, navigo will not run in IE11. | /* global __dirname, require, module*/
const path = require("path");
const yargs = require("yargs");
const env = yargs.argv.env; // use --env with webpack 2
const shouldExportToAMD = yargs.argv.amd;
let libraryName = "Navigo";
let outputFile, mode;
if (shouldExportToAMD) {
libraryName += ".amd";
}
if (env === "b... | /* global __dirname, require, module*/
const path = require("path");
const yargs = require("yargs");
const env = yargs.argv.env; // use --env with webpack 2
const shouldExportToAMD = yargs.argv.amd;
let libraryName = "Navigo";
let outputFile, mode;
if (shouldExportToAMD) {
libraryName += ".amd";
}
if (env === "b... |
Fix wireless transmitter not sending container updates | package refinedstorage.tile;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.nbt.NBTTagCompound;
import refinedstorage.RefinedStorageUtils;
import refinedstorage.container.ContainerWirelessTransmitter;
import refinedstorage.inventory.InventorySimple;
import ref... | package refinedstorage.tile;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.nbt.NBTTagCompound;
import refinedstorage.RefinedStorageUtils;
import refinedstorage.inventory.InventorySimple;
import refinedstorage.item.ItemUpgrade;
public class TileWirelessTransm... |
Fix usage of Piwik in renderer | import {ipcRenderer} from 'electron';
import * as piwik from 'renderer/services/piwik';
import webView from 'renderer/webview';
/**
* Forward a message to the webview.
*/
ipcRenderer.on('fwd-webview', function (event, channel, ...args) {
if (webView.isLoading && (typeof webView.isLoading === 'function') && !webVi... | import {ipcRenderer} from 'electron';
import piwik from 'renderer/services/piwik';
import webView from 'renderer/webview';
/**
* Forward a message to the webview.
*/
ipcRenderer.on('fwd-webview', function (event, channel, ...args) {
if (webView.isLoading && (typeof webView.isLoading === 'function') && !webView.is... |
Sort the results from ls | <?php
include '../util.php.inc';
$dir = $_GET['dir'];
$path = bespin_get_file_name($dir);
$folder_array = array();
$file_array = array();
if (is_dir($path)) {
if ($dh = opendir($path)) {
while (($entry = readdir($dh)) !== false) {
if (substr($entry, 0, 1) == '.') { continue; ... | <?php
include '../util.php.inc';
$dir = $_GET['dir'];
$path = bespin_get_file_name($dir);
// Open a known directory, and proceed to read its contents
if (is_dir($path)) {
if ($dh = opendir($path)) {
echo '<ul class="jqueryFileTree" style="display: none;">';
while (($file = readdir($dh)) ... |
Add special case for "anywhere" | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>
"""
from __future__ import absolute_import
import dataproperty
import six
from ._error import NetworkInterfaceNotFoundError
def verify_network_interface(device):
try:
import netifaces
except ImportError:
return
... | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <gogogo.vm@gmail.com>
"""
from __future__ import absolute_import
import dataproperty
import six
from ._error import NetworkInterfaceNotFoundError
def verify_network_interface(device):
try:
import netifaces
except ImportError:
return
... |
Fix rainbow and staging :boom: | import thunk from 'redux-thunk'
import createLogger from 'redux-logger'
import { browserHistory } from 'react-router'
import { syncHistory } from 'redux-simple-router'
import { combineReducers, compose, createStore, applyMiddleware } from 'redux'
import { autoRehydrate } from 'redux-persist'
import { analytics, request... | import thunk from 'redux-thunk'
import createLogger from 'redux-logger'
import { browserHistory } from 'react-router'
import { syncHistory } from 'redux-simple-router'
import { combineReducers, compose, createStore, applyMiddleware } from 'redux'
import { autoRehydrate } from 'redux-persist'
import { analytics, request... |
Kill more code.google.com/p/ references, and update example code to new API
(It's been broken for a while) | // Simple use of the tuntap package that prints packets received by the interface.
package main
import (
"fmt"
"os"
"github.com/mistsys/tuntap"
)
func main() {
if len(os.Args) != 3 {
fmt.Println("syntax:", os.Args[0], "tun|tap", "<device name>")
return
}
var typ tuntap.DevKind
switch os.Args[1] {
case "... | // Simple use of the tuntap package that prints packets received by the interface.
package main
import (
"fmt"
"os"
"code.google.com/p/tuntap"
)
func main() {
if len(os.Args) != 3 {
fmt.Println("syntax:", os.Args[0], "tun|tap", "<device name>")
return
}
var typ tuntap.DevKind
switch os.Args[1] {
case "t... |
Clean up config, only build once
Need to swap to webpack though! | import fs from 'fs'
import * as babel from 'babel-core'
import _eval from 'eval'
import babelConfig from './babelConfig'
import log from './log'
const configFns = readConfigFns('bastion.conf.js')
export default function configPassthrough (name, config) {
if (typeof configFns[name] === 'function') {
log.verbose(... | import fs from 'fs'
import * as babel from 'babel-core'
import _eval from 'eval'
import babelConfig from './babelConfig'
import log from './log'
const configFile = 'bastion.conf.js'
export default function configPassthrough (name, config) {
if (fileExists(configFile)) {
log.verbose('found config file')
con... |
Add docutils to the list of requirements.
Install docutils during a pip install so that rendering
reStructuredText (CTRL-r) works out of the box. | import os
from setuptools import setup
from nvpy import nvpy
# Utility function to read the README file.
# Used for the long_description. It's nice, because now 1) we have a top level
# README file and 2) it's easier to type in the README file than to put a raw
# string in below ...
def read(fname):
return open(o... | import os
from setuptools import setup
from nvpy import nvpy
# Utility function to read the README file.
# Used for the long_description. It's nice, because now 1) we have a top level
# README file and 2) it's easier to type in the README file than to put a raw
# string in below ...
def read(fname):
return open(o... |
Make tests run from correct directory. | import GenotypeNetwork as gn
import os
import networkx as nx
# Change cwd for tests to the current path.
here = os.path.dirname(os.path.realpath(__file__))
os.chdir(here)
GN = gn.GenotypeNetwork()
GN.read_sequences('test/Demo_052715.fasta')
GN.generate_genotype_network()
GN.write_genotype_network('test/Demo_052715.pk... | import GenotypeNetwork as gn
import os
import networkx as nx
GN = gn.GenotypeNetwork()
GN.read_sequences('test/Demo_052715.fasta')
GN.generate_genotype_network()
GN.write_genotype_network('test/Demo_052715.pkl')
GN.read_genotype_network('test/Demo_052715.pkl')
def test_read_sequences_works_correctly():
"""
C... |
[clean-up] Remove unnecessary contentBase setting of webpack dev server. | "use strict";
const HtmlWebpackPlugin = require('html-webpack-plugin');
const HOST = process.env.HOST || "127.0.0.1";
const PORT = process.env.PORT || "8080";
module.exports = {
entry: [
'./src/client/web/main.jsx'
],
output: {
path: './build/web',
filename: 'bundle.js'
},
resolve: {
extensions: ['', '.... | "use strict";
const HtmlWebpackPlugin = require('html-webpack-plugin');
const HOST = process.env.HOST || "127.0.0.1";
const PORT = process.env.PORT || "8080";
module.exports = {
entry: [
'./src/client/web/main.jsx'
],
output: {
path: './build/web',
filename: 'bundle.js'
},
resolve: {
extensions: ['', '.... |
Add usage example for longestPRefixOf() method | import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class TrieExample {
public static void main(String[] args) {
// Open the data file
Scanner scf = null;
try {
scf = new Scanner(new File("./data/peter_piper.txt"));
} catch (FileNotFoundException e) {
... | import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;
public class TrieExample {
public static void main(String[] args) {
// Open the data file
Scanner scf = null;
try {
scf = new Scanner(new File("./data/peter_piper.txt"));
} catch (FileNotFoundException e) {
... |
Throw a ReferenceError on animations.select(unregisterName) | 'use strict'
module.exports = function (animations) {
let index = 0
let running = false
const api = {
set index (i) {
console.log(animations[i].name)
index = i
},
next: () => { api.index = ++index % animations.length },
previous: () => { api.index = index > 0 ? index - 1 : animation... | 'use strict'
module.exports = function (animations) {
let index = 0
let running = false
const api = {
set index (i) {
console.log(animations[i].name)
index = i
},
next: () => { api.index = ++index % animations.length },
previous: () => { api.index = index > 0 ? index - 1 : animation... |
Fix query extractor UTF-8 handling | #!/usr/bin/env python
"""
Script to extract and then generate random queries for fuzzy searching.
Usage:
./extract-random-queries.py <infile> <outfile>
"""
import codecs
import os
from random import choice, randint, random
import string
from subprocess import call
import sys
from tempfile import mkstemp
__author... | #!/usr/bin/env python
"""
Script to extract and then generate random queries for fuzzy searching.
Usage:
./extract-random-queries.py <infile> <outfile>
"""
import os
from random import choice, randint, random
import string
from subprocess import call
import sys
from tempfile import mkstemp
__author__ = "Uwe L. K... |
Add ModuleConcatenationPlugin to webpack compile plugins | /* eslint-disable import/no-extraneous-dependencies */
import path from 'path'
import webpack from 'webpack'
import packageConfig from './package.json'
const banner = `${packageConfig.name} ${packageConfig.version}
${packageConfig.repository.url}
Includes htmlparser2
https://github.com/fb55/htmlparser2/
https://githu... | /* eslint-disable import/no-extraneous-dependencies */
import path from 'path'
import webpack from 'webpack'
import packageConfig from './package.json'
const banner = `${packageConfig.name} ${packageConfig.version}
${packageConfig.repository.url}
Includes htmlparser2
https://github.com/fb55/htmlparser2/
https://githu... |
Remove redundant 'repo' in WrapperPath() | #!/usr/bin/env python
#
# Copyright (C) 2014 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 req... | #!/usr/bin/env python
#
# Copyright (C) 2014 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 req... |
Use null input handler for ErrorDialog; none needed | package csuf.cs544.hw1.dialogs;
import android.R;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.os.Bundle;
public class ErrorDialogFragment extends DialogFragment {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
... | package csuf.cs544.hw1.dialogs;
import android.R;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface;
import android.os.Bundle;
public class ErrorDialogFragment extends DialogFragment {
@Override
public Dialog onCr... |
Improve redirect on new comment | <?php
namespace App\Http\Controllers;
use App\Comment;
use App\Post;
use App\Sub;
use Illuminate\Http\Request;
class CommentController extends Controller
{
public function store($subName, $postSlug, Request $request)
{
$sub = Sub::where('name', $subName)->firstOrFail();
$post = Post::where('s... | <?php
namespace App\Http\Controllers;
use App\Comment;
use App\Post;
use App\Sub;
use Illuminate\Http\Request;
class CommentController extends Controller
{
public function store($subName, $postSlug, Request $request)
{
$sub = Sub::where('name', $subName)->firstOrFail();
$post = Post::where('s... |
Increase margin and remove the padded space | /**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @flow
*/... | /**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @flow
*/... |
Extend test cases to resolver function returning a non string | /* eslint comma-dangle: 0 */
import createCachedSelector from '../index';
let memoizedFunction;
beforeEach(() => {
memoizedFunction = jest.fn();
});
describe('createCachedSelector', () => {
it('Should use the same cached selector when resolver function returns the same string', () => {
const cachedSelector =... | /* eslint comma-dangle: 0 */
import createCachedSelector from '../index';
let memoizedFunction;
beforeEach(() => {
memoizedFunction = jest.fn();
});
describe('createCachedSelector', () => {
it('Should use the same cached selector when resolver function returns the same string', () => {
const cachedSelector =... |
Fix segmentation fault on PHP 5.6 on Travis CI
Segmentation fault started occuring after adding test case related to issue #51 | <?php
require_once __DIR__ . '/../vendor/autoload.php';
// PHPUnit >= 6.0 compatibility
if (!class_exists('PHPUnit_Framework_TestSuite') && class_exists('PHPUnit\Framework\TestSuite')) {
/** @noinspection PhpIgnoredClassAliasDeclaration */
class_alias('PHPUnit\Framework\TestSuite', 'PHPUnit_Framework_TestSuit... | <?php
require_once __DIR__ . '/../vendor/autoload.php';
// PHPUnit >= 6.0 compatibility
if (!class_exists('PHPUnit_Framework_TestSuite') && class_exists('PHPUnit\Framework\TestSuite')) {
/** @noinspection PhpIgnoredClassAliasDeclaration */
class_alias('PHPUnit\Framework\TestSuite', 'PHPUnit_Framework_TestSuit... |
Remove extra line breaks in Registry.emit tests | import test from 'ava';
import Registry from '../src/registry';
test('Registry.emit calls each handler', t => {
let registry = Registry([]);
registry.on('enter', x => t.true(x === 'a'));
registry.on('enter', y => t.true(y === 'a'));
registry.on('exit', x => t.true(x === 'b'));
registry.on('exit'... | import test from 'ava';
import Registry from '../src/registry';
test('Registry.emit calls each handler', t => {
let registry = Registry([]);
registry.on('enter', x => t.true(x === 'a'));
registry.on('enter', y => t.true(y === 'a'));
registry.on('exit', x => t.true(x === 'b'));
registry.on('exit'... |
Fix migrations - drop old domain | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.db import models, migrations
def update_site_forward(apps, schema_editor):
"""Set site domain and name."""
Site = apps.get_model("sites", "Site")
Site.objects.update_or_create(
id=settings... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.db import models, migrations
def update_site_forward(apps, schema_editor):
"""Set site domain and name."""
Site = apps.get_model("sites", "Site")
Site.objects.update_or_create(
id=settings... |
Remove single slider entry from plugin settings | package com.github.slidekb.back.settings;
import java.util.ArrayList;
import java.util.List;
public class PluginSettings {
List<String> processes;
List<String> hotkeys;
boolean alwaysRun;
List<String> sliderList;
public List<String> getSliderList() {
return sliderList;
}
public v... | package com.github.slidekb.back.settings;
import java.util.ArrayList;
import java.util.List;
public class PluginSettings {
String usedSlider;
List<String> processes;
List<String> hotkeys;
boolean alwaysRun;
List<String> sliderList;
public List<String> getSliderList() {
return sliderLi... |
Update meta values and remove author link. | <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- RSS Feed -->
<link rel="alternate" type="application/rss+xml" href="/rss" />
<!-- Mobile friendliness -->
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimi... | <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="http://james-brooks.uk">
<meta name="apple-mobile-web-app-capable" content="yes">
<link... |
test: Add missing method required for test
- backported create_or_update_social_login_key from v13 | # -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
from frappe.integrations.doctype.social_login_key.social_login_key import BaseUrlNotSetError
import unittest
class TestSocialLoginKey(unittest.TestCase):
def test... | # -*- coding: utf-8 -*-
# Copyright (c) 2017, Frappe Technologies and Contributors
# See license.txt
from __future__ import unicode_literals
import frappe
from frappe.integrations.doctype.social_login_key.social_login_key import BaseUrlNotSetError
import unittest
class TestSocialLoginKey(unittest.TestCase):
def test... |
Remove unused code left from JBMP -> Flowable migration | /*
* Copyright © 2015-2018 Santer Reply S.p.A.
*
* 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 la... | /*
* Copyright © 2015-2018 Santer Reply S.p.A.
*
* 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 la... |
Rename variable for more appropriate name | /*
* Author: Pierre-Henry Soria <hello@ph7cms.com>
* Copyright: (c) 2015-2017, Pierre-Henry Soria. All Rights Reserved.
* License: GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
*/
var $donationBox = (function () {
$.get(pH7Url.base + 'ph7cms-donat... | /*
* Author: Pierre-Henry Soria <hello@ph7cms.com>
* Copyright: (c) 2015-2017, Pierre-Henry Soria. All Rights Reserved.
* License: GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
*/
var $validationBox = (function () {
$.get(pH7Url.base + 'ph7cms-don... |
Set the correct Grunt working directory.
Since `documentsPaths`, `filesPaths`, and `layoutsPaths` are all
relative to `srcPath`, the working directory needs to be set before
performing the file expansion. | /*
* grunt-docs
* https://github.com/shama/grunt-docs
*
* Copyright (c) 2013 Kyle Robinson Young
* Licensed under the MIT license.
*/
module.exports = function(grunt) {
'use strict';
var docpad = require('docpad');
grunt.registerTask('docs', 'Compile with DocPad', function() {
var done = this.async()... | /*
* grunt-docs
* https://github.com/shama/grunt-docs
*
* Copyright (c) 2013 Kyle Robinson Young
* Licensed under the MIT license.
*/
module.exports = function(grunt) {
'use strict';
var docpad = require('docpad');
grunt.registerTask('docs', 'Compile with DocPad', function() {
var done = this.async()... |
Allow null reserved_by value for broken post records | <?php
namespace App\Models;
use ActiveRecord\DateTime;
/**
* @property int $id
* @property int $post_id
* @property int $reserved_by
* @property int $response_code
* @property string $failing_url
* @property DateTime $created_at
* @property DateTime $updated_at
* @property Post $pos... | <?php
namespace App\Models;
use ActiveRecord\DateTime;
/**
* @property int $id
* @property int $post_id
* @property int $reserved_by
* @property int $response_code
* @property string $failing_url
* @property DateTime $created_at
* @property DateTime $updated_at
* @property Post $pos... |
Fix a bug where the search dropdown wouldn't toggle
When clicking on the magnifying glass again, the dropdown wouldn't hide. | ((function (App) {
'use strict';
App.View.HeaderView = Backbone.View.extend({
events: {
'click .js-mobile-menu': 'toggleDrawer',
'click .js-search-button': 'onClickSearchButton',
},
initialize: function () {
this.drawer = this.el.querySelector('.js-mobile-drawer');
this.search... | ((function (App) {
'use strict';
App.View.HeaderView = Backbone.View.extend({
events: {
'click .js-mobile-menu': 'toggleDrawer',
'click .js-search-button': 'toggleSearch',
},
initialize: function () {
this.drawer = this.el.querySelector('.js-mobile-drawer');
this.searchContain... |
Support cleaning of installedChunks callbacks
It requires this PR https://github.com/webpack/webpack/pull/1380
to be approved. Or using custom webpack build with that PR. Otherwise,
stuck callback may cause memory leaks. | patch();
function patch() {
var ensure = __webpack_require__.e;
var head = document.querySelector('head');
__webpack_require__.e = function(chunkId, callback) {
var loaded = false;
var handler = function(error) {
if (loaded) return;
loaded = true;
callback(error);
};
ensure(... | patch();
function patch() {
var ensure = __webpack_require__.e;
var head = document.querySelector('head');
__webpack_require__.e = function(chunkId, callback) {
var loaded = false;
var handler = function(error) {
if (loaded) return;
loaded = true;
callback(error);
};
ensure(... |
Rename package to fmi_weather, as 'fmi' is already taken. | #!/usr/bin/env python
from distutils.core import setup
setup(
name='fmi_weather',
version='0.50',
description='FMI weather data fetcher',
author='Kimmo Huoman',
author_email='kipenroskaposti@gmail.com',
url='https://github.com/kipe/fmi',
packages=['fmi', 'fmi.symbols'],
package_data={
... | #!/usr/bin/env python
from distutils.core import setup
setup(
name='fmi',
version='0.50',
description='FMI weather data fetcher',
author='Kimmo Huoman',
author_email='kipenroskaposti@gmail.com',
url='https://github.com/kipe/fmi',
packages=['fmi', 'fmi.symbols'],
package_data={
'... |
Add support for X-Real-IP Header | /**
* Author: petar bojinov - @pbojinov
* Date: 9/29/13
*/
/**
* @method getClientIp
*
* Get client IP address
*
* Will return 127.0.0.1 when testing locally
* Useful when you need the user ip for geolocation or serving localized content
*
* @param req
* @returns {string} ip
*/
function getClientIp(req) {... | /**
* Author: petar bojinov - @pbojinov
* Date: 9/29/13
*/
/**
* @method getClientIp
*
* Get client IP address
*
* Will return 127.0.0.1 when testing locally
* Useful when you need the user ip for geolocation or serving localized content
*
* @param req
* @returns {string} ip
*/
function getClientIp(req) {... |
Call composer from the webroot
composer.json has been moved from /concrete/composer.json to /composer.json | module.exports = function(grunt, config, parameters, done) {
var workFolder = parameters.releaseWorkFolder || './release/source';
function endForError(error) {
process.stderr.write(error.message || error);
done(false);
}
try {
var path = require('path'),
exec = require('child_process').exec,
fs = requir... | module.exports = function(grunt, config, parameters, done) {
var workFolder = parameters.releaseWorkFolder || './release/source';
function endForError(error) {
process.stderr.write(error.message || error);
done(false);
}
try {
var path = require('path'),
exec = require('child_process').exec,
fs = requir... |
Switch back to legacy decorators
For https://github.com/matrix-org/matrix-react-sdk/pull/3961 | module.exports = {
"sourceMaps": true,
"presets": [
["@babel/preset-env", {
"targets": [
"last 2 Chrome versions", "last 2 Firefox versions", "last 2 Safari versions"
],
}],
"@babel/preset-typescript",
"@babel/preset-flow",
"@babel/... | module.exports = {
"sourceMaps": true,
"presets": [
["@babel/preset-env", {
"targets": [
"last 2 Chrome versions", "last 2 Firefox versions", "last 2 Safari versions"
],
}],
"@babel/preset-typescript",
"@babel/preset-flow",
"@babel/... |
Update dsub version to 0.3.8.dev0
PiperOrigin-RevId: 293000641 | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
Fix bug in python client | # lockd client
import httplib
import json
class LockdClient(object):
def __init__(self, host="127.0.0.1", port=2080):
self._host_port = "%s:%s" % (host, port)
def is_locked(self, name):
return self._lockish("GET", name, 404)
def lock(self, name):
return self._lockish("POST", nam... | # lockd client
import httplib
import json
class LockdClient(object):
def __init__(self, host="127.0.0.1", port=2080):
self._host_port = "%s:%s" % (host, port)
def is_locked(self, name):
return self._lockish("GET", name, 404)
def lock(self, name):
return self._lockish("POST", nam... |
Make it a regular sign | package se.soy.gpg;
import java.util.List;
import java.util.ArrayList;
public class GPG {
// FIXME Remove when done
static<T> void println(T arg) { System.out.println(arg); }
public static void main(String[] args) {
println("main");
GPG.encrypt().armor().recipient("0xrecipient").output();
/*
GP... | package se.soy.gpg;
import java.util.List;
import java.util.ArrayList;
public class GPG {
// FIXME Remove when done
static<T> void println(T arg) { System.out.println(arg); }
public static void main(String[] args) {
println("main");
GPG.encrypt().armor().recipient("0xrecipient").output();
/*
GP... |
Remove deprecated and broken pros help option | import click
import proscli
from proscli.utils import default_options
def main():
# the program name should always be pros. don't care if it's not...
try:
cli.main(prog_name='pros')
except KeyboardInterrupt:
click.echo('Aborted!')
pass
@click.command('pros',
... | import click
import proscli
from proscli.utils import default_options
def main():
# the program name should always be pros. don't care if it's not...
try:
cli.main(prog_name='pros')
except KeyboardInterrupt:
click.echo('Aborted!')
pass
import prosconductor.providers... |
Expand check for empty strings | $(document).ready(function () {
$('textarea').focus();
$('form').on('submit', function (event) {
event.preventDefault();
var text = $('textarea').val();
var y = 0;
if (text.replace(/^\s+|\s+$/g, '') == '') {
text = 'You should probably enter some text next time.'
}
$('header a').addClass('dark');
... | $(document).ready(function () {
$('textarea').focus();
$('form').on('submit', function (event) {
event.preventDefault();
var text = $('textarea').val();
var y = 0;
if (text == '') {
text = 'You should probably enter some text next time.'
}
$('header a').addClass('dark');
$('body').css('background... |
Change to new search api | define('routes_api', [], function() {
// List API routes here.
// E.g.:
// {
// "route": "/foo/bar/{0}",
// "another_route": "/foo/bar/{0}/asdf"
// }
return {
'fxa-login': '/api/v2/account/fxa-login/',
'login': '/api/v2/account/login/',
'logout': '/api/v2/acco... | define('routes_api', [], function() {
// List API routes here.
// E.g.:
// {
// "route": "/foo/bar/{0}",
// "another_route": "/foo/bar/{0}/asdf"
// }
return {
'fxa-login': '/api/v2/account/fxa-login/',
'login': '/api/v2/account/login/',
'logout': '/api/v2/acco... |
Fix false-positive of a type-check | """
This module contains the high-level functions to access the library. Care is
taken to make this as pythonic as possible and hide as many of the gory
implementations as possible.
"""
from x690.types import ObjectIdentifier
# !!! DO NOT REMOVE !!! The following import triggers the processing of SNMP
# Types and th... | """
This module contains the high-level functions to access the library. Care is
taken to make this as pythonic as possible and hide as many of the gory
implementations as possible.
"""
from x690.types import ObjectIdentifier
# !!! DO NOT REMOVE !!! The following import triggers the processing of SNMP
# Types and th... |
Fix lint errors in the `rx-ext` code | import { merge as mergeObs } from 'rxjs/observable'
import { distinctUntilChanged, map as mapObs, debounceTime } from 'rxjs/operators'
import { isEqual, isFunction } from '../util/minilo'
import fromOlEvent from './from-ol-event'
/**
* Creates Observable from OpenLayers change:* event
* @param {module:ol/Observable~... | import { merge as mergeObs } from 'rxjs/observable'
import { distinctUntilChanged, map as mapObs, debounceTime } from 'rxjs/operators'
import { isEqual, isFunction } from '../util/minilo'
import fromOlEvent from './from-ol-event'
/**
* Creates Observable from OpenLayers change:* event
* @param {module:ol/Observable~... |
Fix caching issue in standalone | var config = {
// For internal server or proxying webserver.
url : {
configuration : 'up/configuration',
update : 'up/world/{world}/{timestamp}',
sendmessage : 'up/sendmessage'
},
// For proxying webserver through php.
// url: {
// configuration: 'up.php?path=configuration',
// update: 'up.php?path=world/... | var config = {
// For internal server or proxying webserver.
url : {
configuration : 'up/configuration',
update : 'up/world/{world}/{timestamp}',
sendmessage : 'up/sendmessage'
},
// For proxying webserver through php.
// url: {
// configuration: 'up.php?path=configuration',
// update: 'up.php?path=world/... |
Connect to mongo here so we only do it once | "use strict";
var express = require('express'),
pages = require('./routes/pages.js'),
signup = require('./routes/signup.js'),
flash = require('connect-flash'),
auth = require('./modules/auth.js'),
api = require('./modules/api.js'),
mongoose = require('mongoose');
mongoose.connect(process.env.MONGODB_CONNE... | var express = require('express'),
pages = require('./routes/pages.js'),
signup = require('./routes/signup.js'),
flash = require('connect-flash'),
auth = require('./modules/auth.js');
var app = express();
// Configuration
var secret = process.env.COOKIE_SECRET || 'secret';
app.set('views', __dirname + '/views... |
Support python 2 and 3 compatability | #!/bin/python
try:
import urllib.request as urlrequest
except ImportError:
import urllib as urlrequest
import json
class RESTfulApi:
"""
Generic REST API call
"""
def __init__(self):
"""
Constructor
"""
pass
def request(self, url):
"""
Web... | #!/bin/python
import urllib.request
import json
class RESTfulApi:
"""
Generic REST API call
"""
def __init__(self):
"""
Constructor
"""
pass
def request(self, url):
"""
Web request
:param: url: The url link
:return JSON object
... |
Convert new path to old pattern to reuse current data in GA | // Analytics for Vaadin Components
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-an... | // Analytics for Vaadin Components
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-an... |
Rewrite RouteContext as a function constructor instead of a class | function RouteContext(routes, route) {
let routeIndex = routes.indexOf(route)
this.parentRoutes = routes.slice(0, routeIndex)
}
RouteContext.prototype.trigger = function() {
let parentRoutes = this.parentRoutes
for (let i = parentRoutes.length - 1; i >= 0; i--) {
let channel = parentRoutes[i]._contextChann... | export default class RouteContext {
constructor(routes, route) {
let routeIndex = routes.indexOf(route)
this.parentRoutes = routes.slice(0, routeIndex)
}
trigger() {
let parentRoutes = this.parentRoutes
for (let i = parentRoutes.length - 1; i >= 0; i--) {
let channel = parentRoutes[i]._cont... |
Handle installs not using new settings engine | __copyright__ = "Copyright 2017 Birkbeck, University of London"
__author__ = "Martin Paul Eve & Andy Byers"
__license__ = "AGPL v3"
__maintainer__ = "Birkbeck Centre for Technology and Publishing"
from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic import TemplateView
... | __copyright__ = "Copyright 2017 Birkbeck, University of London"
__author__ = "Martin Paul Eve & Andy Byers"
__license__ = "AGPL v3"
__maintainer__ = "Birkbeck Centre for Technology and Publishing"
from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic import TemplateView
... |
Switch the default for --experimental_multi_threaded_digest
It looks like this is fairly widely used now, and we recommend users who are still on spinning platters to upgrade their workstation. :-P
Progress on #6345.
PiperOrigin-RevId: 262317072 | // Copyright 2016 The Bazel 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 appl... | // Copyright 2016 The Bazel 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 appl... |
Update the equality test for database files | #!/usr/bin/env python
# ----------------------------------------------------------------------------
# Copyright (c) 2015--, micronota development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# ----------------------... | #!/usr/bin/env python
# ----------------------------------------------------------------------------
# Copyright (c) 2015--, micronota development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# ----------------------... |
Use HTTPS rather than SSH to clone Particle firmware repository. | var path = require("path");
var outputDirectory = path.resolve("./output");
var libsDirectory = path.resolve("./libs");
var tempDirectory = path.resolve("./build_temp");
module.exports = {
particle: {
platform: "photon", // See https://github.com/spark/firmware/blob/develop/docs/build.md#platform-nameids
ta... | var path = require("path");
var outputDirectory = path.resolve("./output");
var libsDirectory = path.resolve("./libs");
var tempDirectory = path.resolve("./build_temp");
module.exports = {
particle: {
platform: "photon", // See https://github.com/spark/firmware/blob/develop/docs/build.md#platform-nameids
ta... |
Return failure on pop() from an empty queue | # Topic server
import time
import flask
app = flask.Flask(__name__)
data = []
sessions = {} # session ID -> current index # FIXME No cleanup!
@app.route("/simple/newsession")
def new_session():
session_id = "session" + hex(int(time.time() * 1000))[2:]
sessions[session_id] = 0
return session_id
@app... | # Topic server
import time
import flask
app = flask.Flask(__name__)
data = []
sessions = {} # session ID -> current index # FIXME No cleanup!
@app.route("/simple/newsession")
def new_session():
session_id = "session" + hex(int(time.time() * 1000))[2:]
sessions[session_id] = 0
return session_id
@app... |
Fix issue with Redirect not rendering history page | import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Redirect, Route, withRouter } from 'react-router';
class PrivateRoute extends Component {
render() {
const {
component,
isAuthenticated,
...rest
} = this.props;
r... | import React, { Component } from 'react';
import { connect } from 'react-redux';
import { Redirect, Route } from 'react-router';
class PrivateRoute extends Component {
render() {
const {
component,
isAuthenticated,
...rest
} = this.props;
return (
... |
Use variadic args in main method | /*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,... | /*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,... |
Make it clear that the E-Mail address is optional. | from wtforms import Form, SubmitField, BooleanField, TextField, SelectField, \
PasswordField, IntegerField, FieldList, FormField, validators
class LoginForm(Form):
username = TextField('Username', [validators.Required()])
password = PasswordField('Password', [validators.Required()])
remember = Boolean... | from wtforms import Form, SubmitField, BooleanField, TextField, SelectField, \
PasswordField, IntegerField, FieldList, FormField, validators
class LoginForm(Form):
username = TextField('Username', [validators.Required()])
password = PasswordField('Password', [validators.Required()])
remember = Boolean... |
Modify pypi description to use README.md | from setuptools import setup
from os import path
# read the contents of your README file
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, "README.md"), encoding="utf-8") as f:
long_description = f.read()
setup(
name="simple_slack_bot",
packages=["simple_slack_bot"]... | from setuptools import setup
setup(
name="simple_slack_bot",
packages=["simple_slack_bot"], # this must be the same as the name above
version="1.3.2",
description="Simple Slack Bot makes writing your next Slack bot incredibly easy",
long_description="Simple Slack Bot makes writing your next Slack ... |
Fix required parameter for Modal popup | 'use strict'
import React from 'react'
import {
View,
TouchableHighlight,
Image,
Text,
Modal
} from 'react-native';
var css = require('../../styles/css');
// Modal with text information content and a large button (usually for dismissing the modal)
export default class InfoModal extends React.Component {
_on... | 'use strict'
import React from 'react'
import {
View,
TouchableHighlight,
Image,
Text,
Modal
} from 'react-native';
var css = require('../../styles/css');
// Modal with text information content and a large button (usually for dismissing the modal)
export default class InfoModal extends React.Component {
_on... |
Fix the audience for the extension hook | import path from 'path';
import jwt from 'jsonwebtoken';
import config from '../config';
import logger from '../logger';
module.exports = (hookPath) =>
(req, res, next) => {
if (req.headers.authorization && req.headers.authorization.split(' ')[0] === 'Bearer') {
const token = req.headers.authorization.spl... | import path from 'path';
import jwt from 'jsonwebtoken';
import config from '../config';
import logger from '../logger';
module.exports = (hookPath) =>
(req, res, next) => {
if (req.headers.authorization && req.headers.authorization.split(' ')[0] === 'Bearer') {
const token = req.headers.authorization.spl... |
Add Config.get() to skip KeyErrors
Adds common `dict.get()` pattern to our own Config class, to enable
use of fallbacks or `None`, as appropriate. | #! /usr/bin/env python
import os
import warnings
import yaml
class Config(object):
config_fname = "configuration.yaml"
def __init__(self, config_fname=None):
config_fname = config_fname or self.config_fname
fo = open(config_fname, "r")
blob = fo.read()
fo.close()
self... | #! /usr/bin/env python
import os
import warnings
import yaml
class Config(object):
config_fname = "configuration.yaml"
def __init__(self, config_fname=None):
config_fname = config_fname or self.config_fname
fo = open(config_fname, "r")
blob = fo.read()
fo.close()
self... |
Remove the data attribute when commiting too. | $(function() {
$("td").dblclick(function() {
var td = $(this), originalContent = td.text();
td.addClass("cellEditing");
td.data("originalContent", originalContent);
var el = document.createElement("input"), $el = $(el);
$el.attr({type: "text", value: originalContent});
td.empty();
td.appe... | $(function() {
$("td").dblclick(function() {
var td = $(this), originalContent = td.text();
td.addClass("cellEditing");
td.data("originalContent", originalContent);
var el = document.createElement("input"), $el = $(el);
$el.attr({type: "text", value: originalContent});
td.empty();
td.appe... |
Add runnable method to convert a callable into a runnable. | /*
* Copyright 2007 Russell Harmon
*
* 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 2007 Russell Harmon
*
* 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.