text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Update default smart contract addresses | # -*- coding: utf-8 -*-
UINT64_MAX = 2 ** 64 - 1
UINT64_MIN = 0
INT64_MAX = 2 ** 63 - 1
INT64_MIN = -(2 ** 63)
UINT256_MAX = 2 ** 256 - 1
# Deployed to Ropsten revival on 2017-08-03 from commit 17aa7671159779ceef22fe90001970bed0685c4d
ROPSTEN_REGISTRY_ADDRESS = '25926b6d29f56ba8466601d7ce7dd29985af1f14'
ROPSTEN_DIS... | # -*- coding: utf-8 -*-
UINT64_MAX = 2 ** 64 - 1
UINT64_MIN = 0
INT64_MAX = 2 ** 63 - 1
INT64_MIN = -(2 ** 63)
UINT256_MAX = 2 ** 256 - 1
# Deployed to Ropsten revival on 2017-06-19 from commit 2677298a69c1b1f35b9ab26beafe457acfdcc0ee
ROPSTEN_REGISTRY_ADDRESS = 'aff1f958c69a6820b08a02549ff9041629ae8257'
ROPSTEN_DIS... |
Allow passing other key codes, not just the ones from the list | import Ember from 'ember';
const keyToEventMap = {
27: 'esc',
37: 'leftArrow',
38: 'upArrow',
39: 'rightArrow',
40: 'downArrow'
};
export default Ember.Mixin.create({
mergedProperties: ['keyEvents'],
keyEvents: {},
setupKeyHandling: function() {
this.$(document).on(`keyup.${this.get('elementId')}... | import Ember from 'ember';
const keyCodeToEventMap = {
27: 'esc',
37: 'leftArrow',
38: 'upArrow',
39: 'rightArrow',
40: 'downArrow'
};
export default Ember.Mixin.create({
mergedProperties: ['keyEvents'],
keyEvents: {},
setupKeyHandling: function() {
this.$(document).on(`keyup.${this.get('elementI... |
Revert "sudo is required to run which <gem-exec> on arch."
This reverts commit 15162c58c27bc84f1c7fc0326f782bd693ca4d7e. | from fabric.api import env, run, settings, hide
# Default system user
env.user = 'ubuntu'
# Default puppet environment
env.environment = 'prod'
# Default puppet module directory
env.puppet_module_dir = 'modules/'
# Default puppet version
# If loom_puppet_version is None, loom installs the latest version
env.loom_pu... | from fabric.api import env, run, sudo, settings, hide
# Default system user
env.user = 'ubuntu'
# Default puppet environment
env.environment = 'prod'
# Default puppet module directory
env.puppet_module_dir = 'modules/'
# Default puppet version
# If loom_puppet_version is None, loom installs the latest version
env.l... |
Remove needless import of sys module | #!/usr/bin/env python3
# card-fight-thingy - Simplistic battle card game... thingy
#
# The MIT License (MIT)
#
# Copyright (c) 2015 The Underscores
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the S... | #!/usr/bin/env python3
# card-fight-thingy - Simplistic battle card game... thingy
#
# The MIT License (MIT)
#
# Copyright (c) 2015 The Underscores
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the S... |
Fix dumb case where errors didn't exist in the send callback. | var server = require('http').createServer()
var wr = require('./water_rower.js')({ debug: false} );
var ws = require('ws');
var url = require('url')
var WebSocketServer = ws.Server
var wsServer = new WebSocketServer({ server: server });
var parseArgs = require('minimist');
var argv = parseArgs( process.argv , {
numb... | var server = require('http').createServer()
var wr = require('./water_rower.js')({ debug: false} );
var ws = require('ws');
var url = require('url')
var WebSocketServer = ws.Server
var wsServer = new WebSocketServer({ server: server });
var parseArgs = require('minimist');
var argv = parseArgs( process.argv , {
numb... |
Fix tests after the previous commit | /*
* Copyright 2018 The RoboZonky Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or ... | /*
* Copyright 2017 The RoboZonky Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or ... |
Remove the unused import and fix testing library | """
:mod:`zsl.interface.webservice.performers.method`
-------------------------------------------------
.. moduleauthor:: Martin Babka
"""
from __future__ import unicode_literals
import logging
from importlib import import_module
import sys
from zsl.router.method import get_method_packages
def call_exposers_in_me... | """
:mod:`zsl.interface.webservice.performers.method`
-------------------------------------------------
.. moduleauthor:: Martin Babka
"""
from __future__ import unicode_literals
import logging
from importlib import import_module, reload
import sys
from zsl.router.method import get_method_packages
def call_expose... |
Fix @typedef name to be dot-separated. | steal('can/util', function (can) {
/**
* @typedef {{bind:function():*,unbind:function():*}} can.util.bind
*
* Provides mixin-able bind and unbind methods. `bind()` calls `this._bindsetup`
* when the first bind happens and. `unbind()` calls `this._bindteardown` when there
* are no more event handlers.
*
... | steal('can/util', function (can) {
/**
* @typedef {{bind:function():*,unbind:function():*}} can/util/bind
*
* Provides mixin-able bind and unbind methods. `bind()` calls `this._bindsetup`
* when the first bind happens and. `unbind()` calls `this._bindteardown` when there
* are no more event handlers.
*
... |
Enable import hook by default | """A python library wrapping the Cap'n Proto C++ library
Example Usage::
import capnp
addressbook = capnp.load('addressbook.capnp')
# Building
addresses = addressbook.AddressBook.newMessage()
people = addresses.init('people', 1)
alice = people[0]
alice.id = 123
alice.name = 'Ali... | """A python library wrapping the Cap'n Proto C++ library
Example Usage::
import capnp
addressbook = capnp.load('addressbook.capnp')
# Building
addresses = addressbook.AddressBook.newMessage()
people = addresses.init('people', 1)
alice = people[0]
alice.id = 123
alice.name = 'Ali... |
Change viewport and zoom factor | var page = require("webpage").create();
var system = require("system");
page.paperSize = {
width: '6in',
height: '4in',
margin: {
top: '10px',
left: '15px',
right: '15px',
bottom: '10px'
}
}
page.zoomFactor = 0.7;
page.open(system.args[1], function (sta... | var page = require("webpage").create();
var system = require("system");
page.paperSize = {
width: '6in',
height: '4in',
margin: {
top: '10px',
left: '15px',
right: '15px',
bottom: '10px'
}
}
page.zoomFactor = 0.5;
page.open(system.args[1], function (sta... |
Change .env variable to KCLS_USER | import requests
from bs4 import BeautifulSoup
import json
from dotenv import load_dotenv
import os
load_dotenv(".env")
s = requests.Session()
r = s.get("https://kcls.bibliocommons.com/user/login", verify=False)
payload = {
"name": os.environ.get("KCLS_USER"),
"user_pin": os.environ.get("PIN")
}
p = s.post(... | import requests
from bs4 import BeautifulSoup
import json
from dotenv import load_dotenv
import os
load_dotenv(".env")
s = requests.Session()
r = s.get("https://kcls.bibliocommons.com/user/login", verify=False)
payload = {
"name": os.environ.get("USER"),
"user_pin": os.environ.get("PIN")
}
s.post("https://... |
Load addons into resolver AFField instead of global AFField | import Ember from 'ember'
import { DEFAULT_CONFIG as FIELD_DEFAULT_CONFIG } from '../components/af-field'
import i18n from '../mixins/i18n'
import loc from '../mixins/loc'
import restless from '../mixins/restless'
import validations from '../mixins/validations'
const AF_FIELD_MIXINS = { i18n, loc, restless, validati... | import Ember from 'ember'
import AFField, { DEFAULT_CONFIG as FIELD_DEFAULT_CONFIG } from '../components/af-field'
import i18n from '../mixins/i18n'
import loc from '../mixins/loc'
import restless from '../mixins/restless'
import validations from '../mixins/validations'
const AF_FIELD_MIXINS = { i18n, loc, restless,... |
Disable secure cookies and csrf for dev | from sleepy.conf.base import *
DEBUG = True
TEMPLATE_DEBUG = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'sleepy_dev',
}
}
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = '' # noqa
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = ''
SOCIAL_AUTH_TWITTER_KEY = ''
SOCIAL_AUT... | from sleepy.conf.base import *
DEBUG = True
TEMPLATE_DEBUG = True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'sleepy_dev',
}
}
SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = '' # noqa
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = ''
SOCIAL_AUTH_TWITTER_KEY = ''
SOCIAL_AUT... |
USe the Enum name, not the toString method when binding the parameter value | package com.vladmihalcea.book.hpjp.hibernate.mapping.enums;
import org.hibernate.HibernateException;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Types;
/**
* @author Vlad Mihalcea
*/
public class PostgreSQLEnumTy... | package com.vladmihalcea.book.hpjp.hibernate.mapping.enums;
import org.hibernate.HibernateException;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Types;
/**
* @author Vlad Mihalcea
*/
public class PostgreSQLEnumTy... |
Use inline variable declartion to save LOC | WebApp.connectHandlers.use("/package", function(request, response) {
var url = `https://atmospherejs.com/a/packages/findByNames\
?names=${request.url.split('/')[1]}`;
var opts = {headers: {'Accept': 'application/json'}};
HTTP.get(url, opts, function(err, res) {
var name = '', pl = res.data[0], version, pubDat... | WebApp.connectHandlers.use("/package", function(request, response) {
var url = `https://atmospherejs.com/a/packages/findByNames\
?names=${request.url.split('/')[1]}`;
var opts = {headers: {'Accept': 'application/json'}};
HTTP.get(url, opts, function(err, res) {
var name = '', version, pubDate, starCount, inst... |
Fix `pauseOnHover` default value to true
Which is described in README | var defaultProps = {
className: '',
accessibility: true,
adaptiveHeight: false,
arrows: true,
autoplay: false,
autoplaySpeed: 3000,
centerMode: false,
centerPadding: '50px',
cssEase: 'ease',
dots: false,
dotsClass: 'slick-dots',
draggable: true,
easing: 'linear',
... | var defaultProps = {
className: '',
accessibility: true,
adaptiveHeight: false,
arrows: true,
autoplay: false,
autoplaySpeed: 3000,
centerMode: false,
centerPadding: '50px',
cssEase: 'ease',
dots: false,
dotsClass: 'slick-dots',
draggable: true,
easing: 'linear',
... |
Remove sent word count from jQuery. | function countWords() {
var string = $.trim($("textarea").val()),
words = string.replace(/\s+/gi, ' ').split(' ').length
chars = string.length;
if(!chars)words=0;
$(".word-count").contents().filter(function(){
return this.nodeType == 3;
})[0].nodeValue = words
}
function autoSave() {
var con... | function countWords() {
var string = $.trim($("textarea").val()),
words = string.replace(/\s+/gi, ' ').split(' ').length
chars = string.length;
if(!chars)words=0;
$(".word-count").contents().filter(function(){
return this.nodeType == 3;
})[0].nodeValue = words
}
function autoSave() {
var reg... |
Change Development Status to Beta, add Python 3.4 support flag. | from setuptools import setup, find_packages
import flask_boost
entry_points = {
"console_scripts": [
"boost = flask_boost.cli:main",
]
}
with open("requirements.txt") as f:
requires = [l for l in f.read().splitlines() if l]
setup(
name='Flask-Boost',
version=flask_boost.__version__,
p... | from setuptools import setup, find_packages
import flask_boost
entry_points = {
"console_scripts": [
"boost = flask_boost.cli:main",
]
}
with open("requirements.txt") as f:
requires = [l for l in f.read().splitlines() if l]
setup(
name='Flask-Boost',
version=flask_boost.__version__,
p... |
Allow passing existing express app to appFactory | var _ = require('lodash'),
express = require('express'),
STATIC_CACHE_AGE = 365 * 24 * 60 * 60 * 1000; // 1 year;
module.exports = function confgureServer(config, app) {
var app = app || express();
function serveIndex(request, response) {
return response.sendFile('index.html', {
root: config.app... | var _ = require('lodash'),
express = require('express'),
STATIC_CACHE_AGE = 365 * 24 * 60 * 60 * 1000; // 1 year;
module.exports = function confgureServer(config) {
var app = express();
function serveIndex(request, response) {
return response.sendFile('index.html', {
root: config.appAssets.html.... |
Fix install order to fix wrong caret line color | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
A simple example that shows how to setup CodeEdit.
In this example, we install a syntax highlighter mode (based on pygments), a
mode that highlights the current line and a _search and replace_ panel.
There are many other modes and panels, feel free to use this example... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
A simple example that shows how to setup CodeEdit.
In this example, we install a syntax highlighter mode (based on pygments), a
mode that highlights the current line and a _search and replace_ panel.
There are many other modes and panels, feel free to use this example... |
Add padding to color swatch headline. | /* @flow */
import React from 'react';
import Box from 'grommet/components/Box';
import Heading from 'grommet/components/Heading';
import { BlockParagraph } from '../BlockParagraph';
import Swatch from './swatch';
export default function BlockColorSwatch(props: {
color: ?{
name: string,
thumbColor: string,
... | /* @flow */
import React from 'react';
import Box from 'grommet/components/Box';
import Heading from 'grommet/components/Heading';
import { BlockParagraph } from '../BlockParagraph';
import Swatch from './swatch';
export default function BlockColorSwatch(props: {
color: ?{
name: string,
thumbColor: string,
... |
Remove not essential parameters from config file | <?php
return [
// View settings
'view' => [
'extension' => 'twig'
],
// Auth settings
'auth' => [
'cookie_lifetime' => 86400,
'session_lifetime' => 3600,
'update_gap' => 1800,
'pull_user' => false
],
// LDAP settings
'ldap' => [... | <?php
return [
// External router settings
'external_router' => [
'default_url' => 'home',
'prefixes' => [],
'prefix_options' => [],
'data_type' => 'query_string',
'auto_trim' => true,
'auto_null' => true
],
// Auth settings
'auth' => [... |
Fix app-wrapper tests after merge from master
Remove `wrapper` from `beforeEach`. | import React from 'react';
import TestUtils from 'react-dom/test-utils';
import { shallow } from 'enzyme';
import { rootTagTest } from '../../utils/helpers/tags/tags-specs';
import AppWrapper from './app-wrapper';
describe('app wrapper', () => {
let instance;
beforeEach(() => {
instance = TestUtils.renderInto... | import React from 'react';
import TestUtils from 'react-dom/test-utils';
import { shallow } from 'enzyme';
import { rootTagTest } from '../../utils/helpers/tags/tags-specs';
import AppWrapper from './app-wrapper';
describe('app wrapper', () => {
let instance;
beforeEach(() => {
instance = TestUtils.renderInto... |
Fix regression in path handling of TenantStaticFileStorage.
Fixes #197. | import os
from django.contrib.staticfiles.storage import StaticFilesStorage
from django_tenants.files.storages import TenantStorageMixin
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
class TenantStaticFilesStorage(TenantStorageMixin, StaticFilesStorage):
"""
Implemen... | import os
from django.contrib.staticfiles.storage import StaticFilesStorage
from django_tenants.files.storages import TenantStorageMixin
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
class TenantStaticFilesStorage(TenantStorageMixin, StaticFilesStorage):
"""
Implemen... |
Fix type hint in neon loader trait | <?php
/*
* This is part of the symfonette/neon-integration package.
*
* (c) Martin Hasoň <martin.hason@gmail.com>
* (c) Webuni s.r.o. <info@webuni.cz>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfonette\NeonInte... | <?php
/*
* This is part of the symfonette/neon-integration package.
*
* (c) Martin Hasoň <martin.hason@gmail.com>
* (c) Webuni s.r.o. <info@webuni.cz>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfonette\NeonInte... |
Remove keyring and change to basic cfg file handling | #!/usr/local/bin/python2.7 -u
__author__ = "Peter Shipley"
import os
import ConfigParser
from ISY.IsyEvent import ISYEvent
def main() :
config = ConfigParser.ConfigParser()
config.read(os.path.expanduser('~/home.cfg'))
server = ISYEvent()
isy_addr = config.get('isy', 'addr')
isy_user = c... | #!/usr/local/bin/python2.7 -u
__author__ = "Peter Shipley"
import os
import keyring
import ConfigParser
from ISY.IsyEvent import ISYEvent
def main() :
config = ConfigParser.ConfigParser()
config.read(os.path.expanduser('~/isy.cfg'))
server = ISYEvent()
# you can subscribe to multiple devices... |
Remove action_runner steps for worldjournal pageset to prevent crashes
BUG=skia:3196
NOTRY=true
Review URL: https://codereview.chromium.org/795173002 | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# pylint: disable=W0401,W0614
from telemetry.page import page as page_module
from telemetry.page import page_set as page_set_module
class SkiaBuildbotDesk... | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# pylint: disable=W0401,W0614
from telemetry.page import page as page_module
from telemetry.page import page_set as page_set_module
class SkiaBuildbotDesk... |
Change max length on home page search form | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import forms
from django.core.exceptions import ValidationError
from candidates.mapit import BaseMapItException
from popolo.models import Area
from compat import text_type
from .mapit import get_areas_from_postcode
class PostcodeForm(form... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import forms
from django.core.exceptions import ValidationError
from candidates.mapit import BaseMapItException
from popolo.models import Area
from compat import text_type
from .mapit import get_areas_from_postcode
class PostcodeForm(form... |
Make a better public constructor for that thing. | package edu.umass.cs.ciir.waltz.io.galago;
import edu.umass.cs.ciir.waltz.io.streams.SkipInputStream;
import edu.umass.cs.ciir.waltz.io.streams.StaticStream;
import org.lemurproject.galago.utility.btree.disk.DiskBTreeIterator;
import org.lemurproject.galago.utility.buffer.CachedBufferDataStream;
import org.lemurprojec... | package edu.umass.cs.ciir.waltz.io.galago;
import edu.umass.cs.ciir.waltz.io.streams.SkipInputStream;
import edu.umass.cs.ciir.waltz.io.streams.StaticStream;
import org.lemurproject.galago.utility.btree.disk.DiskBTreeIterator;
import org.lemurproject.galago.utility.buffer.CachedBufferDataStream;
import org.lemurprojec... |
Remove the extra angular declaration from tests
Browserify has already bundled angular on the main script. | 'use strict';
var istanbul = require('browserify-istanbul');
var isparta = require('isparta');
module.exports = function(config) {
config.set({
basePath: '../',
frameworks: ['jasmine', 'browserify'],
preprocessors: {
'app/js/**/*.js': ['browserify', 'babel', 'coverage']
},
browsers: ['C... | 'use strict';
var istanbul = require('browserify-istanbul');
var isparta = require('isparta');
module.exports = function(config) {
config.set({
basePath: '../',
frameworks: ['jasmine', 'browserify'],
preprocessors: {
'app/js/**/*.js': ['browserify', 'babel', 'coverage']
},
browsers: ['C... |
Add todo in jei plugin | package info.u_team.u_team_core.integration.jei;
// TODO uncomment when jei is available again
//import java.util.List;
//import java.util.stream.Collectors;
//
//import info.u_team.u_team_core.UCoreMod;
//import info.u_team.u_team_core.api.dye.IDyeableItem;
//import mezz.jei.api.*;
//import mezz.jei.api.constants.Van... | package info.u_team.u_team_core.integration.jei;
//import java.util.List;
//import java.util.stream.Collectors;
//
//import info.u_team.u_team_core.UCoreMod;
//import info.u_team.u_team_core.api.dye.IDyeableItem;
//import mezz.jei.api.*;
//import mezz.jei.api.constants.VanillaTypes;
//import mezz.jei.api.registration.... |
Set limit for better sizing. | import React, { PropTypes, Component } from 'react';
import CakeChart from 'cake-chart';
function findParentNode(node, child, parent = null) {
if (node === child) return parent;
for (let c of child.children || []) {
const p = findParentNode(node, c, child);
if (p) return p;
}
}
class AllTime extends Com... | import React, { PropTypes, Component } from 'react';
import CakeChart from 'cake-chart';
function findParentNode(node, child, parent = null) {
if (node === child) return parent;
for (let c of child.children || []) {
const p = findParentNode(node, c, child);
if (p) return p;
}
}
class AllTime extends Com... |
Fix story parsing to support both windows and linux style newlines; Allow extra newlines between nodes | package bloople.net.stories;
import java.io.IOException;
import java.io.Reader;
import java.util.Scanner;
/**
* Created by i on 27/05/2016.
*/
public class StoryParser {
private Scanner scanner;
public StoryParser(Reader reader) {
scanner = new Scanner(reader);
scanner.useDelimiter("(?:\r?\... | package bloople.net.stories;
import java.io.IOException;
import java.io.Reader;
import java.util.Scanner;
/**
* Created by i on 27/05/2016.
*/
public class StoryParser {
private Scanner scanner;
public StoryParser(Reader reader) {
scanner = new Scanner(reader);
scanner.useDelimiter("\n\n");... |
Disable submit button while loading relations in unpublish dialog | (function () {
"use strict";
function UnpublishController($scope, $controller, editorState, service) {
var vm = this;
angular.extend(this, $controller('Umbraco.Overlays.UnpublishController', { $scope: $scope }));
vm.loading = true;
vm.relations = [];
vm.showLanguageCol... | (function () {
"use strict";
function UnpublishController($scope, $controller, editorState, service) {
var vm = this;
angular.extend(this, $controller('Umbraco.Overlays.UnpublishController', { $scope: $scope }));
vm.loading = true;
vm.relations = [];
function init() {... |
Revert "Started exploring using argument but realizing this is a rabbit hole"
This reverts commit b899d5613c0f4425aa4cc69bac9561b503ba83d4. | from os import path
import shutil
import sublime
import sublime_plugin
SUBLIME_ROOT = path.normpath(path.join(sublime.packages_path(), '..'))
COMMANDS_FILEPATH = path.join('Packages', 'User', 'Commands.sublime-commands')
COMMANDS_FULL_FILEPATH = path.join(SUBLIME_ROOT, COMMANDS_FILEPATH)
COMMANDS_SOURCE_FULL_FILEPATH... | from os import path
import shutil
import sublime
import sublime_plugin
SUBLIME_ROOT = path.normpath(path.join(sublime.packages_path(), '..'))
COMMANDS_FILEPATH = path.join('Packages', 'User', 'Commands.sublime-commands')
COMMANDS_FULL_FILEPATH = path.join(SUBLIME_ROOT, COMMANDS_FILEPATH)
COMMANDS_SOURCE_FULL_FILEPATH... |
Remove trailing spaces in filenames
FAT does not support trailing spaces, so we must remove them | package de.danoeh.antennapod.util;
import java.util.Arrays;
/** Generates valid filenames for a given string. */
public class FileNameGenerator {
private static final char[] ILLEGAL_CHARACTERS = { '/', '\\', '?', '%',
'*', ':', '|', '"', '<', '>' };
static {
Arrays.sort(ILLEGAL_CHARACTERS);
}
private Fil... | package de.danoeh.antennapod.util;
import java.util.Arrays;
/** Generates valid filenames for a given string. */
public class FileNameGenerator {
private static final char[] ILLEGAL_CHARACTERS = { '/', '\\', '?', '%',
'*', ':', '|', '"', '<', '>' };
static {
Arrays.sort(ILLEGAL_CHARACTERS);
}
private Fil... |
Replace more occurences of "group" with "category" | package org.monospark.actioncontrol.category;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.util.Collections;
import java.util.Set;
import java.util.stream.Collectors;
import org.monospark.actioncontrol.config.ConfigParseException;
import org.monospark.actioncontrol.config.Co... | package org.monospark.actioncontrol.category;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.util.Collections;
import java.util.Set;
import java.util.stream.Collectors;
import org.monospark.actioncontrol.config.ConfigParseException;
import org.monospark.actioncontrol.config.Co... |
Use __invert__ instead of __not__ | import operator
from datashape import dshape
from .core import Scalar, BinOp, UnaryOp
class BooleanInterface(Scalar):
def __invert__(self):
return Invert(self)
def __and__(self, other):
return And(self, other)
def __or__(self, other):
return Or(self, other)
class Boolean(Boolea... | import operator
from datashape import dshape
from .core import Scalar, BinOp, UnaryOp
class BooleanInterface(Scalar):
def __not__(self):
return Not(self)
def __and__(self, other):
return And(self, other)
def __or__(self, other):
return Or(self, other)
class Boolean(BooleanInter... |
Add IOError custom message when rsa key file is missing. | from django.conf import settings as django_settings
from django.core.urlresolvers import reverse
from oidc_provider import settings
def get_issuer():
"""
Construct the issuer full url. Basically is the site url with some path
appended.
"""
site_url = settings.get('SITE_URL')
path = reverse('o... | from django.conf import settings as django_settings
from django.core.urlresolvers import reverse
from oidc_provider import settings
def get_issuer():
"""
Construct the issuer full url. Basically is the site url with some path
appended.
"""
site_url = settings.get('SITE_URL')
path = reverse('o... |
Fix compatibility with Node.js v4.x
The callback for the `message` event on the cluster is invoked
without the `worker` argument in Node.js v4.x.
This commit fixes the issue by using the `message` event that is
emitted on the workers. | 'use strict';
const impl = process.argv[2];
if (!impl) {
console.error('No implementation provided');
process.exit(1);
}
switch (impl) {
case 'ws':
case 'uws':
case 'faye':
break;
default:
console.error(`Implementation: ${impl} not valid`);
process.exit(1);
}
const cluster = require('cluster... | 'use strict';
const impl = process.argv[2];
if (!impl) {
console.error('No implementation provided');
process.exit(1);
}
switch (impl) {
case 'ws':
case 'uws':
case 'faye':
break;
default:
console.error(`Implementation: ${impl} not valid`);
process.exit(1);
}
const cluster = require('cluster... |
Change yield to yield from
...because yield from does actually work with 2.0.x-dev and PHP 7. I'm sorry. :( | #!/usr/bin/env php
<?php
require dirname(__DIR__) . '/vendor/autoload.php';
use Icicle\Coroutine;
use Icicle\Dns\Resolver\Resolver;
use Icicle\Loop;
if (2 > $argc) {
throw new InvalidArgumentException('Too few arguments provided. Usage: {DomainName}');
}
$domain = $argv[1];
$coroutine = Coroutine\create(functi... | #!/usr/bin/env php
<?php
require dirname(__DIR__) . '/vendor/autoload.php';
use Icicle\Coroutine;
use Icicle\Dns\Resolver\Resolver;
use Icicle\Loop;
if (2 > $argc) {
throw new InvalidArgumentException('Too few arguments provided. Usage: {DomainName}');
}
$domain = $argv[1];
$coroutine = Coroutine\create(functi... |
[core] Add try/catch around asset importing and emit error to stream | import through from 'through2'
import getAssetImporter from './getAssetImporter'
import promiseEach from 'promise-each-concurrency'
const batchSize = 10
const concurrency = 6
export default options => {
const assetImporter = getAssetImporter(options)
const documents = []
return through.obj(onChunk, onFlush)
... | import through from 'through2'
import getAssetImporter from './getAssetImporter'
import promiseEach from 'promise-each-concurrency'
const batchSize = 10
const concurrency = 6
export default options => {
const assetImporter = getAssetImporter(options)
const documents = []
return through.obj(onChunk, onFlush)
... |
Fix exception when trying to login with non-existing user | package se.kits.gakusei.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springf... | package se.kits.gakusei.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springf... |
Fix max number to use parseInt | process.stdin.resume();
process.stdin.setEncoding('utf8');
var input = '';
process.stdin.on('data', function(chunk) {
input += chunk;
});
process.stdin.on('end', function() {
var lines = input.trim().split('\n');
if (lines.length > 0) {
var max = parseInt(lines[0], 10);
for (var i = 0; i < max; i++)... | process.stdin.resume();
process.stdin.setEncoding('utf8');
var input = '';
process.stdin.on('data', function(chunk) {
input += chunk;
});
process.stdin.on('end', function() {
var lines = input.trim().split('\n');
if (lines.length > 0) {
var max = lines[0];
for (var i = 0; i < max; i++) {
var n ... |
CDEC-72: Add trial.codenvy.com package as IM download option | /*
* CODENVY CONFIDENTIAL
* __________________
*
* [2012] - [2014] Codenvy, S.A.
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Codenvy S.A. and its suppliers,
* if any. The intellectual and technical concepts contained
* herein are proprietary to Cod... | /*
* CODENVY CONFIDENTIAL
* __________________
*
* [2012] - [2014] Codenvy, S.A.
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Codenvy S.A. and its suppliers,
* if any. The intellectual and technical concepts contained
* herein are proprietary to Cod... |
Replace `replaceAll` with `replace` for better perfomance
if the first argument is not a real regular expression, String::replace does exactly the same thing as String::replaceAll without the performance drawback. | package de.retest.recheck.persistence.xml.util;
import javax.xml.bind.Marshaller;
import de.retest.recheck.ui.descriptors.IdentifyingAttributesAdapter;
import de.retest.recheck.ui.descriptors.RenderContainedElementsAdapter;
import de.retest.recheck.ui.descriptors.StateAttributesAdapter;
public class XmlUtil {
priv... | package de.retest.recheck.persistence.xml.util;
import javax.xml.bind.Marshaller;
import de.retest.recheck.ui.descriptors.IdentifyingAttributesAdapter;
import de.retest.recheck.ui.descriptors.RenderContainedElementsAdapter;
import de.retest.recheck.ui.descriptors.StateAttributesAdapter;
public class XmlUtil {
priv... |
Fix a tab/space issue coming up on github | /**
* Has Vowels
*
* hasVowel tests if the String calling the function has a vowels
*
* @param {void}
* @return {Boolean} returns true or false indicating if the string
* has a vowel or not
*/
String.prototype.hasVowels = function() {
var inputString = this;
return /[aeiou]/gi.test(inputString);
};
/... | /**
* Has Vowels
*
* hasVowel tests if the String calling the function has a vowels
*
* @param {void}
* @return {Boolean} returns true or false indicating if the string
* has a vowel or not
*/
String.prototype.hasVowels = function() {
var inputString = this;
return /[aeiou]/gi.test(inputString);
};
/... |
Fix api key in http request header
Follow the header name of skygear-server. | package model
import (
"net/http"
"strconv"
"github.com/skygeario/skygear-server/pkg/core/config"
)
type KeyType int
const (
// NoAccessKey means no correct access key
NoAccessKey KeyType = iota
// APIAccessKey means request is using api key
APIAccessKey
// MasterAccessKey means request is using master key
... | package model
import (
"net/http"
"strconv"
"github.com/skygeario/skygear-server/pkg/core/config"
)
type KeyType int
const (
// NoAccessKey means no correct access key
NoAccessKey KeyType = iota
// APIAccessKey means request is using api key
APIAccessKey
// MasterAccessKey means request is using master key
... |
Make sure vertices really get added to the graph. Duh.
git-svn-id: e7d6bde23f017c9ff4efd468d79d66def666766b@4044 eae3c2d3-9b19-0410-a86e-396b6ccb6ab3 | package edu.umd.cs.findbugs.ba.ch;
import java.util.HashMap;
import java.util.Map;
import edu.umd.cs.findbugs.graph.AbstractGraph;
public class ClassHierarchyGraph
extends AbstractGraph<ClassHierarchyGraphEdge, ClassHierarchyGraphVertex> {
private Map<String, ClassHierarchyGraphVertex> vertexMap;
public Cl... | package edu.umd.cs.findbugs.ba.ch;
import java.util.HashMap;
import java.util.Map;
import edu.umd.cs.findbugs.graph.AbstractGraph;
public class ClassHierarchyGraph
extends AbstractGraph<ClassHierarchyGraphEdge, ClassHierarchyGraphVertex> {
private Map<String, ClassHierarchyGraphVertex> vertexMap;
public Cl... |
Add beginning and end args to GetGames |
import logging
from version import __version__
logger = logging.getLogger(__name__)
logger.debug('Loading %s ver %s' % (__name__, __version__))
# Actions represents the available textual items that can be passed to main
# to drive dispatch. These should be all lower case, no spaces or underscores.
actions = [
... |
import logging
from version import __version__
logger = logging.getLogger(__name__)
logger.debug('Loading %s ver %s' % (__name__, __version__))
# Actions represents the available textual items that can be passed to main
# to drive dispatch. These should be all lower case, no spaces or underscores.
actions = [
... |
BAP-11409: Create Language entity
- updated unit test | <?php
namespace Oro\Bundle\TranslationBundle\Tests\Unit\Entity;
use Oro\Bundle\OrganizationBundle\Entity\Organization;
use Oro\Bundle\TranslationBundle\Entity\Language;
use Oro\Bundle\UserBundle\Entity\User;
use Oro\Component\Testing\Unit\EntityTestCaseTrait;
class LanguageTest extends \PHPUnit_Framework_TestCase
{... | <?php
namespace Oro\Bundle\TranslationBundle\Tests\Unit\Entity;
use Oro\Bundle\OrganizationBundle\Entity\Organization;
use Oro\Bundle\TranslationBundle\Entity\Language;
use Oro\Bundle\UserBundle\Entity\User;
use Oro\Component\Testing\Unit\EntityTestCaseTrait;
class LanguageTest extends \PHPUnit_Framework_TestCase
{... |
Move QGL import inside function
A channel library is not always available | from . import bbn
import auspex.config
from auspex.log import logger
def pulse_marker(marker_name, length = 100e-9):
""" Utility to generate a square pulse on a APS2 marker. Used for instance to switch a signal between spectrum analyzer and input line
marker_name as defined in measure.yaml """
from QGL im... | from . import bbn
import auspex.config
from auspex.log import logger
from QGL import *
ChannelLibrary()
def pulse_marker(marker_name, length = 100e-9):
""" Utility to generate a square pulse on a APS2 marker. Used for instance to switch a signal between spectrum analyzer and input line
marker_name as defined i... |
Set editing border color to lightgrey | var rows = 0;
var cols = 10;
var table;
var edit_border = "thin dotted lightgrey";
function text(str)
{
return document.createTextNode(str);
}
function cellContents(rowindex, colindex)
{
return " ";
}
function init()
{
table = document.getElementById("wftable");
addRows(4);
}
function addRows(n... | var rows = 0;
var cols = 10;
var table;
var edit_border = "thin dotted grey";
function text(str)
{
return document.createTextNode(str);
}
function cellContents(rowindex, colindex)
{
return " ";
}
function init()
{
table = document.getElementById("wftable");
addRows(4);
}
function addRows(numrow... |
Fix test to pass model not nothing
We were passing a value that doesn't exist and we need to pass the model
into administeredSchools. | import { currentURL, visit } from '@ember/test-helpers';
import { module, test } from 'qunit';
import setupAuthentication from 'ilios/tests/helpers/setup-authentication';
import { percySnapshot } from 'ember-percy';
import { setupApplicationTest } from 'ember-qunit';
import setupMirage from 'ember-cli-mirage/test-supp... | import { currentURL, visit } from '@ember/test-helpers';
import { module, test } from 'qunit';
import setupAuthentication from 'ilios/tests/helpers/setup-authentication';
import { percySnapshot } from 'ember-percy';
import { setupApplicationTest } from 'ember-qunit';
import setupMirage from 'ember-cli-mirage/test-supp... |
Change script to accept non-number versions of sent and para attributes
The script relied on numeric sent and para attributes. The code was
changed to also accept non-numeric sent and para attributes. In some
cases, the sent and para attributes returned by tools are not numeric. | """Script to generate an HTML page from a KAF file that shows the text contents
including line numbers.
"""
from bs4 import BeautifulSoup
with open('data/minnenijd.kaf') as f:
xml_doc = BeautifulSoup(f)
output_html = ['<html><head>',
'<meta http-equiv="Content-Type" content="text/html; '
... | """Script to generate an HTML page from a KAF file that shows the text contents
including line numbers.
"""
from bs4 import BeautifulSoup
with open('data/minnenijd.kaf') as f:
xml_doc = BeautifulSoup(f)
output_html = ['<html><head>',
'<meta http-equiv="Content-Type" content="text/html; ' \
... |
Add Scenario repo search method | package com.aemreunal.repository.scenario;
/*
***************************
* Copyright (c) 2014 *
* *
* This code belongs to: *
* *
* @author Ahmet Emre Ünal *
* S001974 *
* *
* aemreunal@gmail.com *
* emre.unal... | package com.aemreunal.repository.scenario;
/*
***************************
* Copyright (c) 2014 *
* *
* This code belongs to: *
* *
* @author Ahmet Emre Ünal *
* S001974 *
* *
* aemreunal@gmail.com *
* emre.unal... |
Make byte-separator mandatory in MAC addresses
This will prevent false positive (from hash values for example). | from __future__ import unicode_literals
import re
from core.observables import Observable
class MacAddress(Observable):
regex = r'(?P<search>(([0-9A-Fa-f]{1,2}[.:-]){5,7}([0-9A-Fa-f]{1,2})))'
exclude_fields = Observable.exclude_fields
DISPLAY_FIELDS = Observable.DISPLAY_FIELDS
@classmethod
de... | from __future__ import unicode_literals
import re
from core.observables import Observable
class MacAddress(Observable):
regex = r'(?P<search>(([0-9A-Fa-f]{1,2}[.:-]?){5,7}([0-9A-Fa-f]{1,2})))'
exclude_fields = Observable.exclude_fields
DISPLAY_FIELDS = Observable.DISPLAY_FIELDS
@classmethod
d... |
Check against `this.cacheable` before running
Looks like that might not be available when using the loader at backend.
Closes #3. | 'use strict';
var cheerio = require('cheerio');
var he = require('he');
var hl = require('highlight.js');
var highlightAuto = hl.highlightAuto;
var highlight = hl.highlight;
module.exports = function(input) {
this.cacheable && this.cacheable();
var $ = cheerio.load(input);
$('code').replaceWith(function... | 'use strict';
var cheerio = require('cheerio');
var he = require('he');
var hl = require('highlight.js');
var highlightAuto = hl.highlightAuto;
var highlight = hl.highlight;
module.exports = function(input) {
this.cacheable();
var $ = cheerio.load(input);
$('code').replaceWith(function(i, e) {
v... |
Fix finalOpacity unable to be 0 | import Motion from '../motion';
import Tween from '../tween';
import { rAF } from '../concurrency-helpers';
export default class Opacity extends Motion {
constructor(sprite, opts) {
super(sprite, opts);
this.prior = null;
this.opacityTween = null;
this.opacityFrom = 0;
this.opacityTo = 1;
if ... | import Motion from '../motion';
import Tween from '../tween';
import { rAF } from '../concurrency-helpers';
export default class Opacity extends Motion {
constructor(sprite, opts) {
super(sprite, opts);
this.prior = null;
this.opacityTween = null;
this.opacityFrom = opts && opts.initialOpacity || 0;
... |
Allow sead.Random to be constructed by internal state |
class Random:
def __init__(self, *param):
if len(param) == 1: self.set_seed(param[0])
elif len(param) == 4: self.set_state(*param)
else:
raise TypeError("Random.__init__ takes either 1 or 4 arguments")
def set_seed(self, seed):
multiplier = 0x6C078965
temp = seed
self.state = []
for i in rang... |
class Random:
def __init__(self, seed):
multiplier = 0x6C078965
temp = seed
self.state = []
for i in range(1, 5):
temp ^= temp >> 30
temp = (temp * multiplier + i) & 0xFFFFFFFF
self.state.append(temp)
def u32(self):
temp = self.state[0]
temp = (temp ^ (temp << 11)) & 0xFFFFFFFF
temp ^= tem... |
Add tenant id to Enrollment Certificate | /*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you 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/li... | /*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you 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/li... |
Update test to use 768 key size and different message | package cryptopals
import (
"crypto/rand"
"crypto/rsa"
"testing"
)
func TestDecryptRsaPaddingOracleSimple(t *testing.T) {
c := challenge47{}
priv, _ := rsa.GenerateKey(rand.Reader, 768)
pub := priv.PublicKey
expected := "kick it, CC"
ciphertext, err := rsa.EncryptPKCS1v15(rand.Reader, &pub, []byte(expected)... | package cryptopals
import (
"crypto/rand"
"crypto/rsa"
"testing"
)
func TestDecryptRsaPaddingOracleSimple(t *testing.T) {
c := challenge47{}
priv, _ := rsa.GenerateKey(rand.Reader, 1024)
pub := priv.PublicKey
expected := "Chosen Ciphertext Attacks Against Protocols Based on the RSA Encryption Standard PKCS #... |
Update GitHub icon alt text | import React from 'react'
import styled from 'styled-components'
import { Intro, CheckboxTree } from './components'
import data from './data/data.json'
import github from './assets/github.svg'
const Main = styled.main`
display: flex;
flex-direction: column;
width: 80%;
max-width: 64rem;
height: 100vh;
mar... | import React from 'react'
import styled from 'styled-components'
import { Intro, CheckboxTree } from './components'
import data from './data/data.json'
import github from './assets/github.svg'
const Main = styled.main`
display: flex;
flex-direction: column;
width: 80%;
max-width: 64rem;
height: 100vh;
mar... |
Change clear command success message | package guitests;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
public class ClearCommandTest extends TaskManagerGuiTest {
@Test
public void clear() {
//verify a non-empty list can be cleared
assertTrue(taskListPanel.isListMatching(td.getTypicalTasks()));
assertC... | package guitests;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
public class ClearCommandTest extends TaskManagerGuiTest {
@Test
public void clear() {
//verify a non-empty list can be cleared
assertTrue(taskListPanel.isListMatching(td.getTypicalTasks()));
assertC... |
Set focus to first input element. | // This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative pat... | // This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative pat... |
Fix the missing this/other in BoxCollider | 'use strict';
export default class BoxCollider {
constructor(sprite, x, y, width, height) {
this.sprite = sprite;
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
intersectWith(other) {
let selfX1 = this.sprite.position[0] + this.x;
let selfY1 = this.sprite.position[1] +... | 'use strict';
export default class BoxCollider {
constructor(sprite, x, y, width, height) {
this.sprite = sprite;
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
intersectWith(other) {
let selfX1 = this.sprite.position[0] + x;
let selfY1 = this.sprite.position[1] + y;
... |
Enable running scripts from files
E.g. "xp -e AgeInDays.script.php", which is the equivalent of
"cat AgeInDays.script.php | xp -e"
Scripts do not have an enclosing class, but rather just start
with the code right away (after some optional "use" statements).
Example:
<?php
use util\{Date, DateUtil};
use util\cmd\Cons... | <?php namespace xp\runtime;
use util\cmd\Console;
use lang\XPClass;
/**
* Evaluates sourcecode
*
*/
class Evaluate {
/**
* Main
*
* @param string[] args
*/
public static function main(array $args) {
$argc= sizeof($args);
// Read sourcecode from STDIN if no further argument is given
... | <?php namespace xp\runtime;
use util\cmd\Console;
use lang\XPClass;
/**
* Evaluates sourcecode
*
*/
class Evaluate {
/**
* Main
*
* @param string[] args
*/
public static function main(array $args) {
$argc= sizeof($args);
// Read sourcecode from STDIN if no further argument is given
... |
Fix broken Filter import in FilterSummary | import React from 'react'
import { translate } from 'react-i18next'
import PropTypes from 'prop-types'
import Filter from 'common/components/Filter'
import styles from './FiltersSummary.scss'
const FiltersSummary = ({ filters, removeFilter, t }) => (
<div>
<div className={styles.label}>
{filters.length
... | import React from 'react'
import { translate } from 'react-i18next'
import PropTypes from 'prop-types'
import Filter from 'components/Filter'
import styles from './FiltersSummary.scss'
const FiltersSummary = ({ filters, removeFilter, t }) => (
<div>
<div className={styles.label}>
{filters.length
... |
Add ReturnTypeWillChange to count method | <?php
namespace Illuminate\Database\Eloquent\Factories;
use Countable;
class Sequence implements Countable
{
/**
* The sequence of return values.
*
* @var array
*/
protected $sequence;
/**
* The count of the sequence items.
*
* @var int
*/
public $count;
... | <?php
namespace Illuminate\Database\Eloquent\Factories;
use Countable;
class Sequence implements Countable
{
/**
* The sequence of return values.
*
* @var array
*/
protected $sequence;
/**
* The count of the sequence items.
*
* @var int
*/
public $count;
... |
Remove the Intended Audience classifier | #!/usr/bin/env python3
# coding: utf-8
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
from setuptools import setup, find_packages
import keysmith
with open('README.rst') as readme_file:
README = readme_file.read()
setu... | #!/usr/bin/env python3
# coding: utf-8
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
from setuptools import setup, find_packages
import keysmith
with open('README.rst') as readme_file:
README = readme_file.read()
setu... |
Use Solr for testing with Travis CI | from defaults import *
DATABASES = {
'default': {
#'ENGINE': 'django.db.backends.postgresql_psycopg2',
'ENGINE': 'django.contrib.gis.db.backends.postgis',
# 'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'atlas_test',
'USER': 'postgres',
'PASSWORD': '',
'HOST... | from defaults import *
DATABASES = {
'default': {
#'ENGINE': 'django.db.backends.postgresql_psycopg2',
'ENGINE': 'django.contrib.gis.db.backends.postgis',
# 'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'atlas_test',
'USER': 'postgres',
'PASSWORD': '',
'HOST... |
:art: Change Form to FlaskForm (previous is deprecated) | from flask_wtf import FlaskForm
from wtforms import (
StringField, PasswordField, BooleanField, SubmitField,
ValidationError,
)
from wtforms.validators import (
InputRequired, Length, Email, Regexp, EqualTo,
)
from app.models import User
class LoginForm(FlaskForm):
email = StringField('Email', valida... | from flask_wtf import Form
from wtforms import (
StringField, PasswordField, BooleanField, SubmitField,
ValidationError,
)
from wtforms.validators import (
InputRequired, Length, Email, Regexp, EqualTo,
)
from app.models import User
class LoginForm(Form):
email = StringField('Email', validators=[
... |
Fix Finnish week start to Monday, add format
Finns *always* start their week on Mondays.
The d.m.yyyy date format is the most common one. | /**
* Finnish translation for bootstrap-datepicker
* Jaakko Salonen <https://github.com/jsalonen>
*/
;(function($){
$.fn.datepicker.dates['fi'] = {
days: ["sunnuntai", "maanantai", "tiistai", "keskiviikko", "torstai", "perjantai", "lauantai", "sunnuntai"],
daysShort: ["sun", "maa", "tii", "kes", "tor", "per", "... | /**
* Finnish translation for bootstrap-datepicker
* Jaakko Salonen <https://github.com/jsalonen>
*/
;(function($){
$.fn.datepicker.dates['fi'] = {
days: ["sunnuntai", "maanantai", "tiistai", "keskiviikko", "torstai", "perjantai", "lauantai", "sunnuntai"],
daysShort: ["sun", "maa", "tii", "kes", "tor", "per", "... |
fix: Set default header for transaction handler | /**
* Copyright (C) 2015 The Gravitee team (http://gravitee.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless requ... | /**
* Copyright (C) 2015 The Gravitee team (http://gravitee.io)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless requ... |
Handle app boot without cache | function runBlock( // eslint-disable-line max-params
$rootScope, jwtHelper, $state, $location, APP_CONFIG, authService, localStorage
) {
'ngInject';
$rootScope.$on('$stateChangeStart', function (e, toState) {
if (APP_CONFIG.error && toState.name !== 'error') {
e.preventDefault();... | function runBlock( // eslint-disable-line max-params
$rootScope, jwtHelper, $state, $location, APP_CONFIG, authService, localStorage
) {
'ngInject';
$rootScope.$on('$stateChangeStart', function (e, toState) {
if (APP_CONFIG.error && toState.name !== 'error') {
e.preventDefault();... |
TEST Add 'ps' variable to idealized run | from aospy.run import Run
test_am2 = Run(
name='test_am2',
description=(
'Preindustrial control simulation.'
),
data_in_direc=('/archive/Yi.Ming/sm2.1_fixed/'
'SM2.1U_Control-1860_lm2_aie_rerun6.YIM/pp'),
data_in_dur=5,
data_in_start_date='0001-01-01',
data_in_en... | from aospy.run import Run
test_am2 = Run(
name='test_am2',
description=(
'Preindustrial control simulation.'
),
data_in_direc=('/archive/Yi.Ming/sm2.1_fixed/'
'SM2.1U_Control-1860_lm2_aie_rerun6.YIM/pp'),
data_in_dur=5,
data_in_start_date='0001-01-01',
data_in_en... |
Allow update of notification text.
Allows you to update the message in the notification.
I wanted this feature to allow me to show loading percentage in the notification when downloading or uploading data. | var args = _.extend({
duration: 2000,
animationDuration: 250,
message: '',
title: Ti.App.name,
elasticity: 0.5,
pushForce: 30,
usePhysicsEngine: true
}, arguments[0] || {});
var That = null;
exports.show = function(opt) {
if (_.isObject(opt)) _.extend(args, opt);
if (_.isString(opt)) _.extend(args, { message... | var args = _.extend({
duration: 2000,
animationDuration: 250,
message: '',
title: Ti.App.name,
elasticity: 0.5,
pushForce: 30,
usePhysicsEngine: true
}, arguments[0] || {});
var That = null;
exports.show = function(opt) {
if (_.isObject(opt)) _.extend(args, opt);
if (_.isString(opt)) _.extend(args, { message... |
Add default value for simulation time | #!/usr/bin/env python
TRAJECTORY = 'linear'
CONTROLLER = 'euler'
# control constants
K_X = 0.90
K_Y = 0.90
K_THETA = 0.90
# PID control constants
K_P_V = 0.2
K_I_V = 1.905
K_D_V = 0.00
K_P_W = 0.45
K_I_W = 1.25
K_D_W = 0.000
SIMULATION_TIME_IN_SECONDS = 0.0
if TRAJECTORY == 'linear':
SIMULATION_TIME_IN_SECONDS ... | #!/usr/bin/env python
TRAJECTORY = 'linear'
CONTROLLER = 'euler'
# control constants
K_X = 0.90
K_Y = 0.90
K_THETA = 0.90
# PID control constants
K_P_V = 0.2
K_I_V = 1.905
K_D_V = 0.00
K_P_W = 0.45
K_I_W = 1.25
K_D_W = 0.000
if TRAJECTORY == 'linear':
SIMULATION_TIME_IN_SECONDS = 60.0
MAX_V = 0.075
MAX... |
Fix assignment to nil map | package main
import (
"github.com/gbl08ma/disturbancesmlx/dataobjects"
"github.com/gbl08ma/disturbancesmlx/scraper"
)
var annStore AnnouncementStore
// AnnouncementStore implements dataobjects.AnnouncementStore
type AnnouncementStore struct {
scrapers map[string]scraper.AnnouncementScraper
}
// AddScraper regist... | package main
import (
"github.com/gbl08ma/disturbancesmlx/dataobjects"
"github.com/gbl08ma/disturbancesmlx/scraper"
)
var annStore AnnouncementStore
// AnnouncementStore implements dataobjects.AnnouncementStore
type AnnouncementStore struct {
scrapers map[string]scraper.AnnouncementScraper
}
// AddScraper regist... |
Remove .gitignore on bootstrap the project | const fs = require('fs-extra');
const path = require('path');
const chalk = require('chalk');
function copyTemplate(appDir, templatePath) {
fs.copySync(templatePath, appDir);
fs.removeSync('.gitignore');
fs.moveSync(
path.join(appDir, 'gitignore'),
path.join(appDir, '.gitignore'),
);
}
function addPac... | const fs = require('fs-extra');
const path = require('path');
const chalk = require('chalk');
function copyTemplate(appDir, templatePath) {
fs.copySync(templatePath, appDir);
fs.moveSync(
path.join(appDir, 'gitignore'),
path.join(appDir, '.gitignore'),
);
}
function addPackageScripts(appDir) {
const s... |
Update desc for latest too | {
"stable": {
"CSIDE_version": "1.1.3",
"nw_version": "0.21.4",
"desc": "v1.1.3 - Provides a criticial bug fix related to persistent sessions",
"target": "https://choicescriptide.github.io/downloads/updates/targets/113.zip"
},
"latest": {
"CSIDE_version": "1.2.1",
"nw_version": "0.21.4",
"desc"... | {
"stable": {
"CSIDE_version": "1.1.3",
"nw_version": "0.21.4",
"desc": "v1.1.3 - Provides a criticial bug fix related to persistent sessions",
"target": "https://choicescriptide.github.io/downloads/updates/targets/113.zip"
},
"latest": {
"CSIDE_version": "1.2.1",
"nw_version": "0.21.4",
"desc"... |
Remove actual model downloading from tests | # coding: utf-8
from __future__ import unicode_literals
from ..cli.download import download, get_compatibility, get_version, check_error_depr
import pytest
def test_download_fetch_compatibility():
compatibility = get_compatibility()
assert type(compatibility) == dict
@pytest.mark.parametrize('model', ['en_... | # coding: utf-8
from __future__ import unicode_literals
from ..cli.download import download, get_compatibility, get_version, check_error_depr
import pytest
def test_download_fetch_compatibility():
compatibility = get_compatibility()
assert type(compatibility) == dict
@pytest.mark.slow
@pytest.mark.parametr... |
Put IIFE brackets inside, improve comment | (function (Andamio) {
var methodSplitter = /\s+/;
function _bind(target, obj, name, callback, methodName) {
if (!callback) {
throw new Error('Method "' + methodName + '" was configured as an event handler, but does not exist.');
}
target.listenTo(obj, name, callback);
}
function _unbind(ta... | (function (Andamio) {
var methodSplitter = /\s+/;
function _bind(target, obj, name, callback, methodName) {
if (!callback) {
throw new Error('Method "' + methodName + '" was configured as an event handler, but does not exist.');
}
target.listenTo(obj, name, callback);
}
function _unbind(ta... |
Use image onload and onerror | /* eslint-env node */
const Canvas = require('canvas');
const fs = require('fs');
const { Image } = Canvas;
/**
* Create a new canvas object with height and width
* set to the given values.
*
* @param width {number} The width of the canvas.
* @param height {number} The height of the canvas.
*
* @return {Canva... | /* eslint-env node */
const Canvas = require('canvas');
const fs = require('fs');
const { Image } = Canvas;
/**
* Create a new canvas object with height and width
* set to the given values.
*
* @param width {number} The width of the canvas.
* @param height {number} The height of the canvas.
*
* @return {Canva... |
Remove superfluous import of shinken.objects in shinken/_init__.py.
Every script or test-case importing shinken has all the objects loaded,
even if they are not required by the script or test-case at all.
Also see <http://sourceforge.net/mailarchive/message.php?msg_id=29553474>. | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2012:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can r... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2012:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can r... |
Remove delete portion endpoint from api | 'use strict';
const passport = require('passport');
const main = require('../app/controllers/main');
const api = require('../app/controllers/api');
const auth = require('../app/controllers/auth');
/**
* Expose routes
*/
module.exports = function applyRoutes(app) {
app.get('/', main.index);
app.post('/auth/tok... | 'use strict';
const passport = require('passport');
const main = require('../app/controllers/main');
const api = require('../app/controllers/api');
const auth = require('../app/controllers/auth');
/**
* Expose routes
*/
module.exports = function applyRoutes(app) {
app.get('/', main.index);
app.post('/auth/tok... |
Handle matches with no name | from common.log import logUtils as log
from constants import clientPackets, serverPackets
from constants import exceptions
from objects import glob
def handle(userToken, packetData):
try:
# get usertoken data
userID = userToken.userID
# Read packet data
packetData = clientPackets.createMatch(packetData)
... | from common.log import logUtils as log
from constants import clientPackets
from constants import exceptions
from objects import glob
def handle(userToken, packetData):
try:
# get usertoken data
userID = userToken.userID
# Read packet data
packetData = clientPackets.createMatch(packetData)
# Create a matc... |
Set download_url to pypi directory. | #!/usr/bin/env python
from ez_setup import use_setuptools
use_setuptools()
import os
from setuptools import setup, find_packages
here = os.path.dirname(__file__)
version_file = os.path.join(here, 'src/iptools/__init__.py')
d = {}
execfile(version_file, d)
version = d['__version__']
setup(
name = 'iptools',
... | #!/usr/bin/env python
from ez_setup import use_setuptools
use_setuptools()
import os
from setuptools import setup, find_packages
here = os.path.dirname(__file__)
version_file = os.path.join(here, 'src/iptools/__init__.py')
d = {}
execfile(version_file, d)
version = d['__version__']
setup(
name = 'iptools',
... |
Update module name in example code | 'use strict';
var OnlineSGDRegression = require( './../lib' );
var x1;
var x2;
var y;
var i;
// Create model:
var model = new OnlineSGDRegression({
'lambda': 1e-4,
'loss': 'leastSquares',
'intercept': true
});
// Data comes in...
for ( i = 0; i < 100000; i++ ) {
x1 = Math.random();
x2 = Math.random();
y = 3.0 ... | 'use strict';
var OnlineSVM = require( './../lib' );
var x1;
var x2;
var y;
var i;
// Create model:
var model = new OnlineSVM({
'lambda': 1e-4,
'loss': 'leastSquares',
'intercept': true
});
// Data comes in...
for ( i = 0; i < 100000; i++ ) {
x1 = Math.random();
x2 = Math.random();
y = 3.0 * x1 + -3.0 * x2 + 2... |
Add bikeracks and Imgur API params to config | var Config = (function() {
var rootURL = 'http://john.bitsurge.net/bikeracks';
var imageURL = '/static/images';
return {
// API
nearbyRacksURL: '/static/data/austin_racks_v1.json',
updateRackURL: rootURL + '/cgi-bin/bikeracks.py',
getRackURL: rootURL + '/get/',
// ... |
var Config = {
// API
nearbyRacksURL: 'static/data/austin_racks_v1.json',
rackIconOptions: {
iconUrl: 'static/images/parking_bicycle_0.png',
shadowUrl: 'static/images/parking_bicycle_shadow_0.png',
clusterIconUrl: 'static/images/parking_bicycle_cluster_0.png',
clusterShado... |
Fix of the terminal parser functions passed without context | import {
TerminalRuntimeError,
TerminalParsingError,
} from './TerminalErrors';
function errorHandler(rsp) {
throw new TerminalRuntimeError(rsp);
}
function createSession(rsp) {
if (
!rsp[`common_${this.uapi_version}:HostToken`] ||
!rsp[`common_${this.uapi_version}:HostToken`]._
) {
throw new Te... | import {
TerminalRuntimeError,
TerminalParsingError,
} from './TerminalErrors';
const errorHandler = (rsp) => {
throw new TerminalRuntimeError(rsp);
};
const createSession = (rsp) => {
if (
!rsp[`common_${this.uapi_version}:HostToken`] ||
!rsp[`common_${this.uapi_version}:HostToken`]._
) {
throw... |
Use setImmediate instead of process.nextTick (since 0.10) | /**
* Convenient Redis Storage mock for testing purposes
*/
var util = require ('util');
function StorageMocked(data){
data = data || {};
this.currentOutage = data.currentOutage;
}
exports = module.exports = StorageMocked;
StorageMocked.prototype.startOutage = function (service, outageData, callback) {
this... | /**
* Convenient Redis Storage mock for testing purposes
*/
var util = require ('util');
function StorageMocked(data){
data = data || {};
this.currentOutage = data.currentOutage;
}
exports = module.exports = StorageMocked;
StorageMocked.prototype.startOutage = function (service, outageData, callback) {
this... |
Set instance load in instance creation | package jp.ac.nii.prl.mape.autoscaling.model;
import jp.ac.nii.prl.mape.autoscaling.model.dto.InstanceDTO;
public class InstanceFactory {
public static Instance createInstance(InstanceDTO dto, Deployment deployment) {
Instance instance = new Instance();
instance.setInstID(dto.getInstID());
instance.set... | package jp.ac.nii.prl.mape.autoscaling.model;
import jp.ac.nii.prl.mape.autoscaling.model.dto.InstanceDTO;
public class InstanceFactory {
public static Instance createInstance(InstanceDTO dto, Deployment deployment) {
Instance instance = new Instance();
instance.setInstID(dto.getInstID());
instance.set... |
Use debug mode in tests | # -*- coding: utf-8 -*-
import flask
import pytest
import webtest
import marshmallow as ma
class Bunch(object):
def __init__(self, **kwargs):
self.__dict__.update(**kwargs)
def items(self):
return self.__dict__.items()
@pytest.fixture
def app():
app_ = flask.Flask(__name__)
app_.d... | # -*- coding: utf-8 -*-
import flask
import pytest
import webtest
import marshmallow as ma
class Bunch(object):
def __init__(self, **kwargs):
self.__dict__.update(**kwargs)
def items(self):
return self.__dict__.items()
@pytest.fixture
def app():
return flask.Flask(__name__)
@pytest.f... |
Add table sheet selection capabilit | import xlutils, xypath
import databaker
import os
import databaker.constants
from databaker.constants import * # also brings in template
import databaker.databakersolo as ds # causes the xypath.loader to be overwritten
from databaker.jupybakeutils import HDim, HDimConst, savepreviewhtml, writetechnicalCSV, Conve... | import xlutils, xypath
import databaker
import os
import databaker.constants
from databaker.constants import * # also brings in template
import databaker.databakersolo as ds # causes the xypath.loader to be overwritten
from databaker.jupybakeutils import HDim, HDimConst, savepreviewhtml, writetechnicalCSV, Conve... |
Build before you check in.... | package auth
import (
"github.com/gin-gonic/gin"
"github.com/pufferpanel/apufferi/v4/response"
"github.com/pufferpanel/pufferpanel/v2/models"
"github.com/pufferpanel/pufferpanel/v2/services"
"github.com/pufferpanel/pufferpanel/v2/web/handlers"
"net/http"
)
func Reauth(c *gin.Context) {
db := handlers.GetDataba... | package auth
import (
"github.com/gin-gonic/gin"
"github.com/pufferpanel/apufferi/v4/response"
"github.com/pufferpanel/pufferpanel/v2/models"
"github.com/pufferpanel/pufferpanel/v2/services"
"github.com/pufferpanel/pufferpanel/v2/web/handlers"
"net/http"
)
func Reauth(c *gin.Context) {
db := handlers.GetDataba... |
Add random punctuation, and should be done | (function () {
'use strict';
var app = require('express')();
var cors = require('cors');
var bodyParser = require('body-parser');
var http = require('http')
.Server(app);
app.use(cors());
app.use(bodyParser.urlencoded({
extended: false
}));
app.use(function (req, res, next) {
res.heade... | (function () {
'use strict';
var app = require('express')();
var cors = require('cors');
var bodyParser = require('body-parser');
var http = require('http')
.Server(app);
var API_TOKEN = 'HNRO7R4NKRZrgbVf4JvhoeLY';
app.use(cors());
app.use(bodyParser.urlencoded({
extended: false
}));
ap... |
Add Javadoc to working time properties | package org.synyx.urlaubsverwaltung.workingtime.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;
import javax.validation.constraints.Max;
import javax.validation.constraints.... | package org.synyx.urlaubsverwaltung.workingtime.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;
import javax.validation.constraints.Max;
import javax.validation.constraints.... |
Use prefixName abstraction in nano.use | var NanoProxyDbFunctions = function(nano, prefix) {
this.nano = nano;
this.prefix = prefix;
};
NanoProxyDbFunctions.prototype.create = function(name, callback) {
return this.nano.db.create(prefixName.call(this, name), callback);
};
function prefixName(name) {
return [this.prefix, name].join("_");
}... | var NanoProxyDbFunctions = function(nano, prefix) {
this.nano = nano;
this.prefix = prefix;
};
NanoProxyDbFunctions.prototype.create = function(name, callback) {
return this.nano.db.create(prefixName.call(this, name), callback);
};
function prefixName(name) {
return [this.prefix, name].join("_");
}... |
Fix bad test runner setup | const Application = require('spectron').Application
const assert = require('assert')
const path = require('path')
describe('application launch', function() {
this.timeout(10000)
beforeEach(function() {
this.app = new Application({
path: path.join(__dirname, '..', 'node_modules', '.bin', 'electron'),
... | const Application = require('spectron').Application
const assert = require('assert')
const path = require('path')
describe('application launch', function() {
this.timeout(10000)
beforeEach(function() {
this.app = new Application({
path: path.join(__dirname, '..', 'node_modules', '.bin', 'electron'),
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.