text stringlengths 17 1.47k | positive stringlengths 673 4.43k | negative stringlengths 677 2.81k |
|---|---|---|
Make exception task filename to be empty string by default | <?php declare(strict_types=1);
/* (c) Anton Medvedev <anton@medv.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Deployer\Exception;
use Throwable;
class Exception extends \Exception
{
private static $taskSourceLo... | <?php declare(strict_types=1);
/* (c) Anton Medvedev <anton@medv.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Deployer\Exception;
use Throwable;
class Exception extends \Exception
{
private static $taskSourceLo... |
Test of optimized output functions runs automatically. | """
Unit tests for Topographica
$Id$
"""
__version__='$Revision$'
### JABALERT!
###
### Should change this to be like topo/patterns/__init__.py, i.e.
### to automatically discover the test files. That way new tests
### can be just dropped in.
import unittest, os
import testboundingregion
import testdummy
import tes... | """
Unit tests for Topographica
$Id$
"""
__version__='$Revision$'
### JABALERT!
###
### Should change this to be like topo/patterns/__init__.py, i.e.
### to automatically discover the test files. That way new tests
### can be just dropped in.
import unittest, os
import testboundingregion
import testdummy
import tes... |
Put statuses back to correct, adjust unsupported status | (function(ext) {
// Cleanup function when the extension is unloaded
ext._shutdown = function() {};
// Status reporting code
// Use this to report missing hardware, plugin or unsupported browser
ext._getStatus = function() {
// Check for the various File API support.
if (window.... | (function(ext) {
// Cleanup function when the extension is unloaded
ext._shutdown = function() {};
// Status reporting code
// Use this to report missing hardware, plugin or unsupported browser
ext._getStatus = function() {
// Check for the various File API support.
if (window.... |
Fix sounds being uploaded to the wrong path | 'use strict';
var fs = require('fs');
var express = require('express');
var app = express();
var multer = require('multer');
var path = require('path');
var upload = multer({
dest: 'sounds/',
storage: multer.diskStorage({
destination: path.join(__... | 'use strict';
var fs = require('fs');
var express = require('express');
var app = express();
var multer = require('multer');
var path = require('path');
var upload = multer({
dest: 'sounds/',
storage: multer.diskStorage({
destination: path.join(__... |
Add new Modal storybook doc | import React from 'react';
import Modal, { PureModal } from '@ichef/gypcrete/src/Modal';
import ContainsColumnView from '../SplitView/ContainsColumnView';
import ClosableModalExample, { MulitpleClosableModalExample } from './ClosableModalExample';
export default {
title: '@ichef/gypcrete|Modal',
component: P... | import React from 'react';
import { storiesOf } from '@storybook/react';
import { withInfo } from '@storybook/addon-info';
import Modal, { PureModal } from '@ichef/gypcrete/src/Modal';
import { getAddonOptions } from 'utils/getPropTables';
import ContainsColumnView from '../SplitView/ContainsColumnView';
import Closa... |
Fix welcoming new members using outdated functions | 'use strict';
const DiscordHook = require('../../../../bot/modules/DiscordHook');
const ModuleGuildWars2 = require('../../guildwars2');
class HookWelcomeNewMember extends DiscordHook {
constructor(bot) {
super(bot, 'welcome-new-member');
this._hooks = {
guildMemberAdd: this.onNewMem... | 'use strict';
const DiscordHook = require('../../../../bot/modules/DiscordHook');
class HookWelcomeNewMember extends DiscordHook {
constructor(bot) {
super(bot, 'welcome-new-member');
this._hooks = {
guildMemberAdd: this.onNewMember.bind(this),
};
}
async onNewMember... |
Test the puzzle before solving
Norvig's code makes this easier than I thought! | import os
import pickle as pck
import numpy as np
from pprint import pprint
import sys
from scripts.sudokuExtractor import Extractor
from scripts.train import NeuralNetwork
from scripts.sudoku_str import SudokuStr
class Sudoku(object):
def __init__(self, name):
image_path = self.getImagePath(name)
... | import os
import pickle as pck
import numpy as np
from pprint import pprint
import sys
from scripts.sudokuExtractor import Extractor
from scripts.train import NeuralNetwork
from scripts.sudoku_str import SudokuStr
class Sudoku(object):
def __init__(self, name):
image_path = self.getImagePath(name)
... |
Correct code to remove JSHint error "Did you mean to return a conditional instead of an assignment?" | (function () {
'use strict';
angular
.module('app.core')
.run(function($rootScope, $state) {
return $rootScope.$on('$stateChangeStart', function() {
$rootScope.$state = $state;
});
})
.config(function ($stateProvider, $urlRouterProvider) {... | (function () {
'use strict';
angular
.module('app.core')
.run(function($rootScope, $state) {
return $rootScope.$on('$stateChangeStart', function() {
return $rootScope.$state = $state;
});
})
.config(function ($stateProvider, $urlRouterProv... |
Check type of options more carefully | module.exports = ({types: t}) => {
return {
pre(file) {
const opts = this.opts;
if (
!(
opts &&
typeof opts === 'object' &&
Object.keys(opts).every(key => (
opts[key] &&
(
typeof opts[key] === 'string' ||
(
... | module.exports = ({types: t}) => {
return {
pre(file) {
const opts = this.opts;
if (
!(
opts &&
typeof opts === 'object' &&
Object.keys(opts).every(key => (
opts[key] &&
(
typeof opts[key] === 'string' ||
(
... |
BUGFIX: Remove pre-PHP7 code and avoid __toString deprecation warning | <?php
namespace Neos\Flow\Reflection;
/*
* This file is part of the Neos.Flow package.
*
* (c) Contributors of the Neos Project - www.neos.io
*
* This package is Open Source Software. For the full copyright and license
* information, please view the LICENSE file which was distributed with this
* source code.
*... | <?php
namespace Neos\Flow\Reflection;
/*
* This file is part of the Neos.Flow package.
*
* (c) Contributors of the Neos Project - www.neos.io
*
* This package is Open Source Software. For the full copyright and license
* information, please view the LICENSE file which was distributed with this
* source code.
*... |
Add comment about blocking work to be done | package fault.java.singlewriter;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Semaphore;
import java.util.concurrent.atomic.AtomicReference;
/**
* Created by timbrooks on 11/16/14.
*/
public class ResilientPromise<T> {
public T result;
public Throwable error;
private Status st... | package fault.java.singlewriter;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Semaphore;
import java.util.concurrent.atomic.AtomicReference;
/**
* Created by timbrooks on 11/16/14.
*/
public class ResilientPromise<T> {
public T result;
public Throwable error;
private Status st... |
Use `find_packages()` like all the cool kids do. | from setuptools import setup
from setuptools import setup, find_packages
exec (open('plotly/version.py').read())
def readme():
with open('README.rst') as f:
return f.read()
setup(name='plotly',
version=__version__,
use_2to3=False,
author='Chris P',
author_email='chris@plot.ly',
... | from setuptools import setup
exec (open('plotly/version.py').read())
def readme():
with open('README.rst') as f:
return f.read()
setup(name='plotly',
version=__version__,
use_2to3=False,
author='Chris P',
author_email='chris@plot.ly',
maintainer='Chris P',
maintainer... |
Return HTTP 502 and error message if upstream server error. | const util = require('util');
const Koa = require('koa');
const bodyParser = require('koa-bodyparser');
const request = require('./request');
class Server {
constructor(verbose) {
this.app = new Koa();
this.app.use(async (ctx, next) => {
try {
await next();
} catch (error) {
ctx... | const util = require('util');
const Koa = require('koa');
const bodyParser = require('koa-bodyparser');
const request = require('./request');
class Server {
constructor(verbose) {
this.app = new Koa();
this.app.use(async (ctx, next) => {
try {
await next();
} catch (error) {
ctx... |
Include colons in URL matching | from plugins.categories import ISilentCommand
try:
import requests_pyopenssl
from requests.packages.urllib3 import connectionpool
connectionpool.ssl_wrap_socket = requests_pyopenssl.ssl_wrap_socket
except ImportError:
pass
import requests
from bs4 import BeautifulSoup
class URLGrabber (ISilentCommand... | from plugins.categories import ISilentCommand
try:
import requests_pyopenssl
from requests.packages.urllib3 import connectionpool
connectionpool.ssl_wrap_socket = requests_pyopenssl.ssl_wrap_socket
except ImportError:
pass
import requests
from bs4 import BeautifulSoup
class URLGrabber (ISilentCommand... |
Remove unnecessary access modifiers from nested private class | package com.ibm.mil.smartringer;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.util.Log;
public class IncomingCallReceiver extends BroadcastReceiver {
p... | package com.ibm.mil.smartringer;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.util.Log;
public class IncomingCallReceiver extends BroadcastReceiver {
p... |
Set Hystrix group key to command class name | package name.webdizz.fault.tolerance.inventory.client.command;
import name.webdizz.fault.tolerance.inventory.client.InventoryRequester;
import name.webdizz.fault.tolerance.inventory.domain.Inventory;
import name.webdizz.fault.tolerance.inventory.domain.Product;
import name.webdizz.fault.tolerance.inventory.domain.Stor... | package name.webdizz.fault.tolerance.inventory.client.command;
import name.webdizz.fault.tolerance.inventory.client.InventoryRequester;
import name.webdizz.fault.tolerance.inventory.domain.Inventory;
import name.webdizz.fault.tolerance.inventory.domain.Product;
import name.webdizz.fault.tolerance.inventory.domain.Stor... |
Change event tracking to reflect latest button text. | /**
* Meetings and Conferences
*/
var m = require('mithril');
var $osf = require('js/osfHelpers');
// CSS
require('css/meetings-and-conferences.css');
var MeetingsAndConferences = {
view: function(ctrl) {
return m('.p-v-sm',
m('.row',
[
m('.col-md-8',
... | /**
* Meetings and Conferences
*/
var m = require('mithril');
var $osf = require('js/osfHelpers');
// CSS
require('css/meetings-and-conferences.css');
var MeetingsAndConferences = {
view: function(ctrl) {
return m('.p-v-sm',
m('.row',
[
m('.col-md-8',
... |
Fix chart no data display | var merge = require('merge');
var temperature = require('../model/temperature.js');
var humidity = require('../model/humidity.js');
var gas = require('../model/gas.js');
var co = require('../model/co.js');
var timestamp = require('../timestamp.js');
exports.index = function index(callback) {
// FIXME: callback he... | var merge = require('merge');
var temperature = require('../model/temperature.js');
var humidity = require('../model/humidity.js');
var gas = require('../model/gas.js');
var co = require('../model/co.js');
var timestamp = require('../timestamp.js');
exports.index = function index(callback) {
// FIXME: callback he... |
Handle situation where dav does not send length | from __future__ import unicode_literals
import requests
from django.core.files import File
from django.core.files.storage import Storage
from davstorage.utils import trim_trailing_slash
class DavStorage(Storage):
def __init__(self, internal_url, external_url):
self._internal_url = trim_trailing_slash(inte... | from __future__ import unicode_literals
import requests
from django.core.files import File
from django.core.files.storage import Storage
from davstorage.utils import trim_trailing_slash
class DavStorage(Storage):
def __init__(self, internal_url, external_url):
self._internal_url = trim_trailing_slash(inte... |
Add source maps in dev | const path = require("path");
const webpack = require("webpack");
module.exports = {
devtool: "source-map",
resolve: {
extensions: [".js"]
},
module: {
rules: [
{
test: /\.css$/,
use: ["style-loader", "css-loader"]
},
{
test: /\.js$/,
exclude: /(node_mo... | const path = require("path");
const webpack = require("webpack");
module.exports = {
resolve: {
extensions: [".js"]
},
module: {
rules: [
{
test: /\.css$/,
use: ["style-loader", "css-loader"]
},
{
test: /\.js$/,
exclude: /(node_modules)/,
use: {
... |
Update redux to version 2.0 | import React from 'react';
import { createStore, combineReducers, compose } from 'redux';
import { Provider } from 'react-redux';
import * as reducers from './_reducers';
import { devTools, persistState } from 'redux-devtools';
import { DevTools, DebugPanel, LogMonitor } from 'redux-devtools/lib/react';
import { Router... | import React from 'react';
import { createStore, combineReducers, compose } from 'redux';
import { provide } from 'react-redux';
import * as reducers from './_reducers';
import { devTools, persistState } from 'redux-devtools';
import { DevTools, DebugPanel, LogMonitor } from 'redux-devtools/lib/react';
import { Router ... |
Allow modals to close themselves
For example on accept. | import React from 'react';
import Top from 'app/containers/top'
import Login from 'app/containers/login.js'
import Console from 'app/containers/console.js'
import FlashMessageList from 'app/containers/flashmessages.js'
import Router from 'app/router'
import get_modal from './modalfactory'
import Piwik from 'app/contai... | import React from 'react';
import Top from 'app/containers/top'
import Login from 'app/containers/login.js'
import Console from 'app/containers/console.js'
import FlashMessageList from 'app/containers/flashmessages.js'
import Router from 'app/router'
import get_modal from './modalfactory'
import Piwik from 'app/contai... |
Replace anonymous type with lambda | package com.smartcodeltd.jenkinsci.plugins.buildmonitor.viewmodel.features;
import com.smartcodeltd.jenkinsci.plugins.buildmonitor.viewmodel.JobView;
import com.smartcodeltd.jenkinsci.plugins.buildmonitor.viewmodel.features.headline.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
... | package com.smartcodeltd.jenkinsci.plugins.buildmonitor.viewmodel.features;
import com.smartcodeltd.jenkinsci.plugins.buildmonitor.viewmodel.JobView;
import com.smartcodeltd.jenkinsci.plugins.buildmonitor.viewmodel.features.headline.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
i... |
Add brackets around rule ID in parseable format.
This formatter was supposed to model after the PEP8 format,
but was incorrect. The actualy format is:
"<filename>:<linenumber>: [<rule.id>] <message>" | class Formatter:
def format(self, match):
formatstr = "[{0}] {1}\n{2}:{3}\n{4}\n"
return formatstr.format(match.rule.id,
match.message,
match.filename,
match.linenumber,
m... | class Formatter:
def format(self, match):
formatstr = "[{0}] {1}\n{2}:{3}\n{4}\n"
return formatstr.format(match.rule.id,
match.message,
match.filename,
match.linenumber,
m... |
BAP-16688: Replace form aliases by FQCN in entity configs | <?php
namespace Oro\Bundle\CalendarBundle\Migrations\Schema\v1_14;
use Doctrine\DBAL\Schema\Schema;
use Oro\Bundle\EntityBundle\EntityConfig\DatagridScope;
use Oro\Bundle\EntityExtendBundle\EntityConfig\ExtendScope;
use Oro\Bundle\FormBundle\Form\Type\OroResizeableRichTextType;
use Oro\Bundle\MigrationBundle\Migratio... | <?php
namespace Oro\Bundle\CalendarBundle\Migrations\Schema\v1_14;
use Doctrine\DBAL\Schema\Schema;
use Oro\Bundle\EntityBundle\EntityConfig\DatagridScope;
use Oro\Bundle\EntityExtendBundle\EntityConfig\ExtendScope;
use Oro\Bundle\MigrationBundle\Migration\Migration;
use Oro\Bundle\MigrationBundle\Migration\QueryBag;... |
Fix whitespace issue with Admin Panel ModelAdmin columns | @if (method_exists($modelAdmin, 'tableTbodyRow'))
{{ $modelAdmin->tableTbodyRow($modelItem) }}
@else
<tr>
@foreach ($modelAdmin->getColumns() as $key => $field)
<td>{!! $modelAdmin->getAttribute($key, $modelItem) !!}</td>
@endforeach
<td style="width: 1%; white-space:nowrap"... | @if (method_exists($modelAdmin, 'tableTbodyRow'))
{{ $modelAdmin->tableTbodyRow($modelItem) }}
@else
<tr>
@foreach ($modelAdmin->getColumns() as $key => $field)
<td>
{!! $modelAdmin->getAttribute($key, $modelItem) !!}
</td>
@endforeach
<td style="... |
Rename f to func in one last place (ActionQueue) | import logging
import queue
import threading
log = logging.getLogger(__name__)
class Action:
func = None
args = []
kwargs = {}
def __init__(self, func=None, args=[], kwargs={}):
self.func = func
self.args = args
self.kwargs = kwargs
def run(self):
self.func(*self... | import logging
import queue
import threading
log = logging.getLogger(__name__)
class Action:
func = None
args = []
kwargs = {}
def __init__(self, func=None, args=[], kwargs={}):
self.func = func
self.args = args
self.kwargs = kwargs
def run(self):
self.func(*self... |
Use exchange instead of topic from joram | package no.ntnu.okse.protocol.amqp091;
import no.ntnu.okse.core.messaging.Message;
import no.ntnu.okse.core.messaging.MessageService;
import no.ntnu.okse.core.subscription.Publisher;
import org.ow2.joram.mom.amqp.AMQPMessageListener;
import org.ow2.joram.mom.amqp.messages.*;
public class AMQP091MessageListener implem... | package no.ntnu.okse.protocol.amqp091;
import no.ntnu.okse.core.messaging.Message;
import no.ntnu.okse.core.messaging.MessageService;
import no.ntnu.okse.core.subscription.Publisher;
import org.ow2.joram.mom.amqp.AMQPMessageListener;
import org.ow2.joram.mom.amqp.messages.*;
public class AMQP091MessageListener implem... |
Add handler for when setTab is given a non-exsitant tab id | (function(){
"use strict";
xtag.register("sam-tabbar", {
lifecycle: {
created: function() {
if (!this.role) {
this.role = "tablist";
}
},
inserted: function() {
this.activeTabId = this.querySelector("[role='tab'][data-start-active]").id;
},
remov... | (function(){
"use strict";
xtag.register("sam-tabbar", {
lifecycle: {
created: function() {
if (!this.role) {
this.role = "tablist";
}
},
inserted: function() {
this.activeTabId = this.querySelector("[role='tab'][data-start-active]").id;
},
remov... |
Remove unneeded momentjs inclusion in blueprint | /* globals module */
module.exports = {
afterInstall: function() {
var self = this;
return this.addBowerPackageToProject( 'bootstrap-datepicker' )
.then( function() {
return self.addBowerPackageToProject( 'fontawesome' );
})
.then( function() {
... | /* globals module */
module.exports = {
afterInstall: function() {
var self = this;
return this.addBowerPackageToProject( 'bootstrap-datepicker' )
.then( function() {
return self.addBowerPackageToProject( 'momentjs' );
})
.then( function() {
... |
Fix exception handling in management command. Clean up. | """Creates an admin user if there aren't any existing superusers."""
from optparse import make_option
from django.contrib.auth.models import User
from django.core.management.base import BaseCommand, CommandError
class Command(BaseCommand):
help = 'Creates/Updates an Admin user'
def add_arguments(self, par... | '''
Creates an admin user if there aren't any existing superusers
'''
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User
from optparse import make_option
class Command(BaseCommand):
help = 'Creates/Updates an Admin user'
def add_arguments(self, pars... |
Add method to reset SQL schema and to empty the container | <?php
namespace PhpAbac;
use PhpAbac\Manager\AttributeManager;
use PhpAbac\Manager\PolicyRuleManager;
class Abac {
/** @var array **/
private static $container;
/**
* @param \PDO $connection
*/
public function __construct(\PDO $connection)
{
// Set the main managers
... | <?php
namespace PhpAbac;
class Abac {
/** @var array **/
private static $container;
/**
* @param \PDO $connection
*/
public function __construct($connection)
{
self::set('policy-rule-manager', new PolicyRuleManager());
self::set('attribute-manager', new AttributeMana... |
Exclude tests from set of installed packages | from ez_setup import use_setuptools # https://pypi.python.org/pypi/setuptools
use_setuptools()
from setuptools import setup, find_packages
from packager import __version__
# Get the long description from the README file.
def get_long_description():
from codecs import open
from os import path
here = path.a... | from ez_setup import use_setuptools # https://pypi.python.org/pypi/setuptools
use_setuptools()
from setuptools import setup, find_packages
from packager import __version__
# Get the long description from the README file.
def get_long_description():
from codecs import open
from os import path
here = path.a... |
Use safe_load_all to detect errors in multi-document files | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by NotSqrt
# Copyright (c) 2013 NotSqrt
#
# License: MIT
#
"""This module exports the Pyyaml plugin class."""
from SublimeLinter.lint import PythonLinter, persist
class Pyyaml(PythonLinter):
"""Provides an inter... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by NotSqrt
# Copyright (c) 2013 NotSqrt
#
# License: MIT
#
"""This module exports the Pyyaml plugin class."""
from SublimeLinter.lint import PythonLinter, persist
class Pyyaml(PythonLinter):
"""Provides an inter... |
Fix evaluating complex spell properties on load | package com.elmakers.mine.bukkit.magic;
import java.util.HashSet;
import java.util.Set;
import javax.annotation.Nullable;
import com.elmakers.mine.bukkit.api.magic.Mage;
import com.elmakers.mine.bukkit.api.magic.MageController;
public class MageParameters extends ParameterizedConfiguration {
private static Set<S... | package com.elmakers.mine.bukkit.magic;
import java.util.HashSet;
import java.util.Set;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.elmakers.mine.bukkit.api.magic.Mage;
import com.elmakers.mine.bukkit.api.magic.MageController;
public class MageParameters extends ParameterizedConfigu... |
Write ID to DB test |
<!DOCTYPE html>
<html>
<head><title>Response</title></head>
<body>
<h1>Response</h1>
<?php
require("secretSettings.php");
$raw = file_get_contents('php://input');
echo "Raw: " . $raw;
$contents = split(":", $raw);
$id = trim(str_replac... |
<!DOCTYPE html>
<html>
<head><title>Response</title></head>
<body>
<h1>Response</h1>
<?php
require("secretSettings.php");
$raw = file_get_contents('php://input');
echo "Raw: " . $raw;
$contents = split(":", $raw);
$id = trim(str_replac... |
Fix invalid reference to fileNameFromKey | var utils = require('./utils');
function StorageHandler (updateFiles) {
this.sync = function () {
if (typeof chrome === 'undefined' || !chrome || !chrome.storage || !chrome.storage.sync) {
return;
}
var obj = {};
var done = false;
var count = 0
var dont = 0;
function check (key)... | var utils = require('./utils');
function StorageHandler (updateFiles) {
this.sync = function () {
if (typeof chrome === 'undefined' || !chrome || !chrome.storage || !chrome.storage.sync) {
return;
}
var obj = {};
var done = false;
var count = 0
var dont = 0;
function check (key)... |
:wrench: Use cssnext instead of custom packages | const path = require('path')
const webpack = require('webpack')
module.exports = {
module: {
rules: [{
test: /\.less$/,
use: [
'style-loader',
'css-loader?importLoaders=1&sourceMap=true&modules=true',
'less-loader',
],
}, {
test: /\.(eot|woff|woff2|ttf)$/,
... | const path = require('path')
const webpack = require('webpack')
module.exports = {
module: {
rules: [{
test: /\.less$/,
use: [
'style-loader',
'css-loader?importLoaders=1&sourceMap=true&modules=true',
'less-loader',
],
}, {
test: /\.(eot|woff|woff2|ttf)$/,
... |
Make muting rerender properly when getting updates.
If you have two browsers open for the same account, muting in one
browser will now be reflected in the other browser. This got
regressed when changing the approach from collapsing to hiding.
The new code should be less brittle, as we encapsulate re-rendering
in muti... | var muting_ui = (function () {
var exports = {};
function timestamp_ms() {
return (new Date()).getTime();
}
var last_topic_update = 0;
exports.rerender = function () {
current_msg_list.rerender_after_muting_changes();
if (current_msg_list !== home_msg_list) {
home_msg_list.rerender_after_muting_... | var muting_ui = (function () {
var exports = {};
function timestamp_ms() {
return (new Date()).getTime();
}
var last_topic_update = 0;
exports.persist_and_rerender = function () {
// Optimistically rerender our new muting preferences. The back
// end should eventually save it, and if it doesn't, it's a... |
Remove m2m fields from ctnr edit form | from django import forms
from cyder.base.constants import LEVELS
from cyder.base.mixins import UsabilityFormMixin
from cyder.core.ctnr.models import Ctnr
class CtnrForm(forms.ModelForm, UsabilityFormMixin):
class Meta:
model = Ctnr
exclude = ('users', 'domains', 'ranges', 'workgroups')
def f... | from django import forms
from cyder.base.constants import LEVELS
from cyder.base.mixins import UsabilityFormMixin
from cyder.core.ctnr.models import Ctnr
class CtnrForm(forms.ModelForm, UsabilityFormMixin):
class Meta:
model = Ctnr
exclude = ('users',)
def filter_by_ctnr_all(self, ctnr):
... |
Upgrade six 1.10 to 1.11 | import sys
from setuptools import setup, find_packages
with open('VERSION') as version_fp:
VERSION = version_fp.read().strip()
if sys.version_info[:2] < (3, 4):
django_version = '1.8'
else:
django_version = '1.9'
setup(
name='django-perms',
version=VERSION,
url='https://github.com/PSU-OIT... | import sys
from setuptools import setup, find_packages
with open('VERSION') as version_fp:
VERSION = version_fp.read().strip()
if sys.version_info[:2] < (3, 4):
django_version = '1.8'
else:
django_version = '1.9'
setup(
name='django-perms',
version=VERSION,
url='https://github.com/PSU-OIT... |
Fix remove message object from greeting | import json
from http_client import HttpClient
from models.message import ReceivedMessage
class Bot():
"""
@brief Facebook messenger bot
"""
def __init__(self, token):
self.api_token = token
self.client = HttpClient(token)
def send_message(self, message):
response, err... | from http_client import HttpClient
from models.message import ReceivedMessage
class Bot():
"""
@brief Facebook messenger bot
"""
def __init__(self, token):
self.api_token = token
self.client = HttpClient(token)
def send_message(self, message):
response, error = self.cli... |
Add a quick and dirty mute list. | package com.demigodsrpg.chitchat.command;
import com.demigodsrpg.chitchat.Chitchat;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class CCMuteCommand implements CommandExecutor... | package com.demigodsrpg.chitchat.command;
import com.demigodsrpg.chitchat.Chitchat;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class CCMuteCommand implements CommandExecutor... |
Fix wrong boolean binding in fx-root example | package de.saxsys.jfx.mvvmfx.fx_root_example;
import de.saxsys.jfx.mvvm.api.ViewModel;
import javafx.beans.binding.Bindings;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.ReadOnlyBooleanProperty;
import javafx.beans.property.ReadOnlyStringProperty;
import javafx.beans.property.SimpleBoolea... | package de.saxsys.jfx.mvvmfx.fx_root_example;
import de.saxsys.jfx.mvvm.api.ViewModel;
import javafx.beans.binding.Bindings;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.ReadOnlyBooleanProperty;
import javafx.beans.property.ReadOnlyStringProperty;
import javafx.beans.property.SimpleBoolea... |
Use appropriate key if isMultiple is true | <?php
namespace Nails\GeoCode\Settings;
use Nails\GeoCode\Service\Driver;
use Nails\Common\Helper\Form;
use Nails\Common\Interfaces;
use Nails\Common\Service\FormValidation;
use Nails\Components\Setting;
use Nails\GeoCode\Constants;
use Nails\Factory;
/**
* Class General
*
* @package Nails\GeoCode\Settings
*/
cl... | <?php
namespace Nails\GeoCode\Settings;
use Nails\GeoCode\Service\Driver;
use Nails\Common\Helper\Form;
use Nails\Common\Interfaces;
use Nails\Common\Service\FormValidation;
use Nails\Components\Setting;
use Nails\GeoCode\Constants;
use Nails\Factory;
/**
* Class General
*
* @package Nails\GeoCode\Settings
*/
cl... |
Remove no longer needed local variable. | import json
import os
from django.conf import settings
from django.utils.translation import get_language
from django.utils.translation import to_locale
_JSON_MESSAGES_FILE_CACHE = {}
def locale_data_file(locale):
path = getattr(settings, 'LOCALE_PATHS')[0]
return os.path.join(path, locale, "LC_FRONTEND_MESS... | import json
import os
from django.conf import settings
from django.utils.translation import get_language
from django.utils.translation import to_locale
_JSON_MESSAGES_FILE_CACHE = {}
def locale_data_file(locale):
path = getattr(settings, 'LOCALE_PATHS')[0]
locale_path = os.path.join(path, locale)
return... |
Rewrite using WNafUtil.generateNaf instead of the inline Naf generation | package org.bouncycastle.math.ec;
import java.math.BigInteger;
/**
* Class implementing the NAF (Non-Adjacent Form) multiplication algorithm.
*/
public class FpNafMultiplier implements ECMultiplier
{
/**
* D.3.2 pg 101
* @see org.bouncycastle.math.ec.ECMultiplier#multiply(org.bouncycastle.math.ec.ECPo... | package org.bouncycastle.math.ec;
import java.math.BigInteger;
/**
* Class implementing the NAF (Non-Adjacent Form) multiplication algorithm.
*/
public class FpNafMultiplier implements ECMultiplier
{
/**
* D.3.2 pg 101
* @see org.bouncycastle.math.ec.ECMultiplier#multiply(org.bouncycastle.math.ec.ECPo... |
Make short desc less fudful | #!/usr/bin/env python
"""
# sentry-restricted-github
A limited alternavite to sentry-github which doesn't require write access to
repos. It allows creating tickets but doesn't link them to the sentry error
group.
"""
from setuptools import setup, find_packages
# tests_require = [
# 'nose',
# ]
install_require... | #!/usr/bin/env python
"""
# sentry-restricted-github
A limited alternavite to sentry-github which doesn't require write access to
repos. It allows creating tickets but doesn't link them to the sentry error
group.
"""
from setuptools import setup, find_packages
# tests_require = [
# 'nose',
# ]
install_require... |
Change default channel to test_bed | import httplib
import urllib
import json
class Slack:
def __init__(self, webhook_path, url='hooks.slack.com', channel='#test_bed',
username="sb-bot", icon=":satellite:"):
self.web_hook_url = url
self.webhook_path = webhook_path
self.channel = channel
self.userna... | import httplib
import urllib
import json
class Slack:
def __init__(self, webhook_path, url='hooks.slack.com', channel='#sigbridge',
username="sb-bot", icon=":satellite:"):
self.web_hook_url = url
self.webhook_path = webhook_path
self.channel = channel
self.user... |
Use `contenthash` instead of `hash` for webpack output.filename
To suppress "DeprecationWarning: [hash] is now [fullhash] (also consider using [chunkhash] or [contenthash], see documentation for details)" | const glob = require('glob');
const path = require('path');
const webpack = require('webpack');
const WebpackAssetsManifest = require('webpack-assets-manifest');
const { NODE_ENV } = process.env;
const isProd = NODE_ENV === 'production';
const entry = {};
for (const p of glob.sync(path.resolve(__dirname, 'app/javascr... | const glob = require('glob');
const path = require('path');
const webpack = require('webpack');
const WebpackAssetsManifest = require('webpack-assets-manifest');
const { NODE_ENV } = process.env;
const isProd = NODE_ENV === 'production';
const entry = {};
for (const p of glob.sync(path.resolve(__dirname, 'app/javascr... |
Add choices_map and units_map global variables | """Routines used by WMT hooks for TopoFlow components."""
choices_map = {
'Yes': 1,
'No': 0
}
units_map = {
'meters': 'm^2',
'kilometers': 'km^2'
}
def get_dtype(parameter_value):
"""Get the TopoFlow data type of a parameter.
Parameters
----------
parameter_value : object
An ob... | def get_dtype(parameter_value):
"""Get the TopoFlow data type of a parameter.
Parameters
----------
parameter_value : object
An object, a scalar.
"""
try:
float(parameter_value)
except ValueError:
return 'string'
else:
return 'float'
def assign_parameter... |
Remove default anchor behavior for smooth scrolling. | //
// suuoh.com
// Melvin Chien 2013
//
$(document).ready(function() {
$("a[href^='#']").click(function(e){
e.preventDefault();
var id = $(this).attr("href");
var posTop = $(id).position().top;
if ($(".hidden-phone").is(":visible"))
posTop -= 50;
$("html, body").animate({
scrollTop: p... | //
// suuoh.com
// Melvin Chien 2013
//
$(document).ready(function() {
$("a[href^='#']").click(function(){
var id = $(this).attr("href");
var posTop = $(id).position().top;
if ($(".hidden-phone").is(":visible"))
posTop -= 50;
$("html, body").animate({
scrollTop: posTop
}, 1000);
}... |
Fix syntax error, unexpected 'insteadof'. | <?php
namespace Per3evere\Preq;
use Illuminate\Foundation\Application as LaravelApplication;
use Laravel\Lumen\Application as LumenApplication;
use Illuminate\Support\ServiceProvider;
/**
* Class PreqServiceProvider
*
*/
class PreqServiceProvider extends ServiceProvider
{
/**
* Indicates if loading of th... | <?php
namespace Per3evere\Preq;
use Illuminate\Foundation\Application as LaravelApplication;
use Laravel\Lumen\Application as LumenApplication;
use Illuminate\Support\ServiceProvider;
/**
* Class PreqServiceProvider
*
*/
class PreqServiceProvider extends ServiceProvider
{
/**
* Indicates if loading of th... |
Update bundle configuration for Symfony 4.2 change | <?php
namespace LongRunning\Bundle\LongRunningBundle\DependencyInjection;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
class Configuration implements ConfigurationInterface
{
public function __construct($alias)
{
$this->a... | <?php
namespace LongRunning\Bundle\LongRunningBundle\DependencyInjection;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
class Configuration implements ConfigurationInterface
{
public function __construct($alias)
{
$this->a... |
Fix TF using all the GPU memory | from ..kernel import Kernel
from scannerpy import DeviceType
class TensorFlowKernel(Kernel):
def __init__(self, config):
import tensorflow as tf
# If this is a CPU kernel, tell TF that it should not use
# any GPUs for its graph operations
cpu_only = True
visible_device_lis... | from ..kernel import Kernel
from scannerpy import DeviceType
class TensorFlowKernel(Kernel):
def __init__(self, config):
import tensorflow as tf
# If this is a CPU kernel, tell TF that it should not use
# any GPUs for its graph operations
cpu_only = True
visible_device_lis... |
Set status 500 on React rendered errors. | 'use strict';
var React = require('react');
var doctype = '<!DOCTYPE html>\n';
var transformResponse = require('subprocess-middleware').transformResponse;
var render = function (Component, body, res) {
//var start = process.hrtime();
var context = JSON.parse(body);
var props = {
context: context,
... | 'use strict';
var React = require('react');
var doctype = '<!DOCTYPE html>\n';
var transformResponse = require('subprocess-middleware').transformResponse;
var render = function (Component, body, res) {
//var start = process.hrtime();
var context = JSON.parse(body);
var props = {
context: context,
... |
Fix the versioned Django, we're grabbing 1.4.1 off the requirements.txt | #!/usr/bin/env python
from setuptools import setup, find_packages
from billy import __version__
long_description = open('README.rst').read()
setup(name='billy',
version=__version__,
packages=find_packages(),
package_data={'billy': ['schemas/*.json',
'schemas/api/*.json'... | #!/usr/bin/env python
from setuptools import setup, find_packages
from billy import __version__
long_description = open('README.rst').read()
setup(name='billy',
version=__version__,
packages=find_packages(),
package_data={'billy': ['schemas/*.json',
'schemas/api/*.json'... |
Change default arg value for pynuxrc | #!/usr/bin/env python
# -*- coding: utf8 -*-
import sys
import argparse
from deepharvest.deepharvest_nuxeo import DeepHarvestNuxeo
def main(argv=None):
parser = argparse.ArgumentParser(
description='Print count of objects for a given collection.')
parser.add_argument('path', help="Nuxeo path to coll... | #!/usr/bin/env python
# -*- coding: utf8 -*-
import sys
import argparse
from deepharvest.deepharvest_nuxeo import DeepHarvestNuxeo
def main(argv=None):
parser = argparse.ArgumentParser(
description='Print count of objects for a given collection.')
parser.add_argument('path', help="Nuxeo path to coll... |
Move client and resource to __init__
* moved the calls to create the ec2 session resource session client
to the init | import boto3.session
from nubes.connectors import base
class AWSConnector(base.BaseConnector):
def __init__(self, aws_access_key_id, aws_secret_access_key, region_name):
self.connection = boto3.session.Session(
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret... | import boto3.session
from nubes.connectors import base
class AWSConnector(base.BaseConnector):
def __init__(self, aws_access_key_id, aws_secret_access_key, region_name):
self.connection = boto3.session.Session(
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret... |
Use StringUtils for the default string | package org.wikipedia.gallery;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.gson.annotations.SerializedName;
import org.apache.commons.lang3.StringUtils;
import java.io.Serializable;
import java.util.Collections;
import java.util.List;
@SuppressWarnings("unused")
publi... | package org.wikipedia.gallery;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import com.google.gson.annotations.SerializedName;
import org.apache.commons.lang3.StringUtils;
import java.io.Serializable;
import java.util.Collections;
import java.util.List;
@SuppressWarnings("unused")
publi... |
Use single dist js file | const webpack = require('webpack'),
HtmlWebpackPlugin = require('html-webpack-plugin'),
path = require('path'),
babelCfg = require("./babel.config"),
paths = {
root: path.join(__dirname, '../'),
app: path.join(__dirname, '../app/'),
dist: path.join(__dirname, '../dist/')
};
... | const webpack = require('webpack'),
HtmlWebpackPlugin = require('html-webpack-plugin'),
path = require('path'),
babelCfg = require("./babel.config"),
paths = {
root: path.join(__dirname, '../'),
app: path.join(__dirname, '../app/'),
dist: path.join(__dirname, '../dist/')
};
... |
Add more info to test_ais docstring | """
Test dbm_metrics script
"""
from pylearn2.scripts.dbm import dbm_metrics
from pylearn2.datasets.mnist import MNIST
def test_ais():
"""
Test ais computation by comparing the output of estimate_likelihood to
Russ's code's output for the same parameters.
"""
w_list = [None]
b_list = []
# ... | """
Test dbm_metrics script
"""
from pylearn2.scripts.dbm import dbm_metrics
from pylearn2.datasets.mnist import MNIST
def test_ais():
"""
Test ais computation
"""
w_list = [None]
b_list = []
# Add parameters import
trainset = MNIST(which_set='train')
testset = MNIST(which_set='test')... |
Remove showshildren as field from CMS | <?php
class GroupedProduct extends Product {
/**
* @config
*/
private static $description = "A product containing other products";
private static $has_many = array(
"ChildProducts" => "Product"
);
public function getCMSFields() {
$fields = parent::getCMSFiel... | <?php
class GroupedProduct extends Product {
/**
* @config
*/
private static $description = "A product containing other products";
private static $has_many = array(
"ChildProducts" => "Product"
);
public function getCMSFields() {
$fields = parent::getCMSFiel... |
Fix keys implementation - Object.keys does not work on functions | if (typeof buster == "undefined") {
var buster = {};
}
buster.util = (function () {
var toString = Object.prototype.toString;
var div = typeof document != "undefined" && document.createElement("div");
return {
isNode: function (obj) {
if (!div) {
return false;
... | if (typeof buster == "undefined") {
var buster = {};
}
buster.util = (function () {
var toString = Object.prototype.toString;
var div = typeof document != "undefined" && document.createElement("div");
return {
isNode: function (obj) {
if (!div) {
return false;
... |
Simplify creation of MetaData in SQLBackend
Squash a few lines into one. | from sqlalchemy import MetaData, Table, Column, types, create_engine, select
from .base import BaseBackend
class SQLBackend(BaseBackend):
def __init__(self, url, table_name='gimlet_channels'):
meta = MetaData(bind=create_engine(url))
self.table = Table(table_name, meta,
... | from sqlalchemy import MetaData, Table, Column, types, create_engine, select
from .base import BaseBackend
class SQLBackend(BaseBackend):
def __init__(self, url, table_name='gimlet_channels'):
engine = create_engine(url)
meta = MetaData()
meta.bind = engine
self.table = Table(ta... |
Include data in an array in Promotion archive method | <?php
namespace Project\AppBundle\Entity;
use Doctrine\ORM\EntityRepository;
/**
* PromotionRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class PromotionRepository extends EntityRepository
{
/**
* Create a json of a promotion.
*
... | <?php
namespace Project\AppBundle\Entity;
use Doctrine\ORM\EntityRepository;
/**
* PromotionRepository
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class PromotionRepository extends EntityRepository
{
/**
* Create a json of a promotion.
*
... |
Change "Development Status" classifier to "5 - Production/Stable" | #!/usr/bin/env python
import sys, os
try:
from setuptools import setup, find_packages
except ImportError:
from distutils.core import setup
# Hack to prevent "TypeError: 'NoneType' object is not callable" error
# in multiprocessing/util.py _exit_function when setup.py exits
# (see http://www.eby-sarna.com/pi... | #!/usr/bin/env python
import sys, os
try:
from setuptools import setup, find_packages
except ImportError:
from distutils.core import setup
# Hack to prevent "TypeError: 'NoneType' object is not callable" error
# in multiprocessing/util.py _exit_function when setup.py exits
# (see http://www.eby-sarna.com/pi... |
Add decorator for GDB connect test failing on FreeBSD
llvm.org/pr18313
git-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@197910 91177308-0d34-0410-b5e6-96231b3b80d8 | """
Test lldb 'process connect' command.
"""
import os
import unittest2
import lldb
import pexpect
from lldbtest import *
class ConnectRemoteTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@expectedFailureFreeBSD('llvm.org/pr18313')
def test_connect_remote(self):
"""Test "process co... | """
Test lldb 'process connect' command.
"""
import os
import unittest2
import lldb
import pexpect
from lldbtest import *
class ConnectRemoteTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def test_connect_remote(self):
"""Test "process connect connect:://localhost:12345"."""
#... |
Update minimum babel version to >=2.3.
Babel 1.0 is now 3 years obsolete. Numerous critical bug fixes are
included in the 1.0 - 2.3 range. | """
Flask-Babel
-----------
Adds i18n/l10n support to Flask applications with the help of the
`Babel`_ library.
Links
`````
* `documentation <http://packages.python.org/Flask-Babel>`_
* `development version
<http://github.com/mitsuhiko/flask-babel/zipball/master#egg=Flask-Babel-dev>`_
.. _Babel: http://babel.edge... | """
Flask-Babel
-----------
Adds i18n/l10n support to Flask applications with the help of the
`Babel`_ library.
Links
`````
* `documentation <http://packages.python.org/Flask-Babel>`_
* `development version
<http://github.com/mitsuhiko/flask-babel/zipball/master#egg=Flask-Babel-dev>`_
.. _Babel: http://babel.edge... |
Include agents as a default test family | #!/usr/bin/python
# -*- coding: utf-8 -*-
# For better print formatting
from __future__ import print_function
# Imports
import os
############################################
# CONSTANTS
############################################
DEFAULT_SKIP = True
DEFAULT_NUM_RETRIES = 3
DEFAULT_FAIL_FAST = False
DEFAULT_FAMIL... | #!/usr/bin/python
# -*- coding: utf-8 -*-
# For better print formatting
from __future__ import print_function
# Imports
import os
############################################
# CONSTANTS
############################################
DEFAULT_SKIP = True
DEFAULT_NUM_RETRIES = 3
DEFAULT_FAIL_FAST = False
DEFAULT_FAMIL... |
Add introspection rule; prevent South weirdness | from django.db.models import CharField, NOT_PROVIDED
from django.core.exceptions import ValidationError
from south.modelsinspector import add_introspection_rules
from cyder.cydhcp.validation import validate_mac
class MacAddrField(CharField):
"""A general purpose MAC address field
This field holds a MAC addre... | from django.db.models import CharField
from django.core.exceptions import ValidationError
from cyder.cydhcp.validation import validate_mac
class MacAddrField(CharField):
"""A general purpose MAC address field
This field holds a MAC address. clean() removes colons and hyphens from the
field value, raising... |
Add helper methods for creating args | package fi.helsinki.cs.tmc.cli.command;
import static org.junit.Assert.assertTrue;
import fi.helsinki.cs.tmc.cli.Application;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
import java.io.PrintStream;
public class Log... | package fi.helsinki.cs.tmc.cli.command;
import static org.junit.Assert.assertTrue;
import fi.helsinki.cs.tmc.cli.Application;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import java.io.ByteArrayOutputStream;
import java.io.OutputStream;
import java.io.PrintStream;
public class Log... |
Return empty list instead of null in mock | package com.llnw.storage.client;
import com.google.common.collect.Lists;
import com.llnw.storage.client.io.ActivityCallback;
import javax.annotation.Nullable;
import java.io.File;
import java.io.IOException;
import java.util.List;
public class MockEndpointFactory extends EndpointFactory {
public MockEndpointFac... | package com.llnw.storage.client;
import com.llnw.storage.client.io.ActivityCallback;
import javax.annotation.Nullable;
import java.io.File;
import java.io.IOException;
import java.util.List;
public class MockEndpointFactory extends EndpointFactory {
public MockEndpointFactory() {
super(null, null, null)... |
Check if `this.providerParams` is defined | // Load modules
var Crypto = require('crypto');
// Declare internals
var internals = {};
exports = module.exports = function (options) {
return {
protocol: 'oauth2',
auth: 'https://www.linkedin.com/uas/oauth2/authorization',
token: 'https://www.linkedin.com/uas/oauth2/accessToken',
... | // Load modules
var Crypto = require('crypto');
// Declare internals
var internals = {};
exports = module.exports = function (options) {
return {
protocol: 'oauth2',
auth: 'https://www.linkedin.com/uas/oauth2/authorization',
token: 'https://www.linkedin.com/uas/oauth2/accessToken',
... |
Fix build. Change CommandMetadata import. | package io.bootique.undertow.command;
import com.google.inject.Inject;
import com.google.inject.Provider;
import io.bootique.cli.Cli;
import io.bootique.command.CommandOutcome;
import io.bootique.command.CommandWithMetadata;
import io.bootique.meta.application.CommandMetadata;
import io.bootique.undertow.UndertowServe... | package io.bootique.undertow.command;
import com.google.inject.Inject;
import com.google.inject.Provider;
import io.bootique.application.CommandMetadata;
import io.bootique.cli.Cli;
import io.bootique.command.CommandOutcome;
import io.bootique.command.CommandWithMetadata;
import io.bootique.undertow.UndertowServer;
im... |
Use jar.lang.Array instead of native as returnvalue | JAR.register({
MID: 'jar.lang.Object.Object-info',
deps: ['..', '.!reduce|derive', '..Array!reduce']
}, function(lang, Obj, Arr) {
'use strict';
var reduce = Obj.reduce;
lang.extendNativeType('Object', {
keys: function() {
return reduce(this, pushKey, Arr());
},
... | JAR.register({
MID: 'jar.lang.Object.Object-info',
deps: ['..', '.!reduce|derive', '..Array!reduce']
}, function(lang, Obj, Arr) {
'use strict';
var reduce = Obj.reduce;
lang.extendNativeType('Object', {
keys: function() {
return reduce(this, pushKey, []);
},
p... |
Reduce height of mana curve chart
So that labels are visible | app.directive("manaCurveChart", function($timeout) {
return {
restrict: "E",
template: "Mana curve<div></div>",
scope: {
curve: "="
},
link: function(scope, elem, attrs) {
scope.$watch("curve", function(curve) {
if (!curve) {
return;
}
var... | app.directive("manaCurveChart", function($timeout) {
return {
restrict: "E",
template: "Mana curve<div></div>",
scope: {
curve: "="
},
link: function(scope, elem, attrs) {
scope.$watch("curve", function(curve) {
if (!curve) {
return;
}
var... |
Correct data in payment request | import json
import requests
from .environment import Environment
class SwishClient(object):
def __init__(self, environment, payee_alias, cert):
self.environment = Environment.parse_environment(environment)
self.payee_alias = payee_alias
self.cert = cert
def post(self, endpoint, json)... | import json
import requests
from .environment import Environment
class SwishClient(object):
def __init__(self, environment, payee_alias, cert):
self.environment = Environment.parse_environment(environment)
self.payee_alias = payee_alias
self.cert = cert
def post(self, endpoint, json)... |
Use class, module and async |
import events from 'events'
import util from 'util'
import web3 from 'web3'
class Contract extends events.EventEmitter {
constructor(source) {
super()
this.source = source
this.instance = null
this.name = ''
this.deploying = false
}
async compile () {
return await web3.eth.compile.soli... |
var events = require('events')
var util = require('util')
var web3 = require('web3')
function Contract (source) {
this.source = source
this.instance = null
this.name = ''
this.deploying = false
}
util.inherits(Contract, events.EventEmitter)
Contract.prototype.compile = async function () {
try {
retur... |
Switch to toJSON to pull data from models
Allows for simpler customization of data. | /**
* Page view constructor
* Handles all jQuery Mobile setup for any sub-classed page.
*/
define([
"backbone"
],
function(Backbone) {
var PageView = Backbone.View.extend({
tagName: "div",
isInDOM: false,
_name: null,
getName: function() {
return this._name;
... | /**
* Page view constructor
* Handles all jQuery Mobile setup for any sub-classed page.
*/
define([
"backbone"
],
function(Backbone) {
var PageView = Backbone.View.extend({
tagName: "div",
isInDOM: false,
_name: null,
getName: function() {
return this._name;
... |
Add status to project form | from django import forms
from .models import Project
class ProjectForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
self.user = kwargs.pop('user')
super(ProjectForm, self).__init__(*args, **kwargs)
def save(self, *args, **kwargs):
instance = super(ProjectForm, self).save(co... | from django import forms
from .models import Project
class ProjectForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
self.user = kwargs.pop('user')
super(ProjectForm, self).__init__(*args, **kwargs)
def save(self, *args, **kwargs):
instance = super(ProjectForm, self).save(co... |
Set some Regexp related global variables
- $&
- $~ | <?php
namespace Phuby {
class Regexp extends Object { }
}
namespace Phuby\Regexp {
class ClassMethods {
static function initialized($self) {
$self->alias_method('quote', 'escape');
$self->alias_method('valid?', 'valid_query');
}
function escape($string, $delimi... | <?php
namespace Phuby {
class Regexp extends Object { }
}
namespace Phuby\Regexp {
class ClassMethods {
static function initialized($self) {
$self->alias_method('quote', 'escape');
$self->alias_method('valid?', 'valid_query');
}
function escape($string, $delimi... |
Move the taxonomy table definition into a class | <?php
namespace Bolt\Database\Table;
/**
* Table for taxonomy data.
*
* @author Gawain Lynch <gawain.lynch@gmail.com>
*/
class Taxonomy extends BaseTable
{
/**
* {@inheritdoc}
*/
protected function addColumns()
{
// @codingStandardsIgnoreStart
$this->table->addColumn('id', ... | <?php
namespace Bolt\Database\Table;
use Doctrine\DBAL\Schema\Schema;
/**
* Table for taxonomy data.
*
* @author Gawain Lynch <gawain.lynch@gmail.com>
*/
class Taxonomy extends BaseTable
{
/**
* {@inheritdoc}
*/
protected function addColumns()
{
// @codingStandardsIgnoreStart
... |
Add directConnect to true in protractor tests
- it's to avoid the Error: Timed out waiting for the WebDriver server | var HtmlScreenshotReporter = require("protractor-jasmine2-screenshot-reporter");
var JasmineReporters = require('jasmine-reporters');
exports.config = {
seleniumServerJar: '../../../node_modules/protractor/selenium/selenium-server-standalone-2.47.1.jar',
chromeDriver: '../../../node_modules/protractor/selenium... | var HtmlScreenshotReporter = require("protractor-jasmine2-screenshot-reporter");
var JasmineReporters = require('jasmine-reporters');
exports.config = {
seleniumServerJar: '../../../node_modules/protractor/selenium/selenium-server-standalone-2.47.1.jar',
chromeDriver: '../../../node_modules/protractor/selenium... |
Make forms & related stuff final again | <?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\UiBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Comp... | <?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\UiBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Comp... |
Add extra class for Artisan
Adds the call() command. Fixes #42 | <?php
return array(
/*
|--------------------------------------------------------------------------
| Filename
|--------------------------------------------------------------------------
|
| The default path to the helper file
|
*/
'filename' => '_ide_helper.php',
/*
|----... | <?php
return array(
/*
|--------------------------------------------------------------------------
| Filename
|--------------------------------------------------------------------------
|
| The default path to the helper file
|
*/
'filename' => '_ide_helper.php',
/*
|----... |
Use 'fields' instead of 'kwargs' to document intent. | # -*- coding: utf-8 -*-
"""
The Renderer class provides the infrastructure for generating template-based
code. It's used by the .grammars module for parser generation.
"""
from __future__ import print_function, division, absolute_import, unicode_literals
import itertools
from .util import trim
def render(item, **field... | # -*- coding: utf-8 -*-
"""
The Renderer class provides the infrastructure for generating template-based
code. It's used by the .grammars module for parser generation.
"""
from __future__ import print_function, division, absolute_import, unicode_literals
import itertools
from .util import trim
def render(item, **field... |
Fix demographics resolve form formatting. | from django.forms import ModelForm
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit, Layout, Fieldset
from . import models
class DemographicsForm(ModelForm):
class Meta:
model = models.Demographics
exclude = ['patient', 'creation_date']
def __init__(self, *... | from django.forms import ModelForm
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit, Layout, Fieldset
from . import models
class DemographicsForm(ModelForm):
class Meta:
model = models.Demographics
exclude = ['patient', 'creation_date']
def __init__(self, *... |
Apply additional fix to add_user_foreign_key migration
The hack in 583fb729b1e201c830579345dca5beca4b131006 modified
0010_add_user_foreign_key in such a way that it ended up *not* setting
a database constraint when it should have.
Enable the database-enforced constraint in the right place.
Co-authored-by: Florian Ha... | from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.db import migrations, models
import django.db.models.deletion
import logging
logger = logging.getLogger(__name__)
class Migration(migrations.Migration):
def backfill_learner(apps, schema_editor):
"""
... | from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.db import migrations, models
import django.db.models.deletion
import logging
logger = logging.getLogger(__name__)
class Migration(migrations.Migration):
def backfill_learner(apps, schema_editor):
"""
... |
Remove a now useless test | var merge = require('./merge');
var isPlainObject = require('./isPlainObject');
var hash = JSON.stringify;
function applyTransforms(transforms, declarations, transformCache, result) {
var property;
for (property in declarations) {
var value = declarations[property];
if (property in transform... | var merge = require('./merge');
var isPlainObject = require('./isPlainObject');
var hash = JSON.stringify;
function applyTransforms(transforms, declarations, transformCache, result) {
var property;
for (property in declarations) {
var value = declarations[property];
if (property in transform... |
Update the schema instead of ignoring when the schema for the table already exists | <?php
namespace Common\Doctrine\Entity;
use Doctrine\DBAL\Exception\TableExistsException;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Tools\SchemaTool;
use Doctrine\ORM\Tools\ToolsException;
class CreateSchema
{
/** @var EntityManager */
private $entityManager;
/**
* @param EntityManager $enti... | <?php
namespace Common\Doctrine\Entity;
use Doctrine\DBAL\Exception\TableExistsException;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Tools\SchemaTool;
class CreateSchema
{
/** @var EntityManager */
private $entityManager;
/**
* @param EntityManager $entityManager
*/
public function _... |
Fix placement of newly added list items
Update how we work out where to add new items to lists to cope with
the changed page layout | // ------------------------
// Launch a backbone powered entry box when someone clicks the new-person button
// ------------------------
define(
[
'jquery',
'underscore',
'instance-admin/views/list-item-edit'
],
function (
$,
_,
ListItemEditView
) {
"use strict";
return ... | // ------------------------
// Launch a backbone powered entry box when someone clicks the new-person button
// ------------------------
define(
[
'jquery',
'underscore',
'instance-admin/views/list-item-edit'
],
function (
$,
_,
ListItemEditView
) {
"use strict";
return ... |
Fix jslint warning in null checks | /*!
* Wef
* Copyright (c) 2011 Pablo Escalada
* MIT Licensed
*/
/**
* wef module
*/
(function(global) {
var wef = function() {
return new wef.prototype.init();
};
wef.prototype = {
constructor:wef,
version: "0.0.1",
init: function() {
return this;
}... | /*!
* Wef
* Copyright (c) 2011 Pablo Escalada
* MIT Licensed
*/
/**
* wef module
*/
(function(global) {
var wef = function() {
return new wef.prototype.init();
};
wef.prototype = {
constructor:wef,
version: "0.0.1",
init: function() {
return this;
}... |
Add ld alias for the link subcommand. | """ Main entry point """
# from ppci.cli import main
import sys
import importlib
valid_programs = [
"archive",
"asm",
"build",
"c3c",
"cc",
"disasm",
"hexdump",
"hexutil",
"java",
"ld",
"link",
"llc",
"mkuimage",
"objcopy",
"objdump",
"ocaml",
"op... | """ Main entry point """
# from ppci.cli import main
import sys
import importlib
valid_programs = [
"archive",
"asm",
"build",
"c3c",
"cc",
"disasm",
"hexdump",
"hexutil",
"java",
"link",
"llc",
"mkuimage",
"objcopy",
"objdump",
"ocaml",
"opt",
"p... |
Remove the print from datashape | """Error handling"""
syntax_error = """
File {filename}, line {lineno}
{line}
{pointer}
{error}: {msg}
"""
class DataShapeSyntaxError(SyntaxError):
"""
Makes datashape parse errors look like Python SyntaxError.
"""
def __init__(self, lexpos, filename, text, msg=None):
self.lexpos =... | """Error handling"""
syntax_error = """
File {filename}, line {lineno}
{line}
{pointer}
{error}: {msg}
"""
class DataShapeSyntaxError(SyntaxError):
"""
Makes datashape parse errors look like Python SyntaxError.
"""
def __init__(self, lexpos, filename, text, msg=None):
self.lexpos =... |
Fix assertion.
… since the Formatter has to be inside store emulation to retrieve correct value. | <?php
/**
* @group category
*/
class SPM_ShopyMind_Test_DataMapper_Category extends EcomDev_PHPUnit_Test_Case
{
private $SUT;
protected function setUp()
{
parent::setUp();
$this->SUT = new SPM_ShopyMind_DataMapper_Category();
}
protected function tearDown()
{
parent:... | <?php
/**
* @group category
*/
class SPM_ShopyMind_Test_DataMapper_Category extends EcomDev_PHPUnit_Test_Case
{
private $SUT;
protected function setUp()
{
parent::setUp();
$this->SUT = new SPM_ShopyMind_DataMapper_Category();
}
protected function tearDown()
{
parent:... |
Remove change fn from nestedMenuCollection | "use strict";
angular.module('arethusa.relation').directive('nestedMenuCollection', function() {
return {
restrict: 'A',
replace: 'true',
scope: {
current: '=',
all: '=',
property: '=',
ancestors: '=',
emptyVal: '@',
labelAs: "=",
},
link: function(scope, eleme... | "use strict";
angular.module('arethusa.relation').directive('nestedMenuCollection', function() {
return {
restrict: 'A',
replace: 'true',
scope: {
current: '=',
all: '=',
property: '=',
ancestors: '=',
emptyVal: '@',
labelAs: "=",
change: "&"
},
link: fun... |
Send message to user with fixed id | "use strict";
var shared = require("./shared.js");
var UserPages = require("./UserPages.js");
var fs = require("fs");
var exec = require("sync-exec");
var EC = protractor.ExpectedConditions;
var _ = require("lodash");
describe("user page", function() {
var currentDate = Date.now().toString();
var subject = "t... | "use strict";
var shared = require("./shared.js");
var UserPages = require("./UserPages.js");
var fs = require("fs");
var exec = require("sync-exec");
var EC = protractor.ExpectedConditions;
var _ = require("lodash");
describe("user page", function() {
var currentDate = Date.now().toString();
var subject = "t... |
Fix compatibility issue with PHP 5.3 | <?php
namespace SlmQueue\Job;
use Zend\Stdlib\Message;
/**
* This class is supposed to be extended. To create a job, just implements the missing "execute" method. If a queueing
* system needs more information, you can extend this class (but for both Beanstalk and SQS this is enough)
*/
abstract class AbstractJob ... | <?php
namespace SlmQueue\Job;
use Zend\Stdlib\Message;
/**
* This class is supposed to be extended. To create a job, just implements the missing "execute" method. If a queueing
* system needs more information, you can extend this class (but for both Beanstalk and SQS this is enough)
*/
abstract class AbstractJob ... |
Create route for new meal form | import React, { Component } from 'react';
import './App.css';
import Nav from './components/Nav'
import Home from './components/Home'
import HouseholdsContainer from './components/HouseholdsContainer'
import Signup from './components/Signup'
import Login from './components/Login'
import { authenticate, authenticationFa... | import React, { Component } from 'react';
import './App.css';
import Nav from './components/Nav'
import Home from './components/Home'
import HouseholdsContainer from './components/HouseholdsContainer'
import Signup from './components/Signup'
import Login from './components/Login'
import { authenticate, authenticationFa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.