text stringlengths 17 1.47k | positive stringlengths 673 4.43k | negative stringlengths 677 2.81k |
|---|---|---|
Simplify arrow function in map | import { Store } from 'consus-core/flux';
import StudentStore from './student-store';
import { checkOutItems } from '../lib/api-client';
let items = [];
let timer = null;
function clearTimer() {
clearTimeout(timer);
timer = null;
}
class CartStore extends Store {
getItems() {
return items;
}... | import { Store } from 'consus-core/flux';
import StudentStore from './student-store';
import { checkOutItems } from '../lib/api-client';
let items = [];
let timer = null;
function clearTimer() {
clearTimeout(timer);
timer = null;
}
class CartStore extends Store {
getItems() {
return items;
}... |
Remove call to deprecated Controller::getRequest() | <?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Security\Core\SecurityContext;
class SecurityController extends Controller
{
public function loginAction(Request $request)
{
$session = $reques... | <?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Security\Core\SecurityContext;
class SecurityController extends Controller
{
public function loginAction()
{
$request = $this->getRequest();
$session = $request->getSession();
... |
Set package URL to where it'll be uploaded. | #! /usr/bin/python
import os
import setuptools
import sys
# FIXME explain why this is here
sys.path.insert(0,
os.path.join(
os.path.dirname(__file__),
"lib",
))
import opensub
setuptools.setup(
author="Bence Romsics",
author_email="rubasov+opensub@gmail.com",
classifiers=[
... | #! /usr/bin/python
import os
import setuptools
import sys
# FIXME explain why this is here
sys.path.insert(0,
os.path.join(
os.path.dirname(__file__),
"lib",
))
import opensub
setuptools.setup(
author="Bence Romsics",
author_email="rubasov+opensub@gmail.com",
classifiers=[
... |
Update service worker cache version | var CACHE_NAME = 'buddhabrot-2017-10-17';
var urlsToCache = [
'.',
'/',
'/main.js',
'/material-components-web.min.css',
'/material-components-web.min.js',
'/rust-logo-blk.svg',
'/rustybrot.asmjs.js',
'/rustybrot.wasm',
'/rustybrot.wasm.js',
'/worker-compositor.js',
'/worker-producer.js',
'/manif... | var CACHE_NAME = 'buddhabrot-2017-10-12-2';
var urlsToCache = [
'.',
'/',
'/main.js',
'/material-components-web.min.css',
'/material-components-web.min.js',
'/rust-logo-blk.svg',
'/rustybrot.asmjs.js',
'/rustybrot.wasm',
'/rustybrot.wasm.js',
'/worker-compositor.js',
'/worker-producer.js',
'/man... |
Add unit support for spacers | # -*- coding: utf-8 -*-
# See LICENSE.txt for licensing terms
#$HeadURL$
#$LastChangedDate$
#$LastChangedRevision$
import shlex
from reportlab.platypus import Spacer
from flowables import *
from styles import adjustUnits
def parseRaw(data):
"""Parse and process a simple DSL to handle creation of f... | # -*- coding: utf-8 -*-
# See LICENSE.txt for licensing terms
#$HeadURL$
#$LastChangedDate$
#$LastChangedRevision$
import shlex
from reportlab.platypus import Spacer
from flowables import *
def parseRaw(data):
"""Parse and process a simple DSL to handle creation of flowables.
Supported (ca... |
Fix error on profiles page when there is no active machine | # Copyright (c) 2016 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
from UM.Application import Application
from UM.Settings.ContainerRegistry import ContainerRegistry
from cura.QualityManager import QualityManager
from cura.Settings.ProfilesModel import ProfilesModel
## QML Model ... | # Copyright (c) 2016 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
from UM.Application import Application
from UM.Settings.ContainerRegistry import ContainerRegistry
from cura.QualityManager import QualityManager
from cura.Settings.ProfilesModel import ProfilesModel
## QML Model ... |
Update to work with a layout | var gulp = require('gulp');
var Elixir = require('laravel-elixir');
var inky = require('inky');
var prettify = require('gulp-prettify');
var fs = require('fs');
var siphon = require('siphon-media-query');
var lazypipe = require('lazypipe');
var inlineCss = require('gulp-inline-css');
var htmlmin = require('gulp-htmlmin... | var gulp = require('gulp');
var Elixir = require('laravel-elixir');
var inky = require('inky');
var prettify = require('gulp-prettify');
var fs = require('fs');
var siphon = require('siphon-media-query');
var lazypipe = require('lazypipe');
var inlineCss = require('gulp-inline-css');
var htmlmin = require('gulp-htmlmin... |
Set les champs money to not required | <?php
namespace PiggyBox\ShopBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
class ProductType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
... | <?php
namespace PiggyBox\ShopBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
class ProductType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
... |
Make foreign keys unsigned for pivot table generation | <?php namespace Way\Generators\Commands;
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class PivotGeneratorCommand extends BaseGeneratorCommand {
/**
* The console command name.
*
* @var string
*/
protec... | <?php namespace Way\Generators\Commands;
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class PivotGeneratorCommand extends BaseGeneratorCommand {
/**
* The console command name.
*
* @var string
*/
protec... |
Fix failing tests on setup.py test | from plasmapy.classes import BasePlasma, GenericPlasma
# Get rid of any previously registered classes.
BasePlasma._registry = {}
class NoDataSource(BasePlasma):
pass
class IsDataSource(BasePlasma):
@classmethod
def is_datasource_for(cls, **kwargs):
return True
class IsNotDataSource(BasePlasma):
... | from plasmapy.classes import BasePlasma, GenericPlasma
class NoDataSource(BasePlasma):
pass
class IsDataSource(BasePlasma):
@classmethod
def is_datasource_for(cls, **kwargs):
return True
class IsNotDataSource(BasePlasma):
@classmethod
def is_datasource_for(cls, **kwargs):
return ... |
Remove error responsibility from APIResponse | import {
TYPES,
thingType,
COMMENT,
USER,
LINK,
MESSAGE,
} from './thingTypes';
export default class APIResponse {
constructor(meta={}) {
this.meta = meta;
this.results = [];
this.links = {};
this.comments = {};
this.users = {};
this.messages = {};
this.typeToTable = {
... | import {
TYPES,
thingType,
COMMENT,
USER,
LINK,
MESSAGE,
} from './thingTypes';
export default class APIResponse {
constructor(meta={}) {
this.meta = meta;
this.results = [];
this.errors;
this.links = {};
this.comments = {};
this.users = {};
this.messages = {};
this.typ... |
Revert "fix: ensure a scope is used"
This reverts commit 3fbfbb1b2687de3d7c056a6790ad735b19eb9254.
No longer necessary, this is now fixed in vatesfr/xo-server@8c7d254244fdf0438ab8f0bf9ee7c082f7318f09 | import { Strategy } from 'passport-google-oauth20'
// ===================================================================
export const configurationSchema = {
type: 'object',
properties: {
callbackURL: {
type: 'string',
description: 'Must be exactly the same as specified on the Google developer co... | import { Strategy } from 'passport-google-oauth20'
// ===================================================================
export const configurationSchema = {
type: 'object',
properties: {
callbackURL: {
type: 'string',
description: 'Must be exactly the same as specified on the Google developer co... |
Initialize set results before button action. The UI client can be used for receiving messages only. | import converters.JsonConverter;
import datamodel.Request;
import httpserver.RequestSender;
import httpserver.WebServer;
import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
public class Controller {
... | import converters.JsonConverter;
import datamodel.Request;
import httpserver.RequestSender;
import httpserver.WebServer;
import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
public class Controller {
... |
Move annonymous function handling resolved route into named function. | var Driver = require('./Driver').Driver;
function turnpike_server() {
return function(req, res) {
var d = domain.create();
d.on('error', function(er){
console.error('Error encountered in connection handler', er.stack);
try {
var countdown = setTimeout(function(){
process.exit(1... | var Driver = require('./Driver').Driver;
function turnpike_server() {
return function(req, res) {
var d = domain.create();
d.on('error', function(er){
console.error('Error encountered in connection handler', er.stack);
try {
var countdown = setTimeout(function(){
process.exit(1... |
Switch project view when user picks a different project. | Application.Directives.directive("sidebarProjects", sidebarProjectsDirective);
function sidebarProjectsDirective() {
return {
restrict: "AE",
replace: true,
templateUrl: "index/sidebar-projects.html",
controller: "sidebarProjectsDirectiveController"
};
}
Application.Controllers... | Application.Directives.directive("sidebarProjects", sidebarProjectsDirective);
function sidebarProjectsDirective() {
return {
restrict: "AE",
replace: true,
templateUrl: "index/sidebar-projects.html",
controller: "sidebarProjectsDirectiveController"
};
}
Application.Controllers... |
Clean up unused packages in tests | var chai = require('chai'),
sinon = require('sinon'),
rewire = require('rewire');
var expect = chai.expect;
var assert = chai.assert;
describe("It scans for devices", function() {
var detector,
loggerMock,
sonumiLoggerMock,
networkAdapterMock;
var deviceDetector = rewire(".... | var chai = require('chai'),
sinon = require('sinon'),
rewire = require('rewire');
require('sinon-as-promised');
var expect = chai.expect;
var assert = chai.assert;
describe("Scan", function() {
var detector,
loggerMock,
sonumiLoggerMock,
networkAdapterMock;
var deviceDetec... |
tool-core: Change the order of the progress bar and the brand icon | package com.speedment.tool.core.internal.toolbar;
import com.speedment.common.injector.annotation.ExecuteBefore;
import com.speedment.common.injector.annotation.InjectKey;
import com.speedment.common.injector.annotation.WithState;
import com.speedment.tool.core.component.UserInterfaceComponent;
import com.speedment.to... | package com.speedment.tool.core.internal.toolbar;
import com.speedment.common.injector.annotation.ExecuteBefore;
import com.speedment.common.injector.annotation.InjectKey;
import com.speedment.common.injector.annotation.WithState;
import com.speedment.tool.core.component.UserInterfaceComponent;
import com.speedment.to... |
Make uvloop except be explicit ImportError | #!/usr/bin/env python3.6
import argparse
import asyncio
import logging
import sys
from pathlib import Path
from MoMMI.logsetup import setup_logs
# Do this BEFORE we import master, because it does a lot of event loop stuff.
if sys.platform == "win32":
loop = asyncio.ProactorEventLoop()
asyncio.set_event_loop(lo... | #!/usr/bin/env python3.6
import argparse
import asyncio
import logging
import sys
from pathlib import Path
from MoMMI.logsetup import setup_logs
# Do this BEFORE we import master, because it does a lot of event loop stuff.
if sys.platform == "win32":
loop = asyncio.ProactorEventLoop()
asyncio.set_event_loop(lo... |
Adjust the CI job name. |
var job_name = "liveoak";
var CI = function() {
this.json_url = "https://projectodd.ci.cloudbees.com/job/" + job_name + "/api/json?depth=1";
$.ajax( {
url: this.json_url,
jsonp: 'jsonp',
dataType: 'jsonp',
type: 'GET',
success: this.handle_job_jsonp,
} );
}
CI.prototype = {
handle_j... |
var job_name = "experimental";
var CI = function() {
this.json_url = "https://projectodd.ci.cloudbees.com/job/" + job_name + "/api/json?depth=1";
$.ajax( {
url: this.json_url,
jsonp: 'jsonp',
dataType: 'jsonp',
type: 'GET',
success: this.handle_job_jsonp,
} );
}
CI.prototype = {
han... |
Fix Python module search path | from utils.helpers import error, find_mbed_dir, is_mbed_dir
import sys, os
from utils import set_project_dir
from commands.set import CmdSet
from commands.get import CmdGet
from commands.clone import CmdClone
from commands.compile import CmdCompile
from commands.list import CmdList
###################################... | from utils.helpers import error, find_mbed_dir, is_mbed_dir
import sys, os
from utils import set_project_dir
from commands.set import CmdSet
from commands.get import CmdGet
from commands.clone import CmdClone
from commands.compile import CmdCompile
from commands.list import CmdList
###################################... |
Remove URL test due to bad validator | import json
import unittest
import requests
import validators
class DomainsTests(unittest.TestCase):
def test_json_is_valid(self):
with open("../world_universities_and_domains.json") as json_file:
valid_json = json.load(json_file)
for university in valid_json:
self.assertIn(... | import json
import unittest
import requests
import validators
class DomainsTests(unittest.TestCase):
def test_json_is_valid(self):
with open("../world_universities_and_domains.json") as json_file:
valid_json = json.load(json_file)
for university in valid_json:
self.assertIn(... |
Fix OpDateFormat test in other time zones and separate into dedicated methods | package com.addthis.hydra.data.query;
import org.joda.time.format.DateTimeFormat;
import org.junit.Test;
public class TestOpDateFormat extends TestOp {
@Test
public void testConvertDatesInPlace() throws Exception {
doOpTest(
new DataTableHelper().
tr().td("1401... | package com.addthis.hydra.data.query;
import org.junit.Test;
public class TestOpDateFormat extends TestOp {
@Test
public void testOpDateFormat() throws Exception {
doOpTest(
new DataTableHelper().
tr().td("140101").
tr().td("140108"),
... |
Add a few debug logs | import debugModule from "debug";
const debug = debugModule("debugger:session:selectors");
import { createSelectorTree, createLeaf } from "reselect-tree";
import evm from "lib/evm/selectors";
import solidity from "lib/solidity/selectors";
const session = createSelectorTree({
/**
* session.info
*/
info: {
... | import debugModule from "debug";
const debug = debugModule("debugger:session:selectors");
import { createSelectorTree, createLeaf } from "reselect-tree";
import evm from "lib/evm/selectors";
import solidity from "lib/solidity/selectors";
const session = createSelectorTree({
/**
* session.info
*/
info: {
... |
Refactor the selected $watch callback to be defined as a method on $scope | import 'angular';
export default [function () {
return {
restrict: 'E',
transclude: true,
replace: true,
templateUrl: '/modules/ui-kit/sol-tabs/sol-tabs.html',
scope: {
selected: '@'
},
link: function ($scope, $element, $attrs) {
Objec... | import 'angular';
export default [function () {
return {
restrict: 'E',
transclude: true,
replace: true,
templateUrl: '/modules/ui-kit/sol-tabs/sol-tabs.html',
scope: {
selected: '@'
},
link: function ($scope, $element, $attrs) {
Objec... |
Fix 0 coming out as empty cell | <?php
namespace AM2Studio\Laravel\Exporter;
trait Exporter
{
public function exportOneSheet($collection, array $columns, $title, $filename, $format = 'xls', $creator = '', $company = '')
{
$rows = [];
$rows[] = array_values($columns);
foreach ($collection as $item) {
$row ... | <?php
namespace AM2Studio\Laravel\Exporter;
trait Exporter
{
public function exportOneSheet($collection, array $columns, $title, $filename, $format = 'xls', $creator = '', $company = '')
{
$rows = [];
$rows[] = array_values($columns);
foreach ($collection as $item) {
$row ... |
Add position to price selector | var timeout = 20000;
var demoCommands = {
getSelector: function(client) {
if(client.globals.environment === 'xvfb_mobile')
return this.elements.searchResult.selector;
else
return this.elements.filters.selector;
},
chooseCategory4K: function(client) {
return th... | var timeout = 20000;
var demoCommands = {
getSelector: function(client) {
if(client.globals.environment === 'xvfb_mobile')
return this.elements.searchResult.selector;
else
return this.elements.filters.selector;
},
chooseCategory4K: function(client) {
return th... |
Fix push stream prototype constructor. | define([
'./stream',
'../functional/isFunction',
'../functional/isDefined',
'../functional/invoke'
], function (Stream, isFunction, isDefined, invoke) {
'use strict';
/**
* @param {Function} [implementation]
* @param {Function} [destroy]
* @constructor
*/
function PushSt... | define([
'./stream',
'../functional/isFunction',
'../functional/isDefined',
'../functional/invoke'
], function (Stream, isFunction, isDefined, invoke) {
'use strict';
/**
* @param {Function} [implementation]
* @param {Function} [destroy]
* @constructor
*/
function PushSt... |
Add 1 level depth and also categories fields to employee serializer | from .models import Employee
from rest_framework import serializers
class EmployeeSerializer(serializers.ModelSerializer):
class Meta:
model = Employee
depth = 1
fields = ('pk',
'username',
'email',
'first_name',
'last... | from .models import Employee
from rest_framework import serializers
class EmployeeSerializer(serializers.ModelSerializer):
class Meta:
model = Employee
fields = ('pk',
'username',
'email',
'first_name',
'last_name',
... |
Revert "We shouldn’t clear history, since we’re starting a new history file."
Yeah. That was a brain fart. We absolutely should.
This reverts commit 939eec2127dd22534ccabc81d9411ad870176c4e. | <?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\Readline;
use Psy\Readline\Libedit;
class LibeditTest extends \PHPUnit_Framework_TestCase
... | <?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\Readline;
use Psy\Readline\Libedit;
class LibeditTest extends \PHPUnit_Framework_TestCase
... |
:hammer: Fix Travis CI build error | // Karma configuration
// Generated on Wed Aug 30 2017 09:45:21 GMT+0800 (中国标准时间)
const karmaConfig = require('./karma.conf.common.js')
module.exports = function(config) {
config.set(
Object.assign(
{},
karmaConfig,
{
browserStack: {
u... | // Karma configuration
// Generated on Wed Aug 30 2017 09:45:21 GMT+0800 (中国标准时间)
const karmaConfig = require('./karma.conf.common.js')
module.exports = function(config) {
config.set(
Object.assign(
{},
karmaConfig,
{
customLaunchers: {
... |
Use library to print matrices. | import CtCILibrary.AssortedMethods;
import org.junit.Test;
import static org.junit.Assert.*;
public class Q6Test {
interface RotateMatrix90 {
void rotate90(int[][] mat);
}
public void testRotateMatrix90(RotateMatrix90 rotateMatrix90) {
int[][] inputMatrix = {
{1,2,3},
... | import org.junit.Test;
import static org.junit.Assert.*;
public class Q6Test {
interface RotateMatrix90 {
void rotate90(int[][] mat);
}
public void testRotateMatrix90(RotateMatrix90 rotateMatrix90) {
int[][] inputMatrix = {
{1,2,3},
{4,5,6},
... |
Fix req stream race condition due to middleware | // Requires
var _ = require('underscore');
var express = require('express');
function setup(options, imports, register) {
// Import
var app = imports.server.app;
var workspace = imports.workspace;
// Apply middlewares
app.use(express.cookieParser());
app.use(express.cookieSession({
k... | // Requires
var _ = require('underscore');
var express = require('express');
function setup(options, imports, register) {
// Import
var app = imports.server.app;
var workspace = imports.workspace;
// Apply middlewares
app.use(express.cookieParser());
app.use(express.cookieSession({
k... |
Use bold line number for verse. | from bs4 import BeautifulSoup
from bs4 import Comment
from bs4 import NavigableString
import plumeria.util.http as http
from plumeria.command import commands, CommandError
from plumeria.command.parse import Text
from plumeria.util.ratelimit import rate_limit
@commands.register("bible", "esv", category="Search", para... | from bs4 import BeautifulSoup
from bs4 import Comment
from bs4 import NavigableString
import plumeria.util.http as http
from plumeria.command import commands, CommandError
from plumeria.command.parse import Text
from plumeria.util.ratelimit import rate_limit
@commands.register("bible", "esv", category="Search", para... |
Update record temperature to use the stored sensors | var ds18b20 = require('ds18b20');
var crontab = require('node-crontab');
var config = require('../config.json');
var logger = require('./logger.js');
var sensors = [];
function recordTemperature() {
sensors.forEach(function (sensor) {
ds18b20.temperature(sensor, function(err, value) {
lo... | var ds18b20 = require('ds18b20');
var crontab = require('node-crontab');
var config = require('../config.json');
var logger = require('./logger.js');
function recordTemperature(){
ds18b20.sensors(function(err, ids) {
for(index in ids){
ds18b20.temperature(ids[index], function(err, value) {
va... |
Remove use of 'share()' in provider to be laravel 5.4 compatible | <?php
namespace Chalcedonyt\Specification\Providers;
use Chalcedonyt\Specification\Commands\SpecificationGeneratorCommand;
use Illuminate\Support\ServiceProvider;
class SpecificationServiceProvider extends ServiceProvider
{
/**
* Perform post-registration booting of services.
*
* @return void
... | <?php
namespace Chalcedonyt\Specification\Providers;
use Chalcedonyt\Specification\Commands\SpecificationGeneratorCommand;
use Illuminate\Support\ServiceProvider;
class SpecificationServiceProvider extends ServiceProvider
{
/**
* Perform post-registration booting of services.
*
* @return void
... |
Undo accidental global leakage of sys | #!/usr/bin/env python
import contextlib as __stickytape_contextlib
@__stickytape_contextlib.contextmanager
def __stickytape_temporary_dir():
import tempfile
import shutil
dir_path = tempfile.mkdtemp()
try:
yield dir_path
finally:
shutil.rmtree(dir_path)
with __stickytape_temporar... | #!/usr/bin/env python
import contextlib as __stickytape_contextlib
@__stickytape_contextlib.contextmanager
def __stickytape_temporary_dir():
import tempfile
import shutil
dir_path = tempfile.mkdtemp()
try:
yield dir_path
finally:
shutil.rmtree(dir_path)
with __stickytape_temporar... |
Fix Bot Errors with Selecting Wrong Users
Also fix validation in case the zeroth user isn't correct, which is happening a bunch.
Compare the names casefolded incase of mismatch in capitalization. | from twitch import TwitchClient
class TwitchHandler:
async def validateStream(url, twitch_id):
client = TwitchClient(client_id=twitch_id)
channelName = url.split('/')[-1]
channels = client.search.channels(channelName)
if channels:
for ch in channels:
... | from twitch import TwitchClient
class TwitchHandler:
async def validateStream(url, twitch_id):
client = TwitchClient(client_id=twitch_id)
channelName = url.split('/')[-1]
channels = client.search.channels(channelName)
if channels:
channel = channels[0]
... |
Remove unused middleware stuff and add model events | <?php
return [
'route' => 'warden',
'auth' => [
/*
* Set this to your own custom middleware, just please know that it
* should ensure that the user is logged in.
*/
'middleware' => ['web', 'auth'],
'middleware_api' => ['api'],
],
'views' => [
... | <?php
return [
'route' => 'warden',
'auth' => [
/*
* Set this to your own custom middleware, just please know that it
* should ensure that the user is logged in.
*/
'middleware' => Kregel\Warden\Http\Middleware\Authentication::class,
'middleware_name' => 'cust... |
Remove positional argument "name" from Textbox
Users should just use the kwarg name; no sense in having both.
Closes #239 | from .. import bar, manager
import base
class TextBox(base._TextBox):
"""
A flexible textbox that can be updated from bound keys, scripts and
qsh.
"""
defaults = manager.Defaults(
("font", "Arial", "Text font"),
("fontsize", None, "Font pixel size. Calculated if None."),
... | from .. import bar, manager
import base
class TextBox(base._TextBox):
"""
A flexible textbox that can be updated from bound keys, scripts and
qsh.
"""
defaults = manager.Defaults(
("font", "Arial", "Text font"),
("fontsize", None, "Font pixel size. Calculated if None."),
... |
Remove some Python environment variables from user subprocess environment. | import sys, os, subprocess
remove_vars = ("PYTHONHOME", "PYTHONPATH", "VERSIONER_PYTHON_PREFER_32_BIT")
def make_environment(env=None):
if env is None:
env = os.environ
env = env.copy()
for var in remove_vars:
if var in env:
del env[var]
env["PYTHONUNBUFFERED"] = "1"
en... | import sys, os, subprocess
def make_environment(env=None):
if env is None:
env = os.environ
env = env.copy()
env["PYTHONUNBUFFERED"] = "1"
env["PYTHONIOENCODING"] = "UTF-8"
return env
def run_shell_command(cmdline, pipe_output=True, env=None, **kwargs):
if sys.platform == "win32":
... |
BB-562: Add possibility to inject code into forms and view templates
- CR fixes | <?php
namespace Oro\Bundle\UIBundle\Event;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\Form\FormView;
use Twig_Environment;
use Oro\Bundle\UIBundle\View\ScrollData;
class BeforeListRenderEvent extends Event
{
/**
* @var \Twig_Environment
*/
protected $environment;
/**
... | <?php
namespace Oro\Bundle\UIBundle\Event;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\Form\FormView;
use Twig_Environment;
use Oro\Bundle\UIBundle\View\ScrollData;
class BeforeListRenderEvent extends Event
{
/**
* @var \Twig_Environment
*/
protected $environment;
/**
... |
Add wait cursor when loading folder create menu | // folder-create-menu.js
jQuery(function($) {
$('#create-menu').one('click', function() {
var wait = calli.wait();
$.ajax({
type: 'GET',
url: $('#create-menu-json')[0].href + encodeURIComponent(calli.getUserIri()),
xhrFields: calli.withCredentials,
da... | // folder-create-menu.js
jQuery(function($) {
$('#create-menu').one('click', function() {
$.ajax({
type: 'GET',
url: $('#create-menu-json')[0].href + encodeURIComponent(calli.getUserIri()),
xhrFields: calli.withCredentials,
dataType: 'json',
succe... |
Update bar status query download | import { computed, transaction, action, autorun } from 'mobx'
import { BarQueryDownload } from './barquery.js'
import { config } from '/utils/config.js'
export class BarStatusDownload extends BarQueryDownload {
name = 'bar status'
// update bar status every 30s
cacheInfo = config.defaultRefreshCacheInfo
... | import { computed, transaction, action, autorun } from 'mobx'
import { BarQueryDownload } from './barquery.js'
import { config } from '/utils/config.js'
export class BarStatusDownload extends BarQueryDownload {
name = 'bar status'
// update bar status every 30s
cacheInfo = config.defaultRefreshCacheInfo
... |
Sort new cmd: allow empty separator | from cudatext import *
def _sort(s, sep_k, sep_v):
if sep_k:
if not sep_k in s:
return s
key, val = s.split(sep_k, 1)
vals = sorted(val.split(sep_v))
return key+sep_k+sep_v.join(vals)
else:
vals = sorted(s.split(sep_v))
return sep_v.join(vals)
def ... | from cudatext import *
def _sort(s, sep_k, sep_v):
if not sep_k in s:
return s
key, val = s.split(sep_k, 1)
vals = sorted(val.split(sep_v))
return key+sep_k+sep_v.join(vals)
def do_sort_sep_values():
while 1:
res = dlg_input_ex(2,
'Sort: separator chars',
... |
WebRTC: Fix builder triggering in client.webrtc.fyi
In https://codereview.chromium.org/867283002 I missed to
add the new builders to the triggering.
TBR=phoglund@chromium.org
Review URL: https://codereview.chromium.org/875733002
git-svn-id: 239fca9b83025a0b6f823aeeca02ba5be3d9fd76@293797 0039d316-1c4b-4281-b951-d87... | # Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from buildbot.schedulers.basic import SingleBranchScheduler
from master.factory import annotator_factory
m_annotator = annotator_factory.AnnotatorFactory()... | # Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from buildbot.schedulers.basic import SingleBranchScheduler
from master.factory import annotator_factory
m_annotator = annotator_factory.AnnotatorFactory()... |
Add new class to description | import React, { Component } from 'react';
import ReactCSSTransitionReplace from 'react-css-transition-replace';
import { connect } from 'react-redux';
import store from '../store.js';
class Description extends Component {
constructor(props) {
super(props);
}
isFinished() {
return (this.p... | import React, { Component } from 'react';
import ReactCSSTransitionReplace from 'react-css-transition-replace';
import { connect } from 'react-redux';
import store from '../store.js';
class Description extends Component {
constructor(props) {
super(props);
}
isFinished() {
return (this.p... |
Allow to use own Repositories like UserRepository | <?php
/**
* @author: Patsura Dmitry http://github.com/ovr <talk@dmtry.me>
*/
namespace Lynx;
use Doctrine\DBAL\Connection;
class EntityManager
{
/**
* @var Connection
*/
protected $connection;
/**
* @var Repository[]
*/
protected $repositories;
public function __construct(... | <?php
/**
* @author: Patsura Dmitry http://github.com/ovr <talk@dmtry.me>
*/
namespace Lynx;
use Doctrine\DBAL\Connection;
class EntityManager
{
/**
* @var Connection
*/
protected $connection;
/**
* @var Repository[]
*/
protected $repositories;
public function __construct(... |
Move identifier setter to setEventManager | <?php
namespace ZfcBase\EventManager;
use Zend\EventManager\EventCollection,
Zend\EventManager\EventManager;
abstract class EventProvider
{
/**
* @var EventCollection
*/
protected $events;
/**
* Set the event manager instance used by this context
*
* @param EventCollection... | <?php
namespace ZfcBase\EventManager;
use Zend\EventManager\EventCollection,
Zend\EventManager\EventManager;
abstract class EventProvider
{
/**
* @var EventCollection
*/
protected $events;
/**
* Set the event manager instance used by this context
*
* @param EventCollection... |
Fix how to get tags and fields name
The old implementation returns 'integer', 'float' in the result list. | """ InfluxAlchemy Client. """
from . import query
from .measurement import Measurement
class InfluxAlchemy(object):
""" InfluxAlchemy database session.
client (InfluxDBClient): Connection to InfluxDB database
"""
def __init__(self, client):
self.bind = client
# pylint: disable=p... | """ InfluxAlchemy Client. """
from . import query
from .measurement import Measurement
class InfluxAlchemy(object):
""" InfluxAlchemy database session.
client (InfluxDBClient): Connection to InfluxDB database
"""
def __init__(self, client):
self.bind = client
# pylint: disable=p... |
Replace loaders -> rules. Edit webpack.optimize.CommonsChunkPlugin config | const rules = require("./rules");
const webpack = require("webpack");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const CleanWebpackPlugin = require("clean-webpack-plugin");
const UglifyJSPlugin = require("uglifyjs-webpack-plugin");
const path = require("path");
module.exports = {
context: path.join(... | const loaders = require("./loaders");
const webpack = require("webpack");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const CleanWebpackPlugin = require("clean-webpack-plugin");
const UglifyJSPlugin = require("uglifyjs-webpack-plugin");
const path = require("path");
module.exports = {
context: path.j... |
Adjust the time factor to align frontent and backend auth.
Fixes #27 | /* jshint node: true */
module.exports = function(environment) {
var ENV = {
modulePrefix: 'client',
environment: environment,
baseURL: '/',
locationType: 'auto',
'ember-simple-auth-token': {
serverTokenEndpoint: 'http://localhost:8080/api-token-auth/',
serverTokenRefreshEndpoint: 'h... | /* jshint node: true */
module.exports = function(environment) {
var ENV = {
modulePrefix: 'client',
environment: environment,
baseURL: '/',
locationType: 'auto',
'ember-simple-auth-token': {
serverTokenEndpoint: 'http://localhost:8080/api-token-auth/',
serverTokenRefreshEndpoint: 'h... |
Add a forgoten close tag | <!DOCTYPE html>
<html lang="en">
<head>
<title>EndofCodes Demo</title>
<?php
include 'helpers/html.php';
includeStyle( "general" );
includeStyle( "header" );
includeStyle( "home" );
includeStyle( "register" );
includeStyle( "lo... | <!DOCTYPE html>
<html lang="en">
<head>
<title>EndofCodes Demo</title>
<?php
include 'helpers/html.php';
includeStyle( "general" );
includeStyle( "header" );
includeStyle( "home" );
includeStyle( "register" );
includeStyle( "lo... |
Use find_packages() instead of manually specifying package name, so that subpackages get included | from setuptools import setup, find_packages
setup(name="manhattan",
version='0.2',
description='Robust Server-Side Analytics',
long_description='',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Programming Language :: Python :: 2.7',
'Topic :: Inte... | from setuptools import setup
setup(name="manhattan",
version='0.2',
description='Robust Server-Side Analytics',
long_description='',
classifiers=[
'Development Status :: 5 - Production/Stable',
'Programming Language :: Python :: 2.7',
'Topic :: Internet :: WWW/HTT... |
Remove dead code from login modal window | var myUsername = null;
var URL = window.location.hostname + ':8080';
var socket = io.connect(URL);
var channel;
var ready = false;
var active = true;
var first = true;
function updateOwnMessagesInHistory() {
$('#message-list li').each(function() {
if ($(this).find('strong').text() == myUsername) {
... | var myUsername = null;
var URL = window.location.hostname + ':8080';
var socket = io.connect(URL);
var channel;
var ready = false;
var active = true;
var first = true;
function updateOwnMessagesInHistory() {
$('#message-list li').each(function() {
if ($(this).find('strong').text() == myUsername) {
... |
Add support for intent slot's value as a object | 'use strict';
const _ = require('underscore');
function buildSlots(slots) {
const res = {};
_.each(slots, (value, key) => {
res[key] = {
name: key,
value: value
};
if(! _.isString(value)){
res[key] = {...res[key],...value}
}
});
return res;
}
function buildSession(e) {
ret... | 'use strict';
const _ = require('underscore');
function buildSlots(slots) {
const res = {};
_.each(slots, (value, key) => {
res[key] = {
name: key,
value: value
};
});
return res;
}
function buildSession(e) {
return e ? e.sessionAttributes : {};
}
function init(options) {
let isNew =... |
Modify getPrice to report name of item actually queried | import module from '../../module'
import command from '../../components/command'
import axios from 'axios'
import humanize from '../../utils/humanize'
export default module(
command('getprice', 'Gets the Jita price of a given item.', async (state, message, args) => {
try {
const esiURL = 'https... | import module from '../../module'
import command from '../../components/command'
import axios from 'axios'
import humanize from '../../utils/humanize'
export default module(
command('getprice', 'Gets the Jita price of a given item.', async (state, message, args) => {
try {
const esiURL = 'https... |
Add description for java 95 | import java.util.ArrayList;
import java.util.List;
/**
* Given an integer n, generate all structurally unique BST's (binary search trees) that store values 1...n.
* <p>
* For example,
* Given n = 3, your program should return all 5 unique BST's shown below.
* <p>
* 1 3 3 2 1
* \ / ... | import java.util.ArrayList;
import java.util.List;
/**
* Created by drfish on 27/05/2017.
*/
public class _095UniqueBinarySearchTreesII {
public List<TreeNode> generateTrees(int n) {
List<TreeNode> result = genTrees(1, n);
if (result.get(0) == null) {
return new ArrayList<>();
... |
Change trove classifier; 'BSD' was invalid
List of available is here:
https://pypi.python.org/pypi?:action=list_classifiers | #!/usr/bin/env python
from distribute_setup import use_setuptools
use_setuptools()
from setuptools import setup
classifiers = [
'Development Status :: 4 - Beta'
, 'Environment :: Console'
, 'Environment :: Console :: Curses'
, 'Intended Audience :: Developers'
, 'License :: OSI Approved :: BSD License'
... | #!/usr/bin/env python
from distribute_setup import use_setuptools
use_setuptools()
from setuptools import setup
classifiers = [
'Development Status :: 4 - Beta'
, 'Environment :: Console'
, 'Environment :: Console :: Curses'
, 'Intended Audience :: Developers'
, 'License :: BSD'
, 'Natural Language :: ... |
Fix parsing of commander options | /**
* Main CLI parser class
*/
class Config
{
/**
* @param {Command} argv
*/
constructor (argv)
{
// commander just returns undefined for missing flags, so transform them to boolean
/**
* @private
* @type {boolean}
*/
this.dev = !!argv.d || !!ar... | /**
* Main CLI parser class
*/
class Config
{
/**
* @param {Command} argv
*/
constructor (argv)
{
/**
* @private
* @type {boolean}
*/
this.dev = argv.d || argv.dev;
/**
* @private
* @type {boolean}
*/
this.deb... |
Revert "Check if app is mounted"
This reverts commit cb9e2bfb6b03435513750b741da1a5896ae4ad5d. | import React, { Component } from 'react';
import { Navbar, Nav, NavItem } from 'react-bootstrap';
import ImgurImage from './ImgurImage';
import { searchGallery } from './../services/imgur';
export default class App extends Component {
constructor(props) {
super(props);
this.state = {images: [], page: 0};
... | import React, { Component } from 'react';
import { Navbar, Nav, NavItem } from 'react-bootstrap';
import ImgurImage from './ImgurImage';
import { searchGallery } from './../services/imgur';
export default class App extends Component {
constructor(props) {
super(props);
this.state = {images: [], page: 0};
... |
Update Stylus filter with include paths
Since the Stylus filter works with stdin, the compiler doesn't know the
source directory, and thus can't resolve any imports. This adds the
source directory to the include path using the `--include` option, and
also adds the `STYLUS_EXTRA_PATHS` option to configure any extra
... | import os
from webassets.filter import ExternalTool, option
__all__ = ('Stylus',)
class Stylus(ExternalTool):
"""Converts `Stylus <http://learnboost.github.com/stylus/>`_ markup to CSS.
Requires the Stylus executable to be available externally. You can install
it using the `Node Package Manager <http:/... | from webassets.filter import ExternalTool, option
__all__ = ('Stylus',)
class Stylus(ExternalTool):
"""Converts `Stylus <http://learnboost.github.com/stylus/>`_ markup to CSS.
Requires the Stylus executable to be available externally. You can install
it using the `Node Package Manager <http://npmjs.org... |
Support ipv6 for status endpoint security | package org.apereo.cas.configuration.model.core.web.security;
import org.springframework.core.io.Resource;
/**
* This is {@link AdminPagesSecurityProperties}.
*
* @author Misagh Moayyed
* @since 5.0.0
*/
public class AdminPagesSecurityProperties {
private String ip = "127\\.0\\.0\\.1|0:0:0:0:0:0:0:1";
... | package org.apereo.cas.configuration.model.core.web.security;
import org.springframework.core.io.Resource;
/**
* This is {@link AdminPagesSecurityProperties}.
*
* @author Misagh Moayyed
* @since 5.0.0
*/
public class AdminPagesSecurityProperties {
private String ip = "127\\.0\\.0\\.1";
private String a... |
Update StatViewSet to generic, add necessary mixins | # from django.contrib.auth.models import User
from django.shortcuts import get_object_or_404
from rest_framework import viewsets, mixins, permissions # , serializers
from .models import Stat, Activity
# from .permissions import IsAPIUser
from .serializers import ActivitySerializer, ActivityListSerializer, StatSerializ... | # from django.contrib.auth.models import User
from django.shortcuts import get_object_or_404
from rest_framework import viewsets, permissions # , serializers
from .models import Stat, Activity
from .permissions import IsAPIUser
from .serializers import ActivitySerializer, ActivityListSerializer, StatSerializer
# Crea... |
Revert "api key deleted from the list of required parameters" | package org.atlasapi.application.auth;
import static com.google.common.base.Preconditions.checkNotNull;
import javax.servlet.http.HttpServletRequest;
import org.atlasapi.application.Application;
import org.atlasapi.application.ApplicationSources;
import org.atlasapi.application.ApplicationStore;
import com.google.c... | package org.atlasapi.application.auth;
import static com.google.common.base.Preconditions.checkNotNull;
import javax.servlet.http.HttpServletRequest;
import org.atlasapi.application.Application;
import org.atlasapi.application.ApplicationSources;
import org.atlasapi.application.ApplicationStore;
import com.google.c... |
Add additional logging to initialise game | /* global angular */
import {web3, Chess} from '../../contract/Chess.sol';
angular.module('dappChess').controller('InitializeGameCtrl',
function ($rootScope, $scope, accounts) {
$scope.availableAccounts = accounts.availableAccounts;
$scope.selectedAccount = accounts.defaultAccount;
$scope.startcolor = 'wh... | /* global angular */
import {web3, Chess} from '../../contract/Chess.sol';
angular.module('dappChess').controller('InitializeGameCtrl',
function ($rootScope, $scope, accounts) {
$scope.availableAccounts = accounts.availableAccounts;
$scope.selectedAccount = accounts.defaultAccount;
$scope.startcolor = 'wh... |
Add entry point for test-informant | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
from setuptools import setup, find_packages
PACKAGE_VERSION = '0.1'
deps = ['flask',
'Jinja2',
'manife... | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
from setuptools import setup, find_packages
PACKAGE_VERSION = '0.1'
deps = ['flask',
'Jinja2',
'manife... |
Add command to quickly open a notes file | import neovim
import os
from datetime import datetime
@neovim.plugin
class VimpBuffers(object):
def __init__(self, vim):
self.vim = vim
@neovim.command("ToggleTerminalBuffer")
def toggle_terminal_buffer(self):
current_buffer = self.vim.current.buffer
# find the currently open term... | import neovim
@neovim.plugin
class VimpBuffers(object):
def __init__(self, vim):
self.vim = vim
@neovim.command("ToggleTerminalBuffer")
def toggle_terminal_buffer(self):
current_buffer = self.vim.current.buffer
# find the currently open terminal and close it
for idx, windo... |
Validate URI in project config schema | <?php
namespace Drubo\Config\Project;
use Drubo\Config\ConfigSchema;
use Drubo\DruboAwareInterface;
use Drubo\DruboAwareTrait;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Validator\Constraints\Url;
/**
* Schema cl... | <?php
namespace Drubo\Config\Project;
use Drubo\Config\ConfigSchema;
use Drubo\DruboAwareInterface;
use Drubo\DruboAwareTrait;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Validator\Constraints\Url;
use Symfony\Compo... |
Move json print methods into if statement | import os
import json
from dateutil.parser import parse
from scrapi.util import safe_filename
def migrate_from_old_scrapi():
for dirname, dirs, filenames in os.walk('archive'):
for filename in filenames:
oldpath = os.path.join(dirname, filename)
source, sid, dt = dirname.split('/... | import os
import json
from dateutil.parser import parse
from scrapi.util import safe_filename
def migrate_from_old_scrapi():
for dirname, dirs, filenames in os.walk('archive'):
for filename in filenames:
oldpath = os.path.join(dirname, filename)
source, sid, dt = dirname.split('/... |
Rewrite inserting function. It can be a lot simpler now we know we're always dealing with up-to-date data. |
def import_question(posts, namespaces, id, title, body, tags, last_activity_date, last_updated_date, score, answer_count, has_accepted_answer):
namespaces_for_post = {}
for name, n in namespaces.items():
namespace_tags = n.get_tags()
if not(namespace_tags) or any(map(lambda x: x in tags, namesp... |
def import_question(posts, namespaces, id, title, body, tags, last_activity_date, last_updated_date, score, answer_count, has_accepted_answer):
namespaces_for_post = {}
for name, n in namespaces.items():
namespace_tags = n.get_tags()
if not(namespace_tags) or any(map(lambda x: x in tags, namesp... |
Update 1.0 release with latest version of pid sequence migration | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from pidman.pid.noid import decode_noid, encode_noid
from pidman.pid import models as pid_models
def pid_sequence_lastvalue(apps, schema_editor):
# if the database has existing pids, update the sequence last ... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
from pidman.pid.noid import decode_noid
from pidman.pid import models as pid_models
def pid_sequence_lastvalue(apps, schema_editor):
# if the database has existing pids, update the sequence last value
# s... |
Switch to using the `add_arguments` method.
This is an alternative to using the `option_list` and
`optparse.make_option`. Django deprecated the use of `optparse` in
management commands in Django 1.8 and removed it in Django 1.10. | import tempfile
import sys
from django.core.management.base import BaseCommand
from ...lockfile import FileLock, FileLocked
from ...mail import send_queued
from ...logutils import setup_loghandlers
logger = setup_loghandlers()
default_lockfile = tempfile.gettempdir() + "/post_office"
class Command(BaseCommand):
... | import tempfile
import sys
from optparse import make_option
from django.core.management.base import BaseCommand
from ...lockfile import FileLock, FileLocked
from ...mail import send_queued
from ...logutils import setup_loghandlers
logger = setup_loghandlers()
default_lockfile = tempfile.gettempdir() + "/post_office... |
Indent with 8 spaces instead of 2 tabs
Similar to the rest. | <?= '<?php' ?>
/**
* An helper file for Laravel 4, to provide autocomplete information to your IDE
* Generated for Laravel <?= $version ?> on <?= date("Y-m-d") ?>.
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
<?php foreach($namespaces as $n... | <?= '<?php' ?>
/**
* An helper file for Laravel 4, to provide autocomplete information to your IDE
* Generated for Laravel <?= $version ?> on <?= date("Y-m-d") ?>.
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
<?php foreach($namespaces as $n... |
Move redundant check to first point of contact | import random
def sort(items):
if items is None:
raise TypeError("Collection cannot be of type None")
if len(items) < 2:
return items
pivot = random.randint(0, len(items) - 1)
greater = []
less = []
for index in range(0, len(items)):
if index == pivot:
c... | import random
def sort(items):
if items is None:
raise TypeError("Collection cannot be of type None")
if len(items) < 2:
return items
pivot = random.randint(0, len(items) - 1)
greater = []
less = []
for index in range(0, len(items)):
if index == pivot:
c... |
Add support for otf fonts | const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
entry: './app/src/app.js',
output: {
path: path.resolve(__dirname, 'build'),
filename: 'app.js'
},
plugins: [
// Copy our app's index.html to the build folder.
new ... | const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
entry: './app/src/app.js',
output: {
path: path.resolve(__dirname, 'build'),
filename: 'app.js'
},
plugins: [
// Copy our app's index.html to the build folder.
new ... |
Fix 'remember_me' column not found error | <?php
namespace Illuminate\Auth;
trait Authenticatable
{
/**
* Variable containing "remember me" column name.
*
* @var string
*/
protected $remember_column = 'remember_token';
/**
* Get the name of the unique identifier for the user.
*
* @return string
*/
publi... | <?php
namespace Illuminate\Auth;
trait Authenticatable
{
/**
* Get the name of the unique identifier for the user.
*
* @return string
*/
public function getAuthIdentifierName()
{
return $this->getKeyName();
}
/**
* Get the unique identifier for the user.
*
... |
Fix typo in copy/pasta controllerneeds suite | describe('lib/rules/disallow-controllerneeds', function () {
var checker = global.checker({
plugins: ['./lib/index']
});
describe('not configured', function() {
it('should report with undefined', function() {
global.expect(function() {
checker.configure({disallowControllerN... | describe('lib/rules/disallow-positionalparams-extend', function () {
var checker = global.checker({
plugins: ['./lib/index']
});
describe('not configured', function() {
it('should report with undefined', function() {
global.expect(function() {
checker.configure({disallowCon... |
Hide and show the component element inside of the container. | /**
* @module Core
*/
define([
'core/modules/GelatoView'
], function(GelatoView) {
/**
* @class GelatoComponent
* @extends GelatoView
*/
var GelatoComponent = GelatoView.extend({
/**
* @property component
* @typeof {jQuery}
*/
$component: null,
... | /**
* @module Core
*/
define([
'core/modules/GelatoView'
], function(GelatoView) {
/**
* @class GelatoComponent
* @extends GelatoView
*/
var GelatoComponent = GelatoView.extend({
/**
* @property component
* @typeof {jQuery}
*/
$component: null,
... |
Fix a bug in documentation generation | /* task for generating html from sisdocs markdown */
module.exports = function(grunt) {
'use strict';
var marked = require('marked');
var hljs = require('highlight.js');
var renderer = new marked.Renderer();
var oldLink = renderer.link;
renderer.link = function(href, title, text) {
if (... | /* task for generating html from sisdocs markdown */
module.exports = function(grunt) {
'use strict';
var marked = require('marked');
var hljs = require('highlight.js');
marked.setOptions({
breaks : true,
highlight: function(code, lang) {
var result = hljs.highlight(lang, co... |
Add `${temp_file}` marker to `cmd`
Implicit adding of the `${temp_file}` by the framework has been deprecated and SublimeLinter also logs about it. | from SublimeLinter.lint import Linter, util
class CSSLint(Linter):
cmd = 'csslint --format=compact ${temp_file}'
regex = r'''(?xi)
^.+:\s* # filename
# csslint emits errors that pertain to the code as a whole,
# in which case there is no line/col information, so that
# part ... | from SublimeLinter.lint import Linter, util
class CSSLint(Linter):
cmd = 'csslint --format=compact'
regex = r'''(?xi)
^.+:\s* # filename
# csslint emits errors that pertain to the code as a whole,
# in which case there is no line/col information, so that
# part is optional.
... |
Change groupname from 64 char to 256 | <?php
namespace modl;
class RosterLink extends Model
{
public $session;
public $jid;
public $rosterask;
public $rostersubscription;
public $publickey;
public $rostername;
public $groupname;
public $_struct = [
'session' => ['type' => 'string','size' => 64,'key' => true],... | <?php
namespace modl;
class RosterLink extends Model
{
public $session;
public $jid;
public $rosterask;
public $rostersubscription;
public $publickey;
public $rostername;
public $groupname;
public $_struct = [
'session' => ['type' => 'string','size' => 64,'key' => true],... |
Fix stderr from playerctl bar | # py3status module for playerctl
import subprocess
def run(*cmdlist):
return subprocess.run(
cmdlist,
stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL).stdout.decode()
def player_args(players):
if not players:
return 'playerctl',
else:
return 'playerct... | # py3status module for playerctl
import subprocess
def run(*cmdlist):
return subprocess.run(cmdlist, stdout=subprocess.PIPE).stdout.decode()
def player_args(players):
if not players:
return 'playerctl',
else:
return 'playerctl', '-p', players
def get_status(players):
status = run(*pl... |
Allow ManyToMany relationship sapce_people until better solution | package com.parrit.entities;
import javax.persistence.*;
import java.util.Collection;
@Entity
public class Space {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@ManyToMany(targetEntity = Person.class)
private Collection<Person> people;
private String name;
p... | package com.parrit.entities;
import javax.persistence.*;
import java.util.Collection;
@Entity
public class Space {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@OneToMany(targetEntity = Person.class)
private Collection<Person> people;
private String name;
pu... |
Handle query middleware failing tests | 'use strict';
require('../helper');
const server = require('../../app/server')();
const assert = require('../support/assert');
const qs = require('querystring');
const QUERY = `SELECT 14 as foo`;
const API_KEY = 1234;
describe.only('Handle query middleware', function() {
['GET', 'POST'].forEach(method => {
... | 'use strict';
require('../helper');
const server = require('../../app/server')();
const assert = require('../support/assert');
const qs = require('querystring');
const QUERY = `SELECT 14 as foo`;
const API_KEY = 1234;
const BODY_PAYLOAD = {
q: QUERY,
api_key: API_KEY
};
describe.only('Handle query middlewar... |
Update marko example to hapi v17 | 'use strict';
// Load modules
const Hapi = require('hapi');
const Vision = require('../..');
const Path = require('path');
const Marko = require('marko');
// Declare internals
const internals = {
templatePath: '.'
};
const today = new Date();
internals.thisYear = today.getFullYear();
const rootHandler = (req... | 'use strict';
// Load modules
const Hapi = require('hapi');
const Vision = require('../..');
const Path = require('path');
const Marko = require('marko');
// Declare internals
const internals = {
templatePath: '.'
};
const today = new Date();
internals.thisYear = today.getFullYear();
const rootHandler = (req... |
Update connection to script to waitSeconds to load js |
from collections import OrderedDict
from IPython.display import Javascript
import json
from krisk.util import join_current_dir
ECHARTS_URL = 'https://cdnjs.cloudflare.com/ajax/libs/echarts/3.2.0/'
ECHARTS_FILE = 'echarts.min'
d_paths = OrderedDict({})
THEMES = ['dark','vintage','roma','shine','infographic','macarons'... |
from collections import OrderedDict
from IPython.display import Javascript
import json
from krisk.util import join_current_dir
ECHARTS_URL = 'https://cdnjs.cloudflare.com/ajax/libs/echarts/3.2.0/'
ECHARTS_FILE = 'echarts.min'
d_paths = OrderedDict({})
THEMES = ['dark','vintage','roma','shine','infographic','macarons'... |
Fix "Cannot read property 'startContainer' of undefined" caused by code assuming that saveSelection always returns a range or null and never undefined. Update saveSelection to never return undefined. | define([], function() {
var saveSelection, restoreSelection;
if (window.getSelection && document.createRange) {
saveSelection = function(el) {
var sel = window.getSelection && window.getSelection();
if (sel && sel.rangeCount > 0) {
return sel.getRangeAt(0);
... | define([], function() {
var saveSelection, restoreSelection;
if (window.getSelection && document.createRange) {
saveSelection = function(el) {
var sel = window.getSelection && window.getSelection();
if (sel && sel.rangeCount > 0) {
return sel.getRangeAt(0);
... |
fix(Storage): Use promises correctly, fixes storage clearing error display | 'use strict';
/**
* @ngdoc function
* @name MatchCalendarApp.controller:SettingsCtrl
* @description
* # SettingsCtrl
* Controller of the MatchCalendarApp
*/
angular.module('MatchCalendarApp')
.controller('SettingsCtrl', function ($scope, NotifcationTimeFormat, $localForage, $modal, $window) {
$scope.... | 'use strict';
/**
* @ngdoc function
* @name MatchCalendarApp.controller:SettingsCtrl
* @description
* # SettingsCtrl
* Controller of the MatchCalendarApp
*/
angular.module('MatchCalendarApp')
.controller('SettingsCtrl', function ($scope, NotifcationTimeFormat, $localForage, $modal, $window) {
$scope.... |
Add a assertion to test the href of the link | // Polyfill MouseEvent for PhantomJS
if(MouseEvent === undefined) {
function MouseEvent(eventType, params) {
params = params || { bubbles: false, cancelable: false };
var mouseEvent = document.createEvent('MouseEvent');
mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, ... | // Polyfills
if(MouseEvent === undefined) {
function MouseEvent(eventType, params) {
params = params || { bubbles: false, cancelable: false };
var mouseEvent = document.createEvent('MouseEvent');
mouseEvent.initMouseEvent(eventType, params.bubbles, params.cancelable, window, 0, 0, 0, 0, 0, f... |
Make the cheapest shipping method the default one | from django.core.exceptions import ImproperlyConfigured
from oscar.apps.shipping.methods import Free, NoShippingRequired
class Repository(object):
"""
Repository class responsible for returning ShippingMethod
objects for a given user, basket etc
"""
def get_shipping_methods(self, user, basket, sh... | from django.core.exceptions import ImproperlyConfigured
from oscar.apps.shipping.methods import Free, NoShippingRequired
class Repository(object):
"""
Repository class responsible for returning ShippingMethod
objects for a given user, basket etc
"""
def get_shipping_methods(self, user, basket... |
Remove quotation marks from returned strings. | function eval_clojure(code) {
var data;
$.ajax({
url: "eval.json",
data: {
command: {
expr: code,
mode: mode
}
},
async: false,
success: function(res) { data = res; }
});
return data;
}
function html_escape(val) {
v... | function eval_clojure(code) {
var data;
$.ajax({
url: "eval.json",
data: {
command: {
expr: code,
mode: mode
}
},
async: false,
success: function(res) { data = res; }
});
return data;
}
function html_escape(val) {
v... |
Set proxy port to right address | /*
| For up-to-date information about the options:
| http://www.browsersync.io/docs/options/
*/
module.exports = {
"ui": false, // { "port": 8181, "weinre": { "port": 8080 } },
"files": ['./'],
"watchOptions": {
ignoreInitial: true
},
"port": 8080,
"proxy": {
target: 'localhost... | /*
| For up-to-date information about the options:
| http://www.browsersync.io/docs/options/
*/
module.exports = {
"ui": false, // { "port": 8181, "weinre": { "port": 8080 } },
"files": ['./'],
"watchOptions": {
ignoreInitial: true
},
"port": 8080,
"proxy": {
target: 'localhost... |
Fix detach product(s) instead delete it | <?php namespace Octommerce\Octommerce\Console;
use Carbon\Carbon;
use Illuminate\Console\Command;
use Octommerce\Octommerce\Models\Cart;
use Octommerce\Octommerce\Models\Settings;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class DeleteCart extends Command
{
... | <?php namespace Octommerce\Octommerce\Console;
use Carbon\Carbon;
use Illuminate\Console\Command;
use Octommerce\Octommerce\Models\Cart;
use Octommerce\Octommerce\Models\Settings;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class DeleteCart extends Command
{
... |
Handle review deletion when updating categories for a context | from django.conf import settings
from django.shortcuts import render
from rest_framework import permissions
from rest_framework.views import APIView
from rest_framework.response import Response
from models import Context, Review, Keyword, Category
def index(request):
context = {'DEBUG': settings.DEBUG}
return... | from django.conf import settings
from django.shortcuts import render
from rest_framework import permissions
from rest_framework.views import APIView
from rest_framework.response import Response
from models import Context, Review, Keyword, Category
def index(request):
context = {'DEBUG': settings.DEBUG}
return... |
Change api endpoints due to undocumented breaking changes | <?php namespace Dxi\Commands\Dataset\Contact;
use Dxi\Commands\Command;
class Create extends Command {
/**
* Get the payload for the command
*
* @return array
*/
public function getRequiredParams()
{
return [
'firstname',
'dataset',
[
... | <?php namespace Dxi\Commands\Dataset\Contact;
use Dxi\Commands\Command;
class Create extends Command {
/**
* Get the payload for the command
*
* @return array
*/
public function getRequiredParams()
{
return [
'firstname',
'dataset',
[
... |
Add max width to images | module.exports = {
siteMetadata: {
name: `Iiro Jäppinen`,
siteTitle: 'iiro.fi',
siteUrl: `https://iiro.fi/`
},
plugins: [
{
resolve: 'gatsby-source-filesystem',
options: {
path: `${__dirname}/src/pages`,
name: 'pages',
... | module.exports = {
siteMetadata: {
name: `Iiro Jäppinen`,
siteTitle: 'iiro.fi',
siteUrl: `https://iiro.fi/`
},
plugins: [
{
resolve: 'gatsby-source-filesystem',
options: {
path: `${__dirname}/src/pages`,
name: 'pages',
... |
Add zipcode to Freegeoip results | 'use strict';
(function () {
var net = require('net');
/**
* Constructor
*/
var FreegeoipGeocoder = function(httpAdapter) {
if (!httpAdapter || httpAdapter == 'undefinded') {
throw new Error('FreegeoipGeocoder need an httpAdapter');
}
this.httpAdapter = htt... | 'use strict';
(function () {
var net = require('net');
/**
* Constructor
*/
var FreegeoipGeocoder = function(httpAdapter) {
if (!httpAdapter || httpAdapter == 'undefinded') {
throw new Error('FreegeoipGeocoder need an httpAdapter');
}
this.httpAdapter = htt... |
Fix maxLength governor not accepting null value | import PreprocessShader from './preprocessShader';
import Shader from './shader';
export default class ShaderManager {
constructor(renderer) {
this.renderer = renderer;
this.shaders = [];
this.current = null;
this.handler = null;
// Preprocess shader's governor list
this.governors = {
ma... | import PreprocessShader from './preprocessShader';
import Shader from './shader';
export default class ShaderManager {
constructor(renderer) {
this.renderer = renderer;
this.shaders = [];
this.current = null;
this.handler = null;
// Preprocess shader's governor list
this.governors = {
ma... |
Add skipAuthorization to options instead of a variable in our method | var JWTHelper = require('./jwt-helper');
var JWTConfig = require('./jwt-config');
var JWTRequest = {
setAuthorizationHeader(options, token) {
if (!options.headers) options.headers = {};
options.headers[JWTConfig.authHeader] = `${JWTConfig.authPrefix} ${token}`;
return options;
},
... | var JWTHelper = require('./jwt-helper');
var JWTConfig = require('./jwt-config');
var JWTRequest = {
setAuthorizationHeader(options, token) {
if (!options.headers) options.headers = {};
options.headers[JWTConfig.authHeader] = `${JWTConfig.authPrefix} ${token}`;
return options;
},
... |
Use optparser for generate length | #!/usr/bin/env python
import json
import os
import optparse
import random
from crypto import *
from file_io import *
from settings import *
options = None
arguments = None
def main():
if arguments[0] == 'generate':
generate()
elif arguments[0] == 'save':
save()
elif arguments[0] == 'edit'... | #!/usr/bin/env python
import json
import os
import optparse
import random
from crypto import *
from file_io import *
from settings import *
options = None
arguments = None
def main():
if arguments[0] == 'generate':
generate()
elif arguments[0] == 'save':
save()
elif arguments[0] == 'edit'... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.