text stringlengths 17 1.47k | positive stringlengths 673 4.43k | negative stringlengths 677 2.81k |
|---|---|---|
Normalize usernames properly to prevent clashes from guest accounts
Guest accounts can have non berkeley.edu emails, and might
get access to a berkeley.edu user's home directory. This
will prevent that. | from traitlets import List, Unicode
from oauthenticator.generic import GenericOAuthenticator
from tornado import gen
canvas_site = 'https://ucberkeley.test.instructure.com/'
class CanvasAuthenticator(GenericOAuthenticator):
allowed_email_domains = List(
[],
config=True,
help="""
L... | from traitlets import List, Unicode
from oauthenticator.generic import GenericOAuthenticator
from tornado import gen
canvas_site = 'https://ucberkeley.test.instructure.com/'
class CanvasAuthenticator(GenericOAuthenticator):
allowed_email_domains = List(
[],
config=True,
help="""
L... |
Add new line below each snippet | define([
'text!snippet-collapsible',
'text!snippet-ticks',
'text!snippet-callout',
'text!snippet-add-action',
'text!snippet-video',
'text!snippet-action-item'
], function (
collapsibleSnippet,
ticksSnippet,
calloutSnippet,
addActionSnippet,
videoSnippet,
actionItemSnippet
) {
'us... | define([
'text!snippet-collapsible',
'text!snippet-ticks',
'text!snippet-callout',
'text!snippet-add-action',
'text!snippet-video',
'text!snippet-action-item'
], function (
collapsibleSnippet,
ticksSnippet,
calloutSnippet,
addActionSnippet,
videoSnippet,
actionItemSnippet
) {
'us... |
Fix "Python :: 2" being listed twice in pypi classifiers | #!/usr/bin/env python
from setuptools import setup
setup(
name='clize',
version='3.0a2',
description='Command-line argument parsing for Python, without the effort',
license='MIT',
url='https://github.com/epsy/clize',
author='Yann Kaiser',
author_email='kaiser.yann@gmail.com',
install_r... | #!/usr/bin/env python
from setuptools import setup
setup(
name='clize',
version='3.0a2',
description='Command-line argument parsing for Python, without the effort',
license='MIT',
url='https://github.com/epsy/clize',
author='Yann Kaiser',
author_email='kaiser.yann@gmail.com',
install_r... |
Update author email to Spirent support. | import os, sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
def main():
setup(
name='stcrestclient',
version= '1.8.3',
author='Andrew Gillis',
author_email='support@spirent.com',
url='https://github.com/Spirent/py-stcrestcli... | import os, sys
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
def main():
setup(
name='stcrestclient',
version= '1.8.3',
author='Andrew Gillis',
author_email='andrew.gillis@spirent.com',
url='https://github.com/Spirent/py-stcr... |
Remove grids from templates where not needed | <?php
global $post;
$items = get_field('items', $module->ID);
?>
<div class="box box-panel">
<h4 class="box-title"><?php echo $module->post_title; ?></h4>
<ul>
<?php foreach ($items as $item) : ?>
<?php if ($item['type'] == 'external') : ?>
<li>
<a class=... | <?php
global $post;
$items = get_field('items', $module->ID);
?>
<div class="grid">
<div class="grid-lg-12">
<div class="box box-panel">
<h4 class="box-title"><?php echo $module->post_title; ?></h4>
<ul>
<?php foreach ($items as $item) : ?>
... |
Make Data match the Extension API. | <?php
namespace ComplexPie;
class Data extends Extension
{
protected static $static_ext = array();
public static function add_static_extension($extpoint, $ext, $priority)
{
if ($extpoint === 'get' && !is_callable($ext))
{
throw new \InvalidArgumentException("$ext is not cal... | <?php
namespace ComplexPie;
class Data extends Extension
{
protected static $static_ext = array();
public static function add_static_extension($extpoint, $ext, $priority)
{
if ($extpoint === 'get' && !is_callable($ext))
{
throw new \InvalidArgumentException("$ext is not cal... |
[docs] Fix small coding style issue | import React from 'react';
import {Tabs, Tab} from 'material-ui/Tabs';
const styles = {
headline: {
fontSize: 24,
paddingTop: 16,
marginBottom: 12,
fontWeight: 400,
},
};
export default class TabsExampleControlled extends React.Component {
constructor(props) {
super(props);
this.state =... | import React from 'react';
import {Tabs, Tab} from 'material-ui/Tabs';
const styles = {
headline: {
fontSize: 24,
paddingTop: 16,
marginBottom: 12,
fontWeight: 400,
},
};
export default class TabsExampleControlled extends React.Component {
constructor(props) {
super(props);
this.state =... |
Remove inspector left over from module tests. |
function runTests(testType, BABYLON, GUI) {
console.log("running tests");
describe(testType + ' tests', function () {
it("should have BABYLON loaded", function () {
assert.isDefined(BABYLON);
})
it("should have GUI loaded", function () {
assert.... |
function runTests(testType, BABYLON, GUI, INSPECTOR) {
console.log("running tests");
describe(testType + ' tests', function () {
it("should have BABYLON loaded", function () {
assert.isDefined(BABYLON);
})
it("should have GUI loaded", function () {
... |
Enable distinct results for calendar preview | import {
DEFAULT_LIMIT,
DEFAULT_OFFSET,
} from './base'
import {
EventBelongsToManyImage,
EventBelongsToPlace,
EventHasManySlots,
} from '../database/associations'
import Event from '../models/event'
export default {
findAll: (req, res, next) => {
const {
limit = DEFAULT_LIMIT,
offset = D... | import {
DEFAULT_LIMIT,
DEFAULT_OFFSET,
} from './base'
import {
EventBelongsToManyImage,
EventBelongsToPlace,
EventHasManySlots,
} from '../database/associations'
import Event from '../models/event'
export default {
findAll: (req, res, next) => {
const {
limit = DEFAULT_LIMIT,
offset = D... |
Use json library instead of eval. | import sys
import caching
import urllib
import urllib2
import re
import json
from pyquery import PyQuery as p
try: cache = caching.get_cache('tnrs')
except: cache = {}
def tnrs_lookup(name, TIMEOUT=10, CACHE=True):
'''
Look up "name" on the TNRS web service. If a most likely standard name can be identified,... | import sys
import caching
import urllib
import urllib2
import re
from pyquery import PyQuery as p
try: cache = caching.get_cache('tnrs')
except: cache = {}
def tnrs_lookup(name, TIMEOUT=10, CACHE=True):
'''
Look up "name" on the TNRS web service. If a most likely standard name can be identified,
return... |
Use global settings instead of system settings. | /* 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/. */
package info.zamojski.soft.towercollector.utils;
import android.Manifest;
import android.content.Context;
import ... | /* 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/. */
package info.zamojski.soft.towercollector.utils;
import android.Manifest;
import android.content.Context;
import ... |
Fix broken unit test which resulted from deprecating KeyboardDirectionMixin defining a public orientation property. | import * as symbols from '../../src/symbols.js';
import KeyboardDirectionMixin from '../../src/KeyboardDirectionMixin.js';
class KeyboardDirectionMixinTest extends KeyboardDirectionMixin(HTMLElement) {
constructor() {
super();
this.state = {};
}
[symbols.goRight]() {
if (super[symbols.goRight]) { ... | import * as symbols from '../../src/symbols.js';
import KeyboardDirectionMixin from '../../src/KeyboardDirectionMixin.js';
class KeyboardDirectionMixinTest extends KeyboardDirectionMixin(HTMLElement) {
[symbols.goRight]() {
if (super[symbols.goRight]) { super[symbols.goRight](); }
return true;
}
}
customE... |
Change jquery `find` to `querySelectorAll`
Using `querySelectorAll` rather than `querySelector` as input is a list
of radio buttons or checkboxes
Remove global JQuery object as we're no longer using it. | window.GOVUK = window.GOVUK || {}
window.GOVUK.Modules = window.GOVUK.Modules || {};
(function (global, GOVUK) {
'use strict'
GOVUK.Modules.TrackBrexitQaChoices = function () {
this.start = function (element) {
track(element)
}
function track (element) {
element.on('submit', function (eve... | window.GOVUK = window.GOVUK || {}
window.GOVUK.Modules = window.GOVUK.Modules || {};
(function (global, GOVUK) {
'use strict'
var $ = global.jQuery
GOVUK.Modules.TrackBrexitQaChoices = function () {
this.start = function (element) {
track(element)
}
function track (element) {
element.o... |
Stop iteration if callback returned false value | module.exports = {
iterate: iterate
};
var iterableProperties = {
'body': true,
'expression': true,
// if
'test': true,
'consequent': true,
'alternate': true,
'object': true,
//switch
'discriminant': true,
'cases': true,
// return
'argument': true,
'arguments... | module.exports = {
iterate: iterate
};
var iterableProperties = {
'body': true,
'expression': true,
// if
'test': true,
'consequent': true,
'alternate': true,
'object': true,
//switch
'discriminant': true,
'cases': true,
// return
'argument': true,
'arguments... |
Add space after EC prefix
Co-authored-by: Charles Tapley Hoyt <71cbf5b94f8862eb69e356b36e0cdaee3e60b67f@gmail.com> | # -*- coding: utf-8 -*-
"""Processor for the `Chemical Roles Graph (CRoG)
<https://github.com/chemical-roles/chemical-roles>`_.
"""
from typing import Optional
from ..utils import RemoteProcessor
__all__ = [
'CrogProcessor',
]
CROG_URL = 'https://raw.githubusercontent.com/chemical-roles/' \
'chemica... | # -*- coding: utf-8 -*-
"""Processor for the `Chemical Roles Graph (CRoG)
<https://github.com/chemical-roles/chemical-roles>`_.
"""
from typing import Optional
from ..utils import RemoteProcessor
__all__ = [
'CrogProcessor',
]
CROG_URL = 'https://raw.githubusercontent.com/chemical-roles/' \
'chemica... |
Fix concurrent modification exception when switching root | package com.reactnativenavigation.events;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
public enum EventBus {
instance;
private final List<WeakReference<Subscriber>> subscribers = new ArrayList<>();
public void register(Subscriber ... | package com.reactnativenavigation.events;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
import java.util.ListIterator;
public enum EventBus {
instance;
private final List<WeakReference<Subscriber>> subscribers = new ArrayList<>();
public void register(Subscriber ... |
Update double_width_emojis list to improve "rich" printing | from rich.console import Console
from rich.markdown import Markdown
from rich.syntax import Syntax
def process_syntax(code, lang, theme, line_numbers, code_width, word_wrap):
syntax = Syntax(
code,
lang,
theme=theme,
line_numbers=line_numbers,
code_width=code_width,
... | from rich.console import Console
from rich.markdown import Markdown
from rich.syntax import Syntax
def process_syntax(code, lang, theme, line_numbers, code_width, word_wrap):
syntax = Syntax(
code,
lang,
theme=theme,
line_numbers=line_numbers,
code_width=code_width,
... |
Fix Evocation Illager animation on 1.12 | package us.myles.ViaVersion.protocols.protocol1_12to1_11_1;
import us.myles.ViaVersion.api.Via;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.entities.Entity1_12Types;
import us.myles.ViaVersion.api.minecraft.item.Item;
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
i... | package us.myles.ViaVersion.protocols.protocol1_12to1_11_1;
import us.myles.ViaVersion.api.Via;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.entities.Entity1_12Types;
import us.myles.ViaVersion.api.minecraft.item.Item;
import us.myles.ViaVersion.api.minecraft.metadata.Metadata;
i... |
Move the call to the server into a separate thread
So that it does not block the webcore thread | package edu.berkeley.eecs.emission.cordova.comm;
import org.apache.cordova.*;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.content.Context;
import edu.berkeley.eecs.emission.cordova.comm.CommunicationHelper;
import edu.berkeley.eecs.emission.cordova.connectionse... | package edu.berkeley.eecs.emission.cordova.comm;
import org.apache.cordova.*;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.content.Context;
import edu.berkeley.eecs.emission.cordova.comm.CommunicationHelper;
import edu.berkeley.eecs.emission.cordova.connectionse... |
Remove handling of failed send error | // let messanger = require('./mailer/transport')();
module.exports = function(_db, messanger){
if(!SlickSources[_db]) return {start: () => false};
let _req = {db:SlickSources[_db]},
Mails = Models.Mails(_req),
fetchMails = cb => {
Mails.find({limit:100}, function(e, recs){
... | // let messanger = require('./mailer/transport')();
module.exports = function(_db, messanger){
if(!SlickSources[_db]) return {start: () => false};
let _req = {db:SlickSources[_db]},
Mails = Models.Mails(_req),
fetchMails = cb => {
Mails.find({limit:100,sent:'0'}, function(e, rec... |
Fix test to work correctly on windows. | package org.wkh.bateman.trade;
import org.wkh.bateman.trade.Quote;
import org.wkh.bateman.trade.GoogleQuoteFetcher;
import java.io.File;
import java.util.List;
import java.util.Scanner;
import static junit.framework.Assert.assertEquals;
import junit.framework.TestCase;
public class GoogleQuoteFetcherTest extends Test... | package org.wkh.bateman.trade;
import org.wkh.bateman.trade.Quote;
import org.wkh.bateman.trade.GoogleQuoteFetcher;
import java.io.File;
import java.util.List;
import java.util.Scanner;
import static junit.framework.Assert.assertEquals;
import junit.framework.TestCase;
public class GoogleQuoteFetcherTest extends Test... |
Use WebserviceTestCase as parent for listing overview test | <?php
namespace Tests\AppBundle\API\Listing;
use Symfony\Component\HttpFoundation\ParameterBag;
use Tests\AppBundle\API\WebserviceTestCase;
class OverviewTest extends WebserviceTestCase
{
const NICKNAME = 'listingOverviewTestUser';
const USERID = 'listingOverviewTestUser';
const PROVIDER = 'listingOvervi... | <?php
namespace Tests\AppBundle\API\Listing;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage;
class OverviewTest extends WebTestCa... |
Fix NPE if no auth info provided | package digital.loom.rhizome.authentication;
import java.util.regex.Pattern;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import com.auth0.jwt.internal.org.apache.commons.lang3.StringUtils;
import com.auth0.spring.security.api.Auth0AuthenticationFilter;
import com.google.common.bas... | package digital.loom.rhizome.authentication;
import java.util.regex.Pattern;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import com.auth0.jwt.internal.org.apache.commons.lang3.StringUtils;
import com.auth0.spring.security.api.Auth0AuthenticationFilter;
import com.google.common.bas... |
Set cache buster equal to 0 when there is no affected tables in the mapconfig | 'use strict';
module.exports = function setLastUpdatedTimeToLayergroup () {
return function setLastUpdatedTimeToLayergroupMiddleware (req, res, next) {
const { mapConfigProvider, analysesResults } = res.locals;
const layergroup = res.body;
mapConfigProvider.createAffectedTables((err, affec... | 'use strict';
module.exports = function setLastUpdatedTimeToLayergroup () {
return function setLastUpdatedTimeToLayergroupMiddleware (req, res, next) {
const { mapConfigProvider, analysesResults } = res.locals;
const layergroup = res.body;
mapConfigProvider.createAffectedTables((err, affec... |
Fix error logging to actually output useful data | import { basename, extname, join, dirname, relative, resolve } from 'path'
import { default as put } from 'output-file-sync'
import { parallel } from 'async'
const keys = Object.keys
export default function createPipeline(pkg, opts, build, progress) {
const
{ onBuild = noop
, onError = noop
} = progress... | import { basename, extname, join, dirname, relative, resolve } from 'path'
import { default as put } from 'output-file-sync'
import { parallel } from 'async'
const keys = Object.keys
export default function createPipeline(pkg, opts, build, progress) {
const
{ onBuild = noop
, onError = noop
} = progress... |
Add helper to load a single test case. | # -*- encoding: utf-8 -*-
"""Utility routines
"""
import os
import re
from enum import Enum
from contextlib import contextmanager
import unittest
def pyname_join(seq):
return ".".join(seq)
def is_pkgdir(dirpath):
return os.path.isdir(dirpath) \
and os.path.isfile(os.path.join(dirpath, "__init__.py"... | # -*- encoding: utf-8 -*-
"""Utility routines
"""
import os
import re
from enum import Enum
from contextlib import contextmanager
def pyname_join(seq):
return ".".join(seq)
def is_pkgdir(dirpath):
return os.path.isdir(dirpath) \
and os.path.isfile(os.path.join(dirpath, "__init__.py"))
def mod_spli... |
Increase each item of the lVal by rVal when lVal is an array and rVal is a plain value. |
var Operator = require("dice-js/operator");
Operator.define("Addition", {
symbol: "+",
operation: function (lVal, rVal) {
var lValIsArray = Array.isArray(lVal),
rValIsArray = Array.isArray(rVal),
lValIsObj = typeof lVal === "object",
rValIsObj = typeof rVal === ... |
var Operator = require("dice-js/operator");
Operator.define("Addition", {
symbol: "+",
operation: function (lVal, rVal) {
var lValIsArray = Array.isArray(lVal),
rValIsArray = Array.isArray(rVal),
lValIsObj = typeof lVal === "object",
rValIsObj = typeof rVal === ... |
Fix the raw paths for Gitorious
Gitorious have changed the raw orl paths, making impossible to use a Gitorious
repository.
This patch has been tested in production at
http://reviewboard.chakra-project.org/r/27/diff/#index_header
Reviewed at http://reviews.reviewboard.org/r/3649/diff/#index_header | from django import forms
from django.utils.translation import ugettext_lazy as _
from reviewboard.hostingsvcs.forms import HostingServiceForm
from reviewboard.hostingsvcs.service import HostingService
class GitoriousForm(HostingServiceForm):
gitorious_project_name = forms.CharField(
label=_('Project name... | from django import forms
from django.utils.translation import ugettext_lazy as _
from reviewboard.hostingsvcs.forms import HostingServiceForm
from reviewboard.hostingsvcs.service import HostingService
class GitoriousForm(HostingServiceForm):
gitorious_project_name = forms.CharField(
label=_('Project name... |
Use more appropriate status code |
from . import settings
from django.http import HttpResponse
import time
import redis
# Connection pool
POOL = redis.ConnectionPool(**settings.REDIS)
class RatedMiddleware(object):
def process_view(self, request, view_func, view_args, view_kwargs):
# Try to determine the realm for this view
try... |
from . import settings
from django.http import HttpResponse
import time
import redis
# Connection pool
POOL = redis.ConnectionPool(**settings.REDIS)
class RatedMiddleware(object):
def process_view(self, request, view_func, view_args, view_kwargs):
# Try to determine the realm for this view
try... |
CRM-82: Apply forms JS validation
- remove constraint from email form type to fix tests | <?php
namespace Oro\Bundle\FlexibleEntityBundle\Form\Type;
use Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceList;
use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Form\FormBuilderInterface;
class EmailType extends CollectionItemAbstract
{
const TYPE_CORPORATE = 1;
const TYPE_... | <?php
namespace Oro\Bundle\FlexibleEntityBundle\Form\Type;
use Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceList;
use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Form\FormBuilderInterface;
class EmailType extends CollectionItemAbstract
{
const TYPE_CORPORATE = 1;
const TYPE_... |
Update Icebreath to remove "Loading..." messages. | <?php
namespace PVL\RadioAdapter;
use \Entity\Station;
class IceBreath extends AdapterAbstract
{
/* Process a nowplaying record. */
protected function _process(&$np)
{
$return_raw = $this->getUrl();
if (empty($return_raw))
return false;
$return = @json_decode($return_... | <?php
namespace PVL\RadioAdapter;
use \Entity\Station;
class IceBreath extends AdapterAbstract
{
/* Process a nowplaying record. */
protected function _process(&$np)
{
$return_raw = $this->getUrl();
if (empty($return_raw))
return false;
$return = @json_decode($return_... |
Add back `localized` function which was accidentally removed | <?php
class Lang extends \Fuel\Core\Lang
{
/**
* @var string default language when language is not specified in URI
*/
public static $default_language;
public static function _init()
{
static::$default_language = \Config::get('language');
parent::_init();
}
/**
... | <?php
class Lang extends \Fuel\Core\Lang
{
/**
* @var string default language when language is not specified in URI
*/
public static $default_language;
public static function _init()
{
static::$default_language = \Config::get('language');
parent::_init();
}
/**
... |
Send flag when success push notifications | # coding=utf-8
import time, os, json
from apns import APNs, Frame, Payload
from push.models import DevelopFileModel, ProductFileModel
from django.conf import settings
PEM_FILE_DIR = settings.BASE_DIR + '/push/files/'
def execute(device_token_lists, notification):
if notification.is_production:
pem_file_n... | # coding=utf-8
import time, os, json
from apns import APNs, Frame, Payload
from push.models import DevelopFileModel, ProductFileModel
from django.conf import settings
PEM_FILE_DIR = settings.BASE_DIR + '/push/files/'
def execute(device_token_lists, notification):
if notification.is_production:
pem_file_n... |
Fix urls of switcher after first switch | <?php
namespace LanguageSwitcher\View\Helper;
use Cake\Core\Configure;
use Cake\Core\InstanceConfigTrait;
use Cake\Routing\Router;
use Cake\Utility\Hash;
use Cake\Utility\Text;
use Cake\View\Helper;
use Cake\View\View;
/**
* LanguageSwitcher helper
*/
class LanguageSwitcherHelper extends Helper
{
use InstanceC... | <?php
namespace LanguageSwitcher\View\Helper;
use Cake\Core\Configure;
use Cake\Core\InstanceConfigTrait;
use Cake\Routing\Router;
use Cake\Utility\Hash;
use Cake\Utility\Text;
use Cake\View\Helper;
use Cake\View\View;
/**
* LanguageSwitcher helper
*/
class LanguageSwitcherHelper extends Helper
{
use InstanceC... |
Make challenges the initial route | import React from 'react'
import { TabNavigator, addNavigationHelpers } from 'react-navigation'
import { connect } from 'react-redux'
import Challenges from './components/Challenges'
import Friends from './components/Friends'
import CameraScreen from './components/CameraScreen'
import PostChallengeScreen from './compon... | import React from 'react'
import { TabNavigator, addNavigationHelpers } from 'react-navigation'
import { connect } from 'react-redux'
import Challenges from './components/Challenges'
import Friends from './components/Friends'
import CameraScreen from './components/CameraScreen'
import PostChallengeScreen from './compon... |
Fix setPositionVisible on dropdown when in mobile. | var locastyle = locastyle || {};
locastyle.dropdown = (function() {
'use strict';
function init() {
unbind();
bindClickOnTriggers();
bindClickOutsideTriggers();
}
function unbind() {
$("[data-ls-module=dropdown] > a:first-child").off("click.ls");
$("body").off("click.ls");
}
function... | var locastyle = locastyle || {};
locastyle.dropdown = (function() {
'use strict';
function init() {
unbind();
bindClickOnTriggers();
bindClickOutsideTriggers();
}
function unbind() {
$("[data-ls-module=dropdown] > a:first-child").off("click.ls");
$("body").off("click.ls");
}
function... |
Use <aside> rather than <div>
So all page content is within landmarks.
Resolves: https://trello.com/c/ZpypHwAa/526-fix-banner-styling | <?php
$showBannerOnNetwork = get_site_option('banner_setting');
$showBannerBySite = get_field('show_banner', 'options');
if ($showBannerOnNetwork == true && ($showBannerBySite == true || $showBannerBySite === null)) {
$bannerTitle = get_site_option('banner_title');
$bannerLinkText = get_site_option('banner_link... | <?php
$showBannerOnNetwork = get_site_option('banner_setting');
$showBannerBySite = get_field('show_banner', 'options');
if ($showBannerOnNetwork == true && ($showBannerBySite == true || $showBannerBySite === null)) {
$bannerTitle = get_site_option('banner_title');
$bannerLinkText = get_site_option('banner_link... |
Remove "named" parameters when calling ImageSVG in class PDFRendere | <?php
namespace raphiz\passwordcards;
class PDFRenderer
{
public static function render($front, $back)
{
// create new PDF document
$pdf = new \TCPDF(PDF_PAGE_ORIENTATION, 'mm', 'A4', true, 'UTF-8', false);
// set document information
$pdf->SetAuthor('Raphael Zimmermann');
... | <?php
namespace raphiz\passwordcards;
class PDFRenderer
{
public static function render($front, $back)
{
// create new PDF document
$pdf = new \TCPDF(PDF_PAGE_ORIENTATION, 'mm', 'A4', true, 'UTF-8', false);
// set document information
$pdf->SetAuthor('Raphael Zimmermann');
... |
Apply activity readiness check to map screenshot task (instead of hard-coded delay) | package com.basgeekball.screenshotsnanny.core;
import android.app.Activity;
import android.os.Handler;
import com.basgeekball.screenshotsnanny.activityassistant.ActivityHelper;
import com.basgeekball.screenshotsnanny.helper.Callback;
public class ScreenshotsTask {
public static void perform(final Callback callba... | package com.basgeekball.screenshotsnanny.core;
import android.app.Activity;
import android.os.Handler;
import com.basgeekball.screenshotsnanny.activityassistant.ActivityHelper;
import com.basgeekball.screenshotsnanny.helper.Callback;
public class ScreenshotsTask {
public static void perform(final Callback callba... |
Allow relationship to be null | <?php
/*
* This file is part of JSON-API.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Tobscure\JsonApi;
use LogicException;
abstract class AbstractSerializer implements ... | <?php
/*
* This file is part of JSON-API.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Tobscure\JsonApi;
use LogicException;
abstract class AbstractSerializer implements ... |
Add to extras_require examples section | """setup.py"""
from codecs import open as codecs_open
from setuptools import setup
with codecs_open('README.rst', 'r', 'utf-8') as f:
README = f.read()
with codecs_open('HISTORY.rst', 'r', 'utf-8') as f:
HISTORY = f.read()
setup(
name='jsonrpcserver',
version='3.4.0',
description='Process JSON-R... | """setup.py"""
from codecs import open as codecs_open
from setuptools import setup
with codecs_open('README.rst', 'r', 'utf-8') as f:
README = f.read()
with codecs_open('HISTORY.rst', 'r', 'utf-8') as f:
HISTORY = f.read()
setup(
name='jsonrpcserver',
version='3.4.0',
description='Process JSON-R... |
Enable a 'now' property for the PollingDataStream | import logging
from datetime import timedelta
from twisted.internet.task import LoopingCall
from moksha.hub.hub import MokshaHub
log = logging.getLogger('moksha.hub')
class DataStream(object):
""" The parent DataStream class. """
def __init__(self):
self.hub = MokshaHub()
def send_message(self... | import logging
from datetime import timedelta
from twisted.internet.task import LoopingCall
from moksha.hub.hub import MokshaHub
log = logging.getLogger('moksha.hub')
class DataStream(object):
""" The parent DataStream class. """
def __init__(self):
self.hub = MokshaHub()
def send_message(self... |
Use DateTime so that Interval s can be compared easily | package edu.deanza.calendar.models;
import org.joda.time.DateTime;
import org.json.JSONException;
import org.json.JSONObject;
/**
* Created by Sara on 5/28/2016.
*/
public class Event {
protected String name, description, location;
protected DateTime startTime, endTime;
// TODO: implement `categories`... | package edu.deanza.calendar.models;
import org.joda.time.LocalTime;
import org.json.JSONException;
import org.json.JSONObject;
/**
* Created by Sara on 5/28/2016.
*/
public class Event {
protected String name, description, location;
protected LocalTime startTime, endTime;
// TODO: implement `categorie... |
Fix statistics link visible, in Controller all action has permission `manage` but link visible was `support` | <?php
/**
* HiPanel tickets module
*
* @link https://github.com/hiqdev/hipanel-module-ticket
* @package hipanel-module-ticket
* @license BSD-3-Clause
* @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
*/
namespace hipanel\modules\ticket\menus;
use Yii;
class SidebarMenu extends \hiqdev... | <?php
/**
* HiPanel tickets module
*
* @link https://github.com/hiqdev/hipanel-module-ticket
* @package hipanel-module-ticket
* @license BSD-3-Clause
* @copyright Copyright (c) 2015-2017, HiQDev (http://hiqdev.com/)
*/
namespace hipanel\modules\ticket\menus;
use Yii;
class SidebarMenu extends \hiqdev... |
Remove reports from navigation in layout view | <!DOCTYPE html>
<html>
<head>
<title>Budget</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Nunito+Sans:400,400i" />
<link rel="stylesheet" href="/style.css" />
</head>
<body>
... | <!DOCTYPE html>
<html>
<head>
<title>Budget</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Nunito+Sans:400,400i" />
<link rel="stylesheet" href="/style.css" />
</head>
<body>
... |
Revert "Change return type hinting to reference the Proxy class"
This reverts commit 9ea4df8541c682097304bc9b1b42f68307f8d57e. | <?php
declare(strict_types=1);
namespace ProxyManager\ProxyGenerator\NullObject\MethodGenerator;
use ProxyManager\Generator\MethodGenerator;
use ProxyManager\ProxyGenerator\Util\Properties;
use ReflectionClass;
use ReflectionProperty;
use Zend\Code\Generator\Exception\InvalidArgumentException;
use function array_map... | <?php
declare(strict_types=1);
namespace ProxyManager\ProxyGenerator\NullObject\MethodGenerator;
use ProxyManager\Generator\MethodGenerator;
use ProxyManager\ProxyGenerator\Util\Properties;
use ReflectionClass;
use ReflectionProperty;
use Zend\Code\Generator\Exception\InvalidArgumentException;
use function array_map... |
Fix avatar on other pages.
The styling wasn't being set on the parent container so you ended up
with weird things. | // @flow
import React, {Component} from 'react'
import resolveRoot from '../../desktop/resolve-root'
import {globalColorsDZ2} from '../styles/style-guide'
import type {Props} from './avatar'
const noAvatar = `file:///${resolveRoot('shared/images/icons/placeholder-avatar@2x.png')}`
export default class Avatar extends... | // @flow
import React, {Component} from 'react'
import resolveRoot from '../../desktop/resolve-root'
import {globalColorsDZ2} from '../styles/style-guide'
import type {Props} from './avatar'
const noAvatar = `file:///${resolveRoot('shared/images/icons/placeholder-avatar@2x.png')}`
export default class Avatar extends... |
Update marker call for pytest 3.6+ | # -*- coding: utf-8 -*-
import sys
import pytest
class ExpectedException(Exception):
pass
class ExpectedMessage(Exception):
pass
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_call(item):
outcome = yield
raises_marker = item.get_closest_marker('raises')
if raises_marker:
except... | # -*- coding: utf-8 -*-
import sys
import pytest
class ExpectedException(Exception):
pass
class ExpectedMessage(Exception):
pass
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_call(item):
outcome = yield
raises_marker = item.get_marker('raises')
if raises_marker:
exception = ra... |
Fix autologin for versioned feeds. | /**
* Automatically log in a user with a userId and key, so they can view/upload to a feedsource.
*/
var app = require('application');
module.exports = function () {
var feedSourceId, feedVersionId, userId, key;
// yes, this is in fact four arguments, not five, but the Bootstrap router throws an extra null... | /**
* Automatically log in a user with a userId and key, so they can view/upload to a feedsource.
*/
var app = require('application');
module.exports = function () {
var feedSourceId, feedVersionId, userId, key;
if (arguments.length == 4) {
feedSourceId = arguments[0];
feedVersionId = argume... |
Remove empty string from requirements list
When we moved to Python 3 we used this simpler method to read the requirements
file. However we need to remove the empty/Falsey elements from the list.
This fixes the error:
```
Failed building wheel for molo.yourwords
``` | from setuptools import setup, find_packages
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('requirements.txt') as req_file:
requires = [req for req in req_file.read().split('\n') if req]
with open('requirements-dev.txt') as req_file:
requires_dev = [req for req in req_file.... | from setuptools import setup, find_packages
with open('README.rst') as readme_file:
readme = readme_file.read()
with open('requirements.txt') as req_file:
requires = req_file.read().split('\n')
with open('requirements-dev.txt') as req_file:
requires_dev = req_file.read().split('\n')
with open('VERSION')... |
Update autocomplete spec to use <ol> | /*global describe, beforeEach, module, inject, it, spyOn, expect, $, console */
describe('dfAutocompleteDatalist', function() {
'use strict';
var scope, $compile;
beforeEach(module('dataform.directives'));
beforeEach(inject(function(_$rootScope_, _$compile_, _$window_) {
scope = _$rootScope_.$new();
$... | /*global describe, beforeEach, module, inject, it, spyOn, expect, $, console */
describe('dfAutocompleteDatalist', function() {
'use strict';
var scope, $compile;
beforeEach(module('dataform.directives'));
beforeEach(inject(function(_$rootScope_, _$compile_, _$window_) {
scope = _$rootScope_.$new();
$... |
Allow multiple sorting criteria. Reverse specific to each field | 'use strict';
(
function(angular) {
return angular
.module('ngOrderObjectBy', [])
.filter('orderObjectBy', function() {
return function (items, fields) {
if(!Array.isArray(fields))
{
fields = [fields];
}
function isNumeric(n) {
... | 'use strict';
(
function(angular) {
return angular
.module('ngOrderObjectBy', [])
.filter('orderObjectBy', function() {
return function (items, field, reverse) {
function isNumeric(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
}
var fi... |
Raise NotImplemented if methods aren't overridden | # -*- mode: python; indent-tabs-mode: nil -*-
class Connection(object):
"""Interface for receiver connections.
A receiver connection is something that can send messages (filter requests,
multilateration results) to a particular receiver. A single connection
may handle only a single receiver, or may m... | # -*- mode: python; indent-tabs-mode: nil -*-
class Connection(object):
"""Interface for receiver connections.
A receiver connection is something that can send messages (filter requests,
multilateration results) to a particular receiver. A single connection
may handle only a single receiver, or may m... |
Update Python/Django: Admin queryset -> get_queryset | from django.contrib import admin
from timepiece.contracts.models import ProjectContract, ContractHour,\
ContractAssignment, HourGroup
class ContractAssignmentInline(admin.TabularInline):
model = ContractAssignment
raw_id_fields = ('user',)
def get_queryset(self, request):
qs = super(Cont... | from django.contrib import admin
from timepiece.contracts.models import ProjectContract, ContractHour,\
ContractAssignment, HourGroup
class ContractAssignmentInline(admin.TabularInline):
model = ContractAssignment
raw_id_fields = ('user',)
def queryset(self, request):
qs = super(Contract... |
Use .get methods when retrieving uuid keys | #!/usr/bin/env python
import argparse
from bioblend import galaxy
import json
def main():
"""
This script uses bioblend to import .ga workflow files into a running instance of Galaxy
"""
parser = argparse.ArgumentParser()
parser.add_argument("-w", "--workflow_path", help='Path to workflow file... | #!/usr/bin/env python
import argparse
from bioblend import galaxy
import json
def main():
"""
This script uses bioblend to import .ga workflow files into a running instance of Galaxy
"""
parser = argparse.ArgumentParser()
parser.add_argument("-w", "--workflow_path", help='Path to workflow file'... |
Set EAV form class name to match EAV model name
(for easier debugging, at least in theory) | from django import forms
from django.core.exceptions import ValidationError
from cyder.base.eav.constants import ATTRIBUTE_TYPES
from cyder.base.eav.models import Attribute
def get_eav_form(eav_model, entity_model):
class EAVForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
if 'inst... | from django import forms
from django.core.exceptions import ValidationError
from cyder.base.eav.constants import ATTRIBUTE_TYPES
from cyder.base.eav.models import Attribute
def get_eav_form(eav_model, entity_model):
class EAVForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
if 'inst... |
Add specification of output directory from command line | #!/usr/bin/env python
# Grab runs from S3 and do analysis
#
# Daniel Klein, 2015-08-14
import sys
import subprocess
import glob
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('remote_dir', help = 'S3 directory with completed runs')
parser.add_argument('output_dir', help = 'Local destination f... | #!/usr/bin/env python
# Grab runs from S3 and do analysis
#
# Daniel Klein, 2015-08-14
import sys
import subprocess
import glob
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('remote_dir', help = 'S3 directory with completed runs')
parser.add_argument('run_ids', help = 'IDs of runs to analyze... |
Fix missing notifications in Rooms | var Rooms = {
anonymous_room: false,
refresh: function() {
var items = document.querySelectorAll('#rooms_widget ul li:not(.subheader)');
var i = 0;
while(i < items.length)
{
if(items[i].dataset.jid != null) {
items[i].onclick = function(e) {
... | var Rooms = {
anonymous_room: false,
refresh: function() {
var items = document.querySelectorAll('#rooms_widget ul li:not(.subheader)');
var i = 0;
while(i < items.length)
{
if(items[i].dataset.jid != null) {
items[i].onclick = function(e) {
... |
Remove square bracket array syntax for 5.3 compatibility | <?php
namespace spec\PhpSpec\Wrapper\Subject;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use PhpSpec\Formatter\Presenter\PresenterInterface;
class WrappedObjectSpec extends ObjectBehavior
{
function let(PresenterInterface $presenter)
{
$this->beConstructedWith(null, $presenter);
}
f... | <?php
namespace spec\PhpSpec\Wrapper\Subject;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
use PhpSpec\Formatter\Presenter\PresenterInterface;
class WrappedObjectSpec extends ObjectBehavior
{
function let(PresenterInterface $presenter)
{
$this->beConstructedWith(null, $presenter);
}
f... |
Update the send email command to use email manager | <?php
namespace Forex\Bundle\EmailBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class SendEmailCommand extends ContainerAwar... | <?php
namespace Forex\Bundle\EmailBundle\Command;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class SendEmailCommand extends ContainerAwar... |
Update GitVersion provider to use Process array | <?php
declare(strict_types=1);
/**
* This file is part of Laravel Zero.
*
* (c) Nuno Maduro <enunomaduro@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace LaravelZero\Framework\Providers\GitVersion;
use Ill... | <?php
declare(strict_types=1);
/**
* This file is part of Laravel Zero.
*
* (c) Nuno Maduro <enunomaduro@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace LaravelZero\Framework\Providers\GitVersion;
use Ill... |
Add mbstring option to atoum configuration | <?php
namespace jubianchi\PhpSwitch\PHP\Option;
use Symfony\Component\Console\Input\InputOption;
use jubianchi\PhpSwitch\Console\Command\Command;
use jubianchi\PhpSwitch\PHP\Option\Enable;
class AtoumOption extends Option
{
const ARG = 'atoum';
/**
* @param \jubianchi\PhpSwitch\Console\Command\Command $... | <?php
namespace jubianchi\PhpSwitch\PHP\Option;
use Symfony\Component\Console\Input\InputOption;
use jubianchi\PhpSwitch\Console\Command\Command;
use jubianchi\PhpSwitch\PHP\Option\Enable;
class AtoumOption extends Option
{
const ARG = 'atoum';
/**
* @param \jubianchi\PhpSwitch\Console\Command\Command $... |
Fix for missing view in design doc
My Cloudant DB that I replicated to Pouch has design docs with no views present (for some reason).
Fixes nolanlawson/pouchdb-find#100. | 'use strict';
var utils = require('../../../utils');
var localUtils = require('../utils');
var massageIndexDef = localUtils.massageIndexDef;
function getIndexes(db) {
// just search through all the design docs and filter in-memory.
// hopefully there aren't that many ddocs.
return db.allDocs({
startkey: '_... | 'use strict';
var utils = require('../../../utils');
var localUtils = require('../utils');
var massageIndexDef = localUtils.massageIndexDef;
function getIndexes(db) {
// just search through all the design docs and filter in-memory.
// hopefully there aren't that many ddocs.
return db.allDocs({
startkey: '_... |
Remove no-cover from __str__ method | from canvas_object import CanvasObject
from util import combine_kwargs
class Assignment(CanvasObject):
def __str__(self):
return "{} ({})".format(self.name, self.id)
def delete(self):
"""
Delete this assignment.
:calls: `DELETE /api/v1/courses/:course_id/assignments/:id \
... | from canvas_object import CanvasObject
from util import combine_kwargs
class Assignment(CanvasObject):
def __str__(self): # pragma: no cover
return "{} ({})".format(self.name, self.id)
def delete(self):
"""
Delete this assignment.
:calls: `DELETE /api/v1/courses/:course_id/... |
Remove hard coded experiment description. Remove done field and add status field since that is what we get from the backend. | export class ExperimentStep {
constructor(title, _type) {
this.id = '';
this.title = title;
this._type = _type;
this.steps = [];
this.description = '';
this.flags = {
important: false,
review: false,
error: false,
done: ... | export class ExperimentStep {
constructor(title, _type) {
this.id = '';
this.title = title;
this._type = _type;
this.steps = [];
this.description = '';
this.flags = {
important: false,
review: false,
error: false,
done: ... |
Remove suit_dashboard from INSTALLED_APPS causing py35 tests breaking as no models | # -*- coding: utf-8 -*-
"""
Entry point for Django tests.
This script will setup the basic configuration needed by Django.
"""
import sys
from os.path import abspath, dirname, join
try:
from django.conf import settings
from django.test.utils import get_runner
settings.configure(
DEBUG=True,
... | # -*- coding: utf-8 -*-
"""
Entry point for Django tests.
This script will setup the basic configuration needed by Django.
"""
import sys
from os.path import abspath, dirname, join
try:
from django.conf import settings
from django.test.utils import get_runner
settings.configure(
DEBUG=True,
... |
Set the application object into the controller too. | <?php
namespace App;
class Slim extends \Slim\Slim
{
public function mapRoute($args)
{
$callable = array_pop($args);
if (is_string($callable) && strpos($callable, ':')) {
$callable = $this->createControllerCallable($callable);
}
$args[] = $callable;
return ... | <?php
namespace App;
class Slim extends \Slim\Slim
{
public function mapRoute($args)
{
$callable = array_pop($args);
if (is_string($callable) && strpos($callable, ':')) {
$callable = $this->createControllerCallable($callable);
}
$args[] = $callable;
return ... |
Remove removed id property from storage annotation | package de.espend.idea.laravel;
import com.intellij.openapi.components.*;
import com.intellij.openapi.project.Project;
import com.intellij.util.xmlb.XmlSerializerUtil;
import de.espend.idea.laravel.view.dict.TemplatePath;
import org.apache.commons.lang.StringUtils;
import org.jetbrains.annotations.Nullable;
import ja... | package de.espend.idea.laravel;
import com.intellij.openapi.components.*;
import com.intellij.openapi.project.Project;
import com.intellij.util.xmlb.XmlSerializerUtil;
import de.espend.idea.laravel.view.dict.TemplatePath;
import org.apache.commons.lang.StringUtils;
import org.jetbrains.annotations.Nullable;
import ja... |
Remove console.log left from debug | CenterScout.factory('gradeData', ['$http', '$q', function($http, $q) {
var grades = null;
return function() {
var deferred = $q.defer();
if(grades) {
deferred.resolve(grades);
} else {
$http.get('http://localhost:8080/api/grades')
.success(functi... | CenterScout.factory('gradeData', ['$http', '$q', function($http, $q) {
var grades = null;
return function() {
var deferred = $q.defer();
console.log(deferred);
if(grades) {
deferred.resolve(grades);
} else {
$http.get('http://localhost:8080/api/grades')... |
Add simple test for column expansion | from django.test import SimpleTestCase
from jsonobject.exceptions import BadValueError
from sqlagg import SumWhen
from corehq.apps.userreports.sql import _expand_column
from corehq.apps.userreports.reports.specs import ReportColumn
class TestReportColumn(SimpleTestCase):
def testBadAggregation(self):
wit... | from django.test import SimpleTestCase
from jsonobject.exceptions import BadValueError
from corehq.apps.userreports.reports.specs import ReportColumn
class TestReportColumn(SimpleTestCase):
def testBadAggregation(self):
with self.assertRaises(BadValueError):
ReportColumn.wrap({
... |
Fix generator path for service provider | <?php namespace Pingpong\Modules\Commands;
use Illuminate\Support\Str;
use Pingpong\Generators\Stub;
use Pingpong\Modules\Traits\ModuleCommandTrait;
use Symfony\Component\Console\Input\InputArgument;
class GenerateProviderCommand extends GeneratorCommand {
use ModuleCommandTrait;
/**
* The console comm... | <?php namespace Pingpong\Modules\Commands;
use Illuminate\Support\Str;
use Pingpong\Generators\Stub;
use Pingpong\Modules\Traits\ModuleCommandTrait;
use Symfony\Component\Console\Input\InputArgument;
class GenerateProviderCommand extends GeneratorCommand {
use ModuleCommandTrait;
/**
* The console comm... |
Fix markdown explorer for local links. | markdown_explorer = (function() {
var isLocalHref = function(href) {
return href.indexOf("://") === -1;
};
var isMarkdownHref = function(href) {
return href.indexOf(".md") !== -1;
};
var makeLinksHandleMarkdown = function(element, directory) {
element.find('a').click(funct... | markdown_explorer = (function() {
var isLocalHref = function(href) {
return href.indexOf("://") === -1;
};
var isMarkdownHref = function(href) {
return href.indexOf(".md") !== -1;
};
var makeLinksHandleMarkdown = function(element, directory) {
element.find('a').click(functi... |
Add isolate scope to permission directive. | (function () {
'use strict';
/**
* Show/hide elements based on provided permissions/roles
*
* @example
* <div permission only="'USER'"></div>
* <div permission only="['USER','ADMIN']" except="'MANAGER'"></div>
* <div permission except="'MANAGER'"></div>
*/
angular
.module('permission')
... | (function () {
'use strict';
/**
* Show/hide elements based on provided permissions/roles
*
* @example
* <div permission only="'USER'"></div>
* <div permission only="['USER','ADMIN']" except="'MANAGER'"></div>
* <div permission except="'MANAGER'"></div>
*/
angular
.module('permission')
... |
Fix callback erroneously filtered out
The tick from pigpio wraps aroud after xFFFFFFFF,
approximately 1h13. When it wraps the delay was not computed
correctly, causing all following calls to be filtered out. | import functools
def Debounce(threshold=100):
"""
Simple debouncing decorator for apigpio callbacks.
Example:
`@Debouncer()
def my_cb(gpio, level, tick)
print('gpio cb: {} {} {}'.format(gpio, level, tick))
`
The threshold can be given to the decorator as an argument (in millis... | import functools
def Debounce(threshold=100):
"""
Simple debouncing decorator for apigpio callbacks.
Example:
`@Debouncer()
def my_cb(gpio, level, tick)
print('gpio cb: {} {} {}'.format(gpio, level, tick))
`
The threshold can be given to the decorator as an argument (in millis... |
Update with lab app registration | // Config object to be passed to Msal on creation
const msalConfig = {
auth: {
clientId: "5dac5d6d-225c-4a98-a5e4-e29c82c0c4c9",
authority: "https://public.msidlabb2c.com/tfp/cpimtestpartners.onmicrosoft.com/b2c_1_signupsignin_userflow",
knownAuthorities: ["public.msidlabb2c.com"]
},
... | // Config object to be passed to Msal on creation
const msalConfig = {
auth: {
clientId: "e760cab2-b9a1-4c0d-86fb-ff7084abd902",
authority: "https://fabrikamb2c.b2clogin.com/fabrikamb2c.onmicrosoft.com/b2c_1_susi",
knownAuthorities: ["fabrikamb2c.b2clogin.com"]
},
cache: {
ca... |
Make api_key of ApiKey required | @extends('layouts.app')
@section('title', '新增ApiKey')
@section('content')
<div class="mt-3 pb-3">
<div class="col-md-8 offset-md-2">
<h1>新增ApiKey</h1>
<div class="card">
<div class="card-block">
{{ Form::open(['route' => 'api-key.store']) }}
... | @extends('layouts.app')
@section('title', '新增ApiKey')
@section('content')
<div class="mt-3 pb-3">
<div class="col-md-8 offset-md-2">
<h1>新增ApiKey</h1>
<div class="card">
<div class="card-block">
{{ Form::open(['route' => 'api-key.store']) }}
... |
Add function within nested commandgroup to testcase | import expect from 'expect';
import isCommand from '../../../../src/cli/commands/helpers/isCommand';
describe('cli', () => {
describe('commands', () => {
describe('helpers', () => {
describe('isCommand', () => {
const commandsObject = {
meta: {
... | import expect from 'expect';
import isCommand from '../../../../src/cli/commands/helpers/isCommand';
describe('cli', () => {
describe('commands', () => {
describe('helpers', () => {
describe('isCommand', () => {
const commandsObject = {
meta: {
... |
Use readme as the long description in pypi | #!/usr/bin/env python3
import version
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open("docs/README.md", "r") as fh:
long_description = fh.read()
with open('requirements.txt') as f:
requirements = f.read().splitlines()
setup(name='robotframework-zoomb... | #!/usr/bin/env python3
import version
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
with open('requirements.txt') as f:
requirements = f.read().splitlines()
setup(name='robotframework-zoomba',
version=version.VERSION,
description='Robot Framework mini... |
Revert "x,y should be y,x"
This reverts commit 7636eb6ce4f23c6f787aed02590499b6d2ea60b2. | #!/usr/bin/env python
"""
Contains player and NPC-classes.
"""
import logging
from Item import Item
class Person(object):
"""
Base class for all characters in game.
"""
DEFAULT_HEALTH = 100
def __init__(self, health=DEFAULT_HEALTH, position):
"""
Defaults to facing north. Facing c... | #!/usr/bin/env python
"""
Contains player and NPC-classes.
"""
import logging
from Item import Item
class Person(object):
"""
Base class for all characters in game.
"""
DEFAULT_HEALTH = 100
def __init__(self, health=DEFAULT_HEALTH, position):
"""
Defaults to facing north. Facing c... |
Add comment about borschik usage | 'use strict';
var BORSCHIK_CSS_TECH = require('borschik/lib/techs/css'),
Q = require('q');
exports.API_VER = 2;
exports.techMixin = {
getBuildResultChunk : function(relPath) {
return '@import url(' + relPath + ');\n';
},
getBuildSuffixesMap: function() {
return {
css: ['... | 'use strict';
var BORSCHIK_CSS_TECH = require('borschik/lib/techs/css'),
Q = require('q');
exports.API_VER = 2;
exports.techMixin = {
getBuildResultChunk : function(relPath) {
return '@import url(' + relPath + ');\n';
},
getBuildSuffixesMap: function() {
return {
css: ['... |
Remove now-extra specific excision of the version_info query string - the
"bare" option is invoked to do the job. | /**
* FileVersionModel.js
*/
(function (spiderOakApp, window, undefined) {
"use strict";
var console = window.console || {};
console.log = console.log || function(){};
var Backbone = window.Backbone,
_ = window._,
$ = window.$;
spiderOakApp.FileVersionModel = spiderOakApp... | /**
* FileVersionModel.js
*/
(function (spiderOakApp, window, undefined) {
"use strict";
var console = window.console || {};
console.log = console.log || function(){};
var Backbone = window.Backbone,
_ = window._,
$ = window.$;
spiderOakApp.FileVersionModel = spiderOakApp... |
Return the correctly formatted error message | "use strict";
var JSHINT = require("jshint").JSHINT,
assert = require("assert"),
glob = require("glob"),
path = require("path"),
fs = require("fs"),
_ = require('underscore');
var projectDir = path.normalize(path.join(__dirname, '..'));
var jsFiles = glob.sync(
"**/*.js",
{ cwd:... | "use strict";
var JSHINT = require("jshint").JSHINT,
assert = require("assert"),
glob = require("glob"),
path = require("path"),
fs = require("fs"),
_ = require('underscore');
var projectDir = path.normalize(path.join(__dirname, '..'));
var jsFiles = glob.sync(
"**/*.js",
{ cwd:... |
tests: Disable some PHP insights sniffs | <?php
declare(strict_types=1);
return [
/*
|--------------------------------------------------------------------------
| Default Preset
|--------------------------------------------------------------------------
|
| This option controls the default preset that will be used by PHP Insights
... | <?php
declare(strict_types=1);
return [
/*
|--------------------------------------------------------------------------
| Default Preset
|--------------------------------------------------------------------------
|
| This option controls the default preset that will be used by PHP Insights
... |
Use Django's default update method | from django.conf import settings
from django.db import models
class ModelBase(models.Model):
"""Base class for SUMO models.
* Adds objects_range class method.
* Adds update method.
"""
class Meta:
abstract = True
@classmethod
def objects_range(cls, before=None, after=None):
... | from django.conf import settings
from django.db import models
class ModelBase(models.Model):
"""Base class for SUMO models.
* Adds objects_range class method.
* Adds update method.
"""
class Meta:
abstract = True
@classmethod
def objects_range(cls, before=None, after=None):
... |
Stop checking if name is jude | <?php
namespace Jmlamo\DemoBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Component\... | <?php
namespace Jmlamo\DemoBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Component\... |
Remove default value for domain configuration | <?php
namespace Nasyrov\Laravel\Imgix;
use Illuminate\Support\ServiceProvider;
use Imgix\ShardStrategy;
use Imgix\UrlBuilder;
class ImgixServiceProvider extends ServiceProvider
{
const ALIAS = 'imgix';
/**
* Bootstrap any application services.
*/
public function boot()
{
$configFil... | <?php
namespace Nasyrov\Laravel\Imgix;
use Illuminate\Support\ServiceProvider;
use Imgix\ShardStrategy;
use Imgix\UrlBuilder;
class ImgixServiceProvider extends ServiceProvider
{
const ALIAS = 'imgix';
/**
* Bootstrap any application services.
*/
public function boot()
{
$configFil... |
Apply position on mesh, not geometry | (function () {
"use strict";
var Frame = function (elem) {
if (typeof elem === 'string') {
elem = document.getElementById(elem);
}
var height = elem.scrollHeight;
var width = elem.scrollWidth;
var viewAngle = 45;
var aspect = width / (1.0 * height);... | (function () {
"use strict";
var Frame = function (elem) {
if (typeof elem === 'string') {
elem = document.getElementById(elem);
}
var height = elem.scrollHeight;
var width = elem.scrollWidth;
var viewAngle = 45;
var aspect = width / (1.0 * height);... |
Support of old profile names | # -*- coding: utf-8 -*-
'''Generates the main page.'''
import re
from google.appengine.ext import webapp
import vkfeed.util
class MainPage(webapp.RequestHandler):
'''Generates the main page.'''
def get(self):
'''Processes a GET request.'''
self.response.out.write(vkfeed.util.render_temp... | # -*- coding: utf-8 -*-
'''Generates the main page.'''
import re
from google.appengine.ext import webapp
import vkfeed.util
class MainPage(webapp.RequestHandler):
'''Generates the main page.'''
def get(self):
'''Processes a GET request.'''
self.response.out.write(vkfeed.util.render_temp... |
Handle case when response is None | import datetime
import decimal
from django.utils import timezone
def convert_tstamp(response, field_name=None):
try:
if field_name and response[field_name]:
return datetime.datetime.fromtimestamp(
response[field_name],
timezone.utc
)
if resp... | import datetime
import decimal
from django.utils import timezone
def convert_tstamp(response, field_name=None):
try:
if field_name and response[field_name]:
return datetime.datetime.fromtimestamp(
response[field_name],
timezone.utc
)
if not ... |
Add functionality to work with models using different database connections | <?php namespace GeneaLabs\LaravelGovernor\Listeners;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatingListener
{
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings(PHPMD.StaticAccess)
*/
... | <?php namespace GeneaLabs\LaravelGovernor\Listeners;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreatingListener
{
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings(PHPMD.StaticAccess)
*/
... |
Update to use L5 Directive | <?php namespace Rtablada\InspectorGadget;
use Illuminate\Support\ServiceProvider;
use Illuminate\View\Compilers\BladeCompiler;
class GadgetServiceProvider extends ServiceProvider
{
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->ap... | <?php namespace Rtablada\InspectorGadget;
use Illuminate\Support\ServiceProvider;
use Illuminate\View\Compilers\BladeCompiler;
class GadgetServiceProvider extends ServiceProvider
{
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->ap... |
Call sys.exit when pkg-config fails | #!/usr/bin/env python
from setuptools import setup, Extension
import string
import subprocess
import sys
sys.path.append('./test')
with open("README.md") as f:
long_description = f.read()
def cmd(line):
try:
output = subprocess.check_output(line, shell=True)
except subprocess.CalledProcessError:... | #!/usr/bin/env python
from setuptools import setup, Extension
import string
import sys
import os
sys.path.append('./test')
with open("README.md") as f:
long_description = f.read()
def cmd(line):
return os.popen(line).readlines()[0][:-1].split()
setup(name = 'sentencepiece',
author = 'Taku Kudo',
... |
Read Neo4j config from ENV if present | # -*- coding: utf-8 -*-
import os
from django.apps import AppConfig
from django.conf import settings
from django.db.models.signals import m2m_changed, post_migrate, post_save, pre_delete
from neomodel import config
config.AUTO_INSTALL_LABELS = False
class ChemTrailsConfig(AppConfig):
name = 'chemtrails'
... | # -*- coding: utf-8 -*-
from django.apps import AppConfig
from django.conf import settings
from django.db.models.signals import m2m_changed, post_migrate, post_save, pre_delete
from neomodel import config
config.AUTO_INSTALL_LABELS = False
class ChemTrailsConfig(AppConfig):
name = 'chemtrails'
def ready(s... |
Fix sidebar scrollbar not being displayed on slideshow edit on Chrome 53. | /*global angular, removeLocationFromFilter*/
/*jslint nomen: true, es5: true */
angular.module('slideshows').directive('slideshowSlidesHeightSetter', ['$window', '$timeout', '$rootScope', function ($window, $timeout, $rootScope) {
'use strict';
function link(scope, element, attrs) {
var window = angula... | /*global angular, removeLocationFromFilter*/
/*jslint nomen: true, es5: true */
angular.module('slideshows').directive('slideshowSlidesHeightSetter', ['$window', '$timeout', '$rootScope', function ($window, $timeout, $rootScope) {
'use strict';
function link(scope, element, attrs) {
var window = angula... |
PROC-690: Fix to use ImmutableSet to avoid being modified via getter | package com.indeed.proctor.common.dynamic;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableSet;
import com.indeed.proctor.common.model.ConsumableTestDefinition;
import org.... | package com.indeed.proctor.common.dynamic;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonTypeName;
import com.google.common.base.Preconditions;
import com.indeed.proctor.common.model.ConsumableTestDefinition;
import org.springframework.util.CollectionUtils;
import j... |
Make loading config file safer | import os
import logging
import yaml
from pathlib import Path
class ConfigurationCore:
config_from_file = None
def __init__(self, config_path=None):
try:
if not config_path:
config_path = os.path.join(Path.home(), '.gitlabform', 'config.yml')
elif config_path ... | import os
import logging
import yaml
from pathlib import Path
class ConfigurationCore:
config_from_file = None
def __init__(self, config_path=None):
try:
if not config_path:
config_path = os.path.join(Path.home(), '.gitlabform', 'config.yml')
elif config_path ... |
Add request_rectange to HybridLayoutDemo - no clue why this never was here, but it stops it actually working | from base import SubLayout, Rect
from sublayouts import VerticalStack, Floating
from subtile import SubTile
class HybridLayoutDemo(SubLayout):
def _init_sublayouts(self):
class TopWindow(VerticalStack):
def filter_windows(self, windows):
windows = [w for w in windows if w.name ... | from base import SubLayout, Rect
from sublayouts import VerticalStack, Floating
from subtile import SubTile
class HybridLayoutDemo(SubLayout):
def _init_sublayouts(self):
class TopWindow(VerticalStack):
def filter_windows(self, windows):
windows = [w for w in windows if w.name ... |
Allow Postgres DB driver to return the list of tables | async function postgres_sql(args) {
/*
description("Postgres function")
base_component_id("postgres_server")
load_once_from_file(true)
only_run_on_server(true)
*/
var config = {
user: args.user,
database: args.database,
password: args.password,
host: ... | async function postgres_sql(args) {
/*
description("Postgres function")
base_component_id("postgres_server")
load_once_from_file(true)
only_run_on_server(true)
*/
var config = {
user: args.user,
database: args.database,
password: args.password,
host: ... |
Fix french sentence in en lang file | <?php
return [
'vendor' => 'Log viewer by <a href="https://github.com/ARCANEDEV/LogViewer">Arcanedev</a>',
'menu' => [
'category' => "Logs",
'stats' => 'Statistics',
'reports' => 'Reports'
],
'stats' => [
'entries' => ':count entries - :percent %'
],
'... | <?php
return [
'vendor' => 'Log viewer by <a href="https://github.com/ARCANEDEV/LogViewer">Arcanedev</a>',
'menu' => [
'category' => "Logs",
'stats' => 'Statistics',
'reports' => 'Reports'
],
'stats' => [
'entries' => ':count entries - :percent %'
],
'... |
Hide delete button on subsequent tabs | function removeRedundantTabs() {
var t = 0;
if (django && django.jQuery) {
django
.jQuery('.changeform-tabs-item:contains("General")')
.each(function(index, tab) {
t++;
if (t > 1) {
tab.remove();
}
});
}
}
function addHashToInlinePaginator() {
// Make sur... | function removeRedundantTabs() {
var t = 0;
if (django && django.jQuery) {
django.jQuery('.changeform-tabs-item:contains("General")').each(function(index, tab){
t++;
if (t > 1) {
tab.remove();
}
});
}
}
function addHashToInlinePaginator() ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.