text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Use `$http` service to fetch stations data. | 'use strict';
angular.module('velo-app').controller('MainCtrl', ['$scope', 'apiService', function ($scope, apiService) {
$scope.initialize = function () {
var map = L.mapbox.map('map', 'mapbox.streets');
apiService.getStations().then(
function (response) {
var stations ... | 'use strict';
angular.module('velo-app').controller('MainCtrl', ['$scope', 'apiService', function ($scope, apiService) {
$scope.initialize = function () {
var map = L.mapbox.map('map', 'mapbox.streets');
var apiRequest = new XMLHttpRequest();
apiRequest.open('GET', '/api/cities/lyon/stati... |
Convert third pillar setup to react-intl | import React from 'react';
import Types from 'prop-types';
import { Link, Redirect } from 'react-router-dom';
import { connect } from 'react-redux';
import { FormattedMessage } from 'react-intl';
export const ThirdPillarSetup = ({ nextPath, isThirdPillarActive }) => (
<div>
{isThirdPillarActive && <Redirect to={... | import React from 'react';
import Types from 'prop-types';
import { Link, Redirect } from 'react-router-dom';
import { connect } from 'react-redux';
import { Message } from 'retranslate';
export const ThirdPillarSetup = ({ nextPath, isThirdPillarActive }) => (
<div>
{isThirdPillarActive && <Redirect to={nextPath... |
Add getter method for scanner queue. | <?php
namespace Orbt\StyleMirror\Css;
use Orbt\StyleMirror\Resource\SingleUseQueue;
use Orbt\ResourceMirror\Resource\GenericResource;
/**
* Scans a stylesheet for resources.
*/
class ResourceScanner
{
/**
* Scanner queue.
* @var SingleUseQueue
*/
protected $queue;
public function __cons... | <?php
namespace Orbt\StyleMirror\Css;
use Orbt\StyleMirror\Resource\SingleUseQueue;
use Orbt\ResourceMirror\Resource\GenericResource;
/**
* Scans a stylesheet for resources.
*/
class ResourceScanner
{
protected $queue;
public function __construct(SingleUseQueue $queue)
{
$this->queue = $queue;... |
Fix selected value for select field. | <div class="{{$config['divClass']}} {{$wrapperClass}} @if($errors)f-error @endif">
@if($label) <label for="{{$name}}">{!! $label !!} @if($required)<i class="f-required">*</i>@endif</label>@endif
<select
id="{{$name}}"
name="{{$name}}"
@if($value)value="{{$value}}" @endif
@if($required)required @... | <div class="{{$config['divClass']}} {{$wrapperClass}} @if($errors)f-error @endif">
@if($label) <label for="{{$name}}">{!! $label !!} @if($required)<i class="f-required">*</i>@endif</label>@endif
<select
id="{{$name}}"
name="{{$name}}"
@if($value)value="{{$value}}" @endif
@if($required)required @... |
Remove unnecessary branching and pass reject handler as second args to then() | "use strict";
/**
* Fix operator that continuously resolves next promise returned from the function that consumes
* resolved previous value.
*
* ```javascript
* fix(fn)(promise).catch(errorHandler);
* ```
*
* is equivalent to:
*
* ```javascript
* promise.then(fn).then(fn).then(fn) ...
* .catch(errorHandl... | "use strict";
/**
* Fix operator that continuously resolves next promise returned from the function that consumes
* resolved previous value.
*
* ```javascript
* fix(fn)(promise).catch(errorHandler);
* ```
*
* is equivalent to:
*
* ```javascript
* promise.then(fn).then(fn).then(fn) ...
* .catch(errorHandl... |
Fix typo in resource file path | package com.redhat.victims;
public class Resources {
public static final String JAR_FILE = "testdata/junit-4.11/junit-4.11.jar";
public static final String JAR_SHA1 = JAR_FILE + ".sha1";
public static final String JAR_JSON = JAR_FILE + ".json";
public static final String POM_FILE = "testdata/junit-4.11/junit-4.11... | package com.redhat.victims;
public class Resources {
public static final String JAR_FILE = "testdata/junit-4.11/junit-4.11.jar";
public static final String JAR_SHA1 = JAR_FILE + ".sha1";
public static final String JAR_JSON = JAR_FILE + ".json";
public static final String POM_FILE = "testdata/junit-4.11/junit-4.11... |
Implement md5 for demo known users password | 'use strict';
var userDAO = require('../index').UserDAO.createInstance();
var userService = require('../index').UserService.singleton(userDAO);
var UsersGenerator = require('../index').UsersGenerator;
var md5 = require('MD5');
var usersGen = new UsersGenerator();
// Generate some fake users
var fakeUsers = usersGen.... | 'use strict';
var userDAO = require('../index').UserDAO.createInstance();
var userService = require('../index').UserService.singleton(userDAO);
var UsersGenerator = require('../index').UsersGenerator;
var usersGen = new UsersGenerator();
// Generate some fake users
var fakeUsers = usersGen.generateUsers(3);
// Gene... |
Add tests for nonlistening addresses as well. | import socket
import pytest
import portend
def socket_infos():
"""
Generate addr infos for connections to localhost
"""
host = ''
port = portend.find_available_local_port()
return socket.getaddrinfo(host, port, socket.AF_UNSPEC, socket.SOCK_STREAM)
def id_for_info(info):
af, = info[:1]
return str(af)
def... | import socket
import pytest
import portend
def socket_infos():
"""
Generate addr infos for connections to localhost
"""
host = ''
port = portend.find_available_local_port()
return socket.getaddrinfo(host, port, socket.AF_UNSPEC, socket.SOCK_STREAM)
def id_for_info(info):
af, = info[:1]
return str(af)
def... |
Use real network interface for gRPC acceptance testing | // +build acceptance
package app_test
import (
"net"
"github.com/DATA-DOG/godog"
"github.com/deshboard/boilerplate-grpc-service/test"
"google.golang.org/grpc"
)
func init() {
test.RegisterFeaturePath("../features")
test.RegisterFeatureContext(FeatureContext)
}
func FeatureContext(s *godog.Suite) {
lis, err ... | // +build acceptance
package app_test
import (
stdnet "net"
"time"
"github.com/DATA-DOG/godog"
"github.com/deshboard/boilerplate-grpc-service/test"
"github.com/goph/stdlib/net"
"google.golang.org/grpc"
)
func init() {
test.RegisterFeaturePath("../features")
test.RegisterFeatureContext(FeatureContext)
}
fun... |
Resolve image icon path relative to module | var {JFrame, JButton, ImageIcon, JLabel} = javax.swing;
var {setInterval} = require('ringo/scheduler');
var n = 0;
function main() {
var frame = new JFrame("Swing Demo");
var button = new JButton(new ImageIcon(module.resolve("img/ringo-drums.png")));
button.addActionListener(function(e) {
setInterv... | var {JFrame, JButton, ImageIcon, JLabel} = javax.swing;
var {setInterval} = require('ringo/scheduler');
var n = 0;
function main() {
var frame = new JFrame("Swing Demo");
var button = new JButton(new ImageIcon("img/ringo-drums.png"));
button.addActionListener(function(e) {
setInterval(function() {
... |
Handle the case where hash.Members is undefined | import ApplicationSerializer from './application';
import { AdapterError } from 'ember-data/adapters/errors';
export default ApplicationSerializer.extend({
attrs: {
datacenter: 'dc',
address: 'Addr',
serfPort: 'Port',
},
normalize(typeHash, hash) {
if (!hash) {
// It's unusual to throw an ... | import ApplicationSerializer from './application';
import { AdapterError } from 'ember-data/adapters/errors';
export default ApplicationSerializer.extend({
attrs: {
datacenter: 'dc',
address: 'Addr',
serfPort: 'Port',
},
normalize(typeHash, hash) {
if (!hash) {
// It's unusual to throw an ... |
Fix example for rewriting response headers in middleware to set headers for exceptions like 404 Not Found | #!/usr/bin/env python3
"""
Example for rewriting response headers by middleware.
"""
import asyncio
from aiohttp.web import Application, Response, HTTPException
@asyncio.coroutine
def handler(request):
return Response(text="Everything is fine")
@asyncio.coroutine
def middleware_factory(app, next_handler):
... | #!/usr/bin/env python3
"""
Example for rewriting response headers by middleware.
"""
import asyncio
from aiohttp.web import Application, Response
@asyncio.coroutine
def handler(request):
return Response(text="Everything is fine")
@asyncio.coroutine
def middleware_factory(app, next_handler):
@asyncio.corou... |
Throw error at invalid inputs | /**
* Created by Umayr Shahid on 4/28/16.
*/
'use strict';
const ParenthesisRegex = /\([^()"]*(?:"[^"]*"[^()"]*)*\)/;
const Dictionary = Object.freeze({
'AND': '&&',
'OR': '||'
});
const evaluate = require('safe-eval');
class Slq {
constructor(target) {
this.target = target;
}
query(q) {
if (q ... | /**
* Created by Umayr Shahid on 4/28/16.
*/
'use strict';
const ParenthesisRegex = /\([^()"]*(?:"[^"]*"[^()"]*)*\)/;
const Dictionary = Object.freeze({
'AND': '&&',
'OR': '||'
});
const evaluate = require('safe-eval');
class Slq {
constructor(target) {
this.target = target;
}
query(q) {
let ma... |
Use host as localhost address instead of server name | <?php
function adminer_object()
{
// Required to run any plugin.
include_once "./plugins/plugin.php";
// Plugins auto-loader.
foreach (glob("plugins/*.php") as $filename) {
include_once "./$filename";
}
// Specify enabled plugins here.
$plugins = [
new AdminerDatabaseHide(... | <?php
function adminer_object()
{
// Required to run any plugin.
include_once "./plugins/plugin.php";
// Plugins auto-loader.
foreach (glob("plugins/*.php") as $filename) {
include_once "./$filename";
}
// Specify enabled plugins here.
$plugins = array(
new AdminerDatabase... |
Use includes instead of indexOf | 'use strict';
const path = require('path');
const fs = require('fs');
const camelCase = require('camelcase');
function getPackageDeps() {
const pkgFile = fs.readFileSync('./package.json');
return Object.keys(JSON.parse(pkgFile).devDependencies);
}
function renamePlugin(name) {
return camelCase(name.replace(/^g... | 'use strict';
const path = require('path');
const fs = require('fs');
const camelCase = require('camelcase');
function getPackageDeps() {
const pkgFile = fs.readFileSync('./package.json');
return Object.keys(JSON.parse(pkgFile).devDependencies);
}
function renamePlugin(name) {
return camelCase(name.replace(/^g... |
Resolve old Django 1.1 bug in URLs to keep it DRY. | from django.conf.urls.defaults import *
from django.core.urlresolvers import reverse
from django.utils.functional import lazy
reverse_lazy = lazy(reverse, unicode)
urlpatterns = patterns('django.contrib.auth.views',
url(r'^login/', 'login', name='login'),
url(r'^logout/', 'logout', {'next_page':'/'}, name='lo... | from django.conf.urls.defaults import *
urlpatterns = patterns('django.contrib.auth.views',
url(r'^login/', 'login', name='login'),
url(r'^logout/', 'logout', {'next_page':'/'}, name='logout'),
url(r'^password/forgot/$', 'password_reset',
# LH #269 - ideally this wouldn't be hard coded
... |
Update dsub version to 0.4.6.dev0
PiperOrigin-RevId: 393201424 | # 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... |
Fix a ESM bug in build script | /*
* Copyright 2021 Simon Edwards <simon@simonzone.com>
*
* This source code is licensed under the MIT license which is detailed in the LICENSE.txt file.
*/
import * as https from 'node:https';
const log = console.log.bind(console);
/**
* @param {string} url
* @return {Promise<Buffer>}
*/
export async function... | /*
* Copyright 2021 Simon Edwards <simon@simonzone.com>
*
* This source code is licensed under the MIT license which is detailed in the LICENSE.txt file.
*/
import * as https from 'node:https';
const log = console.log.bind(console);
/**
* @param {string} url
* @return {Promise<Buffer>}
*/
async function fetchU... |
Refactor Javadoc on converter API | /*
* Copyright (c) OSGi Alliance (2014, 2016). 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 req... | /*
* Copyright (c) OSGi Alliance (2014, 2016). 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 req... |
Extend timeout before killing process. | const R = require("ramda");
const Promise = require("bluebird");
const pubsub = require("../")("amqp://docker");
const publish = (event, index) => {
const data = { number: index + 1 };
console.log(` [-] Published event '${ event.name }' with data:`, data);
event.publish(data)
};
// Create the event.
... | const R = require("ramda");
const Promise = require("bluebird");
const pubsub = require("../")("amqp://docker");
const publish = (event, index) => {
const data = { number: index + 1 };
console.log(` [-] Published event '${ event.name }' with data:`, data);
event.publish(data)
};
// Create the event.
... |
Add comment referencing Django CSRF docs. | /*
* Internal module that is used by the default client, http client, and
* the session fetching apparatus. Made as a separate module to avoid
* circular dependencies and repeated code.
*/
import rest from 'rest';
import interceptor from 'rest/interceptor';
import errorCode from 'rest/interceptor/errorCode';
import... | /*
* Internal module that is used by the default client, http client, and
* the session fetching apparatus. Made as a separate module to avoid
* circular dependencies and repeated code.
*/
import rest from 'rest';
import interceptor from 'rest/interceptor';
import errorCode from 'rest/interceptor/errorCode';
import... |
Fix collapsing of rule explanations | /**
* This file is covered by the AGPLv3 license, which can be found at the LICENSE file in the root of this project.
* @copyright 2020 subtitulamos.tv
*/
import "../css/rules.scss";
import { get_all, onDomReady } from "./utils";
onDomReady(() => {
for (const $spoilerName of get_all(".spoiler-name")) {
$spoi... | /**
* This file is covered by the AGPLv3 license, which can be found at the LICENSE file in the root of this project.
* @copyright 2020 subtitulamos.tv
*/
import "../css/rules.scss";
import { onDomReady } from "./utils";
onDomReady(() => {
for (const $spoilerWrapper of document.querySelectorAll(".spoiler-wrapper... |
Update the version for 2.0.0~rc2 release. | __version__ = '2.0.0~rc2'
__license__ = '''
Copyright (c) 2009-2011, Cameron Dale <camrdale@gmail.com>
Copyright (c) 2005-2009, Bill McCloskey <bill.mccloskey@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following co... | __version__ = '2.0.0~rc1'
__license__ = '''
Copyright (c) 2009-2011, Cameron Dale <camrdale@gmail.com>
Copyright (c) 2005-2009, Bill McCloskey <bill.mccloskey@gmail.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following co... |
Remove all info pertaining to pygooglechart | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='django-sentry',
version='.'.join(map(str, __import__('sentry').__version__)),
author='David Cramer',
author_email='dcramer@gmail.com',
url='http://github.com/dcramer/django-sentry',
description = 'Exception Logging ... | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='django-sentry',
version='.'.join(map(str, __import__('sentry').__version__)),
author='David Cramer',
author_email='dcramer@gmail.com',
url='http://github.com/dcramer/django-sentry',
description = 'Exception Logging ... |
Add an option to disable code reloader to runserver command | #!/usr/bin/env python
import os
from argh import arg, ArghParser
from functools import wraps
def with_app(func):
@wraps(func)
@arg('--config', help='Path to config file', required=True)
def wrapper(*args, **kwargs):
config = args[0].config
from alfred_listener import create_app
ap... | #!/usr/bin/env python
import os
from argh import arg, ArghParser
from functools import wraps
def with_app(func):
@wraps(func)
@arg('--config', help='Path to config file', required=True)
def wrapper(*args, **kwargs):
config = args[0].config
from alfred_listener import create_app
ap... |
Change cmg get to post | <?
session_start();
if($_REQUEST['logout']){unset($_SESSION['admin']);}
if($_SESSION['admin'] == ""){
die();
}
include("../lib/CloudMngr/cloudmngr.core.class.php");
$CloudMngr = new CloudMngr($_GET['id']);
$module = $_POST['module'];//{TODO input filertering
$action = $_POST['action'];
if($module != "" && file_ex... | <?
session_start();
if($_REQUEST['logout']){unset($_SESSION['admin']);}
if($_SESSION['admin'] == ""){
die();
}
include("../lib/CloudMngr/cloudmngr.core.class.php");
$CloudMngr = new CloudMngr($_GET['id']);
$module = $_GET['module'];//{TODO input filertering
$action = $_GET['action'];
if($module != "" && file_exis... |
Add radix to a parseInt() | Gittip.upgrade = {};
Gittip.upgrade.init = function () {
var userAgent = navigator.userAgent.toLowerCase();
var browser = (userAgent.indexOf('msie') != -1) ? parseInt(userAgent.split('msie')[1], 10) : -1;
if(browser != -1 && browser < 9) {
var message = '' +
'<div id="upgrade_browser"... | Gittip.upgrade = {};
Gittip.upgrade.init = function () {
var userAgent = navigator.userAgent.toLowerCase();
var browser = (userAgent.indexOf('msie') != -1) ? parseInt(userAgent.split('msie')[1]) : -1;
if(browser != -1 && browser < 9) {
var message = '' +
'<div id="upgrade_browser">' +... |
Test reflects passing raw string at initialization. | var nodehun = require('./../lib/index.js'),
Dictionary = nodehun.Dictionary;
var fs = require('fs'),
mctime = require('microtime'),
unit = typeof mctime !== "undefined" ? "μs":"ms",
time = typeof mctime !== "undefined" ? mctime.now : Date.now;
var affbuf = fs.readFileSync(__dirname+'/../dictionaries/en_US/en_US.aff').... | var nodehun = require('./../lib/index.js'),
Dictionary = nodehun.Dictionary,
mctime = require('microtime'),
unit = typeof mctime !== "undefined" ? "μs":"ms",
time = typeof mctime !== "undefined" ? mctime.now : Date.now;
var timeInit = time();
var dict = new Dictionary('en_US');
console.log('time to initialize dicti... |
Revert "Remove the 'end' type from format()"
This reverts commit aff79b167029fa45c3bef6af187d795e1b012cd1. | var util = require('util');
var mochaFormatter = {
suite: "describe('%s', function () {",
test: "it('%s');",
end: '});'
};
function format(line, type) {
if (type === 'end') {
return mochaFormatter.end;
} else {
return util.format(mochaFormatter[type], line.trim());
}
}
function getIndentLength... | var util = require('util');
var mochaFormatter = {
suite: "describe('%s', function () {",
test: "it('%s');",
end: '});'
};
function format(line, type) {
return util.format(mochaFormatter[type], line.trim());
}
function getIndentLength(line) {
return (line.match(/ {2}/g) || []).length;
}
module.exports ... |
Add event key to match score notification | from consts.notification_type import NotificationType
from helpers.model_to_dict import ModelToDict
from notifications.base_notification import BaseNotification
class MatchScoreNotification(BaseNotification):
def __init__(self, match):
self.match = match
self.event = match.event.get()
sel... | from consts.notification_type import NotificationType
from helpers.model_to_dict import ModelToDict
from notifications.base_notification import BaseNotification
class MatchScoreNotification(BaseNotification):
def __init__(self, match):
self.match = match
self.event = match.event.get()
sel... |
Allow for lazy translation of message tags | from django import template
from django.contrib.messages.utils import get_level_tags
from django.utils.encoding import force_text
LEVEL_TAGS = get_level_tags()
register = template.Library()
@register.simple_tag()
def get_message_tags(message):
"""
Returns the message's level_tag prefixed with Bootstrap's "... | from django import template
from django.contrib.messages.utils import get_level_tags
LEVEL_TAGS = get_level_tags()
register = template.Library()
@register.simple_tag()
def get_message_tags(message):
"""
Returns the message's level_tag prefixed with Bootstrap's "alert-" prefix
along with any tags includ... |
Add packageName variable and fix styleguide location | // TODO: Make options linear.
// Would make configuration more user friendly.
'use strict'
var path = require('path')
var packageName = 'chewingum'
module.exports = function (options) {
function n (pathString) {
return path.normalize(pathString)
}
var opts = options || {}
opts.location = (opts.location)... | 'use strict'
// var console = require('better-console')
var path = require('path')
module.exports = function (options) {
function n (pathString) {
return path.normalize(pathString)
}
var opts = options || {}
opts.location = (opts.location) ? opts.location : {}
opts.extensions = (opts.extensions) ? opt... |
Use native Map instead of plain object
Also reduce the use of lodash |
class TextLocationRegistry {
constructor() {
this._recordMap = new Map();
}
register({editorId, decorationId, ranges}) {
const editorDecorations = this._recordMap.get(editorId) || new Map();
editorDecorations.set(decorationId, ranges);
this._recordMap.set(editorId, editorD... |
const _ = require('lodash');
class TextLocationRegistry {
constructor() {
this._recordMap = {};
}
register({editorId, decorationId, ranges}) {
const editorDecorations = Object.assign(
{},
this._recordMap[editorId],
{[decorationId]: ranges}
);
... |
Add linear filter on image little planet texture | ( function () {
/**
* Image Little Planet
* @param {string} source - URL for the image source
* @param {number} [size=10000] - Size of plane geometry
* @param {number} [ratio=0.5] - Ratio of plane geometry's height against width
*/
PANOLENS.ImageLittlePlanet = function ( source, size, ratio ) {
PANOL... | ( function () {
/**
* Image Little Planet
* @param {string} source - URL for the image source
* @param {number} [size=10000] - Size of plane geometry
* @param {number} [ratio=0.5] - Ratio of plane geometry's height against width
*/
PANOLENS.ImageLittlePlanet = function ( source, size, ratio ) {
PANOL... |
Clean up ios delete key test
Clean up ios delete key test | "use strict";
var setup = require("../../common/setup-base"),
desired = require('./desired'),
unorm = require('unorm');
describe('testapp - accented characters', function () {
var driver;
setup(this, desired).then(function (d) { driver = d; });
it('should send accented text', function (done) {
var ... | "use strict";
var setup = require("../../common/setup-base"),
desired = require('./desired'),
unorm = require('unorm');
describe('testapp - accented characters', function () {
var driver;
setup(this, desired).then(function (d) { driver = d; });
it('should send accented text', function (done) {
var ... |
Update and fix external history plugin | "use strict";
window.arethusaInitPlugin('external_history', function() {
/* global HistoryObj */
var obj = {
name: 'external_history',
arethusa: window.arethusaExternalApi(),
hist: new HistoryObj(2),
container: function() {
return $('#' + obj.name);
},
select: function(selector) {... | "use strict";
window.arethusaInitPlugin('external_history', function() {
/* global HistoryObj */
var obj = {
name: 'external_history',
api: window.arethusaExternalApi(),
hist: new HistoryObj(2),
container: function() {
return $('#' + obj.name);
},
select: function(selector) {
... |
Use sqlalchemy 0.7.7 instead of 0.6 | try:
from setuptools import setup, find_packages
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
setup(
name='porick',
version='0.1',
description='',
author='',
author_email='',
url='',
install_requires=[
... | try:
from setuptools import setup, find_packages
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
setup(
name='porick',
version='0.1',
description='',
author='',
author_email='',
url='',
install_requires=[
... |
Remove the last occurence of PHP_EOL in a commented test and enabling it | <?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
namespace ... | <?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
namespace ... |
Add unit test 0.1 + 0.2 = 0.3. | package com.github.verylargenumber;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static com.github.verylargenumber.VeryLargeNumber.add;
public class AddUnitTest {
@Test
public void addToNull() {
assertEquals("0", add(null, null));
assertEquals("12", add("12", nu... | package com.github.verylargenumber;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static com.github.verylargenumber.VeryLargeNumber.add;
public class AddUnitTest {
@Test
public void addToNull() {
assertEquals("0", add(null, null));
assertEquals("12", add("12", nu... |
Sort files before choosing one to upload | #!/usr/bin/python3
from __future__ import print_function
import os
import time
import subprocess
import sys
WAIT = 30
def main():
directory = sys.argv[1]
url = os.environ['RSYNC_URL']
while True:
fnames = sorted(list(f for f in os.listdir(directory) if f.endswith('.warc.gz')))
if len(fna... | #!/usr/bin/python3
from __future__ import print_function
import os
import time
import subprocess
import sys
WAIT = 30
def main():
directory = sys.argv[1]
url = os.environ['RSYNC_URL']
while True:
fnames = list(f for f in os.listdir(directory) if f.endswith('.warc.gz'))
if len(fnames):
... |
Fix problem with navigating to static methods in the reference guide | var showing = null
function hashChange() {
var hash = decodeURIComponent(document.location.hash.slice(1))
var found = document.getElementById(hash), prefix, sect
if (found && (prefix = /^([^\.]+)/.exec(hash)) && (sect = document.getElementById("part_" + prefix[1]))) {
if (!sect.style.display) {
sect.st... | var showing = null
function hashChange() {
var hash = document.location.hash.slice(1)
var found = document.getElementById(hash), prefix, sect
if (found && (prefix = /^([^\.]+)/.exec(hash)) && (sect = document.getElementById("part_" + prefix[1]))) {
if (!sect.style.display) {
sect.style.display = "block... |
Put package name in QUnit header | /*globals QUnit spade */
require('jquery');
var qunit = require('./qunit');
var packageName = location.search.match(/package=([^&]+)&?/);
packageName = packageName && packageName[1];
var prefix = location.search.match(/prefix=([^&]+)&?/);
prefix = prefix && prefix[1];
if (!packageName) {
$('#qunit-header').text('... | /*globals QUnit spade */
require('jquery');
var qunit = require('./qunit');
var packageName = location.search.match(/package=([^&]+)&?/);
packageName = packageName && packageName[1];
var prefix = location.search.match(/prefix=([^&]+)&?/);
prefix = prefix && prefix[1];
if (!packageName) {
$('#qunit-header').text('... |
Fix bad console command path | <?php
namespace App\console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use App\Console\Commands\QueryServerStatusesCommand;
use App\Console\Commands\ImportCommand;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your ap... | <?php
namespace App\console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use App\console\Commands\QueryServerStatusesCommand;
use App\console\Commands\ImportCommand;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your ap... |
Simplify state and save server URL | #!/usr/bin/env python
# encoding=utf8
import requests
from flexbe_core import EventState, Logger
class Wonderland_Request(EventState):
'''
Send requests to Wonderland server
># url string url to call
<= response string Finish job.
'''
def __init__(self):
# See example_state.py for basic explan... | #!/usr/bin/env python
# encoding=utf8
import requests
from flexbe_core import EventState, Logger
class Wonderland_Request(EventState):
'''
MoveArm receive a ROS pose as input and launch a ROS service with the same pose
># url string url to call
<= response string Finish job.
'''
def __init__(sel... |
Make Model available in main openmc namespace | from openmc.arithmetic import *
from openmc.cell import *
from openmc.checkvalue import *
from openmc.mesh import *
from openmc.element import *
from openmc.geometry import *
from openmc.nuclide import *
from openmc.macroscopic import *
from openmc.material import *
from openmc.plots import *
from openmc.region import ... | from openmc.arithmetic import *
from openmc.cell import *
from openmc.checkvalue import *
from openmc.mesh import *
from openmc.element import *
from openmc.geometry import *
from openmc.nuclide import *
from openmc.macroscopic import *
from openmc.material import *
from openmc.plots import *
from openmc.region import ... |
Add third place in version number, why not | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
from setuptools import setup, find_packages
requires = ['cornice', 'mozsvc', 'powerhose', 'circus', 'wimms', 'PyBrowser... | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
from setuptools import setup, find_packages
requires = ['cornice', 'mozsvc', 'powerhose', 'circus', 'wimms', 'PyBrowser... |
Allow an onDone listener to be associated with a slot | 'use strict';
var Node = require('./Node');
class Slot extends Node {
constructor(def) {
super('Slot');
this.onDone = def.onDone;
this.generatorSlot = null;
}
generateCode(generator) {
if (this.onDone) {
generator.onDone((generator) => {
this.on... | 'use strict';
var Node = require('./Node');
class Slot extends Node {
constructor(def) {
super('Slot');
this.generatorSlot = null;
}
generateCode(generator) {
// At the time the code for this node is to be generated we instead
// create a slot. A slot is just a marker in ... |
Remove blank line that breaks cgo | package rc4
// #cgo LDFLAGS: -lcrypto
// #include <openssl/rc4.h>
import "C"
import (
"strconv"
)
type Cipher struct {
key *_Ctype_RC4_KEY
}
type KeySizeError int
func (k KeySizeError) Error() string {
return "rc4: invalid key size " + strconv.Itoa(int(k))
}
func NewCipher(key []byte) (*Cipher, error) {
k := ... | package rc4
// #cgo LDFLAGS: -lcrypto
// #include <openssl/rc4.h>
import "C"
import (
"strconv"
)
type Cipher struct {
key *_Ctype_RC4_KEY
}
type KeySizeError int
func (k KeySizeError) Error() string {
return "rc4: invalid key size " + strconv.Itoa(int(k))
}
func NewCipher(key []byte) (*Cipher, error) {
k :=... |
Use better health check details | package com.simplerecipemanager.resources;
import java.util.Map;
import java.util.Map.Entry;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import com.codahale.metrics.annotation.Timed;
import com.codahale.metrics.hea... | package com.simplerecipemanager.resources;
import java.util.Map;
import java.util.Map.Entry;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Response;
import com.codahale.metrics.health.HealthCheck.Result;
import com.codahale.metrics.health.HealthCheckRegistry;
@Path("/healthcheck")
public ... |
Update badge to show number of sensors currently in breach | import { generalStrings } from '../localization';
import { UIDatabase } from '../database';
const routeList = {
customerRequisitions: 'ResponseRequisition',
supplierRequisitions: 'RequestRequisition',
supplierInvoices: 'SupplierInvoice',
stocktakes: 'Stocktake',
customerInvoices: 'CustomerInvoice',
vaccine... | import { generalStrings } from '../localization';
import { UIDatabase } from '../database';
const routeList = {
customerRequisitions: 'ResponseRequisition',
supplierRequisitions: 'RequestRequisition',
supplierInvoices: 'SupplierInvoice',
stocktakes: 'Stocktake',
customerInvoices: 'CustomerInvoice',
vaccine... |
Refactor async wrapper. Use asyncio.run() for Py3.7 | import asyncio
import functools
import inspect
import sys
from rollbar.contrib.asgi import ASGIApp
def run(coro):
if sys.version_info >= (3, 7):
return asyncio.run(coro)
assert inspect.iscoroutine(coro)
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
try:
return loo... | import asyncio
import functools
from rollbar.contrib.asgi import ASGIApp
def async_test_func_wrapper(asyncfunc):
@functools.wraps(asyncfunc)
def wrapper(*args, **kwargs):
try:
loop = asyncio.get_running_loop()
except RuntimeError:
loop = asyncio.new_event_loop()
... |
Add frontend side of cookie auth | var User = function(baseUrl) {
var self = this;
this.baseUrl = baseUrl;
this.username = '';
this.password = '';
this.errorThrown = '';
this.onAuthUpdate = function() {
// This cookie is set when the login API call returns 200.
// As we may be running on a different domain, we ensure this cookie is u... | var User = function(baseUrl) {
var self = this;
this.baseUrl = baseUrl;
this.username = '';
this.password = '';
this.errorThrown = '';
this.onAuthUpdate = function() {
// as long as the frontend and backend are served from different domains,
// this doesn't work, as we can't access the backend's coo... |
Update count fields on RawDataVersionAdmin | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Custom administration panels for tracking models.
"""
from __future__ import unicode_literals
from django.contrib import admin
from calaccess_raw import models
from .base import BaseAdmin
@admin.register(models.RawDataVersion)
class RawDataVersionAdmin(BaseAdmin):
... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Custom administration panels for tracking models.
"""
from __future__ import unicode_literals
from django.contrib import admin
from calaccess_raw import models
from .base import BaseAdmin
@admin.register(models.RawDataVersion)
class RawDataVersionAdmin(BaseAdmin):
... |
Switch browserify back to debugging mode. | 'use strict';
var gulp = require('gulp');
var config = require('./_config.js');
var paths = config.paths;
var $ = config.plugins;
var istanbul = require('browserify-istanbul');
gulp.task('clean', function () {
return gulp.src(paths.tmp, {read: true})
.pipe($.rimraf());
});
gulp.task('build', ['index.html', '... | 'use strict';
var gulp = require('gulp');
var config = require('./_config.js');
var paths = config.paths;
var $ = config.plugins;
var istanbul = require('browserify-istanbul');
gulp.task('clean', function () {
return gulp.src(paths.tmp, {read: true})
.pipe($.rimraf());
});
gulp.task('build', ['index.html', '... |
Fix search sorting so that a search result never has "undefined" plays or favorities. This could break sorting in unexpected ways. E.g. Katy Perry shows plays but favorites on YouTube. It is better to simply avoid the use of undefined variables. | var _ = require('underscore')._;
function SearchResult(options) {
_.extend(this, _.pick(options,
'url', 'permalink', 'siteMediaID',
'siteCode', 'icon', 'author',
'mediaName', 'duration', 'type'));
var stats = {querySimilarity: 1, playRelevance: 1, favoriteRelevance: 1, relevance: 0.5};
stats = _.extend(sta... | var _ = require('underscore')._;
function SearchResult(options) {
_.extend(this, _.pick(options,
'url', 'permalink', 'siteMediaID',
'siteCode', 'icon', 'author',
'mediaName', 'duration', 'type'));
var stats = {querySimilarity: 1, playRelevance: 1, favoriteRelevance: 1, relevance: 0.5};
stats = _.extend(sta... |
Change the api.update_status() call to explicitly state the 'status' message.
- A recent version of Tweepy required it to be explicit, no harm in always being so | #!/usr/bin/env python
# twitterfunctions.py
# description: This file contains all the functions that are used when connecting to Twitter. Almost all of them rely on Tweepy
# copyrigtht: 2015 William Patton - PattonWebz
# licence: GPLv3
import tweepy
def authenticatetwitter(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_KEY, A... | #!/usr/bin/env python
# twitterfunctions.py
# description: This file contains all the functions that are used when connecting to Twitter. Almost all of them rely on Tweepy
# copyrigtht: 2015 William Patton - PattonWebz
# licence: GPLv3
import tweepy
def authenticatetwitter(CONSUMER_KEY, CONSUMER_SECRET, ACCESS_KEY, A... |
Move Gogland report higher up list because it couldn’t be used. | package reporters
import (
"os/exec"
"github.com/approvals/go-approval-tests/utils"
)
// NewFrontLoadedReporter creates the default front loaded reporter.
func NewFrontLoadedReporter() *Reporter {
tmp := NewFirstWorkingReporter(
NewContinuousIntegrationReporter(),
)
return &tmp
}
// NewDiffReporter creates ... | package reporters
import (
"os/exec"
"github.com/approvals/go-approval-tests/utils"
)
// NewFrontLoadedReporter creates the default front loaded reporter.
func NewFrontLoadedReporter() *Reporter {
tmp := NewFirstWorkingReporter(
NewContinuousIntegrationReporter(),
)
return &tmp
}
// NewDiffReporter creates ... |
Remove unused byName @SecondaryKey from ApprovalCategory
Change-Id: Ic00e7fcd48f206f16d49b96dc4890c5ae3dc7252
Signed-off-by: Shawn O. Pearce <f3ea74d906fa9fe97c1fef6bad9cb871485c7045@google.com> | // Copyright (C) 2008 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable ... | // Copyright (C) 2008 The Android Open Source Project
//
// 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 ... |
Add an accessor for the SecurityClassification enum. | /**
* Copyright (c) Codice Foundation
*
* This is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser
* General Public License as published by the Free Software Foundation, either version 3 of the
* License, or any later version.
*
* This program is distributed in the hope... | /**
* Copyright (c) Codice Foundation
*
* This is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser
* General Public License as published by the Free Software Foundation, either version 3 of the
* License, or any later version.
*
* This program is distributed in the hope... |
Fix bug with daily forecast | import React from 'react';
const Daily = ({ weather }) => {
const daily = weather[0].forecast.simpleforecast.forecastday;
const nextTen = daily.filter((day, i) => {
return i > 0;
});
return (
<section className='extended-forecast'>
<h3 className='title'>10 Day Forecast</h3>
<div className='... | import React from 'react';
const Daily = ({ weather }) => {
const daily = weather[0].forecast.simpleforecast.forecastday;
daily.shift();
return (
<section className='extended-forecast'>
<h3 className='title'>10 Day Forecast</h3>
<div className='daily-forecast'>
{daily.map((day, i) => {
... |
Improve help text of registry server opts
Partial-Bug: #1570946
Change-Id: Iad255d3ab5d96b91f897731f4f29cd804d6b1840 | # Copyright 2010-2011 OpenStack Foundation
# 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... | # Copyright 2010-2011 OpenStack Foundation
# 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... |
Implement a search test for when there is no matching template | # -*- coding: utf-8 -*-
import pathlib
import json
import pytest
@pytest.fixture
def templates_file():
return 'tests/templates.json'
def scenarios():
yield ['django', 'docker'], ['cookiecutter-django']
yield ['pytest'], [
'cookiecutter-pylibrary',
'cookiecutter-pypackage',
'co... | # -*- coding: utf-8 -*-
import pathlib
import json
import pytest
@pytest.fixture
def templates_file():
return 'tests/templates.json'
def scenarios():
yield ['django', 'docker'], ['cookiecutter-django']
yield ['pytest'], [
'cookiecutter-pylibrary',
'cookiecutter-pypackage',
'co... |
Load orgs inside location promise | import React, { Component } from 'react'
import globalConfig from '../../config'
import { fetchLocation, fetchOrganization } from '../../core/firebaseRestAPI'
import Layout from '../../components/Layout'
import Loading from '../../components/Loading'
import Location from '../../components/Location'
export default c... | import React, { Component } from 'react'
import globalConfig from '../../config'
import { fetchLocation, fetchOrganization } from '../../core/firebaseRestAPI'
import Layout from '../../components/Layout'
import Loading from '../../components/Loading'
import Location from '../../components/Location'
export default c... |
Use the Link component from react-router in combination with our custom styled Link | import React, { PureComponent } from 'react';
import { Link, Heading1, Section } from '../../components/';
import { BrowserRouter as Router, Link as ReactRouterLink } from 'react-router-dom';
Link.use(ReactRouterLink);
class LinkTest extends PureComponent {
handleClick = () => {
console.log('Clicked on a link')... | import React, { PureComponent } from 'react';
import Link from '../../components/link';
class LinkTest extends PureComponent {
handleClick = () => {
console.log('Clicked on a link');
};
render () {
return (
<article>
<header>
<h1>Links</h1>
</header>
<div classNam... |
fix: Add default case and fix help/version flag | package main
import (
"flag"
"fmt"
"github.com/cristianoliveira/ergo/commands"
"github.com/cristianoliveira/ergo/proxy"
"os"
)
const VERSION = "0.0.4"
const USAGE = `
Ergo proxy.
The local proxy agent for multiple services development.
Usage:
ergo [options]
ergo run [options]
ergo list
Options:
-h ... | package main
import (
"flag"
"fmt"
"github.com/cristianoliveira/ergo/commands"
"github.com/cristianoliveira/ergo/proxy"
"os"
)
const VERSION = "0.0.4"
const USAGE = `
Ergo proxy.
The local proxy agent for multiple services development.
Usage:
ergo [options]
ergo run [options]
ergo list
Options:
-h ... |
Use MutationObserver API to catch dom updates | function hide_covers() {
// Remove covers
$(".mix_element div.cover").remove()
// Add class so cards can be restyled
$(".mix_card.half_card").addClass("ext-coverless_card")
// Remove covers on track page
$("#cover_art").remove()
// Remove covers in the sidebar of a track page
$(".card.s... | function hide_covers() {
// Remove covers
$(".mix_element div.cover").remove()
// Add class so cards can be restyled
$(".mix_card.half_card").addClass("ext-coverless_card")
// Remove covers on track page
$("#cover_art").remove()
// Remove covers in the sidebar of a track page
$(".card.s... |
Add option to deploy specific branch/tag which defaults to master | /*
@method gitPull
Takes a flightplan instance and transport
@param remote {Object} Flightplan transport instance
@param webRoot {string} path to run git pull on the remote server
@param [gitIdentifier=master] {string} branch/tag/commit identifier
e.g. /var/www/project
*/
var gitPull = function (remote, we... | /*
@method gitPull
Takes a flightplan instance and transport
@param remote {Object} Flightplan transport instance
@param webRoot {string} path to run git pull on the remote server
e.g. /var/www/project
*/
var gitPull = function (remote, webRoot) {
// git pull
remote.with('cd ' + webRoot, function() {
... |
Validate the test github request | <?php
/**
* Created by PhpStorm.
* User: Danny
* Date: 15/06/2017
* Time: 06:37 PM
*/
namespace App\Http\Controllers;
use App\Notifications\ReviewerNotifier;
use App\SlackToken;
use App\User;
use function dd;
use Illuminate\Http\Request;
use Illuminate\Notifications\Notifiable;
use function json_decode;
class Notif... | <?php
/**
* Created by PhpStorm.
* User: Danny
* Date: 15/06/2017
* Time: 06:37 PM
*/
namespace App\Http\Controllers;
use App\Notifications\ReviewerNotifier;
use App\SlackToken;
use App\User;
use function dd;
use Illuminate\Http\Request;
use Illuminate\Notifications\Notifiable;
use function json_decode;
class Notif... |
Update snapshot util, disable javascript
My CentOs server was segfaulting without this option, and having
javascript on to render email templates just don't make any sense
anyway | <?php
namespace Ob\CampaignBundle\Utils;
use Knp\Snappy\Image;
class Snapshot
{
/**
* @var string
*/
private $folder;
/**
* @var string
*/
private $binaryPath;
/**
* @param null $folder The folder where to save the image
* @param string $binaryPath The path t... | <?php
namespace Ob\CampaignBundle\Utils;
use Knp\Snappy\Image;
class Snapshot
{
/**
* @var string
*/
private $folder;
/**
* @var string
*/
private $binaryPath;
/**
* @param null $folder The folder where to save the image
* @param string $binaryPath The path t... |
Use PAPERTRAIL_HOSTNAME env var instead of creating the hostname manually | 'use strict';
const winston = require('winston'),
DEBUG = process.env.DEBUG,
LOGGING_LEVEL = DEBUG ? 'debug' : 'info',
transports = [];
require('winston-papertrail').Papertrail;
if (!process.env.HIDE_ALL_LOGS) {
transports.push(new (winston.transports.Console)({
level: LOGGING_LEVEL,
colorize: true,
... | 'use strict';
const winston = require('winston'),
DEBUG = process.env.DEBUG,
LOGGING_LEVEL = DEBUG ? 'debug' : 'info',
transports = [];
require('winston-papertrail').Papertrail;
if (!process.env.HIDE_ALL_LOGS) {
transports.push(new (winston.transports.Console)({
level: LOGGING_LEVEL,
colorize: true,
... |
Make the build script P2/3 compatible | #! /usr/bin/env python
import os
import stat
import zipfile
try:
from StringIO import StringIO
except ImportError:
from io import BytesIO as StringIO
package_dir = 'xyppy'
python_directive = '#!/usr/bin/env python'
packed = StringIO()
packed_writer = zipfile.ZipFile(packed, 'w', zipfile.ZIP_DEFLATED)
for fn... | #! /usr/bin/env python
import os
import stat
import zipfile
import StringIO
package_dir = 'xyppy'
python_directive = '#!/usr/bin/env python'
packed = StringIO.StringIO()
packed_writer = zipfile.ZipFile(packed, 'w', zipfile.ZIP_DEFLATED)
for fname in os.listdir(package_dir):
fpath = os.path.join(package_dir, fnam... |
Change sendReports time to 11am
Signed-off-by: Felipe Milani <6def120dcec8fcb28aed4723fac713cfff66d853@gmail.com> | import { SyncedCron } from 'meteor/percolate:synced-cron';
import { sendReports } from '../../api/email/server/reports.js';
import EndOfMonthEnum from '../../api/settings/EndOfMonthEnum';
SyncedCron.add({
name: 'Send reports for users with end of month on last day',
schedule(parser) {
return parser.recur()
... | import { SyncedCron } from 'meteor/percolate:synced-cron';
import { sendReports } from '../../api/email/server/reports.js';
import EndOfMonthEnum from '../../api/settings/EndOfMonthEnum';
SyncedCron.add({
name: 'Send reports for users with end of month on last day',
schedule(parser) {
return parser.recur()
... |
Add missing comment and fix copyright date. | /**
* Copyright 2014 Rackspace
*
* 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 agree... | /**
* Copyright 2013 Rackspace
*
* 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 agree... |
Make hhvm-have-source-tarball take S3 info, and pass through input | 'use strict'
/**
* Copyright (c) 2017-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*... | 'use strict'
/**
* Copyright (c) 2017-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*... |
Fix detection of request type in IE | /*
==================================================================================================
Lowland - JavaScript low level functions
Copyright (C) 2012 Sebatian Fastner
==================================================================================================
*/
(function() {
"use strict";
/* gl... | /*
==================================================================================================
Lowland - JavaScript low level functions
Copyright (C) 2012 Sebatian Fastner
==================================================================================================
*/
core.Module("lowland.detect.IoReques... |
Make sure the aggregate service only using the IDirectoryService interface when interactive with its sub-services.
git-svn-id: 81e381228600e5752b80483efd2b45b26c451ea2@10781 e27351fd-9f3e-4f54-a53b-843176b1656c | ##
# Copyright (c) 2013 Apple 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... | ##
# Copyright (c) 2013 Apple 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... |
Use white when selected to contrast with blue | import React from 'react';
import PropTypes from 'prop-types';
//Custom all purpose dashboard button
class DashButton extends React.Component {
render() {
const {isSelected} = this.props;
return (
<div className="DashButton">
<a
style={{
backgroundColor: isSelected ? 'rgb... | import React from 'react';
import PropTypes from 'prop-types';
//Custom all purpose dashboard button
class DashButton extends React.Component {
render() {
return (
<div className="DashButton">
<a
style={{
backgroundColor: this.props.isSelected? 'rgba(49, 119, 201, 0.75)' : '... |
Add switch to activate debug in tests
Helpful in developing tests | var bs = require('../lib/beanstalk_client');
var net = require('net');
var port = process.env.BEANSTALK_PORT || 11333;
var mock = process.env.BEANSTALKD !== '1';
var mock_server;
var connection;
module.exports = {
bind : function (fn, closeOnEnd) {
if(!mock) {
return false;
}
mock_server = net.createSer... | var bs = require('../lib/beanstalk_client');
var net = require('net');
var port = process.env.BEANSTALK_PORT || 11333;
var mock = process.env.BEANSTALKD !== '1';
var mock_server;
var connection;
module.exports = {
bind : function (fn, closeOnEnd) {
if(!mock) {
return false;
}
mock_server = net.createSer... |
Disable Redux devtools in production. |
import 'babel-polyfill';
import React from 'react';
import ReactDOM from 'react-dom';
import { Router, Route, IndexRoute, browserHistory } from 'react-router';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware, compose } from 'redux';
import thunkMiddleware from 'redux-thunk';
import rootR... |
import 'babel-polyfill';
import React from 'react';
import ReactDOM from 'react-dom';
import { Router, Route, IndexRoute, browserHistory } from 'react-router';
import { Provider } from 'react-redux';
import { createStore, applyMiddleware, compose } from 'redux';
import thunkMiddleware from 'redux-thunk';
import rootR... |
Add UserId column to migration | 'use strict';
module.exports = {
up: function(queryInterface, Sequelize) {
return queryInterface.createTable('Tasks', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
name: {
type: Sequelize.STRING
},
... | 'use strict';
module.exports = {
up: function(queryInterface, Sequelize) {
return queryInterface.createTable('Tasks', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
name: {
type: Sequelize.STRING
},
... |
Add dedicated method to send request | <?php
namespace Powermash\ComicVine;
use Buzz\Browser;
use Buzz\Exception\RequestException;
/**
*
*/
class Client
{
const DEFAULT_ENDPOINT = 'http://www.comicvine.com/api/characters';
protected $apiKey;
protected $endpoint;
protected $browser;
public function __construct($key, $endpoint = null)
{
$this->a... | <?php
namespace Powermash\ComicVine;
use Buzz\Browser;
use Buzz\Exception\RequestException;
/**
*
*/
class Client
{
protected $apiKey;
protected $browser;
public function __construct($key)
{
$this->apiKey = $key;
$this->browser = new Browser();
}
public function randomCharacter()
{
$url = 'http://ww... |
Add final modifiers to immutable variables | package jp.setchi.HitAndBlow;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class StringUtility {
private StringUtility() {}
public static Boolean isDistinctChars(String str) {
if (str == null) {
throw new IllegalArgumen... | package jp.setchi.HitAndBlow;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class StringUtility {
private StringUtility() {}
public static Boolean isDistinctChars(String str) {
if (str == null) {
throw new IllegalArgumen... |
Fix bug with pip install. Update version to 0.1.1. | #
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | #
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... |
Allow more time for goroutines to exit | // Copyright 2012-2013 Apcera Inc. All rights reserved.
package test
import (
"runtime"
"testing"
"time"
)
func TestSimpleGoServerShutdown(t *testing.T) {
base := runtime.NumGoroutine()
s := RunDefaultServer()
s.Shutdown()
time.Sleep(10 * time.Millisecond)
delta := (runtime.NumGoroutine() - base)
if delta >... | // Copyright 2012-2013 Apcera Inc. All rights reserved.
package test
import (
"runtime"
"testing"
"time"
)
func TestSimpleGoServerShutdown(t *testing.T) {
base := runtime.NumGoroutine()
s := RunDefaultServer()
s.Shutdown()
time.Sleep(10 * time.Millisecond)
delta := (runtime.NumGoroutine() - base)
if delta >... |
Revert "progress on DDG cog & aiohttp wrapper"
This reverts commit 6b6d243e96bd13583e7f02dfe6669578d238a594. | #!/bin/env python
import aiohttp
async def aio_get(url: str):
async with aiohttp.ClientSession() as session:
<<<<<<< HEAD
async with session.get(url, headers=headers) as r:
if r.status == 200:
return r.text()
else:
return None
async def aio_get_jso... | #!/bin/env python
import aiohttp
async def aio_get_text(url, headers=None):
async with aiohttp.ClientSession() as session:
async with session.get(url, headers=headers) as r:
if r.status == 200:
return r.text()
else:
return None
async def aio_get_js... |
Make cleanBin escape carriage returns.
We get confusing output on terminals if we leave \r unescaped. |
def cleanBin(s, fixspacing=False):
"""
Cleans binary data to make it safe to display. If fixspacing is True,
tabs, newlines and so forth will be maintained, if not, they will be
replaced with a placeholder.
"""
parts = []
for i in s:
o = ord(i)
if (o > 31 and o <... |
def cleanBin(s, fixspacing=False):
"""
Cleans binary data to make it safe to display. If fixspacing is True,
tabs, newlines and so forth will be maintained, if not, they will be
replaced with a placeholder.
"""
parts = []
for i in s:
o = ord(i)
if (o > 31 and o <... |
Music: Fix stopAll() not working (at all) | var Music = {
sounds: { },
prepareSound: function(filename) {
if (typeof(this.sounds[filename]) == 'undefined') {
this.sounds[filename] = new Audio('assets/audio/' + filename);
}
return this.sounds[filename];
},
loopSound: function(filename) {
var sound = t... | var Music = {
sounds: { },
prepareSound: function(filename) {
if (typeof(this.sounds[filename]) == 'undefined') {
this.sounds[filename] = new Audio('assets/audio/' + filename);
}
return this.sounds[filename];
},
loopSound: function(filename) {
var sound = t... |
Drop python2-era manual encode dance | import sys
import csv
from django.core.management.base import BaseCommand
from django.contrib.auth import get_user_model
from wafer.talks.models import Talk, ACCEPTED, PROVISIONAL
class Command(BaseCommand):
help = ("List talks and the associated video_reviewer emails."
" Only reviewers for accepted... | import sys
import csv
from django.core.management.base import BaseCommand
from django.contrib.auth import get_user_model
from wafer.talks.models import Talk, ACCEPTED, PROVISIONAL
class Command(BaseCommand):
help = ("List talks and the associated video_reviewer emails."
" Only reviewers for accepted... |
Cut the over than 80 columns code | module.exports = function (app, passport) {
var authorization = require('../controllers/authorization'),
pages = require('../controllers/pages'),
users = require('../controllers/users'),
auth = require('../lib/authorization');
app.get('/', pages.index);
app.get('/about', pages.about);
app.get('/si... |
module.exports = function (app, passport) {
var authorization = require('../controllers/authorization'),
pages = require('../controllers/pages'),
users = require('../controllers/users'),
auth = require('../lib/authorization');
app.get('/', pages.index);
app.get('/about', pages.about);
app.... |
Extend site model with storage for a defaultRoomID.
This is used in conjunction with autopromote to allow homecloud
to auto-promote all newly created devices.
Signed-off-by: Jon Seymour <44f878afe53efc66b76772bd845eb65944ed8232@ninjablocks.com> | package model
type Site struct {
ID string `json:"id,omitempty" redis:"id"`
Name *string `json:"name,omitempty" redis:"name"`
Type *string `json:"type,omitempty" redis:"type"`
Latitude *float64 `json:"latitude,omitempty" redis:"latitude"`
Longitude *... | package model
type Site struct {
ID string `json:"id,omitempty" redis:"id"`
Name *string `json:"name,omitempty" redis:"name"`
Type *string `json:"type,omitempty" redis:"type"`
Latitude *float64 `json:"latitude,omitempty" redis:"latitude"`
Longitude *... |
Add jobtype as index for schedule | package org.commonjava.indy.schedule.datastax;
public class ScheduleDBUtil
{
public static final String TABLE_SCHEDULE = "schedule";
public static String getSchemaCreateTableSchedule( String keyspace )
{
return "CREATE TABLE IF NOT EXISTS " + keyspace + "." + TABLE_SCHEDULE + " ("
... | package org.commonjava.indy.schedule.datastax;
public class ScheduleDBUtil
{
public static String getSchemaCreateTableSchedule( String keyspace )
{
return "CREATE TABLE IF NOT EXISTS " + keyspace + ".schedule ("
+ "jobtype varchar,"
+ "jobname varchar,"
... |
Add all code annotations in single line block comments instead of only @var. | <?php
/**
* PHP version 5
*
* @author Christian Schiffler <c.schiffler@cyberspectrum.de>
* @copyright 2014 Contao Community Alliance
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
*/
/**
* Verifies that block comments are used appropriately.
*
* This alters th... | <?php
/**
* PHP version 5
*
* @author Christian Schiffler <c.schiffler@cyberspectrum.de>
* @copyright 2014 Contao Community Alliance
* @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
*/
/**
* Verifies that block comments are used appropriately.
*
* This alters th... |
Add strings for upcoming features to common learn strings | import { createTranslator } from 'kolibri.utils.i18n';
export const learnStrings = createTranslator('CommonLearnStrings', {
// Labels
learnLabel: {
message: 'Learn',
context:
"Each time a learner signs in to Kolibri, the first thing they see is the 'Learn' page with the list of all the classes they ... | import { createTranslator } from 'kolibri.utils.i18n';
export const learnStrings = createTranslator('CommonLearnStrings', {
// Labels
learnLabel: {
message: 'Learn',
context:
"Each time a learner signs in to Kolibri, the first thing they see is the 'Learn' page with the list of all the classes they ... |
Remove calls to the console from the background script | /*
* Default Values of options
*/
var defaults = {
min: 39000
};
function onError(e){
console.error(e);
}
// to be run when the app is installed.
function checkStorage(res){
var keys = Object.keys(defaults);
for (var i = 0; i < keys.length;i++){
var nthKey = keys[i];
if (!res[nthKey]){
... | /*
* Default Values of options
*/
var defaults = {
min: 39000
};
function onError(e){
console.error(e);
}
// to be run when the app is installed.
function checkStorage(res){
var keys = Object.keys(defaults);
for (var i = 0; i < keys.length;i++){
var nthKey = keys[i];
if (!res[nthKey]){
... |
Change fillable user_name to name in model | <?php
namespace ZaLaravel\LaravelUser\Models;
use Illuminate\Auth\Authenticatable;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
use Illuminate\Database\Eloquent\Model... | <?php
namespace ZaLaravel\LaravelUser\Models;
use Illuminate\Auth\Authenticatable;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
use Illuminate\Database\Eloquent\Model... |
Disable the jbcsrc debug flag, this was accidentally left on in a debugging session.
GITHUB_BREAKING_CHANGES=none
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=255963260 | /*
* Copyright 2015 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to ... | /*
* Copyright 2015 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to ... |
Fix test for Traits listing | <?php
namespace fennecweb\ajax\listing;
use \fennecweb\WebService as WebService;
class TraitsTest extends \PHPUnit_Framework_TestCase
{
public function testExecute()
{
//Test for error returned by user is not logged in
list($service) = WebService::factory('listing/Traits');
$results ... | <?php
namespace fennecweb\ajax\listing;
use \fennecweb\WebService as WebService;
class TraitsTest extends \PHPUnit_Framework_TestCase
{
public function testExecute()
{
//Test for error returned by user is not logged in
list($service) = WebService::factory('listing/Traits');
$results ... |
Change value in "should assert equality with ===" block | describe("About Expects", function() {
//We shall contemplate truth by testing reality, via spec expectations.
it("should expect true", function() {
expect(true).toBeTruthy(); //This should be true
});
//To understand reality, we must compare our expectations against reality.
it("should expect equalit... | describe("About Expects", function() {
//We shall contemplate truth by testing reality, via spec expectations.
it("should expect true", function() {
expect(true).toBeTruthy(); //This should be true
});
//To understand reality, we must compare our expectations against reality.
it("should expect equalit... |
Add daily import for Google Analytics boosting | <?php
namespace App\Console\Commands;
use Aic\Hub\Foundation\AbstractCommand as BaseCommand;
class ImportScheduleDaily extends BaseCommand
{
protected $signature = 'import:daily';
protected $description = 'Run all increment commands on sources that we\'re able to, and do a full refresh on sources that requ... | <?php
namespace App\Console\Commands;
use Aic\Hub\Foundation\AbstractCommand as BaseCommand;
class ImportScheduleDaily extends BaseCommand
{
protected $signature = 'import:daily';
protected $description = 'Run all increment commands on sources that we\'re able to, and do a full refresh on sources that requ... |
Move Namespace in first line | <?php namespace Xaamin\Curl;
use Illuminate\Foundation\AliasLoader as Loader;
use Illuminate\Support\ServiceProvider;
/**
* CURL Service provider
*
* @package Xaamin\Curl
* @author Benjamín Martínez Mateos <bmxamin@gmail.com>
*/
class CurlServiceProvider extends ServiceProvider
{
/**
* Indicates if loa... | <?php
namespace Xaamin\Curl;
use Illuminate\Foundation\AliasLoader as Loader;
use Illuminate\Support\ServiceProvider;
/**
* CURL Service provider
*
* @package Xaamin\Curl
* @author Benjamín Martínez Mateos <bmxamin@gmail.com>
*/
class CurlServiceProvider extends ServiceProvider
{
/**
* Indicates if lo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.