text
stringlengths
17
1.47k
positive
stringlengths
673
4.43k
negative
stringlengths
677
2.81k
Fix wrong order of parameters and change json decode to json encode
<?php namespace AppBundle\API\Edit; use AppBundle\API\Webservice; use AppBundle\AppBundle; use AppBundle\Entity\FennecUser; use AppBundle\Entity\WebuserData; use AppBundle\Service\DBVersion; use Symfony\Component\HttpFoundation\ParameterBag; class UpdateProject { private $manager; /** * UpdateProject ...
<?php namespace AppBundle\API\Edit; use AppBundle\API\Webservice; use AppBundle\AppBundle; use AppBundle\Entity\FennecUser; use AppBundle\Entity\WebuserData; use AppBundle\Service\DBVersion; use Symfony\Component\HttpFoundation\ParameterBag; class UpdateProject { private $manager; /** * UpdateProject ...
Add window onresize listener to viz
import d3 from 'd3'; export default function openmetadesign_viz(data) { // The container for the viz var d3Container = document.getElementById("d3-container"); // Get dimensions of the container on window resize window.addEventListener("resize", function(d) { width = d3Container.clientWidth; ...
import d3 from 'd3'; export default function openmetadesign_viz(data) { var svg = d3.select('#d3-container').append("svg"); svg.append("rect") .attr("x", 10) .attr("y", 10) .attr("width", 50) .attr("height", 100) .attr("class", "svg-modal-button") .on("mouseover"...
Set SRID the new way
# -*- coding: utf-8 -*- from django.contrib.gis.geos import Polygon class ResourceLink(object): def __init__(self, type, href): self.type = type self.href = href class Resource(object): def __init__(self, id, description, author, links, title, created_at, updated_at, geom): ...
# -*- coding: utf-8 -*- from django.contrib.gis.geos import Polygon class ResourceLink(object): def __init__(self, type, href): self.type = type self.href = href class Resource(object): def __init__(self, id, description, author, links, title, created_at, updated_at, geom): ...
Make sure that prompt window disappears after entering secret.
var EncryptedLocations = { decryptAll: function(locations) { var dfd = $.Deferred() askForPassword().done(function(password) { var decryptedLocations = _(locations).map(function(location) { try { var decrypted = JSON.parse(decrypt(location.salt, location.iv, password, location.data)) ...
var EncryptedLocations = { decryptAll: function(locations) { var dfd = $.Deferred() askForPassword().done(function(password) { var decryptedLocations = _(locations).map(function(location) { try { var decrypted = JSON.parse(decrypt(location.salt, location.iv, password, location.data)) ...
Fix commit_on_http_success when an exception is raised
from django.db.transaction import is_dirty, leave_transaction_management, rollback, commit, enter_transaction_management, managed from django.db import DEFAULT_DB_ALIAS from django.http import HttpResponse def commit_on_http_success(func, using=None): """ This decorator activates db commit on HTTP success res...
from django.db.transaction import is_dirty, leave_transaction_management, rollback, commit, enter_transaction_management, managed from django.db import DEFAULT_DB_ALIAS from django.http import HttpResponse def commit_on_http_success(func, using=None): """ This decorator activates db commit on HTTP success res...
Add option to get file size
<?php namespace Intervention\Image; class File { /** * Mime type * * @var string */ public $mime; /** * Name of directory path * * @var string */ public $dirname; /** * Basename of current file * * @var string */ public $basename; ...
<?php namespace Intervention\Image; class File { /** * Mime type * * @var string */ public $mime; /** * Name of directory path * * @var string */ public $dirname; /** * Basename of current file * * @var string */ public $basename; ...
Add schema comparator to diff command.
<?php namespace LazyRecord\Command; use Exception; use CLIFramework\Command; use LazyRecord\Schema; use LazyRecord\Schema\SchemaFinder; use LazyRecord\ConfigLoader; class DiffCommand extends Command { public function brief() { return 'diff database schema.'; } public function options($opts) ...
<?php namespace LazyRecord\Command; use Exception; use CLIFramework\Command; use LazyRecord\Schema; use LazyRecord\Schema\SchemaFinder; use LazyRecord\ConfigLoader; class DiffCommand extends Command { public function brief() { return 'diff database schema.'; } public function options($opts) ...
Disable contextual menu (not very useful, exposes features we don't want to expose)
YAHOO.xbl.fr.Tinymce.DefaultConfig = { mode: "exact", language: "en", theme: "advanced", skin: "thebigreason", plugins: "spellchecker,style,table,save,ie...
YAHOO.xbl.fr.Tinymce.DefaultConfig = { mode: "exact", language: "en", theme: "advanced", skin: "thebigreason", plugins: "spellchecker,style,table,save,ie...
Adjust path one last time.
<?php namespace League\StatsD\Laravel5\Provider; use Illuminate\Support\ServiceProvider; use League\StatsD\Client as Statsd; /** * StatsD Service provider for Laravel * * @author Aran Wilkinson <aran@aranw.net> */ class StatsdServiceProvider extends ServiceProvider { /** * Boot the service provider. ...
<?php namespace League\StatsD\Laravel5\Provider; use Illuminate\Support\ServiceProvider; use League\StatsD\Client as Statsd; /** * StatsD Service provider for Laravel * * @author Aran Wilkinson <aran@aranw.net> */ class StatsdServiceProvider extends ServiceProvider { /** * Boot the service provider. ...
Allow commands to throw AbortException to fail the build
package org.jenkinsci.plugins.dockerbuildstep.cmd; import hudson.AbortException; import hudson.DescriptorExtensionList; import hudson.ExtensionPoint; import hudson.model.Describable; import hudson.model.AbstractBuild; import hudson.model.Descriptor; import jenkins.model.Jenkins; import org.jenkinsci.plugins.dockerbui...
package org.jenkinsci.plugins.dockerbuildstep.cmd; import hudson.DescriptorExtensionList; import hudson.ExtensionPoint; import hudson.model.Describable; import hudson.model.AbstractBuild; import hudson.model.Descriptor; import jenkins.model.Jenkins; import org.jenkinsci.plugins.dockerbuildstep.DockerBuilder; import o...
Use context so the test file to get closed after tests
from urllib import request from bs4 import BeautifulSoup HEADERS = { 'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7' } class AbstractScraper(): def __init__(self, url, test=False): if test: # when testing, we simply load a file ...
from urllib import request from bs4 import BeautifulSoup HEADERS = { 'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7' } class AbstractScraper(): def __init__(self, url, test=False): if test: # when testing, we simply load a file ...
Add customer in BOA Application.
<?php namespace Tisseo\BoaBundle\DataFixtures\ORM; use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Doctrine\Common\Persistence\ObjectManager; use Doctrine\Common\DataFixtures\AbstractFixture; use Doctrine\Common\DataFixtures\OrderedF...
<?php namespace Tisseo\BoaBundle\DataFixtures\ORM; use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Doctrine\Common\Persistence\ObjectManager; use Doctrine\Common\DataFixtures\AbstractFixture; use Doctrine\Common\DataFixtures\OrderedF...
Create static generator from Element
package com.grayben.riskExtractor.htmlScorer.partScorers; import org.jsoup.nodes.Attribute; import org.jsoup.nodes.Element; import org.jsoup.parser.Tag; import java.util.ArrayList; import java.util.List; public class TagAndAttribute { private final Tag tag; private final Attribute attribute; public Tag getTag...
package com.grayben.riskExtractor.htmlScorer.partScorers; import org.jsoup.nodes.Attribute; import org.jsoup.parser.Tag; public class TagAndAttribute { private final Tag tag; private final Attribute attribute; public Tag getTag() { return tag; } public Attribute getAttribute() { return...
Align Logger component with new AppiComponent api
import intelLogger from 'intel' import joi from 'joi' import { validateObject } from '../../core' /** * Returns config data and its schema * @param {Object} env * @returns {SchemedData} */ function getConfig(env) { /** * Log level compatible with intel module * Valid values: ALL, TRACE, VERBOSE, DEB...
import intelLogger from 'intel' import joi from 'joi' import { validateObject } from '../../core' /** * Returns config data and its schema * @param {Object} env * @returns {SchemedData} */ function getConfig(env) { /** * Log level compatible with intel module * Valid values: ALL, TRACE, VERBOSE, DEB...
Store values from array to database
<?php $host = "localhost"; $user_name = "root"; $password = ""; $database_name = "vawhack"; $db = mysql_connect($host, $user_name, $password); if (mysql_error() > ""){ print_r(mysql_error()); } mysql_select_db($database_name, $db); // $directory = "nfsshare/audiofiles/"...
<?php // $directory = "nfsshare/audiofiles/" //directory from where to read file $directory = "C:/Users/sus/Desktop/voicemail/device/999/INBOX/"; // get all text files with a .txt extension. $texts = glob($directory . "*.txt"); if(empty($texts)){ echo "File not present"; return;...
Add getNodes method to fetch the list of nodes from chef.
<?php namespace DominionEnterprises\Chef; use Jenssegers\Chef\Chef as ChefApi; class Chef { /** * @var \Jenssegers\Chef\Chef The chef API */ private $_chef; /** * Construct the Chef Wrapper * * @param \Jenssegers\Chef\Chef $chef The chef API */ public function __construc...
<?php namespace DominionEnterprises\Chef; use Jenssegers\Chef\Chef as ChefApi; class Chef { /** * @var \Jenssegers\Chef\Chef The chef API */ private $_chef; /** * Construct the Chef Wrapper * * @param \Jenssegers\Chef\Chef $chef The chef API */ public function __construc...
Fix import location of environment variables
#-*- coding: utf-8 -*- import os if os.path.exists('.env'): print('Importing environment from .env...') for line in open('.env'): var = line.strip().split('=') if len(var) == 2: os.environ[var[0]] = var[1] from flask.ext.script import Manager, prompt, prompt_bool, prompt_pass from ...
#-*- coding: utf-8 -*- from flask.ext.script import Manager, prompt, prompt_bool, prompt_pass from db_create import ( init_db, drop_db, init_admin_user, init_entry, init_category, init_tag ) from flask.ext.migrate import MigrateCommand from logpot.app import app import os if os.path.exists('.e...
Modify videoloop to allow for audio
#!/usr/bin/env python3 import logging import re from gi.repository import Gst from lib.config import Config from lib.sources.avsource import AVSource class VideoLoopSource(AVSource): timer_resolution = 0.5 def __init__(self, name, has_audio=True, has_video=True, force_num_streams=None): ...
#!/usr/bin/env python3 import logging import re from gi.repository import Gst from lib.config import Config from lib.sources.avsource import AVSource class VideoLoopSource(AVSource): def __init__(self, name): super().__init__('VideoLoopSource', name, False, True) self.location = Config.getLocati...
Enable send button when user enters text.
import React from 'react/addons'; export class ChatForm extends React.Component { static propTypes = { onSend: React.PropTypes.func.isRequired } constructor(props) { super(props); this.state = {text: ''}; } handleSubmit = (e) => { this.props.onSend(this.state.text)...
import React from 'react/addons'; export class ChatForm extends React.Component { static propTypes = { onSend: React.PropTypes.func.isRequired } constructor(props) { super(props); this.state = {text: ''}; } handleSubmit = (e) => { this.props.onSend(this.state.text)...
Add system status to /status endpoint
<?php /* * This file is part of Cachet. * * (c) Alt Three Services Limited * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace CachetHQ\Cachet\Http\Controllers\Api; use CachetHQ\Cachet\Integrations\Contracts\Releases; use ...
<?php /* * This file is part of Cachet. * * (c) Alt Three Services Limited * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace CachetHQ\Cachet\Http\Controllers\Api; use CachetHQ\Cachet\Integrations\Contracts\Releases; use ...
Rename appContextModule variable to appModule.
/* * Copyright (C) 2017 Yaroslav Mytkalyk * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or...
/* * Copyright (C) 2017 Yaroslav Mytkalyk * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or...
Call start() in file:/// test if not file:///
Batman.ready(function() { module('Batman.Request'); test('creation', function() { var request = Batman.Request({url: 'stubs.js'}); ok(request.isRequest, 'request is request'); equal(request.url(), 'stubs.js', 'url is set'); equal(request.method(), 'get', 'default method...
Batman.ready(function() { module('Batman.Request'); test('creation', function() { var request = Batman.Request({url: 'stubs.js'}); ok(request.isRequest, 'request is request'); equal(request.url(), 'stubs.js', 'url is set'); equal(request.method(), 'get', 'default method...
Use new logging facilites in Lambda code updater
"use strict"; const AWS = require('aws-sdk'); const fs = require('fs'); const Promise = require('bluebird'); // // Step that loops over Lambdas and updates their respective functions' code // module.exports = function(context) { const Lambda = new AWS.Lambda(); return context.logger.task('Updating Lambda co...
"use strict"; require('colors'); const AWS = require('aws-sdk'); const fs = require('fs'); const Promise = require('bluebird'); // // Step that loops over Lambdas and updates their respective functions' code // module.exports = function(context) { const Lambda = new AWS.Lambda(); return new Promise(function...
Fix Edit Trigger bug flowing from creating a zone
'use strict'; yeomanApp.controller('EditZoneCtrl' , ['$scope', '$rootScope', 'UIEvents', 'ZoneFactory', 'ZoneService', 'EditZoneService', 'EditTriggerService', 'TriggerFactory' , function($scope, $rootScope, UIEvents, ZoneFactory, ZoneService, EditZoneService, EditTriggerService, TriggerFactory) { $scope.Zon...
'use strict'; yeomanApp.controller('EditZoneCtrl' , ['$scope', '$rootScope', 'UIEvents', 'ZoneFactory', 'ZoneService', 'EditZoneService', 'EditTriggerService', 'TriggerFactory' , function($scope, $rootScope, UIEvents, ZoneFactory, ZoneService, EditZoneService, EditTriggerService, TriggerFactory) { $scope.Zon...
Set name_scope of entire network to the dataset it handles
import tensorflow as tf import numpy as np import itertools as it import importlib from flowfairy.conf import settings from flowfairy.utils import take from flowfairy import data from flowfairy.feature import FeatureManager from flowfairy.core.queue import FlowQueue from flowfairy.core.stage import stage def load_ne...
import tensorflow as tf import numpy as np import itertools as it import importlib from flowfairy.conf import settings from flowfairy.utils import take from flowfairy import data from flowfairy.feature import FeatureManager from flowfairy.core.queue import FlowQueue from flowfairy.core.stage import stage def load_ne...
Update favorite preset button state automatically
import { event as d3_event, select as d3_select } from 'd3-selection'; import { t } from '../util/locale'; import { svgIcon } from '../svg'; export function uiPresetFavorite(preset, geom, context, klass) { var presetFavorite = {}; var _button = d3_select(null); presetFavorite.button = function...
import { event as d3_event, select as d3_select } from 'd3-selection'; import { t } from '../util/locale'; import { svgIcon } from '../svg'; export function uiPresetFavorite(preset, geom, context, klass) { var presetFavorite = {}; var _button = d3_select(null); presetFavorite.button = function...
Fix menu close btn position
import * as React from 'react' import { Link } from 'gatsby' import { Container } from './Container' import { CloseIcon } from './icons/Close' export const Menu = ({ showMenu, onClick }) => { return ( <div className={`${ showMenu ? 'fixed' : 'hidden' } inset-0 z-40 h-full bg-black w-full bg-...
import * as React from 'react' import { Link } from 'gatsby' import { Container } from './Container' import { CloseIcon } from './icons/Close' export const Menu = ({ showMenu, onClick }) => { return ( <div className={`${ showMenu ? 'fixed' : 'hidden' } inset-0 z-40 h-screen bg-black w-full b...
Delete ZnZendFlashMessages view helper - ZF2 has own helper now
<?php return array( 'controller_plugins' => array( 'invokables' => array( 'znZendDataTables' => 'ZnZend\Mvc\Controller\Plugin\ZnZendDataTables', 'znZendMvcParams' => 'ZnZend\Mvc\Controller\Plugin\ZnZendMvcParams', 'znZendPageStore' => 'ZnZend\Mvc\Controller\Plugin\ZnZen...
<?php return array( 'controller_plugins' => array( 'invokables' => array( 'znZendDataTables' => 'ZnZend\Mvc\Controller\Plugin\ZnZendDataTables', 'znZendMvcParams' => 'ZnZend\Mvc\Controller\Plugin\ZnZendMvcParams', 'znZendPageStore' => 'ZnZend\Mvc\Controller\Plugin\ZnZen...
Add notifications to retsult of api /login method
<?php class AuthController extends BaseController { public function login() { $remember = Input::get('remember') == 'true' ? true : false; if (Auth::attempt(['shadow_name' => Str::lower(Input::get('username')), 'password' => Input::get('password'), 'is_activated' => true], $rememb...
<?php class AuthController extends BaseController { public function login() { $remember = Input::get('remember') == 'true' ? true : false; if (Auth::attempt(['shadow_name' => Str::lower(Input::get('username')), 'password' => Input::get('password'), 'is_activated' => true], $rememb...
Use the error returned from the response type
<?php namespace League\OAuth2\Server\Middleware; use League\OAuth2\Server\Exception\OAuthServerException; use League\OAuth2\Server\Server; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; class ResourceServerMiddleware { /** * @var \League\OAuth2\Server\Server */ ...
<?php namespace League\OAuth2\Server\Middleware; use League\OAuth2\Server\Exception\OAuthServerException; use League\OAuth2\Server\Server; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ServerRequestInterface; class ResourceServerMiddleware { /** * @var \League\OAuth2\Server\Server */ ...
Remove listeners object from broadcaster if topic is empty
package com.clinicpatientqueueexample.messaging; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.function.Consumer; public a...
package com.clinicpatientqueueexample.messaging; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.function.Consumer; public a...
Add option 'response' to render
<?php namespace Spark\Controller; use Silex\Application; use Symfony\Component\HttpFoundation\Response; use Spark\Core\ApplicationAware; abstract class Base implements ApplicationAware { use ActionHelper\Filters; use ActionHelper\Redirect; use ActionHelper\Layout; protected $application; protect...
<?php namespace Spark\Controller; use Silex\Application; use Symfony\Component\HttpFoundation\Response; use Spark\Core\ApplicationAware; abstract class Base implements ApplicationAware { use ActionHelper\Filters; use ActionHelper\Redirect; use ActionHelper\Layout; protected $application; protect...
Fix case where path is None in sanitize_path
# -*- coding: utf-8 -*- import os import os.path import sys import fnmatch import glob from nimp.utilities.logging import * from nimp.utilities.system import * #------------------------------------------------------------------------------- def split_path(path): splitted_path = [] while True: (path, ...
# -*- coding: utf-8 -*- import os import os.path import sys import fnmatch import glob from nimp.utilities.logging import * from nimp.utilities.system import * #------------------------------------------------------------------------------- def split_path(path): splitted_path = [] while True: (path, ...
Remove a relative import that escaped test.test_importlib.
import os import sys from test import support import unittest def test_suite(package=__package__, directory=os.path.dirname(__file__)): suite = unittest.TestSuite() for name in os.listdir(directory): if name.startswith(('.', '__')): continue path = os.path.join(directory, name) ...
import os import sys from .. import support import unittest def test_suite(package=__package__, directory=os.path.dirname(__file__)): suite = unittest.TestSuite() for name in os.listdir(directory): if name.startswith(('.', '__')): continue path = os.path.join(directory, name) ...
Make code comply to PEP8
# # -*- encoding: utf-8 -*- # import re import config import surllib import semail import datetime import urllib URL_PREFIX = 'http://%s/Infoweb/Fi/' % config.HOSTNAME URL_MAIN = URL_PREFIX + 'Ugeplaner.asp' def docFindWeekplans(bs): trs = bs.findAll('tr') for line in trs: if not line.has_key('cla...
# # -*- encoding: utf-8 -*- # import re import config import surllib import semail import datetime import urllib URL_PREFIX = 'http://%s/Infoweb/Fi/' % config.HOSTNAME URL_MAIN = URL_PREFIX + 'Ugeplaner.asp' def docFindWeekplans(bs): trs = bs.findAll('tr') for line in trs: if not line.has_key('clas...
Add try and catch and log errors
<?php namespace BrockReece\ElasticAnalytics; class ElasticAnalytics { protected $client; public function __construct() { $this->client = $this->buildClient(); } public static function buildClient() { return \Elasticsearch\ClientBuilder::create() ->setHosts(config('elasticq...
<?php namespace BrockReece\ElasticAnalytics; class ElasticAnalytics { protected $client; public function __construct() { $this->client = $this->buildClient(); } public static function buildClient() { return \Elasticsearch\ClientBuilder::create() ->setHosts(config('elasticq...
Set frames to be not resizable
package alotoc.graphics.view; import java.awt.Point; import javax.swing.JFrame; /** * This is an abstract class for all the frames in the program. * * @author Kazeheki * */ @SuppressWarnings("serial") public abstract class AbstractAlotocFrame extends JFrame { /** * Ctor. * * @param x...
package alotoc.graphics.view; import java.awt.Point; import javax.swing.JFrame; /** * This is an abstract class for all the frames in the program. * * @author Kazeheki * */ @SuppressWarnings("serial") public abstract class AbstractAlotocFrame extends JFrame { /** * Ctor. * * @param x...
Add message in log with plotting process id.
import datetime import multiprocessing from lobster.cmssw.plotting import Plotter logger = multiprocessing.get_logger() class DummyPlotter(object): def make_plots(*args, **kwargs): pass class Actions(object): def __init__(self, config): if 'plotdir' in config: logger.info('plots ...
import datetime import multiprocessing from lobster.cmssw.plotting import Plotter logger = multiprocessing.get_logger() class DummyPlotter(object): def make_plots(*args, **kwargs): pass class Actions(object): def __init__(self, config): if 'plotdir' in config: logger.info('plots ...
Add equality methods to SpatialReference
"""Spatial reference systems""" __all__ = ['SpatialReference'] from osgeo import osr class BaseSpatialReference(osr.SpatialReference): """Base class for extending osr.SpatialReference.""" def __repr__(self): return self.wkt def __eq__(self, another): return bool(self.IsSame(another)) ...
"""Spatial reference systems""" from osgeo import osr class BaseSpatialReference(osr.SpatialReference): """Base class for extending osr.SpatialReference.""" def __repr__(self): return self.wkt @property def srid(self): """Returns the EPSG ID as int if it exists.""" epsg_id = ...
Add test for Mysql sc
import unittest from tests.common import load_check import time class TestMySql(unittest.TestCase): def setUp(self): # This should run on pre-2.7 python so no skiptest self.skip = False try: import pymysql except ImportError: self.skip = True def testChe...
import unittest from tests.common import load_check import time class TestMySql(unittest.TestCase): def setUp(self): # This should run on pre-2.7 python so no skiptest self.skip = False try: import pymysql except ImportError: self.skip = True def testChe...
Add static method to extract post from post id
<?php namespace WPCore; use WPCore\admin\WPpostSaveable; class WPcustomPost implements WPpostSaveable { protected $postId; protected $post; protected $meta = array(); protected $metakey = 'wpcmeta'; public static function getInstance($id) { $post = new self($id); $post->setPos...
<?php namespace WPCore; use WPCore\admin\WPpostSaveable; class WPcustomPost implements WPpostSaveable { protected $postId; protected $post; protected $meta = array(); protected $metakey = 'wpcmeta'; static public function create($postId) { return new self($postId); } public f...
Add more information to exception
<?php namespace Laravel\Dusk; use Exception; use Illuminate\Support\Facades\Route; use Illuminate\Support\ServiceProvider; class DuskServiceProvider extends ServiceProvider { /** * Bootstrap any package services. * * @return void */ public function boot() { Route::get('/_dusk/...
<?php namespace Laravel\Dusk; use Exception; use Illuminate\Support\Facades\Route; use Illuminate\Support\ServiceProvider; class DuskServiceProvider extends ServiceProvider { /** * Bootstrap any package services. * * @return void */ public function boot() { Route::get('/_dusk/...
Stop relying on array [] shorthand We want to support PHP 5.3 for now
<?php namespace Lstr\Silex\Database; use PHPUnit_Framework_TestCase; use Silex\Application; class DatabaseServiceTest extends PHPUnit_Framework_TestCase { public function testPdoConnectionCanBeRetrieved() { $app = new Application(); $db = new DatabaseService($app, $this->getConfig()); ...
<?php namespace Lstr\Silex\Database; use PHPUnit_Framework_TestCase; use Silex\Application; class DatabaseServiceTest extends PHPUnit_Framework_TestCase { public function testPdoConnectionCanBeRetrieved() { $app = new Application(); $db = new DatabaseService($app, $this->getConfig()); ...
Add underscore prefix for routes
<?php namespace BW\SecurityCheckerBundle\Controller; use BW\SecurityCheckerBundle\Entity\VulnerabilityReport; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundatio...
<?php namespace BW\SecurityCheckerBundle\Controller; use BW\SecurityCheckerBundle\Entity\VulnerabilityReport; use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundatio...
Handle events' odd button click: - pass values to parent using props function;
import React from 'react' import styles from './event-bets.module.styl' export default ({ betTypes, optionClickHandler = () => {} }) => ( <table className={styles.betsTable}> <tbody> {betTypes.map((betType, idx) => ( <tr key={idx}> <th>{betType.name}</th> <td> {betT...
import React from 'react' import styles from './event-bets.module.styl' export default ({ betTypes }) => ( <table className={styles.betsTable}> <tbody> {betTypes.map((betType, idx) => ( <tr key={idx}> <th>{betType.name}</th> <td> {betType.options.map((option, idx) =...
Fix test: Missing Guice dependency
package guice; import play.Application; import services.AuthenticationService; import services.StubConfigurationImplTest; import services.ConfigurationService; import services.ESConstantImpl; import services.ESConstantService; import services.ESSearchImpl; import services.ESSearchService; import stub.StubAuthenticatio...
package guice; import play.Application; import services.AuthenticationService; import services.StubConfigurationImplTest; import services.ConfigurationService; import services.ESConstantImpl; import services.ESConstantService; import services.ESSearchImpl; import services.ESSearchService; import stub.StubAuthenticatio...
admin_screenshow: Add form for irc messages.
# -*- coding: utf-8 -*- from django import forms from django.core.exceptions import ValidationError from crispy_forms.helper import FormHelper from crispy_forms.layout import Submit, Layout, Fieldset, ButtonHolder from Instanssi.screenshow.models import Sponsor,Message,IRCMessage import os class IRCMessageForm(forms....
# -*- coding: utf-8 -*- from django import forms from django.core.exceptions import ValidationError from crispy_forms.helper import FormHelper from crispy_forms.layout import Submit, Layout, Fieldset, ButtonHolder from Instanssi.screenshow.models import Sponsor,Message,IRCMessage import os class MessageForm(forms.Mod...
Use ~200MB chunk to simulate memory problem
<?php /** * Created by PhpStorm. * User: miroslavcillik * Date: 24/02/16 * Time: 14:02 */ namespace Keboola\Syrup\Command; use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\...
<?php /** * Created by PhpStorm. * User: miroslavcillik * Date: 24/02/16 * Time: 14:02 */ namespace Keboola\Syrup\Command; use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\...
Update the config for the prompts for inquirer.
/* * <%= appNameSlug %> * https://github.com/<%= userName %>/<%= appNameSlug %> * * Copyright (c) <%= year %>, <%= authorName %> * Licensed under the <%= license %> license. */ 'use strict'; var gulp = require('gulp'), install = require('gulp-install'), conflict = require('gulp-conflict'), template ...
/* * <%= appNameSlug %> * https://github.com/<%= userName %>/<%= appNameSlug %> * * Copyright (c) <%= year %>, <%= authorName %> * Licensed under the <%= license %> license. */ 'use strict'; var gulp = require('gulp'), install = require('gulp-install'), conflict = require('gulp-conflict'), template ...
Add CSS class changes to the asset partial.
<div class="col-md-3 asset" data-asset-id="{{ $asset->getId() }}"> <a href="#"> <div class="list-content-card animated pulse-hover"> <span class="label label-danger m-r-5"> {{ $asset->getCriticalSeverityVulnerabilities()->count() }} </span> <span class="la...
<div class="col-md-3 asset" data-asset-id="{{ $asset->getId() }}"> <a href="#"> <div class="list-content-card animated pulse-hover"> <span class="label label-danger"> {{ $asset->getCriticalSeverityVulnerabilities()->count() }} </span> <span class="label la...
Add problem admin URL to problem report email
from django.core.mail import mail_managers from django.conf import settings from django.urls import reverse from django.template.loader import render_to_string from django.utils.translation import ugettext_lazy as _ def inform_managers(report): admin_url = settings.SITE_URL + reverse( 'admin:problem_probl...
from django.core.mail import mail_managers from django.conf import settings from django.urls import reverse from django.template.loader import render_to_string from django.utils.translation import ugettext_lazy as _ def inform_managers(report): admin_url = settings.SITE_URL + reverse( 'admin:problem_probl...
Fix error on comment screen.
<?php namespace WPametu\UI\Admin; use WPametu\UI\MetaBox; abstract class EditMetaBox extends MetaBox { /** * Meta box context * * @var string 'normal', 'side', and 'advanced' */ protected $context = 'advanced'; /** * Meta box priority * * @var string 'high', 'low', an...
<?php namespace WPametu\UI\Admin; use WPametu\UI\MetaBox; abstract class EditMetaBox extends MetaBox { /** * Meta box context * * @var string 'normal', 'side', and 'advanced' */ protected $context = 'advanced'; /** * Meta box priority * * @var string 'high', 'low', an...
Add url to contact form
// Here be the site javascript! $(document).ready(function () { $(".button-collapse").sideNav(); $('.scrollspy').scrollSpy(); $("form").submit(function (event) { event.preventDefault(); $("#send-msg").attr("disabled", true); $("#fa-send").toggleClass("fa-envelope-o").toggleClass("fa-s...
// Here be the site javascript! $(document).ready(function () { $(".button-collapse").sideNav(); $('.scrollspy').scrollSpy(); $("form").submit(function (event) { event.preventDefault(); $("#send-msg").attr("disabled", true); $("#fa-send").toggleClass("fa-envelope-o").toggleClass("fa-s...
Fix comment in aliases php script
<?php // Grab the datastore settings from drupdates $result = json_decode(exec('python ~/.drush/settings.py'), true); $path = $result['workingDir']['value']; $driver = $result['datastoreDriver']['value']; $user = $result['datastoreSuperUser']['value']; $pass = $result['datastoreSuperPword']['value']; $port = $result['d...
<?php // Grab the "Global" settings from drupdates $result = json_decode(exec('python ~/.drush/settings.py'), true); $path = $result['workingDir']['value']; $driver = $result['datastoreDriver']['value']; $user = $result['datastoreSuperUser']['value']; $pass = $result['datastoreSuperPword']['value']; $port = $result['da...
Clone the parameters too since they are an object We need to clone the parameters for this query or the parameters could change if the original query's parameters are changed. This is how doctrine does it. https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Tools/Pagination/Paginator.php#L212 To bad...
<?php namespace Knp\Component\Pager\Event\Subscriber\Paginate\Doctrine\ORM\Query; use Doctrine\ORM\Query; /** * ORM Query helper for cloning * and hint processing */ class Helper { /** * Clones the given $query and copies all used * parameters and hints * * @param Query $query * @retu...
<?php namespace Knp\Component\Pager\Event\Subscriber\Paginate\Doctrine\ORM\Query; use Doctrine\ORM\Query; /** * ORM Query helper for cloning * and hint processing */ class Helper { /** * Clones the given $query and copies all used * parameters and hints * * @param Query $query * @retu...
Use correct m2m join table name in LatestCommentsFeed git-svn-id: 4f9f921b081c523744c7bf24d959a0db39629563@9089 bcc190cf-cafb-0310-a4f2-bffc1f526a37
from django.conf import settings from django.contrib.syndication.feeds import Feed from django.contrib.sites.models import Site from django.contrib import comments class LatestCommentFeed(Feed): """Feed of latest comments on the current site.""" def title(self): if not hasattr(self, '_site'): ...
from django.conf import settings from django.contrib.syndication.feeds import Feed from django.contrib.sites.models import Site from django.contrib import comments class LatestCommentFeed(Feed): """Feed of latest comments on the current site.""" def title(self): if not hasattr(self, '_site'): ...
Fix links in the cherry-pick demo
import './base.css'; import './application.css'; import 'suitcss-base'; import 'suitcss-utils-text'; import 'suitcss-components-arrange'; import React from 'react'; module.exports = React.createClass({ contextTypes: { router: React.PropTypes.object.isRequired }, link: function () { var router = this.con...
import './base.css'; import './application.css'; import 'suitcss-base'; import 'suitcss-utils-text'; import 'suitcss-components-arrange'; import React from 'react'; module.exports = React.createClass({ contextTypes: { router: React.PropTypes.object.isRequired }, link: function () { var router = this.con...
Add addition method to Terrain
"""This module is for the Terrain class, used for storing randomly generated terrain.""" class Terrain(object): """Container for a randomly generated area of terrain. Attributes: width (int): Width of generated terrain. length (int): Length of generated terrain. height_map (list): Map...
"""This module is for the Terrain class, used for storing randomly generated terrain.""" class Terrain(object): """Container for a randomly generated area of terrain. Attributes: width (int): Width of generated terrain. length (int): Length of generated terrain. height_map (list): Map...
Include command: All arguments lowercase. Require file, default to empty macros
''' Created on Mar 8,2015 @author: qiuyx ''' from scan.commands.command import Command import xml.etree.ElementTree as ET class Include(Command): ''' classdocs ''' def __init__(self, scan, macros=None, errhandler=None): ''' @param scan: Name of included scan file, must be on the se...
''' Created on Mar 8,2015 @author: qiuyx ''' from scan.commands.command import Command import xml.etree.ElementTree as ET class Include(Command): ''' classdocs ''' def __init__(self, scanFile=None, macros=None,errHandler=None): ''' @param scanFile: The included scan file path located...
Work with new and *older* kombu versions
from Queue import Empty from anyjson import serialize, deserialize from kombu.transport import virtual from django.conf import settings from django.core import exceptions as errors from djkombu.models import Queue POLLING_INTERVAL = getattr(settings, "DJKOMBU_POLLING_INTERVAL", 5.0) class Channel(virtual.Channel)...
from Queue import Empty from anyjson import serialize, deserialize from kombu.transport import virtual from django.conf import settings from django.core import exceptions as errors from djkombu.models import Queue POLLING_INTERVAL = getattr(settings, "DJKOMBU_POLLING_INTERVAL", 5.0) class Channel(virtual.Channel)...
Include testing workflow in default task.
'use strict'; module.exports = function(grunt) { // Configuration. grunt.initConfig({ jscs: { options: { config: '.jscsrc' }, grunt: 'Gruntfile.js', tasks: 'tasks/**/*.js' }, jshint: { options: { ...
'use strict'; module.exports = function(grunt) { // Configuration. grunt.initConfig({ jscs: { options: { config: '.jscsrc' }, grunt: 'Gruntfile.js', tasks: 'tasks/**/*.js' }, jshint: { options: { ...
Remove PHP 7.1 feature usage for 7.0 compat
<?php namespace Amp; final class CombinedCancellationToken implements CancellationToken { private $tokens = []; private $nextId = "a"; private $callbacks = []; private $exception; public function __construct(CancellationToken ...$tokens) { foreach ($tokens as $token) { $i...
<?php namespace Amp; final class CombinedCancellationToken implements CancellationToken { private $tokens = []; private $nextId = "a"; private $callbacks = []; private $exception; public function __construct(CancellationToken ...$tokens) { foreach ($tokens as $token) { $i...
Update vigenereDicitonaryHacker: simplified comparison with None
# Vigenère Cipher Dictionary Hacker # https://www.nostarch.com/crackingcodes/ (BSD Licensed) import detectEnglish, vigenereCipher, pyperclip def main(): ciphertext = """Tzx isnz eccjxkg nfq lol mys bbqq I lxcz.""" hackedMessage = hackVigenereDictionary(ciphertext) if not hackedMessage: print('Co...
# Vigenère Cipher Dictionary Hacker # https://www.nostarch.com/crackingcodes/ (BSD Licensed) import detectEnglish, vigenereCipher, pyperclip def main(): ciphertext = """Tzx isnz eccjxkg nfq lol mys bbqq I lxcz.""" hackedMessage = hackVigenereDictionary(ciphertext) if hackedMessage != None: print...
Update image path for Windows builder test
<?php use BryanCrowe\Growl\Builder\GrowlNotifyWindowsBuilder; class GrowlNotifyWindowsBuilderTest extends PHPUnit_Framework_TestCase { public function setUp() { parent::setUp(); $this->GrowlNotifyWindowsBuilder = new GrowlNotifyWindowsBuilder(); } public function tearDown() { ...
<?php use BryanCrowe\Growl\Builder\GrowlNotifyWindowsBuilder; class GrowlNotifyWindowsBuilderTest extends PHPUnit_Framework_TestCase { public function setUp() { parent::setUp(); $this->GrowlNotifyWindowsBuilder = new GrowlNotifyWindowsBuilder(); } public function tearDown() { ...
Save game_id when joining game
class MainController { constructor(_, $scope, $state, $log, SocketService) { 'ngInject'; this._ = _; this.$log = $log; this.$state = $state; this.$scope = $scope; this.SocketService = SocketService; this.name = ''; this.password = ''; this.errorMessage = ''; this.processing = ...
class MainController { constructor(_, $scope, $state, $log, SocketService) { 'ngInject'; this._ = _; this.$log = $log; this.$state = $state; this.$scope = $scope; this.SocketService = SocketService; this.name = ''; this.password = ''; this.errorMessage = ''; this.processing = ...
Remove references to NdbManipulatorBase, which never really happened.
from helpers.manipulator_base import ManipulatorBase class TeamManipulator(ManipulatorBase): """ Handle Team database writes. """ @classmethod def updateMerge(self, new_team, old_team): """ Given an "old" and a "new" Team object, replace the fields in the "old" team tha...
from helpers.ndb_manipulator_base import NdbManipulatorBase class TeamManipulator(NdbManipulatorBase): """ Handle Team database writes. """ @classmethod def updateMerge(self, new_team, old_team): """ Given an "old" and a "new" Team object, replace the fields in the "old...
Add logs for listener callbacks
package com.davidferrand.subappbarpanelsample; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.util.Log; import android.view.View; import android.widget.ImageView; import com.davidferrand.subappbarpanel.SubAppBarPanel; public class M...
package com.davidferrand.subappbarpanelsample; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; import android.widget.ImageView; import com.davidferrand.subappbarpanel.SubAppBarPanel; public class MainActivity extends AppCo...
Fix : delete command call badly formatted in handler
#!/usr/bin/env python # -*- coding: utf-8 -*- class Handler(object): def __init__(self, db): # Each handlers is formatted following # the pattern : [ command, # default return value, # raised error ] self.handles = { 'GET': (db.Get...
#!/usr/bin/env python # -*- coding: utf-8 -*- class Handler(object): def __init__(self, db): # Each handlers is formatted following # the pattern : [ command, # default return value, # raised error ] self.handles = { 'GET': (db.Get...
Fix for the date of birth label
const _ = require('lodash'); const countries = require('../../../config/countries'); module.exports = { 'expiry-year': { labelClassName: 'form-label', formatter: 'removehyphens', validate: [ 'numeric', 'required' ] }, 'expiry-month': { labelClassName: 'form-label', formatter: 'remov...
const _ = require('lodash'); const countries = require('../../../config/countries'); module.exports = { 'expiry-year': { labelClassName: 'form-label', formatter: 'removehyphens', validate: [ 'numeric', 'required' ] }, 'expiry-month': { labelClassName: 'form-label', formatter: 'remov...
Adjust for new IATI Updates API; don't have to page through results
# IATI Data Quality, tools for Data QA on IATI-formatted publications # by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith # # Copyright (C) 2013 Publish What You Fund # # This programme is free software; you may redistribute and/or modify # it under the terms of the GNU Affero General Public License v3...
# IATI Data Quality, tools for Data QA on IATI-formatted publications # by Mark Brough, Martin Keegan, Ben Webb and Jennifer Smith # # Copyright (C) 2013 Publish What You Fund # # This programme is free software; you may redistribute and/or modify # it under the terms of the GNU Affero General Public License v3...
Fix a minor bootstrap UI issue
var getThat = {}; getThat.controller = function() { }; getThat.header = function() { return m('.row', [ m('.col-md-10', [ m('.jumbotron', [ m('h1', [ m('a[href="//getthat.email"]', 'Get That Email') ]) ]) ]) ]); }; g...
var getThat = {}; getThat.controller = function() { }; getThat.header = function() { return m('.row', [ m('.col-md-10', [ m('.jumbotron', [ m('h1', [ m('a[href="//getthat.email"]', 'Get That Email') ]) ]) ]) ]); }; g...
Add getInstance method for symfony kernel this allows us using symfony services everywhere.
<?php use Symfony\Component\HttpKernel\Kernel; use Doctrine\Common\Annotations\AnnotationRegistry; abstract class Kwf_SymfonyKernel extends Kernel { private static $_instance; public function __construct() { $env = Kwf_Config::getValue('symfony.environment'); if (in_array($env, array('test...
<?php use Symfony\Component\HttpKernel\Kernel; use Doctrine\Common\Annotations\AnnotationRegistry; abstract class Kwf_SymfonyKernel extends Kernel { public function __construct() { $env = Kwf_Config::getValue('symfony.environment'); if (in_array($env, array('test', 'dev'))) { $envir...
Use importlib.import_module instead of __import__
""" :py:mod:`pymco.utils` --------------------- python-mcollective utils. """ import importlib def import_class(import_path): """Import a class based on given dotted import path string. It just splits the import path in order to geth the module and class names, then it just calls to :py:func:`__import__`...
""" :py:mod:`pymco.utils` --------------------- python-mcollective utils. """ def import_class(import_path): """Import a class based on given dotted import path string. It just splits the import path in order to geth the module and class names, then it just calls to :py:func:`__import__` with the module ...
Set AtsMode to 'disabled', if no apply link is found.
<?php /** * @filesource * @copyright (c) 2013 - 2017 Cross Solution (http://cross-solution.de) * @license MIT * @author Miroslav Fedeleš <miroslav.fedeles@gmail.com> * @since 0.30 */ namespace SimpleImport\Hydrator; use Zend\Hydrator\HydrationInterface; use Jobs\Entity\AtsMode; class JobHydrator implements Hydr...
<?php /** * @filesource * @copyright (c) 2013 - 2017 Cross Solution (http://cross-solution.de) * @license MIT * @author Miroslav Fedeleš <miroslav.fedeles@gmail.com> * @since 0.30 */ namespace SimpleImport\Hydrator; use Zend\Hydrator\HydrationInterface; use Jobs\Entity\AtsMode; class JobHydrator implements Hydr...
Refactor to use promises for social media service responses.
module.exports = (function(){ // GET /users/:id/media?lat=<LAT>&lng=<LNG>&time=<TIME> return function* collection(id) { var Q = require('q'); var TwitterManager = require('../media/twitter'); var InstagramManager = require('../media/instagram'); // Twitter Requests var twitterDef = Q.defer()...
module.exports = (function(){ // GET /users/:id/media?lat=<LAT>&lng=<LNG>&time=<TIME> return function* collection(id) { // Twitter Requests var twitterDef = require('q').defer() var TwitterManager = require('../media/twitter'); var twitterGranuals = twitterDef.promise.then(TwitterManager.search); //...
Fix layer model serialize method to use new organization
cinema.models.LayerModel = Backbone.Model.extend({ constructor: function (defaults, options) { Backbone.Model.call(this, {}, options); if (typeof defaults === 'string') { this.setFromString(defaults); } else if (defaults) { this.set('state', defaults); } ...
cinema.models.LayerModel = Backbone.Model.extend({ constructor: function (defaults, options) { Backbone.Model.call(this, {}, options); if (typeof defaults === 'string') { this.setFromString(defaults); } else if (defaults) { this.set('state', defaults); } ...
Add missing api key in product picker. Fixes #6185
$.fn.productAutocomplete = function (options) { 'use strict'; // Default options options = options || {}; var multiple = typeof(options.multiple) !== 'undefined' ? options.multiple : true; this.select2({ minimumInputLength: 3, multiple: multiple, initSelection: function (element, callback) { ...
$.fn.productAutocomplete = function (options) { 'use strict'; // Default options options = options || {}; var multiple = typeof(options.multiple) !== 'undefined' ? options.multiple : true; this.select2({ minimumInputLength: 3, multiple: multiple, initSelection: function (element, callback) { ...
Make sure content app works when there are no variants
(function () { 'use strict'; function RelatedLinksAppController($scope) { var vm = this; vm.relations = $scope.model.viewModel; var currentVariant = _.find($scope.content.variants, function (v) { return v.active }); if (currentVariant.language) { vm.culture =...
(function () { 'use strict'; function RelatedLinksAppController($scope) { var vm = this; vm.relations = $scope.model.viewModel; var currentVariant = _.find($scope.content.variants, function(v) { return v.active }); vm.culture = currentVariant.language.culture; ...
Add `route_strategy` to Demo conf
<?php $debug = true; return [ 'debug' => $debug, 'kernel' => [ 'root' => realpath(__DIR__), ], 'databases' => [ 'write' => [ 'driver' => 'mysql', 'host' => '127.0.0.1', 'name' => 'simple_x', 'user' => 'root', 'p...
<?php $debug = true; return [ 'debug' => $debug, 'kernel' => [ 'root' => realpath(__DIR__), ], 'databases' => [ 'write' => [ 'driver' => 'mysql', 'host' => '127.0.0.1', 'name' => 'simple_x', 'user' => 'root', 'p...
Update grunt configuration for the embedded web server
module.exports = function (grunt) { 'use strict'; grunt.loadNpmTasks('grunt-php'); grunt.loadNpmTasks('grunt-contrib-less'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.initConfig({ php: { dist: { options: { keepalive: true, ...
module.exports = function (grunt) { 'use strict'; grunt.loadNpmTasks('grunt-php'); grunt.loadNpmTasks('grunt-contrib-less'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.initConfig({ php: { dist: { options: { keepalive: true, ...
Use proper npm ui-bootstrap dependency
var webpack = require('webpack'); var ejs = require('ejs'); var MIN = process.argv.indexOf('-p') > -1; function getBanner() { var pkg = require('./bower.json'); var banner = ['/**', ' * <%= pkg.name %> - <%= pkg.description %>', ' * @version v<%= pkg.version %>', ' * @link <%= pkg.homepage %>', ' *...
var webpack = require('webpack'); var ejs = require('ejs'); var MIN = process.argv.indexOf('-p') > -1; function getBanner() { var pkg = require('./bower.json'); var banner = ['/**', ' * <%= pkg.name %> - <%= pkg.description %>', ' * @version v<%= pkg.version %>', ' * @link <%= pkg.homepage %>', ' *...
newuser: Add some explanation as to what to do with the output.
import logging import getpass from wikked.bcryptfallback import generate_password_hash from wikked.commands.base import WikkedCommand, register_command logger = logging.getLogger(__name__) @register_command class UsersCommand(WikkedCommand): def __init__(self): super(UsersCommand, self).__init__() ...
import logging import getpass from wikked.bcryptfallback import generate_password_hash from wikked.commands.base import WikkedCommand, register_command logger = logging.getLogger(__name__) @register_command class UsersCommand(WikkedCommand): def __init__(self): super(UsersCommand, self).__init__() ...
Check if an anetry already exists before adding it
""" Module for adding new entries """ import re import api import conf import json def add(target_url, title=None, star=False, read=False): conf.load() valid_url = False if not re.compile("(?i)https?:\\/\\/.+").match(target_url): for protocol in "https://", "http://": i...
""" Module for adding new entries """ import re import api import conf def add(target_url, title=None, star=False, read=False): conf.load() valid_url = False if not re.compile("(?i)https?:\\/\\/.+").match(target_url): for protocol in "https://", "http://": if api.is_vali...
Change production build for input/output files
module.exports = function(grunt) { 'use strict'; grunt.initConfig({ less: { development: { options: { paths: ['velvet'] }, files: { 'build/style.css': 'velvet/velvet.less' } }, production: { options: { paths: ['less'], ...
module.exports = function(grunt) { 'use strict'; grunt.initConfig({ less: { development: { options: { paths: ['velvet'] }, files: { 'build/style.css': 'velvet/velvet.less' } }, production: { options: { paths: ['less'], ...
Return a list for objects on pb widget
import json from django import forms from .models import PublicBody class PublicBodySelect(forms.Widget): input_type = "text" template_name = 'publicbody/_chooser.html' initial_search = None class Media: extend = False js = ('js/publicbody.js',) def set_initial_search(self, sea...
import json from django import forms from .models import PublicBody class PublicBodySelect(forms.Widget): input_type = "text" template_name = 'publicbody/_chooser.html' initial_search = None class Media: extend = False js = ('js/publicbody.js',) def set_initial_search(self, sea...
FIX: Make watermark robust if __version__ attribute is missing.
from __future__ import (absolute_import, division, print_function, unicode_literals) from collections import OrderedDict import importlib import sys import six def watermark(): """ Give the version of each of the dependencies -- useful for bug reports. Returns ------- resu...
from __future__ import (absolute_import, division, print_function, unicode_literals) from collections import OrderedDict import importlib import six def watermark(): """ Give the version of each of the dependencies -- useful for bug reports. Returns ------- result : dict ...
Remove json and an unused alias
const paths = require('./paths'); const utils = require('../build/utils'); const vueLoaderConfig = require('../build/vue-loader.conf'); const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin'); module.exports = { resolve: { extensions: ['.js', '.vue', '.scss'], alias: { '@': path...
const paths = require('./paths'); const utils = require('../build/utils'); const vueLoaderConfig = require('../build/vue-loader.conf'); const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin'); module.exports = { resolve: { extensions: ['.js', '.vue', '.json', '.scss'], alias: { ...
Tweak to bam file name calling
#!/usr/bin/env python # Standard packages import sys import argparse # Third-party packages from toil.job import Job # Package methods from ddb import configuration from ddb_ngsflow import gatk from ddb_ngsflow import pipeline if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argumen...
#!/usr/bin/env python # Standard packages import sys import argparse # Third-party packages from toil.job import Job # Package methods from ddb import configuration from ddb_ngsflow import gatk from ddb_ngsflow import pipeline if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argumen...
Check for deleted machine when showing pending surveys. Hopefully a work around for #382
<h2><span class="label label-default">Pending surveys</span></h2> <table class="table table-striped table-hover"> <thead> <tr> <th>Survey ID</th> <th>Description</th> <th>Date Scheduled</th> <th>Test type</th> <th>Accession</th> <th>Survey Note</th> ...
<h2><span class="label label-default">Pending surveys</span></h2> <table class="table table-striped table-hover"> <thead> <tr> <th>Survey ID</th> <th>Description</th> <th>Date Scheduled</th> <th>Test type</th> <th>Accession</th> <th>Survey Note</th> ...
Add an action for server disconnects
from twisted.internet.protocol import ClientFactory, ReconnectingClientFactory from heufybot.connection import HeufyBotConnection class HeufyBotFactory(ReconnectingClientFactory): protocol = HeufyBotConnection def __init__(self, bot): self.bot = bot self.currentlyDisconnecting = [] def b...
from twisted.internet.protocol import ClientFactory, ReconnectingClientFactory from heufybot.connection import HeufyBotConnection class HeufyBotFactory(ReconnectingClientFactory): protocol = HeufyBotConnection def __init__(self, bot): self.bot = bot self.currentlyDisconnecting = [] def b...
Add py solution for 329. Longest Increasing Path in a Matrix 329. Longest Increasing Path in a Matrix: https://leetcode.com/problems/longest-increasing-path-in-a-matrix/ Approach 2: Top down search
from collections import Counter class Solution(object): def dfs(self, dp, matrix, x, y, w, h): v = matrix[x][y] if dp[x, y] == 0: dp[x, y] = 1 + max( 0 if x == 0 or matrix[x - 1][y] <= v else self.dfs(dp, matrix, x - 1, y, w, h), 0 if y == 0 or matrix[x][y...
from collections import defaultdict, Counter class Solution(object): def longestIncreasingPath(self, matrix): """ :type matrix: List[List[int]] :rtype: int """ if not matrix: return 0 h = len(matrix) w = len(matrix[0]) neighbors = defaultdi...
Add classname to permissions data cell for testing
import React, { PropTypes } from 'react'; import Immutable from 'immutable'; import { Table } from 'react-bootstrap'; import { AUTHENTICATED_USER } from '../../../utils/Consts/UserRoleConsts'; import styles from '../styles.module.css'; export default class RolePermissionsTable extends React.Component { static propTy...
import React, { PropTypes } from 'react'; import Immutable from 'immutable'; import { Table } from 'react-bootstrap'; import { AUTHENTICATED_USER } from '../../../utils/Consts/UserRoleConsts'; import styles from '../styles.module.css'; export default class RolePermissionsTable extends React.Component { static propTy...
Switch off the output file generation.
#!/usr/bin/env python3 # coding: utf-8 """ ================================================ Optimization Benchmark: Plot the Sphere Function ================================================ This example show how to plot the *Sphere function*. """ ######################################################################...
#!/usr/bin/env python3 # coding: utf-8 """ ================================================ Optimization Benchmark: Plot the Sphere Function ================================================ This example show how to plot the *Sphere function*. """ ######################################################################...
[IMP] Use constraint decorator on account_constraints+
# -*- coding: utf-8 -*- ############################################################################## # # Author Joel Grand-Guillaume. Copyright 2012 Camptocamp SA # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # pub...
# -*- coding: utf-8 -*- ############################################################################## # # Author Joel Grand-Guillaume. Copyright 2012 Camptocamp SA # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # pub...
Fix statistics not showing in navbar during the first iteration of textillate
var navbar = function($interval, $q, User) { return { restrict: 'E', // only activate on element attribute templateUrl: 'navbar.html', link: function(scope, element) { var formats = [formatPercentResolvedBugs, formatNumberProjects]; var currentFormat; var ...
var navbar = function($interval, $q, User) { return { restrict: 'E', // only activate on element attribute templateUrl: 'navbar.html', link: function(scope, element) { var formats = [formatPercentResolvedBugs, formatNumberProjects]; var currentFormat; var ...
Update event namings based on edX standard formats
function OfficeMixBlock(runtime, element) { var iframe = $('iframe', element); var player = new playerjs.Player(iframe.get(0)); var mixUrl = iframe.attr('src'); var eventUrl = runtime.handlerUrl(element, 'publish_event'); player.on('ready', function () { player.getDuration(function (durati...
function OfficeMixBlock(runtime, element) { var iframe = $('iframe', element); var player = new playerjs.Player(iframe.get(0)); var mixUrl = iframe.attr('src'); var eventUrl = runtime.handlerUrl(element, 'publish_event'); player.on('ready', function () { player.getDuration(function (durati...
Define Link ID as UUID
"""Module with all classes related to links. Links are low level abstractions representing connections between two interfaces. """ import json from uuid import uuid4 from kytos.core.common import GenericEntity class Link(GenericEntity): """Define a link between two Endpoints.""" def __init__(self, endpoi...
"""Module with all classes related to links. Links are low level abstractions representing connections between two interfaces. """ import json from kytos.core.common import GenericEntity class Link(GenericEntity): """Define a link between two Endpoints.""" def __init__(self, endpoint_a, endpoint_b): ...
Remove "A" from start of title for RT search
import requests from bs4 import BeautifulSoup from source.models.rt_rating import RTRating class RottenTomatoesService: __URL = 'http://www.rottentomatoes.com/m/' __SEPERATOR = '_' def __init__(self, title): self.title = title def get_rt_rating(self): search_url = self.__URL + self...
import requests from bs4 import BeautifulSoup from source.models.rt_rating import RTRating class RottenTomatoesService: __URL = 'http://www.rottentomatoes.com/m/' __SEPERATOR = '_' def __init__(self, title): self.title = title def get_rt_rating(self): search_url = self.__URL + self...
Fix e2e tests for ShowView
/*global describe,it,expect,$$,element,browser,by*/ describe('ShowView', function () { 'use strict'; var hasToLoad = true; beforeEach(function() { if (hasToLoad) { browser.get(browser.baseUrl + '#/posts/show/1'); hasToLoad = false; } }); describe('ChoiceFiel...
/*global describe,it,expect,$$,element,browser,by*/ describe('ShowView', function () { 'use strict'; var hasToLoad = true; beforeEach(function() { if (hasToLoad) { browser.get(browser.baseUrl + '#/posts/show/1'); hasToLoad = false; } }); describe('ChoiceFiel...
Rework external link style in catalogues
<table class="catalogue_table"> <thead> <tr> <th></th> <th><?php echo __('Link');?></th> <th><?php echo __('Comment');?></th> <th></th> </tr> </thead> <tbody> <?php foreach($links as $link):?> <tr> <td> <?php echo link_to(image_tag('edit.png'),'extlinks/extLinks?table...
<table class="catalogue_table"> <thead> <tr> <th><?php echo __('Link');?></th> <th><?php echo __('Comment');?></th> <th></th> </tr> </thead> <tbody> <?php foreach($links as $link):?> <tr> <td> <?php echo link_to($link->getUrl(),'extlinks/extLinks?table='.$table.'&cid='.$l...