text stringlengths 17 1.47k | positive stringlengths 673 4.43k | negative stringlengths 677 2.81k |
|---|---|---|
Clear Results for next submit | 'use strict';
// Declare app level module which depends on views, and components
/*angular.module('myApp', [
'ngRoute',
'myApp.view1',
'myApp.view2',
'myApp.version'
]).
config(['$locationProvider', '$routeProvider', function($locationProvider, $routeProvider) {
$locationProvider.hashPrefix('!');
$routePr... | 'use strict';
// Declare app level module which depends on views, and components
/*angular.module('myApp', [
'ngRoute',
'myApp.view1',
'myApp.view2',
'myApp.version'
]).
config(['$locationProvider', '$routeProvider', function($locationProvider, $routeProvider) {
$locationProvider.hashPrefix('!');
$routePr... |
Refactor bind_to spec to better performance | var vows = require('vows')
, assert = require('assert')
, Glue = require(__dirname + "/../lib/glue");
var suite = vows.describe('bindTo')
suite.addBatch({
"ensures": {
topic: new Glue({}),
"that the target object of glue is changed": function(topic) {
topic.target = {};
topic.bindTo({... | var vows = require('vows')
, assert = require('assert')
, Glue = require(__dirname + "/../lib/glue");
var suite = vows.describe('bindTo')
suite.addBatch({
"ensures": {
"that the target object of glue is changed": function() {
var topic = new Glue({an: "object"});
topic.bindTo({another: "ob... |
Disable testcase3 with child node edgecase | package io.apiman.plugins.transformation_policy.transformer;
import java.io.IOException;
import org.apache.commons.io.IOUtils;
import org.custommonkey.xmlunit.XMLTestCase;
import org.custommonkey.xmlunit.XMLUnit;
@SuppressWarnings("nls")
public class JsonToXmlTransformerTest extends XMLTestCase {
sta... | package io.apiman.plugins.transformation_policy.transformer;
import java.io.IOException;
import org.apache.commons.io.IOUtils;
import org.custommonkey.xmlunit.XMLTestCase;
import org.custommonkey.xmlunit.XMLUnit;
@SuppressWarnings("nls")
public class JsonToXmlTransformerTest extends XMLTestCase {
sta... |
Make debug log handle multiple arguments
Ex: console.log('delivery receipt', phone_number, timestamp)
// FREEBIE | /*
* vim: ts=4:sw=4:expandtab
*/
(function () {
'use strict';
var MAX_MESSAGES = 1000;
var PHONE_REGEX = /\+\d{7,12}(\d{3})/g;
var debugLog = [];
if (window.console) {
console._log = console.log;
console.log = function(){
console._log.apply(this, arguments);
... | /*
* vim: ts=4:sw=4:expandtab
*/
(function () {
'use strict';
var MAX_MESSAGES = 1000;
var PHONE_REGEX = /\+\d{7,12}(\d{3})/g;
var debugLog = [];
if (window.console) {
console._log = console.log;
console.log = function(thing){
console._log(thing);
if (debugL... |
Fix missing closing bracket for redirect() method | <?php
/**
* Backend {{ moduleName }} {{ action }} action
*/
{% if action in ['index', 'add', 'edit', 'delete'] %}
class Backend{{ moduleName|capitalize }}{{ action|capitalize }} extends BackendBaseAction{{ action|capitalize }}
{% else %}
class Backend{{ moduleName|capitalize }}{{ action|capitalize }} extends BackendB... | <?php
/**
* Backend {{ moduleName }} {{ action }} action
*/
{% if action in ['index', 'add', 'edit', 'delete'] %}
class Backend{{ moduleName|capitalize }}{{ action|capitalize }} extends BackendBaseAction{{ action|capitalize }}
{% else %}
class Backend{{ moduleName|capitalize }}{{ action|capitalize }} extends BackendB... |
Add _init check for Vue.http being set | module.exports = {
_init: function () {
if ( ! this.options.Vue.http) {
return 'vue-resource.1.x.js : Vue.http must be set.';
}
},
_interceptor: function (req, res) {
var _this = this;
this.options.Vue.http.interceptors.push(function (request, next) {
... | module.exports = {
_interceptor: function (req, res) {
var _this = this;
this.options.Vue.http.interceptors.push(function (request, next) {
if (req) { req.call(_this, request); }
next(function (response) {
if (res) { res.call(_this, response... |
Use normal query if no data is passed or using bind method if there is data passed | <?php
namespace DB;
include (SYSTEM_PATH . 'db/IDriver.php');
class DB
{
private $dbDriver;
public function __construct()
{
$config =& loadClass('Config', 'Core');
$cfg = $config->load('DB');
if ($cfg !== false)
{
... | <?php
namespace DB;
include (SYSTEM_PATH . 'db/IDriver.php');
class DB
{
private $dbDriver;
public function __construct()
{
$config =& loadClass('Config', 'Core');
$cfg = $config->load('DB');
if ($cfg !== false)
{
... |
Remove logging and parameter from dismiss function
- The page routes have been updated to reflect the user model change for
moving posts to all connections rather than for each connection; as
such, /dismiss/all will remove all existing posts and the connection
parameter is no longer necessary
- Remove unneeded l... | function dismiss(id, el) {
$.post('/dismiss/' + id, function(data) {
var post = $(el).closest('div.row');
$.when(post.fadeOut()).then(function() {
post.remove().delay(1000);
if (id === 'all') window.location.reload();
});
});
}
function refresh() {
$('#refres... | function dismiss(id, connection, el) {
$.post('/dismiss/' + connection + '/' + id, function(data) {
var post = $(el).closest('div.row');
$.when(post.fadeOut()).then(function() {
post.remove().delay(1000);
if (id === 'all') window.location.reload();
});
});
}
func... |
Fix bad invocation of old, dead code | export default function createNodeIterator(root, whatToShow, filter = null) {
let document = root.ownerDocument;
var iter = document.createNodeIterator(root, whatToShow, filter, false);
return typeof(iter.referenceNode) === 'undefined' ? shim(iter, root) : iter;
}
function shim(iter, root) {
var _referenceNod... | export default function createNodeIterator(root, whatToShow, filter = null) {
var iter = _create.call(window.document, root, whatToShow, filter, false);
return typeof(iter.referenceNode) === 'undefined' ? shim(iter, root) : iter;
}
function shim(iter, root) {
var _referenceNode = root;
var _pointerBeforeRefer... |
Throw error if no frame is found. | define(['exports', 'module',
'events',
'class'],
function(exports, module, Emitter, clazz) {
function send(data, origin, win) {
if (!win) {
var frame;
for (var i = 0, len = window.frames.length; i < len; i++) {
frame = window.frames[i];
if (frame.location == origin) ... | define(['exports', 'module',
'events',
'class'],
function(exports, module, Emitter, clazz) {
function send(data, origin, win) {
if (!win) {
var frame;
for (var i = 0, len = window.frames.length; i < len; i++) {
frame = window.frames[i];
if (frame.location == origin) ... |
Use the bin in node_modules | module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
babel: {
options: {
sourceMap: false
},
dist: {
files: [{
expand: true,
cwd: 'src',
src: ['**/*.js'],
dest: "lib",
ext: ".js"
... | module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
babel: {
options: {
sourceMap: false
},
dist: {
files: [{
expand: true,
cwd: 'src',
src: ['**/*.js'],
dest: "lib",
ext: ".js"
... |
Add title text to sync button | import React from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import { translate as $t, formatDate } from '../../helpers';
import { actions, get } from '../../store';
const Export = connect(
(state, props) => {
let access = get.accessById(state, props.account.bankAc... | import React from 'react';
import { connect } from 'react-redux';
import PropTypes from 'prop-types';
import { translate as $t, formatDate } from '../../helpers';
import { actions, get } from '../../store';
const Export = connect(
(state, props) => {
let access = get.accessById(state, props.account.bankAc... |
Fix install error on python 2.7 | #!/usr/bin/env python3
# encoding: UTF-8
"""Build tar.gz for pygubu
Needed packages to run (using Debian/Ubuntu package names):
python3-tk
"""
import os
from io import open
import pygubu
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
VERSION = pygubu.__version__... | #!/usr/bin/env python3
# encoding: UTF-8
"""Build tar.gz for pygubu
Needed packages to run (using Debian/Ubuntu package names):
python3-tk
"""
import os
import pygubu
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
VERSION = pygubu.__version__
_dirname_ = os.pat... |
Expand test to cover variables. | import json
from webtest import TestApp as Client
from wsgi_graphql import wsgi_graphql
from graphql.core.type import (
GraphQLObjectType,
GraphQLField,
GraphQLArgument,
GraphQLNonNull,
GraphQLSchema,
GraphQLString,
)
def raises(*_):
raise Exception("Raises!")
TestSchema = GraphQLSchema... | from webtest import TestApp as Client
from wsgi_graphql import wsgi_graphql
from graphql.core.type import (
GraphQLEnumType,
GraphQLEnumValue,
GraphQLInterfaceType,
GraphQLObjectType,
GraphQLField,
GraphQLArgument,
GraphQLList,
GraphQLNonNull,
GraphQLSchema,
GraphQLString,
)
d... |
Remove default 'group' class name | import React from 'react';
import classNames from 'classnames';
import ListItem from './ListItem';
export default class List extends React.Component {
getListItems(list, childIndex) {
var that = this;
childIndex = childIndex || 0;
var items = list.map(function(item, parentIndex) {
var key = pare... | import React from 'react';
import classNames from 'classnames';
import ListItem from './ListItem';
export default class List extends React.Component {
getListItems(list, childIndex) {
var that = this;
childIndex = childIndex || 0;
var items = list.map(function(item, parentIndex) {
var key = pare... |
Use `str_replace` instead of `preg_replace` | <?php
/*
* This file is part of Psy Shell
*
* (c) 2013 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Psy\Test\Formatter;
use Psy\Formatter\CodeFormatter;
class CodeFormatterTest extends \PHPUnit_Frame... | <?php
/*
* This file is part of Psy Shell
*
* (c) 2013 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Psy\Test\Formatter;
use Psy\Formatter\CodeFormatter;
class CodeFormatterTest extends \PHPUnit_Frame... |
Fix search reducer when no results are found | import values from 'lodash/values';
import queryString from 'query-string';
import { UPDATE_PATH } from 'redux-simple-router';
import Immutable from 'seamless-immutable';
import types from 'constants/ActionTypes';
import { pickSupportedFilters } from 'utils/SearchUtils';
const initialState = Immutable({
filters: {
... | import values from 'lodash/values';
import queryString from 'query-string';
import { UPDATE_PATH } from 'redux-simple-router';
import Immutable from 'seamless-immutable';
import types from 'constants/ActionTypes';
import { pickSupportedFilters } from 'utils/SearchUtils';
const initialState = Immutable({
filters: {
... |
Change the URL where the repository is hosted. | """Package setup configuration.
To Install package, run:
>>> python setup.py install
To install package with a symlink, so that changes to the source files will be immediately available, run:
>>> python setup.py develop
"""
from __future__ import print_function
from setuptools import setup, find_packages
__... | """Package setup configuration.
To Install package, run:
>>> python setup.py install
To install package with a symlink, so that changes to the source files will be immediately available, run:
>>> python setup.py develop
"""
from __future__ import print_function
from setuptools import setup, find_packages
__... |
Apply PHP CS Fixer changes | <?php
declare(strict_types=1);
namespace Telegram\Bot\Tests\Unit\Objects;
use PHPUnit\Framework\TestCase;
use Telegram\Bot\Objects\Chat;
use Telegram\Bot\Objects\Update;
/** @covers \Telegram\Bot\Objects\Update */
class UpdateTest extends TestCase
{
/** @test */
public function it_parses_chat_relation_for_b... | <?php declare(strict_types=1);
namespace Telegram\Bot\Tests\Unit\Objects;
use PHPUnit\Framework\TestCase;
use Telegram\Bot\Objects\Chat;
use Telegram\Bot\Objects\Update;
/** @covers \Telegram\Bot\Objects\Update */
class UpdateTest extends TestCase
{
/** @test */
public function it_parses_chat_relation_for_bo... |
Revert "Refactoring of various aspects of this directive" | angular.module('eee-c.angularBindPolymer', []).
directive('bindPolymer', function() {
return {
restrict: 'A',
link: function(scope, element, attrs) {
var attrMap = {};
for (var prop in attrs.$attr) {
if (prop != 'bindPolymer') {
var _attr = attrs.$attr[prop];
var _match... | angular.module('eee-c.angularBindPolymer', [])
.directive('bindPolymer', function() {
'use strict';
return {
restrict: 'A',
link: function($scope, $element, attributes) {
var attrs = {};
angular.forEach(attributes.$attr, function(keyName, key) {
var val;
if (key... |
Add Tutorial to backend : get article by translated slug | <?php
namespace FBN\GuideBundle\Entity;
use Doctrine\ORM\EntityRepository;
/**
* TutorialRepository.
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class TutorialRepository extends EntityRepository
{
public function getArticlesImages($first = 0, $limit =... | <?php
namespace FBN\GuideBundle\Entity;
use Doctrine\ORM\EntityRepository;
/**
* TutorialRepository.
*
* This class was generated by the Doctrine ORM. Add your own custom
* repository methods below.
*/
class TutorialRepository extends EntityRepository
{
public function getArticlesImages($first = 0, $limit =... |
Fix Json error for Python3 compatibility | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import pprint
import json
class View(object):
def service_list(self, service_list):
print('service LIST:')
for service in service_list:
print(service)
print('')
def service_information(self, action, name, *argv):
print... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import pprint
import json
class View(object):
def service_list(self, service_list):
print('service LIST:')
for service in service_list:
print(service)
print('')
def service_information(self, action, name, *argv):
print... |
Set metadata as UI title only when someone changes it | 'use strict';
/*global Wodo*/
angular.module('manticoreApp')
.controller('TitleEditorCtrl', function ($scope, $timeout) {
function handleTitleChanged(changes) {
var title = changes.setProperties['dc:title'];
if (title !== undefined && title !== $scope.title) {
$timeout(function () {
... | 'use strict';
/*global Wodo*/
angular.module('manticoreApp')
.controller('TitleEditorCtrl', function ($scope, $timeout) {
function handleTitleChanged(changes) {
var title = changes.setProperties['dc:title'];
if (title !== undefined && title !== $scope.title) {
$timeout(function () {
... |
Use extension method for Observer.checked | from six import add_metaclass
from rx import Observer
from rx.internal import ExtensionMethod
from rx.internal.exceptions import ReEntracyException, CompletedException
class CheckedObserver(Observer):
def __init__(self, observer):
self._observer = observer
self._state = 0 # 0 - idle, 1 - busy, 2 -... | from rx import Observer
from rx.internal.exceptions import ReEntracyException, CompletedException
class CheckedObserver(Observer):
def __init__(self, observer):
self._observer = observer
self._state = 0 # 0 - idle, 1 - busy, 2 - done
def on_next(self, value):
self.check_access()
... |
Clean up exception error message | export default function(tokens) {
const items = tokens.body;
function walk(token) {
// If no type exists, continue
if (!token || !token.valueType || token.valueType === "let") {
return;
}
const type = token.valueType;
const values = token.value;
for (let i = 0; i < values.length; i+... | export default function(tokens) {
const items = tokens.body;
function walk(token) {
// If no type exists, continue
if (!token || !token.valueType || token.valueType === "let") {
return;
}
const type = token.valueType;
const values = token.value;
for (let i = 0; i < values.length; i+... |
Update tests for nbgrader feedback | from .base import TestBase
from nbgrader.api import Gradebook
import os
import shutil
class TestNbgraderFeedback(TestBase):
def _setup_db(self):
dbpath = self._init_db()
gb = Gradebook(dbpath)
gb.add_assignment("ps1")
gb.add_student("foo")
return dbpath
def test_help(... | from .base import TestBase
from nbgrader.api import Gradebook
import os
class TestNbgraderFeedback(TestBase):
def _setup_db(self):
dbpath = self._init_db()
gb = Gradebook(dbpath)
gb.add_assignment("Problem Set 1")
gb.add_student("foo")
gb.add_student("bar")
return ... |
Increase sleep time to a more conservative level | package annis.gui;
import com.github.mvysny.kaributesting.v8.MockVaadin;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeoutException;
import org.slf4j.LoggerFactory;
public class TestHelper {
private static final org.slf4j.Logger log = LoggerFactory.getLogger(TestHelper.class);
private T... | package annis.gui;
import com.github.mvysny.kaributesting.v8.MockVaadin;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeoutException;
import org.slf4j.LoggerFactory;
public class TestHelper {
private static final org.slf4j.Logger log = LoggerFactory.getLogger(TestHelper.class);
private T... |
Change order of client registration | <?php
namespace Laravel\Scout;
use Illuminate\Support\ServiceProvider;
use Laravel\Scout\Console\FlushCommand;
use Laravel\Scout\Console\ImportCommand;
use MeiliSearch\Client as MeiliSearch;
class ScoutServiceProvider extends ServiceProvider
{
/**
* Register the service provider.
*
* @return void
... | <?php
namespace Laravel\Scout;
use Illuminate\Support\ServiceProvider;
use Laravel\Scout\Console\FlushCommand;
use Laravel\Scout\Console\ImportCommand;
use MeiliSearch\Client as MeiliSearch;
class ScoutServiceProvider extends ServiceProvider
{
/**
* Register the service provider.
*
* @return void
... |
Use dynamically updated cents value if available (total may change as shipping methods are changed, etc) | <?php defined('C5_EXECUTE') or die(_("Access Denied."));?>
<script src="https://checkout.stripe.com/checkout.js"></script>
<input type="hidden" value="" name="stripeToken" id="stripeToken" />
<script>
$(document).ready(function() {
var handler = StripeCheckout.configure({
key: '<?= $publicAPIKey... | <?php defined('C5_EXECUTE') or die(_("Access Denied."));?>
<script src="https://checkout.stripe.com/checkout.js"></script>
<input type="hidden" value="" name="stripeToken" id="stripeToken" />
<script>
$(document).ready(function() {
var handler = StripeCheckout.configure({
key: '<?= $publicAPIKey... |
PUT services rather than POSTing them | #!/usr/bin/env python
import sys
import json
import os
import requests
import multiprocessing
def list_files(directory):
for root, subdirs, files in os.walk(directory):
print("ROOT: {}".format(root))
for file in files:
yield os.path.abspath(os.path.join(root, file))
for subdir... | #!/usr/bin/env python
import sys
import os
import requests
import multiprocessing
def list_files(directory):
for root, subdirs, files in os.walk(directory):
print("ROOT: {}".format(root))
for file in files:
yield os.path.abspath(os.path.join(root, file))
for subdir in subdirs:... |
Switch back to DROP IF EXISTS | package me.xdrop.passlock.datasource.sqlite;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
public class SQLitePrepare {
private final static Logger LOG = LoggerFactory.getLogger(SQL... | package me.xdrop.passlock.datasource.sqlite;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
public class SQLitePrepare {
private final static Logger LOG = LoggerFactory.getLogger(SQL... |
Enable min_priority again - seems to be working? | #!/usr/bin/python
import board
import pente_exceptions
from ab_state import *
CAPTURE_SCORE_BASE = 120 ** 3
class ABGame():
""" This class acts as a bridge between the AlphaBeta code and my code """
def __init__(self, base_game):
s = self.current_state = ABState()
s.set_state(base_game.curre... | #!/usr/bin/python
import board
import pente_exceptions
from ab_state import *
CAPTURE_SCORE_BASE = 120 ** 3
class ABGame():
""" This class acts as a bridge between the AlphaBeta code and my code """
def __init__(self, base_game):
s = self.current_state = ABState()
s.set_state(base_game.curre... |
Add better __repr__s for commands errors. | class CommandsError(Exception):
pass
class CheckFailureError(Exception):
def __init__(self, ctx, check):
self.ctx = ctx
self.check = check
def __repr__(self):
if isinstance(self.check, list):
return "The checks for `{.name}` failed.".format(self.ctx)
return "Th... | class CommandsError(Exception):
pass
class CheckFailureError(Exception):
def __init__(self, ctx, check):
self.ctx = ctx
self.check = check
def __repr__(self):
if isinstance(self.check, list):
return "The checks for {.name} failed.".format(self.ctx)
return "The ... |
Fix MessageStack for model events | <?php
namespace SleepingOwl\Admin\Widgets\Messages;
use AdminTemplate;
use SleepingOwl\Admin\Widgets\Widget;
abstract class Messages extends Widget
{
/**
* @var string
*/
protected static $sessionName;
/**
* @var string
*/
protected $messageView;
/**
* Get content as a ... | <?php
namespace SleepingOwl\Admin\Widgets\Messages;
use AdminTemplate;
use SleepingOwl\Admin\Widgets\Widget;
abstract class Messages extends Widget
{
/**
* @var string
*/
protected static $sessionName;
/**
* @var string
*/
protected $messageView;
/**
* Get content as a ... |
Allow target attribute on menu links | <section class="sidebar">
<ul class="sidebar-menu">
<el-menu default-active="1"
:default-openeds="['1']"
theme="dark">
@foreach ($menu as $menuItem)
<el-menu-item index="0">
<a href="{{ URL::route($menuItem['route']) }}" targ... | <section class="sidebar">
<ul class="sidebar-menu">
<el-menu default-active="1"
:default-openeds="['1']"
theme="dark">
@foreach ($menu as $menuItem)
<el-menu-item index="0">
<a href="{{ URL::route($menuItem['route']) }}">
... |
Remove ugly bold formatting in messages | package fr.aumgn.diamondrush.views;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.bukkit.ChatColor;
public class MessagesView implements Iterable<String> {
private List<String> messages;
private StringBuilder current;
public MessagesView() {
this.messa... | package fr.aumgn.diamondrush.views;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.bukkit.ChatColor;
public class MessagesView implements Iterable<String> {
private List<String> messages;
private StringBuilder current;
public MessagesView() {
this.messa... |
Make Yeoman's greeting more cromulent. | 'use strict';
var yeoman = require('yeoman-generator');
var chalk = require('chalk');
var yosay = require('yosay');
module.exports = yeoman.generators.Base.extend({
prompting: function () {
var done = this.async();
// Have Yeoman greet the user.
this.log(yosay(
'Welcome to the most cromulent ' + c... | 'use strict';
var yeoman = require('yeoman-generator');
var chalk = require('chalk');
var yosay = require('yosay');
module.exports = yeoman.generators.Base.extend({
prompting: function () {
var done = this.async();
// Have Yeoman greet the user.
this.log(yosay(
'Welcome to the amazing ' + chalk.re... |
Modify help text on page header component to not use bootstrap js | define(['react', 'components/common/glyphicon'], function(React, Glyphicon) {
var PageHeader = React.createClass({
getInitialState: function() {
return {showHelpText: false};
},
render: function() {
var help_button = [];
var help_text = [];
if... | define(['react', 'components/common/glyphicon'], function(React, Glyphicon) {
var PageHeader = React.createClass({
render: function() {
var help_button = [];
var help_text = [];
if (this.props.helpText) {
help_button = React.DOM.button({
... |
posts: Add ability to filter posts by site | from django.contrib import admin
from reversion import VersionAdmin
from base.admin import PrettyFilterMixin, RestrictedCompetitionAdminMixin
from base.util import admin_commentable, editonly_fieldsets
from .models import Post
# Reversion-enabled Admin for problems
@admin_commentable
@editonly_fieldsets
class PostA... | from django.contrib import admin
from reversion import VersionAdmin
from base.admin import PrettyFilterMixin, RestrictedCompetitionAdminMixin
from base.util import admin_commentable, editonly_fieldsets
from .models import Post
# Reversion-enabled Admin for problems
@admin_commentable
@editonly_fieldsets
class PostA... |
Add self to list of filtered users for editors
Closes #4412 | import AuthenticatedRoute from 'ghost/routes/authenticated';
import PaginationRouteMixin from 'ghost/mixins/pagination-route';
import styleBody from 'ghost/mixins/style-body';
var paginationSettings,
UsersIndexRoute;
paginationSettings = {
page: 1,
limit: 20,
status: 'active'
};
UsersIndexRoute = Aut... | import AuthenticatedRoute from 'ghost/routes/authenticated';
import PaginationRouteMixin from 'ghost/mixins/pagination-route';
import styleBody from 'ghost/mixins/style-body';
var paginationSettings,
UsersIndexRoute;
paginationSettings = {
page: 1,
limit: 20,
status: 'active'
};
UsersIndexRoute = Aut... |
Fix Config loading in DownloadCsv | <?php
namespace NemC\IP2LocLite\Commands;
use Illuminate\Support\Facades\Config,
Illuminate\Console\Command,
NemC\IP2LocLite\Services\IP2LocLiteService,
NemC\IP2LocLite\Exceptions\NotLoggedInResponseException,
NemC\IP2LocLite\Exceptions\UnsupportedDatabaseCommandException;
class DownloadCsvCommand ex... | <?php
namespace NemC\IP2LocLite\Commands;
use Illuminate\Console\Config,
Illuminate\Console\Command,
NemC\IP2LocLite\Services\IP2LocLiteService,
NemC\IP2LocLite\Exceptions\NotLoggedInResponseException,
NemC\IP2LocLite\Exceptions\UnsupportedDatabaseCommandException;
class DownloadCsvCommand extends Co... |
Add -Wno-writable-strings to clean up output | #!/usr/bin/env python
from os import listdir
import re
#reads in old makefile from folder
#parses for compiler arguments
#creates cmake lists file with parsed arguments as parent-scope variables
def readAndMake(folder):
inStream = open(folder+"/Makefile", "r")
oldMake = inStream.readlines()
inStream.close... | #!/usr/bin/env python
from os import listdir
import re
#reads in old makefile from folder
#parses for compiler arguments
#creates cmake lists file with parsed arguments as parent-scope variables
def readAndMake(folder):
inStream = open(folder+"/Makefile", "r")
oldMake = inStream.readlines()
inStream.close... |
Use more pythonic pattern for default attributes | import urllib
import urllib.error
import urllib.request
from rasp.constants import DEFAULT_USER_AGENT
from rasp.errors import EngineError
class Engine(object):
def get_page_source(self, url):
raise NotImplemented("get_page_source not implemented for {}"
.format(str(self.__cla... | import urllib
import urllib.error
import urllib.request
from rasp.constants import DEFAULT_USER_AGENT
from rasp.errors import EngineError
class Engine(object):
def get_page_source(self, url):
raise NotImplemented("get_page_source not implemented for {}"
.format(str(self.__cla... |
Rewrite Api tests to ES2015 | 'use strict';
const assert = require('assert');
const sinon = require('sinon');
const Api = require('../../lib/endpoints/api');
const Request = require('../../lib/request');
describe('endpoints/api', () => {
describe('listFunctions', () => {
it('should set the request URL', () => {
const requ... | 'use strict';
var assert = require('assert');
var sinon = require('sinon');
var Api = require('../../lib/endpoints/api');
var Request = require('../../lib/request');
describe('endpoints/api', function () {
describe('listFunctions', function () {
it('should set the request URL', function () {
... |
Fix para que robotina no utilice sus propios mensajes como comando | var Discord = require('discord.io');
var bot = new Discord.Client({
autorun: true,
token: "MjUzNTcyNjgwNjYwMjg3NDg5.CyCfAA.12c7GJ7PCeEgt_XYRDDlVdB6b0g"
});
bot.on('ready', function(event) {
console.log('Logged in as %s - %s\n', bot.username, bot.id);
});
bot.on('message', function(user, userID, chan... | var Discord = require('discord.io');
var bot = new Discord.Client({
autorun: true,
token: "MjUzNTcyNjgwNjYwMjg3NDg5.CyCfAA.12c7GJ7PCeEgt_XYRDDlVdB6b0g"
});
bot.on('ready', function(event) {
console.log('Logged in as %s - %s\n', bot.username, bot.id);
});
bot.on('message', function(user, userID, chan... |
Remove redundant empty paragraph tag under IE family. | /*
jquery.popline.justify.js 0.1.0-dev
Version: 0.1.0-dev
Updated: Aug 11th, 2014
(c) 2014 by kenshin54
*/
;(function($) {
var removeRedundantParagraphTag = function(popline, align) {
if ($.popline.utils.browser.ie) {
$paragraphs = popline.target.find("p[align=" + align + "]");
$paragraphs.... | /*
jquery.popline.justify.js 0.1.0-dev
Version: 0.1.0-dev
Updated: Aug 11th, 2014
(c) 2014 by kenshin54
*/
;(function($) {
$.popline.addButton({
justify: {
iconClass: "fa fa-align-justify",
mode: "edit",
buttons: {
justifyLeft: {
iconClass: "fa fa-align-left",
... |
Add gauge Helper so card disappears | /*global define*/
define([
'jquery',
'underscore',
'backbone',
'templates',
'dygraphs',
'helpers/gauge-helper',
'marionette',
], function($, _, Backbone, JST, Dygraph, gaugeHelper) {
'use strict';
var IopsDashView = Backbone.Marionette.ItemView.extend({
... | /*global define*/
define([
'jquery',
'underscore',
'backbone',
'templates',
'dygraphs',
'marionette'
], function($, _, Backbone, JST, Dygraph) {
'use strict';
var IopsDashView = Backbone.Marionette.ItemView.extend({
className: 'custom-gutter col-sm-12 co... |
Enforce consistent artisan command tag namespacing | <?php
declare(strict_types=1);
namespace Rinvex\Tags\Console\Commands;
use Illuminate\Console\Command;
class PublishCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'rinvex:publish:tags {--f|force : Overwrite any exi... | <?php
declare(strict_types=1);
namespace Rinvex\Tags\Console\Commands;
use Illuminate\Console\Command;
class PublishCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'rinvex:publish:tags {--f|force : Overwrite any exi... |
Rewrite text-fill directive to use isolated scope. [IQSLDSH-382] | /*global angular*/
(function () {
'use strict';
// member attribute = member in slide to watch for changes
// min-font-size attribute = minimum font size in pixels
// max-font-size attribute = maximum font size in pixels
// Directive must be used on the parent of an element with the .text-fill clas... | /*global angular*/
(function () {
'use strict';
// min-font-size attribute = minimum font size in pixels
// max-font-size attribute = maximum font size in pixels
// Directive must be used on the parent of an element with the .text-fill class
angular.module('core').directive('textFill', ["$timeout",... |
Fix assumption that tornado.web was imported. | # -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
import os
import sys
import tornado.web
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop, PeriodicCallback
from gunicorn.workers.base import Worker
from gunicorn... | # -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
import os
import sys
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop, PeriodicCallback
from gunicorn.workers.base import Worker
from gunicorn import __version__... |
Fix roles check if no roles present | <?php namespace GeneaLabs\LaravelGovernor\Policies;
use GeneaLabs\LaravelGovernor\Permission;
class LaravelGovernorPolicy
{
protected $permissions;
public function __construct()
{
$this->permissions = Permission::with('role')->get();
}
protected function validatePermissions($user, $actio... | <?php namespace GeneaLabs\LaravelGovernor\Policies;
use GeneaLabs\LaravelGovernor\Permission;
class LaravelGovernorPolicy
{
protected $permissions;
public function __construct()
{
$this->permissions = Permission::with('role')->get();
}
protected function validatePermissions($user, $actio... |
[page] Add the cartrige left compoennt in the mixin. | var isFunction = require('lodash/lang/isFunction');
var dispatcher = require('focus').dispatcher;
var Empty = require('../../common/empty').component;
module.exports = {
/**
* Register the cartridge.
*/
_registerCartridge: function registerCartridge(){
this.cartridgeConfiguration = this.cartridg... | var isFunction = require('lodash/lang/isFunction');
var dispatcher = require('focus').dispatcher;
module.exports = {
/**
* Register the cartridge.
*/
_registerCartridge: function registerCartridge(){
this.cartridgeConfiguration = this.cartridgeConfiguration || this.props.cartridgeConfiguration;
... |
Tweak PayPal output to use Payee and Memo fields | #!/usr/bin/env python3
import argparse
import csv
parser = argparse.ArgumentParser()
parser.add_argument('--config', help='path to file containing column header mappings', required=True)
parser.add_argument('--csv-file', help='path to CSV file', required=True)
parser.add_argument('--skip-headers', help='skip first li... | #!/usr/bin/env python3
import argparse
import csv
parser = argparse.ArgumentParser()
parser.add_argument('--config', help='path to file containing column header mappings', required=True)
parser.add_argument('--csv-file', help='path to CSV file', required=True)
parser.add_argument('--skip-headers', help='skip first li... |
Return array instead of null because return value is evaluated in foreach | <?php
class Susy_Kwc_TextImage_Layout extends Susy_Layout
{
protected function _isSupportedContext($context)
{
if ($context['spans'] < 3) return false;
return true;
}
public function getChildContexts(Kwf_Component_Data $data, Kwf_Component_Data $child)
{
$ownContexts = paren... | <?php
class Susy_Kwc_TextImage_Layout extends Susy_Layout
{
protected function _isSupportedContext($context)
{
if ($context['spans'] < 3) return false;
return true;
}
public function getChildContexts(Kwf_Component_Data $data, Kwf_Component_Data $child)
{
$ownContexts = paren... |
Fix bug where specified bias is ignored. | package com.github.klane.wann.core;
import com.github.klane.wann.function.activation.ActivationFunction;
import com.github.klane.wann.function.input.InputFunction;
import com.google.common.base.Preconditions;
import javafx.util.Builder;
public abstract class WANNBuilder<T, U extends WANNBuilder<T, U>> implements Buil... | package com.github.klane.wann.core;
import com.github.klane.wann.function.activation.ActivationFunction;
import com.github.klane.wann.function.input.InputFunction;
import com.google.common.base.Preconditions;
import javafx.util.Builder;
public abstract class WANNBuilder<T, U extends WANNBuilder<T, U>> implements Buil... |
Use "FormHttpMessageConverter" for form based requests | package at.create.android.ffc.http;
import java.net.URI;
import org.springframework.http.converter.FormHttpMessageConverter;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
/**
* @author Philipp Ullmann
* Authenticate with username and password.
*/
public final ... | package at.create.android.ffc.http;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
/**
* @author Philipp Ullmann
* Authenticate... |
fix(global-options): Allow --sort to be configured from file | "use strict";
module.exports = globalOptions;
function globalOptions(yargs, { ci = false, loglevel = "info", progress = true }) {
// the global options applicable to _every_ command
const opts = {
loglevel: {
default: loglevel,
describe: "What level of logs to report.",
type: "string",
}... | "use strict";
module.exports = globalOptions;
function globalOptions(yargs, { ci = false, loglevel = "info", progress = true }) {
// the global options applicable to _every_ command
const opts = {
loglevel: {
default: loglevel,
describe: "What level of logs to report.",
type: "string",
}... |
Allow configuration of debug on prod lol | <?php
declare(strict_types=1);
if (!getenv('HEROKU')) {
return [];
}
return [
'debug' => (bool)\getenv('DEBUG'),
'config_cache_enabled' => true,
'doctrine' => [
'connection' => [
'orm_default' => [
'params' => [
'url' => \getenv('DATABASE_URL'),
... | <?php
declare(strict_types=1);
if (!getenv('HEROKU')) {
return [];
}
return [
'debug' => false,
'config_cache_enabled' => false,
'doctrine' => [
'connection' => [
'orm_default' => [
'params' => [
'url' => \getenv('DATABASE_URL'),
... |
Deal with case that item lines already exist before SI finalised | import Realm from 'realm';
import {
addLineToParent,
generateUUID,
getTotal,
} from '../utilities';
export class Transaction extends Realm.Object {
get isFinalised() {
return this.status === 'finalised';
}
get isConfirmed() {
return this.status === 'confirmed';
}
get totalPrice() {
return... | import Realm from 'realm';
import {
addLineToParent,
generateUUID,
getTotal,
} from '../utilities';
export class Transaction extends Realm.Object {
get isFinalised() {
return this.status === 'finalised';
}
get totalPrice() {
return getTotal(this.items, 'totalPrice');
}
// Adds a TransactionLi... |
Include all gin files in pip package.
PiperOrigin-RevId: 318120480 | """Install Mesh TensorFlow."""
from setuptools import find_packages
from setuptools import setup
setup(
name='mesh-tensorflow',
version='0.1.15',
description='Mesh TensorFlow',
author='Google Inc.',
author_email='no-reply@google.com',
url='http://github.com/tensorflow/mesh',
license='Apach... | """Install Mesh TensorFlow."""
from setuptools import find_packages
from setuptools import setup
setup(
name='mesh-tensorflow',
version='0.1.14',
description='Mesh TensorFlow',
author='Google Inc.',
author_email='no-reply@google.com',
url='http://github.com/tensorflow/mesh',
license='Apach... |
Drinks: Check the response whether null or empty | (function (env) {
"use strict";
function getInfoBoxData(item) {
var infoboxData = [{
heading: 'Ingredients:'
}];
for (var i = 1; i <= 15; i++) {
if(item["strIngredient" + i] !== "") {
infoboxData.push({
label: item["strMeasure"... | (function (env) {
"use strict";
function getInfoBoxData(item) {
var infoboxData = [{
heading: 'Ingredients:'
}];
for (var i = 1; i <= 15; i++) {
if(item["strIngredient" + i] !== "") {
infoboxData.push({
label: item["strMeasure"... |
Remove intent warning and allow zero values for settings | import React from 'react';
import PropTypes from 'prop-types';
import { InputGroup } from '@blueprintjs/core';
const Option = ({ intent, title, type, value, unit, onChange, inputStyles }) => (
<label className="pt-label pt-inline">
<div className="d-inline-block w-exact-225">{title} {unit && `(${unit})`}</div>
... | import React from 'react';
import PropTypes from 'prop-types';
import { InputGroup, Intent } from '@blueprintjs/core';
const Option = ({ intent, title, type, value, unit, onChange, inputStyles }) => (
<label className="pt-label pt-inline">
<div className="d-inline-block w-exact-225">{title} {unit && `(${unit})`}... |
Clean up existing gRPC bridge test (make it like t_tcpmapping.py)
- Remove redundant HTTP status assertions
- Adjust formatting
- Remove unused import | from kat.harness import Query
from abstract_tests import AmbassadorTest, ServiceType, EGRPC
class AcceptanceGrpcBridgeTest(AmbassadorTest):
target: ServiceType
def init(self):
self.target = EGRPC()
def config(self):
yield self, self.format("""
---
apiVersion: ambassador/v0
kind: Module... | import json
from kat.harness import Query
from abstract_tests import AmbassadorTest, ServiceType, EGRPC
class AcceptanceGrpcBridgeTest(AmbassadorTest):
target: ServiceType
def init(self):
self.target = EGRPC()
def config(self):
yield self, self.format("""
---
apiVersion: ambassador/v0
... |
Attach custom result popup menu to widget
Call gtk.Menu.attach_to_widget() on the popup menu for custom results.
This should have little practical result one way or the other, though
it is theoretically "right", but it has the useful side-effect of getting
the menu into the right GtkWindowGroup. Again that should have... | # Copyright 2007 Owen Taylor
#
# This file is part of Reinteract and distributed under the terms
# of the BSD license. See the file COPYING in the Reinteract
# distribution for full details.
#
########################################################################
import gtk
class CustomResult(object):
def creat... | # Copyright 2007 Owen Taylor
#
# This file is part of Reinteract and distributed under the terms
# of the BSD license. See the file COPYING in the Reinteract
# distribution for full details.
#
########################################################################
import gtk
class CustomResult(object):
def creat... |
Use jsonp() instead of generate_jsonp() | <?
include '../scat.php';
$days= (int)$_REQUEST['days'];
if (!$days) $days= 30;
$q= "SELECT DATE_FORMAT(filled, '%Y-%m-%d') day,
SUM(subtotal) AS total
FROM (SELECT
filled,
CAST(ROUND_TO_EVEN(
SUM(IF(type = 'customer', -1, 1) * allocate... | <?
include '../scat.php';
$days= (int)$_REQUEST['days'];
if (!$days) $days= 30;
$q= "SELECT DATE_FORMAT(filled, '%Y-%m-%d') day,
SUM(subtotal) AS total
FROM (SELECT
filled,
CAST(ROUND_TO_EVEN(
SUM(IF(type = 'customer', -1, 1) * allocate... |
Fix copy&pasted extension config root node name | <?php
namespace OwsProxy3\CoreBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* @author Christian Wygoda
*/
class Configuration implements ConfigurationInterface
{
/**
* {@inheritDoc}
*/
... | <?php
namespace OwsProxy3\CoreBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* @author Christian Wygoda
*/
class Configuration implements ConfigurationInterface
{
/**
* {@inheritDoc}
*/
... |
Fix missing comma in sohm al triggers | // Sohm Al (normal)
// Nobody remembers what to do here, so here's triggers.
[{
zoneRegex: /^Sohm Al$/,
triggers: [
{
id: 'Sohm Al Myath Stack',
regex: /1B:........:(\y{Name}):....:....:0017:0000:0000:0000:/,
alertText: function(data) {
if (data.matches[1] == data.me)
return ... | // Sohm Al (normal)
// Nobody remembers what to do here, so here's triggers.
[{
zoneRegex: /^Sohm Al$/
triggers: [
{
id: 'Sohm Al Myath Stack',
regex: /1B:........:(\y{Name}):....:....:0017:0000:0000:0000:/,
alertText: function(data) {
if (data.matches[1] == data.me)
return '... |
Add build as a possible environment option | """Add application.properties to Application's S3 Bucket directory."""
import logging
import argparse
from .create_archaius import init_properties
LOG = logging.getLogger(__name__)
def main():
"""Create application.properties for a given application."""
logging.basicConfig()
parser = argparse.ArgumentPar... | """Add application.properties to Application's S3 Bucket directory."""
import logging
import argparse
from .create_archaius import init_properties
LOG = logging.getLogger(__name__)
def main():
"""Create application.properties for a given application."""
logging.basicConfig()
parser = argparse.ArgumentPar... |
Move annotation type information before final keyword
Signed-off-by: Sebastian Hoß <1d6e1cf70ec6f9ab28d3ea4b27a49a77654d370e@shoss.de> | /*
* Copyright © 2013 Sebastian Hoß <mail@shoss.de>
* This work is free. You can redistribute it and/or modify it under the
* terms of the Do What The Fuck You Want To Public License, Version 2,
* as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
*/
package com.github.sebhoss.nullanalysis;
... | /*
* Copyright © 2013 Sebastian Hoß <mail@shoss.de>
* This work is free. You can redistribute it and/or modify it under the
* terms of the Do What The Fuck You Want To Public License, Version 2,
* as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
*/
package com.github.sebhoss.nullanalysis;
... |
Modify whitespaces according to ESLint, remove unused key and onClick | import React from 'react';
import ClipboardJS from 'clipboard';
import 'balloon-css/balloon.css';
export default class CopyButton extends React.PureComponent {
constructor(props) {
super(props);
this.copyBtnRef = React.createRef();
this.clipboardRef = React.createRef();
}
static defaultProps = {
... | import React from 'react';
import ClipboardJS from 'clipboard';
import 'balloon-css/balloon.css';
export default class CopyButton extends React.PureComponent {
constructor(props) {
super(props);
this.copyBtnRef = React.createRef();
this.clipboardRef = React.createRef();
}
static defaultProps = {
... |
Change truncate to delete from in db abstraction. Truncate is not getting rolled back in the new h2 db version, leaving things in a dirty state after failed block application. | package nxt.db;
import nxt.Nxt;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
public abstract class DerivedDbTable {
protected final String table;
protected DerivedDbTable(String table) {
this.table = table;
Nxt.getBl... | package nxt.db;
import nxt.Nxt;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
public abstract class DerivedDbTable {
protected final String table;
protected DerivedDbTable(String table) {
this.table = table;
Nxt.getBl... |
Change the way a method is called | window.$claudia = {
throttle: function (func, time) {
var wait = false
return function () {
if (wait) return
wait = true
setTimeout(function () {
func()
wait = false
}, time || 100)
}
},
fadeInImage: fun... | window.$claudia = {
imgAddLoadedEvent: function () {
var images = document.querySelectorAll('.js-progressive-loading')
// TODO: type is image ?
// TODO: read data-backdrop
function loaded(event) {
var image = event.currentTarget
var parent = image.parentEleme... |
Fix failing API gen test | import unittest
from falafel.tools import generate_api_config
class TestAPIGen(unittest.TestCase):
@classmethod
def setUpClass(cls):
from falafel.mappers import * # noqa
pass
def setUp(self):
self.latest = generate_api_config.APIConfigGenerator(plugin_package="falafel").serializ... | import unittest
from tools import generate_api_config
class TestAPIGen(unittest.TestCase):
@classmethod
def setUpClass(cls):
from falafel.mappers import * # noqa
pass
def setUp(self):
self.latest = generate_api_config.APIConfigGenerator(plugin_package="falafel").serialize_data_s... |
Remove Sf4.2 deprecation on TreeBuilder constructor | <?php
namespace AlterPHP\EasyAdminExtensionBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* This is the class that validates and merges configuration from your app/config files.
*
* To learn more see {@li... | <?php
namespace AlterPHP\EasyAdminExtensionBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
/**
* This is the class that validates and merges configuration from your app/config files.
*
* To learn more see {@li... |
Move requires to the top of the template | /*
* Copyright 2011 eBay Software Foundation
*
* 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 o... | /*
* Copyright 2011 eBay Software Foundation
*
* 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 o... |
Fix summary - pypi doesn't allow multiple lines | from setuptools import setup
setup(
name='django-markwhat',
version=".".join(map(str, __import__('django_markwhat').__version__)),
packages=['django_markwhat', 'django_markwhat.templatetags'],
url='http://pypi.python.org/pypi/django-markwhat',
license=open('LICENSE').read(),
author='Alireza Sav... | from setuptools import setup
setup(
name='django-markwhat',
version=".".join(map(str, __import__('django_markwhat').__version__)),
packages=['django_markwhat', 'django_markwhat.templatetags'],
url='http://pypi.python.org/pypi/django-markwhat',
license=open('LICENSE').read(),
author='Alireza Sav... |
Add view __call method for testing. | <?php
/**
* \YafUnit\View 通过模拟一个无法渲染无法读取模板的视图引擎获取视图中变量
* 子类\Yaf\View\Simple
* @author Lancer He <lancer.he@gmail.com>
* @since 2014-04-18
* @update 2015-07-10
*/
namespace YafUnit\View;
final class Simple extends \Yaf\View\Simple {
protected static $_instance = null;
/**
* 初始化一个单例对象,不需要模板路径以及任何渲... | <?php
/**
* \YafUnit\View 通过模拟一个无法渲染无法读取模板的视图引擎获取视图中变量
* 子类\Yaf\View\Simple
* @author Lancer He <lancer.he@gmail.com>
* @since 2014-04-18
* @update 2015-07-10
*/
namespace YafUnit\View;
final class Simple extends \Yaf\View\Simple {
protected static $_instance = null;
/**
* 初始化一个单例对象,不需要模板路径以及任何渲... |
Resolve all paths to CWD | var metaRouter = require('../');
var DataHolder = require('raptor-async/DataHolder');
var nodePath = require('path');
module.exports = function match(routes) {
var matcher;
var matcherDataHolder;
if (typeof routes === 'string') {
routes = nodePath.resolve(process.cwd(), routes);
m... | var metaRouter = require('../');
var DataHolder = require('raptor-async/DataHolder');
module.exports = function match(routes) {
var matcher;
var matcherDataHolder;
if (typeof routes === 'string') {
matcherDataHolder = new DataHolder();
metaRouter.routesLoader.load(routes, function(err, rou... |
Fix path to packaged sinon test dependency | module.exports = function (config) {
config.set({
browsers: [ 'PhantomJS' ],
plugins: [
'karma-mocha',
'karma-coverage',
'karma-coveralls',
'karma-phantomjs-launcher',
'karma-mocha-reporter'
],
frameworks: [ 'mocha' ],
... | module.exports = function (config) {
config.set({
browsers: [ 'PhantomJS' ],
plugins: [
'karma-mocha',
'karma-coverage',
'karma-coveralls',
'karma-phantomjs-launcher',
'karma-mocha-reporter'
],
frameworks: [ 'mocha' ],
... |
Allow compilation even in debug mode | import os
import subprocess
import tempfile
from webassets.filter import Filter
from webassets.exceptions import FilterError
__all__ = ('TypeScript',)
class TypeScript(Filter):
"""Compile `TypeScript <http://www.typescriptlang.org`_ to JavaScript.
TypeScript is an external tool written for NodeJS.
Th... | import os
import subprocess
import tempfile
from webassets.filter import Filter
from webassets.exceptions import FilterError
__all__ = ('TypeScript',)
class TypeScript(Filter):
"""Compile `TypeScript <http://www.typescriptlang.org`_ to JavaScript.
TypeScript is an external tool written for NodeJS.
Th... |
Fix one more style error | package seedu.bulletjournal.logic.parser;
/**
* Provides variations of commands Note: hard-coded for v0.2, will implement nlp
* for future versions
* @author Tu An - arishuynhvan
*/
public class FlexibleCommand {
private String commandFromUser = "";
private String[] commandGroups = new String[] { "add a a... | package seedu.bulletjournal.logic.parser;
/**
* Provides variations of commands Note: hard-coded for v0.2, will implement nlp
* for future versions
* @author Tu An - arishuynhvan
*/
public class FlexibleCommand {
private String commandFromUser = "";
private String[] commandGroups = new String[] { "add a a... |
Increase version and switch location to new upstream. | from distutils.core import setup
# Load in babel support, if available.
try:
from babel.messages import frontend as babel
cmdclass = {"compile_catalog": babel.compile_catalog,
"extract_messages": babel.extract_messages,
"init_catalog": babel.init_catalog,
"updat... | from distutils.core import setup
# Load in babel support, if available.
try:
from babel.messages import frontend as babel
cmdclass = {"compile_catalog": babel.compile_catalog,
"extract_messages": babel.extract_messages,
"init_catalog": babel.init_catalog,
"updat... |
Clean up now that we're no longer trying to use CSV_URL. | import os
try:
from urllib.parse import urljoin
from urllib.request import urlopen
except:
# for Python 2.7 compatibility
from urlparse import urljoin
from urllib2 import urlopen
from django.shortcuts import render
from django.views import View
from django.http import HttpResponse
from django.conf ... | import os
try:
from urllib.parse import urljoin
from urllib.request import urlopen
except:
# for Python 2.7 compatibility
from urlparse import urljoin
from urllib2 import urlopen
from django.shortcuts import render
from django.views import View
from django.http import HttpResponse
from django.conf ... |
Set the POI being saved on the Favourite model | define(['jquery', 'backbone', 'underscore', 'moxie.conf', 'hbs!places/templates/detail', 'hbs!places/templates/busrti', 'hbs!places/templates/trainrti'],
function($, Backbone, _, conf, detailTemplate, busRTITemplate, trainRTITemplate){
var RTI_REFRESH = 15000; // 15 seconds
var DetailView = Backbone.View... | define(['jquery', 'backbone', 'underscore', 'moxie.conf', 'hbs!places/templates/detail', 'hbs!places/templates/busrti', 'hbs!places/templates/trainrti'],
function($, Backbone, _, conf, detailTemplate, busRTITemplate, trainRTITemplate){
var RTI_REFRESH = 15000; // 15 seconds
var DetailView = Backbone.View... |
Update iDeal plugin for Symfony 3 | <?php
namespace Ruudk\Payment\MultisafepayBundle\Plugin;
use JMS\Payment\CoreBundle\Model\FinancialTransactionInterface;
use JMS\Payment\CoreBundle\Model\PaymentInstructionInterface;
use JMS\Payment\CoreBundle\Plugin\ErrorBuilder;
use Ruudk\Payment\MultisafepayBundle\Form\IdealType;
class IdealPlugin extends Default... | <?php
namespace Ruudk\Payment\MultisafepayBundle\Plugin;
use JMS\Payment\CoreBundle\Model\FinancialTransactionInterface;
use JMS\Payment\CoreBundle\Model\PaymentInstructionInterface;
use JMS\Payment\CoreBundle\Plugin\ErrorBuilder;
class IdealPlugin extends DefaultPlugin
{
public function processes($name)
{
... |
Use native method to get status code from response | <?php
namespace Omnipay\GoPay\Message;
use Omnipay\Common\Message\AbstractResponse;
use Omnipay\Common\Message\RedirectResponseInterface;
class PurchaseResponse extends AbstractResponse implements RedirectResponseInterface
{
/**
* Is the response successful?
*
* @return boolean
*/
public ... | <?php
namespace Omnipay\GoPay\Message;
use Omnipay\Common\Message\AbstractResponse;
use Omnipay\Common\Message\RedirectResponseInterface;
class PurchaseResponse extends AbstractResponse implements RedirectResponseInterface
{
/**
* Is the response successful?
*
* @return boolean
*/
public ... |
Add photo to avatar if possible | import React from 'react'
import { ScrollView, View } from 'react-native'
import { List, ListItem, SearchBar } from 'react-native-elements'
import PropTypes from 'prop-types'
function PersonListView({colors, styles, list, handlePress}) {
return (
<View style={styles.container}>
<SearchBar
lightThem... | import React from 'react'
import { ScrollView, View } from 'react-native'
import { List, ListItem, SearchBar } from 'react-native-elements'
import PropTypes from 'prop-types'
function PersonListView({colors, styles, list, handlePress}) {
return (
<View style={styles.container}>
<SearchBar
lightThem... |
Check if mail config exists | <?php
/*
* This file is part of WordPlate.
*
* (c) Vincent Klaiber <hello@vinkla.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace WordPlate\WordPress\Components;
use PHPMailer;
/**
* This is the mail component.
... | <?php
/*
* This file is part of WordPlate.
*
* (c) Vincent Klaiber <hello@vinkla.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace WordPlate\WordPress\Components;
use PHPMailer;
/**
* This is the mail component.
... |
Set whether to use count walker for iterator count
Can get the following error:
```
Cannot count query that uses a HAVING clause. Use the output walkers for pagination
```
This can happen when attempting to iterate over a query containing a 'HAVING' clause. Allowing the user to set that a count walker shouldn'... | <?php
namespace Oro\Bundle\DataGridBundle\Datasource\Orm;
use Doctrine\ORM\Query;
use Doctrine\ORM\QueryBuilder;
use Oro\Bundle\DataGridBundle\Datasource\ResultRecord;
use Oro\Bundle\BatchBundle\ORM\Query\BufferedQueryResultIterator;
/**
* Iterates query result with elements of ResultRecord type
*/
class Iterable... | <?php
namespace Oro\Bundle\DataGridBundle\Datasource\Orm;
use Doctrine\ORM\Query;
use Doctrine\ORM\QueryBuilder;
use Oro\Bundle\DataGridBundle\Datasource\ResultRecord;
use Oro\Bundle\BatchBundle\ORM\Query\BufferedQueryResultIterator;
/**
* Iterates query result with elements of ResultRecord type
*/
class Iterable... |
tests: Replace control hasher with constant hexdigest.
Signed-off-by: Michael Markert <5eb998b7ac86da375651a4cd767b88c9dad25896@googlemail.com> | from hashlib import sha1
from tempfile import TemporaryFile
from contextlib import contextmanager
from penchy.compat import unittest, nested, update_hasher, unicode_
class NestedTest(unittest.TestCase):
def test_reraising_exception(self):
e = Exception('reraise this')
with self.assertRaises(Excep... | from hashlib import sha1
from tempfile import TemporaryFile
from contextlib import contextmanager
from penchy.compat import unittest, nested, update_hasher
class NestedTest(unittest.TestCase):
def test_reraising_exception(self):
e = Exception('reraise this')
with self.assertRaises(Exception) as r... |
Add support of Google Guice dependency injection at integration tests | package com.centurylinkcloud.servers.service;
import com.centurylinkcloud.servers.config.ServersModule;
import com.centurylinkcloud.servers.domain.*;
import com.centurylinkcloud.servers.domain.datacenter.DataCenters;
import com.google.inject.Guice;
import com.google.inject.Inject;
import com.google.inject.Injector;
im... | package com.centurylinkcloud.servers.service;
import com.centurylinkcloud.servers.config.ServersModule;
import com.centurylinkcloud.servers.domain.*;
import com.centurylinkcloud.servers.domain.datacenter.DataCenters;
import com.google.inject.Guice;
import com.google.inject.Inject;
import com.google.inject.Injector;
im... |
Remove a logging call, not needed anymore. | import time
from contextlib import contextmanager
import six
import inspect
import importlib
import logging
from redis.exceptions import RedisError
from django_redis import get_redis_connection
logger = logging.getLogger('cq')
def to_import_string(func):
if inspect.isfunction(func) or inspect.isbuiltin(func):
... | import time
from contextlib import contextmanager
import six
import inspect
import importlib
import logging
from redis.exceptions import RedisError
from django_redis import get_redis_connection
logger = logging.getLogger('cq')
def to_import_string(func):
if inspect.isfunction(func) or inspect.isbuiltin(func):
... |
Rewrite Scope with prototypal notation | // Heavily inspired by coffee-script again
(function() {
var Scope;
exports.Scope = Scope = (function () {
Scope.root = null;
function Scope(parent) {
this.parent = parent;
if (!this.parent) {
Scope.root = this;
}
// where we ke... | // Heavily inspired by coffee-script again
exports.Scope = function (parent) {
var self = this;
if (parent) {
self.root = null;
} else {
self.root = self;
}
self.parent = parent;
// where we keep the variables names for this scope
self.variables = {};
// add a variab... |
Remove matplotlib from required dependencies | from setuptools import setup
from tools.generate_pyi import generate_pyi
def main():
# Generate .pyi files
import pyxtf.xtf_ctypes
generate_pyi(pyxtf.xtf_ctypes)
import pyxtf.vendors.kongsberg
generate_pyi(pyxtf.vendors.kongsberg)
# Run setup script
setup(name='pyxtf',
version='0... | from setuptools import setup
from tools.generate_pyi import generate_pyi
def main():
# Generate .pyi files
import pyxtf.xtf_ctypes
generate_pyi(pyxtf.xtf_ctypes)
import pyxtf.vendors.kongsberg
generate_pyi(pyxtf.vendors.kongsberg)
# Run setup script
setup(name='pyxtf',
version='0... |
Fix broken build in IE11
Don't use array.includes, it is not supported in IE11 | "use strict";
var assert = require("@sinonjs/referee").assert;
var createSet = require("./create-set");
describe("createSet", function() {
describe("when called without arguments", function() {
it("returns an empty Set", function() {
var set = createSet();
assert.isSet(set);
... | "use strict";
var assert = require("@sinonjs/referee").assert;
var createSet = require("./create-set");
describe("createSet", function() {
describe("when called without arguments", function() {
it("returns an empty Set", function() {
var set = createSet();
assert.isSet(set);
... |
Add 'nullable' validation to password field | <?php
namespace Nodes\Backend\Models\User\Validation;
use Nodes\Validation\AbstractValidator;
/**
* Class UserValidation.
*/
class UserValidator extends AbstractValidator
{
/**
* Validation rules.
*
* @var array
*/
protected $rules = [
'create' => [
'name' => ['requi... | <?php
namespace Nodes\Backend\Models\User\Validation;
use Nodes\Validation\AbstractValidator;
/**
* Class UserValidation.
*/
class UserValidator extends AbstractValidator
{
/**
* Validation rules.
*
* @var array
*/
protected $rules = [
'create' => [
'name' => ['requi... |
Fix a bug with livereload | var elixir = require('laravel-elixir');
require('laravel-elixir-livereload');
/*
|--------------------------------------------------------------------------
| Elixir Asset Management
|--------------------------------------------------------------------------
|
| Elixir provides a clean, fluent API for defining som... | var elixir = require('laravel-elixir');
require('laravel-elixir-livereload');
/*
|--------------------------------------------------------------------------
| Elixir Asset Management
|--------------------------------------------------------------------------
|
| Elixir provides a clean, fluent API for defining som... |
Fix running when pytest.ini is not present. | try:
from configparser import ConfigParser
except ImportError:
from ConfigParser import ConfigParser
import pytest
CLI_OPTION_PREFIX = '--'
class CollectConfig(object):
"""
A pytest plugin to gets the configuration file.
"""
def __init__(self):
self.path = None
def pytest_cmdli... | try:
from configparser import ConfigParser
except ImportError:
from ConfigParser import ConfigParser
import pytest
CLI_OPTION_PREFIX = '--'
class CollectConfig(object):
"""
A pytest plugin to gets the configuration file.
"""
def __init__(self):
self.path = None
def pytest_cmdli... |
Add files to Country Reports | var superagent = require('superagent');
var superagentQ = require('superagent-promises');
class CountryReportMapper {
//============================================================
//
//
//============================================================
async query () {
var res = await ... | var superagent = require('superagent');
var superagentQ = require('superagent-promises');
class CountryReportMapper {
//============================================================
//
//
//============================================================
async query () {
var res = await ... |
Fix news & announcements to be reverse sorted. | 'use strict';
// =========================================================================
//
// Controller for orgs
//
// =========================================================================
var path = require('path');
var DBModel = require (path.resolve('./modules/core/server/controllers/core.dbmodel.... | 'use strict';
// =========================================================================
//
// Controller for orgs
//
// =========================================================================
var path = require('path');
var DBModel = require (path.resolve('./modules/core/server/controllers/core.dbmodel.... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.