text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Fix on/off if there is no 'off' field. | # -*- coding: utf-8 -*-
#from twisted.words.xish import domish
from base import *
import random
import bnw_core.bnw_objects as objs
@require_auth
@defer.inlineCallbacks
def cmd_on(request):
""" Включение доставки сообщений """
_ = yield objs.User.mupdate({'name':request.user['name']},{'$set':{'off':False}},s... | # -*- coding: utf-8 -*-
#from twisted.words.xish import domish
from base import *
import random
import bnw_core.bnw_objects as objs
@require_auth
@defer.inlineCallbacks
def cmd_on(request):
""" Включение доставки сообщений """
_ = yield objs.User.mupdate({'name':request.user['name']},{'$set':{'off':False}},s... |
Change the way to report bugs | //
// script.js
//
'use strict';
chrome.runtime.onInstalled.addListener(() => {
chrome.contextMenus.create({
contexts: ['page', 'frame', 'selection', 'link', 'editable', 'image', 'video', 'audio'],
id: 'background_img',
title: chrome.i18n.getMessage('title')
});
});
chrome.contextMen... | //
// script.js
//
'use strict';
chrome.runtime.onInstalled.addListener(() => {
chrome.contextMenus.create({
contexts: ['page', 'frame', 'selection', 'link', 'editable', 'image', 'video', 'audio'],
id: 'background_img',
title: chrome.i18n.getMessage('title')
});
});
chrome.contextMen... |
Fix title rendering in redux example | /* @flow */
import React from 'react';
import { Route, IndexRoute } from 'react-router';
import { App, NotFound } from './components/App.js';
import Home, { Who, How } from './components/Pages.js';
import { LogIn, SignUp } from './components/SignUp.js';
/**
* The route configuration for the whole app.
*/
export co... | /* @flow */
import React from 'react';
import { Route, IndexRoute } from 'react-router';
import { App, NotFound } from './components/App.js';
import Home, { Who, How } from './components/Pages.js';
import { LogIn, SignUp } from './components/SignUp.js';
/**
* The route configuration for the whole app.
*/
export co... |
Make typeahead sort-- promoting identical matches, or just naturally. | $( document ).ready(function() {
var typer = $('.typeahead');
var genders = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.whitespace,
queryTokenizer: Bloodhound.tokenizers.whitespace,
prefetch: 'https://raw.githubusercontent.com/anne-decusatis/genderamender/master/genders.json',
sorter: f... | $( document ).ready(function() {
var typer = $('.typeahead');
var genders = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.whitespace,
queryTokenizer: Bloodhound.tokenizers.whitespace,
prefetch: 'https://raw.githubusercontent.com/anne-decusatis/genderamender/master/genders.json'
});
typer.typ... |
Add service worker registration back | import * as HAWS from 'home-assistant-js-websocket';
window.HAWS = HAWS;
window.HASS_DEMO = __DEMO__;
const init = window.createHassConnection = function (password) {
const proto = window.location.protocol === 'https:' ? 'wss' : 'ws';
const url = `${proto}://${window.location.host}/api/websocket`;
const options... | import * as HAWS from 'home-assistant-js-websocket';
window.HAWS = HAWS;
window.HASS_DEMO = __DEMO__;
const init = window.createHassConnection = function (password) {
const proto = window.location.protocol === 'https:' ? 'wss' : 'ws';
const url = `${proto}://${window.location.host}/api/websocket`;
const options... |
Optimize conditioning and improve truncation.
"tuj" and "ĝis" should not be replaced. | // Get selection and limit to only the first word, because vortaro.net
// doesn't support sentences.
function firstWord(text) {
return text.split(/\s+/, 1)[0].toLowerCase();
}
// Remove -n and -j and present verbs as infinitives
// (replacing -as/is/os with -i).
function normalize(text) {
if (text.endsWith("as... | // Get selection and limit to only the first word, because vortaro.net
// doesn't support sentences.
function firstWord(text) {
return text.split(/\s+/, 1)[0].toLowerCase();
}
// Remove -n and -j and present verbs as infinitives
// (replacing -as/is/os with -i).
function normalize(text) {
if (text.endsWith("n"... |
Add factory for Earning model | <?php
use Faker\Generator;
use App\User;
use App\Earning;
use App\Spending;
$factory->define(User::class, function (Generator $faker) {
return [
'name' => $faker->name,
'email' => $faker->unique()->safeEmail,
'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // ... | <?php
use Faker\Generator;
use App\User;
use App\Spending;
$factory->define(User::class, function (Generator $faker) {
return [
'name' => $faker->name,
'email' => $faker->unique()->safeEmail,
'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret
'r... |
Add default path to config | import argparse
from collections import OrderedDict
import json
import logger
import logging
from session import Session
from simulator import Simulator
from cache import Cache
from client_factory import ClientFactory
from keeper import Keeper
parser = argparse.ArgumentParser()
parser.add_argument('--pipe', dest='pi... | import argparse
from collections import OrderedDict
import json
import logger
import logging
from session import Session
from simulator import Simulator
from cache import Cache
from client_factory import ClientFactory
from keeper import Keeper
parser = argparse.ArgumentParser()
parser.add_argument('--pipe', dest='pi... |
Add save xml name argument to TRIPS API | import sys
import trips_client
from processor import TripsProcessor
def process_text(text, save_xml_name='trips_output.xml'):
html = trips_client.send_query(text)
xml = trips_client.get_xml(html)
if save_xml_name:
trips_client.save_xml(xml, save_xml_name)
return process_xml(xml)
def process_... | import sys
import trips_client
from processor import TripsProcessor
def process_text(text):
html = trips_client.send_query(text)
xml = trips_client.get_xml(html)
trips_client.save_xml(xml, 'test.xml')
return process_xml(xml)
def process_xml(xml_string):
tp = TripsProcessor(xml_string)
tp.get... |
Fix Spawner
Well, not really. | package com.hiagg.item;
import com.hiagg.creativetabs.ModTabs;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;... | package com.hiagg.item;
import com.hiagg.creativetabs.ModTabs;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraft.world.WorldSettings;
import net.m... |
Remove foreign keys from paytrail_result table creation migration
The foreign keys are added through another migration that is run after this one | <?php
class m131125_152138_create_paytrail_result_table extends CDbMigration
{
public function up()
{
$this->execute(
"CREATE TABLE `paytrail_result` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`paymentId` INT UNSIGNED NOT NULL,
`orderNumber`... | <?php
class m131125_152138_create_paytrail_result_table extends CDbMigration
{
public function up()
{
$this->execute(
"CREATE TABLE `paytrail_result` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT,
`paymentId` INT UNSIGNED NOT NULL,
`orderNumber`... |
Use a better exec from shelljs | #!/usr/bin/env node
"use strict";
var chokidar = require('chokidar')
var child = require('child_process')
var command = process.argv[2]
var target = process.argv[3]
if (!command || !target) {
usage()
process.exit(1)
}
var watcher = chokidar.watch(target, {persistent: true})
var run = runner(command)
watcher
... | #!/usr/bin/env node
"use strict";
var chokidar = require('chokidar')
var exec = require('child_process').exec
var command = process.argv[2]
var target = process.argv[3]
if (!command || !target) {
usage()
process.exit(1)
}
var watcher = chokidar.watch(target, {persistent: true})
var run = runner(command)
watche... |
Format de date chelou pour l'ANSM | package rss
import (
"strings"
"time"
)
func parseTime(s string) (time.Time, error) {
formats := []string{
"Mon, _2 Jan 2006 15:04:05 MST",
"Mon, _2 Jan 2006 15:04:05 -0700",
time.ANSIC,
time.UnixDate,
time.RubyDate,
time.RFC822,
time.RFC822Z,
time.RFC850,
time.RFC1123,
time.RFC1123Z,
time.RF... | package rss
import (
"strings"
"time"
)
func parseTime(s string) (time.Time, error) {
formats := []string{
"Mon, _2 Jan 2006 15:04:05 MST",
"Mon, _2 Jan 2006 15:04:05 -0700",
time.ANSIC,
time.UnixDate,
time.RubyDate,
time.RFC822,
time.RFC822Z,
time.RFC850,
time.RFC1123,
time.RFC1123Z,
time.RF... |
Use interfaces instead of concrete implementations | <?php
namespace EasyCorp\Bundle\EasyAdminBundle\Orm;
use EasyCorp\Bundle\EasyAdminBundle\Contracts\Orm\EntityUpdaterInterface;
use EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto;
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
/**
* @author Javier Eguiluz <javier.eguiluz@gmail.com>
*/
final class En... | <?php
namespace EasyCorp\Bundle\EasyAdminBundle\Orm;
use EasyCorp\Bundle\EasyAdminBundle\Contracts\Orm\EntityUpdaterInterface;
use EasyCorp\Bundle\EasyAdminBundle\Dto\EntityDto;
use Symfony\Component\PropertyAccess\PropertyAccessor;
/**
* @author Javier Eguiluz <javier.eguiluz@gmail.com>
*/
final class EntityUpdat... |
Modify : ajout de get Timestamp | package entity;
import java.sql.Timestamp;
import java.util.Calendar;
import java.io.Serializable;
/**
* Created by corentin on 10/03/15.
*/
public abstract class AbstractEntity implements Serializable {
/**
* Unique id of entity
*/
protected long id;
/**
* Type of entity
*/
pr... | package entity;
import java.sql.Timestamp;
import java.util.Calendar;
import java.io.Serializable;
/**
* Created by corentin on 10/03/15.
*/
public abstract class AbstractEntity implements Serializable {
/**
* Unique id of entity
*/
protected long id;
/**
* Type of entity
*/
pr... |
Move key to correct element | import React from 'react'
import BlankSlate from './BlankSlate'
import EventCard from '../EventCard'
import StyledEvents, {
StyledLink,
StyledList,
StyledListItem,
} from './Events.css'
export default ({ events = [] }) => {
if (!events.length) {
return <BlankSlate>No events yet. Check back soon.</BlankSla... | import React from 'react'
import BlankSlate from './BlankSlate'
import EventCard from '../EventCard'
import StyledEvents, {
StyledLink,
StyledList,
StyledListItem,
} from './Events.css'
export default ({ events = [] }) => {
if (!events.length) {
return <BlankSlate>No events yet. Check back soon.</BlankSla... |
[5.1] Handle InnoDB Deadlocks By Re-Attempting Transactions
https://github.com/laravel/framework/issues/12813 | <?php
namespace Illuminate\Database;
use Exception;
use Illuminate\Support\Str;
trait DetectsLostConnections
{
/**
* Determine if the given exception was caused by a lost connection.
*
* @param \Exception $e
* @return bool
*/
protected function causedByLostConnection(Exception $e)
... | <?php
namespace Illuminate\Database;
use Exception;
use Illuminate\Support\Str;
trait DetectsLostConnections
{
/**
* Determine if the given exception was caused by a lost connection.
*
* @param \Exception $e
* @return bool
*/
protected function causedByLostConnection(Exception $e)
... |
Fix TypeError: _set_bank_data() takes at least 7 arguments (7 given) | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2014 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pu... | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2014 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pu... |
Fix corner case for javadoc redirector | /*
* Copyright 2014 ZXing 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 applicable law or agreed ... | /*
* Copyright 2014 ZXing 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 applicable law or agreed ... |
Add setInterval to keep clock up to date | angular.module('mini-data.controllers', [])
.controller('mainCtrl', function($scope){
var getTimeInfo = function(){
var now = new Date();
var hours = now.getHours();
var period = 'AM';
var minutes = now.getMinutes();
if(hours > 12){
hours -= 12;
period = 'PM';
... | angular.module('mini-data.controllers', [])
.controller('mainCtrl', function($scope){
var getTimeInfo = function(){
var now = new Date();
var hours = now.getHours();
var period = 'AM';
var minutes = now.getMinutes();
if(hours > 12){
hours -= 12;
period = 'PM';
... |
Fix componet build on iterator | <!-- Notifications Menu -->
<li class="dropdown notifications-menu">
<!-- Menu toggle button -->
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-calendar-check-o"></i>
<span class="label {{ $appointments->count() > 0 ? 'label-warning' : 'label-default' }}">{{ $appointments->count... | <!-- Notifications Menu -->
<li class="dropdown notifications-menu">
<!-- Menu toggle button -->
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
<i class="fa fa-calendar-check-o"></i>
<span class="label {{ $appointments->count() > 0 ? 'label-warning' : 'label-default' }}">{{ $appointments->count... |
Add back call to setStyle on options | // Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
const vectorlayer = require('./VectorLayer.js');
export class LeafletPathModel extends vectorlayer.LeafletVectorLayerModel {
defaults() {
return {
...super.defaults(),
_view_name: 'LeafletPathView'... | // Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.
const vectorlayer = require('./VectorLayer.js');
export class LeafletPathModel extends vectorlayer.LeafletVectorLayerModel {
defaults() {
return {
...super.defaults(),
_view_name: 'LeafletPathView'... |
Fix some more U tests ... | package redis.clients.jedis.tests;
import java.io.IOException;
import java.net.UnknownHostException;
import java.util.List;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPipeline;
import redis.clients.jedis.Protocol;
import... | package redis.clients.jedis.tests;
import java.io.IOException;
import java.net.UnknownHostException;
import java.util.List;
import junit.framework.Assert;
import org.junit.Before;
import org.junit.Test;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPipeline;
import redis.clients.jedis.tests.Host... |
Return right path on gulp watch | var pathModule = require('path');
module.exports = function(data) {
data = data || {};
var functions = [
{
name: 'revisionedPath',
func: function (fullPath) {
var path = pathModule.basename(fullPath);
if (data.manifest) {
if(!data.manifest[path]) {
throw new Er... | var pathModule = require('path');
module.exports = function(data) {
data = data || {};
var functions = [
{
name: 'revisionedPath',
func: function (fullPath) {
var path = pathModule.basename(fullPath);
if (data.manifest) {
if(!data.manifest[path]) {
throw new Er... |
Fix the auto-generated docstrings of style sheets | # This file is part of rinohtype, the Python document preparation system.
#
# Copyright (c) Brecht Machiels.
#
# Use of this source code is subject to the terms of the GNU Affero General
# Public License v3. See the LICENSE file or http://www.gnu.org/licenses/.
import inspect
import os
import sys
from .. import DATA... | # This file is part of rinohtype, the Python document preparation system.
#
# Copyright (c) Brecht Machiels.
#
# Use of this source code is subject to the terms of the GNU Affero General
# Public License v3. See the LICENSE file or http://www.gnu.org/licenses/.
import inspect
import os
import sys
from .. import DATA... |
Make OS pie chart aware of dates | <?php
require_once('./conf.php');
$sql =
"SELECT type, sum(cnt) as sumcnt FROM (
select
useragent,
(SELECT count(*) FROM log
WHERE useragent_id=useragent.id AND
`responsecode` <> " . E_DOSPROTECT . " AND
`date` BETWEEN timestamp('$startTime') AND timestamp('$endTime')) as cnt,
(CASE
WHEN us... | <?php
require_once('./conf.php');
$sql =
"SELECT type, sum(cnt) as sumcnt FROM (
select
useragent,
(SELECT count(*) FROM log WHERE useragent_id=useragent.id) as cnt,
(CASE
WHEN useragent LIKE '%Linux%' THEN 'Linux'
WHEN useragent LIKE '%Macintosh%' THEN 'Macintosh'
WHEN use... |
Remove scrollIntoView() to fix scroll jank preventing users from scrolling | const observer = new IntersectionObserver(entries => {
const intersectingEntries = entries.filter(e => e.isIntersecting);
for (const entry of intersectingEntries) {
const previouslyActive = document.querySelector('.pageNav a.is-active');
if (previouslyActive) {
previouslyActive.class... | const observer = new IntersectionObserver(entries => {
const intersectingEntries = entries.filter(e => e.isIntersecting);
for (const entry of intersectingEntries) {
const previouslyActive = document.querySelector('.pageNav a.is-active');
if (previouslyActive) {
previouslyActive.class... |
Add integration test for starting the API | from piper.cli import cmd_piperd
from piper.api import api
import mock
class TestEntry(object):
@mock.patch('piper.cli.cmd_piperd.CLIBase')
def test_calls(self, clibase):
self.mock = mock.Mock()
cmd_piperd.entry(self.mock)
clibase.assert_called_once_with(
'piperd',
... | from piper.cli import cmd_piperd
from piper.api import api
import mock
class TestEntry(object):
@mock.patch('piper.cli.cmd_piperd.CLIBase')
def test_calls(self, clibase):
self.mock = mock.Mock()
cmd_piperd.entry(self.mock)
clibase.assert_called_once_with(
'piperd',
... |
Remove the extra require for https | var request = require('request');
var yaml = require('js-yaml');
// The URL of the data file with GitHub's language colors.
exports.languagesURL = 'https://raw.githubusercontent.com/github/linguist/master/lib/linguist/languages.yml';
// Given an Object of languages (from language name Strings to Objects),
// filterCo... | var https = require('https');
var yaml = require('js-yaml');
var request = require('request');
// The URL of the data file with GitHub's language colors.
exports.languagesURL = 'https://raw.githubusercontent.com/github/linguist/master/lib/linguist/languages.yml';
// Given an Object of languages (from language name St... |
Add a docstring to image_bytes | from __future__ import print_function, division, absolute_import
import sys
import os
import base64
# See https://iterm2.com/images.html
IMAGE_CODE = '\033]1337;File={file};inline={inline};size={size}:{base64_img}\a'
def image_bytes(b, filename=None, inline=1):
"""
Display the image given by the bytes b in t... | from __future__ import print_function, division, absolute_import
import sys
import os
import base64
# See https://iterm2.com/images.html
IMAGE_CODE = '\033]1337;File={file};inline={inline};size={size}:{base64_img}\a'
def image_bytes(b, filename=None, inline=1):
data = {
'file': base64.b64encode((filename... |
Add fixme for future revision | """
URLCONF for the user accounts app (part 2/2).
"""
from django.conf.urls import url, include
from django.contrib.auth import views as auth_views
from . import views
# User accounts URL patterns configuration
urlpatterns = (
# My account page
url(r'^$', views.my_account_show, name='index'),
# Passwo... | """
URLCONF for the user accounts app (part 2/2).
"""
from django.conf.urls import url, include
from django.contrib.auth import views as auth_views
from . import views
# User accounts URL patterns configuration
urlpatterns = (
# My account page
url(r'^$', views.my_account_show, name='index'),
# Passwo... |
Handle instances where level_tag is undefined
Better mimics the implementation of message.tags in Django 1.7 | from django import template
from django.contrib.messages.utils import get_level_tags
from django.utils.encoding import force_text
LEVEL_TAGS = get_level_tags()
register = template.Library()
@register.simple_tag()
def get_message_tags(message):
"""
Returns the message's level_tag prefixed with Bootstrap's "... | from django import template
from django.contrib.messages.utils import get_level_tags
from django.utils.encoding import force_text
LEVEL_TAGS = get_level_tags()
register = template.Library()
@register.simple_tag()
def get_message_tags(message):
"""
Returns the message's level_tag prefixed with Bootstrap's "... |
emoji: Fix misleading variable name `list` for non-lists.
The `Array#reduce` method basically operates on a list... but
these variables are referring to essentially the opposite thing!
The array (or "list") acts as input, but this variable / this
parameter to the inner function is the *output* we're in the
middle of b... | /* @flow */
import { createSelector } from 'reselect';
import { getRawRealmEmoji } from '../directSelectors';
import { getAuth } from '../account/accountSelectors';
import { getFullUrl } from '../utils/url';
export const getAllRealmEmojiById = createSelector(getAuth, getRawRealmEmoji, (auth, emojis) =>
Object.keys(e... | /* @flow */
import { createSelector } from 'reselect';
import { getRawRealmEmoji } from '../directSelectors';
import { getAuth } from '../account/accountSelectors';
import { getFullUrl } from '../utils/url';
export const getAllRealmEmojiById = createSelector(getAuth, getRawRealmEmoji, (auth, emojis) =>
Object.keys(e... |
Declare dependency on zeit.cms (for testing) | from setuptools import setup, find_packages
setup(
name='zeit.objectlog',
version='0.11dev',
author='Christian Zagrodnick',
author_email='cz@gocept.com',
description="""\
""",
packages=find_packages('src'),
package_dir = {'': 'src'},
include_package_data = True,
zip_safe=False,
... | from setuptools import setup, find_packages
setup(
name='zeit.objectlog',
version='0.11dev',
author='Christian Zagrodnick',
author_email='cz@gocept.com',
description="""\
""",
packages=find_packages('src'),
package_dir = {'': 'src'},
include_package_data = True,
zip_safe=False,
... |
Remove unused main entry point. | import nmap
from st2actions.runners.pythonrunner import Action
"""
Note: This action requires nmap binary to be available and needs to run as root.
"""
class PortScanner(Action):
def run(self, host):
result = []
port_details = {}
ps = nmap.PortScanner()
scan_res = ps.scan(host, arguments='--min-pa... | import nmap
from st2actions.runners.pythonrunner import Action
"""
Note: This action requires nmap binary to be available and needs to run as root.
"""
class PortScanner(Action):
def run(self, host):
result = []
port_details = {}
ps = nmap.PortScanner()
scan_res = ps.scan(host, arguments='--min-pa... |
Add placeholder htmlbars flag in dummy app for packaging to toggle | /* jshint node: true */
module.exports = function(environment) {
var ENV = {
modulePrefix: 'dummy',
environment: environment,
baseURL: '/',
locationType: 'auto',
EmberENV: {
FEATURES: {
//'ember-htmlbars': true
// Here you can enable experimental features on an ember canary ... | /* jshint node: true */
module.exports = function(environment) {
var ENV = {
modulePrefix: 'dummy',
environment: environment,
baseURL: '/',
locationType: 'auto',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. 'with-contr... |
[clean] Use the specifiers in the JCC order | package net.safedata.springboot.training.d02.s04.exceptions;
import net.safedata.springboot.training.d02.s04.dto.MessageDTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.w... | package net.safedata.springboot.training.d02.s04.exceptions;
import net.safedata.springboot.training.d02.s04.dto.MessageDTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.w... |
BB-4395: Create entity MenuUpdate that extends MenuUpdate model
- improve tests | <?php
namespace Oro\Bundle\NavigationBundle\Tests\Unit\Entity;
use Oro\Component\Testing\Unit\EntityTestCaseTrait;
use Oro\Bundle\NavigationBundle\Entity\MenuUpdate;
class MenuUpdateTest extends \PHPUnit_Framework_TestCase
{
use EntityTestCaseTrait;
public function testProperties()
{
$propertie... | <?php
namespace Oro\Bundle\NavigationBundle\Tests\Unit\Entity;
use Oro\Component\Testing\Unit\EntityTestCaseTrait;
use Oro\Bundle\NavigationBundle\Entity\MenuUpdate;
class MenuUpdateTest extends \PHPUnit_Framework_TestCase
{
use EntityTestCaseTrait;
public function testProperties()
{
$propertie... |
Send 404 errors as JSON to keep NPM happy | const express = require('express')
const fs = require('fs')
const http = require('http')
const https = require('https')
const path = require('path')
function startHttpServer(app, port) {
const httpServer = http.Server(app)
httpServer.listen(port, () => console.log(`Listening on HTTP port *:${port}`))
}
function s... | const express = require('express')
const fs = require('fs')
const http = require('http')
const https = require('https')
const path = require('path')
function startHttpServer(app, port) {
const httpServer = http.Server(app)
httpServer.listen(port, () => console.log(`Listening on HTTP port *:${port}`))
}
function s... |
Implement 'inverse' prop and remove obsolete styling | import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { TextBody, TextDisplay } from '../typography';
import theme from './theme.css';
import cx from "classnames";
export default class Label extends PureComponent {
static propTypes = {
children: PropTypes.oneOfType([PropTypes.e... | import React, { PureComponent } from 'react';
import PropTypes from 'prop-types';
import { TextBody, TextDisplay } from '../typography';
import theme from './theme.css';
export default class Label extends PureComponent {
static propTypes = {
children: PropTypes.oneOfType([PropTypes.element, PropTypes.string, Pro... |
Fix getting snapshotsoftware on old snapshots | from pydash import find
from ereuse_devicehub.resources.device.domain import DeviceDomain
from ereuse_devicehub.resources.event.device import DeviceEventDomain
from ereuse_devicehub.scripts.updates.update import Update
class SnapshotSoftware(Update):
"""
Changes the values of SnapshotSoftware and adds it to ... | from pydash import find
from ereuse_devicehub.resources.device.domain import DeviceDomain
from ereuse_devicehub.resources.event.device import DeviceEventDomain
from ereuse_devicehub.scripts.updates.update import Update
class SnapshotSoftware(Update):
"""
Changes the values of SnapshotSoftware and adds it to ... |
Bump aiohttp version constraint to <3.4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
__name__ == '__main__' and setup(name='aiohttp-json-rpc',
version='0.10.1',
author='Florian Scherf',
url='https://github.com/pengutronix/aiohttp-json-rpc/',
author_email='f.scherf@pengutronix.de',
l... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
__name__ == '__main__' and setup(name='aiohttp-json-rpc',
version='0.10.1',
author='Florian Scherf',
url='https://github.com/pengutronix/aiohttp-json-rpc/',
author_email='f.scherf@pengutronix.de',
l... |
Allow keys to contain hyphens
See the [full length example](http://www.yaml.org/spec/1.2/spec.html#id2761803) from the yaml docs. | // Contributed by ribrdb @ code.google.com
/**
* @fileoverview
* Registers a language handler for YAML.
*
* @author ribrdb
*/
PR['registerLangHandler'](
PR['createSimpleLexer'](
[
[PR['PR_PUNCTUATION'], /^[:|>?]+/, null, ':|>?'],
[PR['PR_DECLARATION'], /^%(?:YAML|TAG)[^#\r\n]+/, null, '%'],
... | // Contributed by ribrdb @ code.google.com
/**
* @fileoverview
* Registers a language handler for YAML.
*
* @author ribrdb
*/
PR['registerLangHandler'](
PR['createSimpleLexer'](
[
[PR['PR_PUNCTUATION'], /^[:|>?]+/, null, ':|>?'],
[PR['PR_DECLARATION'], /^%(?:YAML|TAG)[^#\r\n]+/, null, '%'],
... |
Fix failure on Django < 1.4.5 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
try:
# Django >= 1.4.5
from django.utils.encoding import force_bytes, force_text, smart_text # NOQA
from django.utils.six import string_types, text_type, binary_type # NOQA
except ImportError: # pragma: no cover
# Django < 1.4.5
fr... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
try:
# Django >= 1.4.5
from django.utils.encoding import force_bytes, force_text, smart_text # NOQA
from django.utils.six import string_types, text_type, binary_type # NOQA
except ImportError: # pragma: no cover
# Django < 1.4.5
fr... |
Add data to JobStep serializer | from changes.api.serializer import Serializer, register
from changes.models import JobStep
@register(JobStep)
class JobStepSerializer(Serializer):
def serialize(self, instance, attrs):
return {
'id': instance.id.hex,
'name': instance.label,
'phase': {
'i... | from changes.api.serializer import Serializer, register
from changes.models import JobStep
@register(JobStep)
class JobStepSerializer(Serializer):
def serialize(self, instance, attrs):
return {
'id': instance.id.hex,
'name': instance.label,
'phase': {
'i... |
Fix param name in docblock | <?php
namespace QueryTranslator\Values;
/**
* Token sequence holds an array of tokens extracted from the query string.
*
* @see \QueryTranslator\Tokenizing::tokenize()
*/
class TokenSequence
{
/**
* An array of tokens extracted from the input string.
*
* @var \QueryTranslator\Values\Token[]
... | <?php
namespace QueryTranslator\Values;
/**
* Token sequence holds an array of tokens extracted from the query string.
*
* @see \QueryTranslator\Tokenizing::tokenize()
*/
class TokenSequence
{
/**
* An array of tokens extracted from the input string.
*
* @var \QueryTranslator\Values\Token[]
... |
Update list of ignored files in servers bootstrap | const fs = require('fs'),
path = require('path'),
async = require('async'),
IGNORE_FILES = ['index.js', '_servers.js', 'servers.json', '.gitignore'],
SERVERS = [],
URLS = {};
fs.readdirSync(__dirname).forEach(function (file) {
if (IGNORE_FILES.includes(file)) { return; }
SERVERS.push({
... | const fs = require('fs'),
path = require('path'),
async = require('async'),
IGNORE_FILES = ['index.js', '_servers.js', 'servers.json'],
SERVERS = [],
URLS = {};
fs.readdirSync(__dirname).forEach(function (file) {
if (IGNORE_FILES.includes(file)) { return; }
SERVERS.push({
name: pa... |
Add ability to list file uploads. | <?php
class Stripe_FileUpload extends Stripe_ApiResource
{
public static function baseUrl()
{
return Stripe::$apiUploadBase;
}
public static function className($class)
{
return 'file';
}
/**
* @param string $id The ID of the file upload to retrieve.
* @param string|null $apiKey
*
* ... | <?php
class Stripe_FileUpload extends Stripe_ApiResource
{
public static function baseUrl()
{
return Stripe::$apiUploadBase;
}
public static function className($class)
{
return 'file';
}
/**
* @param string $id The ID of the file upload to retrieve.
* @param string|null $apiKey
*
* ... |
Fix : Use SCryptPasswordHaser instead of SShaPasswordHasher
Change-Id: I03faaf863d0034a45dde318b877c02e7e4acb00a | package oasis.services.authn;
import javax.inject.Inject;
import oasis.model.authn.ClientType;
import oasis.model.authn.Credentials;
import oasis.model.authn.CredentialsRepository;
import oasis.services.authn.login.PasswordHasher;
import oasis.services.authn.login.SCryptPasswordHasher;
public class CredentialsServic... | package oasis.services.authn;
import javax.inject.Inject;
import oasis.model.authn.ClientType;
import oasis.model.authn.Credentials;
import oasis.model.authn.CredentialsRepository;
import oasis.services.authn.login.PasswordHasher;
import oasis.services.authn.login.SShaPasswordHasher;
public class CredentialsService ... |
Change click event to change event | var settings = {
api_url: "http://127.0.0.1:8000/api/",
agency_id: "SPTRANS"
};
start();
function start(){
var api_url = settings.api_url;
var agency_id = settings.agency_id;
var url = "";
url = api_url + "agency?agency_id=" + agency_id;
getApi(url, Generator.drawAgencyStop);
url = api_url + "route... | var settings = {
api_url: "http://127.0.0.1:8000/api/",
agency_id: "SPTRANS"
};
start();
function start(){
var api_url = settings.api_url;
var agency_id = settings.agency_id;
var url = "";
url = api_url + "agency?agency_id=" + agency_id;
getApi(url, Generator.drawAgencyStop);
url = api_url + "route... |
[SMALLFIX] Use static imports for standard test utilities
Change
`import org.junit.Assert;`
to
`import static org.junit.Assert.assertEquals;`
AND
Update all
`Assert.{{ method }}*`
to
`{{ method }}*`
pr-link: Alluxio/alluxio#8697
change-id: cid-80367e58e882e7d64d77c0040a4faf3cf3f1d84d | /*
* The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
* (the "License"). You may not use this work except in compliance with the License, which is
* available at www.apache.org/licenses/LICENSE-2.0
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDI... | /*
* The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
* (the "License"). You may not use this work except in compliance with the License, which is
* available at www.apache.org/licenses/LICENSE-2.0
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDI... |
Rename env var to PUSHOVER_TOKEN | exports.name = 'task.pushover';
exports.version = '1.0.0';
exports.register = function(plugin, options, next) {
var app = plugin.app;
var request = app.service.request;
var url = 'https://api.pushover.net/1/messages.json';
function run(job, done) {
var params = {
method: 'POST',
url: ... | exports.name = 'task.pushover';
exports.version = '1.0.0';
exports.register = function(plugin, options, next) {
var app = plugin.app;
var request = app.service.request;
var url = 'https://api.pushover.net/1/messages.json';
function run(job, done) {
var params = {
method: 'POST',
url: ... |
Add child(); TODO: test this |
class DataModelAdapter(object) :
def __init__(self, data) :
self._data = data
self._children = set()
self._parent = None
pass
def numChildren(self) :
return len(self._children)
def hasData(self) :
return self._data is not None
def getData(self, key) :... |
class DataModelAdapter(object) :
def __init__(self, data) :
self._data = data
self._children = set()
self._parent = None
pass
def numChildren(self) :
return len(self._children)
def hasData(self) :
return self._data is not None
def getData(self, key) :... |
Use the Charset constants in the JDK's StandardCharsets class instead of c.g.c.base.Charsets. The c.g.common.base.Charsets is scheduled for deletion.
More information: []
Tested:
TAP train for global presubmit queue
[] Some tests failed; test failures are believed to be unrelated to this CL
Change on 2015... | // Copyright 2011 The MOE Authors All Rights Reserved.
package com.google.devtools.moe.client.project;
import static java.nio.charset.StandardCharsets.UTF_8;
import com.google.common.io.Files;
import com.google.devtools.moe.client.Ui;
import java.io.File;
import java.io.IOException;
import javax.inject.Inject;
/*... | // Copyright 2011 The MOE Authors All Rights Reserved.
package com.google.devtools.moe.client.project;
import com.google.common.base.Charsets;
import com.google.common.io.Files;
import com.google.devtools.moe.client.Ui;
import java.io.File;
import java.io.IOException;
import javax.inject.Inject;
/**
*
* @author ... |
Add a line that was removed by mistake | #!/usr/bin/env python3
"""
Main entry point to run all tests
"""
import sys
from pathlib import Path
from unittest import TestLoader, TestSuite, TextTestRunner
PATH = Path(__file__).absolute()
sys.path.append(PATH.parents[1].joinpath('rpc_spec/InterfaceParser').as_posix())
sys.path.append(PATH.parents[1].as_posix())
... | #!/usr/bin/env python3
"""
Main entry point to run all tests
"""
import sys
from pathlib import Path
from unittest import TestLoader, TestSuite, TextTestRunner
PATH = Path(__file__).absolute()
sys.path.append(PATH.parents[1].joinpath('rpc_spec/InterfaceParser').as_posix())
sys.path.append(PATH.parents[1].as_posix())
... |
Add flash messages to the response | <?php
/**
* jsonAPI - Slim extension to implement fast JSON API's
*
* @package Slim
* @subpackage View
* @author Jonathan Tavares <the.entomb@gmail.com>
* @license GNU General Public License, version 3
* @filesource
*
*
*/
/**
* JsonApiView - view wrapper for json responses (with error code).
*
* @package... | <?php
/**
* jsonAPI - Slim extension to implement fast JSON API's
*
* @package Slim
* @subpackage View
* @author Jonathan Tavares <the.entomb@gmail.com>
* @license GNU General Public License, version 3
* @filesource
*
*
*/
/**
* JsonApiView - view wrapper for json responses (with error code).
*
* @package... |
Fix for child process running | import { resolve } from 'path'
import { node } from 'execa'
const childProcessHelperPath = resolve(__dirname, 'childProcessHelper.js')
export default class ChildProcessRunner {
#env = null
#functionKey = null
#handlerName = null
#handlerPath = null
#timeout = null
constructor(funOptions, env) {
const... | import { resolve } from 'path'
import { node } from 'execa'
const childProcessHelperPath = resolve(__dirname, 'childProcessHelper.js')
export default class ChildProcessRunner {
#env = null
#functionKey = null
#handlerName = null
#handlerPath = null
#timeout = null
constructor(funOptions, env) {
const... |
Use 'wraps' from 'functools', to keep wrapped function's docstring, name and attributes. | # -*- coding:utf-8 -*-
'''
Decorators for using specific routing state for particular requests.
Used in cases when automatic switching based on request method doesn't
work.
Usage:
from django_replicated.decorators import use_master, use_slave
@use_master
def my_view(request, ...):
# master databa... | # -*- coding:utf-8 -*-
'''
Decorators for using specific routing state for particular requests.
Used in cases when automatic switching based on request method doesn't
work.
Usage:
from django_replicated.decorators import use_master, use_slave
@use_master
def my_view(request, ...):
# master databa... |
Add new configuration setting for log_directory | # General Settings
timerestriction = False
debug_mode = True
log_directory = './logs'
# Email Settings
# emailtype = "Gmail"
emailtype = "Console"
# SMS Settings
# outboundsmstype = "WebService"
outboundsmstype = "Console"
# Twilio Auth Keys
account_sid = "twilio sid here"
auth_token = "auth token here"
# SMS Servi... | # General Settings
timerestriction = False
debug_mode = True
# Email Settings
# emailtype = "Gmail"
emailtype = "Console"
# SMS Settings
# outboundsmstype = "WebService"
outboundsmstype = "Console"
# Twilio Auth Keys
account_sid = "twilio sid here"
auth_token = "auth token here"
# SMS Services Auth
basic_auth = 'ba... |
MNT: Add explicit test for deprecation decorator | # Copyright (c) 2019 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Test MetPy's testing utilities."""
import warnings
import numpy as np
import pytest
from metpy.deprecation import MetpyDeprecationWarning
from metpy.testing import assert_arr... | # Copyright (c) 2019 MetPy Developers.
# Distributed under the terms of the BSD 3-Clause License.
# SPDX-License-Identifier: BSD-3-Clause
"""Test MetPy's testing utilities."""
import numpy as np
import pytest
from metpy.testing import assert_array_almost_equal
# Test #1183: numpy.testing.assert_array* ignores an... |
Use low root margin to prevent premature loading of images | import mediumZoom from 'src/config/medium-zoom';
import lqip from 'src/modules/lqip';
import galleryLoader from 'src/modules/gallery-lazy-load';
window.addEventListener('DOMContentLoaded', () => {
galleryLoader({
afterInsert(lastPost) {
lqip({
selectorRoot: lastPost,
rootMargin: '0px',
... | import mediumZoom from 'src/config/medium-zoom';
import lqip from 'src/modules/lqip';
import galleryLoader from 'src/modules/gallery-lazy-load';
window.addEventListener('DOMContentLoaded', () => {
galleryLoader({
afterInsert(lastPost) {
lqip({
selectorRoot: lastPost,
afterReplace: (lqipImag... |
Include skip-link-focus-fix.js in bundled js. | // 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... |
Add API for handler that know the SDocumentGraph of the editor | /**
*
*/
package org.corpus_tools.atomic.api.commands;
import org.corpus_tools.atomic.api.editors.DocumentGraphEditor;
import org.corpus_tools.salt.common.SDocumentGraph;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI;
/**
* TODO Description
... | /**
*
*/
package org.corpus_tools.atomic.api.commands;
import org.corpus_tools.atomic.api.editors.DocumentGraphEditor;
import org.corpus_tools.salt.common.SDocumentGraph;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionExce... |
Allow irregular whitespaces in string or comment | module.exports = {
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
},
},
"rules": {
"arrow-parens": "warn",
"comma-dangle": ["error", "always-multiline"],
"max-len": ["error", {
"code": 100,
"ignore... | module.exports = {
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
},
},
"rules": {
"arrow-parens": "warn",
"comma-dangle": ["error", "always-multiline"],
"max-len": ["error", {
"code": 100,
"ignore... |
Improve the speed of csv export file generation | import sys
import csv
from optparse import make_option
from django.core.management.base import BaseCommand
from modoboa.core import load_core_settings
from modoboa.core.models import User
from modoboa.core.extensions import exts_pool
from modoboa.core.management.commands import CloseConnectionMixin
from ...models imp... | import sys
import csv
from optparse import make_option
from django.core.management.base import BaseCommand
from modoboa.core import load_core_settings
from modoboa.core.models import User
from modoboa.core.extensions import exts_pool
from modoboa.core.management.commands import CloseConnectionMixin
from ...models imp... |
Modify example server request params | 'use strict';
const express = require('express');
const MsgQueueClient = require('msgqueue-client');
const mqServerConfig = require('../common/config/mqserver.js');
const config = require('./config.js');
const app = express();
const mq = new MsgQueueClient(`${mqServerConfig.url}:${mqServerConfig.port}`, { log: true ... | 'use strict';
const express = require('express');
const MsgQueueClient = require('msgqueue-client');
const mqServerConfig = require('../common/config/mqserver.js');
const config = require('./config.js');
const app = express();
const mq = new MsgQueueClient(`${mqServerConfig.url}:${mqServerConfig.port}`, { log: true ... |
Set preferBuiltins to silence a rollup warning. | const fs = require('fs');
const pathModule = require('path');
const plugins = [
/* eslint import/no-extraneous-dependencies: ["error", {"devDependencies": true}] */
require('rollup-plugin-commonjs')({
// leave the os require in the tree as that codepath is not
// taken when executed in Deno after magicpen ... | const fs = require('fs');
const pathModule = require('path');
const plugins = [
/* eslint import/no-extraneous-dependencies: ["error", {"devDependencies": true}] */
require('rollup-plugin-commonjs')({
// leave the os require in the tree as that codepath is not
// taken when executed in Deno after magicpen ... |
Fix sql error in migration | <?php
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration,
Doctrine\DBAL\Schema\Schema;
/**
* Auto-generated Migration: Please modify to your need!
*/
class Version20121107231047 extends AbstractMigration
{
public function up(Schema $schema)
{
// this up() migration... | <?php
namespace Application\Migrations;
use Doctrine\DBAL\Migrations\AbstractMigration,
Doctrine\DBAL\Schema\Schema;
/**
* Auto-generated Migration: Please modify to your need!
*/
class Version20121107231047 extends AbstractMigration
{
public function up(Schema $schema)
{
// this up() migration... |
Set Factory.noisy to False by default
git-svn-id: 81e381228600e5752b80483efd2b45b26c451ea2@3933 e27351fd-9f3e-4f54-a53b-843176b1656c | from zope.interface import implements
from twisted.plugin import IPlugin
from twisted.application.service import IServiceMaker
from twisted.python import reflect
from twisted.internet.protocol import Factory
Factory.noisy = False
def serviceMakerProperty(propname):
def getProperty(self):
return getattr(... | from zope.interface import implements
from twisted.plugin import IPlugin
from twisted.application.service import IServiceMaker
from twisted.python import reflect
def serviceMakerProperty(propname):
def getProperty(self):
return getattr(reflect.namedClass(self.serviceMakerClass), propname)
return prop... |
Remove explicit unboxing to primitive | /*
* Licensed to Crate under one or more contributor license agreements.
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership. Crate licenses this file
* to you under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compl... | /*
* Licensed to Crate under one or more contributor license agreements.
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership. Crate licenses this file
* to you under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compl... |
Put the category tabs on the left and scroll them if they are too many.
git-svn-id: 64ebf368729f38804935acb7146e017e0f909c6b@907 6335cc39-0255-0410-8fd6-9bcaacd3b74c | //
// $Id: BrowsePanel.java,v 1.3 2002/11/11 17:04:12 mdb Exp $
package robodj.chooser;
import javax.swing.*;
import robodj.repository.*;
public class BrowsePanel extends JTabbedPane
{
public BrowsePanel ()
{
EntryList elist;
Category[] cats = Chooser.model.getCategories();
// stick... | //
// $Id: BrowsePanel.java,v 1.2 2002/02/22 07:06:33 mdb Exp $
package robodj.chooser;
import javax.swing.*;
import robodj.repository.*;
public class BrowsePanel extends JTabbedPane
{
public BrowsePanel ()
{
EntryList elist;
Category[] cats = Chooser.model.getCategories();
// creat... |
Add matches method to AndRule class. | class PriceRule:
"""PriceRule is a rule that triggers when a stock price satisfies a condition.
The condition is usually greater, equal or lesser than a given value.
"""
def __init__(self, symbol, condition):
self.symbol = symbol
self.condition = condition
def matches(self, exchan... | class PriceRule:
"""PriceRule is a rule that triggers when a stock price satisfies a condition.
The condition is usually greater, equal or lesser than a given value.
"""
def __init__(self, symbol, condition):
self.symbol = symbol
self.condition = condition
def matches(self, exchan... |
Add logging to see if model is being correctly loaded | package sk.sodik.sample.wro4jBoot;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ro.isdc.wro.manager.factory.ConfigurableWroManagerFactory;
import ro.isdc.wro.model.factory.WroModelFactory;
import ro.isdc.wro.model... | package sk.sodik.sample.wro4jBoot;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ro.isdc.wro.manager.factory.ConfigurableWroManagerFactory;
import ro.isdc.wro.model.factory.WroModelFactory;
import ro.isdc.wro.model... |
Change license info to show name of license, not license text. | try:
from setuptools import setup
except ImportError:
from distutils.core import setup
packages = ['magento']
requires = []
setup(
name='python-magento',
version='0.2.1',
author='Vikram Oberoi',
author_email='voberoi@gmail.com',
packages=['magento'],
install_requires=requires,
entr... | try:
from setuptools import setup
except ImportError:
from distutils.core import setup
packages = ['magento']
requires = []
setup(
name='python-magento',
version='0.2.1',
author='Vikram Oberoi',
author_email='voberoi@gmail.com',
packages=['magento'],
install_requires=requires,
entr... |
Send HTTP code when cron is too much executed | <?php
/**
* @author Pierre-Henry Soria <ph7software@gmail.com>
* @copyright (c) 2012-2016, Pierre-Henry Soria. All Rights Reserved.
* @license GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
* @package PH7 / App / Include / Class
*/
n... | <?php
/**
* @author Pierre-Henry Soria <ph7software@gmail.com>
* @copyright (c) 2012-2016, Pierre-Henry Soria. All Rights Reserved.
* @license GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
* @package PH7 / App / Include / Class
*/
n... |
Fix Use % formatting in logging functions | import logging
LOGGER = logging.getLogger(__name__)
DEFAULT_SETTINGS = [
"CHOICES_SEPARATOR",
"USER_DID_NOT_ANSWER",
"TEX_CONFIGURATION_FILE",
"SURVEY_DEFAULT_PIE_COLOR",
"EXCEL_COMPATIBLE_CSV",
]
def set_default_settings():
try:
from django.conf import settings
from . import... | import logging
LOGGER = logging.getLogger(__name__)
DEFAULT_SETTINGS = [
"CHOICES_SEPARATOR",
"USER_DID_NOT_ANSWER",
"TEX_CONFIGURATION_FILE",
"SURVEY_DEFAULT_PIE_COLOR",
"EXCEL_COMPATIBLE_CSV",
]
def set_default_settings():
try:
from django.conf import settings
from . import... |
Fix docstring for module (minor) | # No shebang line, this module is meant to be imported
#
# Copyright 2014 Ambient Entertainment GmbH & Co. KG
#
# 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/lice... | # No shebang line, this module is meant to be imported
#
# Copyright 2014 Ambient Entertainment GmbH & Co. KG
#
# 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/lice... |
Clear require cache for config reloads.
Wrapping in a `Function` worked for simple `config/environment.js`
contents but breaks down in other scenarios that relied on the file
being evaluated in "nodeland". The prior implementation prevented
custom `require`'s (to get the package name from the `package.json`
for insta... | 'use strict';
var fs = require('fs');
var path = require('path');
var Filter = require('broccoli-filter');
function ConfigLoader (inputTree, options) {
if (!(this instanceof ConfigLoader)) {
return new ConfigLoader(inputTree, options);
}
this.inputTree = inputTree;
this.options = options || {};
}
... | 'use strict';
var fs = require('fs');
var path = require('path');
var Filter = require('broccoli-filter');
function ConfigLoader (inputTree, options) {
if (!(this instanceof ConfigLoader)) {
return new ConfigLoader(inputTree, options);
}
this.inputTree = inputTree;
this.options = options || {};
}
... |
Add guid to checkbox select | import FormControlsAbstractSelectComponent from './abstract-select';
import { action } from '@ember/object';
import { arg } from 'ember-arg-types';
import { string, bool } from 'prop-types';
import { get } from '@ember/object';
import { A } from '@ember/array';
import { guidFor } from '@ember/object/internals';
export... | import FormControlsAbstractSelectComponent from './abstract-select';
import { action } from '@ember/object';
import { arg } from 'ember-arg-types';
import { string, bool } from 'prop-types';
import { get } from '@ember/object';
import { A } from '@ember/array';
export default class FormControlsFfCheckboxSelectComponen... |
Change 'language' to 'syntax', that is more precise terminology. | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Aparajita Fishman
# Copyright (c) 2013 Aparajita Fishman
#
# Project: https://github.com/SublimeLinter/SublimeLinter-contrib-jshint
# License: MIT
#
"""This module exports the JSHint plugin linter class."""
from Sub... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Aparajita Fishman
# Copyright (c) 2013 Aparajita Fishman
#
# Project: https://github.com/SublimeLinter/SublimeLinter-contrib-jshint
# License: MIT
#
"""This module exports the JSHint plugin linter class."""
from Sub... |
Remove superfluous check in core.oauth | /*globals chrome,console */
/*jslint indent:2,browser:true, node:true */
var PromiseCompat = require('es6-promise').Promise;
var oAuthRedirectId = "freedom.oauth.redirect.handler";
var ChromeIdentityAuth = function() {
"use strict";
};
ChromeIdentityAuth.prototype.initiateOAuth = function(redirectURIs, continuatio... | /*globals chrome,console */
/*jslint indent:2,browser:true, node:true */
var PromiseCompat = require('es6-promise').Promise;
var oAuthRedirectId = "freedom.oauth.redirect.handler";
var ChromeIdentityAuth = function() {
"use strict";
};
ChromeIdentityAuth.prototype.initiateOAuth = function(redirectURIs, continuatio... |
Add ExcludeIds parameter to AnswerServer GetResources action
[rev. matthew.gordon] | /*
* Copyright 2015 Hewlett-Packard Development Company, L.P.
* Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
*/
package com.hp.autonomy.types.requests.idol.actions.answer.params;
@SuppressWarnings({"WeakerAccess", "unused"})
public enum GetResourc... | /*
* Copyright 2015 Hewlett-Packard Development Company, L.P.
* Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
*/
package com.hp.autonomy.types.requests.idol.actions.answer.params;
@SuppressWarnings({"WeakerAccess", "unused"})
public enum GetResourc... |
Put in some version requirements. | import os
from setuptools import setup, find_packages
setup(name='morepath',
version = '0.1dev',
description="A micro web-framework with superpowers",
author="Martijn Faassen",
author_email="faassen@startifact.com",
license="BSD",
packages=find_packages(),
include_package_data... | import os
from setuptools import setup, find_packages
setup(name='morepath',
version = '0.1dev',
description="A micro web-framework with superpowers",
author="Martijn Faassen",
author_email="faassen@startifact.com",
license="BSD",
packages=find_packages(),
include_package_data... |
Use POST instead of GET Request for ES Search API (Issue with query string size) | from __future__ import absolute_import
from future.builtins import ( # noqa
bytes, dict, int, list, object, range, str,
ascii, chr, hex, input, next, oct, open,
pow, round, super,
filter, map, zip)
from functools import wraps
import logging
from elasticsearch import Elasticsearch
from conf.appconfig im... | from __future__ import absolute_import
from future.builtins import ( # noqa
bytes, dict, int, list, object, range, str,
ascii, chr, hex, input, next, oct, open,
pow, round, super,
filter, map, zip)
from functools import wraps
import logging
from elasticsearch import Elasticsearch
from conf.appconfig im... |
Update Cloud9 per 2021-04-01 changes | # Copyright (c) 2012-2021, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
#
# *** Do not modify - this file is autogenerated ***
# Resource specification version: 35.0.0
from troposphere import Tags
from . import AWSObject, AWSProperty
from .validators import integer
class ... | # Copyright (c) 2012-2017, Mark Peek <mark@peek.org>
# All rights reserved.
#
# See LICENSE file for full license.
from . import AWSObject, AWSProperty
from .validators import integer
class Repository(AWSProperty):
props = {
"PathComponent": (str, True),
"RepositoryUrl": (str, True),
}
clas... |
Remove default route because it is not the desired behavior.
Autoconverted from SVN (revision:1409) | from django.conf.urls.defaults import *
from django.conf import settings
from django.views.generic.simple import direct_to_template, redirect_to
UUID_REGEX = '[\w]{8}(-[\w]{4}){3}-[\w]{12}'
urlpatterns = patterns('dashboard.main.views',
# Index
(r'^$', redirect_to, {'url': '/ingest/'}),
# Ingest
... | from django.conf.urls.defaults import *
from django.conf import settings
from django.views.generic.simple import direct_to_template, redirect_to
UUID_REGEX = '[\w]{8}(-[\w]{4}){3}-[\w]{12}'
urlpatterns = patterns('dashboard.main.views',
# Ingest
url(r'ingest/$', direct_to_template, {'template': 'main/in... |
Fix broken require after refactoring | import program from 'commander'
import sagui from './index'
import { InvalidPath } from './configure/path'
import { logError, log } from './util/log'
program.command('build')
.description('Build the project')
.action(function (options) {
sagui.build(options)
})
program.command('dist')
.description('Builds... | import program from 'commander'
import sagui from './index'
import { InvalidPath } from './plugins/path'
import { logError, log } from './util/log'
program.command('build')
.description('Build the project')
.action(function (options) {
sagui.build(options)
})
program.command('dist')
.description('Builds a... |
Fix the scenario plugin sample
We forgot to fix scenario plugin sample when we were doing
rally.task.scenario refactoring
Change-Id: Iadbb960cf168bd3b9cd6c1881a5f7a8dffd7036f | # Copyright 2013: Mirantis 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 ... | # Copyright 2013: Mirantis 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 ... |
Use PEP8 style for conditionals | import re
# A regular expression is a string like what you see below between the quote
# marks, and the ``re`` module interprets it as a pattern. Each regular
# expression describes a small program that takes another string as input and
# returns information about that string. See
# http://docs.python.org/library/re.... | import re
# A regular expression is a string like what you see below between the quote
# marks, and the ``re`` module interprets it as a pattern. Each regular
# expression describes a small program that takes another string as input and
# returns information about that string. See
# http://docs.python.org/library/re.... |
Add blank to allow no stars/tags in admin | from django.conf import settings
from django.db import models
class HashTag(models.Model):
# The hash tag length can't be more than the body length minus the `#`
text = models.CharField(max_length=139)
def __str__(self):
return self.text
class Message(models.Model):
user = models.ForeignKey... | from django.conf import settings
from django.db import models
class HashTag(models.Model):
# The hash tag length can't be more than the body length minus the `#`
text = models.CharField(max_length=139)
def __str__(self):
return self.text
class Message(models.Model):
user = models.ForeignKey... |
Revert remote origin to 'origin' for deploy github pages | module.exports = {
// Autoprefixer
autoprefixer: {
// https://github.com/postcss/autoprefixer#browsers
browsers: [
'Explorer >= 10',
'ExplorerMobile >= 10',
'Firefox >= 30',
'Chrome >= 34',
'Safari >= 7',
'Opera >= 23',
'iOS >= 7',
'Android >= 4.4',
'Bla... | module.exports = {
// Autoprefixer
autoprefixer: {
// https://github.com/postcss/autoprefixer#browsers
browsers: [
'Explorer >= 10',
'ExplorerMobile >= 10',
'Firefox >= 30',
'Chrome >= 34',
'Safari >= 7',
'Opera >= 23',
'iOS >= 7',
'Android >= 4.4',
'Bla... |
Use generator to get random character buffers | var mt = require('mersenne-twister')
var prng
var codes
var generator
main()
function main() {
seed = process.argv[2]
setup(seed)
console.log(getBuffer(10000))
}
function setup(seed) {
if (!seed) {
console.log('no seed provided - using default seed')
seed = 123
}
prng = new m... | var mt = require('mersenne-twister')
var generator
main()
function main() {
seed = process.argv[2]
if (!seed) {
console.log('no seed provided - using default seed')
seed = 123
}
generator = new mt(seed)
console.log(getCharacterStream(10))
}
function getRange(from, to) {
var r... |
[BACKLOG-18075] Fix for input box focus | /*!
* Copyright 2017 Pentaho Corporation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by a... | /*!
* Copyright 2017 Pentaho Corporation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by a... |
Remove deprecated ContainerAware class and make use of the trait in another class | <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bridge\Doctrine;
use Symfony\Component\DependencyInjection\Cont... | <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Bridge\Doctrine;
use Symfony\Component\DependencyInjection\Cont... |
Throw exception before using null | package org.irmacard.credentials.info;
import java.net.URI;
import java.util.HashMap;
/**
* TODO: Change print statements to proper Logging statements
*/
public class DescriptionStore {
static URI CORE_LOCATION;
static DescriptionStore ds;
HashMap<Integer,CredentialDescription> credentialDescriptions = new Has... | package org.irmacard.credentials.info;
import java.net.URI;
import java.util.HashMap;
/**
* TODO: Change print statements to proper Logging statements
*/
public class DescriptionStore {
static URI CORE_LOCATION;
static DescriptionStore ds;
HashMap<Integer,CredentialDescription> credentialDescriptions = new Has... |
fix: Return empty tuple in get_readonly_fields | from django.contrib import admin
from django.template.defaultfilters import pluralize
from .forms import EnvironmentVariableForm
from .models import EnvironmentVariable, Project
class EnvironmentVariableMixin:
form = EnvironmentVariableForm
@staticmethod
def get_readonly_fields(request, obj=None):
... | from django.contrib import admin
from django.template.defaultfilters import pluralize
from .forms import EnvironmentVariableForm
from .models import EnvironmentVariable, Project
class EnvironmentVariableMixin:
form = EnvironmentVariableForm
@staticmethod
def get_readonly_fields(request, obj=None):
... |
Use basic auth when posting data. | package com.watcher.car;
import android.util.Base64;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import static android.util.Base64.DEFAULT;
public class HttpClient {
public void post(String data) {
try {
HttpURLConnection conn =... | package com.watcher.car;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
public class HttpClient {
public void post(String data) {
try {
HttpURLConnection conn = openConnection("http://leetor.no-ip.org:8010/");
conn.setDoOutput(... |
Add go_api as a dependency. | from setuptools import setup, find_packages
setup(
name="go_contacts",
version="0.1.0a",
url='http://github.com/praekelt/go-contacts-api',
license='BSD',
description="A contacts and groups API for Vumi Go",
long_description=open('README.rst', 'r').read(),
author='Praekelt Foundation',
a... | from setuptools import setup, find_packages
setup(
name="go_contacts",
version="0.1.0a",
url='http://github.com/praekelt/go-contacts-api',
license='BSD',
description="A contacts and groups API for Vumi Go",
long_description=open('README.rst', 'r').read(),
author='Praekelt Foundation',
a... |
Update the explostion effect code comments. | /* global Demo, Random */
//------------------------------------------------------------------
//
// Creates an explostion effect that emits all particles at creation time.
// The spec is defined as:
// {
// center: { x: , y: },
// howMany: // How many particles to emit
// }
//
//------------------------------------... | /* global Demo, Random */
Demo.components.ParticleSystem.createEffectExplosion = function(spec) {
'use strict';
var effect = {
get center() { return spec.center; },
get emitRate() { return 0; }
},
particle = 0;
effect.update = function() {
for (particle = 0; particle < spec.howMany; particle += 1) {
... |
Logs: Check for each stream if the filepath exists, create it otherwise | 'use strict';
const bunyan = require('bunyan');
const path = require('path');
const fs = require('fs');
const argv = require('yargs').argv;
function initLogger({Configuration}) {
const environment = Configuration.get('env');
const loggerConfig = Configuration.get('logs');
const streams = []
// If Mockiji is... | 'use strict';
const bunyan = require('bunyan');
const argv = require('yargs').argv;
function initLogger({Configuration}) {
const environment = Configuration.get('env');
const loggerConfig = Configuration.get('logs');
const streams = []
// If Mockiji is not in silent mode, add a stdout stream
if (!argv.sil... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.