text
stringlengths
16
4.96k
positive
stringlengths
321
2.24k
negative
stringlengths
310
2.21k
Remove obsolete import and fix formatting in test.
package hello; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org....
package hello; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org....
Make precompiled script plugin sample backwards compatible with JDK8
package com.example; import org.gradle.api.DefaultTask; import org.gradle.api.file.RegularFileProperty; import org.gradle.api.provider.ListProperty; import org.gradle.api.tasks.InputFile; import org.gradle.api.tasks.Internal; import org.gradle.api.tasks.PathSensitive; import org.gradle.api.tasks.PathSensitivity; impor...
package com.example; import org.gradle.api.DefaultTask; import org.gradle.api.file.RegularFileProperty; import org.gradle.api.provider.ListProperty; import org.gradle.api.tasks.InputFile; import org.gradle.api.tasks.Internal; import org.gradle.api.tasks.PathSensitive; import org.gradle.api.tasks.PathSensitivity; impor...
Add a mechanism for creating and deleting a bucket after a dataflow test.
package com.neverwinterdp.scribengin.dataflow.test; import com.beust.jcommander.Parameter; import com.beust.jcommander.ParametersDelegate; import com.neverwinterdp.scribengin.client.shell.ScribenginShell; import com.neverwinterdp.scribengin.storage.s3.S3Client; public class S3DataflowTest extends DataflowTest { @P...
package com.neverwinterdp.scribengin.dataflow.test; import com.beust.jcommander.Parameter; import com.beust.jcommander.ParametersDelegate; import com.neverwinterdp.scribengin.client.shell.ScribenginShell; import com.neverwinterdp.scribengin.storage.s3.S3Client; public class S3DataflowTest extends DataflowTest { @P...
Rename result file of a replay from `result.replay` to `replay.result`
package de.retest.recheck; import java.util.Set; import de.retest.ui.DefaultValueFinder; import de.retest.ui.descriptors.RootElement; /** * Interface to help recheck transform an arbitrary object into its internal format to allow persistence, state diffing * and ignoring of attributes and elements. */ public inte...
package de.retest.recheck; import java.util.Set; import de.retest.ui.DefaultValueFinder; import de.retest.ui.descriptors.RootElement; /** * Interface to help recheck transform an arbitrary object into its internal format to allow persistence, state diffing * and ignoring of attributes and elements. */ public inte...
Support for YouTube 2020 CSS changes
function main() { // Define video & thumbnail HTML element classes var videoClasses = '.html5-video-container'; var thumbnailClasses = '.yt-uix-simple-thumb-wrap, .yt-thumb img, .yt-img-shadow, .ytp-thumbnail-overlay, .pl-header-thumb'; // Add transition for the blur effect $(thumbnailClasses).css(...
function main() { // Define video & thumbnail HTML element classes var videoClasses = '.html5-video-container'; var thumbnailClasses = '.yt-uix-simple-thumb-wrap, .yt-thumb img, .ytp-thumbnail-overlay, .pl-header-thumb'; // Add transition for the blur effect $(thumbnailClasses).css('-webkit-transit...
Fix the wrong method because of a rename in the annotation
package info.u_team.u_team_core.integration; import org.apache.logging.log4j.*; import org.objectweb.asm.Type; import info.u_team.u_team_core.api.integration.*; import info.u_team.u_team_core.util.AnnotationUtil; import net.minecraftforge.fml.ModList; import net.minecraftforge.forgespi.language.ModFileScanData.Annota...
package info.u_team.u_team_core.integration; import org.apache.logging.log4j.*; import org.objectweb.asm.Type; import info.u_team.u_team_core.api.integration.*; import info.u_team.u_team_core.util.AnnotationUtil; import net.minecraftforge.fml.ModList; import net.minecraftforge.forgespi.language.ModFileScanData.Annota...
Add test for get products when no store is specified
<?php /** * @loadSharedFixture */ class SPM_ShopyMind_Test_Lib_ShopymindClient_Callback_Get_Products extends EcomDev_PHPUnit_Test_Case { public function testCanGetRandomProducts() { Mage::app()->setCurrentStore(1); $products = ShopymindClient_Callback::getProducts('store-1', false...
<?php /** * @loadSharedFixture */ class SPM_ShopyMind_Test_Lib_ShopymindClient_Callback_Get_Products extends EcomDev_PHPUnit_Test_Case { public function testCanGetRandomProducts() { Mage::app()->setCurrentStore(1); $products = ShopymindClient_Callback::getProducts('store-1', false...
Fix STATIC_URL (for Django 1.5 admin tests)
#!/usr/bin/env python import sys from os.path import abspath, dirname from django.conf import settings sys.path.insert(0, abspath(dirname(__file__))) if not settings.configured: settings.configure( ROOT_URLCONF='simple_history.tests.urls', STATIC_URL='/static/', INSTALLED_APPS=( ...
#!/usr/bin/env python import sys from os.path import abspath, dirname from django.conf import settings sys.path.insert(0, abspath(dirname(__file__))) if not settings.configured: settings.configure( ROOT_URLCONF='simple_history.tests.urls', INSTALLED_APPS=( 'django.contrib.contenttyp...
Add 'sent items' to default folder mapping
# Folder name mappings, based on http://tools.ietf.org/html/rfc6154 INBOX = 'inbox' DRAFTS = 'drafts' SPAM = 'spam' ARCHIVE = 'archive' SENT = 'sent' TRASH = 'trash' ALL = 'all' IMPORTANT = 'important' # Default mapping to unify various provider behaviors DEFAULT_FOLDER_MAPPING = { 'inbox': INBOX, 'drafts': D...
# Folder name mappings, based on http://tools.ietf.org/html/rfc6154 INBOX = 'inbox' DRAFTS = 'drafts' SPAM = 'spam' ARCHIVE = 'archive' SENT = 'sent' TRASH = 'trash' ALL = 'all' IMPORTANT = 'important' # Default mapping to unify various provider behaviors DEFAULT_FOLDER_MAPPING = { 'inbox': INBOX, 'drafts': D...
Use importlib.import_module instead of __import__.
import builtins import operator import functools import importlib from ..compile import varary builtins.__dict__.update({ # Runtime counterparts of some stuff in `Compiler.builtins`. '$': lambda f, *xs: f(*xs) , ':': lambda f, *xs: f(*xs) , ',': lambda a, *xs: (a,) + xs , '<': operator.lt , '<=': o...
import builtins import operator import functools from ..compile import varary builtins.__dict__.update({ # Runtime counterparts of some stuff in `Compiler.builtins`. '$': lambda f, *xs: f(*xs) , ':': lambda f, *xs: f(*xs) , ',': lambda a, *xs: (a,) + xs , '<': operator.lt , '<=': operator.le , '=...
Use testtools as test base class. On the path to testr migration, we need to replace the unittest base classes with testtools. Replace tearDown with addCleanup, addCleanup is more resilient than tearDown. The fixtures library has excellent support for managing and cleaning tempfiles. Use it. Replace skip_ with testtoo...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2011 OpenStack LLC. # All Rights Reserved. # # 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/...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2011 OpenStack LLC. # All Rights Reserved. # # 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/...
Add enabled flag as courtesy
/* * Copyright 2013-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by ap...
/* * Copyright 2013-2015 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by ap...
Put nbresuse js files in appropriate path How did this work before?
from glob import glob import setuptools setuptools.setup( name="nbresuse", version='0.2.0', url="https://github.com/yuvipanda/nbresuse", author="Yuvi Panda", description="Simple Jupyter extension to show how much resources (RAM) your notebook is using", packages=setuptools.find_packages(), ...
import setuptools setuptools.setup( name="nbresuse", version='0.2.0', url="https://github.com/yuvipanda/nbresuse", author="Yuvi Panda", description="Simple Jupyter extension to show how much resources (RAM) your notebook is using", packages=setuptools.find_packages(), install_requires=[ ...
Add cheat to the game
var LEDModule = require('./lib/modules/LEDModule'); var ModuleLoader = require('./lib/ModuleLoader'); var WebSocketServer = require('./lib/WebSocketServer'); var led = new LEDModule(); var server = new WebSocketServer(3000); var moduleLoader = new ModuleLoader({ Accelerometer: 'A', Ambient: 'C' }); /** * Triggers...
var LEDModule = require('./lib/modules/LEDModule'); var ModuleLoader = require('./lib/ModuleLoader'); var WebSocketServer = require('./lib/WebSocketServer'); var led = new LEDModule(); var server = new WebSocketServer(3000); var moduleLoader = new ModuleLoader({ Accelerometer: 'A', Ambient: 'C' }); /** * Triggers...
Order parents in Admin select field
from django.contrib import admin from .models import Page, PageRead, Tag class PageAdmin(admin.ModelAdmin): search_fields = ["title"] list_display = ["title", "parent", "updated"] prepopulated_fields = {"slug": ("title",)} readonly_fields = ["updated"] ordering = ["parent", "title"] filter_ho...
from django.contrib import admin from .models import Page, PageRead, Tag class PageAdmin(admin.ModelAdmin): search_fields = ["title"] list_display = ["title", "parent", "updated"] prepopulated_fields = {"slug": ("title",)} readonly_fields = ["updated"] ordering = ["parent", "title"] filter_ho...
Fix typo in FXML file name
package com.gitrekt.resort.controller; import java.net.URL; import java.util.ResourceBundle; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.Button; /** * FXML Controller class for reports home screen. */ public class ReportsHomeScreenController implements Initializable { ...
package com.gitrekt.resort.controller; import java.net.URL; import java.util.ResourceBundle; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.Button; /** * FXML Controller class for reports home screen. */ public class ReportsHomeScreenController implements Initializable { ...
SO-3379: Add text/csv media type constant
/* * Copyright 2011-2019 B2i Healthcare Pte Ltd, http://b2i.sg * * 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 require...
/* * Copyright 2011-2015 B2i Healthcare Pte Ltd, http://b2i.sg * * 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 require...
Test all functions in basic composition test, deliberately misorder them.
package sqlc import ( "reflect" "runtime" "strings" "testing" ) func TestBasicComposition(t *testing.T) { s := Statement{} // These statements are deliberately out of order s = s.Group("role").Order("id").Limit("30") s = s.Where("name = 'Marge'") s = s.Select("*").From("Employees") sql, args := s.ToSQL() ...
package sqlc import ( "reflect" "runtime" "strings" "testing" ) func TestBasicComposition(t *testing.T) { s := Statement{} s = s.Select("*").From("Employees").Where("name = 'Marge'").Order("id") sql, args := s.ToSQL() expect(t, args, make([]interface{}, 0)) expect(t, sql, strings.TrimSpace(` SELECT * FROM E...
Support mach3 style comments with parentheses.
/** * Parses a string of gcode instructions, and invokes handlers for * each type of command. * * Special handler: * 'default': Called if no other handler matches. */ function GCodeParser(handlers) { this.handlers = handlers || {}; } GCodeParser.prototype.parseLine = function(text, info) { text = text.repl...
/** * Parses a string of gcode instructions, and invokes handlers for * each type of command. * * Special handler: * 'default': Called if no other handler matches. */ function GCodeParser(handlers) { this.handlers = handlers || {}; } GCodeParser.prototype.parseLine = function(text, info) { text = text.repl...
Replace direct use of testtools BaseTestCase. Using the BaseTestCase across the tests in the tree lets us put in log fixtures and consistently handle mox and stubout. Part of blueprint grizzly-testtools. Change-Id: Iba7eb2c63b0c514009b2c28e5930b27726a147b0
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2011 OpenStack LLC. # All Rights Reserved. # # 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/...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2011 OpenStack LLC. # All Rights Reserved. # # 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/...
Hide dialog when leaving route
import Ember from "ember"; export default Ember.Component.extend({ didInsertElement: function() { // show the dialog this.$('.modal').modal('show'); // send the according action after it has been hidden again var _this = this; this.$('.modal').one('hidden.bs.modal', function() { Ember.run(...
import Ember from "ember"; export default Ember.Component.extend({ didInsertElement: function() { // show the dialog this.$('.modal').modal('show'); // send the according action after it has been hidden again var _this = this; this.$('.modal').one('hidden.bs.modal', function() { Ember.run(...
Add a test method to test wildcard matcher parsing
package org.monospark.spongematchers.type; import static org.hamcrest.CoreMatchers.not; import static org.junit.Assert.assertThat; import static org.monospark.spongematchers.testutil.HamcrestSpongeMatchers.matches; import org.junit.Test; import org.monospark.spongematchers.matcher.SpongeMatcher; import org.monospark....
package org.monospark.spongematchers.type; import static org.hamcrest.CoreMatchers.not; import static org.junit.Assert.assertThat; import static org.monospark.spongematchers.testutil.HamcrestSpongeMatchers.matches; import org.junit.Test; import org.monospark.spongematchers.matcher.SpongeMatcher; import org.monospark....
Use proper spinegar wrapper again.
<?php namespace BisonLab\SugarCrmBundle\Service; /* * Just a service object for the sugar7crm-wrapper class. */ class SugarWrapper { private $sugar; private $options; public function __construct($base_url, $username, $password) { $this->options = array('base_url' => $base_url, ...
<?php namespace BisonLab\SugarCrmBundle\Service; /* * Just a service object for the sugar7crm-wrapper class. */ class SugarWrapper { private $sugar; private $options; public function __construct($base_url, $username, $password) { $this->options = array('base_url' => $base_url, ...
Fix jogging with Y or Z axes inverted
# Copyright (c) 2020 Aldo Hoeben / fieldOfView # OctoPrintPlugin is released under the terms of the AGPLv3 or higher. from cura.PrinterOutput.GenericOutputController import GenericOutputController class OctoPrintOutputController(GenericOutputController): def __init__(self, output_device: "PrinterOutputDevice") ->...
# Copyright (c) 2020 Aldo Hoeben / fieldOfView # OctoPrintPlugin is released under the terms of the AGPLv3 or higher. from cura.PrinterOutput.GenericOutputController import GenericOutputController class OctoPrintOutputController(GenericOutputController): def __init__(self, output_device: "PrinterOutputDevice") ->...
Fix tests for image fallbacks
define([ 'client/preprocessors/visualisation_fallback', 'modernizr' ], function (visualisationFallback, Modernizr) { describe('Module actions', function () { var el; beforeEach(function () { el = $('<div class="visualisation-inner" data-src="spec/client/preprocessors/transparent.gif">original conte...
define([ 'client/preprocessors/visualisation_fallback' ], function (visualisationFallback) { describe('Module actions', function () { var originalModernizr = visualisationFallback.Modernizr; var el; beforeEach(function () { visualisationFallback.Modernizr = {}; el = $('<div class="visualis...
Fix fatal error from Imagick when creating email picture
<?php function createEmailPic($jid, $email) { $cachefile = DOCUMENT_ROOT.'/cache/'.$jid.'_email.png'; if(file_exists(DOCUMENT_ROOT.'/cache/'.$jid.'_email.png')) unlink(DOCUMENT_ROOT.'/cache/'.$jid.'_email.png'); $draw = new ImagickDraw(); try { $draw->setFontSize(13); $draw->...
<?php function createEmailPic($jid, $email) { $cachefile = DOCUMENT_ROOT.'/cache/'.$jid.'_email.png'; if(file_exists(DOCUMENT_ROOT.'/cache/'.$jid.'_email.png')) unlink(DOCUMENT_ROOT.'/cache/'.$jid.'_email.png'); $draw = new ImagickDraw(); $draw->setFontSize(13); $draw->setGravity(Imagick...
runCommand: Expand use for returning both exit code + content
# -*- coding: utf-8 -*- import sys from .processrunner import ProcessRunner from .writeout import writeOut def runCommand(command, outputPrefix="ProcessRunner> ", returnAllContent=False): """Easy invocation of a command with default IO streams returnAllContent as False (default): Args: command ...
# -*- coding: utf-8 -*- import sys from .processrunner import ProcessRunner from .writeout import writeOut def runCommand(command, outputPrefix="ProcessRunner> "): """Easy invocation of a command with default IO streams Args: command (list): List of strings to pass to subprocess.Popen Kwargs: ...
Add router and start server
package main import ( "github.com/gorilla/mux" "github.com/larzconwell/moln/config" "github.com/larzconwell/moln/loggers" "log" "net/http" "os" "path/filepath" ) func main() { env := "development" if len(os.Args) > 1 { env = os.Args[1] } conf, err := config.ReadFiles("config/environment.json", "config/"...
package main import ( "github.com/larzconwell/moln/config" "github.com/larzconwell/moln/loggers" "log" "os" "path/filepath" ) func main() { env := "development" if len(os.Args) > 1 { env = os.Args[1] } conf, err := config.ReadFiles("config/environment.json", "config/"+env+".json") if err != nil { log.F...
Refactor Armory API to use UnsignedTransaction class
import urlparse import os, sys, re, random,pybitcointools, bitcoinrpc, math from decimal import Decimal from flask import Flask, request, jsonify, abort, json, make_response from msc_apps import * tools_dir = os.environ.get('TOOLSDIR') lib_path = os.path.abspath(tools_dir) sys.path.append(lib_path) data_dir_root = os.e...
import urlparse import os, sys, re, random,pybitcointools, bitcoinrpc, math from decimal import Decimal from flask import Flask, request, jsonify, abort, json, make_response from msc_apps import * tools_dir = os.environ.get('TOOLSDIR') lib_path = os.path.abspath(tools_dir) sys.path.append(lib_path) data_dir_root = os.e...
Fix not on FX thread exception
package org.jabref; import org.jabref.gui.util.DefaultTaskExecutor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Catch and log any unhandled exceptions. */ public class FallbackExceptionHandler implements Thread.UncaughtExceptionHandler { private static final Logger LOGGER = LoggerFactory.ge...
package org.jabref; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Catch and log any unhandled exceptions. */ public class FallbackExceptionHandler implements Thread.UncaughtExceptionHandler { private static final Logger LOGGER = LoggerFactory.getLogger(FallbackExceptionHandler.class); pub...
Create all the subroutes and pass logOut to the DashNav
import React from 'react'; import { connect } from 'react-redux'; // actions import { logOut } from '../actions/login'; // Components import { Route, Redirect, Switch } from 'react-router'; import DashNav from '../components/dashboard/DashNav'; // Styles import '../styles/dashboard/index.css'; // SubContainers import ...
import React from 'react'; import { connect } from 'react-redux'; // Components import { Route, Redirect } from 'react-router'; import DashNav from '../components/dashboard/DashNav'; // Styles import '../styles/dashboard/index.css'; const DashboardContainer = (props) => { if(props.loggedIn){ return ( <div...
Add new field for about link
import DS from 'ember-data'; import OsfModel from 'ember-osf/models/osf-model'; export default OsfModel.extend({ name: DS.attr('fixstring'), logoPath: DS.attr('string'), bannerPath: DS.attr('string'), description: DS.attr('fixstring'), example: DS.attr('fixstring'), advisoryBoard: DS.attr('stri...
import DS from 'ember-data'; import OsfModel from 'ember-osf/models/osf-model'; export default OsfModel.extend({ name: DS.attr('fixstring'), logoPath: DS.attr('string'), bannerPath: DS.attr('string'), description: DS.attr('fixstring'), example: DS.attr('fixstring'), advisoryBoard: DS.attr('stri...
consentSimpleAdmin: Use new selftest-function on database backend.
<?php /** * * @param array &$hookinfo hookinfo */ function consentSimpleAdmin_hook_sanitycheck(&$hookinfo) { assert('is_array($hookinfo)'); assert('array_key_exists("errors", $hookinfo)'); assert('array_key_exists("info", $hookinfo)'); try { $consentconfig = SimpleSAML_Configuration::getConfig('module_consen...
<?php /** * * @param array &$hookinfo hookinfo */ function consentSimpleAdmin_hook_sanitycheck(&$hookinfo) { assert('is_array($hookinfo)'); assert('array_key_exists("errors", $hookinfo)'); assert('array_key_exists("info", $hookinfo)'); try { $consentconfig = SimpleSAML_Configuration::getConfig('module_consen...
Update case of autoload class
<?php namespace Joindin; require_once '../src/Joindin/Service/Autoload.php'; spl_autoload_register('Joindin\Service\Autoload::autoload'); session_cache_limiter(false); session_start(); ini_set('display_errors', 'on'); // include dependencies require '../vendor/Slim/Slim.php'; require '../vendor/TwigView.php'; // i...
<?php namespace Joindin; require_once '../src/Joindin/Service/Autoload.php'; spl_autoload_register('Joindin\Service\autoload::autoload'); session_cache_limiter(false); session_start(); ini_set('display_errors', 'on'); // include dependencies require '../vendor/Slim/Slim.php'; require '../vendor/TwigView.php'; // i...
Update range comments inches and centimeters
package org.firebears.sensors; // made by Jacob Wiggins import edu.wpi.first.wpilibj.AnalogInput; /* * Range Sensor */ public class sharpIRRange extends AnalogInput { public sharpIRRange(int channel) { super(channel); } //distance will be close to the distance that the robot is //assuming th...
package org.firebears.sensors; // made by Jacob Wiggins import edu.wpi.first.wpilibj.AnalogInput; /* * Range Sensor */ public class sharpIRRange extends AnalogInput { public sharpIRRange(int channel) { super(channel); } //distance will be close to the distance that the robot is //assuming th...
Read README as UTF-8, always
import os from setuptools import find_packages, setup with open(os.path.join(os.path.dirname(__file__), 'README.rst'), encoding='utf-8') as readme: README = readme.read() setup( name='django-postgres-extra', version='1.20', packages=find_packages(), include_package_data=True, license='MIT Lic...
import os from setuptools import find_packages, setup with open(os.path.join(os.path.dirname(__file__), 'README.rst')) as readme: README = readme.read() setup( name='django-postgres-extra', version='1.19', packages=find_packages(), include_package_data=True, license='MIT License', descrip...
Set up better merge method with default values
<?php namespace ThemeKeeper\DI; use Nette\DI\CompilerExtension; use ThemeKeeper\Theme\Theme; use UrlMatcher\Utils\Arrays; /** * Class ThemeKeeperExtension * * @author Lukáš Drahník (http://drahnik-lukas.com/) * @package ldrahnik\ThemeKeeper\DI */ class ThemeKeeperExtension extends CompilerExtension { private ...
<?php namespace ThemeKeeper\DI; use Nette\DI\CompilerExtension; use ThemeKeeper\Theme\Theme; use UrlMatcher\Utils\Arrays; /** * Class ThemeKeeperExtension * * @author Lukáš Drahník (http://drahnik-lukas.com/) * @package ldrahnik\ThemeKeeper\DI */ class ThemeKeeperExtension extends CompilerExtension { private ...
Handle Android RN 0.47 breaking change
package com.BV.LinearGradient; import com.facebook.react.ReactPackage; import com.facebook.react.bridge.JavaScriptModule; import com.facebook.react.bridge.NativeModule; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.uimanager.ViewManager; import java.util.Arrays; import java.util....
package com.BV.LinearGradient; import com.facebook.react.ReactPackage; import com.facebook.react.bridge.JavaScriptModule; import com.facebook.react.bridge.NativeModule; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.uimanager.ViewManager; import java.util.Arrays; import java.util....
chore(example): Move the location of the enhancer
import { createStore, combineReducers, applyMiddleware, compose } from 'redux' import { reducer as repoReducer } from './RepoRedux' import { reducer as logoReducer } from './LogoRedux' import { reducer as errorReducer } from './ErrorRedux' import { not, contains } from 'ramda' import { createLogger } from 'redux-logger...
import { createStore, combineReducers, applyMiddleware, compose } from 'redux' import { reducer as repoReducer } from './RepoRedux' import { reducer as logoReducer } from './LogoRedux' import { reducer as errorReducer } from './ErrorRedux' import { not, contains } from 'ramda' import { createLogger } from 'redux-logger...
Remove the prepended 0x returned from RPC.
var web3 = require('web3') var rm = require('web3/lib/web3/requestmanager') var web3api = function(provider) { this.requestmanager = rm.getInstance(); try { web3.setProvider(new web3.providers.HttpProvider(provider)); } catch(e) { console.error("Could not connect: %s", e); } } web3ap...
var web3 = require('web3') var rm = require('web3/lib/web3/requestmanager') var web3api = function(provider) { this.requestmanager = rm.getInstance(); try { web3.setProvider(new web3.providers.HttpProvider(provider)); } catch(e) { console.error("Could not connect: %s", e); } } web3ap...
Make jacobian use more explicit.
# -*- coding: utf-8 -*- """ Created on Wed Sep 23 15:23:58 2015 @author: jensv """ import skin_core_scanner_simple as scss reload(scss) import equil_solver as es reload(es) import newcomb_simple as new reload(new) (lambda_a_mesh, k_a_mesh, stability_maps) = scss.scan_lambda_k_space([0.01, 3.0, 25.], [0.01, 1.5, 25]...
# -*- coding: utf-8 -*- """ Created on Wed Sep 23 15:23:58 2015 @author: jensv """ import skin_core_scanner_simple as scss reload(scss) import equil_solver as es reload(es) import newcomb_simple as new reload(new) (lambda_a_mesh, k_a_mesh, stability_maps) = scss.scan_lambda_k_space([0.01, 3.0, 25.], [0.01, 1.5, 25]...
Fix build failure with pip
#!/usr/bin/env python3 """ Dispatch your torrents into multiple watchdirs See: https://github.com/Anthony25/torrents_dispatcher """ from os import path from setuptools import setup here = path.abspath(path.dirname(__file__)) setup( name="torrents_dispatcher", version="0.0.1", description="Dispatch ...
#!/usr/bin/env python3 """ Dispatch your torrents into multiple watchdirs See: https://github.com/Anthony25/torrents_dispatcher """ from os import path from setuptools import setup here = path.abspath(path.dirname(__file__)) # Get the long description from the README file with open(path.join(here, "README.mkd")...
Update to use Buffer.alloc in place of deprecated new Buffer()
function isBrowser() { return typeof window !== 'undefined'; } function isNode() { return typeof window === 'undefined'; } function nodeBufferToArrayBuffer(buffer) { const ab = new ArrayBuffer(buffer.length); const view = new Uint8Array(ab); for (let i = 0; i < buffer.length; ++i) { view[i...
function isBrowser() { return typeof window !== 'undefined'; } function isNode() { return typeof window === 'undefined'; } function nodeBufferToArrayBuffer(buffer) { const ab = new ArrayBuffer(buffer.length); const view = new Uint8Array(ab); for (let i = 0; i < buffer.length; ++i) { view[i...
Comment mxtoolbox because of limited requests
from functools import reduce import pprint import time import shodan import requests import api_key from google_api import query_google_api from shodan_api import query_shodan_api from mxtoolbox_api import query_mxtoolbox_api from utils import assoc_default_score, combine_scores pp = pprint.PrettyPrinter(indent=2) ...
from functools import reduce import pprint import time import shodan import requests import api_key from google_api import query_google_api from shodan_api import query_shodan_api from mxtoolbox_api import query_mxtoolbox_api from utils import assoc_default_score, combine_scores pp = pprint.PrettyPrinter(indent=2) ...
Add helper to check instance and subclass
""" Helpers ======= """ import inspect from collections import Mapping, Iterable def is_generator(obj): """Return True if ``obj`` is a generator """ return inspect.isgeneratorfunction(obj) or inspect.isgenerator(obj) def is_iterable_but_not_string(obj): """Return True if ``obj`` is an iterable objec...
""" Helpers ======= """ import inspect from collections import Mapping, Iterable def is_generator(obj): """Return True if ``obj`` is a generator """ return inspect.isgeneratorfunction(obj) or inspect.isgenerator(obj) def is_iterable_but_not_string(obj): """Return True if ``obj`` is an iterable objec...
Add seperate key log handler
"""Run a server that takes all GET requests and dumps them.""" from flask import Flask, request, send_from_directory from flask_cors import CORS from w3lib.html import replace_entities app = Flask(__name__) CORS(app) @app.route('/') def route(): """Get all GET and POST requests and dump them to logs.""" # ...
"""Run a server that takes all GET requests and dumps them.""" from flask import Flask, request, send_from_directory from flask_cors import CORS from w3lib.html import replace_entities app = Flask(__name__) CORS(app) @app.route('/') def route(): """Get all GET and POST requests and dump them to logs.""" # ...
Add more documentation. Fix the expand_directory function
import os def expand_directory(directory_path): """Recursively create a list of all the files in a directory and its subdirectories """ ret = [] for file_path in os.listdir(directory_path): if os.path.isfile(os.path.join(directory_path, file_path)): # Append instead of extend or +=...
import os def expand_directory(directory_path): ret = [] for file_path in os.listdir(directory_path): if os.path.isfile(os.path.join(directory_path, file_path)): # Append instead of extend or += because those separate the string into its individual characters # This has to do w...
Set default value of order in Quotation
<?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateQuotationsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('quotations',...
<?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateQuotationsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('quotations',...
Clean string returned by website => remove newline-characters and strip
import re from bs4 import BeautifulSoup import cfscrape def nplstatus(): scraper = cfscrape.create_scraper() data = scraper.get('http://npl.teamspeakusa.com/ts3npl.php').content soup = BeautifulSoup(data, 'html.parser') raw_status = soup.find_all(class_='register_linklabel')[2].span return not r...
import re from bs4 import BeautifulSoup import cfscrape def nplstatus(): scraper = cfscrape.create_scraper() data = scraper.get('http://npl.teamspeakusa.com/ts3npl.php').content soup = BeautifulSoup(data, 'html.parser') raw_status = soup.find_all(class_='register_linklabel')[2].span return not r...
Move Settings to addCheck config syntax
<?hh class SettingsController extends BaseController { public static function getPath(): string { return '/settings'; } public static function getConfig(): ControllerConfig { return (new ControllerConfig())->addCheck( Auth::requireRoles(Vector {UserRole::Superuser}), ); } public static fu...
<?hh class SettingsController extends BaseController { public static function getPath(): string { return '/settings'; } public static function getConfig(): ControllerConfig { return (new ControllerConfig())->setUserRoles(Vector {UserRole::Superuser}); } public static function get(): :xhp { ...
Fix FoUC visibility style order - Body visibility visible order is not correct in react & vue, it is now fixed by appending visibility hidden to the top of the nodes.
import { applyPolyfills, defineCustomElements as dce } from '../loader'; export { defineCustomElements, addTheme }; function defineCustomElements() { fixFouc(); return applyPolyfills().then(() => dce(window)); } function addTheme(_theme) { const { store, actions, storeReady } = window.CorporateUi || {}; if...
import { applyPolyfills, defineCustomElements as dce } from '../loader'; export { defineCustomElements, addTheme }; function defineCustomElements() { fixFouc(); return applyPolyfills().then(() => dce(window)); } function addTheme(_theme) { const { store, actions, storeReady } = window.CorporateUi || {}; if...
Order taxons with hierarchy in mind.
<?php /* * This file is part of the Sylius package. * * (c) Paweł Jędrzejewski * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Sylius\Bundle\TaxonomiesBundle\Doctrine\ORM; use Sylius\Bundle\ResourceBundle\Doctrine\ORM\...
<?php /* * This file is part of the Sylius package. * * (c) Paweł Jędrzejewski * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Sylius\Bundle\TaxonomiesBundle\Doctrine\ORM; use Sylius\Bundle\ResourceBundle\Doctrine\ORM\...
Use the custom.js as served from the CDN for try
#!/usr/bin/env python # -*- coding: utf-8 -*- # Configuration file for ipython-notebook. c = get_config() c.NotebookApp.ip = '*' c.NotebookApp.open_browser = False c.NotebookApp.port = 8888 # Whether to trust or not X-Scheme/X-Forwarded-Proto and X-Real-Ip/X-Forwarded- # For headerssent by the upstream reverse proxy...
#!/usr/bin/env python # -*- coding: utf-8 -*- # Configuration file for ipython-notebook. c = get_config() c.NotebookApp.ip = '*' c.NotebookApp.open_browser = False c.NotebookApp.port = 8888 # Whether to trust or not X-Scheme/X-Forwarded-Proto and X-Real-Ip/X-Forwarded- # For headerssent by the upstream reverse proxy...
Fix safe handling of old buttons
'use strict' var botQueryHandler = require('./storage/replyQuery'); var tg = require('./telegram/telegramAPI'); var replyQuery = require('./storage/replyQuery'); var lfm = require('./lfmController') botQueryHandler.answer = function (query, queryData) { botQueryHandler[queryData.method](query, queryData); }; bot...
'use strict' var botQueryHandler = require('./storage/replyQuery'); var tg = require('./telegram/telegramAPI'); var replyQuery = require('./storage/replyQuery'); var lfm = require('./lfmController') botQueryHandler.answer = function (query, queryData) { botQueryHandler[queryData.method](query, queryData); }; bot...
Remove creating variables and just show function call results.
package mccli import ( "fmt" "github.com/codegangsta/cli" "github.com/materials-commons/config" "github.com/materials-commons/mcstore/server/mcstore" ) var ShowCommand = cli.Command{ Name: "show", Aliases: []string{"sh"}, Usage: "Show commands", Subcommands: []cli.Command{ showConfigCommand, }, } va...
package mccli import ( "fmt" "github.com/codegangsta/cli" "github.com/materials-commons/config" "github.com/materials-commons/mcstore/server/mcstore" ) var ShowCommand = cli.Command{ Name: "show", Aliases: []string{"sh"}, Usage: "Show commands", Subcommands: []cli.Command{ showConfigCommand, }, } va...
Print error message before exiting in main() Amends 42af9a9985ec5409f7773d9daf9f8a68df291228
import sys from .config import RawConfig from .exc import RunCommandsError from .run import run, partition_argv, read_run_args_from_file from .util import printer def main(argv=None): try: all_argv, run_argv, command_argv = partition_argv(argv) cli_args = run.parse_args(RawConfig(debug=False), ru...
import sys from .config import RawConfig from .exc import RunCommandsError from .run import run, partition_argv, read_run_args_from_file def main(argv=None): try: all_argv, run_argv, command_argv = partition_argv(argv) cli_args = run.parse_args(RawConfig(debug=False), run_argv) run_args =...
Use io.open for Python 2 compatibility.
#!/usr/bin/env python # Generated by jaraco.develop (https://bitbucket.org/jaraco/jaraco.develop) import io import setuptools with io.open('README.txt', encoding='utf-8') as readme: long_description = readme.read() with io.open('CHANGES.txt', encoding='utf-8') as changes: long_description += '\n\n' + changes.read()...
#!/usr/bin/env python # Generated by jaraco.develop (https://bitbucket.org/jaraco/jaraco.develop) import setuptools with open('README.txt', encoding='utf-8') as readme: long_description = readme.read() with open('CHANGES.txt', encoding='utf-8') as changes: long_description += '\n\n' + changes.read() setup_params = ...
Remove deprecated Logger usage in Analytics Change-Id: I66165a76f3a8a47af8473555c6280450835a75c2
/* * Copyright Google Inc. All Rights Reserved. * * 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 l...
/* * Copyright Google Inc. All Rights Reserved. * * 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 l...
Add missing libapol rolequery import.
"""The SETools SELinux policy analysis library.""" # Copyright 2014, Tresys Technology, LLC # # This file is part of SETools. # # SETools is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation, either version 2...
"""The SETools SELinux policy analysis library.""" # Copyright 2014, Tresys Technology, LLC # # This file is part of SETools. # # SETools is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation, either version 2...
Send events to be prevented by default
import React, { PropTypes, Component } from 'react'; export default function (WrappedComponent) { class KeyStrokeSupport extends Component { static propTypes = { cancel: PropTypes.func.isRequired, submit: PropTypes.func.isRequired }; constructor (props) { super(props); this.hand...
import React, { PropTypes, Component } from 'react'; export default function (WrappedComponent) { class KeyStrokeSupport extends Component { static propTypes = { cancel: PropTypes.func.isRequired, submit: PropTypes.func.isRequired }; constructor (props) { super(props); this.hand...
Fix the CLI minor bug
#!/usr/bin/env node const jsdotmd = require('../lib') const program = require('commander') const path = require('path') program .usage('[options] <source> <destination>') .option( '-l, --langCodes <items>', 'List of language codes that are compiled into the destination, separated by commas. Default: js,ja...
#!/usr/bin/env node const jsdotmd = require('../lib') const program = require('commander') const path = require('path') program .usage('[options] <source> <destination') .option( '-l, --langCodes <items>', 'List of language codes that are compiled into the destination, separated by commas. Default: js,jav...
Add function for adding domains
'use strict'; module.exports = function(app) { app.controller('dataController', [ '$scope', 'HttpService', '$http', '$cookies', function($scope, HttpService, $http, $cookies) { $http.defaults.headers.common.jwt = $cookies.jwt; $scope.selectedDomain = false; var domainService = new HttpService('d...
'use strict'; module.exports = function(app) { app.controller('dataController', [ '$scope', 'HttpService', '$http', '$cookies', function($scope, HttpService, $http, $cookies) { $http.defaults.headers.common.jwt = $cookies.jwt; $scope.selectedDomain = false; var domainService = new HttpService('d...
Fix range slider merged values tooltip
import React, { forwardRef, useLayoutEffect } from 'react' import PropTypes from 'prop-types' import styles from './styles.module.scss' const MergedValues = forwardRef(({ handles, ...props }, ref) => { const values = handles.map(el => el.value).filter(value => isFinite(value)) const percent = handles.reduce((acc,...
import React, { forwardRef, useLayoutEffect } from 'react' import PropTypes from 'prop-types' import styles from './styles.module.scss' const MergedValues = forwardRef(({ handles, ...props }, ref) => { const values = handles.map(el => el.value).filter(value => isFinite(value)) const percent = handles.reduce((acc,...
Use native streams in sitemap
// Collect urls to include in sitemap // 'use strict'; const stream = require('stream'); module.exports = function (N, apiPath) { N.wire.on(apiPath, function get_users_sitemap(data) { let user_stream = new stream.Transform({ objectMode: true, transform(user, encoding, callback) { this.p...
// Collect urls to include in sitemap // 'use strict'; const pumpify = require('pumpify'); const through2 = require('through2'); module.exports = function (N, apiPath) { N.wire.on(apiPath, function get_users_sitemap(data) { let stream = pumpify.obj( N.models.users.User.collection ...
Fix the engine's APM plugin and add some documentation.
from collections import Counter class APMTracker(object): """ Builds ``player.aps`` and ``player.apm`` dictionaries where an action is any Selection, Hotkey, or Ability event. Also provides ``player.avg_apm`` which is defined as the sum of all the above actions divided by the number of seconds pla...
from collections import Counter class APMTracker(object): def handleInitGame(self, event, replay): for player in replay.players: player.apm = Counter() player.aps = Counter() player.seconds_played = replay.length.seconds def handlePlayerActionEvent(self, event, rep...
Add comment telling where to get updated geoip database
from __future__ import unicode_literals, print_function, division import pygeoip import os.path import sys import socket # http://dev.maxmind.com/geoip/legacy/geolite/ DATAFILE = os.path.join(sys.path[0], "GeoIP.dat") # STANDARD = reload from disk # MEMORY_CACHE = load to memory # MMAP_CACHE = memory using mmap gi4 =...
from __future__ import unicode_literals, print_function, division import pygeoip import os.path import sys import socket DATAFILE = os.path.join(sys.path[0], "GeoIP.dat") # STANDARD = reload from disk # MEMORY_CACHE = load to memory # MMAP_CACHE = memory using mmap gi4 = pygeoip.GeoIP(DATAFILE, pygeoip.MEMORY_CACHE) ...
Use a better function (lambda) name git-svn-id: b0ea89ea3bf41df64b6a046736e217d0ae4a0fba@40 806ff5bb-693f-0410-b502-81bc3482ff28
#!/usr/bin/env python # # Copyright 2007 Neal Norwitz # Portions Copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
#!/usr/bin/env python # # Copyright 2007 Neal Norwitz # Portions Copyright 2007 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0...
[Telemetry] Raise robohornetpro timeout. Is it timing out on cros. BUG=266129 Review URL: https://chromiumcodereview.appspot.com/21297004 git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@214925 0039d316-1c4b-4281-b951-d872f2087c98
# Copyright (c) 2012 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. """Runs Microsoft's RoboHornet Pro benchmark.""" import os from telemetry import test from telemetry.core import util from telemetry.page import page_m...
# Copyright (c) 2012 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. """Runs Microsoft's RoboHornet Pro benchmark.""" import os from telemetry import test from telemetry.core import util from telemetry.page import page_m...
Use url path instead of full url for threads
var Vue = require('vue'); var CommentService = require('./services/comment-service.js'); var template = require('./list.html'); new Vue({ el: '#platon-comment-thread', render: template.render, staticRenderFns: template.staticRenderFns, data: { loading: true, comments: [] }, ...
var Vue = require('vue'); var CommentService = require('./services/comment-service.js'); var template = require('./list.html'); new Vue({ el: '#platon-comment-thread', render: template.render, staticRenderFns: template.staticRenderFns, data: { loading: true, comments: [] }, ...
Correct the hash tag test
<?php if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) { print "This script must be run from the command line\n"; exit(); } define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); define('LACONICA', true); require_once INSTALLDIR . '/lib/common.php'; class HashTagDetectionTest extends...
<?php if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) { print "This script must be run from the command line\n"; exit(); } define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); define('LACONICA', true); require_once INSTALLDIR . '/lib/common.php'; class HashTagDetectionTest extends...
Add process.env inside plugins to react understand that we are at production env
var debug = process.env.NODE_ENV !== "production"; var webpack = require('webpack'); var path = require('path'); module.exports = { context: path.join(__dirname, "src"), devtool: debug ? "inline-sourcemap" : null, entry: "./js/app.js", module: { loaders: [ { test: /\.jsx?$/, exclude: ...
var debug = process.env.NODE_ENV !== "production"; var webpack = require('webpack'); var path = require('path'); module.exports = { context: path.join(__dirname, "src"), devtool: debug ? "inline-sourcemap" : null, entry: "./js/app.js", module: { loaders: [ { test: /\.jsx?$/, exclude: ...
Remove accidentally added UserGreeting from example app.
from flask import Flask, render_template from flask_nav import Nav from flask_nav.elements import * nav = Nav() # registers the "top" menubar nav.register_element('top', Navbar( View('Widgits, Inc.', 'index'), View('Our Mission', 'about'), Subgroup( 'Products', View('Wg240-Series', 'produ...
from flask import Flask, render_template from flask_nav import Nav from flask_nav.elements import * nav = Nav() class UserGreeting(Text): def __init__(self): pass @property def text(self): return 'Hello, {}'.format('bob') # registers the "top" menubar nav.register_element('top', Navbar...
Fix inviting others to private messages.
/** The controls at the top of a private message in the map area. @class PrivateMessageMapComponent @extends Ember.Component @namespace Discourse @module Discourse **/ Discourse.PrivateMessageMapComponent = Ember.View.extend({ templateName: 'components/private-message-map', tagName: 'section', classNam...
/** The controls at the top of a private message in the map area. @class PrivateMessageMapComponent @extends Ember.Component @namespace Discourse @module Discourse **/ Discourse.PrivateMessageMapComponent = Ember.View.extend({ templateName: 'components/private-message-map', tagName: 'section', classNam...
Mark gdal tests as requiring internet
""" Test gdal plugin functionality. """ import pytest from imageio.testing import run_tests_if_main, get_test_dir, need_internet import imageio from imageio.core import get_remote_file test_dir = get_test_dir() try: from osgeo import gdal except ImportError: gdal = None @pytest.mark.skipif('gdal is None')...
""" Test gdal plugin functionality. """ import pytest from imageio.testing import run_tests_if_main, get_test_dir import imageio from imageio.core import get_remote_file test_dir = get_test_dir() try: from osgeo import gdal except ImportError: gdal = None @pytest.mark.skipif('gdal is None') def test_gdal_...
Use more go-like error messages
package main import ( "bytes" "encoding/json" "errors" "fmt" "io/ioutil" "log" "os" "path/filepath" "strings" ) type Commands map[string]string func getCommands() (Commands, error) { var commands Commands jsonStream, err := ioutil.ReadFile("./commands.json") if err != nil { return command...
package main import ( "bytes" "encoding/json" "errors" "fmt" "io/ioutil" "log" "os" "path/filepath" "strings" ) type Commands map[string]string func getCommands() (Commands, error) { var commands Commands jsonStream, err := ioutil.ReadFile("./commands.json") if err != nil { return command...
Remove inline opacity style after transition complete (This was causing the raw tag editor to sometimes *not* display for fallback presets like "point", "line", "area")
// toggles the visibility of ui elements, using a combination of the // hide class, which sets display=none, and a d3 transition for opacity. // this will cause blinking when called repeatedly, so check that the // value actually changes between calls. iD.ui.Toggle = function(show, callback) { return function(selec...
// toggles the visibility of ui elements, using a combination of the // hide class, which sets display=none, and a d3 transition for opacity. // this will cause blinking when called repeatedly, so check that the // value actually changes between calls. iD.ui.Toggle = function(show, callback) { return function(selec...
feat(back): Add mapping to angular routes
const path = require('path'); const express = require('express'); const router = express.Router(); const log = require('../logger'); const wordsRepository = new (require("../repositories/word.repository"))(); router.get('/', (req, res) => { wordsRepository.getRandomWords(6) .then(words => { res.render("ind...
const path = require('path'); const express = require('express'); const router = express.Router(); const log = require('../logger'); const wordsRepository = new (require("../repositories/word.repository"))(); router.get('/', (req, res) => { wordsRepository.getRandomWords(6) .then(words => { res.render("ind...
Fix formatting bug in repr
#!/usr/bin/env python import six import numpy as np import pandas as pd class TimeSlice(object): """ A slice of time: has a start time, a duration, and a reference to an Audio object. """ def __init__(self, time, duration, audio, unit='s'): self.time = pd.to_timedelta(time, unit=unit) ...
#!/usr/bin/env python import six import numpy as np import pandas as pd class TimeSlice(object): """ A slice of time: has a start time, a duration, and a reference to an Audio object. """ def __init__(self, time, duration, audio, unit='s'): self.time = pd.to_timedelta(time, unit=unit) ...
Remove fatal error in workers
package main import ( "fmt" "time" "sync" ) var wg sync.WaitGroup func worker(id int, jobs <-chan int, results chan<- int) { for j := range jobs { if j == -1 { wg.Done() break } fmt.Println("worker", id, "processing job", j) time.Sleep(time.Second) results <- j * 2 } } func printer(results <-ch...
package main import ( "fmt" "time" "sync" ) var wg sync.WaitGroup func worker(id int, jobs <-chan int, results chan<- int) { for j := range jobs { if j == -1 { wg.Done() return } fmt.Println("worker", id, "processing job", j) time.Sleep(time.Second) results <- j * 2 } } func printer(results <-c...
Modify block colors for greater contrast
import _merge from 'lodash/merge' import moment from 'moment' let today = moment().format('YYYY-MM-DD') export default { loading: true, schedule: {}, // Restore saved preferences to over default lunches and classes lunches: _merge({ 'Monday': 1, 'Tuesday': 1, 'Wednesday': 1, 'Thursday': 1, 'Friday': 1 }, ...
import _merge from 'lodash/merge' import moment from 'moment' let today = moment().format('YYYY-MM-DD') export default { loading: true, schedule: {}, // Restore saved preferences to over default lunches and classes lunches: _merge({ 'Monday': 1, 'Tuesday': 1, 'Wednesday': 1, 'Thursday': 1, 'Friday': 1 }, ...
Fix encoding error happening on some Windows servers Fix error causing: “UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d”
from setuptools import setup def readme(): with open('README.rst', 'rb') as f: return f.read().decode('UTF-8') setup(name='housecanary', version='0.6.2', description='Client Wrapper for the HouseCanary API', long_description=readme(), url='http://github.com/housecanary/hc-api-pyth...
from setuptools import setup def readme(): with open('README.rst') as f: return f.read() setup(name='housecanary', version='0.6.2', description='Client Wrapper for the HouseCanary API', long_description=readme(), url='http://github.com/housecanary/hc-api-python', author='Hou...
Fix too long line issue
'use strict'; var Node = require('../node'); var dot = require('dot'); var TYPE = 'weighted-centroid'; var PARAMS = { source : Node.PARAM.NODE(Node.GEOMETRY.POINT), weight_column : Node.PARAM.STRING, category_column : Node.PARAM.STRING }; var WeightedCentroid = Node.create(TYPE, PARAMS, {cache: true});...
'use strict'; var Node = require('../node'); var dot = require('dot'); var TYPE = 'weighted-centroid'; var PARAMS = { source : Node.PARAM.NODE(Node.GEOMETRY.POINT), weight_column : Node.PARAM.STRING, category_column : Node.PARAM.STRING }; var WeightedCentroid = Node.create(TYPE, PARAMS, {cache: true});...
Use material-ui Table for module table
import React, { PropTypes } from 'react'; import { Table, TableBody, TableRow, TableRowColumn } from 'material-ui/Table'; const ModuleTable = ({ modules, removeModule, }) => ( <Table selectable={false} style={{ tableLayout: 'auto' }} > <TableBody displayRowCheckbox={false} > {module...
import React, { PropTypes } from 'react'; const ModuleTable = ({ modules, removeModule, }) => ( <table className="table table-bordered"> <tbody> {modules.map(module => <tr key={module.ModuleCode}> <td>{module.ModuleCode}</td> <td>{module.ModuleTitle}</td> <td> ...
Fix study actions order on the toolbar
package com.jetbrains.edu.learning; import com.intellij.openapi.actionSystem.DefaultActionGroup; import com.intellij.openapi.project.Project; import com.jetbrains.edu.courseFormat.Course; import org.jetbrains.annotations.NotNull; public class PyStudyToolWindowConfigurator extends StudyBaseToolWindowConfigurator { ...
package com.jetbrains.edu.learning; import com.intellij.openapi.actionSystem.DefaultActionGroup; import com.intellij.openapi.project.Project; import com.jetbrains.edu.courseFormat.Course; import org.jetbrains.annotations.NotNull; public class PyStudyToolWindowConfigurator extends StudyBaseToolWindowConfigurator { ...
Add resolved debug and rtl values to plugin The Lazy Way ©
'use strict' var postcss = require('postcss') var defined = require('defined') var noop = postcss.plugin('noop', function () { return function (css) {} }) module.exports = postcss.plugin('@emilbayes/css-pipeline', function (options) { options = options || {} var rtl = defined(options.rtl, process.env.RTL == tr...
'use strict' var postcss = require('postcss') var defined = require('defined') var noop = postcss.plugin('noop', function () { return function (css) {} }) module.exports = postcss.plugin('@emilbayes/css-pipeline', function (options) { options = options || {} var rtl = defined(options.rtl, process.env.RTL == tr...
Add match error msg pattern like "<file>:<line>: syntax error" This error msg is available in iverilog 0.10.0 (devel).
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Jack Cherng # https://github.com/jfcherng/SublimeLinter-contrib-iverilog # Copyright (c) 2015 jfcherng # # License: MIT # import sublime from SublimeLinter.lint import Linter, util class Iverilog(Linter): # lin...
# # linter.py # Linter for SublimeLinter3, a code checking framework for Sublime Text 3 # # Written by Jack Cherng # Copyright (c) 2015 jfcherng # https://github.com/jfcherng/SublimeLinter-contrib-iverilog # # License: MIT # import sublime from SublimeLinter.lint import Linter, util class Iverilog(Linter): # lin...
[REFACTOR] Remove "final" keyword on getItems and getDefaultId methods in dynamic list services.
<?php /** * event_ListAvailablemodelsService * @package modules.event.lib.services */ class event_ListAvailablemodelsService extends BaseService implements list_ListItemsService { /** * @var event_ListAvailablemodelsService */ private static $instance; /** * @return event_ListAvailablemodelsService */ p...
<?php /** * event_ListAvailablemodelsService * @package modules.event.lib.services */ class event_ListAvailablemodelsService extends BaseService implements list_ListItemsService { /** * @var event_ListAvailablemodelsService */ private static $instance; /** * @return event_ListAvailablemodelsService */ p...
Use streams instead of strings for the response when reading.
<?php namespace h4cc\StackFlysystem\Handler; use DateTime; use h4cc\StackFlysystem\HandlerInterface; use League\Flysystem\Filesystem; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\StreamedResponse; class Reader implements HandlerInterface { private $filesystem; public fu...
<?php namespace h4cc\StackFlysystem\Handler; use h4cc\StackFlysystem\HandlerInterface; use League\Flysystem\Filesystem; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; class Reader implements HandlerInterface { private $filesystem; public function __construct(Fil...
Fix test case to work with newest version of datastax java driver
package com.pardot.rhombus.functional; import static org.junit.Assert.*; import com.datastax.driver.core.exceptions.InvalidConfigurationInQueryException; import com.datastax.driver.core.exceptions.InvalidQueryException; import com.pardot.rhombus.helpers.TestHelpers; import org.junit.Test; import com.datastax.driver....
package com.pardot.rhombus.functional; import static org.junit.Assert.*; import com.datastax.driver.core.exceptions.InvalidConfigurationInQueryException; import com.pardot.rhombus.helpers.TestHelpers; import org.junit.Test; import com.datastax.driver.core.Session; import com.pardot.rhombus.ConnectionManager; impor...
Use jsonpointer instead of my own terrible Reference class.
import json import jsonpointer class Schema(dict): """ Lightweight encapsulation of a JSON Schema. """ @classmethod def from_file(cls, path_or_stream): """ Create a schema from a file name or stream. """ if hasattr(path_or_stream, 'read'): return cls(jso...
import json class Schema(dict): """ Lightweight encapsulation of a JSON Schema. """ @classmethod def from_file(cls, path_or_stream): """ Create a schema from a file name or stream. """ if hasattr(path_or_stream, 'read'): return cls(json.load(path_or_stre...
Fix byte swap for Explicit VR Big Endian (retired)
/* eslint no-bitwise: 0 */ function swap16 (val) { return ((val & 0xFF) << 8) | ((val >> 8) & 0xFF); } function decodeBigEndian (imageFrame, pixelData) { if (imageFrame.bitsAllocated === 16) { let arrayBuffer = pixelData.buffer; let offset = pixelData.byteOffset; const length = pixelData.length; ...
/* eslint no-bitwise: 0 */ function swap16 (val) { return ((val & 0xFF) << 8) | ((val >> 8) & 0xFF); } function decodeBigEndian (imageFrame, pixelData) { if (imageFrame.bitsAllocated === 16) { let arrayBuffer = pixelData.buffer; let offset = pixelData.byteOffset; const length = pixelData.length; ...
Fix `httpFileSystemLoader.Open` to not crash on nil The reason is that in certain cases (mainly in development) this loader might be configured with an empty file system – it accepts an interface so passing nil just works. If `Open` is called it shouldn’t crash.
package httpfs import ( "io" "net/http" "os" "github.com/CloudyKit/jet" ) type httpFileSystemLoader struct { fs http.FileSystem } // NewLoader returns an initialized loader serving the passed http.FileSystem. func NewLoader(fs http.FileSystem) jet.Loader { return &httpFileSystemLoader{fs: fs} } // Open opens...
package httpfs import ( "io" "net/http" "os" "github.com/CloudyKit/jet" ) type httpFileSystemLoader struct { fs http.FileSystem } // NewLoader returns an initialized loader serving the passed http.FileSystem. func NewLoader(fs http.FileSystem) jet.Loader { return &httpFileSystemLoader{fs: fs} } // Open opens...
Add regex rule for repeater selector
var utilConfig = { regexList : [ { type : "attr", attrName : "ng-model", match : /[b|B]y\.model\(\s*['|"](.*?)['|"]\s*\)/gi }, { type : "attr", attrName : "ng-repeat", match : /[b|B]y\.repeater\(\s*['|"](.*?)['|"]\s*\)/gi }, { type : "cssAttr", match : /[b|B]y\.css\(['|"]\[(.+=.+)...
var utilConfig = { regexList : [ { type : "attr", attrName : "ng-model", match : /[b|B]y\.model\(\s*['|"](.*?)['|"]\s*\)/gi }, { type : "attr", attrName : "ng-repeat", match : /[b|B]y\.repeater\(\s*['|"](.*?)['|"]\s*\)/gi }, { type : "cssAttr", match : /[b|B]y\.css\(['|"]\[(.+=.+)...
Add preview images cache clearing
<?php namespace Craft; class WistiaPlugin extends BasePlugin { public function getName() { return 'Wistia'; } public function getDescription() { return 'Manage videos and output data using the Wistia API.'; } public function getVersion() { return '0.1.5'; } public function getDeveloper() { return...
<?php namespace Craft; class WistiaPlugin extends BasePlugin { public function getName() { return 'Wistia'; } public function getDescription() { return 'Manage videos and output data using the Wistia API.'; } public function getVersion() { return '0.1.5'; } public function getDeveloper() { return...
Add more 2 indexes to cache to improve invalidation speed
""" Setup for the API """ import api log = api.logger.use(__name__) def index_mongo(): """ Ensure the mongo collections are indexed. """ db = api.common.get_conn() log.debug("Ensuring mongo is indexed.") db.users.ensure_index("uid", unique=True, name="unique uid") db.users.ensure_inde...
""" Setup for the API """ import api log = api.logger.use(__name__) def index_mongo(): """ Ensure the mongo collections are indexed. """ db = api.common.get_conn() log.debug("Ensuring mongo is indexed.") db.users.ensure_index("uid", unique=True, name="unique uid") db.users.ensure_inde...
Use string template in place of concatenation (STRIPES-100)
import React from 'react'; import Route from 'react-router-dom/Route'; import { connectFor } from '@folio/stripes-connect'; import { modules } from 'stripes-loader'; // eslint-disable-line import AddContext from './AddContext'; if (!Array.isArray(modules.app) && modules.length < 0) { throw new Error('At least one mo...
import React from 'react'; import Route from 'react-router-dom/Route'; import { connectFor } from '@folio/stripes-connect'; import { modules } from 'stripes-loader'; // eslint-disable-line import AddContext from './AddContext'; if (!Array.isArray(modules.app) && modules.length < 0) { throw new Error('At least one mo...
Add last version of Google Java Format to supported versions
package com.github.sherter.googlejavaformatgradleplugin.format; import com.google.common.collect.ImmutableList; /** Static factory method for creating new {@link Formatter}s. */ public class Gjf { public static final String GROUP_ID = "com.google.googlejavaformat"; public static final String ARTIFACT_ID = "googl...
package com.github.sherter.googlejavaformatgradleplugin.format; import com.google.common.collect.ImmutableList; /** Static factory method for creating new {@link Formatter}s. */ public class Gjf { public static final String GROUP_ID = "com.google.googlejavaformat"; public static final String ARTIFACT_ID = "googl...
Reorganize jsdoc, add @method tag
define(function () { "use strict"; var Edge = function (nodes) { this.setNodes(nodes); }; Edge.prototype.setNodes = function (nodes) { this._nodes = nodes; return this; }; Edge.prototype.getNodes = function () { return this._nodes; }; Edge.prototype.ad...
define(function () { "use strict"; var Edge = function (nodes) { this.setNodes(nodes); }; Edge.prototype.setNodes = function (nodes) { this._nodes = nodes; return this; }; Edge.prototype.getNodes = function () { return this._nodes; }; Edge.prototype.ad...
Reset incubation logger with deprecation logger
/* * Copyright 2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applica...
/* * Copyright 2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applica...
Fix FC name pattern for NextSeq2000
"""Filesystem utilities.""" import contextlib import os import shutil RUN_RE = '^\d{6}_[a-zA-Z\d\-]+_\d{2,}_[AB0][A-Z\d\-]+$' @contextlib.contextmanager def chdir(new_dir): """Context manager to temporarily change to a new directory.""" cur_dir = os.getcwd() os.chdir(new_dir) try: yield fi...
"""Filesystem utilities.""" import contextlib import os import shutil RUN_RE = '^\d{6}_[a-zA-Z\d\-]+_\d{4}_[AB0][A-Z\d\-]+$' @contextlib.contextmanager def chdir(new_dir): """Context manager to temporarily change to a new directory.""" cur_dir = os.getcwd() os.chdir(new_dir) try: yield fin...