text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Add init process as default | import sys
import RPi.GPIO as GPIO
# Register Pin number
enable1 = 22
input1a = 18
input1b = 16
def control(arg):
if arg == 'init':
GPIO.setmode(GPIO.BOARD)
GPIO.setup(enable1, GPIO.OUT)
GPIO.setup(input1a, GPIO.OUT)
GPIO.setup(input1b, GPIO.OUT)
elif arg == 'forward':
... | import sys
import RPi.GPIO as GPIO
# Register Pin number
enable1 = 22
input1a = 18
input1b = 16
def control(arg):
if arg == 'init':
GPIO.setmode(GPIO.BOARD)
GPIO.setup(enable1, GPIO.OUT)
GPIO.setup(input1a, GPIO.OUT)
GPIO.setup(input1b, GPIO.OUT)
elif arg == 'forward':
... |
Test if const CLIENT is valid | <?php
namespace Moip\Tests;
use Moip\Tests\MoipTestCase;
/**
* class MoipTest
*/
class MoipTest extends MoipTestCase
{
/**
* Test if endpoint production is valid.
*/
public function testShouldReceiveEndpointProductionIsValid()
{
$endpoint_production = 'api.moip.com.br';
$const_endpoint_production = consta... | <?php
namespace Moip\Tests;
use Moip\Tests\MoipTestCase;
/**
* class MoipTest
*/
class MoipTest extends MoipTestCase
{
/**
* Test if endpoint production is valid.
*/
public function testShouldReceiveEndpointProductionIsValid()
{
$endpoint_production = 'api.moip.com.br';
$const_endpoint_production = consta... |
Add source maps to tests | module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['jasmine', 'browserify'],
files: [
'test/*'
],
reporters: ['progress', 'coverage'],
port: 9876,
runnerPort: 9100,
colors: true,
logLevel: config.LOG_DEBUG,
autoWatch: true,
browsers: ['Phantom... | module.exports = function(config) {
config.set({
basePath: '',
frameworks: ['jasmine', 'browserify'],
files: [
'test/*'
],
reporters: ['progress', 'coverage'],
port: 9876,
runnerPort: 9100,
colors: true,
logLevel: config.LOG_DEBUG,
autoWatch: true,
browsers: ['Phantom... |
Update dsub version to 0.3.11.dev0
PiperOrigin-RevId: 324910070 | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | # Copyright 2017 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... |
Add temporary limit to Cover view to stop rebuilding artwork
TODO: Implement lazy loading of images to that they aren't
all fetched initially! | /** @jsx React.DOM */
'use strict';
var React = require('react/addons');
var CollectionStore = require('../stores/CollectionStore.js');
var CollectionActions = require('../actions/CollectionActions.js');
var Covers = React.createClass({
getInitialState: function() {
return {
list: [],
};
},
comp... | /** @jsx React.DOM */
'use strict';
var React = require('react/addons');
var CollectionStore = require('../stores/CollectionStore.js');
var CollectionActions = require('../actions/CollectionActions.js');
var Covers = React.createClass({
getInitialState: function() {
return {
list: [],
};
},
comp... |
Add the utils module to the uncompiled whitelist.
PiperOrigin-RevId: 185733139 | # Copyright 2016 The TensorFlow 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 applica... | # Copyright 2016 The TensorFlow 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 applica... |
Refactor dependant-selector further and (conditionally) update TomSelect if present
I'm also introducing a convention here of adding a `private` comment to visually demarcate which methods are meant to be part of the public interface of the class and which aren't. The methods aren't *actually* private in any technical... | import { Controller } from "stimulus";
export default class extends Controller {
static targets = ["source", "select"];
static values = { options: Array };
handleSelectChange() {
this.populateSelect(parseInt(this.sourceTarget.value));
}
// private
populateSelect(sourceId) {
this.removeCurrentOpt... | import { Controller } from "stimulus";
export default class extends Controller {
static targets = ["source", "select"];
static values = { options: Array };
handleSelectChange() {
this.populateSelect(parseInt(this.sourceTarget.value));
}
populateSelect(sourceId) {
this.removeCurrentOptions()
th... |
Migrate from Form to FlaskForm | from flask_wtf import FlaskForm
from flask_wtf.csrf import CsrfProtect
from wtforms import StringField, IntegerField, SelectField, BooleanField
csrf = CsrfProtect()
class Submission(FlaskForm):
submission = StringField('Submission URL')
comments = BooleanField('Include comments')
comments_style = SelectF... | from flask_wtf import Form
from flask_wtf.csrf import CsrfProtect
from wtforms import StringField, IntegerField, SelectField, BooleanField
csrf = CsrfProtect()
class Submission(Form):
submission = StringField('Submission URL')
comments = BooleanField('Include comments')
comments_style = SelectField('Comm... |
Add support for ZStandard compression.
This is landing in Kafka 2.1.0, due for release 29th October, 2018.
References -
1. https://cwiki.apache.org/confluence/display/KAFKA/KIP-110%3A+Add+Codec+for+ZStandard+Compression
2. https://issues.apache.org/jira/browse/KAFKA-4514
3. https://github.com/apache/kafka/pull/2267
... | const { KafkaJSNotImplemented } = require('../../../errors')
const MESSAGE_CODEC_MASK = 0x3
const RECORD_BATCH_CODEC_MASK = 0x07
const Types = {
None: 0,
GZIP: 1,
Snappy: 2,
LZ4: 3,
ZSTD: 4,
}
const Codecs = {
[Types.GZIP]: () => require('./gzip'),
[Types.Snappy]: () => {
throw new KafkaJSNotImplem... | const { KafkaJSNotImplemented } = require('../../../errors')
const MESSAGE_CODEC_MASK = 0x3
const RECORD_BATCH_CODEC_MASK = 0x07
const Types = {
None: 0,
GZIP: 1,
Snappy: 2,
LZ4: 3,
}
const Codecs = {
[Types.GZIP]: () => require('./gzip'),
[Types.Snappy]: () => {
throw new KafkaJSNotImplemented('Snap... |
Add paratemers to mediaSession factory method | /*
* Kurento Commons MSControl: Simplified Media Control API for the Java Platform based on jsr309
* Copyright (C) 2012 Tikal Technologies
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3
* as published by the Free Software ... | /*
* Kurento Commons MSControl: Simplified Media Control API for the Java Platform based on jsr309
* Copyright (C) 2012 Tikal Technologies
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3
* as published by the Free Software ... |
Fix piechart on 0 chars | import {connect} from 'react-redux'
import {createSelector} from 'reselect'
import DemoPieChart from '../components/DemoPieChart'
import {countLetters} from '../utils/stringStats'
import {incrementRenderCount, piechartToggleFilter} from '../actions'
import toJS from '../toJS'
const getText = state => state.get('text')... | import {connect} from 'react-redux'
import {createSelector} from 'reselect'
import DemoPieChart from '../components/DemoPieChart'
import {countLetters} from '../utils/stringStats'
import {incrementRenderCount, piechartToggleFilter} from '../actions'
import toJS from '../toJS'
const getText = state => state.get('text')... |
Make internal urls relative (as before) | /*
Copyright 2016 The Fission 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 law or agreed to in writing, sof... | /*
Copyright 2016 The Fission 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 law or agreed to in writing, sof... |
Rename private variable to $handler | <?php
namespace Lily\Application;
class MiddlewareApplication
{
private $handler;
private $middleware;
public function __construct(array $pipeline)
{
$this->handler = array_shift($pipeline);
$this->middleware = $pipeline;
}
private function handler()
{
return $thi... | <?php
namespace Lily\Application;
class MiddlewareApplication
{
private $application;
private $middleware;
public function __construct(array $pipeline)
{
$this->handler = array_shift($pipeline);
$this->middleware = $pipeline;
}
private function handler()
{
return ... |
Remove pixel test fail expectation
This patch undo the failure expectation in
https://codereview.chromium.org/340603002/ and completes the rebaseline of the
pixel tests.
BUG=384551
Review URL: https://codereview.chromium.org/348853003
git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@278961 0039d316-1c4b-4281-b9... | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.page import test_expectations
# Valid expectation conditions are:
#
# Operating systems:
# win, xp, vista, win7, mac, leopard, snowleopar... | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.page import test_expectations
# Valid expectation conditions are:
#
# Operating systems:
# win, xp, vista, win7, mac, leopard, snowleopar... |
Make using AMD imports a linting error
Change-Id: I8c5073d660b808f6eb62432f914be71941253a80
Reviewed-on: https://gerrit.instructure.com/105000
Tested-by: Jenkins
Reviewed-by: Ryan Shaw <ea3cd978650417470535f3a4725b6b5042a6ab59@instructure.com>
Product-Review: Clay Diffrient <9dff2e5c98626d20d2848250c411e8009465bb87@in... | /*
* This file can be used to convey information to other eslint files inside
* Canvas.
*/
module.exports = {
globals: {
"ENV": true
},
plugins: [
"promise"
],
// 0 - off, 1 - warning, 2 - error
rules: {
"class-methods-use-this": [0],
"comma-dangle": [2, "only-multiline"],
"func-names":... | /*
* This file can be used to convey information to other eslint files inside
* Canvas.
*/
module.exports = {
globals: {
"ENV": true
},
plugins: [
"promise"
],
// 0 - off, 1 - warning, 2 - error
rules: {
"class-methods-use-this": [0],
"comma-dangle": [2, "only-multiline"],
"func-names":... |
Test execution: Remove unneeded variable | #! /bin/python3
"""
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be us... | #! /bin/python3
"""
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be us... |
Change module path for cluster evaluation and edit how to get original logs | # for local run, before pygraphc packaging
import sys
sys.path.insert(0, '../pygraphc/misc')
from LKE import *
sys.path.insert(0, '../pygraphc/evaluation')
from ExternalEvaluation import *
ip_address = '161.166.232.17'
standard_path = '/home/hudan/Git/labeled-authlog/dataset/' + ip_address
standard_file = standard_pat... | # for local run, before pygraphc packaging
import sys
sys.path.insert(0, '../pygraphc/misc')
from LKE import *
sys.path.insert(0, '../pygraphc/clustering')
from ClusterUtility import *
from ClusterEvaluation import *
ip_address = '161.166.232.17'
standard_path = '/home/hudan/Git/labeled-authlog/dataset/' + ip_address
... |
Update webhook handler example to use `http.MaxBytesReader`
Updates the webhook handler example to use `http.MaxBytesReader` to
protect against a malicious client streaming an endless request body.
We're making a similar change in our server side documentation examples,
so I'm updating this spot as well for consisten... | package webhook_test
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"github.com/stripe/stripe-go/webhook"
)
func Example() {
http.HandleFunc("/webhook", func(w http.ResponseWriter, req *http.Request) {
// Protects against a malicious client streaming us an endless requst
// body
const MaxBodyBytes = int64(6... | package webhook_test
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"github.com/stripe/stripe-go/webhook"
)
func Example() {
http.HandleFunc("/webhook", func(w http.ResponseWriter, req *http.Request) {
body, err := ioutil.ReadAll(req.Body)
if err != nil {
w.WriteHeader(http.StatusBadRequest)
return
}... |
Update collect ini script. Now it shows if field is required. | """
collect information about fields and values in ini file
usage run script with file name in directory with unpacked stats.
Script will collect data from all files with name.
You can specify path as second argument.
python get_ini_fields.py body.ini
python get_ini_fields.py body.ini "C:/games/warzone2100"
"""
i... | """
collect information about fields and values in ini file
usage run script with file name in directory with unpacked stats.
Script will collect data from all files with name.
You can specify path as second argument.
python get_ini_fields.py body.ini
python get_ini_fields.py body.ini "C:/games/warzone2100"
"""
i... |
Make this slightly less as simple as possible | <?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\Util\Metadata;
/**
* @internal This class is no... | <?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PHPUnit\Util\Metadata;
/**
* @internal This class is no... |
Increase HTTP request limit to allow for larger imports | /*
* Biodiversity Heritage Library
* A backend for collecting OCR corrections from BHL games.
* Copyright 2015 Tiltfactor
*/
(function() {
global.requireLocal = function(name) {
return require(__dirname + '/' + name);
};
})();
var express = require('express');
var bodyParser = require('body-parser');
v... | /*
* Biodiversity Heritage Library
* A backend for collecting OCR corrections from BHL games.
* Copyright 2015 Tiltfactor
*/
(function() {
global.requireLocal = function(name) {
return require(__dirname + '/' + name);
};
})();
var express = require('express');
var bodyParser = require('body-parser');
v... |
Remove name field from form | from django import forms
from .models import get_application_model
class AllowForm(forms.Form):
allow = forms.BooleanField(required=False)
redirect_uri = forms.CharField(widget=forms.HiddenInput())
scope = forms.CharField(required=False, widget=forms.HiddenInput())
client_id = forms.CharField(widget=... | from django import forms
from .models import get_application_model
class AllowForm(forms.Form):
allow = forms.BooleanField(required=False)
redirect_uri = forms.CharField(widget=forms.HiddenInput())
scope = forms.CharField(required=False, widget=forms.HiddenInput())
client_id = forms.CharField(widget=... |
Increase debounce for settings input | import { h, Component } from 'preact';
import style from './style';
function debounce(fn, delay) {
let timer = null;
return function () {
const context = this;
const args = arguments;
clearTimeout(timer);
timer = setTimeout(() => {
fn.apply(context, args);
}, delay);
};
}
export defaul... | import { h, Component } from 'preact';
import style from './style';
function debounce(fn, delay) {
let timer = null;
return function () {
const context = this;
const args = arguments;
clearTimeout(timer);
timer = setTimeout(() => {
fn.apply(context, args);
}, delay);
};
}
export defaul... |
Add data method to model | var Obstruct = require('obstruct');
var minivents = require('minivents');
var createGetter = require('./lib/createGet');
var createSetter = require('./lib/createSet');
var merge = require('./lib/merge');
var noop = function () {};
var Model = Obstruct.extend({
constructor: function (data) {
minivents(this);
... | var Obstruct = require('obstruct');
var minivents = require('minivents');
var createGetter = require('./lib/createGet');
var createSetter = require('./lib/createSet');
var merge = require('./lib/merge');
var noop = function () {};
var Model = Obstruct.extend({
constructor: function (data) {
minivents(this);
... |
Change to predict 'on demand' | // Entry point of the application
var parser = require('./parser');
var Renderer = require('./renderer');
var Interpreter = require('./interpreter');
var Predictor = require('./predictor');
var interpreter;
var renderer;
var predictor;
window.onload = function() {
var code = document.getElementById('source').inner... | // Entry point of the application
var parser = require('./parser');
var Renderer = require('./renderer');
var Interpreter = require('./interpreter');
var Predictor = require('./predictor');
var interpreter;
var renderer;
window.onload = function() {
var code = document.getElementById('source').innerHTML;
interpr... |
Fix brittle TFLite Java version test
Mirror the native TF test for version checking.
PiperOrigin-RevId: 305948727
Change-Id: I18169d0a1b6b0deaefed7984237ea76481c2c59b | /* Copyright 2017 The TensorFlow 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 applicable law or a... | /* Copyright 2017 The TensorFlow 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 applicable law or a... |
Add comments and validation to create msg | /*
* The MIT License (MIT)
*
* Copyright (c) 2016 Vincent Zhang/PhoenixLAB
*
* 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 u... | /*
* The MIT License (MIT)
*
* Copyright (c) 2016 Vincent Zhang/PhoenixLAB
*
* 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 u... |
Fix template name reference (zfcuser/login -> zfc-user/user/login) | <?php
namespace ZfcUser\View\Helper;
use Zend\View\Helper\AbstractHelper,
ZfcUser\Form\Login as LoginForm,
Zend\View\Model\ViewModel;
class ZfcUserLoginWidget extends AbstractHelper
{
/**
* Login Form
* @var LoginForm
*/
protected $loginForm;
/**
* __invoke
*
... | <?php
namespace ZfcUser\View\Helper;
use Zend\View\Helper\AbstractHelper,
ZfcUser\Form\Login as LoginForm,
Zend\View\Model\ViewModel;
class ZfcUserLoginWidget extends AbstractHelper
{
/**
* Login Form
* @var LoginForm
*/
protected $loginForm;
/**
* __invoke
*
... |
Add site footer to each documentation generator | var _ = require('lodash')
var fs = require('fs')
var gzip = require('gzip-size')
var filesize = require('filesize')
var cssstats = require('cssstats')
var module = require('tachyons-images/package.json')
var moduleCss = fs.readFileSync('node_modules/tachyons-images/tachyons-images.min.css', 'utf8')
var moduleObj = css... | var _ = require('lodash')
var fs = require('fs')
var gzip = require('gzip-size')
var filesize = require('filesize')
var cssstats = require('cssstats')
var module = require('tachyons-images/package.json')
var moduleCss = fs.readFileSync('node_modules/tachyons-images/tachyons-images.min.css', 'utf8')
var moduleObj = css... |
Add jquery to global require | (function() {
'use strict';
require.config({
baseUrl: "..",
paths: {
'jasmine': 'test/lib/jasmine-2.0.0/jasmine',
'jasmine-html': 'test/lib/jasmine-2.0.0/jasmine-html',
'boot': 'test/lib/jasmine-2.0.0/boot',
'jquery': 'lib/jquery-2.1.0.min',
'd3': 'lib/d3.v3.min',
'a... | (function() {
'use strict';
require.config({
baseUrl: "..",
paths: {
'jasmine': 'test/lib/jasmine-2.0.0/jasmine',
'jasmine-html': 'test/lib/jasmine-2.0.0/jasmine-html',
'boot': 'test/lib/jasmine-2.0.0/boot',
'jquery': 'lib/jquery-2.1.0.min',
'd3': 'lib/d3.v3.min',
'a... |
Fix use regions cancelling interaction with blocks | package in.twizmwaz.cardinal.module.modules.appliedRegion.type;
import in.twizmwaz.cardinal.module.modules.appliedRegion.AppliedRegion;
import in.twizmwaz.cardinal.module.modules.filter.FilterModule;
import in.twizmwaz.cardinal.module.modules.filter.FilterState;
import in.twizmwaz.cardinal.module.modules.regions.Regio... | package in.twizmwaz.cardinal.module.modules.appliedRegion.type;
import in.twizmwaz.cardinal.module.modules.appliedRegion.AppliedRegion;
import in.twizmwaz.cardinal.module.modules.filter.FilterModule;
import in.twizmwaz.cardinal.module.modules.filter.FilterState;
import in.twizmwaz.cardinal.module.modules.regions.Regio... |
Remove unique_together on the model; the key length was too long on wide-character MySQL installs. | from django.db import models
class MigrationHistory(models.Model):
app_name = models.CharField(max_length=255)
migration = models.CharField(max_length=255)
applied = models.DateTimeField(blank=True)
@classmethod
def for_migration(cls, migration):
try:
return cls.objects.get(app... | from django.db import models
class MigrationHistory(models.Model):
app_name = models.CharField(max_length=255)
migration = models.CharField(max_length=255)
applied = models.DateTimeField(blank=True)
class Meta:
unique_together = (('app_name', 'migration'),)
@classmethod
def for_migrat... |
Correct key for revision in tool playbook parser | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import argparse
import re
import yaml
def get_revision_number(yaml_content, tool_name):
for tool in yaml_content['tools']:
if tool["name"] == tool_name:
if tool.has_key("revisions"):
print tool["revisions"][0]
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import argparse
import re
import yaml
def get_revision_number(yaml_content, tool_name):
for tool in yaml_content['tools']:
if tool["name"] == tool_name:
if tool.has_key("revision"):
print tool["revision"][0]
de... |
Disable caching for CMS plugin.
CSRF tokens may get cached otherwise.
This is for compatibility with Django CMS 3.0+. | from form_designer.contrib.cms_plugins.form_designer_form.models import CMSFormDefinition
from form_designer.views import process_form
from form_designer import settings
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from django.utils.translation import ugettext as _
class FormDes... | from form_designer.contrib.cms_plugins.form_designer_form.models import CMSFormDefinition
from form_designer.views import process_form
from form_designer import settings
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from django.utils.translation import ugettext as _
class FormDes... |
Delete wrong attributes of 'cols' and 'rows' (these are for texture). | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Zip Address Util</title>
<link rel="stylesheet" href="/bower_components/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="/bower_components/bootstrap/dist/css/bootstrap-theme.min.css">
</head>
<body>
<h1>Zip Address... | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Zip Address Util</title>
<link rel="stylesheet" href="/bower_components/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="/bower_components/bootstrap/dist/css/bootstrap-theme.min.css">
</head>
<body>
<h1>Zip Address... |
Use CourseOverview instead of modulestore. | """ Signal handler for enabling self-generated certificates by default
for self-paced courses.
"""
from celery.task import task
from django.dispatch.dispatcher import receiver
from certificates.models import CertificateGenerationCourseSetting
from opaque_keys.edx.keys import CourseKey
from openedx.core.djangoapps.cont... | """ Signal handler for enabling self-generated certificates by default
for self-paced courses.
"""
from celery.task import task
from django.dispatch.dispatcher import receiver
from certificates.models import CertificateGenerationCourseSetting
from opaque_keys.edx.keys import CourseKey
from xmodule.modulestore.django i... |
Remove attempts to force corrections on the gradient. | <?php
declare(strict_types=1);
namespace mcordingley\Regression\Linkings;
use InvalidArgumentException;
use mcordingley\Regression\Helpers;
final class Logistic extends Linking
{
public function delinearize(float $value): float
{
return 1.0 / (1.0 + exp(-$value));
}
public function lineariz... | <?php
declare(strict_types=1);
namespace mcordingley\Regression\Linkings;
use InvalidArgumentException;
use mcordingley\Regression\Helpers;
final class Logistic extends Linking
{
public function delinearize(float $value): float
{
return 1.0 / (1.0 + exp(-$value));
}
public function lineariz... |
Fix checkboxes for Patient Summary. | import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { Col } from 'react-bootstrap';
const PTCustomCheckbox = ({ title, name, isChecked, disabled = false, onChange }) => {
const toggleCheckbox = () => !disabled && onChange(name);
return <Col xs={6} sm={4}>
... | import React from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import { Col } from 'react-bootstrap';
const PTCustomCheckbox = ({ title, name, isChecked, disabled = false, onChange }) => {
const toggleCheckbox = () => !disabled && onChange(name);
return <Col xs={6} sm={4}>
... |
Remove version info from app. | <?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
* @author Taylor Otwell <taylorotwell@gmail.com>
*/
define('ILLUMINATE_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Register The Composer Auto Loader
|---------------------... | <?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
* @version 4.0.0
* @author Taylor Otwell <taylorotwell@gmail.com>
*/
define('ILLUMINATE_START', microtime(true));
/*
|--------------------------------------------------------------------------
| Register The Composer Auto Loader
|--... |
Allow args and kwargs to upload_handler_name
Now can use args and kwargs for reverse url. Example in template:
{% jfu 'core/core_fileuploader.html' 'core_upload' object_id=1 content_type_str='app.model' %} | from django.core.context_processors import csrf
from django.core.urlresolvers import reverse
from django.template import Library, Context, loader
register = Library()
@register.simple_tag( takes_context = True )
def jfu(
context,
template_name = 'jfu/upload_form.html',
upload_handler_name =... | from django.core.context_processors import csrf
from django.core.urlresolvers import reverse
from django.template import Library, Context, loader
register = Library()
@register.simple_tag( takes_context = True )
def jfu(
context,
template_name = 'jfu/upload_form.html',
upload_handler_name =... |
Simplify LogWriter by making it a PassThrough
Allows the use of pipe internally which is safer than wrapping writes
to this.sink. | var util = require('util');
var stream = require('stream');
var fs = require('fs');
var generateLogName = require('./logname').generate;
module.exports = LogWriter;
function LogWriter(worker, options) {
if (!(this instanceof LogWriter)) return new LogWriter(worker, options);
stream.PassThrough.call(this);
th... | var util = require('util');
var stream = require('stream');
var fs = require('fs');
var generateLogName = require('./logname').generate;
module.exports = LogWriter;
function LogWriter(worker, options) {
if (!(this instanceof LogWriter)) return new LogWriter(worker, options);
stream.Writable.call(this);
this.... |
Fix pb in base test class | <?php
namespace Neblion\ScrumBundle\Tests;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase as BaseWebTestCase;
abstract class WebTestCase extends BaseWebTestCase
{
protected function login($username, $password)
{
$client = static::createClient();
$crawler = $client->request('GET', '/login... | <?php
namespace Neblion\ScrumBundle\Tests;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase as BaseWebTestCase;
abstract class WebTestCase extends BaseWebTestCase
{
protected function login($username, $password)
{
$client = static::createClient();
$crawler = $client->request('GET', '/login... |
Improve log lines for private/public clones | var fs = require('fs');
var gitane = require('gitane');
var winston = require('winston');
function cloneInto(repoUrl, destPath, keyPath, callback) {
var gitClone = function(keyData) {
// clone with . to avoid the extra containing folder
var gitCmd = 'git clone ' + repoUrl + ' .';
// If keyData is truthy... | var fs = require('fs');
var gitane = require('gitane');
var winston = require('winston');
function cloneInto(repoUrl, destPath, keyPath, callback) {
var gitClone = function(keyData) {
// clone with . to avoid the extra containing folder
var gitCmd = 'git clone ' + repoUrl + ' .';
winston.log('info', 'Cl... |
Add python 3 trove classifier | import os
from setuptools import setup
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
README = readme.read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='django-extra-fields',
version='0.9'... | import os
from setuptools import setup
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
README = readme.read()
# allow setup.py to be run from any path
os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup(
name='django-extra-fields',
version='0.9'... |
Use "link" to reference enum literal, fixing javadoc issue. | /*******************************************************************************
* Copyright (c) 2018 Red Hat Inc and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is avail... | /*******************************************************************************
* Copyright (c) 2018 Red Hat Inc and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is avail... |
Fix NPM command that was failing and breaking code
May not handle all cases, but at least it's not broken anymore | 'use strict';
// is this installed in a node_modules dir?
// is this version not equal to npm latest?
var fs = require('fs');
var colors = require('colors/safe');
var exec = require('child_process').exec;
module.exports = function(callback) {
var cancel = false;
var tid = setTimeout(function(){
cancel = tru... | 'use strict';
// is this installed in a node_modules dir?
// is this version not equal to npm latest?
var fs = require('fs');
var colors = require('colors/safe');
var exec = require('child_process').exec;
module.exports = function(callback) {
var cancel = false;
var tid = setTimeout(function(){
cancel = tru... |
Use findOneAndUpdate for PATCH request so new username will be saved | const express = require('express'),
router = express.Router(),
db = require('../models');
router.get('/', function(req, res, next) {
res.render('index');
});
router.get('/new', function(req, res, next) {
res.render('users/new');
});
router.get('/:username', function(req, res, next) {
db.User.findOn... | const express = require('express'),
router = express.Router(),
db = require('../models');
router.get('/', function(req, res, next) {
res.render('index');
});
router.get('/new', function(req, res, next) {
res.render('users/new');
});
router.get('/:username', function(req, res, next) {
db.User.findOn... |
Update to latest version of trusty-URI | package ch.tkuhn.nanopub.validator;
import org.apache.wicket.request.http.WebResponse;
import org.apache.wicket.request.resource.IResource;
import org.nanopub.Nanopub;
import org.nanopub.NanopubUtils;
import org.openrdf.rio.RDFFormat;
import net.trustyuri.rdf.TransformNanopub;
public class DownloadTrustyResource imp... | package ch.tkuhn.nanopub.validator;
import org.apache.wicket.request.http.WebResponse;
import org.apache.wicket.request.resource.IResource;
import org.nanopub.Nanopub;
import org.nanopub.NanopubUtils;
import org.openrdf.rio.RDFFormat;
import net.trustyuri.rdf.TransformNanopub;
public class DownloadTrustyResource imp... |
Fix webpack lodash external require | var webpack = require('webpack')
, glob = require('glob').sync
, ExtractTextPlugin = require('extract-text-webpack-plugin');
// Find all the css files but sort the common ones first
var cssFiles = glob('./src/common/**/*.css').concat(glob('./src/!(common)/**/*.css'));
module.exports = {
entry: {
'sir-... | var webpack = require('webpack')
, glob = require('glob').sync
, ExtractTextPlugin = require('extract-text-webpack-plugin');
// Find all the css files but sort the common ones first
var cssFiles = glob('./src/common/**/*.css').concat(glob('./src/!(common)/**/*.css'));
module.exports = {
entry: {
'sir-... |
Add missing license header to js files | /*
* Copyright 2015 Google Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... | 'use strict';
// Define each block's generated code
Blockly.JavaScript['simple_input_output'] = function(block) {
return ['simple_input_output', Blockly.JavaScript.ORDER_ATOMIC];
};
Blockly.JavaScript['multiple_input_output'] = function(block) {
return ['multiple_input_output', Blockly.JavaScript.ORDER_ATOMIC];
}... |
Remove extra logging that exposed secrets to cloud watch log | var AWS = require('aws-sdk');
var s3 = new AWS.S3();
var yaml = require('js-yaml');
// const s3EnvVars = require('s3-env-vars');
// var doc = s3EnvVars("mybucketname", "folderpathinbucket", "filename", function(err, data) {
// if(err) console.log(err);
// else console.log(data);
// });
module.exports = function(bu... | var AWS = require('aws-sdk');
var s3 = new AWS.S3();
var yaml = require('js-yaml');
// const s3EnvVars = require('s3-env-vars');
// var doc = s3EnvVars("mybucketname", "folderpathinbucket", "filename", function(err, data) {
// if(err) console.log(err);
// else console.log(data);
// });
module.exports = function(bu... |
Fix admin URL import in devproject for Django 2.0
For #191 | from django.conf.urls import include, static, url
from django.contrib import admin
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^flickr/', include('ditto.flickr.urls', namespace='flickr')),
url(r'^lastfm/', include('ditto.lastfm.urls', namespace='lastfm')),
url(r'^pinboard/', include('ditt... | from django.conf.urls import include, static, url
from django.contrib import admin
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^flickr/', include('ditto.flickr.urls', namespace='flickr')),
url(r'^lastfm/', include('ditto.lastfm.urls', namespace='lastfm')),
url(r'^pinboard/', incl... |
Add transitionTo stub to solve interaction error | import _ from 'lodash';
import React from 'react/addons';
var stubRouterContext = (Component, props, stubs) => {
return React.createClass({
childContextTypes: {
transitionTo: React.PropTypes.func,
getCurrentPath: React.PropTypes.func,
getCurrentRoutes: React.PropTypes.func,
getCurrentPath... | import _ from 'lodash';
import React from 'react/addons';
var stubRouterContext = (Component, props, stubs) => {
return React.createClass({
childContextTypes: {
getCurrentPath: React.PropTypes.func,
getCurrentRoutes: React.PropTypes.func,
getCurrentPathname: React.PropTypes.func,
getCurre... |
Add index to user_id on social_identities for speeding up searches with lots of records. | <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSocialIdentitiesTable extends Migration
{
/**
* Run the migration.
*
* @return void
*/
public function up()
{
Schema::create('social_identities', function (Blueprint $table... | <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateSocialIdentitiesTable extends Migration
{
/**
* Run the migration.
*
* @return void
*/
public function up()
{
Schema::create('social_identities', function (Blueprint $table... |
Put comment on seperate line | import { moduleForComponent, test } from 'ember-qunit';<% if (testType === 'integration') { %>
import hbs from 'htmlbars-inline-precompile';<% } %>
moduleForComponent('<%= componentPathName %>', '<%= friendlyTestDescription %>', {
<% if (testType === 'integration' ) { %>integration: true<% } else if(testType === 'un... | import { moduleForComponent, test } from 'ember-qunit';<% if (testType === 'integration') { %>
import hbs from 'htmlbars-inline-precompile';<% } %>
moduleForComponent('<%= componentPathName %>', '<%= friendlyTestDescription %>', {
<% if (testType === 'integration' ) { %>integration: true<% } else if(testType === 'un... |
Fix template URL generation (WAL-141) | 'use strict';
(function() {
angular.module('ncsaas')
.service('invoicesService', ['baseServiceClass', '$http', 'ENV', '$state', invoicesService]);
function invoicesService(baseServiceClass, $http, ENV, $state) {
/*jshint validthis: true */
var ServiceClass = baseServiceClass.extend({
... | 'use strict';
(function() {
angular.module('ncsaas')
.service('invoicesService', ['baseServiceClass', '$http', 'ENV', '$state', invoicesService]);
function invoicesService(baseServiceClass, $http, ENV, $state) {
/*jshint validthis: true */
var ServiceClass = baseServiceClass.extend({
... |
Use ?: instead of ??
Signed-off-by: crynobone <e1a543840a942eb68427510a8a483282a7bfeddf@gmail.com> | <?php
namespace Orchestra\Database\Console\Migrations;
trait Packages
{
/**
* The path to the packages directory (vendor).
*
* @var string
*/
protected $packagePath;
/**
* Set package path.
*
* @param string $packagePath
*
* @return $this
*/
public ... | <?php
namespace Orchestra\Database\Console\Migrations;
trait Packages
{
/**
* The path to the packages directory (vendor).
*
* @var string
*/
protected $packagePath;
/**
* Set package path.
*
* @param string $packagePath
*
* @return $this
*/
public ... |
Add slash if not present | /*
* This file is released under terms of BSD license
* See LICENSE file for more information
*/
package cx2x.xcodeml.xnode;
import org.w3c.dom.Document;
/**
* The Xmod represents the module information produced by the Fortran front-end
* of OMNI Compiler.
*
* @author clementval
*/
public class Xmod extends ... | /*
* This file is released under terms of BSD license
* See LICENSE file for more information
*/
package cx2x.xcodeml.xnode;
import org.w3c.dom.Document;
/**
* The Xmod represents the module information produced by the Fortran front-end
* of OMNI Compiler.
*
* @author clementval
*/
public class Xmod extends ... |
Update message for error 500 | import apiConfig from '../../config/api'
import googleConfig from '../../config/google'
function handleErrors (response) {
if (response.status >= 200 && response.status < 300) {
return response // .json()
} else if (response.status === 400) {
throw Error('Le formulaire est incomplet')
// return respons... | import apiConfig from '../../config/api'
import googleConfig from '../../config/google'
function handleErrors (response) {
if (response.status >= 200 && response.status < 300) {
return response // .json()
} else if (response.status === 400) {
throw Error('Le formulaire est incomplet')
// return respons... |
Return the result of loading module | (function(app) {
'use strict';
var jCore = require('jcore');
var helper = app.helper || require('../helper.js');
var Module = app.Module || require('./module.js');
var ModuleContainer = helper.inherits(function(props) {
ModuleContainer.super_.call(this);
this.modules = this.prop([]);
this.eleme... | (function(app) {
'use strict';
var jCore = require('jcore');
var helper = app.helper || require('../helper.js');
var Module = app.Module || require('./module.js');
var ModuleContainer = helper.inherits(function(props) {
ModuleContainer.super_.call(this);
this.modules = this.prop([]);
this.eleme... |
Add support for single quoted multi-line strings in Python | Prism.languages.python={comment:{pattern:/(^|[^\\])#.*?(\r?\n|$)/g,lookbehind:!0},string:/"""[\s\S]+?"""|'''[\s\S]+?'''|("|')(\\?.)*?\1/g,keyword:/\b(as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|pass|print|raise|return|try|while|with|yield)\b/g,"boolean":/\... | Prism.languages.python={comment:{pattern:/(^|[^\\])#.*?(\r?\n|$)/g,lookbehind:!0},string:/"""[\s\S]+?"""|("|')(\\?.)*?\1/g,keyword:/\b(as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|pass|print|raise|return|try|while|with|yield)\b/g,"boolean":/\b(True|False)\b... |
fix: Send access token as a header instead of querystring parameter | import version from '../version'
/**
* Create pre configured axios instance
* @private
* @param {Object} axios - Axios library
* @param {Object} HTTPClientParams - Initialization parameters for the HTTP client
* @prop {string} space - Space ID
* @prop {string} accessToken - Access Token
* @prop {boolean=} insec... | import qs from 'querystring'
import version from '../version'
/**
* Create pre configured axios instance
* @private
* @param {Object} axios - Axios library
* @param {Object} HTTPClientParams - Initialization parameters for the HTTP client
* @prop {string} space - Space ID
* @prop {string} accessToken - Access To... |
Add Travis UA for API calls | var Travis = require('travis-ci');
var child_process = require('child_process');
var repo = "excaliburjs/excaliburjs.github.io";
var travis = new Travis({
version: '2.0.0',
headers: {
'User-Agent': 'Travis/1.0'
}
});
var branch = process.env.TRAVIS_BRANCH;
if (branch !== "master") {
console.log("Curren... | var Travis = require('travis-ci');
var child_process = require('child_process');
var repo = "excaliburjs/excaliburjs.github.io";
var travis = new Travis({
version: '2.0.0'
});
var branch = process.env.TRAVIS_BRANCH;
if (branch !== "master") {
console.log("Current branch is `" + branch + "`, skipping docs deployme... |
Add /rl to command blacklist | package protocolsupport.server.listeners;
import java.util.HashSet;
import java.util.Set;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
public class CommandListener implements Listener {
private final Set<String> blacklist = new ... | package protocolsupport.server.listeners;
import java.util.HashSet;
import java.util.Set;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
public class CommandListener implements Listener {
private final Set<String> blacklist = new ... |
[cleanup] Read dev server port from env if its there | /* eslint no-var: 0, func-names: 0 , no-console: 0 */
/**
* Development Server
* - See https://github.com/gaearon/react-transform-boilerplate
*/
var path = require('path');
var express = require('express');
var webpack = require('webpack');
var config = require('./webpack.config.dev');
var app = express();
var co... | /* eslint no-var: 0, func-names: 0 , no-console: 0 */
/**
* Development Server
* - See https://github.com/gaearon/react-transform-boilerplate
*/
var path = require('path');
var express = require('express');
var webpack = require('webpack');
var config = require('./webpack.config.dev');
var app = express();
var co... |
Fix revision ID of an alternate-language document. | <?php
declare (strict_types = 1);
namespace Crell\Document\Document;
use Ramsey\Uuid\Uuid;
trait DocumentTrait
{
/**
* UUID of this document.
*
* @var string
*/
protected $uuid;
/**
* Revision ID of this document.
*
* @var string.
*/
protected $revision;
... | <?php
declare (strict_types = 1);
namespace Crell\Document\Document;
trait DocumentTrait
{
/**
* UUID of this document.
*
* @var string
*/
protected $uuid;
/**
* Revision ID of this document.
*
* @var string.
*/
protected $revision;
/**
* The langua... |
Improve ActiveLanguageMixin to hide original field | from .conf import get_default_language
from .translator import get_i18n_field
from .utils import get_language
class ActiveLanguageMixin(object):
'''
Add this mixin to your admin class to hide the untranslated field and all
translated fields, except:
- The field for the default language (settings.LAN... | from .conf import get_default_language
from .translator import get_i18n_field
from .utils import get_language
class ActiveLanguageMixin(object):
'''
Hide all translated fields, except:
- The field for the default language (settings.LANGUAGE_CODE)
- The field for the currently active language.
''... |
Make Spanish tutorial images also load for Latinamerican Spanish | /**
* @fileoverview
* Utility functions for handling tutorial images in multiple languages
*/
import {enImages as defaultImages} from './en-steps.js';
let savedImages = {};
let savedLocale = '';
const loadSpanish = () =>
import(/* webpackChunkName: "es-steps" */ './es-steps.js')
.then(({esImages: imag... | /**
* @fileoverview
* Utility functions for handling tutorial images in multiple languages
*/
import {enImages as defaultImages} from './en-steps.js';
let savedImages = {};
let savedLocale = '';
const loadSpanish = () =>
import(/* webpackChunkName: "es-steps" */ './es-steps.js')
.then(({esImages: imag... |
Fix in expected attribute value. | <?php
/*
* Bear CMS addon for Bear Framework
* https://bearcms.com/
* Copyright (c) 2016 Amplilabs Ltd.
* Free to use under the MIT license.
*/
$onClick = 'none';
if ($component->onClick === 'fullscreen') {
$onClick = 'fullscreen';
} elseif ($component->onClick === 'openUrl') {
$onClick = 'url';
}
$onClic... | <?php
/*
* Bear CMS addon for Bear Framework
* https://bearcms.com/
* Copyright (c) 2016 Amplilabs Ltd.
* Free to use under the MIT license.
*/
$onClick = 'none';
if ($component->onClick === 'fullscreen') {
$onClick = 'fullscreen';
} elseif ($component->onClick === 'openUrl') {
$onClick = 'url';
}
$onClic... |
[fix] Set default API limit to 1000.
Fixes an exception on /artists when there are more than 20 artists on
the page (e.g. with ?limit=40). | import _ from "lodash";
import jQuery from "jquery";
import moment from "moment";
import DText from "./dtext.js";
import Tag from "./tag.js";
import UI from "./ui.js";
import "./danbooru-ex.css";
export default class EX {
static search(url, data, success) {
return $.getJSON(url, { search: data, limit: 1000... | import _ from "lodash";
import jQuery from "jquery";
import moment from "moment";
import DText from "./dtext.js";
import Tag from "./tag.js";
import UI from "./ui.js";
import "./danbooru-ex.css";
export default class EX {
static search(url, data, success) {
return $.getJSON(url, { search: data }, success);... |
Update structure tables with common D8 entries and add option for easily excluding watchdog as well. | <?php
/**
* Drush System configuration
*
* This file configures usage of Drush on the build container, in conjunction
* with configuration and commands placed in /etc/drush.
*/
// On drush sql-dump and other database extraction operations, ignore the data
// in these tables, but keep the table structures.
// Make... | <?php
/**
* Drush System configuration
*
* This file configures usage of Drush on the build container, in conjunction
* with configuration and commands placed in /etc/drush.
*/
// On drush sql-dump and other database extraction operations, ignore the data
// in these tables, but keep the table structures.
// Make... |
Fix boolean logic related to showing delete button | import React, { Component } from 'react';
import style from './style';
import CommentItem from '../CommentItem';
export default class CommentList extends Component {
componentDidMount() {
this.wrapper.scrollTop = this.wrapper.scrollHeight;
}
componentDidUpdate(prev) {
if (this.props.comments.length !== ... | import React, { Component } from 'react';
import style from './style';
import CommentItem from '../CommentItem';
export default class CommentList extends Component {
componentDidMount() {
this.wrapper.scrollTop = this.wrapper.scrollHeight;
}
componentDidUpdate(prev) {
if (this.props.comments.length !== ... |
Create json for bsx server status | <?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Homepage extends Application {
/**
* Index Page for the Homepage controller.
*/
public function index()
{
/* Grab data from database for Stocks and Players */
$this->data['stocks'] = $this->s... | <?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Homepage extends Application {
/**
* Index Page for the Homepage controller.
*/
public function index()
{
/* Grab data from database for Stocks and Players */
$this->data['stocks'] = $this->s... |
Fix logging from afterEach hook in tests | import 'es5-shim';
beforeEach(() => {
sinon.stub(console, 'error');
});
afterEach(function checkNoUnexpectedWarnings() {
if (typeof console.error.restore === 'function') {
assert(!console.error.called, () => {
return `${console.error.getCall(0).args[0]} \nIn '${this.currentTest.fullTitle()}'`;
});
... | import 'es5-shim';
beforeEach(() => {
sinon.stub(console, 'error');
});
afterEach(() => {
if (typeof console.error.restore === 'function') {
assert(!console.error.called, () => {
return `${console.error.getCall(0).args[0]} \nIn '${this.currentTest.fullTitle()}'`;
});
console.error.restore();
}... |
Remove default null because nullable does that | <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddQuantityColumnToPostsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('posts... | <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddQuantityColumnToPostsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('posts... |
Add fright script back in, just in case | #!/usr/bin/env python
from setuptools import setup
setup(
name='ghostly',
version='0.7.1',
description='Create simple browser tests',
author='Brenton Cleeland',
url='https://github.com/sesh/ghostly',
install_requires=['click', 'colorama', 'pillow', 'PyYAML', 'selenium'],
py_modules=['ghost... | #!/usr/bin/env python
from setuptools import setup
setup(
name='ghostly',
version='0.7.1',
description='Create simple browser tests',
author='Brenton Cleeland',
url='https://github.com/sesh/ghostly',
install_requires=['click', 'colorama', 'pillow', 'PyYAML', 'selenium'],
py_modules=['ghost... |
Fix bug with broken receiving of values. | import React, { PropTypes } from 'react';
import styles from 'styles/Input';
class Input extends React.Component {
constructor(props) {
super(props);
this.state = {
value: props.value
};
}
componentWillReceiveProps({ value }) {
this.setState({ value });
}
render() {
const { valu... | import React, { PropTypes } from 'react';
import styles from 'styles/Input';
class Input extends React.Component {
constructor(props) {
super(props);
this.state = {
value: props.value
};
}
render() {
const { value } = this.state;
return (
<input
type='text'
cla... |
Add default selected state to toolbar selections. | import SelectStateItemsCollection from '../collections/SelectStateItemsCollection';
import meta from '../meta';
export default Backbone.Model.extend({
initialize() {
const items = this.get('items');
const itemsCollection = new SelectStateItemsCollection(items);
this.listenTo(itemsCollection... | import SelectStateItemsCollection from '../collections/SelectStateItemsCollection';
import meta from '../meta';
export default Backbone.Model.extend({
initialize() {
const items = this.get('items');
const itemsCollection = new SelectStateItemsCollection(items);
this.listenTo(itemsCollection... |
Add support for a dir of client tests | #!/usr/bin/env python
'''
Discover all instances of unittest.TestCase in this directory.
'''
# Import python libs
import os
# Import salt libs
import saltunittest
from integration import TestDaemon
TEST_DIR = os.path.dirname(os.path.normpath(os.path.abspath(__file__)))
def run_integration_tests():
with TestDaemon... | #!/usr/bin/env python
'''
Discover all instances of unittest.TestCase in this directory.
'''
# Import python libs
import os
# Import salt libs
import saltunittest
from integration import TestDaemon
TEST_DIR = os.path.dirname(os.path.normpath(os.path.abspath(__file__)))
def run_integration_tests():
with TestDaemon... |
Backup directory is made, and a notification is sent and logged if the directory doesn't exist | #!/usr/bin/python2
import LogUncaught, ConfigParser, logging, PushBullet, os
from time import localtime, strftime
sbConfig = ConfigParser.RawConfigParser()
sbConfig.read('scripts.cfg')
# Logger File Handler
sbLFH = logging.FileHandler(sbConfig.get('ServerBackup', 'log_location'))
sbLFH.setLevel(logging.DEBUG)
# Logg... | #!/usr/bin/python2
import LogUncaught, ConfigParser, logging, os
sbConfig = ConfigParser.RawConfigParser()
sbConfig.read('scripts.cfg')
# Logger File Handler
sbLFH = logging.FileHandler(sbConfig.get('ServerBackup', 'log_location'))
sbLFH.setLevel(logging.DEBUG)
# Logger Formatter
sbLFORMAT = logging.Formatter('[%(as... |
Add compatibility with Python 3.x | #!/usr/bin/env python
# encoding: utf-8
"""
import debug: https://github.com/narfdotpl/debug
"""
try:
import __builtin__
except ImportError:
# Python 3.x
import builtins as __builtin__
from sys import _getframe
from ipdb import set_trace
# do not forget
old_import = __builtin__.__import__
def debug():
... | #!/usr/bin/env python
# encoding: utf-8
"""
import debug: https://github.com/narfdotpl/debug
"""
import __builtin__
from sys import _getframe
from ipdb import set_trace
# do not forget
old_import = __builtin__.__import__
def debug():
# get frame
frame = _getframe(2)
# inject see (`from see import see`... |
Revert "Remove Windows build for ia32 arch"
This reverts commit ec504d074f02783b8e90ec149437e08f7d647bed. | 'use strict';
const gulp = require('gulp');
const { build } = require('electron-builder');
const config = require('../electron-builder.json');
const { getEnvName } = require('./utils');
const publish = getEnvName() !== 'production' ? 'never' : 'onTagOrDraft';
gulp.task('release:darwin', () => build({ publish, x64: tr... | 'use strict';
const gulp = require('gulp');
const { build } = require('electron-builder');
const config = require('../electron-builder.json');
const { getEnvName } = require('./utils');
const publish = getEnvName() !== 'production' ? 'never' : 'onTagOrDraft';
gulp.task('release:darwin', () => build({ publish, x64: tr... |
Check if results from bank are not equal null | import { expect } from 'chai';
import NBG from '../src/banks/NBG';
import CreditAgricole from '../src/banks/CreditAgricole';
import CBE from '../src/banks/CBE';
const { describe, it } = global;
const banks = [
NBG,
CreditAgricole,
CBE,
];
describe('Banks', () => {
banks.forEach((Bank) => {
const bank = ... | import { expect } from 'chai';
import NBG from '../src/banks/NBG';
import CreditAgricole from '../src/banks/CreditAgricole';
import CBE from '../src/banks/CBE';
const { describe, it } = global;
const banks = [
NBG,
CreditAgricole,
CBE,
];
describe('Banks', () => {
banks.forEach((Bank) => {
const bank = ... |
Fix application name in admin | from django.db import models
class AirtimeApplication(models.Model):
name = models.CharField(max_length=50)
ratio = models.IntegerField(null=True, blank=True)
max_per_day = models.IntegerField(null=True, blank=True)
amount = models.IntegerField(null=True, blank=True)
active = models.BooleanFiel... | from django.db import models
class AirtimeApplication(models.Model):
name = models.CharField(max_length=50)
ratio = models.IntegerField(null=True, blank=True)
max_per_day = models.IntegerField(null=True, blank=True)
amount = models.IntegerField(null=True, blank=True)
active = models.BooleanFiel... |
Add mocks to movies controller tests | 'use strict';
describe('controllers', function() {
var httpBackend, scope, createController;
beforeEach(module('polyflix'));
beforeEach(inject(function($rootScope, $httpBackend, $controller) {
httpBackend = $httpBackend;
scope = $rootScope.$new();
httpBackend.whenGET(mocks.configUrl).respond(
... | 'use strict';
describe('controllers', function() {
var httpBackend, scope, createController;
beforeEach(module('polyflix'));
beforeEach(inject(function($rootScope, $httpBackend, $controller) {
httpBackend = $httpBackend;
scope = $rootScope.$new();
httpBackend.whenGET(mocks.configUrl).respond(
... |
Call writeAll() to make sure pre/post operations by subclasses get applied properly. | package org.pharmgkb.parsers;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Collection;
import java.util.function.Function;
import java.util.stream.Stream;
import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
/**
* Cou... | package org.pharmgkb.parsers;
import java.io.IOException;
import java.io.PrintWriter;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Collection;
import java.util.function.Function;
import java.util.stream.Stream;
import javax.annotation.Nonnegative;
import javax.annotation.Nonnull;
/**
* Cou... |
Use parameter to pass Webdriver object to share execution | #
# HamperAuthenticator is the class to handle the authentication part of the provisioning portal.
# Instantiate with the email and password you want, it'll pass back the cookie jar if successful,
# or an error message on failure
#
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
class H... | #
# HamperAuthenticator is the class to handle the authentication part of the provisioning portal.
# Instantiate with the email and password you want, it'll pass back the cookie jar if successful,
# or an error message on failure
#
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
class H... |
Check for default values in dropdowns | import React from 'react'
import PropTypes from 'prop-types'
import FormGroup from '../forms/FormGroup'
import Select from '../forms/Select'
const SelectStackOption = ({ label, name, value, definitions, required, onChange, error }) => {
// default value may be null
if (value === null) {
value = ''
}
const ... | import React from 'react'
import PropTypes from 'prop-types'
import FormGroup from '../forms/FormGroup'
import Select from '../forms/Select'
const SelectStackOption = ({ label, name, value, definitions, required, onChange, error }) => {
// default value may be null
if (value === null) {
value = ''
}
return... |
Add an API for formatter functionality. | "use strict";
/*
default options
*/
var defaultOptions = {
// force additionalProperties and additionalItems to be defined on "object" and "array" types
forceAdditional: false,
// force items to be defined on "array" types
forceItems: false,
// force maxLength to be defined on "string" types
... | "use strict";
/*
default options
*/
var defaultOptions = {
// force additionalProperties and additionalItems to be defined on "object" and "array" types
forceAdditional: false,
// force items to be defined on "array" types
forceItems: false,
// force maxLength to be defined on "string" types
... |
Use port number from command line argument | import java.io.IOException;
import java.net.ServerSocket;
import java.net.SocketException;
/**
* Created by Xinan on 11/9/15.
*/
public class WebProxy {
public static void main(String[] args) {
try {
int port = Integer.parseInt(args[0]);
ServerSocket socket = new ServerSocket(port);
Runtime.g... | import java.io.IOException;
import java.net.ServerSocket;
import java.net.SocketException;
/**
* Created by Xinan on 11/9/15.
*/
public class WebProxy {
public static void main(String[] args) {
try {
int port = Integer.parseInt("1234");
ServerSocket socket = new ServerSocket(port);
Runtime.ge... |
[FIX] Fix email (as username) validation when login_is_email pref is on
git-svn-id: a7fabbc6a7c54ea5c67cbd16bd322330fd10cc35@59506 b456876b-0849-0410-b77d-98878d47e9d5 | <?php
// (c) Copyright 2002-2016 by authors of the Tiki Wiki CMS Groupware Project
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$
function validator_username($input, $parameter = ''... | <?php
// (c) Copyright 2002-2016 by authors of the Tiki Wiki CMS Groupware Project
//
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// $Id$
function validator_username($input, $parameter = ''... |
Fix for undocumented timestamp filtering in python-instagram | from instagram import InstagramAPI, helper
from social.backends.instagram import InstagramOAuth2
from yak.rest_social_auth.backends.base import ExtraDataAbstractMixin, ExtraActionsAbstractMixin
class Instagram(ExtraActionsAbstractMixin, ExtraDataAbstractMixin, InstagramOAuth2):
@staticmethod
def save_extra_da... | from instagram import InstagramAPI
from social.backends.instagram import InstagramOAuth2
from yak.rest_social_auth.backends.base import ExtraDataAbstractMixin, ExtraActionsAbstractMixin
class Instagram(ExtraActionsAbstractMixin, ExtraDataAbstractMixin, InstagramOAuth2):
@staticmethod
def save_extra_data(respo... |
Send the error message as JSON | const watch = require(`${__dirname}/watch.js`);
const datastore = require(`${__dirname}/datastore`);
const express = require('express');
const app = express();
app.use('/', express.static(`${__dirname}/../public`));
app.get('/api/full', function (req, res) {
res.json(datastore.full);
});
app.get('/api/delta', fun... | const watch = require(`${__dirname}/watch.js`);
const datastore = require(`${__dirname}/datastore`);
const express = require('express');
const app = express();
app.use('/', express.static(`${__dirname}/../public`));
app.get('/api/full', function (req, res) {
res.json(datastore.full);
});
app.get('/api/delta', fun... |
Add names to each url | from django.conf.urls.defaults import *
from django.conf import settings
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
(r'^\+media/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT}),
(r'^admin/', include(admin.site.urls)),
url(r... | from django.conf.urls.defaults import *
from django.conf import settings
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
(r'^\+media/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT}),
(r'^admin/', include(admin.site.urls)),
(r'^(... |
Fix globbing pattern in Modernizr taks when not defined | import config from '../lib/config';
import log from 'fancy-log';
import pump from 'pump';
import gulpModernizr from 'gulp-modernizr';
import terser from 'gulp-terser';
import { src, dest, task } from 'gulp';
/**
* Check .js and .scss source files for Modernizr tests and create a custom
* Modernizr build containing ... | import config from '../lib/config';
import log from 'fancy-log';
import pump from 'pump';
import gulpModernizr from 'gulp-modernizr';
import terser from 'gulp-terser';
import { src, dest, task } from 'gulp';
/**
* Check .js and .scss source files for Modernizr tests and create a custom
* Modernizr build containing ... |
Test MGI translation loading too. | from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy import and_
import mgi
import mgi.load
import mgi.models
from translations.models import Translation
def test_mgi_load():
engine = create_engine('sqlite://')
metadata = mgi.models.Base.metadata
metadata.bind = eng... | from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
import mgi
import mgi.load
import mgi.models
def test_mgi_load():
engine = create_engine('sqlite://')
metadata = mgi.models.Base.metadata
metadata.bind = engine
metadata.create_all()
sessionmaker_ = sessionmaker(engine)
... |
Use a transparent pixel to hold the height | Photo = function (doc) {
_.extend(this, doc);
};
_.extend(Photo.prototype, {
getImgTag: function (dimension) {
return {
'class': 'lazy',
'src': 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7',
'data-src': _.str.sprintf(
'%s/photos/%s/%s',
Meteor.settings.public.ur... | Photo = function (doc) {
_.extend(this, doc);
};
_.extend(Photo.prototype, {
getImgTag: function (dimension) {
return {
'class': 'lazy',
'data-src': _.str.sprintf(
'%s/photos/%s/%s',
Meteor.settings.public.uri.cdn,
dimension,
this.filename
),
'data-src-retina': _.str.sprintf(
'%s/p... |
Remove "less-than" restrictions on Astropy, LXML.
I think I put these in place before I had Travis-CI cron-jobs available.
Therefore wanted to avoid future unknowns. Now at least an email gets sent
when there's a new release and it breaks something. | #!/usr/bin/env python
from setuptools import find_packages, setup
import versioneer
install_requires = [
"astropy>=1.2",
"lxml>=2.3",
'iso8601',
'orderedmultidict',
'pytz',
'six',
]
test_requires = [
'pytest>3',
'coverage'
]
extras_require = {
'test': test_requires,
'all': te... | #!/usr/bin/env python
from setuptools import find_packages, setup
import versioneer
install_requires = [
"astropy>=1.2, <3",
"lxml>=2.3, <4.0",
'iso8601',
'orderedmultidict',
'pytz',
'six',
]
test_requires = [
'pytest>3',
'coverage'
]
extras_require = {
'test': test_requires,
... |
Stop the HRM when display is off | /*
Returns the Heart Rate BPM, with off-wrist detection.
Callback rasied to update your UI.
*/
import { display } from "display";
import { HeartRateSensor } from "heart-rate";
import { user } from "user-profile";
let hrm, watchID, hrmCallback;
let lastReading = 0;
let heartRate;
export function initialize(callba... | /*
Returns the Heart Rate BPM, with off-wrist detection.
Callback rasied to update your UI.
*/
import { display } from "display";
import { HeartRateSensor } from "heart-rate";
import { user } from "user-profile";
let hrm, watchID, hrmCallback;
let lastReading = 0;
let heartRate;
export function initialize(callba... |
Fix error message in t.test() | 'use strict';
const t = require('tcomb-validation');
const Type = t.irreducible('Type', t.isType);
function test (value, type) {
const result = t.validate(value, type);
if (!result.isValid()) t.fail(result.firstError().message);
}
function typedFunc (obj) {
return t.func(obj.inputs || [], obj.outputs || t.... | 'use strict';
const t = require('tcomb-validation');
const Type = t.irreducible('Type', t.isType);
function test (value, type) {
const result = t.validate(value, type);
if (!result.isValid()) t.fail(result.firstError());
}
function typedFunc (obj) {
return t.func(obj.inputs || [], obj.outputs || t.Any).of(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.