text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
[FIX] Use non ideal state component to show no challenges | import React from 'react';
import PropTypes from 'prop-types';
import { Spinner, NonIdealState } from '@blueprintjs/core';
import ChallengeCard from './ChallengeCard';
class ChallengeList extends React.Component {
static propTypes = {
challenges: PropTypes.array
}
render() {
const { challenges } = this.props;... | import React from 'react';
import PropTypes from 'prop-types';
import { Spinner } from '@blueprintjs/core';
import ChallengeCard from './ChallengeCard';
class ChallengeList extends React.Component {
static propTypes = {
challenges: PropTypes.array
}
render() {
const { challenges } = this.props;
if (challen... |
Make the interface clear when it comes to what happens when the container can't find the bean
git-svn-id: ba1d8d5a2a2c535e023d6080c1e5c29aa0f5364e@389 3a8262b2-faa5-11dc-8610-ff947880b6b2 | /*
* Copyright 2005 Joe Walker
*
* 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 i... | /*
* Copyright 2005 Joe Walker
*
* 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 i... |
Add toggleIsCopied to UI actions | import * as types from '../constants/UIConstants'
export function selectKey(id) {
return { type: types.SELECT_KEY, id }
}
export function toggleComposer() {
return { type: types.TOGGLE_COMPOSER }
}
export function toggleGeneratingKey() {
return { type: types.TOGGLE_GENERATING_KEY }
}
export function toggleIsC... | import * as types from '../constants/UIConstants'
export function selectKey(id) {
return { type: types.SELECT_KEY, id }
}
export function toggleComposer() {
return { type: types.TOGGLE_COMPOSER }
}
export function toggleGeneratingKey() {
return { type: types.TOGGLE_GENERATING_KEY }
}
export function clearSele... |
Fix for 1.6 & 1.7 | try:
from django.conf.urls.defaults import patterns, include, url
except ImportError:
from django.conf.urls import patterns, url, include
import settings
import os
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$',
'django.views.generic.simple.direct_to_t... | from django.conf.urls.defaults import patterns, include, url
import settings
import os
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
url(r'^$',
'django.views.generic.simple.direct_to_template',
{'template': 'index.html'}
),
url(r'^test/', 'test_app.... |
Make signup just point to landing page | """voteswap URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... | """voteswap URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-ba... |
Increase logwait to 10 instead of 5 secs | import os; # needed for opening/compiling file
import time; # needed for delay
def getPath(allowCancel = True):
"""Ask the user for lilypond file path and return it as string.
Takes one boolean argument as to whether message should say cancelling is allowed or not. Defaults to true, however this may not be suita... | import os; # needed for opening/compiling file
import time; # needed for delay
def getPath(allowCancel = True):
"""Ask the user for lilypond file path and return it as string.
Takes one boolean argument as to whether message should say cancelling is allowed or not. Defaults to true, however this may not be suita... |
Add lxml and beautifulsoup dependencies |
from setuptools import setup
setup(
name = "javasphinx",
packages = ["javasphinx"],
version = "0.9.8",
author = "Chris Thunes",
author_email = "cthunes@brewtab.com",
url = "http://github.com/bronto/javasphinx",
description = "Sphinx extension for documenting Java projects",
classifiers... |
from setuptools import setup
setup(
name = "javasphinx",
packages = ["javasphinx"],
version = "0.9.8",
author = "Chris Thunes",
author_email = "cthunes@brewtab.com",
url = "http://github.com/bronto/javasphinx",
description = "Sphinx extension for documenting Java projects",
classifiers... |
[test] Fix tests for improved lazy loading | /*
* require-directory-test.js: Tests for `requireDir` and `requireDirLazy`
* methods.
*
* (C) 2011, Nodejitsu Inc.
* MIT LICENSE
*
*/
var assert = require('assert'),
path = require('path'),
vows = require('vows'),
macros = require('./helpers/macros'),
utile = require('../');
var requireFixture... | /*
* require-directory-test.js: Tests for `requireDir` and `requireDirLazy`
* methods.
*
* (C) 2011, Nodejitsu Inc.
* MIT LICENSE
*
*/
var assert = require('assert'),
path = require('path'),
vows = require('vows'),
macros = require('./helpers/macros'),
utile = require('../');
var requireFixture... |
Change the due datetime field for calculating late | <thead>
<tr>
<th>Item Name</th>
<th>Borrower Name</th>
<th>Borrower NetID</th>
<th>Pickup Time</th>
<th>Due Time</th>
</tr>
</thead>
<tbody>
<?php
include '../config.php';
include '../db.php';
$fdb = new FlatFileDB($db_filename, $table_sep, $cell_sep);
foreach ($fdb->getTab... | <thead>
<tr>
<th>Item Name</th>
<th>Borrower Name</th>
<th>Borrower NetID</th>
<th>Pickup Time</th>
<th>Due Time</th>
</tr>
</thead>
<tbody>
<?php
include '../config.php';
include '../db.php';
$fdb = new FlatFileDB($db_filename, $table_sep, $cell_sep);
foreach ($fdb->getTab... |
Support user config. Located at phoxy_config function | <?php
error_reporting(E_ALL); ini_set('display_errors', '1');
include_once('connect.php');
if (!count($_GET))
{
include_once('index.html');
exit();
}
if (!function_exists("phoxy_conf"))
include_once("config.php");
function phoxy_default_conf()
{
return array(
"ip" => $_SERVER['REMOTE_ADDR'],
"sit... | <?php
error_reporting(E_ALL); ini_set('display_errors', '1');
include_once('connect.php');
if (!count($_GET))
{
include_once('index.html');
exit();
}
function conf()
{
return array(
"ip" => $_SERVER['REMOTE_ADDR'],
"site" => "http://localhost/phoxy/"
);
}
if (isset($_GET['api']))
{
$file = $_... |
Use the release version rather than public version for GitHub links | #!/usr/bin/env python3
from importlib.metadata import version
from packaging.version import parse
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx.ext.extlinks",
"sphinx_autodoc_typehints",
"sphinxcontrib.asyncio",
"sphinx_tabs.tabs",
]
templates_path = ["_templates"]
so... | #!/usr/bin/env python3
from importlib.metadata import version
from packaging.version import parse
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.intersphinx",
"sphinx.ext.extlinks",
"sphinx_autodoc_typehints",
"sphinxcontrib.asyncio",
"sphinx_tabs.tabs",
]
templates_path = ["_templates"]
so... |
Use stream.write() instead of console.log() | 'use strict';
var assign = require('object-assign');
var chalk = require('chalk');
var ProgressBar = require('progress');
/**
* Progress bar download plugin
*
* @param {Object} opts
* @api public
*/
module.exports = function (opts) {
return function (res, url, cb) {
opts = opts || { info: 'cyan' };
opts.st... | 'use strict';
var assign = require('object-assign');
var chalk = require('chalk');
var ProgressBar = require('progress');
/**
* Progress bar download plugin
*
* @param {Object} opts
* @api public
*/
module.exports = function (opts) {
return function (res, url, cb) {
opts = opts || { info: 'cyan' };
if (re... |
Make the proxy server listen port configurable | package main
import (
"net"
"os"
"flag"
"strconv"
)
func handleConnection(conn net.Conn) {
connection := NewConnection(conn)
defer connection.Close()
connection.Handle()
}
func acceptedConnsChannel(listener net.Listener) chan net.Conn {
channel := make(chan net.Conn)
go func() {
for {
conn, err := list... | package main
import (
"net"
"os"
)
func handleConnection(conn net.Conn) {
connection := NewConnection(conn)
defer connection.Close()
connection.Handle()
}
func acceptedConnsChannel(listener net.Listener) chan net.Conn {
channel := make(chan net.Conn)
go func() {
for {
conn, err := listener.Accept()
if... |
Fix broken GithubAPIClient constructor args | from __future__ import print_function
from getpass import getpass, _raw_input
import logging
import sys
from argh import ArghParser, arg
from ghtools import cli
from ghtools.api import envkey, GithubAPIClient
log = logging.getLogger(__name__)
parser = ArghParser()
def login_if_needed(gh, scopes):
if gh.logged_... | from __future__ import print_function
from getpass import getpass, _raw_input
import logging
import sys
from argh import ArghParser, arg
from ghtools import cli
from ghtools.api import envkey, GithubAPIClient
log = logging.getLogger(__name__)
parser = ArghParser()
def login_if_needed(gh, scopes):
if gh.logged_... |
Rename node stream to avoid confusion with web streams | const Readable = require('readable-stream')
module.exports = function (snapshot) {
return checkCache.bind(null, snapshot._namespace)
}
function checkCache (namespace, req, rsp) {
if (rsp.createReadStream) return
const url = new URL(req.url)
return global.caches.open('planktos-' + namespace)
.then(c => c.mat... | const ReadableStream = require('readable-stream')
module.exports = function (snapshot) {
return checkCache.bind(null, snapshot._namespace)
}
function checkCache (namespace, req, rsp) {
if (rsp.createReadStream) return
const url = new URL(req.url)
return global.caches.open('planktos-' + namespace)
.then(c =>... |
Fix py/capnp build for python 3.7 | from setuptools import setup
from setuptools.extension import Extension
import buildtools
# You might also need to set PKG_CONFIG_PATH=/path/to/lib/pkgconfig if
# your capnp is installed in a non-default location
CAPNP = buildtools.read_pkg_config(['capnp'])
setup(
name = 'capnp',
packages = [
'cap... | from setuptools import setup
from setuptools.extension import Extension
import buildtools
# You might also need to set PKG_CONFIG_PATH=/path/to/lib/pkgconfig if
# your capnp is installed in a non-default location
CAPNP = buildtools.read_pkg_config(['capnp'])
setup(
name = 'capnp',
packages = [
'cap... |
Update javadoc to cover desugaring
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=258431740 | /*
* Copyright 2016 The Error Prone 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 ... | /*
* Copyright 2016 The Error Prone 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 ... |
Rework node-server-generator to use new util. | const generators = require('yeoman-generator');
const util = require('../../util/util.js');
const prompts = util.prompts.nodeServer;
const generator = generators.Base.extend({
// Cannot use arrow notation due to this object not referencing the correct object.
constructor: function () {
generators.Base.apply(this... | const generators = require('yeoman-generator');
const util = require('../util.js');
const generator = generators.Base.extend({
// Cannot use arrow notation due to this object not referencing the correct object.
constructor: function () {
generators.Base.apply(this, arguments);
util.generatorConstructor.call(th... |
Add a new passing test for invalid week numbers. | import unittest
from hypothesis import given
from hypothesis.strategies import integers
from hypothesis.extra.datetime import datetimes
import qual
from datetime import date, MINYEAR, MAXYEAR
class TestIsoUtils(unittest.TestCase):
@given(datetimes(timezones=[]))
def test_round_trip_date(self, dt):
d ... | import unittest
from hypothesis import given
from hypothesis.strategies import integers
from hypothesis.extra.datetime import datetimes
import qual
from datetime import date, MINYEAR, MAXYEAR
class TestIsoUtils(unittest.TestCase):
@given(datetimes(timezones=[]))
def test_round_trip_date(self, dt):
d ... |
[Bugfix] Use memo parameter in TapBailout.copy | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
exc.py
~~~~~~
Exceptions for TAP file handling.
(c) BSD 3-clause.
"""
from __future__ import division, absolute_import
from __future__ import print_function, unicode_literals
import os
import sys
__all__ = ['TapParseError', 'TapMissingPlan',
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
exc.py
~~~~~~
Exceptions for TAP file handling.
(c) BSD 3-clause.
"""
from __future__ import division, absolute_import
from __future__ import print_function, unicode_literals
import os
import sys
__all__ = ['TapParseError', 'TapMissingPlan',
... |
Create a compound index for status and type | module.exports = [
{
collection: 'entries',
spec: { locationId: 1 },
options: {},
},
{
collection: 'events',
spec: { time: 1 },
options: {},
},
{
collection: 'events',
spec: { locationId: 1 },
options: {},
},
{
collection: 'locations',
spec: { geom: '2dsphere' }... | module.exports = [
{
collection: 'entries',
spec: { locationId: 1 },
options: {},
},
{
collection: 'events',
spec: { time: 1 },
options: {},
},
{
collection: 'events',
spec: { locationId: 1 },
options: {},
},
{
collection: 'locations',
spec: { geom: '2dsphere' }... |
Use fmt.Print instead of the print builtin in stripReader | // Package deansify strips ANSI escape codes from either a named file or
// from STDIN.
package deansify
import (
"bufio"
"fmt"
"io"
"log"
"os"
"regexp"
)
var version = "0.0.2"
var ansiRegexp = regexp.MustCompile("\x1b[^m]*m")
func stripAnsi(s string) string {
return ansiRegexp.ReplaceAllLiteralString(s, "")
... | // Package deansify strips ANSI escape codes from either a named file or
// from STDIN.
package deansify
import (
"bufio"
"io"
"log"
"os"
"regexp"
)
var version = "0.0.2"
var ansiRegexp = regexp.MustCompile("\x1b[^m]*m")
func stripAnsi(s string) string {
return ansiRegexp.ReplaceAllLiteralString(s, "")
}
func... |
Change development status to Alpha
It better reflects the project's immature state. | #!/usr/bin/env python2
from distutils.core import setup
setup(name='visram',
version='0.1.0',
description='Graphical RAM/CPU Visualizer',
license='MIT',
author='Matthew Pfeiffer',
author_email='spferical@gmail.com',
url='http://github.com/Spferical/visram',
packages=['visram'... | #!/usr/bin/env python2
from distutils.core import setup
setup(name='visram',
version='0.1.0',
description='Graphical RAM/CPU Visualizer',
license='MIT',
author='Matthew Pfeiffer',
author_email='spferical@gmail.com',
url='http://github.com/Spferical/visram',
packages=['visram'... |
Rename image sizes, add store image size. | <?php
function brewtah_theme_support() {
// Add language support
load_theme_textdomain('brewtah', get_template_directory() . '/languages');
// Add menu support
add_theme_support('menus');
// Add post thumbnail support: http://codex.wordpress.org/Post_Thumbnails
add_theme_support('post-thumbnai... | <?php
function brewtah_theme_support() {
// Add language support
load_theme_textdomain('brewtah', get_template_directory() . '/languages');
// Add menu support
add_theme_support('menus');
// Add post thumbnail support: http://codex.wordpress.org/Post_Thumbnails
add_theme_support('post-thumbnai... |
Add the test task dependency back to the default gulp task | 'use strict';
var gulp = require('gulp');
var options = {
name: 'ec2prices',
dependantFiles: ['node_modules/babel/browser-polyfill.js'],
mainFiles: [
'app/scripts/app.es6',
'app/scripts/**/!(*.spec|*.mock).{js,es6}'
],
templateFiles: ['app/scripts/**/*.htm{,l}'],
specFiles: ['app/scripts/**/*.{spe... | 'use strict';
var gulp = require('gulp');
var options = {
name: 'ec2prices',
dependantFiles: ['node_modules/babel/browser-polyfill.js'],
mainFiles: [
'app/scripts/app.es6',
'app/scripts/**/!(*.spec|*.mock).{js,es6}'
],
templateFiles: ['app/scripts/**/*.htm{,l}'],
specFiles: ['app/scripts/**/*.{spe... |
Add commment to stop recorder once done with it | package vcr_test
import (
"io/ioutil"
"net/http"
"strings"
"testing"
"github.com/dnaeon/go-vcr/recorder"
)
func TestSimple(t *testing.T) {
// Start our recorder
r, err := recorder.New("fixtures/golang-org")
if err != nil {
t.Fatal(err)
}
defer r.Stop() // Make sure recorder is stopped once done with it
... | package vcr_test
import (
"io/ioutil"
"net/http"
"strings"
"testing"
"github.com/dnaeon/go-vcr/recorder"
)
func TestSimple(t *testing.T) {
// Start our recorder
r, err := recorder.New("fixtures/golang-org")
if err != nil {
t.Fatal(err)
}
defer r.Stop()
// Create an HTTP client and inject our transport
... |
Mark all descendants of Defs as seen after a draw
When adding clipping paths in a def and changing properties of that clipping path (or its descendants), redraw is triggered only once as updates are never marked as seen.
This change makes sure to call `markUpdateSeen` on all descendants of the Defs node on a `draw`. | /**
* Copyright (c) 2015-present, Horcrux.
* All rights reserved.
*
* This source code is licensed under the MIT-style license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.horcrux.svg;
import android.graphics.Canvas;
import android.graphics.Paint;
/**
* Shadow node fo... | /**
* Copyright (c) 2015-present, Horcrux.
* All rights reserved.
*
* This source code is licensed under the MIT-style license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.horcrux.svg;
import android.graphics.Canvas;
import android.graphics.Paint;
/**
* Shadow node fo... |
Clean up for Dungeon loot code | package techreborn.world;
import java.util.Arrays;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraftforge.common.ChestGenHooks;
import techreborn.items.ItemIngots;
public class DungeonLoot {
public static void init()
{
... | package techreborn.world;
import net.minecraft.item.ItemStack;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraftforge.common.ChestGenHooks;
import techreborn.items.ItemIngots;
public class DungeonLoot {
public static void init()
{
generate(ItemIngots.getIngotByName("steel"), 5);
}
p... |
Make the call to gladiator to unsubscribe a user | <?php
namespace Northstar\Http\Controllers\Web;
use Illuminate\Http\Request;
use DoSomething\Gateway\Gladiator;
use Illuminate\Routing\Controller as BaseController;
class UnsubscribeController extends BaseController
{
/**
* Gladiator instance.
*
* @var \DoSomething\Gateway\Gladiator
*/
pr... | <?php
namespace Northstar\Http\Controllers\Web;
use Illuminate\Http\Request;
use DoSomething\Gateway\Gladiator;
use Illuminate\Routing\Controller as BaseController;
class UnsubscribeController extends BaseController
{
/**
* Gladiator instance.
*
* @var \DoSomething\Gateway\Gladiator
*/
pr... |
Fix bug with multiprocessing and Nose. | #!/usr/bin/env python
import sys
from setuptools import setup, find_packages
try:
import multiprocessing # Seems to fix http://bugs.python.org/issue15881
except ImportError:
pass
setup_requires = []
if 'nosetests' in sys.argv[1:]:
setup_requires.append('nose')
setup(
name='modeldict',
version... | #!/usr/bin/env python
try:
from setuptools import setup, find_packages
from setuptools.command.test import test
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
from setuptools.command.test import test
setup(
name='modeldi... |
Set server listen to 0.0.0.0 | import Express from 'express';
import path from 'path';
import webpack from 'webpack';
import webpackDevMiddleware from 'webpack-dev-middleware';
import webpackHotMiddleware from 'webpack-hot-middleware';
const webpackConfig = require('../webpack.dev.config');
const webpackCompiler = webpack(webpackConfig);
const webp... | import Express from 'express';
import path from 'path';
import webpack from 'webpack';
import webpackDevMiddleware from 'webpack-dev-middleware';
import webpackHotMiddleware from 'webpack-hot-middleware';
const webpackConfig = require('../webpack.dev.config');
const webpackCompiler = webpack(webpackConfig);
const webp... |
Update User-Agent: Node -> node | var resources = require('./lib').resources;
var maybePromise = require('./lib').maybePromise;
var version = require('./package.json').version;
module.exports = function client(apiKey, config) {
//
// #client provides the top-level interface to making API requests to Button.
// It requires a Button API key, which... | var resources = require('./lib').resources;
var maybePromise = require('./lib').maybePromise;
var version = require('./package.json').version;
module.exports = function client(apiKey, config) {
//
// #client provides the top-level interface to making API requests to Button.
// It requires a Button API key, which... |
Set radial max amount to more reasonable 16. | /* Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
* Copyright (c) 2010 Mr.doob, rhyolight, bebraw
*/
function RadialMirror() {
this.init();
}
RadialMirror.prototype = {
type: 'instance',
attributes: {'amount': {'type': 'int', 'min': 1, 'max': 16, 'value': 1}},
in... | /* Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
* Copyright (c) 2010 Mr.doob, rhyolight, bebraw
*/
function RadialMirror() {
this.init();
}
RadialMirror.prototype = {
type: 'instance',
attributes: {'amount': {'type': 'int', 'min': 1, 'max': 64, 'value': 1}},
in... |
Change standard function to arrow function | document.addEventListener("DOMContentLoaded", () => {
main();
});
const main = () => {
const button = document.getElementById("start");
button.addEventListener("click", () => {
const num = 1000000;
let text = "";
for (let i = 0; i < 1024; i++) {
text = text + "a";
}
for (let i = 0; i < ... | document.addEventListener("DOMContentLoaded", function() {
main();
});
const main = () => {
const button = document.getElementById("start");
button.addEventListener("click", () => {
const num = 1000000;
let text = "";
for (let i = 0; i < 1024; i++) {
text = text + "a";
}
for (let i = 0;... |
Rename cookie keys to be consistent with naming | 'use strict';
/**
* @module code-project/handler/select-messaging-platform
*/
/**
* Stores the messaging platform information
* @param {Request} request - Hapi Request
* @param {Reply} reply - Hapi Reply
* @returns {Null} responds with a redirect
*/
function selectMessagingPlatform (request, reply) {
const... | 'use strict';
/**
* @module code-project/handler/select-messaging-platform
*/
/**
* Stores the messaging platform information
* @param {Request} request - Hapi Request
* @param {Reply} reply - Hapi Reply
* @returns {Null} responds with a redirect
*/
function selectMessagingPlatform (request, reply) {
const... |
Fix state machine using wrong variable | #!/usr/bin/env python
import rospy
class StopStates(object):
NORMAL = 0
FULL_STOP = 1
IGNORE_STOP_SIGNS = 2
class StopSign(object):
def __init__(self):
self.state = StopStates.NORMAL
self.stopDuration = 2
self.ignoreDuration = 4
def stopSignDetected(self):
self... | #!/usr/bin/env python
import rospy
class StopStates(object):
NORMAL = 0
FULL_STOP = 1
IGNORE_STOP_SIGNS = 2
class StopSign(object):
def __init__(self):
self.state = StopStates.NORMAL
self.stopDuration = 2
self.ignoreDuration = 2
def stopSignDetected(self):
self... |
Fix force_unicode for Python 3, use force_text() | """
Internal utils for search.
"""
from django.utils.encoding import force_text
from django.utils.html import strip_tags
import six
def get_search_field_values(contentitem):
"""
Extract the search fields from the model.
"""
plugin = contentitem.plugin
values = []
for field_name in plugin.searc... | """
Internal utils for search.
"""
from django.utils.encoding import force_unicode
from django.utils.html import strip_tags
import six
def get_search_field_values(contentitem):
"""
Extract the search fields from the model.
"""
plugin = contentitem.plugin
values = []
for field_name in plugin.se... |
Throw exception when primary tests fail | import os
import sys
import contextlib
import subprocess
@contextlib.contextmanager
def binding(binding):
"""Prepare an environment for a specific binding"""
sys.stderr.write("""\
#
# Running tests with %s..
#
""" % binding)
os.environ["QT_PREFERRED_BINDING"] = binding
try:
yield
except... | import os
import sys
import contextlib
import subprocess
@contextlib.contextmanager
def binding(binding):
"""Prepare an environment for a specific binding"""
sys.stderr.write("""\
#
# Running tests with %s..
#
""" % binding)
os.environ["QT_PREFERRED_BINDING"] = binding
try:
yield
except... |
Fix PRIVATE_PORT env variable read | 'use strict';
const EventEmitter = require('events');
const createPublicWebApp = require('./web/public');
const createPrivateWebApp = require('./web/private');
const actions = require('./core/actions');
const logger = require('./lib/logger');
const emitter = new EventEmitter();
const ... | 'use strict';
const EventEmitter = require('events');
const createPublicWebApp = require('./web/public');
const createPrivateWebApp = require('./web/private');
const actions = require('./core/actions');
const logger = require('./lib/logger');
const emitter = new EventEmitter();
const ... |
Add check for empty tags | from .request import url
class Search(object):
def __init__(self, key=None, q=[], sf="created_at", sd="desc"):
self._parameters = {
"key": key,
"q": [str(tag).strip() for tag in q if tag],
"sf": sf,
"sd": sd
}
@property
def parameters(self):
return self._parameters
@proper... | from .request import url
class Search(object):
def __init__(self, key=None, q=[], sf="created_at", sd="desc"):
self._parameters = {
"key": key,
"q": q,
"sf": sf,
"sd": sd
}
@property
def parameters(self):
return self._parameters
@property
def url(self):
return url(**... |
Make `is_authenticated` a property access rather than a function call.
This is a change in Django that was still functional for compatibility
reasons until recently, but ultimately should be an attribute. | from django.conf import settings
from django.utils.deprecation import MiddlewareMixin
from server.models import *
class AddToBU(MiddlewareMixin):
"""
This middleware will add the current user to any BU's they've not already
been explicitly added to.
"""
def process_view(self, request, view_func,... | from django.conf import settings
from django.utils.deprecation import MiddlewareMixin
from server.models import *
class AddToBU(MiddlewareMixin):
"""
This middleware will add the current user to any BU's they've not already
been explicitly added to.
"""
def process_view(self, request, view_func,... |
Clarify missing output file error | var React = require('react');
var evaluate = require('eval');
function ReactToHtmlWebpackPlugin(destPath, srcPath) {
this.srcPath = srcPath;
this.destPath = destPath;
}
ReactToHtmlWebpackPlugin.prototype.apply = function(compiler) {
compiler.plugin('emit', function(compiler, done) {
try {
var asset =... | var React = require('react');
var evaluate = require('eval');
function ReactToHtmlWebpackPlugin(destPath, srcPath) {
this.srcPath = srcPath;
this.destPath = destPath;
}
ReactToHtmlWebpackPlugin.prototype.apply = function(compiler) {
compiler.plugin('emit', function(compiler, done) {
try {
var asset =... |
Add another TBD for future reference | from blinkytape import color
class Gradient(object):
# TBD: If this had a length it would also work as a streak; consider
def __init__(self, pixel_count, start_color, end_color):
self._pixels = self._rgb_gradient(pixel_count, start_color, end_color)
@property
def pixels(self):
return l... | from blinkytape import color
class Gradient(object):
def __init__(self, pixel_count, start_color, end_color):
self._pixels = self._rgb_gradient(pixel_count, start_color, end_color)
@property
def pixels(self):
return list(self._pixels)
def _rgb_gradient(self, pixel_count, start_color, ... |
Fix to use single quotes instead of double quotes | const binding = require('bindings')('contextify');
const ContextifyContext = binding.ContextifyContext;
const ContextifyScript = binding.ContextifyScript;
function Contextify (sandbox) {
if (typeof sandbox != 'object') {
sandbox = {};
}
let ctx = new ContextifyContext(sandbox);
sandbox.run = f... | const binding = require('bindings')('contextify');
const ContextifyContext = binding.ContextifyContext;
const ContextifyScript = binding.ContextifyScript;
function Contextify (sandbox) {
if (typeof sandbox != 'object') {
sandbox = {};
}
let ctx = new ContextifyContext(sandbox);
sandbox.run = f... |
Make log event format more readable | /*
* Copyright 2018, EnMasse authors.
* License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html).
*/
package io.enmasse.k8s.api;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class LogEventLogger implements EventLogger {
private static final Logger log... | /*
* Copyright 2018, EnMasse authors.
* License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html).
*/
package io.enmasse.k8s.api;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class LogEventLogger implements EventLogger {
private static final Logger log... |
Load pagination per_page limit from configuration.
Signed-off-by: crynobone <e1a543840a942eb68427510a8a483282a7bfeddf@gmail.com> | <?php namespace Orchestra\Story\Routing;
use Illuminate\Routing\Controllers\Controller;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\View;
use Orchestra\Story\Model\Content;
class HomeController extends Controller {
/**
* Get landing page.
*
* @access public
* @return Response
*/
... | <?php namespace Orchestra\Story\Routing;
use Illuminate\Routing\Controllers\Controller;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\View;
use Orchestra\Story\Model\Content;
class HomeController extends Controller {
/**
* Get landing page.
*
* @access public
* @return Response
*/
... |
Fix Flask example to allow freezing | import logging
import webview
from contextlib import redirect_stdout
from io import StringIO
from threading import Thread, Lock
from time import sleep
from server import run_server
server_lock = Lock()
logger = logging.getLogger(__name__)
def url_ok(url, port):
# Use httplib on Python 2
try:
from h... | from threading import Thread, Lock
import logging
import webview
from time import sleep
from server import run_server
server_lock = Lock()
logger = logging.getLogger(__name__)
def url_ok(url, port):
# Use httplib on Python 2
try:
from http.client import HTTPConnection
except ImportError:
... |
Make sure there actually is an object | var txt_cache='604800';chrome.webRequest.onHeadersReceived.addListener(function(object){'use strict';if(object){var object_type=object.type.toLowerCase();if((object_type!=='main_frame')&&(object_type!=='sub_frame')&&(object_type!=='xmlhttprequest')){var headers=object.responseHeaders,len=headers.length-1,f=false,elem=n... | var txt_cache='604800';chrome.webRequest.onHeadersReceived.addListener(function(object){'use strict';var object_type=object.type.toLowerCase();if((object_type!=='main_frame')&&(object_type!=='sub_frame')&&(object_type!=='xmlhttprequest')){var headers=object.responseHeaders,len=headers.length-1,f=false,elem=null;do{elem... |
Add period to keep grammar nazis and godoc happy.
Signed-off-by: Jon Seymour <44f878afe53efc66b76772bd845eb65944ed8232@ninjablocks.com> | package ninja
import (
"time"
)
type ServiceClient struct {
conn *Connection
topic string
}
//
// OnEvent builds a simple subscriber which supports pulling apart the topic
//
// err := sm.conn.GetServiceClient("$device/:deviceid/channel/:channelid")
// .OnEvent("state", func(params *YourEven... | package ninja
import (
"time"
)
type ServiceClient struct {
conn *Connection
topic string
}
//
// OnEvent builds a simple subscriber which supports pulling apart the topic
//
// err := sm.conn.GetServiceClient("$device/:deviceid/channel/:channelid")
// .OnEvent("state", func(params *YourEven... |
Add comment for event state | /*
* Copyright 2017 Axway Software
*
* 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 t... | /*
* Copyright 2017 Axway Software
*
* 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 t... |
Move the package comments above package | /*
Copyright 2018 The Kubernetes 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 to in writing, ... | /*
Copyright 2018 The Kubernetes 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 to in writing, ... |
Add class active to first tabs link | export default function normalizeTabControllerClick() {
const hashLinks = document.querySelectorAll(".js-tabs-control a[href^='#']");
const firstLink = document.querySelector('.js-tabs-control > a');
function setActiveLink(event) {
Array.prototype.forEach.call(hashLinks, (link) => {
link.classList.remove('acti... | export default function normalizeTabControllerClick() {
const hashLinks = document.querySelectorAll(".js-tabs-control a[href^='#']");
const firstLink = document.querySelector('.js-tabs-control > a');
function setActiveLink(event) {
Array.prototype.forEach.call(hashLinks, (link) => {
link.classList.remove('acti... |
Update SUPPORTS_TRANSACTIONS attribute to what is expected by Django 1.2.
Patch contributed by Felix Leong. Thanks.
Fixes Issue #162. | #!/usr/bin/python2.4
#
# Copyright 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | #!/usr/bin/python2.4
#
# Copyright 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... |
Allow counting sort to handle negative numbers | public class CountingSort {
public static int[] countingSort(int[] unsorted) {
int minValue = min(unsorted);
int maxValue = max(unsorted);
// Adjust max so that min equals zero
int offset = -minValue;
int adjustedMax = maxValue + offset;
// Count occurrences of each value in unsorted
int[] counts = new... | public class CountingSort {
public static int[] countingSort(int[] unsorted) {
int maxValue = max(unsorted);
// Count occurrences of each value in unsorted
int[] counts = new int[maxValue + 1];
for(int value : unsorted)
counts[value]++;
for(int i = 1; i < counts.length; i++)
counts[i] += counts[i - ... |
Set return on parent when using api::create | <?php
/**
* Created by PhpStorm.
* User: mark.smith
* Date: 04/09/2017
* Time: 19:31
*/
namespace AppBundle\Utils\Api;
use AppBundle\Utils\Api;
class Redis extends Api implements \AppBundle\Utils\Api\ApiInterface
{
protected $storageClass = 'redis';
public function __construct()
{
$this->se... | <?php
/**
* Created by PhpStorm.
* User: mark.smith
* Date: 04/09/2017
* Time: 19:31
*/
namespace AppBundle\Utils\Api;
use AppBundle\Utils\Api;
class Redis extends Api implements \AppBundle\Utils\Api\ApiInterface
{
protected $storageClass = 'redis';
public function __construct()
{
$this->se... |
Document that Close must be called on the reader returned from NewStreamReader | package fasthttp
import (
"bufio"
"io"
"runtime/debug"
"sync"
)
// StreamWriter must write data to w.
//
// Usually StreamWriter writes data to w in a loop (aka 'data streaming').
//
// StreamWriter must return immediately if w returns error.
//
// Since the written data is buffered, do not forget calling w.Flush... | package fasthttp
import (
"bufio"
"io"
"runtime/debug"
"sync"
)
// StreamWriter must write data to w.
//
// Usually StreamWriter writes data to w in a loop (aka 'data streaming').
//
// StreamWriter must return immediately if w returns error.
//
// Since the written data is buffered, do not forget calling w.Flush... |
Update tonic example for new API | var jss = require('jss');
var extend = require('jss-extend');
var nested = require('jss-nested');
var camelCase = require('jss-camel-case');
var defaultUnit = require('jss-default-unit');
var perdido = require('perdido');
jss.use(extend());
jss.use(nested());
jss.use(camelCase());
jss.use(defaultUnit());
var testGri... | var jss = require('jss');
var extend = require('jss-extend');
var nested = require('jss-nested');
var camelCase = require('jss-camel-case');
var defaultUnit = require('jss-default-unit');
var perdido = require('perdido');
jss.use(extend());
jss.use(nested());
jss.use(camelCase());
jss.use(defaultUnit());
var testGri... |
Fix token types for comments in SOM
Signed-off-by: Stefan Marr <46f1a0bd5592a2f9244ca321b129902a06b53e03@stefan-marr.de> | package som.langserv.som;
import java.util.ArrayList;
import java.util.List;
import som.langserv.SemanticTokenType;
import trufflesom.compiler.Lexer;
public class SomLexer extends Lexer {
private List<Integer> commentTokens = new ArrayList<Integer>();
protected SomLexer(final String content) {
super(conten... | package som.langserv.som;
import java.util.ArrayList;
import java.util.List;
import trufflesom.compiler.Lexer;
public class SomLexer extends Lexer {
private List<Integer> commentTokens = new ArrayList<Integer>();
protected SomLexer(final String content) {
super(content);
}
@Override
protected void s... |
Make status the last optional arg. | from django.http import HttpResponse, HttpResponseServerError
from django.template import RequestContext, loader
from django.conf import settings
from maintenancemode.http import HttpResponseTemporaryUnavailable
import logging
logger = logging.getLogger('comrade.views.simple')
def status(request):
logger.info("R... | from django.http import HttpResponse, HttpResponseServerError
from django.template import RequestContext, loader
from django.conf import settings
from maintenancemode.http import HttpResponseTemporaryUnavailable
import logging
logger = logging.getLogger('comrade.views.simple')
def status(request):
logger.info("R... |
Fix eslint errors in leaderboard.js | 'use strict'
let RatView = Marionette.ItemView.extend({
tagName: 'tr',
template: Handlebars.compile(
'<td>{{CMDRname}}</td>' +
'<td>{{successfulRescueCount}}</td>'
)
})
Marionette.CompositeView.extend({
childView: RatView,
childViewContainer: 'tbody',
className: 'card',
initialize: function ... | var LeaderboardView, RatView
RatView = Marionette.ItemView.extend({
tagName: 'tr',
template: Handlebars.compile(
'<td>{{CMDRname}}</td>' +
'<td>{{successfulRescueCount}}</td>'
)
})
LeaderboardView = Marionette.CompositeView.extend({
childView: RatView,
childViewContainer: 'tbody',
className: 'c... |
Remove unnecessary operation when sorting users | var _ = require("lodash");
module.exports = Chan;
Chan.Type = {
CHANNEL: "channel",
LOBBY: "lobby",
QUERY: "query"
};
var id = 0;
function Chan(attr) {
_.merge(this, _.extend({
id: id++,
messages: [],
name: "",
topic: "",
type: Chan.Type.CHANNEL,
unread: 0,
users: []
}, attr));
}
Chan.prototype.... | var _ = require("lodash");
module.exports = Chan;
Chan.Type = {
CHANNEL: "channel",
LOBBY: "lobby",
QUERY: "query"
};
var id = 0;
function Chan(attr) {
_.merge(this, _.extend({
id: id++,
messages: [],
name: "",
topic: "",
type: Chan.Type.CHANNEL,
unread: 0,
users: []
}, attr));
}
Chan.prototype.... |
Use variable for key name | /*
Copyright 2016 OpenMarket 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 writing, software
... | /*
Copyright 2016 OpenMarket 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 writing, software
... |
Hide logger from outside of the package | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from __future__ import absolute_import
from tabledata import DataError, InvalidHeaderNameError, InvalidTableNameError
from .__version__ import __author__, __copyright__, __email__, __license__, __version__
from ._constant impo... | # encoding: utf-8
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""
from __future__ import absolute_import
from tabledata import DataError, InvalidHeaderNameError, InvalidTableNameError
from .__version__ import __author__, __copyright__, __email__, __license__, __version__
from ._constant impo... |
Use the PlaygroundQuickLook(reflecting:) constructor in this test case | # TestREPLQuickLookObject.py
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See http://swift.org/LICENSE.txt for license information
# See http://swift.org/CO... | # TestREPLQuickLookObject.py
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See http://swift.org/LICENSE.txt for license information
# See http://swift.org/CO... |
Fix functions into Session class | <?php
/*
----------------------------------------------------------------------
FusionInventory
Copyright (C) 2010-2011 by the FusionInventory Development Team.
http://www.fusioninventory.org/ http://forge.fusioninventory.org/
----------------------------------------------------------------------
... | <?php
/*
----------------------------------------------------------------------
FusionInventory
Copyright (C) 2010-2011 by the FusionInventory Development Team.
http://www.fusioninventory.org/ http://forge.fusioninventory.org/
----------------------------------------------------------------------
... |
Fix no message attribute in exception
For py35, message attribute in exception seems removed.
We should directly get the string message from exception object
if message attribute not presented. And since get message attribute
already been deprecated. We should remove sopport on
exception.message after we fully jump to... | #
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... | #
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# ... |
Fix the mock Service to implement "Debug" also. | package mocks
import "time"
type Service struct {
URLCall struct {
ReturnURL string
Err error
}
StartCall struct {
Called bool
Err error
}
StopCall struct {
Called bool
Err error
}
WaitForBootCall struct {
Timeout time.Duration
Err error
}
}
func (s *Service) URL() (string,... | package mocks
import "time"
type Service struct {
URLCall struct {
ReturnURL string
Err error
}
StartCall struct {
Called bool
Err error
}
StopCall struct {
Called bool
Err error
}
WaitForBootCall struct {
Timeout time.Duration
Err error
}
}
func (s *Service) URL() (string,... |
Use proxy methods for getPrecision() and getRecall(). | package edu.ntnu.idi.goldfish;
import org.apache.mahout.cf.taste.eval.IRStatistics;
public class Result {
String recommender;
// RMSE
double RMSE;
//
double AAD;
// IR stats (precision, recall)
IRStatistics irStats;
public Result(String recommender, double RMSE, double AAD, IRStatistics irStats) {... | package edu.ntnu.idi.goldfish;
import org.apache.mahout.cf.taste.eval.IRStatistics;
public class Result {
String recommender;
// RMSE
double RMSE;
//
double AAD;
// IR stats (precision, recall)
IRStatistics irStats;
public Result(String recommender, double RMSE, double AAD, IRStatistics irStats) {... |
Add json5 and toml to supported formats, add Python 3.5 to supported Python versions | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(
name='anymarkup-core',
version='0.6.2',
description='Core library for anymarkup',
long_description=''.join(open('README.rst').readlines()),
keywords='xml, yaml, toml, json, json5, ini',
author='Sl... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
setup(
name='anymarkup-core',
version='0.6.2',
description='Core library for anymarkup',
long_description=''.join(open('README.rst').readlines()),
keywords='xml, yaml, json, ini',
author='Slavek Kabrda',... |
Rename form BucketlistItem to Activity | from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, BooleanField, TextAreaField
from wtforms.validators import DataRequired, Length, Email
class SignupForm(FlaskForm):
"""Render and validate the signup form"""
email = StringField("Email", validators=[DataRequired(), Email(message="... | from flask_wtf import FlaskForm
from wtforms import StringField, PasswordField, BooleanField, TextAreaField
from wtforms.validators import DataRequired, Length, Email
class SignupForm(FlaskForm):
"""Render and validate the signup form"""
email = StringField("Email", validators=[DataRequired(), Email(message="... |
Update decimal tests to only run on text/none.
Change-Id: I9a35f9e1687171fc3f06c17516bca2ea4b9af9e1
Reviewed-on: http://gerrit.ent.cloudera.com:8080/2217
Tested-by: jenkins
Reviewed-by: Ishaan Joshi <d1d1e60202ec9f2503deb1b724986485a125d802@cloudera.com> | #!/usr/bin/env python
# Copyright (c) 2012 Cloudera, Inc. All rights reserved.
# Targeted tests for decimal type.
#
import logging
import pytest
from copy import copy
from tests.common.test_vector import *
from tests.common.impala_test_suite import *
class TestDecimalQueries(ImpalaTestSuite):
BATCH_SIZES = [0, 1]
... | #!/usr/bin/env python
# Copyright (c) 2012 Cloudera, Inc. All rights reserved.
# Targeted tests for decimal type.
#
import logging
import pytest
from copy import copy
from tests.common.test_vector import *
from tests.common.impala_test_suite import *
class TestDecimalQueries(ImpalaTestSuite):
BATCH_SIZES = [0, 1]
... |
Allow for 2nd argument to be destination filename | #!/usr/bin/env node
require('coffee-script').register()
var fs = require('fs'),
indentation = require('../lib/indentation'),
buf, emblemFile, hbsFile, output;
if (process.argv.length < 3) {
if (process.stdin.isTTY) {
console.log('USAGE: emblem2hbs filetoconvert.emblem or in piped format `pbcopy | emble... | #!/usr/bin/env node
require('coffee-script').register()
var fs = require('fs'),
indentation = require('../lib/indentation'),
buf, emblemFile, hbsFile, output;
if (process.argv.length < 3) {
if (process.stdin.isTTY) {
console.log('USAGE: emblem2hbs filetoconvert.emblem or in piped format `pbcopy | emble... |
Fix incorrect dotenv path fallback | /* eslint-disable import/no-dynamic-require,global-require */
import fs from 'fs';
import path from 'path';
import log from 'fancy-log';
import dotenv from 'dotenv';
import config from './lib/config';
/**
* Update `cwd` if `package.json` is a symlink.
*/
const packageLocation = fs.realpathSync(path.resolve(process.... | /* eslint-disable import/no-dynamic-require,global-require */
import fs from 'fs';
import path from 'path';
import log from 'fancy-log';
import dotenv from 'dotenv';
import config from './lib/config';
/**
* Update `cwd` if `package.json` is a symlink.
*/
const packageLocation = fs.realpathSync(path.resolve(process.... |
Enable passing custom columns to be serialized | 'use strict';
const p = require('path');
const _ = require('lodash');
const passport = require('passport');
// const User = require('../services/users/model');
const config = require(p.join(process.cwd(), 'server/config/membership'));
let serializeUser;
let deserializeUser;
const pick = ['id', 'username', 'email'... | 'use strict';
// const p = require('path');
const _ = require('lodash');
const passport = require('passport');
// const User = require('../services/users/model');
// const config = require(p.join(process.cwd(), 'server/config/membership'));
let serializeUser;
let deserializeUser;
// if (typeof config.serializeUse... |
Switch tests back to tinkerpop graph api | package com.gentics.mesh.test;
import javax.annotation.PostConstruct;
import org.elasticsearch.node.Node;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import com.gentics.mesh.cli.Mesh;
imp... | package com.gentics.mesh.test;
import javax.annotation.PostConstruct;
import org.elasticsearch.node.Node;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import com.gentics.mesh.cli.Mesh;
imp... |
Add a text vs number composite statement example | import Local
import Global
"Global.x:" <input data=Global.x dataType="number" style={ display:'block' }/>
"Global.y:" <input data=Global.y dataType="number" style={ display:'block' }/>
let five = 5,
two = 2,
greeting = "hello ",
name = "world"
<table>
<tr>
<th>"Global.x + Global.y"</th>
Global.x + Global.y
... | import Local
import Global
"Global.x:" <input data=Global.x dataType="number" style={ display:'block' }/>
"Global.y:" <input data=Global.y dataType="number" style={ display:'block' }/>
let five = 5,
two = 2,
greeting = "hello ",
name = "world"
<table>
<tr>
<th>"Global.x + Global.y"</th>
Global.x + Global.y
... |
Fix the condition when a monster has no flags. | <?php
class Monster implements Robbo\Presenter\PresentableInterface
{
use MagicModel;
protected $data;
public function load($data)
{
$this->data = $data;
}
public function getPresenter()
{
return new Presenters\Monster($this);
}
public function getMinDamage()
... | <?php
class Monster implements Robbo\Presenter\PresentableInterface
{
use MagicModel;
protected $data;
public function load($data)
{
$this->data = $data;
}
public function getPresenter()
{
return new Presenters\Monster($this);
}
public function getMinDamage()
... |
Change package name to 'cirm' to avoid confusion. | #
# Copyright 2012 University of Southern California
#
# 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 2012 University of Southern California
#
# 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... |
Adjust import statements to be sorted | from ..auth_provider import KnowledgeAuthProvider
from ..models import User
from ..utils.auth import is_safe_url
import flask
from flask import (
flash,
redirect,
render_template,
request,
url_for,
)
from flask_login import login_user
class DebugAuthProvider(KnowledgeAuthProvider):
_registry_k... | import flask
from flask import request, render_template, flash, redirect, url_for
from flask_login import login_user
from ..models import User
from ..utils.auth import is_safe_url
from ..auth_provider import KnowledgeAuthProvider
class DebugAuthProvider(KnowledgeAuthProvider):
_registry_keys = ['debug']
de... |
Add a newline before @param (again)
Co-authored-by: Zach Ghera <7d293d7aa3d73ce243886706f2742c0d78eb864e@gmail.com> | /**
* Format a timestamp (in milliseconds) into a pretty string with just the time.
*
* @param {int} msTimestamp
* @param {string} timezone
* @returns {string} Time formatted into a string like "10:19 AM".
*/
export function timestampToTimeFormatted(msTimestamp, timezone = "America/New_York") {
let date = new... | /**
* Format a timestamp (in milliseconds) into a pretty string with just the time.
*
* @param {int} msTimestamp
* @param {string} timezone
* @returns {string} Time formatted into a string like "10:19 AM".
*/
export function timestampToTimeFormatted(msTimestamp, timezone = "America/New_York") {
let date = new... |
Update foundation asset and fixed minor html syntax error.
Signed-off-by: crynobone <e1a543840a942eb68427510a8a483282a7bfeddf@gmail.com> | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>{{ HTML::title() }}</title>
<?php
$asset = Asset::container('cello.frontend');
$asset->style('foundation', 'bundles/orchestra/vendor/foundation/css/foundation.min.css');
$asset->scrip... | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>{{ HTML::title() }}</title>
<?php
$asset = Asset::container('cello.frontend');
$asset->style('foundation', 'bundles/orchestra/vendor/foundation/stylesheets/foundation.min.css');
$asse... |
Use 3.3 api for redirects | <?php defined('SYSPATH') or die('No direct script access.');
class Controller_User extends Controller_Website
{
public function action_logout()
{
Auth::instance()->logout(TRUE);
$this->redirect(url::site());
}
public function action_login()
{
$this->template->title = 'Lo... | <?php defined('SYSPATH') or die('No direct script access.');
class Controller_User extends Controller_Website
{
public function action_logout()
{
Auth::instance()->logout(TRUE);
$this->request->redirect(url::site());
}
public function action_login()
{
$this->template->titl... |
Fix CTRL-ALT-DEL button on Spice consoles
Appears that the current Spice JS library requires polluting the global namespace for this feature to work.
https://github.com/himdel/spice-html5-bower/blob/master/spiceHTML5/TODO#L28
https://bugzilla.redhat.com/show_bug.cgi?id=1491387 | //= require jquery
//= require spice-html5-bower
//= require_tree ../locale
//= require gettext/all
$(function() {
var host = window.location.hostname;
var encrypt = window.location.protocol === 'https:';
var port = encrypt ? 443 : 80;
if (window.location.port) {
port = window.location.port;
}
$('#ctr... | //= require jquery
//= require spice-html5-bower
//= require_tree ../locale
//= require gettext/all
$(function() {
var host = window.location.hostname;
var encrypt = window.location.protocol === 'https:';
var port = encrypt ? 443 : 80;
if (window.location.port) {
port = window.location.port;
}
$('#ctr... |
Set password in env var | import os
from fabric.api import env, run, local, sudo, settings
env.password = os.getenv('SUDO_PASSWORD', None)
assert env.password
def build_local():
local('docker-compose run app go build -v')
local('mv app/app ./application')
def copy_app():
local('scp application {0}@{1}:/home/{0}'.format(env.use... | from fabric.api import env, run, local, sudo, settings
from fabric.contrib.console import confirm
def build_local():
local('docker-compose run app go build -v')
local('mv app/app ./application')
def copy_app():
local('scp application {0}@{1}:/home/{0}'.format(env.user, env.hosts[0]))
def stop_service(... |
[test] Test for colons in the password | var assert = require('assert'),
vows = require('vows'),
basicAuthParser = require('../');
vows.describe('basic-auth-parser').addBatch({
'When using `basic-auth-parser`': {
'with a correct string input': {
topic: basicAuthParser('Basic YWRtaW46cGFzc3dvcmQ='),
'it should return parsed data': fu... | var assert = require('assert'),
vows = require('vows'),
basicAuthParser = require('../');
vows.describe('basic-auth-parser').addBatch({
'When using `basic-auth-parser`': {
'with a correct string input': {
topic: basicAuthParser('Basic YWRtaW46cGFzc3dvcmQ='),
'it should return parsed data': fu... |
Add test for new file upload to existing bucket | import unittest, boto, os
from bucketeer import commit
class BuckeeterTest(unittest.TestCase):
# Constants - TODO move to config file
global existing_bucket, test_dir, test_file
existing_bucket = 'bucket.exists'
test_dir = 'bucketeer_test_dir'
test_file = 'bucketeer_test_file'
def setUp(self):
connec... | import unittest, boto, os
from bucketeer import commit
class BuckeeterTest(unittest.TestCase):
# Constants - TODO move to config file
global existing_bucket, test_dir, test_file
existing_bucket = 'bucket.exists'
test_dir = 'bucketeer_test_dir'
test_file = 'bucketeer_test_file'
def setUp(self):
connec... |
Make the test a bit less idiotic. | package com.topsy.jmxproxy.jmx.tests;
import com.topsy.jmxproxy.jmx.ConnectionCredentials;
import org.junit.Test;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
public class ConnectionCredentialsTest {
@Test
public void compareEquals() throws Exception {
final ... | package com.topsy.jmxproxy.jmx.tests;
import com.topsy.jmxproxy.jmx.ConnectionCredentials;
import org.junit.Test;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
public class ConnectionCredentialsTest {
@Test
public void compareEquals() throws Exception {
final ... |
FIX (sharing gists): Fix shared gist not being loaded properly and now displays gist files. | 'use strict';
function sharedCtrl($scope, ghAPI, gistData, $routeParams, $location, notificationService, $window) {
$scope.author = $routeParams.user;
ghAPI.gist($routeParams.id).then(function(gist) {
$scope.gist = gist;
});
console.log($scope.gist);
$scope.fork = function() {
g... | 'use strict';
function sharedCtrl($scope, ghAPI, gistData, $routeParams, $location, notificationService, $window) {
$scope.author = $routeParams.user;
$scope.gist = ghAPI.gist($routeParams.id);
$scope.fork = function() {
ghAPI.fork($routeParams.id).then(function(data) {
notificationS... |
Format the clock time when a bus will arrive at the stop | 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: ['timeline__event'],
classNameBindings: ['i... | 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: ['timeline__event'],
classNameBindings: ['i... |
Add logging to background assign | """
Assign articles from AmCAT sets for background processing in nlpipe
"""
import sys, argparse
from nlpipe import tasks
from nlpipe.pipeline import parse_background
from nlpipe.backend import get_input_ids
from nlpipe.celery import app
import logging
FORMAT = '[%(asctime)-15s] %(message)s'
logging.basicConfig(form... | """
Assign articles from AmCAT sets for background processing in nlpipe
"""
import sys, argparse
from nlpipe import tasks
from nlpipe.pipeline import parse_background
from nlpipe.backend import get_input_ids
from nlpipe.celery import app
modules = {n.split(".")[-1]: t for (n,t) in app.tasks.iteritems() if n.startswi... |
Write Views to Global Obj. | var views = [];
$.get("http://127.0.0.1:1338/views", function (views) {
window.views = views;
});
function loadData(view) {
$.get("http://127.0.0.1:1338/data/" + view, function (views) {
views.forEach(function (view) {
var table = `<div class="table-responsive"><table class="table table-striped"><thead><tr>`;
... | function loadData(view) {
$.get("http://127.0.0.1:1338/data/" + view, function (views) {
views.forEach(function (view) {
var table = `<div class="table-responsive"><table class="table table-striped"><thead><tr>`;
view.headers.forEach(function (header) {
table += "<th>" + header.text + "</th>";
});
... |
Remove limit from ember post API calls
ref #3004
- this is unnecessary and causing bugs | import styleBody from 'ghost/mixins/style-body';
import AuthenticatedRoute from 'ghost/routes/authenticated';
var paginationSettings = {
status: 'all',
staticPages: 'all',
page: 1
};
var PostsRoute = AuthenticatedRoute.extend(styleBody, {
classNames: ['manage'],
model: function () {
// us... | import styleBody from 'ghost/mixins/style-body';
import AuthenticatedRoute from 'ghost/routes/authenticated';
var paginationSettings = {
status: 'all',
staticPages: 'all',
page: 1,
limit: 15
};
var PostsRoute = AuthenticatedRoute.extend(styleBody, {
classNames: ['manage'],
model: function () ... |
Simplify keeping test temp files
- adds withSuppressCleanup method that can be used in the Rule directly
- useful when manually debugging a single test | /*
* Copyright 2010 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applica... | /*
* Copyright 2010 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applica... |
core: Use a mixer mock in tests | from __future__ import absolute_import, unicode_literals
import unittest
import mock
from mopidy import core, mixer
class CoreMixerTest(unittest.TestCase):
def setUp(self): # noqa: N802
self.mixer = mock.Mock(spec=mixer.Mixer)
self.core = core.Core(mixer=self.mixer, backends=[])
def test_... | from __future__ import absolute_import, unicode_literals
import unittest
from mopidy import core
class CoreMixerTest(unittest.TestCase):
def setUp(self): # noqa: N802
self.core = core.Core(mixer=None, backends=[])
def test_volume(self):
self.assertEqual(self.core.mixer.get_volume(), None)
... |
Change tests to ignore Illustrator's faulty bounds calculation of symbols. | module('Placed Symbol');
test('placedSymbol bounds', function() {
var doc = new Document();
var path = new Path.Circle([50, 50], 50);
path.strokeWidth = 1;
path.strokeCap = 'round';
path.strokeJoin = 'round';
compareRectangles(path.strokeBounds,
{ x: -0.5, y: -0.5, width: 101, height: 101 },
'Path initial bo... | module('Placed Symbol');
test('placedSymbol bounds', function() {
var doc = new Document();
var path = new Path.Circle([50, 50], 50);
path.strokeWidth = 1;
path.strokeCap = 'round';
path.strokeJoin = 'round';
compareRectangles(path.strokeBounds,
new Rectangle(-0.5, -0.5, 101, 101),
'Path initial bounds.');
... |
Handle posts with malformed email addresses | <?php
namespace duncan3dc\Twitter\Posts;
use duncan3dc\DomParser\HtmlParser;
class Php extends AbstractPost
{
public $hostname = "http://news.php.net";
public $avatar = "/images/php.png";
public function __construct(array $row)
{
parent::__construct($row);
$a = (new HtmlParser($this... | <?php
namespace duncan3dc\Twitter\Posts;
use duncan3dc\DomParser\HtmlParser;
class Php extends AbstractPost
{
public $hostname = "http://news.php.net";
public $avatar = "/images/php.png";
public function __construct(array $row)
{
parent::__construct($row);
$a = (new HtmlParser($this... |
Fix content block test failing because of layout changes | <?php
namespace Backend\Modules\ContentBlocks\Tests\Action;
use Backend\Core\Tests\BackendWebTestCase;
use Symfony\Bundle\FrameworkBundle\Client;
class IndexTest extends BackendWebTestCase
{
public function testAuthenticationIsNeeded(Client $client): void
{
self::assertAuthenticationIsNeeded($client,... | <?php
namespace Backend\Modules\ContentBlocks\Tests\Action;
use Backend\Core\Tests\BackendWebTestCase;
use Symfony\Bundle\FrameworkBundle\Client;
class IndexTest extends BackendWebTestCase
{
public function testAuthenticationIsNeeded(Client $client): void
{
self::assertAuthenticationIsNeeded($client,... |
Add inline SVG feature detection | (function() {
// Feature detection results
const supports = {};
// Detect localStorage support
try {
localStorage.setItem('test', 'test');
localStorage.removeItem('test');
supports.localStorage = true;
} catch (e) {
supports.localStorage = false;
}
// Detect inline SVG support
support... | (function() {
// Feature detection results
const supports = {};
// Detect localStorage support
try {
localStorage.setItem('test', 'test');
localStorage.removeItem('test');
supports.localStorage = true;
} catch (e) {
supports.localStorage = false;
}
// Add ios class to body on iOS device... |
Make the calendar server a singleton | package com.gruppe27.fellesprosjekt.server;
import com.esotericsoftware.kryonet.Connection;
import com.esotericsoftware.kryonet.Server;
import com.gruppe27.fellesprosjekt.common.Network;
import java.io.IOException;
public class CalendarServer {
private static Server server = null;
DatabaseConnector connecto... | package com.gruppe27.fellesprosjekt.server;
import com.esotericsoftware.kryonet.Connection;
import com.esotericsoftware.kryonet.Server;
import com.gruppe27.fellesprosjekt.common.Network;
import java.io.IOException;
public class CalendarServer {
Server server;
DatabaseConnector connector;
public Calenda... |
Update tooltip copy for analytics referrals chart | <?php
namespace Minds\Core\Analytics\Dashboards\Metrics\Engagement;
use Minds\Core\Di\Di;
use Minds\Core\Session;
use Minds\Core\Data\ElasticSearch;
use Minds\Core\Analytics\Dashboards\Metrics\AbstractMetric;
use Minds\Core\Analytics\Dashboards\Metrics\MetricSummary;
use Minds\Core\Analytics\Dashboards\Metrics\Visuali... | <?php
namespace Minds\Core\Analytics\Dashboards\Metrics\Engagement;
use Minds\Core\Di\Di;
use Minds\Core\Session;
use Minds\Core\Data\ElasticSearch;
use Minds\Core\Analytics\Dashboards\Metrics\AbstractMetric;
use Minds\Core\Analytics\Dashboards\Metrics\MetricSummary;
use Minds\Core\Analytics\Dashboards\Metrics\Visuali... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.