text
stringlengths
16
4.96k
positive
stringlengths
321
2.24k
negative
stringlengths
310
2.21k
Fix an issue where the sort function weren't included in the fkit module.
'use strict'; var util = require('./util'); /** * FKit treats both arrays and strings as *lists*: an array is a list of * elements, and a string is a list of characters. * * Representing strings as lists may be a novel concept for some JavaScript * users, but it is quite common in other languages. This seemingly...
'use strict'; var util = require('./util'); /** * FKit treats both arrays and strings as *lists*: an array is a list of * elements, and a string is a list of characters. * * Representing strings as lists may be a novel concept for some JavaScript * users, but it is quite common in other languages. This seemingly...
Check warningCount as well as errorCount http://eslint.org/docs/developer-guide/nodejs-api#executeonfiles "The errorCount and warningCount give the exact number of errors and warnings respectively on the given file."
'use strict'; const colors = require('ansicolors'); const pluralize = require('pluralize'); const CLIEngine = require('eslint').CLIEngine; class ESLinter { constructor(brunchConfig) { this.config = (brunchConfig && brunchConfig.plugins && brunchConfig.plugins.eslint) || {}; this.warnOnly = (this.config.warn...
'use strict'; const colors = require('ansicolors'); const pluralize = require('pluralize'); const CLIEngine = require('eslint').CLIEngine; class ESLinter { constructor(brunchConfig) { this.config = (brunchConfig && brunchConfig.plugins && brunchConfig.plugins.eslint) || {}; this.warnOnly = (this.config.warn...
Remove user from db connection string
# -*- coding: utf-8 -*- from flask import Flask import os import psycopg2 from contextlib import closing DB_SCHEMA = """ DROP TABLE IF EXISTS entries; CREATE TABLE entries ( id serial PRIMARY KEY, title VARCHAR (127) NOT NULL, text TEXT NOT NULL, created TIMESTAMP NOT NULL ) """ app = Flask(__name__) ...
# -*- coding: utf-8 -*- from flask import Flask import os import psycopg2 from contextlib import closing DB_SCHEMA = """ DROP TABLE IF EXISTS entries; CREATE TABLE entries ( id serial PRIMARY KEY, title VARCHAR (127) NOT NULL, text TEXT NOT NULL, created TIMESTAMP NOT NULL ) """ app = Flask(__name__) ...
Change tabular to 4 spaces
#!/usr/bin/env node "use strict"; const moment = require("moment"); const sugar = require("sugar"); const chalk = require("chalk"); const exec = require("child_process").exec; process.argv.splice(0, 2); if (process.argv.length > 0) { // Attempt to parse the date let date = process.argv.join(" "); let parsedDa...
#!/usr/bin/env node "use strict"; const moment = require("moment"); const sugar = require("sugar"); const chalk = require("chalk"); const exec = require("child_process").exec; process.argv.splice(0, 2); if (process.argv.length > 0) { // Attempt to parse the date let date = process.argv.join(" "); let parsedDa...
[fix] Check for lack of host header.
var union = require('union'), ecstatic = require('ecstatic'); var port = process.env.PORT || 8080; // // ### redirect(res) // World's simplest redirect function // function redirect(res) { var url = 'http://2015.empirenode.org', body = '<p>301. Redirecting to <a href="' + url + '">' + url + '</a></p>'...
var union = require('union'), ecstatic = require('ecstatic'); var port = process.env.PORT || 8080; // // ### redirect(res) // World's simplest redirect function // function redirect(res) { var url = 'http://2015.empirenode.org', body = '<p>301. Redirecting to <a href="' + url + '">' + url + '</a></p>'...
Fix a problem where else rendering is messed up when an if is inside an if
/* * JBoss, Home of Professional Open Source. * Copyright 2014 Red Hat, Inc., and individual contributors * as indicated by the @author tags. * * 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 Licen...
/* * JBoss, Home of Professional Open Source. * Copyright 2014 Red Hat, Inc., and individual contributors * as indicated by the @author tags. * * 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 Licen...
Allow to override kwargs of filter
from django.views import generic class FilteredListView(generic.ListView): """List view with support for filtering and sorting via django-filter. Usage: Set filter_set to your django_filters.FilterSet definition. Use view.filter.form in the template to access the filter form. Note: ...
from django.views import generic class FilteredListView(generic.ListView): """List view with support for filtering and sorting via django-filter. Usage: Set filter_set to your django_filters.FilterSet definition. Use view.filter.form in the template to access the filter form. Note: ...
Optimize production builds by passing in NODE_ENV React contains a lot of debugging machinery that is being run throughout development. This should always be stripped out in production in order to make the application more performant. The most simple way to do this is with the built-in Webpack EnvironmentPlugin that w...
var path = require('path'); var webpack = require('webpack'); module.exports = { context: __dirname + "/src", entry: "./jsx/main.jsx", output: { path: path.join(__dirname, 'build'), filename: 'js/app.js' }, resolve: { extensions: ['', '.js', '.jsx'], modulesDirectories: ["src/jsx", "node_modu...
var path = require('path'); module.exports = { context: __dirname + "/src", entry: "./jsx/main.jsx", output: { path: path.join(__dirname, 'build'), filename: 'js/app.js' }, resolve: { extensions: ['', '.js', '.jsx'], modulesDirectories: ["src/jsx", "node_modules"] }, module: { loaders...
Check number of arguments instead of val existence
var extend = require('extend'); var Plom = function(options) { this.options = options || {}; this.data = this.options.data || {}; } Plom.extend = function(object) { var NewPlom = function(options) { this.options = options || {}; this.data = this.options.data || {}; if(this.initialize) { this...
var extend = require('extend'); var Plom = function(options) { this.options = options || {}; this.data = this.options.data || {}; } Plom.extend = function(object) { var NewPlom = function(options) { this.options = options || {}; this.data = this.options.data || {}; if(this.initialize) { this...
Set the RBAC role hierarchy to 10 levels by default.
// Copyright 2017 The casbin Authors. 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 a...
// Copyright 2017 The casbin Authors. 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 a...
Remove print statements for syncdb receivers
from django.db.models.signals import post_syncdb from django.conf import settings from accounts import models def ensure_core_accounts_exists(sender, **kwargs): create_source_account() create_sales_account() create_expired_account() def create_sales_account(): name = getattr(settings, 'ACCOUNTS_SAL...
from django.db.models.signals import post_syncdb from django.conf import settings from accounts import models def ensure_core_accounts_exists(sender, **kwargs): create_source_account() create_sales_account() create_expired_account() def create_sales_account(): name = getattr(settings, 'ACCOUNTS_SAL...
Sort the staff by their order attr
<?php defined('C5_EXECUTE') or die("Access Denied."); Loader::model('user_list'); $av = Loader::helper('concrete/avatar'); $ul = new UserList(); $ul->filterByGroup('Staff'); $ul->sortBy('ak_order','asc'); $content = $controller->getContent(); print $content; ?> <ul class="ccm-staff-list"> <?php foreach($ul->get(100)...
<?php defined('C5_EXECUTE') or die("Access Denied."); Loader::model('user_list'); $av = Loader::helper('concrete/avatar'); $ul = new UserList(); $ul->filterByGroup('Staff'); $ul->sortBy('uName'); $content = $controller->getContent(); print $content; ?> <ul class="ccm-staff-list"> <?php foreach($ul->get(100) as $staf...
Docs: Update createInstance documentation to be more clear Former-commit-id: c79279a20551c2cac39e2b2d74a8941914b62d98 Former-commit-id: 935f0112079632ec2940db2ca281707f2007815f
<?php namespace Concrete\Core\Foundation\Service; use \Concrete\Core\Application\Application; class ProviderList { public function __construct(Application $app) { $this->app = $app; } /** * Loads and registers a class ServiceProvider class. * @param string $class * @return void */ public function regi...
<?php namespace Concrete\Core\Foundation\Service; use \Concrete\Core\Application\Application; class ProviderList { public function __construct(Application $app) { $this->app = $app; } /** * Loads and registers a class ServiceProvider class. * @param string $class * @return void */ public function regi...
Set minimum query length to 10 nts The shortest length that the nhmmer alphabet guesser will work on is 10.
""" Copyright [2009-2014] EMBL-European Bioinformatics Institute Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or a...
""" Copyright [2009-2014] EMBL-European Bioinformatics Institute Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or a...
Switch to example to localhost uppy-server
import { Core, Dummy, Dashboard, GoogleDrive, Webcam, Tus10, MetaData, Informer } from '../src/index.js' // import ru_RU from '../src/locales/ru_RU.js' // import MagicLog from '../src/plugins/MagicLog' const uppy = new Core({debug: true, autoProceed: fals...
import { Core, Dummy, Dashboard, GoogleDrive, Webcam, Tus10, MetaData, Informer } from '../src/index.js' // import ru_RU from '../src/locales/ru_RU.js' // import MagicLog from '../src/plugins/MagicLog' const uppy = new Core({debug: true, autoProceed: fals...
Include test for invalid input
<?php namespace Zend\Romans\View\Helper; use PHPUnit\Framework\TestCase; use Zend\View\Helper\HelperInterface; /** * Roman Test */ class RomanTest extends TestCase { /** * {@inheritdoc} */ protected function setUp() { $this->helper = new Roman(); } /** * Test Instance Of...
<?php namespace Zend\Romans\View\Helper; use PHPUnit\Framework\TestCase; use Zend\View\Helper\HelperInterface; /** * Roman Test */ class RomanTest extends TestCase { /** * {@inheritdoc} */ protected function setUp() { $this->helper = new Roman(); } /** * Test Instance Of...
Add documentation for 8ball command
# Copyright (c) 2013-2014 Molly White # # Permission is hereby granted, free of charge, to any person obtaining a copy of this software # and associated documentation files (the "Software"), to deal in the Software without # restriction, including without limitation the rights to use, copy, modify, merge, publish, # di...
# Copyright (c) 2013-2014 Molly White # # Permission is hereby granted, free of charge, to any person obtaining a copy of this software # and associated documentation files (the "Software"), to deal in the Software without # restriction, including without limitation the rights to use, copy, modify, merge, publish, # di...
Fix a possible deadlock in unit tests after an error Summary: After certain types of errors, we may deadlock when trying to destroy test databases. Specifically, we still have connections open to, say, `phabricator_unittest_abasonaknlbaklnasb_herald` (or whatever) and MySQL sometimes (not sure exactly when?) waits fo...
<?php /** * Used by unit tests to build storage fixtures. */ final class PhabricatorStorageFixtureScopeGuard extends Phobject { private $name; public function __construct($name) { $this->name = $name; execx( 'php %s upgrade --force --no-adjust --namespace %s', $this->getStorageBinPath(), ...
<?php /** * Used by unit tests to build storage fixtures. */ final class PhabricatorStorageFixtureScopeGuard extends Phobject { private $name; public function __construct($name) { $this->name = $name; execx( 'php %s upgrade --force --no-adjust --namespace %s', $this->getStorageBinPath(), ...
Reformat and correct keyPress call
package com.opera.core.systems; import java.util.ArrayList; import java.util.List; import org.junit.Test; import com.opera.core.systems.scope.protos.SystemInputProtos.ModifierPressed; public class QuickWidgetTest extends DesktopTestBase { @Test public void testSomething() { driver.waitStart(); List<Mod...
package com.opera.core.systems; import java.util.List; import org.junit.Test; import com.opera.core.systems.scope.protos.SystemInputProtos.ModifierPressed; public class QuickWidgetTest extends DesktopTestBase { @Test public void testSomething(){ driver.waitStart(); // driver.operaDesktopAction("...
Throw ValidationError for invalid form, drop get_query_form()
from rest_framework.exceptions import ValidationError class ModelSerializerMixin(object): """Provides generic model serializer classes to views.""" model_serializer_class = None def get_serializer_class(self): if self.serializer_class: return self.serializer_class class Defaul...
class ModelSerializerMixin(object): """Provides generic model serializer classes to views.""" model_serializer_class = None def get_serializer_class(self): if self.serializer_class: return self.serializer_class class DefaultSerializer(self.model_serializer_class): cl...
Fix assert.match integration test helper
/** * Copyright 2012-2013 Amazon.com, Inc. or its affiliates. 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. A copy of * the License is located at * * http://aws.amazon.com/apache2.0/ * * or in the ...
/** * Copyright 2012-2013 Amazon.com, Inc. or its affiliates. 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. A copy of * the License is located at * * http://aws.amazon.com/apache2.0/ * * or in the ...
Switch to Double DQN as the default algorithm.
"""Configuration data for training or evaluating a reinforcement learning agent. """ import agents def get_config(): config = { 'game': 'BreakoutDeterministic-v3', 'agent_type': agents.DoubleDeepQLearner, 'history_length': 4, 'training_steps': 50000000, 'training_freq': 4, ...
"""Configuration data for training or evaluating a reinforcement learning agent. """ import agents def get_config(): config = { 'game': 'BreakoutDeterministic-v3', 'agent_type': agents.DeepQLearner, 'history_length': 4, 'training_steps': 50000000, 'training_freq': 4, ...
Update URL, need to set dev version on GitHub.
""" Flask-Script -------------- Flask support for writing external scripts. Links ````` * `documentation <http://packages.python.org/Flask-Script>`_ """ from setuptools import setup setup( name='Flask-Script', version='0.3.2', url='http://github.com/rduplain/flask-script', license='BSD', auth...
""" Flask-Script -------------- Flask support for writing external scripts. Links ````` * `documentation <http://packages.python.org/Flask-Script>`_ * `development version <http://bitbucket.org/danjac/flask-Script/get/tip.gz#egg=Flask-Script-dev>`_ """ from setuptools import setup setup( name='Flask-Script...
Add use strict to stub controller
"use strict"; let db = require('./db.js'), express = require('express'), router = express.Router(); function convertBase62ToId(base62) { let chars = base62.split(''); return chars.reduce(function(sum, char) { if (/[0-9]/.test(char)) return sum += parseInt(char); else if (/[a-z]/.test(char)) ...
let db = require('./db.js'), express = require('express'), router = express.Router(); function convertBase62ToId(base62) { let chars = base62.split(''); return chars.reduce(function(sum, char) { if (/[0-9]/.test(char)) return sum += parseInt(char); else if (/[a-z]/.test(char)) return su...
Remove ES6 template strings for node 0.10+ compatibility
var assert = require('chai').assert; var fun = require('../lib/utils').stripStackOverflow; describe('stripStackOverflow', function() { it('should not strip -f parameters in the title', function () { var title = 'monitoring - How does the "tail" command\'s "-f" parameter ...'; assert.equal(fun(title...
var assert = require('chai').assert; var fun = require('../lib/utils').stripStackOverflow; describe('stripStackOverflow', function() { it('should not strip -f parameters in the title', function () { var title = `monitoring - How does the "tail" command's "-f" parameter ...`; assert.equal(fun(title)...
Set package version to 0.4.2
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Alignak REST backend """ # Application manifest VERSION = (0, 4, 2) __application__ = u"Alignak_Backend" __version__ = '.'.join((str(each) for each in VERSION[:4])) __author__ = u"Alignak team" __copyright__ = u"(c) 2015 - %s" % __author__ __license__ = u"GNU Affero ...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Alignak REST backend """ # Application manifest VERSION = (0, 4, 1) __application__ = u"Alignak_Backend" __version__ = '.'.join((str(each) for each in VERSION[:4])) __author__ = u"Alignak team" __copyright__ = u"(c) 2015 - %s" % __author__ __license__ = u"GNU Affero ...
Fix parameter syntax in CreateReleation modified: lib/create_relation.js
'use strict'; var U = require('lodash'); var DynamoDB = require('./dynamodb'); function CreateRelation() {} module.exports = CreateRelation; CreateRelation.create = function createCreateRelation(spec) { var obj = new CreateRelation(); return obj.initialize(spec); }; U.extend(CreateRelation.prototype, { initializ...
'use strict'; var U = require('lodash'); var DynamoDB = require('./dynamodb'); function CreateRelation() {} module.exports = CreateRelation; CreateRelation.create = function createCreateRelation(spec) { var obj = new CreateRelation(); return obj.initialize(spec); }; U.extend(CreateRelation.prototype, { initializ...
Update socket URL for production use.
var socket = io('http://was.geht.im.hackspace.siegen.so:13374'); var elems = document.getElementsByClassName("status"); socket.on('status', function (data) { console.log(data); for (var i = 0; i < elems.length; i++) { var elem = elems[i]; var key = elem.getAttribute("data-key"); var unit = elem....
var socket = io('http://localhost:13374'); var elems = document.getElementsByClassName("status"); socket.on('status', function (data) { console.log(data); for (var i = 0; i < elems.length; i++) { var elem = elems[i]; var key = elem.getAttribute("data-key"); var unit = elem.getAttribute("data-uni...
Add Content-Length header to Aphront file responses. Summary: Provide a Content-Length header so that browsers can estimate time remaining for file downloads. Test Plan: Tested on our local phabricator install. Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.ph...
<?php /** * @group aphront */ final class AphrontFileResponse extends AphrontResponse { private $content; private $mimeType; private $download; public function setDownload($download) { $download = preg_replace('/[^A-Za-z0-9_.-]/', '_', $download); if (!strlen($download)) { $download = 'untitl...
<?php /** * @group aphront */ final class AphrontFileResponse extends AphrontResponse { private $content; private $mimeType; private $download; public function setDownload($download) { $download = preg_replace('/[^A-Za-z0-9_.-]/', '_', $download); if (!strlen($download)) { $download = 'untitl...
Fix comment for bucket deletion
// Copyright 2010-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. // Licensed under the Apache-2.0 License on an "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND. // ABOUT THIS NODE.JS SAMPLE: This sample is part of the SDK for JavaScript Developer Guide topic at // https://docs.aws.amazon.com/sdk-for-ja...
// Copyright 2010-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. // Licensed under the Apache-2.0 License on an "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND. // ABOUT THIS NODE.JS SAMPLE: This sample is part of the SDK for JavaScript Developer Guide topic at // https://docs.aws.amazon.com/sdk-for-ja...
Update clusterconfig-provider binary to use logrusx.JSONFormatter
package main import ( "time" log "github.com/Sirupsen/logrus" logx "github.com/cerana/cerana/pkg/logrusx" "github.com/cerana/cerana/provider" "github.com/cerana/cerana/providers/clusterconf" flag "github.com/spf13/pflag" ) func main() { log.SetFormatter(&logx.JSONFormatter{}) config := clusterconf.NewConfig...
package main import ( "time" log "github.com/Sirupsen/logrus" logx "github.com/cerana/cerana/pkg/logrusx" "github.com/cerana/cerana/provider" "github.com/cerana/cerana/providers/clusterconf" flag "github.com/spf13/pflag" ) func main() { log.SetFormatter(&logx.MistifyFormatter{}) config := clusterconf.NewCon...
Add a register method for plugins
package io.github.Cnly.BusyInv.BusyInv; import io.github.Cnly.BusyInv.BusyInv.listeners.BusyListener; import org.bukkit.Bukkit; import org.bukkit.event.HandlerList; import org.bukkit.plugin.java.JavaPlugin; public class BusyInv extends JavaPlugin { private static BusyInv instance; @Override pub...
package io.github.Cnly.BusyInv.BusyInv; import io.github.Cnly.BusyInv.BusyInv.listeners.BusyListener; import org.bukkit.Bukkit; import org.bukkit.event.HandlerList; import org.bukkit.plugin.java.JavaPlugin; public class BusyInv extends JavaPlugin { private static BusyInv instance; @Override pub...
Fix mostUrgentSubject query to not use r.row in subquery
var r = require('rethinkdb'); // Number of seconds after which Reddit will archive an article // (180 days): https://github.com/reddit/reddit/commit/b7b24d2e9fa06ba37ea78e0275dce86d95158e64 var archiveLimit = 180 * 24 * 60 * 60; exports.mostUrgentSubject = r.table('subjects') .between(r.now().sub(archiveLimit),r.no...
var r = require('rethinkdb'); // Number of seconds after which Reddit will archive an article // (180 days): https://github.com/reddit/reddit/commit/b7b24d2e9fa06ba37ea78e0275dce86d95158e64 var archiveLimit = 180 * 24 * 60 * 60; exports.mostUrgentSubject = r.table('subjects') .between(r.now().sub(archiveLimit),r.no...
Add the ability to specify a tag
// MIT license, see: https://github.com/tjcrowder/simple-snippets-console/blob/master/LICENSE var snippet = { version: "1.1", // Writes out the given text in a monospaced paragraph tag, escaping // & and < so they aren't rendered as HTML. log: function(msg, tag) { var elm = document.createEleme...
// MIT license, see: https://github.com/tjcrowder/simple-snippets-console/blob/master/LICENSE var snippet = { version: "1.0", // Writes out the given text in a monospaced paragraph tag, escaping // & and < so they aren't rendered as HTML. log: function(msg) { if (Object.prototype.toString.call(...
Remove agenda view from calendar
import React from 'react'; import BigCalendar from 'react-big-calendar'; import moment from 'moment'; import 'react-big-calendar/lib/css/react-big-calendar.css' BigCalendar.setLocalizer( BigCalendar.momentLocalizer(moment) ); // TODO take in events as props let Calendar = React.createClass({ render(){ console...
import React from 'react'; import BigCalendar from 'react-big-calendar'; import moment from 'moment'; import 'react-big-calendar/lib/css/react-big-calendar.css' BigCalendar.setLocalizer( BigCalendar.momentLocalizer(moment) ); // TODO take in events as props let Calendar = React.createClass({ render(){ console...
Allow whitespace after multiline code open dash
<?php namespace Phug\Lexer\Scanner; use Phug\Lexer\ScannerInterface; use Phug\Lexer\State; use Phug\Lexer\Token\CodeToken; use Phug\Lexer\Token\TextToken; class CodeScanner implements ScannerInterface { public function scan(State $state) { $reader = $state->getReader(); if (!$reader->match('...
<?php namespace Phug\Lexer\Scanner; use Phug\Lexer\ScannerInterface; use Phug\Lexer\State; use Phug\Lexer\Token\CodeToken; use Phug\Lexer\Token\TextToken; class CodeScanner implements ScannerInterface { public function scan(State $state) { $reader = $state->getReader(); if (!$reader->peekCha...
Fix division by zero is not possible
<?php namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; class Category extends Model { use HasFactory; protected $table = 'categories'; protected $fillable = [ 'label', 'parent_category_id', 'budgeted', 'user_id', ]; public function ge...
<?php namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; class Category extends Model { use HasFactory; protected $table = 'categories'; protected $fillable = [ 'label', 'parent_category_id', 'budgeted', 'user_id', ]; public function ge...
Add int detection to interpreting results
#!/usr/bin/env python # -*- coding: utf-8 -*- try: from setuptools import setup except ImportError: from distutils.core import setup with open('README.rst') as readme_file: readme = readme_file.read() with open('HISTORY.rst') as history_file: history = history_file.read().replace('.. :changelog:', ...
#!/usr/bin/env python # -*- coding: utf-8 -*- try: from setuptools import setup except ImportError: from distutils.core import setup with open('README.rst') as readme_file: readme = readme_file.read() with open('HISTORY.rst') as history_file: history = history_file.read().replace('.. :changelog:', ...
Add method to access an element of save-button
(function(app) { 'use strict'; var jCore = require('jcore'); var helper = app.helper || require('../helper.js'); var dom = app.dom || require('../dom.js'); var SidebarToggleButton = app.SidebarToggleButton || require('./sidebar-toggle-button.js'); var ContentHeader = helper.inherits(function(props) { ...
(function(app) { 'use strict'; var jCore = require('jcore'); var helper = app.helper || require('../helper.js'); var dom = app.dom || require('../dom.js'); var SidebarToggleButton = app.SidebarToggleButton || require('./sidebar-toggle-button.js'); var ContentHeader = helper.inherits(function(props) { ...
Add function bind for iOS
(function() { window.PointerEventShim = { clone: function(inSink, inSource) { var p$ = [].slice.call(arguments, 1); for (var i=0, p; p=p$[i]; i++) { if (p) { var g, s; for (var n in p) { //inSink[n] = p[n]; /* fixme: sigh, copy getters/setters */ ...
(function() { window.PointerEventShim = { clone: function(inSink, inSource) { var p$ = [].slice.call(arguments, 1); for (var i=0, p; p=p$[i]; i++) { if (p) { var g, s; for (var n in p) { //inSink[n] = p[n]; /* fixme: sigh, copy getters/setters */ ...
Fix typo in orm transformer
<?php namespace FOQ\ElasticaBundle\Doctrine\ORM; use FOQ\ElasticaBundle\Doctrine\AbstractElasticaToModelTransformer; use Elastica_Document; use Doctrine\ORM\Query; /** * Maps Elastica documents with Doctrine objects * This mapper assumes an exact match between * elastica documents ids and doctrine object ids */ ...
<?php namespace FOQ\ElasticaBundle\Doctrine\ORM; use FOQ\ElasticaBundle\Doctrine\AbstractElasticaToModelTransformer; use Elastica_Document; use Doctrine\ORM\Query; /** * Maps Elastica documents with Doctrine objects * This mapper assumes an exact match between * elastica documents ids and doctrine object ids */ ...
Use Query struct for searchString method
package main import ( "bytes" "fmt" "log" "net/http" "strings" ) const baseURL = "https://api.github.com/search/repositories" type Query struct { Q string Lang string Limit int } func escapeSearch(s string) string { return strings.Replace(s, " ", "+", -1) } func searchString(q Query) string { var buffer ...
package main import ( "bytes" "fmt" "log" "net/http" "strings" ) const baseURL = "https://api.github.com/search/repositories" func escapeSearch(s string) string { return strings.Replace(s, " ", "+", -1) } func searchString(q string, lang string, limit int) string { var buffer bytes.Buffer buffer.WriteString...
Use property instead of name for meta tags
<?php if ($content_type = Controller::$view->mime_type): ?> <?php if (!empty(Controller::$view->charset)) { $content_type .= ';charset=' . Controller::$view->charset; } ?> <meta http-equiv="Content-Type" content="<?php echo $content_type ?>"> <?php endif; ?> <?php if ($author = Backend::getConfig('applicat...
<?php if ($content_type = Controller::$view->mime_type): ?> <?php if (!empty(Controller::$view->charset)) { $content_type .= ';charset=' . Controller::$view->charset; } ?> <meta http-equiv="Content-Type" content="<?php echo $content_type ?>"> <?php endif; ?> <?php if ($author = Backend::getConfig('applicat...
Set up reading lines from file, print count for testing purposes
import sqlite3 as sql import os import sys import logging import benchmark # bmVerify(['final_r7', 'final_r8'], filepath="/home/ysun/disambig/newcode/all/", outdir = "/home/ayu/results_v2/") # Text Files txt_file = 'benchmark_errors.txt' opened_file = open(txt_file, 'U') log_file = 'benchmark_results.log' #...
import sqlite3 as sql import os import sys import logging import benchmark # bmVerify(['final_r7', 'final_r8'], filepath="/home/ysun/disambig/newcode/all/", outdir = "/home/ayu/results_v2/") # Text Files txt_file = 'benchmark_errors.txt' opened_file = open(txt_file, 'U') log_file = 'benchmark_results.log' #...
Add missing return of Event methods
class Event: def __init__(self, bot, data): self.bot = bot self.data = data def post_message(self, text, channel=None): if channel is None: channel = self.data['channel'] return self.bot.post_message(text, channel) def add_reaction(self, emoji, channel=None, times...
class Event: def __init__(self, bot, data): self.bot = bot self.data = data def post_message(self, text, channel=None): if channel is None: channel = self.data['channel'] self.bot.post_message(text, channel) def add_reaction(self, emoji, channel=None, timestamp=No...
Add description to the table and populate it with two categories
"""create category table Revision ID: 47dd43c1491 Revises: 27bf0aefa49d Create Date: 2013-05-21 10:41:43.548449 """ # revision identifiers, used by Alembic. revision = '47dd43c1491' down_revision = '27bf0aefa49d' from alembic import op import sqlalchemy as sa import datetime def make_timestamp(): now = dateti...
"""create category table Revision ID: 47dd43c1491 Revises: 27bf0aefa49d Create Date: 2013-05-21 10:41:43.548449 """ # revision identifiers, used by Alembic. revision = '47dd43c1491' down_revision = '27bf0aefa49d' from alembic import op import sqlalchemy as sa import datetime def make_timestamp(): now = dateti...
Add default argument when looking up sentry dsn setting
import os import logging from django.conf import settings log = logging.getLogger(__name__) def static(request): "Shorthand static URLs. In debug mode, the JavaScript is not minified." static_url = settings.STATIC_URL prefix = 'src' if settings.DEBUG else 'min' return { 'CSS_URL': os.path.joi...
import os import logging from django.conf import settings log = logging.getLogger(__name__) def static(request): "Shorthand static URLs. In debug mode, the JavaScript is not minified." static_url = settings.STATIC_URL prefix = 'src' if settings.DEBUG else 'min' return { 'CSS_URL': os.path.join...
Update offline bat cache after adding a bat
package peergos.server; import peergos.server.storage.auth.*; import peergos.shared.storage.auth.*; import peergos.shared.util.*; import java.util.*; import java.util.concurrent.*; public class OfflineBatCache implements BatCave { private final BatCave target; private final BatCache cache; public Offli...
package peergos.server; import peergos.server.storage.auth.*; import peergos.shared.storage.auth.*; import peergos.shared.util.*; import java.util.*; import java.util.concurrent.*; public class OfflineBatCache implements BatCave { private final BatCave target; private final BatCache cache; public Offli...
Add Zend_Log Test - Logging to a database (reformatting)
<?php class LogTest extends PHPUnit_Framework_TestCase { public function testDbLogger() { $databaseAdapter = Zend_Db::factory( 'PDO_SQLITE', array( 'dbname' => dirname(__FILE__) . '/../../../data/test.sqlite' ) ); $databaseTableName = ...
<?php class LogTest extends PHPUnit_Framework_TestCase { public function testDbLogger() { $log = new Zend_Log(); $dbWriter = new Zend_Log_Writer_Db( Zend_Db::factory( 'PDO_SQLITE', array( 'dbname' => dirname(__FILE__) . '/../../../...
Set no-op entries as tombstones.
/* * Copyright 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 applicable l...
/* * Copyright 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 applicable l...
Revert "Revert "Revert "I don't know what changed""" This reverts commit 9831a5f3e60457ac87b1b4a83000b0aee5a027b8.
<?php get_template_part('templates/head'); ?> <body <?php body_class(); ?>> <!--[if lt IE 8]> <div class="alert alert-warning"> <?php _e('You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.', 'roots'); ?> </di...
<?php get_template_part('templates/head'); ?> <body <?php body_class(); ?>> <!--[if lt IE 8]> <div class="alert alert-warning"> <?php _e('You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.', 'roots'); ?> </di...
Revert "[GH-4308] Temporary disable all tests with extensions" This reverts commit 0cbe0a7152891c4bd0e846a7c76bebcf47ab8cec.
package io.syndesis.qe; import com.codeborne.selenide.Configuration; import cucumber.api.CucumberOptions; import cucumber.api.junit.Cucumber; import org.junit.BeforeClass; import org.junit.runner.RunWith; @RunWith(Cucumber.class) @CucumberOptions( features = "classpath:features", tags = {"not @wip", "...
package io.syndesis.qe; import org.junit.BeforeClass; import org.junit.runner.RunWith; import com.codeborne.selenide.Configuration; import cucumber.api.CucumberOptions; import cucumber.api.junit.Cucumber; @RunWith(Cucumber.class) @CucumberOptions( features = "classpath:features", tags = {"not @wip",...
Add example commands for the Systeminfo api Currently the api documentation does not include example commands. It would be very friendly for our users to have some example commands to follow and use the api. This patch adds examples to the Systeminfo section of the api documentation. Change-Id: Ic3d56d207db696100754...
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. # # 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...
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P. # # 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...
Adjust route to add result_id, not _id...
var express = require('express'); var router = express.Router(); var mongoose = require('../models/mongoose'); const config = require('../config'); // Redis const Redis = require('ioredis'); var redis_client = new Redis(config.redis_connection); // routes that end with jobs // ------------------------------------...
var express = require('express'); var router = express.Router(); var mongoose = require('../models/mongoose'); const config = require('../config'); // Redis const Redis = require('ioredis'); var redis_client = new Redis(config.redis_connection); // routes that end with jobs // ------------------------------------...
Update analyzer definition access to type field
'use strict'; export default class AnalyzerConfigFormController { constructor($log) { 'ngInject'; this.$log = $log; this.rateUnits = ['Day', 'Month']; this.formData = {}; } $onInit() { this.$log.log( 'onInit of AnalyzerConfigFormController', this.definition, this.analyzer...
'use strict'; export default class AnalyzerConfigFormController { constructor($log) { 'ngInject'; this.$log = $log; this.rateUnits = ['Day', 'Month']; this.formData = {}; } $onInit() { this.$log.log( 'onInit of AnalyzerConfigFormController', this.definition, this.analyzer...
Add `jade` to the list of inputformats for Pug
'use strict'; var pug = require('pug'); exports.name = 'pug'; exports.inputFormats = ['pug', 'jade']; exports.outputFormat = 'html'; exports.compile = function (source, options) { var fn = pug.compile(source, options); return {fn: fn, dependencies: fn.dependencies} }; exports.compileClient = function (source, op...
'use strict'; var pug = require('pug'); exports.name = 'pug'; exports.outputFormat = 'html'; exports.compile = function (source, options) { var fn = pug.compile(source, options); return {fn: fn, dependencies: fn.dependencies} }; exports.compileClient = function (source, options) { return pug.compileClientWithD...
Add a context to the fixture translations
import json import codecs import tempfile from django.core.management.commands.makemessages import Command as BaseCommand class Command(BaseCommand): """ Extend the makemessages to include some of the fixtures """ fixtures = [ ('bb_projects', 'project_data.json'), ('bb_tasks', 'skills.json'),...
import json import codecs import tempfile from django.core.management.commands.makemessages import Command as BaseCommand class Command(BaseCommand): """ Extend the makemessages to include some of the fixtures """ fixtures = [ ('bb_projects', 'project_data.json'), ('bb_tasks', 'skills.json'),...
Update up to changes in es5-ext
'use strict'; var compose = require('es5-ext/function/#/compose') , write = process.stdout.write.bind(process.stdout) , chars = '-\\|/' , l = chars.length , p; p = { next: 0, write: write, throbbed: false, ontick: function () { if (this.throbbed) { write('\u0008'); } else { this.throbbed = ...
'use strict'; var chain = require('es5-ext/function/#/chain') , write = process.stdout.write.bind(process.stdout) , chars = '-\\|/' , l = chars.length , p; p = { next: 0, write: write, throbbed: false, ontick: function () { if (this.throbbed) { write('\u0008'); } else { this.throbbed = true...
Change param name to match parent
<?php declare(strict_types=1); namespace Doctrine\Bundle\MongoDBBundle\Tests\Mapping\Driver; use Doctrine\Bundle\MongoDBBundle\Mapping\Driver\XmlDriver; class XmlDriverTest extends AbstractDriverTest { /** * @return string */ protected function getFileExtension() { return '.mongodb.xml...
<?php declare(strict_types=1); namespace Doctrine\Bundle\MongoDBBundle\Tests\Mapping\Driver; use Doctrine\Bundle\MongoDBBundle\Mapping\Driver\XmlDriver; class XmlDriverTest extends AbstractDriverTest { /** * @return string */ protected function getFileExtension() { return '.mongodb.xml...
Fix number of bills test
from tests import PMGTestCase from tests.fixtures import dbfixture, BillData, BillTypeData class TestBillAPI(PMGTestCase): def setUp(self): super(TestBillAPI, self).setUp() self.fx = dbfixture.data(BillTypeData, BillData) self.fx.setup() def test_total_bill(self): """ ...
from tests import PMGTestCase from tests.fixtures import dbfixture, BillData, BillTypeData class TestBillAPI(PMGTestCase): def setUp(self): super(TestBillAPI, self).setUp() self.fx = dbfixture.data(BillTypeData, BillData) self.fx.setup() def test_total_bill(self): """ ...
Use %d to format int value
package camelinaction; import org.apache.camel.jsonpath.JsonPath; import org.apache.camel.language.Bean; /** * A bean that acts as a JSon order service to handle incoming JSon orders */ public class JSonOrderService { public String handleIncomingOrder(@JsonPath("$.order.customerId") int customerId, ...
package camelinaction; import org.apache.camel.jsonpath.JsonPath; import org.apache.camel.language.Bean; /** * A bean that acts as a JSon order service to handle incoming JSon orders */ public class JSonOrderService { public String handleIncomingOrder(@JsonPath("$.order.customerId") int customerId, ...
Fix issues with database calculated rating column Actually its not nullable, but since we don't set one on creation, Hibernate trips on double. Therefore we use Double again.
package com.faforever.api.data.domain; import lombok.Setter; import org.hibernate.annotations.Generated; import org.hibernate.annotations.GenerationTime; import javax.persistence.Column; import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.Map...
package com.faforever.api.data.domain; import lombok.Setter; import org.hibernate.annotations.Generated; import org.hibernate.annotations.GenerationTime; import javax.persistence.Column; import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.Map...
Use db as backend for EOS file browser
<?php /** * Created by PhpStorm. * User: labkode * Date: 6/27/17 * Time: 11:16 AM */ namespace OC\CernBox\Storage\Eos; class InstanceMapper implements IInstanceMapper { /** * @var []InstanceInfo */ private $mappings = []; public function __construct() { $this->logger = \OC::$server->getLogger(); $da...
<?php /** * Created by PhpStorm. * User: labkode * Date: 6/27/17 * Time: 11:16 AM */ namespace OC\CernBox\Storage\Eos; class InstanceMapper implements IInstanceMapper { /** * @var []InstanceInfo */ private $mappings; public function __construct() { $info = new InstanceInfo('Experiment', 'root://eospub...
Make constructor param more specific
package com.grayben.riskExtractor.htmlScorer.partScorers.elementScorers; import com.grayben.riskExtractor.htmlScorer.partScorers.Scorer; import com.grayben.riskExtractor.htmlScorer.partScorers.tagScorers.TagSegmentationScorer; import org.jsoup.nodes.Element; import org.jsoup.parser.Tag; /** * Score the segmentation ...
package com.grayben.riskExtractor.htmlScorer.partScorers.elementScorers; import com.grayben.riskExtractor.htmlScorer.partScorers.Scorer; import org.jsoup.nodes.Element; import org.jsoup.parser.Tag; /** * Score the segmentation of an {@link org.jsoup.nodes.Element} based upon the {@link org.jsoup.parser.Tag} it conta...
Use a sha1 as key.
<?php namespace Prometheus; class Sample { private $name; private $labelNames; private $labelValues; private $value; public function __construct(array $data) { $this->name = $data['name']; $this->labelNames = $data['labelNames']; $this->labelValues = $data['labelValue...
<?php namespace Prometheus; class Sample { private $name; private $labelNames; private $labelValues; private $value; public function __construct(array $data) { $this->name = $data['name']; $this->labelNames = $data['labelNames']; $this->labelValues = $data['labelValue...
Use others to pick box props from
import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; import cx from 'classnames'; import InputBase from './InputBase'; import Box, { omitBoxProps, pickBoxProps } from '../box'; import ValidationText from '../validationText'; import theme from './theme.css'; class TextArea extends PureComp...
import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; import cx from 'classnames'; import InputBase from './InputBase'; import Box, { omitBoxProps, pickBoxProps } from '../box'; import ValidationText from '../validationText'; import theme from './theme.css'; class TextArea extends PureComp...
Add option to fail fast on parse
package org.commcare.modern.parse; import org.commcare.core.interfaces.UserSandbox; import org.commcare.core.parse.ParseUtils; import org.javarosa.xml.util.InvalidStructureException; import org.javarosa.xml.util.UnfullfilledRequirementsException; import org.xmlpull.v1.XmlPullParserException; import java.io.ByteArrayI...
package org.commcare.modern.parse; import org.commcare.core.interfaces.UserSandbox; import org.commcare.core.parse.ParseUtils; import org.javarosa.xml.util.InvalidStructureException; import org.javarosa.xml.util.UnfullfilledRequirementsException; import org.xmlpull.v1.XmlPullParserException; import java.io.ByteArrayI...
Replace jquery Ready() with vanilla JS We see some errors with loading the JS for some users, caused by $ being undefined. Why that happens is unknown, since jquery should be loaded before the main.js file, but we want to ultimately remove the jquery dependency anyway.
// This file gets added to the page via /app/views/shared/_head // That Rails view also adds several JavaScript globals to the page, // including the available locales and wikis, the Features enabled, // and other static (from a JavaScript perspective) data objects. // Polyfill import '@babel/polyfill'; import Rails ...
// This file gets added to the page via /app/views/shared/_head // That Rails view also adds several JavaScript globals to the page, // including the available locales and wikis, the Features enabled, // and other static (from a JavaScript perspective) data objects. // Polyfill import '@babel/polyfill'; import Rails ...
Use SingleThemeProvider - here google
package ch.difty.scipamato.publ.web.autoconfiguration; import org.apache.wicket.protocol.http.WebApplication; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.Ena...
package ch.difty.scipamato.publ.web.autoconfiguration; import org.apache.wicket.protocol.http.WebApplication; import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.Ena...
WORK WORK CARRY MOVE MOVE MOVE
module.exports = function () { StructureSpawn.prototype.createCustomCreep = function(energy, roleName) { var numberOfParts = Math.floor(energy / 350); var body = []; for (let i = 0; i < numberOfParts; i++) { body.push(WORK); } for (let i = 0; ...
module.exports = function () { StructureSpawn.prototype.createCustomCreep = function(energy, roleName) { var numberOfParts = Math.floor(energy / 350); var body = []; for (let i = 0; i < numberOfParts; i++) { body.push(WORK); } for (let i = 0; ...
Add 'clear' and 'format' to Ukrainian locale
/** * Ukrainian translation for bootstrap-datepicker * Igor Polynets */ ;(function($){ $.fn.datepicker.dates['uk'] = { days: ["Неділя", "Понеділок", "Вівторок", "Середа", "Четвер", "П'ятниця", "Субота", "Неділя"], daysShort: ["Нед", "Пнд", "Втр", "Срд", "Чтв", "Птн", "Суб", "Нед"], daysMin: ["Нд", "Пн", "Вт",...
/** * Ukrainian translation for bootstrap-datepicker * Igor Polynets */ ;(function($){ $.fn.datepicker.dates['uk'] = { days: ["Неділя", "Понеділок", "Вівторок", "Середа", "Четвер", "П'ятниця", "Субота", "Неділя"], daysShort: ["Нед", "Пнд", "Втр", "Срд", "Чтв", "Птн", "Суб", "Нед"], daysMin: ["Нд", "Пн", "Вт",...
Remove call to open account window when loading module
from ghostlines.storage.app_storage import AppStorage from ghostlines.windows.account_details_window import AccountDetailsWindow from ghostlines.windows.sign_in_window import SignInWindow class AccountWindow(object): def __init__(self, sign_in=SignInWindow, account_details=AccountDetailsWindow): if self.i...
from ghostlines.storage.app_storage import AppStorage from ghostlines.windows.account_details_window import AccountDetailsWindow from ghostlines.windows.sign_in_window import SignInWindow class AccountWindow(object): def __init__(self, sign_in=SignInWindow, account_details=AccountDetailsWindow): if self.i...
Replace default links and values
#!/usr/bin/env python # -*- coding: utf-8 -*- # from __future__ import unicode_literals AUTHOR = 'Vitaly Potyarkin' BIO = 'Unsorted ramblings, sometimes related to programming' SITENAME = 'Randomize' SITEURL = '' PATH = 'content' TIMEZONE = 'Europe/Moscow' DEFAULT_LANG = 'EN' # Feed generation is usually not desir...
#!/usr/bin/env python # -*- coding: utf-8 -*- # from __future__ import unicode_literals AUTHOR = 'Vitaly Potyarkin' BIO = 'Unsorted ramblings, sometimes related to programming' SITENAME = 'Randomize' SITEURL = '' PATH = 'content' TIMEZONE = 'Europe/Moscow' DEFAULT_LANG = 'EN' # Feed generation is usually not desir...
Add selection option for instances of CommandHandlers
package org.jeecqrs.commands.registry; import java.util.Iterator; import java.util.logging.Logger; import javax.annotation.PostConstruct; import javax.enterprise.inject.Instance; import javax.inject.Inject; import org.jeecqrs.commands.CommandHandler; /** * */ public class AutoDiscoverCommandHandlerRegistry<C> exten...
package org.jeecqrs.commands.registry; import java.util.Iterator; import java.util.logging.Logger; import javax.annotation.PostConstruct; import javax.enterprise.inject.Instance; import javax.inject.Inject; import org.jeecqrs.commands.CommandHandler; /** * */ public class AutoDiscoverCommandHandlerRegistry<C> exten...
Refactor Space Before Bang further
'use strict'; var helpers = require('../helpers.js'); module.exports = { 'name': 'space-before-bang', 'defaults': { 'include': true }, 'detect': function (ast, parser) { var result = []; ast.traverseByTypes(['important'], function (block, i, parent) { var previous = parent.content[i - 1]; ...
'use strict'; var helpers = require('../helpers.js'); module.exports = { 'name': 'space-before-bang', 'defaults': { 'include': true }, 'detect': function (ast, parser) { var result = []; ast.traverseByTypes(['important'], function (block, i, parent) { var previous = parent.content[i - 1]; ...
[Props] Make the source prop type optional This way if it's marked as required in `Image` we won't get warnings.
'use strict'; let React = require('react-native'); let { Image, PixelRatio, PropTypes, } = React; class ResponsiveImage extends React.Component { setNativeProps(nativeProps) { this.refs.image.setNativeProps(nativeProps); } render() { let { source } = this.props; let optimalSource = this._getClo...
'use strict'; let React = require('react-native'); let { Image, PixelRatio, PropTypes, } = React; class ResponsiveImage extends React.Component { setNativeProps(nativeProps) { this.refs.image.setNativeProps(nativeProps); } render() { let { source } = this.props; let optimalSource = this._getClo...
Change size of inline images
<?php /** * * * @author Knut Kohl <github@knutkohl.de> * @copyright 2012-2013 Knut Kohl * @license GNU General Public License http://www.gnu.org/licenses/gpl.txt * @version $Id$ */ return array( // ----------------------------------------------------------------------- // INTERNAL SETTINGS, DO ...
<?php /** * * * @author Knut Kohl <github@knutkohl.de> * @copyright 2012-2013 Knut Kohl * @license GNU General Public License http://www.gnu.org/licenses/gpl.txt * @version $Id$ */ return array( // ----------------------------------------------------------------------- // INTERNAL SETTINGS, DO ...
Optimize context value per official docs
/** * @file TimestampProvider component. */ import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; import axios from 'axios'; import getLogger from '../utils/logger'; const log = getLogger('TimestampContext'); export const TimestampContext = React.createContext({ timestamp: null, fe...
/** * @file TimestampProvider component. */ import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; import axios from 'axios'; import getLogger from '../utils/logger'; const log = getLogger('TimestampContext'); export const TimestampContext = React.createContext({ timestamp: null, fe...
Update service provider to use bindShared. Signed-off-by: Mior Muhammad Zaki <e1a543840a942eb68427510a8a483282a7bfeddf@gmail.com>
<?php namespace Orchestra\Support; use Illuminate\Support\ServiceProvider; use Illuminate\Foundation\AliasLoader; class MessagesServiceProvider extends ServiceProvider { /** * Register the service provider. * * @return void */ public function register() { $this->app->bindShared...
<?php namespace Orchestra\Support; use Illuminate\Support\ServiceProvider; use Illuminate\Foundation\AliasLoader; class MessagesServiceProvider extends ServiceProvider { /** * Register the service provider. * * @return void */ public function register() { $this->app['orchestra....
Include sender in message if echo is specified. Needs io object.
var read = require('fs').readFileSync; var client = require('khoros-client'); module.exports = function (io, server) { // Serve client js. if (server) { var clientSource = read(require.resolve('khoros-client/khoros.js'), 'utf-8'); server.on('request', function(req, res) { if (req.url == "/khoros/khoros.js"...
var read = require('fs').readFileSync; var client = require('khoros-client'); module.exports = function (server) { // Serve client js. if (server) { var clientSource = read(require.resolve('khoros-client/khoros.js'), 'utf-8'); server.on('request', function(req, res) { if (req.url == "/khoros/khoros.js") { ...
Fix type of variable on PHPDoc
<?php namespace Chris\Composer\AutoregisterClassmapPlugin\Manipulator; /** * Class AutoloadManipulator * * @author Christophe Chausseray <chausseray.christophe@gmail.com> * * Manipulator of the existing autoload files. */ class AutoloadManipulator { /** * @var string */ protected $vendorDir; ...
<?php namespace Chris\Composer\AutoregisterClassmapPlugin\Manipulator; /** * Class AutoloadManipulator * * @author Christophe Chausseray <chausseray.christophe@gmail.com> * * Manipulator of the existing autoload files. */ class AutoloadManipulator { /** * @var string */ protected $vendorDir; ...
Fix bug that appears when a reference file model is created from scratch where the dq_def member exists, but has no rows. git-svn-id: 7ab1303e5df1b63f74144546e35d3203cc1d26c5@3127 560b4ebf-6bc0-4cc5-b8e0-b136f69d22d4
import numpy as np from . import dqflags def dynamic_mask(input_model): # # Return a mask model given a mask with dynamic DQ flags # Dynamic flags define what each plane refers to using the DQ_DEF extension dq_table = input_model.dq_def # Get the DQ array and the flag definitions if dq_table i...
import numpy as np from . import dqflags def dynamic_mask(input_model): # # Return a mask model given a mask with dynamic DQ flags # Dynamic flags define what each plane refers to using the DQ_DEF extension dq_table = input_model.dq_def # Get the DQ array and the flag definitions if dq_table i...
Apply Buble to build locale
import fs from 'fs' import path from 'path' import {rollup} from 'rollup' import uglify from 'rollup-plugin-uglify' import chalk from 'chalk' import buble from 'rollup-plugin-buble' async function build () { console.log(chalk.cyan('Building individual translations.')) const files = fs.readdirSync('./src/locale/tra...
import fs from 'fs' import path from 'path' import {rollup} from 'rollup' import uglify from 'rollup-plugin-uglify' import chalk from 'chalk' async function build () { console.log(chalk.cyan('Building individual translations.')) const files = fs.readdirSync('./src/locale/translations') files.forEach(async functi...
Make the buffer radio be big enough to change points visually
var AddAnalysisOptionModel = require('./add-analysis-option-model'); module.exports = function (analysisDefinitionNodeModel) { var models = []; var areaOfInfluence = _t('components.modals.add-analysis.options.sub-titles.area-of-influence'); // Buffer models.push( new AddAnalysisOptionModel({ title:...
var AddAnalysisOptionModel = require('./add-analysis-option-model'); module.exports = function (analysisDefinitionNodeModel) { var models = []; var areaOfInfluence = _t('components.modals.add-analysis.options.sub-titles.area-of-influence'); // Buffer models.push( new AddAnalysisOptionModel({ title:...
Add global level vars for other packages
from functools import wraps import platform # FIXME: had to duplicate this for package level imports. this is a bad design operating_system = platform.system() distribution, version, codename = platform.linux_distribution() def is_debian(versions=None, distro_name='Debian'): # FIXME: this is duplicated above. F...
from functools import wraps import platform def is_debian(versions=None, distro_name='Debian'): operating_system = platform.system() distribution, version, codename = platform.linux_distribution() is_version = True if versions: is_version = version in versions or codename in versions retu...
Add response to sensor stream API handler
var express = require('express'); var router = express.Router(); var sqlite3 = require('sqlite3').verbose(); var db = new sqlite3.Database('/home/pi/homeauto/backend/temp.db'); /* GET home page. */ router.get('/v1/temperature', function(req, res, next) { var filter = "WHERE sensor_fk = 1"; if(req.query.starttime ...
var express = require('express'); var router = express.Router(); var sqlite3 = require('sqlite3').verbose(); var db = new sqlite3.Database('/home/pi/homeauto/backend/temp.db'); /* GET home page. */ router.get('/v1/temperature', function(req, res, next) { var filter = "WHERE sensor_fk = 1"; if(req.query.starttime ...
Add sensor field to Event model in sensor.core
# 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 django.db import models VALUE_MAX_LEN = 128 class GenericEvent(models.Model): """Represents a measuremen...
# 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 django.db import models VALUE_MAX_LEN = 128 class GenericEvent(models.Model): """Represents a measuremen...
Fix focus jumping to comment after cleaning the customer
/** * @module timed * @submodule timed-components * @public */ import Component from 'ember-component' import service from 'ember-service/inject' import { observes } from 'ember-computed-decorators' import { later } from 'ember-runloop' const ENTER_CHAR_CODE = 13 /** * The tracking bar component * * @class Tra...
/** * @module timed * @submodule timed-components * @public */ import Component from 'ember-component' import service from 'ember-service/inject' import { observes } from 'ember-computed-decorators' import { later } from 'ember-runloop' const ENTER_CHAR_CODE = 13 /** * The tracking bar component * * @class Tra...
Remove value which is already default
from django.db import models from django.contrib.auth.models import User from django.utils.translation import gettext_lazy as _ class Excerpt(models.Model): name = models.CharField(max_length=128, verbose_name=_('name')) is_public = models.BooleanField(default=False, verbose_name=_('is public')) is_active...
from django.db import models from django.contrib.auth.models import User from django.utils.translation import gettext_lazy as _ class Excerpt(models.Model): name = models.CharField(max_length=128, verbose_name=_('name'), blank=False) is_public = models.BooleanField(default=False, verbose_name=_('is public')) ...
Reduce search response time by keeping wordlist in memory
from flask import Flask, render_template, jsonify app = Flask(__name__) app.config.update( JSONIFY_PRETTYPRINT_REGULAR=False, ) # Read in the entire wordlist at startup and keep it in memory. # Optimization for improving search response time. with open('typesetter/data/words.txt') as f: WORDS = f.read().spli...
from flask import Flask, render_template, jsonify app = Flask(__name__) app.config.update( JSONIFY_PRETTYPRINT_REGULAR=False, ) @app.route('/') def index(): return render_template('index.html') @app.route('/api/search/<fragment>') def search(fragment): results = [] with open('typesetter/data/words...
Stop console error about content security policy
/* jshint node: true */ module.exports = function(environment) { var ENV = { modulePrefix: 'smallprint', environment: environment, baseURL: '/', locationType: 'auto', EmberENV: { FEATURES: { // Here you can enable experimental features on an ember canary build // e.g. 'with-...
/* jshint node: true */ module.exports = function(environment) { var ENV = { modulePrefix: 'smallprint', environment: environment, baseURL: '/', locationType: 'auto', EmberENV: { FEATURES: { // Here you can enable experimental features on an ember canary build // e.g. 'with-...
Change way README is imported. The custom read function is unnecessary since only one file is being accessed. Removing it reduces the amount of code.
#!/usr/bin/env python from distutils.core import setup setup( name='facebook-sdk', version='0.3.2', description='This client library is designed to support the Facebook ' 'Graph API and the official Facebook JavaScript SDK, which ' 'is the canonical way to implement Facebook...
#!/usr/bin/env python from distutils.core import setup import os def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup( name='facebook-sdk', version='0.3.2', description='This client library is designed to support the Facebook ' 'Graph API and the o...
Add option to pass options object to ng-simditor
module.exports = angular .module('simditor.directive', []) .directive('simditor', simditor); simditor.$inject = ['simditorOptions']; function simditor(simditorOptions) { return { restrict: 'AE', require: 'ngModel', scope: { options: '<' }, link: function(scope, element, attr, ngModel) ...
module.exports = angular .module('simditor.directive', []) .directive('simditor', simditor); simditor.$inject = ['simditorOptions']; function simditor(simditorOptions) { return { restrict: 'AE', require: 'ngModel', link: function(scope, element, attr, ngModel) { if (!ngModel) return; va...
Add new utility find function for converting id to longname for unit fields
var ObjectEditor = { Data: { Units: require('../WEdata/data/Units.json') }, Fields: { Units: require('../WEdata/fields/UnitMetaData.json') }, Find: { UnitFieldIdByLongName: function(longName) { // e.g. bountydice -> ubdi // TODO: time this function ...
var ObjectEditor = { Data: { Units: require('../WEdata/data/Units.json') }, Fields: { Units: require('../WEdata/fields/UnitMetaData.json') }, Find: { UnitFieldIdByLongName: function(longName) { // e.g. bountydice -> ubdi // TODO: time this function ...
Print out bag contents for lidar and button topics
#!/usr/bin/env python # -*- coding: utf-8 -*- """Convert a rosbag file to legacy lidar binary format. """ """LIDAR datatype format is: ( timestamp (long), flag (bool saved as int), accelerometer[3] (double), gps[3] (double), distance[LIDAR_NUM_ANGLES] (long), ) 'int...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Convert a rosbag file to legacy lidar binary format. """ """LIDAR datatype format is: ( timestamp (long), flag (bool saved as int), accelerometer[3] (double), gps[3] (double), distance[LIDAR_NUM_ANGLES] (long), ) 'int...
tests: Allow multiple 'golden' results for agglomeration test on Linux
import sys import platform import h5py import numpy segh5 = sys.argv[1] predh5 = sys.argv[2] classifier = sys.argv[3] threshold = float(sys.argv[4]) from neuroproof import Agglomeration # open as uint32 and float respectively seg = numpy.array(h5py.File(segh5)['stack'], numpy.uint32) pred = numpy.array(h5py.File(pre...
import sys import platform import h5py import numpy segh5 = sys.argv[1] predh5 = sys.argv[2] classifier = sys.argv[3] threshold = float(sys.argv[4]) from neuroproof import Agglomeration # open as uint32 and float respectively seg = numpy.array(h5py.File(segh5)['stack'], numpy.uint32) pred = numpy.array(h5py.File(pre...
Fix a typo: error message showed the whole list of flies, instead of the one to which we tried to connect
// Enumerates USB devices, finds and identifies CrazyRadio USB dongle. package main import ( "fmt" "os" "time" "github.com/krasin/crazyradio" "github.com/krasin/crazyradio/usb" ) func fail(format string, args ...interface{}) { fmt.Fprintf(os.Stderr, format, args...) os.Exit(1) } func main() { st, err := cra...
// Enumerates USB devices, finds and identifies CrazyRadio USB dongle. package main import ( "fmt" "os" "time" "github.com/krasin/crazyradio" "github.com/krasin/crazyradio/usb" ) func fail(format string, args ...interface{}) { fmt.Fprintf(os.Stderr, format, args...) os.Exit(1) } func main() { st, err := cra...
Throw error if no config passed to errorHandler factory (instead of using example config)
/* * Error handling middleware factory * * @see module:midwest/util/format-error * @see module:midwest/util/log-error */ 'use strict'; // modules > 3rd party const _ = require('lodash'); // modules > internal const format = require('../util/format-error'); const log = require('../util/log-error'); module.export...
/* * Error handling middleware factory * * @see module:midwest/util/format-error * @see module:midwest/util/log-error */ 'use strict'; // modules > 3rd party const _ = require('lodash'); // modules > internal const format = require('../util/format-error'); const log = require('../util/log-error'); module.export...
Make load balancer as fast as possible. No config is used, servers are defined in code.
package sk.httpclient.app; import com.netflix.loadbalancer.ILoadBalancer; import com.netflix.loadbalancer.Server; import java.util.List; public class MyLoadBalancer implements ILoadBalancer { private int c = 0; @Override public void addServers(List<Server> newServers) { //super.addServers(newSe...
package sk.httpclient.app; import com.netflix.loadbalancer.DynamicServerListLoadBalancer; import com.netflix.loadbalancer.Server; import java.util.List; public class MyLoadBalancer extends DynamicServerListLoadBalancer { private int c = 0; @Override public void addServers(List<Server> newServers) { ...
Edit docs test for local test on windows machine
import subprocess import unittest import os import subprocess import unittest import os class Doc_Test(unittest.TestCase): @property def path_to_docs(self): dirname, filename = os.path.split(os.path.abspath(__file__)) return dirname.split(os.path.sep)[:-2] + ['docs'] def test_html(self)...
import subprocess import unittest import os import subprocess import unittest import os class Doc_Test(unittest.TestCase): @property def path_to_docs(self): dirname, filename = os.path.split(os.path.abspath(__file__)) return dirname.split(os.path.sep)[:-2] + ['docs'] def test_html(self)...