text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Use shallowMount instead of mount | import RemoveModal from '~/components/RemoveModal'
import BaseModal from '~/components/BaseModal'
import { shallowMount } from 'helper'
describe('Remove modal component', () => {
let wrapper, baseModalWrapper
beforeEach(() => {
wrapper = shallowMount(RemoveModal, {})
baseModalWrapper = wrapper.find(BaseMod... | import RemoveModal from '~/components/RemoveModal'
import BaseModal from '~/components/BaseModal'
import { mount } from 'helper'
describe('Remove modal component', () => {
let wrapper, baseModalWrapper
beforeEach(() => {
wrapper = mount(RemoveModal, {
stubs: {
post: true
}
})
baseMo... |
Add function to populate storage | 'use strict'
// Code thanks to MDN
export function storageAvailable (type) {
try {
let storage = window[type]
let x = '__storage_test__'
storage.setItem(x, x)
storage.removeItem(x)
return true
} catch (e) {
let storage = window[type]
return e instanceof DOMException && (
// everyt... | 'use strict'
// Code thanks to MDN
export function storageAvailable (type) {
try {
let storage = window[type]
let x = '__storage_test__'
storage.setItem(x, x)
storage.removeItem(x)
return true
} catch (e) {
let storage = window[type]
return e instanceof DOMException && (
// everyt... |
Fix the ordering of stripping and transliteration
This was kind of a silly way to do this. First stripping everything that is not default, and then using iconv transliteration. At that point there would be no special chars left. This explains why i always lose my French éàç characters in the slug :)
Fixes #8 | <?php
namespace Kunstmaan\UtilitiesBundle\Helper;
/**
* Sulgifier is a helper to slugify a certain string
*/
class Slugifier
{
/**
* Slugify a string
*
* @param string $text Text to slugify
* @param string $default Default return value (override when slugify would return an empty string)
... | <?php
namespace Kunstmaan\UtilitiesBundle\Helper;
/**
* Sulgifier is a helper to slugify a certain string
*/
class Slugifier
{
/**
* Slugify a string
*
* @param string $text Text to slugify
* @param string $default Default return value (override when slugify would return an empty string)
... |
Improve string encoding in network protocols
Eliminate unnecessary memory allocation. | package org.jvirtanen.parity.net.poe;
import static java.nio.charset.StandardCharsets.*;
import java.nio.ByteBuffer;
class ByteBuffers {
private static final byte SPACE = ' ';
static String getString(ByteBuffer buffer, int length) {
byte[] bytes = new byte[length];
buffer.get(bytes);
... | package org.jvirtanen.parity.net.poe;
import static java.nio.charset.StandardCharsets.*;
import java.nio.ByteBuffer;
class ByteBuffers {
private static final byte SPACE = ' ';
static String getString(ByteBuffer buffer, int length) {
byte[] bytes = new byte[length];
buffer.get(bytes);
... |
Change prefilled gray suggestiosn to black by adding class. | ;(function(){//IFEE
angular.module('brewKeeper')
.controller('createNewRecipe', function($scope, $http, $location){
$scope.recipe = { }
$scope.recipe.orientation = "Standard";
$scope.createNew=function(){
var username = ""
$http.get('https://brew-keeper-api.herokuapp.com/api/whoami/')
... | ;(function(){//IFEE
angular.module('brewKeeper')
.controller('createNewRecipe', function($scope, $http, $location){
$scope.recipe = { }
$scope.recipe.orientation = "Standard";
$scope.submit=function(){
var username = ""
$http.get('https://brew-keeper-api.herokuapp.com/api/whoami/')
.... |
Add code for recieving data | package in.co.sdslabs.cognizance;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
public class AlarmReciever extends BroadcastRe... | package in.co.sdslabs.cognizance;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
public class AlarmReciever extends BroadcastReceiver {
NotificationMan... |
Add wine type to the list. | from django.contrib import admin
from .models import Wine, Grape, Winery
class GrapeInline(admin.TabularInline):
model = Grape
extra = 0
@admin.register(Wine)
class WineAdmin(admin.ModelAdmin):
list_display = ["__str__", "year", "wine_type", "in_cellar",]
fieldsets = (
('Bottle', {
... | from django.contrib import admin
from .models import Wine, Grape, Winery
class GrapeInline(admin.TabularInline):
model = Grape
extra = 0
@admin.register(Wine)
class WineAdmin(admin.ModelAdmin):
list_display = ["__str__", "year", "in_cellar",]
fieldsets = (
('Bottle', {
'fields': ... |
Add TODO to broken test | """
Plot to test logscale
TODO (@vladh): `sharex` and `sharey` seem to cause the tick labels to go nuts. This needs to
be fixed.
"""
import matplotlib.pyplot as plt
import numpy as np
import mpld3
def create_plot():
fig = plt.figure()
fig.subplots_adjust(hspace=0.4, wspace=0.4)
ax1 = fig.add_subplot(2, ... | """Plot to test logscale"""
import matplotlib.pyplot as plt
import numpy as np
import mpld3
def create_plot():
fig = plt.figure()
fig.subplots_adjust(hspace=0.4, wspace=0.4)
ax1 = fig.add_subplot(2, 2, 1)
ax2 = fig.add_subplot(2, 2, 2, sharey=ax1, xscale='log')
ax3 = fig.add_subplot(2, 2, 3, shar... |
Remove setting REPORT_TYPE. Reformatted code. Remove ANYBAR_COLOR_FAIL. | {
'REPORT_RECIPIENTS': 'steven.knight@cashstar.com',
'JENKINS_USERNAME': 'sknight',
'JENKINS_API_TOKEN': '594849a68d4911d6c39a2cb5f700c385',
'FEATURES': {
'PASSWORD_DECRYPTION': False,
'AWS': False,
'ANYBAR': True
},
# 'LOG_DB_URL': 'sqlite:///Users/steven.knight/Proje... | {
'REPORT_TYPE': 'HTML',
'REPORT_RECIPIENTS': 'steven.knight@cashstar.com',
'JENKINS_USERNAME': 'sknight',
'JENKINS_API_TOKEN': '594849a68d4911d6c39a2cb5f700c385',
'FEATURES': {'PASSWORD_DECRYPTION': False, 'AWS': False, 'ANYBAR': True},
# 'LOG_DB_URL': 'sqlite:///Users/steven.knight/Projects... |
Set correct headings for file responses | const express = require('express'),
router = express.Router(),
fs = require('fs'),
path = require('path'),
grid = require('gridfs-stream');
const db = require('../lib/db'),
mongoose = db.goose,
conn = db.rope;
grid.mongo = mongoose.mongo;
router.get('/', function(req, res) {
co... | const express = require('express'),
router = express.Router(),
fs = require('fs'),
path = require('path'),
grid = require('gridfs-stream');
const db = require('../lib/db'),
mongoose = db.goose,
conn = db.rope;
grid.mongo = mongoose.mongo;
router.get('/', function(req, res) {
co... |
Make KeychainItem _decode method static | from Crypto.Cipher import AES
from base64 import b64decode
import json
from openpassword.pkcs_utils import strip_byte_padding
from openpassword.openssl_utils import derive_openssl_key
class KeychainItem:
def __init__(self, item):
self.encrypted = b64decode(item["encrypted"])
def decrypt(self, decrypt... | from Crypto.Cipher import AES
from base64 import b64decode
import json
from openpassword.pkcs_utils import strip_byte_padding
from openpassword.openssl_utils import derive_openssl_key
class KeychainItem:
def __init__(self, item):
self.encrypted = b64decode(item["encrypted"])
def decrypt(self, decrypt... |
Update current user from props | import React, {Component} from 'react';
import {Table} from 'react-bootstrap';
import {connect} from 'react-redux';
import _ from 'lodash';
class UsersTable extends Component {
render() {
return (
<div className="tbl-scroll">
<Table responsive striped>
<tbody>
<tr>
... | import React, {Component} from 'react';
import {Table} from 'react-bootstrap';
import {connect} from 'react-redux';
import _ from 'lodash';
class UsersTable extends Component {
render() {
return (
<div className="tbl-scroll">
<Table responsive striped>
<tbody>
<tr>
... |
Fix having special characters in login/password field.
Signed-off-by: thomnico <5d7b651831a7f5cf7c72a23146042589c88b16b7@googlemail.com> | #!/usr/bin/env python
from setuptools import setup
def readme():
with open('README.md') as f:
return f.read()
setup(
name='fortiosapi',
version='0.10.6',
description=('Python modules to use Fortigate APIs'
'full configuration, monitoring, lifecycle rest and ssh'),
long_... | #!/usr/bin/env python
from setuptools import setup
def readme():
with open('README.md') as f:
return f.read()
setup(
name='fortiosapi',
version='0.10.5',
description=('Python modules to use Fortigate APIs'
'full configuration, monitoring, lifecycle rest and ssh'),
long_... |
Use Bluebird's nodeify to handle resulting promise | var Promise = require('bluebird');
var mapObj = require('map-obj');
var assign = require('object-assign');
function FileWebpackPlugin(files) {
this.files = files || {};
}
FileWebpackPlugin.prototype.apply = function(compiler) {
var self = this;
compiler.plugin('emit', function(compiler, done) {
var data = {... | var Promise = require('bluebird');
var mapObj = require('map-obj');
var assign = require('object-assign');
function FileWebpackPlugin(files) {
this.files = files || {};
}
FileWebpackPlugin.prototype.apply = function(compiler) {
var self = this;
compiler.plugin('emit', function(compiler, done) {
var data = {... |
Handle worker with no options | var mongoose = require('mongoose');
var mubsub = require('mubsub');
var monq = module.exports = {};
monq.Job = require('./job');
monq.Queue = require('./queue');
monq.Worker = require('./worker');
monq.pubsub = mubsub.channel('events');
monq.worker = function(options) {
options || (options = {});
options.pu... | var mongoose = require('mongoose');
var mubsub = require('mubsub');
var monq = module.exports = {};
monq.Job = require('./job');
monq.Queue = require('./queue');
monq.Worker = require('./worker');
monq.pubsub = mubsub.channel('events');
monq.worker = function(options) {
options.pubsub || (options.pubsub = monq.... |
Remove init in public api | const RunPluginScriptCommand = require('./src/commands/runPluginScript')
const CreateProjectCommand = require('./src/commands/createProject')
const AddPluginsCommand = require('./src/commands/addPlugins')
const RemovePluginsCommand = require('./src/commands/removePlugins')
const UpdatePluginsCommand = require('./src/co... | const RunPluginScriptCommand = require('./src/commands/runPluginScript')
const CreateProjectCommand = require('./src/commands/createProject')
const AddPluginsCommand = require('./src/commands/addPlugins')
const RemovePluginsCommand = require('./src/commands/removePlugins')
const UpdatePluginsCommand = require('./src/co... |
Fix up local.ini updater code to look specifically for 'xform_translate_path' | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4 encoding=utf-8
"""
The sole purpose of the following script is to update the
local.ini file used by the dimagi teamcity buildserver
so that xform_translate_path gets updated to point to the folder
{project.dir}/lib
"""
JAR_PATH_SETTING = 'xform_translate_path'
impo... | #!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4 encoding=utf-8
"""
The sole purpose of the following script is to update the
local.ini file used by the dimagi teamcity buildserver
so that the path to xform_translate.jar is updated dynamically.
It does this by identifying the jar_path_placeholder in the file
identi... |
Use `find_packages()` and since we aren't building `package_data` anymore, we need to use `MANIFEST.in`. That's what it's there for and does a more obvious job. "Explicit is better than implicit." Using MANIFEST requires `include_package_data=True`. | # Nothing in this file should need to be edited.
# Use package.json to adjust metadata about this package.
# Use MANIFEST.in to include package-specific data files.
import os
import json
from setuptools import setup, find_packages
info = json.load(open("./package.json"))
def generate_namespaces(package):
i ... | """
setup.py file for building armstrong components.
Nothing in this file should need to be edited, please see accompanying
package.json file if you need to adjust metadata about this package.
"""
import os
import json
from setuptools import setup, find_packages
info = json.load(open("./package.json"))
def genera... |
[Security] Fix security.interactive_login event const doc block | <?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\Component\Security\Http;
final class SecurityEvents
{
/**
... | <?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\Component\Security\Http;
final class SecurityEvents
{
/**
... |
Add total load time to cache debug options | package com.tisawesomeness.minecord.debug;
import com.google.common.cache.CacheStats;
import lombok.NonNull;
/**
* Debugs a Guava {@link com.google.common.cache.LoadingCache}.
*/
public abstract class CacheDebugOption implements DebugOption {
public @NonNull String debug() {
CacheStats stats = getCache... | package com.tisawesomeness.minecord.debug;
import com.google.common.cache.CacheStats;
import lombok.NonNull;
/**
* Debugs a Guava {@link com.google.common.cache.LoadingCache}.
*/
public abstract class CacheDebugOption implements DebugOption {
public @NonNull String debug() {
CacheStats stats = getCacheS... |
Comment out Google Analytics init. | import React, { Component, PropTypes } from 'react';
import { Provider } from 'react-redux';
import { getRoutes } from '../routes';
import { Router, applyRouterMiddleware } from 'react-router';
import { useScroll } from 'react-router-scroll';
//import ReactGA from 'react-ga';
export default class Root extends Componen... | import React, { Component, PropTypes } from 'react';
import { Provider } from 'react-redux';
import { getRoutes } from '../routes';
import { Router, applyRouterMiddleware } from 'react-router';
import { useScroll } from 'react-router-scroll';
import ReactGA from 'react-ga';
export default class Root extends Component ... |
Add name on register form submit input. Is usefull to select it in unit test. | @extends('app')
@section('content')
<div class="container-fluid">
@include('partials/hero')
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4">
<h1>
{{ trans('messages.user.register') }}
<a href="... | @extends('app')
@section('content')
<div class="container-fluid">
@include('partials/hero')
<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4">
<h1>
{{ trans('messages.user.register') }}
<a href="... |
Add python 3.4 to trove classifiers | from setuptools import setup
version = '0.1'
setup(
name='python-editor',
version=version,
description="Programmatically open an editor, capture the result.",
#long_description='',
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :... | from setuptools import setup
version = '0.1'
setup(
name='python-editor',
version=version,
description="Programmatically open an editor, capture the result.",
#long_description='',
classifiers=[
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'License :... |
auditlog: Remove pre_init_hook reference from openerp, no pre_init hook exists any more | # -*- coding: utf-8 -*-
# © 2015 ABF OSIELL <http://osiell.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': "Audit Log",
'version': "9.0.1.0.0",
'author': "ABF OSIELL,Odoo Community Association (OCA)",
'license': "AGPL-3",
'website': "http://www.osiell.com",
'categ... | # -*- coding: utf-8 -*-
# © 2015 ABF OSIELL <http://osiell.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
'name': "Audit Log",
'version': "9.0.1.0.0",
'author': "ABF OSIELL,Odoo Community Association (OCA)",
'license': "AGPL-3",
'website': "http://www.osiell.com",
'categ... |
Add footer fields to Attachment | package slack
// https://api.slack.com/docs/attachments
// It is possible to create more richly-formatted messages using Attachments.
type AttachmentField struct {
Title string `json:"title"`
Value string `json:"value"`
Short bool `json:"short"`
}
type Attachment struct {
Color string `json:"color,omitempty"... | package slack
// https://api.slack.com/docs/attachments
// It is possible to create more richly-formatted messages using Attachments.
type AttachmentField struct {
Title string `json:"title"`
Value string `json:"value"`
Short bool `json:"short"`
}
type Attachment struct {
Color string `json:"color,omitempty"... |
Add helper to easily cancel AsyncMap tasks | /*
* Copyright 2016 Peter Kenji Yamanaka
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... | /*
* Copyright 2016 Peter Kenji Yamanaka
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... |
Use compatible release versions for all dependencies | import os
from setuptools import setup, find_packages
src_dir = os.path.dirname(__file__)
install_requires = [
"troposphere~=1.8.0",
"awacs~=0.6.0",
"stacker~=0.6.3",
]
tests_require = [
"nose~=1.0",
"mock~=2.0.0",
]
def read(filename):
full_path = os.path.join(src_dir, filename)
with o... | import os
from setuptools import setup, find_packages
src_dir = os.path.dirname(__file__)
install_requires = [
"troposphere==1.7.0",
"awacs==0.6.0",
"stacker==0.6.3",
]
tests_require = [
"nose>=1.0",
"mock==1.0.1",
]
def read(filename):
full_path = os.path.join(src_dir, filename)
with o... |
Add debug messages for all region actions.. | package au.com.mineauz.minigamesregions.actions;
import java.util.Map;
import au.com.mineauz.minigames.Minigames;
import au.com.mineauz.minigames.minigame.Minigame;
import au.com.mineauz.minigames.script.ScriptObject;
import org.bukkit.configuration.file.FileConfiguration;
import au.com.mineauz.minigames.MinigamePla... | package au.com.mineauz.minigamesregions.actions;
import java.util.Map;
import org.bukkit.configuration.file.FileConfiguration;
import au.com.mineauz.minigames.MinigamePlayer;
import au.com.mineauz.minigames.menu.Menu;
import au.com.mineauz.minigamesregions.Node;
import au.com.mineauz.minigamesregions.Region;
public... |
Fix `sleep` test. How did this pass locally before?! | """
Tests for POSIX-compatible `sleep`.
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sleep.html
"""
import time
from helpers import check_version, run
def test_version():
"""Check that we're using Boreutil's implementation."""
assert check_version("sleep")
def test_missing_args():
"""No ... | """
Tests for POSIX-compatible `sleep`.
https://pubs.opengroup.org/onlinepubs/9699919799/utilities/sleep.html
"""
import time
from helpers import check_version, run
def test_version():
"""Check that we're using Boreutil's implementation."""
assert check_version("sleep")
def test_missing_args():
"""No ... |
Use threshold for time boundary in manager | from dateutil.relativedelta import relativedelta
from django.apps import apps
from django.utils import timezone
user_deletion_config = apps.get_app_config('user_deletion')
class UserDeletionManagerMixin:
def users_to_notify(self):
"""Finds all users who have been inactive and not yet notified."""
... | from dateutil.relativedelta import relativedelta
from django.apps import apps
from django.utils import timezone
user_deletion_config = apps.get_app_config('user_deletion')
class UserDeletionManagerMixin:
def users_to_notify(self):
"""Finds all users who have been inactive and not yet notified."""
... |
Fix colour not being set when a colour multiplier with white was added | package codechicken.lib.render;
import codechicken.lib.colour.ColourRGBA;
public class ColourMultiplier implements CCRenderState.IVertexOperation
{
private static ColourMultiplier instance = new ColourMultiplier(-1);
public static ColourMultiplier instance(int colour) {
instance.colour = colour;
... | package codechicken.lib.render;
import codechicken.lib.colour.ColourRGBA;
public class ColourMultiplier implements CCRenderState.IVertexOperation
{
private static ColourMultiplier instance = new ColourMultiplier(-1);
public static ColourMultiplier instance(int colour) {
instance.colour = colour;
... |
Use javascript redirect to break out from iframe | <?php
/**
* Mondido
*
* PHP version 5.6
*
* @category Mondido
* @package Mondido_Mondido
* @author Andreas Karlsson <andreas@kodbruket.se>
* @license MIT License https://opensource.org/licenses/MIT
* @link https://www.mondido.com
*/
namespace Mondido\Mondido\Controller\Checkout;
/**
* Error action
... | <?php
/**
* Mondido
*
* PHP version 5.6
*
* @category Mondido
* @package Mondido_Mondido
* @author Andreas Karlsson <andreas@kodbruket.se>
* @license MIT License https://opensource.org/licenses/MIT
* @link https://www.mondido.com
*/
namespace Mondido\Mondido\Controller\Checkout;
/**
* Error action
... |
Revert "Temporarily make talks visible only to committee"
This reverts commit 57050b7025acb3de66024fe01255849a5ba5f1fc. | from django.shortcuts import render, get_object_or_404
from config.utils import get_active_event
from .models import Talk
def list_talks(request):
event = get_active_event()
talks = event.talks.prefetch_related(
'applicants',
'applicants__user',
'skill_level',
'sponsor',
... | from django.shortcuts import render, get_object_or_404
from config.utils import get_active_event
from .models import Talk
def list_talks(request):
event = get_active_event()
talks = event.talks.prefetch_related(
'applicants',
'applicants__user',
'skill_level',
'sponsor',
... |
Fix typo breaking PyPI push. | from distutils.core import setup
setup(
name = 'mustache',
packages = ['mustache'],
version = '0.1.3',
description = 'Mustache templating in Python',
author = 'Peter Downs',
author_email = 'peterldowns@gmail.com',
url = 'https://github.com/peterldowns/python-mustache',
download_url = 'ht... | from distutils.core import setup
setup(
name = 'mustache',
packages = ['mustache'],
version = '0.1.3',
description = 'Mustache templating in Python',
author = 'Peter Downs',
author_email = 'peterldowns@gmail.com',
url = 'https://github.com/peterldowns/python-mustache',
download_url = 'ht... |
Fix: Return EmptyIterator when no subscribers have been added for type
Co-authored-by: Andreas Möller <96e8155732e8324ae26f64d4516eb6fe696ac84f@localheinz.com>
Co-authored-by: Arne Blankerts <2d7739f42ebd62662a710577d3d9078342a69dee@Blankerts.de> | <?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\Event;
use function array_key_exists;
use ArrayI... | <?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\Event;
use ArrayIterator;
use Iterator;
final c... |
Throw WrongOrientationException (resolving compile-time issues) | package edu.agh.tunev.model.cellular.agent;
import java.awt.geom.Point2D;
import edu.agh.tunev.model.AbstractPerson;
public final class Person extends AbstractPerson {
public static final class WrongOrientationException extends Exception {
private static final long serialVersionUID = 1L;
}
public enum Orie... | package edu.agh.tunev.model.cellular.agent;
import java.awt.geom.Point2D;
import edu.agh.tunev.model.AbstractPerson;
public final class Person extends AbstractPerson {
public enum Orientation{
E, NE, N, NW, W, SW, S, SE
}
public Person(Point2D.Double position) {
super(position);
}
public static Double... |
Remove unused initialization code from user list activity. | /**
* Copyright (C) 2014 android10.org. All rights reserved.
* @author Fernando Cejas (the android10 coder)
*/
package com.fernandocejas.android10.sample.presentation.view.activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.Window;
import com.fernan... | /**
* Copyright (C) 2014 android10.org. All rights reserved.
* @author Fernando Cejas (the android10 coder)
*/
package com.fernandocejas.android10.sample.presentation.view.activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.Window;
import com.fernan... |
Change refresh time to 4 seconds | <?php
class CodesController extends \BaseController {
public function process($code)
{
$code = Code::where('code', '=', $code)->first();
if(is_null($code) || $code->used == 1){
return Redirect::to('/');
} else {
//Snapchatty functions
//Refresh(disappear... | <?php
class CodesController extends \BaseController {
public function process($code)
{
$code = Code::where('code', '=', $code)->first();
if(is_null($code) || $code->used == 1){
return Redirect::to('/');
} else {
//Snapchatty functions
//Refresh(disappear... |
Update individual income tax test case | package main
import (
"fmt"
"testing"
)
func TestTax2011QuickDeduction(t *testing.T) {
fmt.Println("Year 2011:")
rate := tax2011Rate()
beforeTax := []float64{
18000,
54000,
108000,
420000,
660000,
960000,
-1,
}
afterTax, qdWithTax := quickDeduction(0, beforeTax, rate)
fmt.Printf("Atfer Tax:%v\n"... | package main
import (
"fmt"
"testing"
)
func TestTax2011QuickDeduction(t *testing.T) {
fmt.Println("Year 2011:")
afterTax, qdWithTax := tax2011QuickDeduction(0)
fmt.Printf("Atfer Tax:%v\n", afterTax)
for k, v := range qdWithTax {
if k > 0 {
fmt.Printf("%v: %v\n", k/12.0, v)
}
}
afterTax, qdWithoutTax ... |
Add a final on a member variable. | package com.haskforce.jps;
/*
* Downloaded from https://github.com/ignatov/intellij-erlang on 7 May
* 2014.
*/
import org.jetbrains.jps.builders.BuildRootDescriptor;
import org.jetbrains.jps.builders.BuildTarget;
import java.io.File;
/**
*
*/
public class HaskellSourceRootDescriptor extends BuildRootDescriptor... | package com.haskforce.jps;
/*
* Downloaded from https://github.com/ignatov/intellij-erlang on 7 May
* 2014.
*/
import org.jetbrains.jps.builders.BuildRootDescriptor;
import org.jetbrains.jps.builders.BuildTarget;
import java.io.File;
/**
*
*/
public class HaskellSourceRootDescriptor extends BuildRootDescriptor... |
Append 'px' to end of image upload form resize field | from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.bootstrap import FormActions, Div, AppendedText
from crispy_forms.layout import Layout, Field, HTML, Button, Submit, Reset
class UploadImageForm(forms.Form):
helper = FormHelper()
helper.form_tag = False
helper.form_clas... | from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.bootstrap import FormActions, Div
from crispy_forms.layout import Layout, Field, HTML, Button, Submit, Reset
class UploadImageForm(forms.Form):
helper = FormHelper()
helper.form_tag = False
helper.form_class = 'form-hori... |
Unify AppData, attribute is 'fill_window' everywhere
TO maintain consistency with pack data, The fillWindow property should be fill_window, this is the style that all JSON in the API takes | pc.extend(pc.fw, function () {
/**
* @name pc.fw.AppData
* @class AppData contains global data about the application that is loaded from Entity or Exported data
* For Exported applications it comes from pc.content.data['application'], for development applications it comes from the designer Compon... | pc.extend(pc.fw, function () {
/**
* @name pc.fw.AppData
* @class AppData contains global data about the application that is loaded from Entity or Exported data
* For Exported applications it comes from pc.content.data['application'], for development applications it comes from the designer Compon... |
Include node-interval-tree in debugger bundle | const path = require('path');
const webpack = require('webpack');
const nodeExternals = require('webpack-node-externals');
module.exports = {
entry: "./debugger",
module: {
rules: [{
test: /\.js$/,
loader: "babel-loader",
query: {
presets: [
[
'babel-preset-env'... | const path = require('path');
const webpack = require('webpack');
const nodeExternals = require('webpack-node-externals');
module.exports = {
entry: "./debugger",
module: {
rules: [{
test: /\.js$/,
loader: "babel-loader",
query: {
presets: [
[
'babel-preset-env'... |
Mark as python 3 compatable.
git-svn-id: c8188841f5432f3fe42d04dee4f87e556eb5cf84@19 99efc558-b41a-11dd-8714-116ca565c52f | #!/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',
... |
Add message when email already exist | Template.register.events({
'submit #register-form': function(e, t) {
e.preventDefault();
var isValidPassword = function(val, field) {
if (val.length >= 6) {
return true;
} else {
return false;
}
}
var trimInput = function(val) {
return val.replace(/^\s*|\s*$/g... | Template.register.events({
'submit #register-form': function(e, t) {
e.preventDefault();
var isValidPassword = function(val, field) {
if (val.length >= 6) {
return true;
} else {
return false;
}
}
var trimInput = function(val) {
return val.replace(/^\s*|\s*$/g... |
Fix test failure on Python 2 | import copy
import pkg_resources
from rwt import deps
def test_entry_points():
"""
Ensure entry points are visible after making packages visible
"""
with deps.on_sys_path('jaraco.mongodb'):
eps = pkg_resources.iter_entry_points('pytest11')
assert list(eps), "Entry points not found"
class TestInstallCheck:... | import pkg_resources
from rwt import deps
def test_entry_points():
"""
Ensure entry points are visible after making packages visible
"""
with deps.on_sys_path('jaraco.mongodb'):
eps = pkg_resources.iter_entry_points('pytest11')
assert list(eps), "Entry points not found"
class TestInstallCheck:
def test_in... |
Simplify _getHostURL using Ternary operator | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
'use strict';
function _getHostURL(url) {
const host = url.match(/^(?:https?\:\/\/)(?:[^\/])+/);
return ... | /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
'use strict';
function _getHostURL(url) {
const host = url.match(/^(?:https?\:\/\/)(?:[^\/])+/);
if (hos... |
Add FLX to the release train | #!/usr/bin/env python
# Copyright 2015 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.
# See https://github.com/domokit/sky_engine/wiki/Release-process
import os
import subprocess
import sys
def main():
engine_root ... | #!/usr/bin/env python
# Copyright 2015 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.
# See https://github.com/domokit/sky_engine/wiki/Release-process
import os
import subprocess
import sys
def main():
engine_root ... |
Adjust Javadoc for the exception. | /*
* Copyright 2015, TeamDev Ltd. All rights reserved.
*
* Redistribution and use in source and/or binary forms, with or without
* modification, must retain the above copyright notice and the following
* disclaimer.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRES... | /*
* Copyright 2015, TeamDev Ltd. All rights reserved.
*
* Redistribution and use in source and/or binary forms, with or without
* modification, must retain the above copyright notice and the following
* disclaimer.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRES... |
Fix orthographic camera usage of the glViewport method | 'use strict';
let gl = require('./gl');
let glm = require('gl-matrix');
let mat4 = glm.mat4;
let Camera = require('./Camera');
const _name = 'orthographic.camera';
const _left = -1;
const _bottom = -1;
const _near = 0.1;
const _far = 1;
class OrthographicCamera extends Camera
{
constructor({ name = _name, path, u... | 'use strict';
let gl = require('./gl');
let glm = require('gl-matrix');
let mat4 = glm.mat4;
let Camera = require('./Camera');
const _name = 'orthographic.camera';
const _left = -1;
const _top = -1;
const _near = 0.1;
const _far = 1;
class OrthographicCamera extends Camera
{
constructor({ name = _name, path, unif... |
Add test to check gear value | #!/usr/bin/env python
# -*- coding: utf-8 -*-
line = " 0:00 InitGame: \g_matchmode\1\g_gametype\7\g_allowvote\536871039\g_gear\KQ\mapname\ut4_dust2_v2\gamename\q3urt43\g_survivor\0\auth\0\g_modversion\4.3.4"
def test_initgame():
tmp = line.split()
assert tmp[1] == "InitGame:"
def test_mod43():
ret_val... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
line = " 0:00 InitGame: \g_matchmode\1\g_gametype\7\g_allowvote\536871039\g_gear\KQ\mapname\ut4_dust2_v2\gamename\q3urt43\g_survivor\0\auth\0\g_modversion\4.3.4"
def test_initgame():
tmp = line.split()
assert tmp[1] == "InitGame:"
def test_mod43():
ret_val... |
Update the Portuguese example test | # Portuguese Language Test - Python 3 Only!
from seleniumbase.translate.portuguese import CasoDeTeste
class MinhaClasseDeTeste(CasoDeTeste):
def test_exemplo_1(self):
self.abrir_url("https://pt.wikipedia.org/wiki/")
self.verificar_texto("Wikipédia")
self.verificar_elemento('[title="Língua... | # Portuguese Language Test - Python 3 Only!
from seleniumbase.translate.portuguese import CasoDeTeste
class MinhaClasseDeTeste(CasoDeTeste):
def test_exemplo_1(self):
self.abrir_url("https://pt.wikipedia.org/wiki/")
self.verificar_texto("Wikipédia")
self.verificar_elemento('[title="Visita... |
[tests/traffic] Fix tests for module traffic | import mock
import unittest
import tests.mocks as mocks
from bumblebee.modules.traffic import Module
class TestTrafficModule(unittest.TestCase):
def setUp(self):
mocks.setup_test(self, Module)
def test_default_format(self):
self.assertEqual(self.module._format, "{:.2f}")
def test_get_mi... | import mock
import unittest
import tests.mocks as mocks
from bumblebee.modules.traffic import Module
class TestTrafficModule(unittest.TestCase):
def setUp(self):
mocks.setup_test(self, Module)
def test_default_format(self):
self.assertEqual(self.module._format, "{:.2f}")
def test_get_mi... |
Switch to more visible touchablehighlight | import React, {
Component,
PropTypes,
} from 'react';
import {
TouchableHighlight,
View,
Text,
} from 'react-native';
import { add1Action } from './actions';
import styles from './styles';
import Random from './components/Random';
class Home extends Component {
static contextTypes = {
store: PropTypes... | import React, {
Component,
PropTypes,
} from 'react';
import {
Button,
View,
Text,
} from 'react-native';
import { add1Action } from './actions';
import styles from './styles';
import Random from './components/Random';
class Home extends Component {
static contextTypes = {
store: PropTypes.object,
}... |
Fix for ckeditor in dev | var CKEDITOR_BASEPATH = '/assets/ckeditor/';
CKEDITOR.config.ignoreEmptyParagraph = false;
CKEDITOR.config.allowedContent = true;
CKEDITOR.config.baseHref = '/assets/ckeditor/';
CKEDITOR.config.height = 400;
CKEDITOR.config.width = '95.5%';
CKEDITOR.config.toolbarStartupExpanded = false;
CKEDITOR.config.toolbarGroups =... | CKEDITOR.config.ignoreEmptyParagraph = false;
CKEDITOR.config.allowedContent = true;
CKEDITOR.config.baseHref = '/assets/ckeditor/';
CKEDITOR.config.height = 400;
CKEDITOR.config.width = '95.5%';
CKEDITOR.config.toolbarStartupExpanded = false;
CKEDITOR.config.toolbarGroups = [
{ name: 'document', groups: [ 'mode', 'd... |
Update test for GOVUK Frontend libraries parity | import json
from importlib import metadata
from packaging.version import Version
def test_govuk_frontend_jinja_overrides_on_design_system_v3():
with open("package.json") as package_file:
package_json = json.load(package_file)
govuk_frontend_version = Version(package_json["dependencies"]["govuk-fr... | import json
from importlib import metadata
from packaging.version import Version
def test_govuk_frontend_jinja_overrides_on_design_system_v3():
with open("package.json") as package_file:
package_json = json.load(package_file)
govuk_frontend_version = Version(package_json["dependencies"]["govuk-fr... |
Improve code and remove line feed from host RegEx | (function() {
var __WS_send = WebSocket.prototype.send;
window.__WS_send = WebSocket.prototype.send;
WebSocket.prototype.send = function(data) {
var websocketURL = this.url;
console.log(websocketURL);
try {
var agarBaseURL = 'http://agar.io/?sip=';
var agar... | (function() {
var __WS_send = WebSocket.prototype.send;
window.__WS_send = WebSocket.prototype.send;
WebSocket.prototype.send = function(data) {
console.log(this.url);
try {
var domain = /([^:\/\n]+)\.*agar\.io/.exec(this.url);
console.log("http://agar.io/?sip=" + dom... |
Add fallback to no-icon so icons will show issues | import Ractive from "ractive";
import "../../static/fontawesome/js/fontawesome.js";
import "../../static/fontawesome/js/packs/brands.js";
import "../../static/fontawesome/js/packs/light.js";
import Templates from "../Templates.js";
var Icon = Ractive.extend( {
"template": Templates.getComponent( "Icon" ),
dat... | import Ractive from "ractive";
import "../../static/fontawesome/js/fontawesome.js";
import "../../static/fontawesome/js/packs/brands.js";
import "../../static/fontawesome/js/packs/light.js";
import Templates from "../Templates.js";
var Icon = Ractive.extend( {
"template": Templates.getComponent( "Icon" ),
dat... |
Fix to parse 'now+1y' becase FormValue has already unescaped | package handler
import (
"net/http"
"net/url"
"time"
"github.com/yuuki/dynamond/log"
"github.com/yuuki/dynamond/timeparser"
)
const (
DAYTIME = time.Duration(24 * 60 * 60) * time.Second
)
func Render(w http.ResponseWriter, r *http.Request) {
until := time.Now()
from := until.Add(-DAYTIME)
if v := r.FormVa... | package handler
import (
"net/http"
"time"
"github.com/yuuki/dynamond/log"
"github.com/yuuki/dynamond/timeparser"
)
const (
DAYTIME = time.Duration(24 * 60 * 60) * time.Second
)
func Render(w http.ResponseWriter, r *http.Request) {
until := time.Now()
from := until.Add(-DAYTIME)
if v := r.FormValue("from")... |
Fix NPE when exporting JDO using maven plugin | /*
* Copyright 2012, Mysema Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writin... | /*
* Copyright 2012, Mysema Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writin... |
Add "last" property to enable the calling application to get the file path of the last loaded config file | "use strict";
var use = require("alamid-plugin/use.js");
var path = require("path"),
argv = require("minimist")(process.argv.slice(2));
function dynamicConfig(basePath, fileName) {
var env = dynamicConfig.getEnv(),
filePath = dynamicConfig.getFilePath(basePath, env, fileName),
config;
i... | "use strict";
var use = require("alamid-plugin/use.js");
var path = require("path"),
argv = require("minimist")(process.argv.slice(2));
function dynamicConfig(basePath, fileName) {
var env = dynamicConfig.getEnv(),
filePath = dynamicConfig.getFilePath(basePath, env, fileName),
config;
i... |
Allow transition to exit route
Fixes issue where clicking the "Exit"
button on the exp-thank-you frame would
redirect to the 'participate.survey.index'
route, where the beforeModel hook would
then redirect to the consent form. | import Ember from 'ember';
export default Ember.Route.extend({
setupController(controller, session) {
this._super(controller, session);
controller.set('experiment', this.controllerFor('participate.survey').get('experiment'));
controller.set('session', session);
controller.set('pastSessions', []);
}... | import Ember from 'ember';
export default Ember.Route.extend({
setupController(controller, session) {
this._super(controller, session);
controller.set('experiment', this.controllerFor('participate.survey').get('experiment'));
controller.set('session', session);
controller.set('pastSessions', []);
}... |
Test delegation of options parsing | import test from 'tape'
import chunkify from './index'
import ChunkifyOptions from './options'
import sinon from 'sinon'
let spy_ChunkifyOptions_of = (callback) => {
let spy = sinon.spy(ChunkifyOptions, 'of');
callback(spy);
ChunkifyOptions.of.restore()
};
test('should require an array', t => {
t.throws(() =... | import test from 'tape'
import chunkify from './index'
test('should require an array', t => {
t.throws(() => {
chunkify.array()
}, /Usage: chunkify.array\(Array array, Function fn, \[Object] options\) - bad array/);
t.end()
});
test('should require a function', t => {
t.throws(() => {
chunkify.array(... |
Fix for encoding bug during installation on Windows | from setuptools import setup, find_packages
from jamo import __version__
import sys
if sys.version_info <= (3, 0):
print("ERROR: jamo requires Python 3.0 or later "
"(bleeding edge preferred)", file=sys.stderr)
sys.exit(1)
with open('README.rst', encoding='utf8') as f:
long_description = f.read(... | from setuptools import setup, find_packages
from jamo import __version__
import sys
if sys.version_info <= (3, 0):
print("ERROR: jamo requires Python 3.0 or later "
"(bleeding edge preferred)", file=sys.stderr)
sys.exit(1)
with open('README.rst') as f:
long_description = f.read()
setup(
nam... |
Update stable channel builders to pull from 1.3
Review URL: https://codereview.chromium.org/225263024
git-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@262391 0039d316-1c4b-4281-b951-d872f2087c98 | # Copyright 2013 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.
class Channel(object):
def __init__(self, name, branch, position, category_postfix, priority):
self.branch = branch
self.builder_postfix = '-' + na... | # Copyright 2013 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.
class Channel(object):
def __init__(self, name, branch, position, category_postfix, priority):
self.branch = branch
self.builder_postfix = '-' + na... |
Fix bug where only PDF files in current directory can be found | """Main Module of PDF Splitter"""
import argparse
import os
from PyPDF2 import PdfFileWriter
from Util import all_pdf_files_in_directory, split_on_condition, concat_pdf_pages
parser = \
argparse.ArgumentParser(
description='Split all the pages of multiple PDF files in a directory by document number'
... | """Main Module of PDF Splitter"""
import argparse
import os
from PyPDF2 import PdfFileWriter
from Util import all_pdf_files_in_directory, split_on_condition, concat_pdf_pages
parser = \
argparse.ArgumentParser(
description='Split all the pages of multiple PDF files in a directory by document number'
... |
Update dancer's nginx.conf to find new test root | import subprocess
import sys
import setup_util
from os.path import expanduser
import os
import getpass
def start(args, logfile, errfile):
setup_util.replace_text("dancer/app.pl", "localhost", args.database_host)
setup_util.replace_text("dancer/nginx.conf", "USR", getpass.getuser())
setup_util.replace_text("dance... | import subprocess
import sys
import setup_util
from os.path import expanduser
import os
import getpass
def start(args, logfile, errfile):
setup_util.replace_text("dancer/app.pl", "localhost", args.database_host)
setup_util.replace_text("dancer/nginx.conf", "USR", getpass.getuser())
setup_util.replace_text("dance... |
Update dropdown menu tests to use enzyme. | /* Copyright (C) 2017 Canonical Ltd. */
'use strict';
const React = require('react');
const enzyme = require('enzyme');
const DropdownMenu = require('./dropdown-menu');
describe('Dropdown Menu', function() {
const renderComponent = (options = {}) => enzyme.shallow(
<DropdownMenu.WrappedComponent
handle... | /* Copyright (C) 2017 Canonical Ltd. */
'use strict';
const React = require('react');
const DropdownMenu = require('./dropdown-menu');
const Panel = require('../panel/panel');
const jsTestUtils = require('../../utils/component-test-utils');
describe('Dropdown Menu', function() {
function renderComponent(options... |
Use $location.url() instead of $location.path() to remove url params. | "use strict";
angular.module("hikeio").
factory("navigation", ["$location", function($location) {
var NavigationService = function() {
};
NavigationService.prototype.toSearch = function(query) {
$location.url("/search?q=" + query);
};
NavigationService.prototype.toIndex = function() {
return $locati... | "use strict";
angular.module("hikeio").
factory("navigation", ["$location", function($location) {
var NavigationService = function() {
};
NavigationService.prototype.toSearch = function(query) {
$location.url("/search?q=" + query);
};
NavigationService.prototype.toIndex = function() {
return $locati... |
Remove version bounds for elasticsearch dependency | from setuptools import setup, find_packages
setup(
name="elasticmagic",
version="0.0.0a0",
author="Alexander Koval",
author_email="kovalidis@gmail.com",
description=("Python orm for elasticsearch."),
license="Apache License 2.0",
keywords="elasticsearch dsl",
url="https://github.com/an... | from setuptools import setup, find_packages
setup(
name="elasticmagic",
version="0.0.0a0",
author="Alexander Koval",
author_email="kovalidis@gmail.com",
description=("Python orm for elasticsearch."),
license="Apache License 2.0",
keywords="elasticsearch dsl",
url="https://github.com/an... |
Switch the blog handler over to POST
Makes the Discourse webhook actually work right. | // Copyright © 2017 Michael Howell. All rights reserved.
// The following code is covered by the AGPL-3.0 license.
const selfapi = require('selfapi');
const blog = require('../lib/blog');
const log = require('../lib/log');
// API resource to manage Janitor's Discourse-backed news section.
const blogAPI = module.expo... | // Copyright © 2017 Michael Howell. All rights reserved.
// The following code is covered by the AGPL-3.0 license.
const selfapi = require('selfapi');
const blog = require('../lib/blog');
const log = require('../lib/log');
// API resource to manage Janitor's Discourse-backed news section.
const blogAPI = module.expo... |
Fix callback parameter as optional | "use strict";
var utils = require("../utils");
var log = require("npmlog");
module.exports = function(defaultFuncs, api, ctx) {
return function changeThreadEmoji(emoji, threadID, callback) {
if(!callback) {
callback = function() {};
}
var form = {
'emoji_choice' : emoji,
'thread_or_oth... | "use strict";
var utils = require("../utils");
var log = require("npmlog");
module.exports = function(defaultFuncs, api, ctx) {
return function changeThreadEmoji(emoji, threadID, callback) {
var form = {
'emoji_choice' : emoji,
'thread_or_other_fbid' : threadID
};
defaultFuncs
.post("... |
Remove isRequired from header propTypes | import React from 'react';
import { connect } from 'react-redux';
import { Link } from 'react-router';
import Loader from '../Loader';
import './Header.scss';
export const Header = ({ isFetching }) => (
<div>
<nav className='navbar navbar-inverse container-fluid'>
<Link to='/' className='brand-title navbar... | import React from 'react';
import { connect } from 'react-redux';
import { Link } from 'react-router';
import Loader from '../Loader';
import './Header.scss';
export const Header = ({ isFetching }) => (
<div>
<nav className='navbar navbar-inverse container-fluid'>
<Link to='/' className='brand-title navbar... |
Correct project requirements (sklearn -> scikit-learn) | # coding: utf-8
from setuptools import setup, find_packages
import tom_lib
__author__ = "Adrien Guille, Pavel Soriano"
__email__ = "adrien.guille@univ-lyon2.fr"
version = tom_lib.__version__
setup(
name='tom_lib',
version=version,
packages=find_packages(),
author="Adrien Guille, Pavel Soriano",
au... | # coding: utf-8
from setuptools import setup, find_packages
import tom_lib
__author__ = "Adrien Guille, Pavel Soriano"
__email__ = "adrien.guille@univ-lyon2.fr"
version = tom_lib.__version__
setup(
name='tom_lib',
version=version,
packages=find_packages(),
author="Adrien Guille, Pavel Soriano",
au... |
Update StringIO import for Python3 compat | # USEFUL FUNCTIONS DESIGNED FOR TESTS ##############################################################
import glob
import os
import uuid
from PIL import Image
from django.core.files.base import ContentFile
from django.utils import six
def new_test_image():
"""
Creates an automatically generated test image.
... | # USEFUL FUNCTIONS DESIGNED FOR TESTS ##############################################################
import glob
import os
import uuid
from django.core.files.base import ContentFile
from PIL import Image
from StringIO import StringIO
def new_test_image():
"""
Creates an automatically generated test image.
... |
Use small tdb in wikipedia example |
import traildb.*;
import java.io.FileNotFoundException;
public class Wikipedia {
public static long SESSION_LIMIT = 30 * 60;
public static void sessions(TrailDB tdb) {
TrailDBCursor cursor = tdb.cursorNew();
long n = tdb.numTrails();
long totalSessions = 0;
long totalEvents = 0;
for (long i = 0; i < n; ... |
import traildb.*;
import java.io.FileNotFoundException;
public class Wikipedia {
public static long SESSION_LIMIT = 3600;
public static void sessions(TrailDB tdb) {
TrailDBCursor cursor = tdb.cursorNew();
long n = tdb.numTrails();
long totalSessions = 0;
long totalEvents = 0;
for (long i = 0; i < n; i++... |
Fix bug to only store the 30 most recent points | import pymodm
import slugify
class DevicePlot(pymodm.MongoModel):
device_name = pymodm.fields.CharField()
slug = pymodm.fields.CharField()
plot_title = pymodm.fields.CharField()
x_label = pymodm.fields.CharField()
y_label = pymodm.fields.CharField()
def save(self, *args, **kwargs):
if... | import pymodm
import slugify
class DevicePlot(pymodm.MongoModel):
device_name = pymodm.fields.CharField()
slug = pymodm.fields.CharField()
plot_title = pymodm.fields.CharField()
x_label = pymodm.fields.CharField()
y_label = pymodm.fields.CharField()
def save(self, *args, **kwargs):
if... |
Fix ClearCommand Unit Test Failing | package guitests;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
public class ClearCommandTest extends TaskManagerGuiTest {
@Test
public void clear() {
System.out.println(taskListPanel.getTask(4));
//verify a non-empty list can be cleared
assertTrue(taskListPanel.i... | 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... |
Migrate to new Storage API
for Django 1.8 | """
A storage implementation that overwrites exiting files in the storage
See "Writing a custom storage system"
(https://docs.djangoproject.com/en/1.3/howto/custom-file-storage/) and
the discussion on stackoverflow on "ImageField overwrite image file"
(http://stackoverflow.com/questions/9522759/imagefield-overwrite-im... | """
A storage implementation that overwrites exiting files in the storage
See "Writing a custom storage system"
(https://docs.djangoproject.com/en/1.3/howto/custom-file-storage/) and
the discussion on stackoverflow on "ImageField overwrite image file"
(http://stackoverflow.com/questions/9522759/imagefield-overwrite-im... |
[tasks] Allow to modify the is_default flag | from zou.app.models.task_status import TaskStatus
from zou.app.services import tasks_service
from .base import BaseModelResource, BaseModelsResource
class TaskStatusesResource(BaseModelsResource):
def __init__(self):
BaseModelsResource.__init__(self, TaskStatus)
def check_read_permissions(self):
... | from zou.app.models.task_status import TaskStatus
from zou.app.services import tasks_service
from .base import BaseModelResource, BaseModelsResource
class TaskStatusesResource(BaseModelsResource):
def __init__(self):
BaseModelsResource.__init__(self, TaskStatus)
def check_read_permissions(self):
... |
Revert "Revert "Reduce the time we keep expired remotes sessions and fix comment"" | // Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.config.server.maintenance;
import com.yahoo.vespa.config.server.ApplicationRepository;
import com.yahoo.vespa.curator.Curator;
import java.time.Duration;
/**
* Removes inact... | // Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.config.server.maintenance;
import com.yahoo.vespa.config.server.ApplicationRepository;
import com.yahoo.vespa.curator.Curator;
import java.time.Duration;
/**
* Removes inact... |
Fix first path check on builder helpers | /**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. 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. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the ... | /**
* Copyright 2012-2013 Amazon.com, Inc. or its affiliates. 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. A copy of
* the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the ... |
Disable pull-to-refresh and overscroll glow | import React from 'react'
import ReactDOM from 'react-dom'
import { createGlobalStyle } from 'styled-components'
import { App } from './App'
import woff2 from './fonts/source-sans-pro-v11-latin-regular.woff2'
import woff from './fonts/source-sans-pro-v11-latin-regular.woff'
import registerServiceWorker from './registe... | import React from 'react'
import ReactDOM from 'react-dom'
import { createGlobalStyle } from 'styled-components'
import { App } from './App'
import woff2 from './fonts/source-sans-pro-v11-latin-regular.woff2'
import woff from './fonts/source-sans-pro-v11-latin-regular.woff'
import registerServiceWorker from './registe... |
Update numpy array of tuples with np version | # Numpy converts a list of tuples *not* into an array of tuples, but into a 2D
# array instead.
import numpy as np # 1.11.1
list_of_tuples = [(1, 2), (3, 4)]
print('list of tuples:', list_of_tuples, 'type:', type(list_of_tuples))
A = np.array(list_of_tuples)
print('numpy array of tuples:', A, 'type:', type(A))
# I... | # Numpy converts a list of tuples *not* into an array of tuples, but into a 2D
# array instead.
list_of_tuples = [(1, 2), (3, 4)]
import numpy as np
print('list of tuples:', list_of_tuples, 'type:', type(list_of_tuples))
A = np.array(list_of_tuples)
print('numpy array of tuples:', A, 'type:', type(A))
# It makes comp... |
Append slash to urls in example project | # Django settings for example_project project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'example_project.sqlite3',
}
}
SITE_ID = 1
SECRET_KEY = 'u%38dln@$1!7w#cxi4np504^sa3_skv5aekad)jy_u0v2mc+nr'
TEMPLATE_LOADERS = (
... | # Django settings for example_project project.
DEBUG = True
TEMPLATE_DEBUG = DEBUG
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'example_project.sqlite3',
}
}
SITE_ID = 1
SECRET_KEY = 'u%38dln@$1!7w#cxi4np504^sa3_skv5aekad)jy_u0v2mc+nr'
TEMPLATE_LOADERS = (
... |
[NEW] Remove cart line can redirect to referer | <?php
class order_RemoveCartLineAction extends f_action_BaseAction
{
/**
* @param Context $context
* @param Request $request
*/
public function _execute($context, $request)
{
$cartService = order_CartService::getInstance();
$cart = $cartService->getDocumentInstanceFromSession();
$cartLineIndex = $request... | <?php
class order_RemoveCartLineAction extends f_action_BaseAction
{
/**
* @param Context $context
* @param Request $request
*/
public function _execute($context, $request)
{
$cartService = order_CartService::getInstance();
$cart = $cartService->getDocumentInstanceFromSession();
$cartLineIndex = $request... |
Fix NullPointerException when restoring backup | package com.benny.openlauncher.widget;
import android.content.Context;
import android.support.v7.preference.PreferenceCategory;
import android.support.v7.preference.PreferenceViewHolder;
import android.util.AttributeSet;
import android.widget.TextView;
import com.benny.openlauncher.util.AppSettings;
public class Col... | package com.benny.openlauncher.widget;
import android.content.Context;
import android.support.v7.preference.PreferenceCategory;
import android.support.v7.preference.PreferenceViewHolder;
import android.util.AttributeSet;
import android.widget.TextView;
import com.benny.openlauncher.manager.Setup;
public class ColorP... |
Fix read articles by tag test | <?php
namespace Tests\Feature;
use Tests\IntegrationTestCase;
use Tests\TestCase;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class ReadArticlesByTagTest extends IntegrationTestCase
{
use Datab... | <?php
namespace Tests\Feature;
use Tests\IntegrationTestCase;
use Tests\TestCase;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
class ReadArticlesByTagTest extends IntegrationTestCase
{
use Datab... |
Fix property access mistake
Bootstrapping should work now | <?php
namespace Herzen\Admission\Orm;
use \Doctrine\ORM\Tools\Setup;
use \Doctrine\ORM\EntityManager;
abstract class Bootstrapper {
protected static $em;
public static function getEntityManager() {
return self::$em;
}
public static function bootstrap($connectionFile) {
$libRoot = __... | <?php
namespace Herzen\Admission\Orm;
use \Doctrine\ORM\Tools\Setup;
use \Doctrine\ORM\EntityManager;
abstract class Bootstrapper {
protected static $em;
public static function getEntityManager() {
return self::$em;
}
protected static function bootstrap($connectionFile) {
$libRoot =... |
Add a class to past stops for styling purposes | import Ember from 'ember';
import moment from 'moment';
import stringToHue from 'bus-detective/utils/string-to-hue';
var inject = Ember.inject;
export default Ember.Component.extend({
tagName: 'li',
clock: inject.service(),
attributeBindings: ['style'],
classNames: ['rt-arrival'],
classNameBindings: ['isPast... | import Ember from 'ember';
import moment from 'moment';
import stringToHue from 'bus-detective/utils/string-to-hue';
var inject = Ember.inject;
export default Ember.Component.extend({
tagName: 'li',
clock: inject.service(),
attributeBindings: ['style'],
classNames: ['rt-arrival'],
timeFromNow: Ember.compute... |
Add more default args so tests pass in py3+ | from __future__ import unicode_literals
from argparse import Namespace
import mock
import pytest
from kafka_utils.kafka_cluster_manager.cluster_info \
.partition_count_balancer import PartitionCountBalancer
from kafka_utils.kafka_cluster_manager.cmds import decommission
from tests.kafka_cluster_manager.helper im... | from __future__ import unicode_literals
from argparse import Namespace
import mock
import pytest
from kafka_utils.kafka_cluster_manager.cluster_info \
.partition_count_balancer import PartitionCountBalancer
from kafka_utils.kafka_cluster_manager.cmds import decommission
from tests.kafka_cluster_manager.helper im... |
Fix for not setting Gofig config dirs (Rebased)
This patch was originally commit
d04023572e47e5c18fa549fe7f7de301e8470c63, but it failed to build in CI
as it was not rebased off of master prior to being merged. This is the
rebased patch.
This patch fixes the issue where the Gofig's global (/etc) and user
($HOME) dire... | package core
import (
"fmt"
"github.com/akutz/gofig"
"github.com/akutz/gotil"
"github.com/emccode/rexray/util"
)
func init() {
initDrivers()
gofig.SetGlobalConfigPath(util.EtcDirPath())
gofig.SetUserConfigPath(fmt.Sprintf("%s/.rexray", gotil.HomeDir()))
gofig.Register(globalRegistration())
gofig.Register(d... | package core
import (
"github.com/akutz/gofig"
)
func init() {
initDrivers()
gofig.Register(globalRegistration())
gofig.Register(driverRegistration())
}
func globalRegistration() *gofig.Registration {
r := gofig.NewRegistration("Global")
r.Yaml(`
rexray:
host: tcp://:7979
logLevel: warn
`)
r.Key(gofig... |
Fix incremental compilation for lua classes that require a superclass name resolution | package net.wizardsoflua.annotation;
import static java.lang.annotation.ElementType.TYPE;
import java.lang.annotation.Target;
/**
* We use class retention, because otherwise this annotation is not available on unchanged classes
* during eclipses incremental compilation.
*
* @author Adrodoc
*/
@Target(TYPE)
pub... | package net.wizardsoflua.annotation;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.SOURCE;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
@Retention(SOURCE)
@Target(TYPE)
public @interface GenerateLuaDoc {
/**
* The name of th... |
Use PORT environment variable when it is available because Heroku | import 'babel-polyfill'
import bodyParser from 'body-parser'
import express from 'express'
import log from './log'
import appRenderer from './middleware/app-renderer'
import { apolloServer } from 'apollo-server'
import { schema, resolvers } from './api/schema'
import mocks from './api/mocks'
process.on('uncaughtExcept... | import 'babel-polyfill'
import bodyParser from 'body-parser'
import express from 'express'
import log from './log'
import appRenderer from './middleware/app-renderer'
import { apolloServer } from 'apollo-server'
import { schema, resolvers } from './api/schema'
import mocks from './api/mocks'
process.on('uncaughtExcept... |
Rewrite "The Perry Bible Fellowship" after feed change | from comics.aggregator.crawler import CrawlerBase, CrawlerImage
from comics.core.comic_data import ComicDataBase
class ComicData(ComicDataBase):
name = "The Perry Bible Fellowship"
language = "en"
url = "http://www.pbfcomics.com/"
start_date = "2001-01-01"
rights = "Nicholas Gurewitch"
class Cra... | from comics.aggregator.crawler import CrawlerBase, CrawlerImage
from comics.core.comic_data import ComicDataBase
class ComicData(ComicDataBase):
name = "The Perry Bible Fellowship"
language = "en"
url = "http://www.pbfcomics.com/"
start_date = "2001-01-01"
rights = "Nicholas Gurewitch"
class Cra... |
Add $in operator if object is an array | var methods = {};
methods.setRelated = function(relationName, value) {};
methods.getRelated = function(relationName) {
var doc = this;
var Class = doc.constructor;
// If there is already a reference to the relation object(s) stored in the
// "_references" object then we can take it without looking in collect... | var methods = {};
methods.setRelated = function(relationName, value) {};
methods.getRelated = function(relationName) {
var doc = this;
var Class = doc.constructor;
// If there is already a reference to the relation object(s) stored in the
// "_references" object then we can take it without looking in collect... |
Remove object from local storage hook | 'use strict';
var AbstractStore = require('stores/AbstractStore');
var assign = require('object-assign');
var GeoAppDispatcher = require('../dispatcher/GeoAppDispatcher');
var GeoAppActionsConstants = require('constants/GeoAppActions');
var LocalStoreDataProvider = require('stores/LocalStorageDataProvider');
var GeoO... | 'use strict';
var AbstractStore = require('stores/AbstractStore');
var assign = require('object-assign');
var GeoAppDispatcher = require('../dispatcher/GeoAppDispatcher');
var GeoAppActionsConstants = require('constants/GeoAppActions');
var LocalStoreDataProvider = require('stores/LocalStorageDataProvider');
var GeoO... |
Remove lru-cache dependency from stylus | Package.describe({
summary: 'Expressive, dynamic, robust CSS',
version: "2.0.0_511"
});
Package.registerBuildPlugin({
name: 'compileStylusBatch',
use: ['ecmascript', 'caching-compiler'],
sources: [
'plugin/compile-stylus.js'
],
npmDependencies: {
stylus: "https://github.com/meteor/stylus/tarball/... | Package.describe({
summary: 'Expressive, dynamic, robust CSS',
version: "2.0.0_511"
});
Package.registerBuildPlugin({
name: 'compileStylusBatch',
use: ['ecmascript', 'caching-compiler'],
sources: [
'plugin/compile-stylus.js'
],
npmDependencies: {
stylus: "https://github.com/meteor/stylus/tarball/... |
Add clean task for package publishing | /// <binding AfterBuild='nuget-pack' />
"use strict";
var gulp = require('gulp'),
path = require('path'),
exec = require('child_process').exec,
fs = require('fs');
var solutionFolder = path.resolve(__dirname, '..');
var projectFolder = path.join(solutionFolder, 'MAB.SimpleMapper');
var distFolder = path.... | /// <binding AfterBuild='nuget-pack' />
"use strict";
var gulp = require('gulp'),
path = require('path'),
exec = require('child_process').exec,
fs = require('fs');
var solutionFolder = path.resolve(__dirname, '..');
var projectFolder = path.join(solutionFolder, 'MAB.SimpleMapper');
var distFolder = path.... |
Fix output stream and return code | <?php
if ( posix_geteuid() ) {
fwrite( STDERR, "\033[1;31mError:\033[0m Please run `ee` with root privileges." );
exit( 1 );
}
// Can be used by plugins/themes to check if EE is running or not
define( 'EE', true );
define( 'EE_VERSION', trim( file_get_contents( EE_ROOT . '/VERSION' ) ) );
define( 'EE_START_MICROTIM... | <?php
if( posix_geteuid() ) {
echo "\033[1;31mError:\033[0m Please run `ee` with root privileges.";
return;
}
// Can be used by plugins/themes to check if EE is running or not
define( 'EE', true );
define( 'EE_VERSION', trim( file_get_contents( EE_ROOT . '/VERSION' ) ) );
define( 'EE_START_MICROTIME', microtime( tr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.