text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Increase request buffer as workaround for stackoverflow in asyncio | from japronto import Application
from services.articles import ArticleService
from mongoengine import *
article_service = ArticleService()
def index(req):
"""
The main index
"""
return req.Response(text='You reached the index!')
def articles(req):
"""
Get alll articles
"""
docs = article_service.all()
ret... | from japronto import Application
from services.articles import ArticleService
from mongoengine import *
article_service = ArticleService()
def index(req):
"""
The main index
"""
return req.Response(text='You reached the index!')
def articles(req):
"""
Get alll articles
"""
docs = article_service.all()
ret... |
Add test that validates method call | from money_conversion.money import Money
import unittest
class MoneyClassTest(unittest.TestCase):
def setUp(self):
self.twenty_euro = Money(20, 'EUR')
def test_convert_euro_to_usd(self):
twenty_usd = self.twenty_euro.to_usd()
self.assertIsInstance(twenty_usd, Money)
self.asse... | from money_conversion.money import Money
import unittest
class MoneyClassTest(unittest.TestCase):
def setUp(self):
self.twenty_euro = Money(20, 'EUR')
def test_convert_euro_to_usd(self):
twenty_usd = self.twenty_euro.to_usd()
self.assertIsInstance(twenty_usd, Money)
self.asse... |
Use bigrams in Markov chain generator | """Displays a randomly generated witticism from Brian Chu himself."""
import json
import random
__match__ = r"!brian"
attribution = [
"salad master",
"esquire",
"the one and only",
"startup enthusiast",
"boba king",
"not-dictator",
"normal citizen",
"ping-pong expert"
]
with ... | """Displays a randomly generated witticism from Brian Chu himself."""
import json
import random
__match__ = r"!brian"
with open('plugins/brian_corpus/cache.json', 'r') as infile:
cache = json.load(infile)
with open('plugins/brian_corpus/phrases.json', 'r') as infile:
phrases = json.load(infile)
def gener... |
Correct Balance update logic upon transaction | package devopsdistilled.operp.server.data.service.account.impl;
import java.util.Date;
import javax.inject.Inject;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import devopsdistilled.operp.server.data.entity.account.PaidTransaction;
import devopsdis... | package devopsdistilled.operp.server.data.service.account.impl;
import java.util.Date;
import javax.inject.Inject;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import devopsdistilled.operp.server.data.entity.account.PaidTransaction;
import devopsdis... |
Put event handler in separate func | package main
import (
"errors"
"sdl"
)
const (
defaultWidth, defaultHeight = 1024, 768
gameName = "gogame"
)
var (
quitting = errors.New("quitting")
)
func eventHandler(e interface{}) error {
switch v := e.(type) {
case sdl.QuitEvent:
return quitting
case sdl.KeyEvent:
if v.Type == sdl.KeyUp {
switch... | package main
import (
"errors"
"sdl"
)
const (
defaultWidth, defaultHeight = 1024, 768
gameName = "gogame"
)
func main() {
ctx, err := sdl.NewContext(gameName, defaultWidth, defaultHeight)
if err != nil {
panic(err)
}
defer ctx.Close()
quit := errors.New("quitting")
for {
err = sdl.HandleEvents(func(... |
Handle zero-padding for millisecond component
Fixes tests for 1 and 12 milliseconds. | (function (millisecondsToISO8601Duration) {
'use strict';
millisecondsToISO8601Duration.iso8601duration = function(milliseconds) {
var offset = Math.floor(milliseconds);
var milliseconds = offset % 1000;
offset = Math.floor(offset / 1000);
var seconds = offset % 60;
offset = Math.floor(offset / 60);
var ... | (function (millisecondsToISO8601Duration) {
'use strict';
millisecondsToISO8601Duration.iso8601duration = function(milliseconds) {
var offset = Math.floor(milliseconds);
var milliseconds = offset % 1000;
offset = Math.floor(offset / 1000);
var seconds = offset % 60;
offset = Math.floor(offset / 60);
var ... |
Disable ant trails for now, too expensive | // Global planners
var room_counter = require("planners_global_room_counter");
// Local planners
var construction = require("planners_local_construction");
var towers = require("planners_local_towers");
var family_planner = require("planners_local_family_planner");
var ant_trail = require("planners_local_ant_trail");
... | // Global planners
var room_counter = require("planners_global_room_counter");
// Local planners
var construction = require("planners_local_construction");
var towers = require("planners_local_towers");
var family_planner = require("planners_local_family_planner");
var ant_trail = require("planners_local_ant_trail");
... |
Add comment explaining why we disable ip_forward | # coding: latin-1
"""
pax_mininet_node.py: Defines PaxNode which allows Pax to behave as the sole packet hander on a node.
"""
from mininet.node import Node
from mininet.log import info, warn
class PaxNode( Node ):
"PaxNode: A node which allows Pax to behave as the sole packet hander on that node."
def __in... | # coding: latin-1
"""
pax_mininet_node.py: Defines PaxNode which allows Pax to behave as the sole packet hander on a node.
"""
from mininet.node import Node
from mininet.log import info, warn
class PaxNode( Node ):
"PaxNode: A node which allows Pax to behave as the sole packet hander on that node."
def __in... |
Remove specific path for Travis | 'use strict';
/**
* This file contains the variables used in other gulp files
* which defines tasks
* By design, we only put there very generic config values
* which are used in several places to keep good readability
* of the tasks
*/
const path = require('path');
const gutil = require('gulp-util');
<% i... | 'use strict';
/**
* This file contains the variables used in other gulp files
* which defines tasks
* By design, we only put there very generic config values
* which are used in several places to keep good readability
* of the tasks
*/
const path = require('path');
const gutil = require('gulp-util');
<% i... |
Fix domains test after pull & npm install | 'use strict';
let nock = require('nock');
let cmd = require('../../../commands/domains');
let expect = require('chai').expect;
describe('domains', function() {
beforeEach(() => cli.mockConsole());
it('shows the domains', function() {
let api = nock('https://api.heroku.com:443')
.get('/apps/myapp/d... | 'use strict';
let nock = require('nock');
let cmd = require('../../../commands/domains');
let expect = require('chai').expect;
describe('domains', function() {
beforeEach(() => cli.mockConsole());
it('shows the domains', function() {
let api = nock('https://api.heroku.com:443')
.get('/apps/myapp/d... |
Add State to Artifact struct to support the new packer api (v0.7.2) | package softlayer
import (
"fmt"
"log"
)
// Artifact represents a Softlayer image as the result of a Packer build.
type Artifact struct {
imageName string
imageId string
datacenterName string
client *SoftlayerClient
}
// BuilderId returns the builder Id.
func (*Artifact) BuilderId() string ... | package softlayer
import (
"fmt"
"log"
)
// Artifact represents a Softlayer image as the result of a Packer build.
type Artifact struct {
imageName string
imageId string
datacenterName string
client *SoftlayerClient
}
// BuilderId returns the builder Id.
func (*Artifact) BuilderId() string ... |
Include missing argument in router query string method | class GelatoRouter extends Backbone.Router {
execute(callback, args, name) {
if (this.page) {
this.page.remove();
}
this.trigger('navigate:before', args, name);
callback && callback.apply(this, args);
this.trigger('navigate:after', args, name);
}
getQueryString(name) {
const locat... | class GelatoRouter extends Backbone.Router {
execute(callback, args, name) {
if (this.page) {
this.page.remove();
}
this.trigger('navigate:before', args, name);
callback && callback.apply(this, args);
this.trigger('navigate:after', args, name);
}
getQueryString() {
const location ... |
Make sure encoding closes correctly | package io.appium.android.bootstrap.utils;
import java.nio.charset.Charset;
import io.appium.android.bootstrap.Logger;
public class UnicodeEncoder {
private static final Charset M_UTF7 = Charset.forName("x-IMAP-mailbox-name");
private static final Charset ASCII = Charset.forName("US-ASCII");
public static ... | package io.appium.android.bootstrap.utils;
import java.nio.charset.Charset;
public class UnicodeEncoder {
private static final Charset M_UTF7 = Charset.forName("x-IMAP-mailbox-name");
private static final Charset ASCII = Charset.forName("US-ASCII");
public static String encode(final String text) {
byte[... |
Fix module name in JSDoc | 'use strict';
/**
* Uniformly distributed pseudorandom numbers.
*
* @module @stdlib/math/base/random/randu
*
* @example
* var randu = require( '@stdlib/math/base/random/randu' );
*
* var v = randu();
* // returns <number>
*
* @example
* var factory = require( '@stdlib/math/base/random/randu' ).factory;
*
* var randu =... | 'use strict';
/**
* Uniformly distributed pseudorandom numbers.
*
* @module @stdlib/math/base/random/uniform
*
* @example
* var randu = require( '@stdlib/math/base/random/randu' );
*
* var v = randu();
* // returns <number>
*
* @example
* var factory = require( '@stdlib/math/base/random/randu' ).factory;
*
* var randu... |
Increase keepalive to 24 hrs. | 'use strict';
let mqtt = require('mqtt');
let mqttClient;
module.exports = {
connect: function (options, callback) {
mqttClient = mqtt.connect(options.url, {
keepalive: 86400,
clientId: options.machineCode,
username: options.user,
password: options.pass,
reconnectPeriod: 1000
});
mqttClient.on(... | 'use strict';
let mqtt = require('mqtt');
let mqttClient;
module.exports = {
connect: function (options, callback) {
mqttClient = mqtt.connect(options.url, {
keepalive: 300,
clientId: options.machineCode,
username: options.user,
password: options.pass,
reconnectPeriod: 1000
});
mqttClient.on('c... |
Remove django requirement to prevent version conflicts when using pip | #!/usr/bin/env python
from setuptools import setup,find_packages
METADATA = dict(
name='django-socialregistration',
version='0.4.3',
author='Alen Mujezinovic',
author_email='alen@caffeinehit.com',
description='Django application enabling registration through a variety of APIs',
long_description... | #!/usr/bin/env python
from setuptools import setup,find_packages
METADATA = dict(
name='django-socialregistration',
version='0.4.3',
author='Alen Mujezinovic',
author_email='alen@caffeinehit.com',
description='Django application enabling registration through a variety of APIs',
long_description... |
Use ActivityCompat instead of reinventing the wheel | package net.redwarp.library.testapplication;
import android.os.Bundle;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;
import android.widget.TextView;
import butterknife.Bind;
import butterknife.ButterKnife;
public class DetailActivity ext... | package net.redwarp.library.testapplication;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;
import android.widget.TextView;
import butterknife.Bind;
import butterknife.ButterKnife;
public class DetailActivity extends AppCompatActivit... |
Refactor str_to_num to be more concise
Functionally nothing has changed. We just need not try twice nor
define the variable _ twice. | # -*- coding: utf-8 -*-
def str_to_num(i, exact_match=True):
"""
Attempts to convert a str to either an int or float
"""
# TODO: Cleanup -- this is really ugly
if not isinstance(i, str):
return i
try:
if not exact_match:
return int(i)
elif str(int(i)) == i:
... | # -*- coding: utf-8 -*-
def str_to_num(i, exact_match=True):
"""
Attempts to convert a str to either an int or float
"""
# TODO: Cleanup -- this is really ugly
if not isinstance(i, str):
return i
try:
_ = int(i)
if not exact_match:
return _
elif str(_... |
Fix zoom levels for example. | var playlist = WaveformPlaylist.init({
samplesPerPixel: 3000,
zoomLevels: [500, 1000, 3000, 5000],
mono: true,
waveHeight: 100,
container: document.getElementById("playlist"),
state: 'cursor',
waveOutlineColor: '#E0EFF1',
colors: {
waveOutlineColor: '#E0EFF1',
timeColor: 'grey',
fadeCo... | var playlist = WaveformPlaylist.init({
samplesPerPixel: 3000,
mono: true,
waveHeight: 100,
container: document.getElementById("playlist"),
state: 'cursor',
waveOutlineColor: '#E0EFF1',
colors: {
waveOutlineColor: '#E0EFF1',
timeColor: 'grey',
fadeColor: 'black'
},
controls: {
sho... |
Use css class instead of direct formatting
In order to preserve the hover effect on the table, use a css class to
highlight table rows with active projects. | name: Dashboard - Highlight active projects (Compact View only)
description: See https://github.com/quincunx/testrail-ui-scripts
author: Christian Schuerer-Waldheim <csw@gmx.at>
version: 1.0
includes: ^dashboard
excludes:
js:
$(document).ready(
function() {
// Check if Compact View is being displayed
if ($(... | name: Dashboard - Highlight active projects (Compact View only)
description: See https://github.com/quincunx/testrail-ui-scripts
author: Christian Schuerer-Waldheim <csw@gmx.at>
version: 1.0
includes: ^dashboard
excludes:
js:
$(document).ready(
function() {
// Check if Compact View is being displayed
if ($(... |
Mark all scripts as 0o755
This gives execute permission for everyone even if Atom is installed as root:
https://github.com/atom/atom/issues/19367 | #!/usr/bin/env node
var cp = require('child_process')
var fs = require('fs')
var path = require('path')
var script = path.join(__dirname, 'postinstall')
if (process.platform === 'win32') {
script += '.cmd'
} else {
script += '.sh'
}
// Make sure all the scripts have the necessary permissions when we execute them... | #!/usr/bin/env node
var cp = require('child_process')
var fs = require('fs')
var path = require('path')
var script = path.join(__dirname, 'postinstall')
if (process.platform === 'win32') {
script += '.cmd'
} else {
script += '.sh'
}
// Read + execute permission
fs.chmodSync(script, fs.constants.S_IRUSR | fs.cons... |
Update muteConsole & restoreConsole functions | const fs = require('fs');
export const makeAsyncCallback = (callbackValue) => {
let promiseResolve;
const promise = new Promise((resolve) => {
promiseResolve = resolve;
});
const func = jest.fn(
callbackValue
? () => promiseResolve(callbackValue)
: (...args) => promiseResolve(args.length ==... | const fs = require('fs');
export const makeAsyncCallback = (callbackValue) => {
let promiseResolve;
const promise = new Promise((resolve) => {
promiseResolve = resolve;
});
const func = jest.fn(
callbackValue
? () => promiseResolve(callbackValue)
: (...args) => promiseResolve(args.length ==... |
Fix code for review comments | """Functions to retrieve pending list and invoke Graph Sync."""
import f8a_jobs.defaults as configuration
import requests
import traceback
import logging
from urllib.parse import urljoin
logger = logging.getLogger(__name__)
def _api_call(url, params=None):
params = params or {}
try:
logger.info("AP... | """Functions to retrieve pending list and invoke Graph Sync."""
import f8a_jobs.defaults as configuration
import requests
import traceback
import logging
logger = logging.getLogger(__name__)
def _api_call(url, params={}):
try:
logger.info("API Call for url: %s, params: %s" % (url, params))
r = ... |
Add example of using sorting options for calcs
Signed-off-by: Patrick Avery <743342299f279e7a8c3ff5eb40671fce3e95f13a@kitware.com> | import React, { Component } from 'react';
import { connect } from 'react-redux'
import { push } from 'connected-react-router';
import { selectors } from '@openchemistry/redux'
import { calculations, molecules } from '@openchemistry/redux'
import { isNil } from 'lodash-es';
import Calculations from '../components/cal... | import React, { Component } from 'react';
import { connect } from 'react-redux'
import { push } from 'connected-react-router';
import { selectors } from '@openchemistry/redux'
import { calculations, molecules } from '@openchemistry/redux'
import { isNil } from 'lodash-es';
import Calculations from '../components/cal... |
Fix selector not using get | import { takeLatest } from 'redux-saga';
import { call, put, select, take } from 'redux-saga/effects';
import { NOT_CONNECTED, CREATING_ACCOUNT, CONNECTED_CREATING_ACCOUNT } from '../messages';
import * as libs from '../libs';
import * as actions from '../actions';
import * as types from '../types';
import * as deps fr... | import { takeLatest } from 'redux-saga';
import { call, put, select, take } from 'redux-saga/effects';
import { NOT_CONNECTED, CREATING_ACCOUNT, CONNECTED_CREATING_ACCOUNT } from '../messages';
import * as libs from '../libs';
import * as actions from '../actions';
import * as types from '../types';
import * as deps fr... |
Make wedding page home page. | import React from 'react';
import { Router, Route, IndexRoute, browserHistory } from 'react-router';
import { syncHistoryWithStore } from 'react-router-redux';
import App from './components/App';
import BlogContainer from './containers/blog-container';
import PostEditorContainer from './containers/post-editor-containe... | import React from 'react';
import { Router, Route, IndexRoute, browserHistory } from 'react-router';
import { syncHistoryWithStore } from 'react-router-redux';
import App from './components/App';
import BlogContainer from './containers/blog-container';
import PostEditorContainer from './containers/post-editor-containe... |
Fix issue where tar command would fail if there were too many command line arguments
Signed-off-by: Dan Weinberg <5ed7700fd0f25639b4f8f8b3c1bd72b4eff8b781@cloudcredo.com> | // +build !windows
package commands
import (
"io"
"log"
"os"
"os/exec"
)
func tarStreamFrom(workDir string, paths []string) (io.ReadCloser, error) {
var archive io.ReadCloser
var writer io.WriteCloser
if tarPath, err := exec.LookPath("tar"); err == nil {
tarCmd := exec.Command(tarPath, []string{"-czf", "-"... | // +build !windows
package commands
import (
"io"
"log"
"os"
"os/exec"
)
func tarStreamFrom(workDir string, paths []string) (io.ReadCloser, error) {
var archive io.ReadCloser
if tarPath, err := exec.LookPath("tar"); err == nil {
tarCmd := exec.Command(tarPath, append([]string{"-czf", "-"}, paths...)...)
t... |
Add filters module to deps | 'use strict';
var angular = require('angular');
// angular modules
require('angular-ui-router');
require('angular-animate');
require('angular-moment');
require('angular-loading-bar');
require('./templates');
require('./controllers/_index');
require('./services/_index');
require('./directives/_index');
require('./comp... | 'use strict';
var angular = require('angular');
// angular modules
require('angular-ui-router');
require('angular-animate');
require('angular-moment');
require('angular-loading-bar');
require('./templates');
require('./controllers/_index');
require('./services/_index');
require('./directives/_index');
require('./comp... |
Fix AppView test to render activity indicator | /*eslint-disable max-nested-callbacks*/
import React from 'react';
import {shallow} from 'enzyme';
import {describe, it} from 'mocha';
import {expect} from 'chai';
import {ActivityIndicator} from 'react-native';
import AppView from '../AppView';
describe('<AppView />', () => {
describe('isReady', () => {
it('sh... | /*eslint-disable max-nested-callbacks*/
import React from 'react';
import {shallow} from 'enzyme';
import {describe, it} from 'mocha';
import {expect} from 'chai';
import Spinner from 'react-native-gifted-spinner';
import AppView from '../AppView';
describe('<AppView />', () => {
describe('isReady', () => {
it... |
Remove unnecessary set time to calendar. | package bj.pranie.util;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
/**
* Created by noon on 03.02.17.
*/
public class TimeUtil {
private static final SimpleDateFormat format = new SimpleDateFormat("yyyy/MM/dd H... | package bj.pranie.util;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
/**
* Created by noon on 03.02.17.
*/
public class TimeUtil {
private static final SimpleDateFormat format = new SimpleDateFormat("yyyy/MM/dd H... |
Use define as it seems to work correctly? | define([
'angular',
'app',
'moment',
'app/controllers/default',
'app/controllers/manageTeamOwnership',
'app/controllers/projectStream',
'app/controllers/teamDashboard',
'app/directives/count',
'app/directives/timeSince'
], function(angular, app, moment){
'use strict';
app.config(function(
$... | require([
'angular',
'app',
'moment',
'app/controllers/default',
'app/controllers/loginSudo',
'app/controllers/manageTeamOwnership',
'app/controllers/projectStream',
'app/controllers/teamDashboard',
'app/directives/count',
'app/directives/timeSince'
], function(angular, app, moment){
'use strict... |
Update to new location of require config | module.exports = function(grunt) {
'use strict';
// Project configuration.
grunt.initConfig({
jasmine : {
src : 'src/**/*.js',
options : {
specs : 'spec/**/*.js',
template: require('grunt-template-jasmine-requirejs'),
templateO... | module.exports = function(grunt) {
'use strict';
// Project configuration.
grunt.initConfig({
jasmine : {
src : 'src/**/*.js',
options : {
specs : 'spec/**/*.js',
template: require('grunt-template-jasmine-requirejs'),
templateO... |
Use requests.session instead of requests.Session | import re
import requests
import lxml.html
def grab_cloudflare(url, *args, **kwargs):
sess = requests.session()
sess.headers = {"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:17.0) Gecko/20100101 Firefox/17.0"}
safe_eval = lambda s: eval(s, {"__builtins__": {}}) if "#" not in s and "__"... | import re
import requests
import lxml.html
def grab_cloudflare(url, *args, **kwargs):
sess = requests.Session()
sess.headers = {"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:17.0) Gecko/20100101 Firefox/17.0"}
safe_eval = lambda s: eval(s, {"__builtins__": {}}) if "#" not in s and "__"... |
Add related et related_owner methods | <?php
namespace Amenophis\Bundle\SocialBundle\Twig;
use Amenophis\Bundle\SocialBundle\Manager\SocialManager;
class SocialExtension extends \Twig_Extension
{
public function __construct(SocialManager $service)
{
$this->service = $service;
}
public function getFunctions()
{
return ... | <?php
namespace Amenophis\Bundle\SocialBundle\Twig;
use Amenophis\Bundle\SocialBundle\Service\SocialManager;
class SocialExtension extends \Twig_Extension
{
public function __construct(SocialManager $service)
{
$this->service = $service;
}
public function getFunctions()
{
return ... |
Change of context for picture transformation | package com.williammora.openfeed.fragments;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.williammora.openfeed.R;
import com.williammora.openfeed.activities.StatusActivity;
import com.williammora.openfeed.... | package com.williammora.openfeed.fragments;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.williammora.openfeed.R;
import com.williammora.openfeed.activities.StatusActivity;
import com.williammora.openfeed.... |
Increase the default timeout to 1s. | from gi.repository import Gio
from .proxy import ProxyMixin
from .bus_names import OwnMixin, WatchMixin
from .subscription import SubscriptionMixin
from .registration import RegistrationMixin
from .publication import PublicationMixin
class Bus(ProxyMixin, OwnMixin, WatchMixin, SubscriptionMixin, RegistrationMixin, Pub... | from gi.repository import Gio
from .proxy import ProxyMixin
from .bus_names import OwnMixin, WatchMixin
from .subscription import SubscriptionMixin
from .registration import RegistrationMixin
from .publication import PublicationMixin
class Bus(ProxyMixin, OwnMixin, WatchMixin, SubscriptionMixin, RegistrationMixin, Pub... |
Make sg label clicking act like a toggle | "use strict";
angular.module('arethusa.sg').directive('sgAncestors', [
'sg',
function(sg) {
return {
restrict: 'A',
scope: {
obj: '=sgAncestors'
},
link: function(scope, element, attrs) {
scope.requestGrammar = function(el) {
if (el.sections) {
if (... | "use strict";
angular.module('arethusa.sg').directive('sgAncestors', [
'sg',
function(sg) {
return {
restrict: 'A',
scope: {
obj: '=sgAncestors'
},
link: function(scope, element, attrs) {
scope.requestGrammar = function(el) {
if (el.sections) {
sg.r... |
Use `open` of props. and close hander call onHidePromoteModal action. | import React, { Component } from 'react';
import Dialog from 'material-ui/lib/dialog';
import FlatButton from 'material-ui/lib/flat-button';
import RaisedButton from 'material-ui/lib/raised-button';
// NOTE: For emit `onTouchTap` event.
import injectTapEventPlugin from 'react-tap-event-plugin';
injectTapEventPlugin();... | import React, { Component } from 'react';
import Dialog from 'material-ui/lib/dialog';
import FlatButton from 'material-ui/lib/flat-button';
import RaisedButton from 'material-ui/lib/raised-button';
// NOTE: For emit `onTouchTap` event.
import injectTapEventPlugin from 'react-tap-event-plugin';
injectTapEventPlugin();... |
Fix another I18n skeleton case typo | <?php
namespace Victoire\Bundle\I18nBundle\CacheWarmer;
use Sensio\Bundle\GeneratorBundle\Generator\Generator;
/**
*
* @author Florian Raux
*
*/
class I18nGenerator extends Generator
{
private $annotationReader;
protected $applicationLocales;
/**
*
* @param unknown $annotationReader
*... | <?php
namespace Victoire\Bundle\I18nBundle\CacheWarmer;
use Sensio\Bundle\GeneratorBundle\Generator\Generator;
/**
*
* @author Florian Raux
*
*/
class I18nGenerator extends Generator
{
private $annotationReader;
protected $applicationLocales;
/**
*
* @param unknown $annotationReader
*... |
Use auto generated hashcode and equals | package io.github.imsmobile.fahrplan.model;
import com.google.common.base.Objects;
public class FavoriteModelItem {
private final String from;
private final String to;
FavoriteModelItem(String from, String to) {
this.from = from;
this.to = to;
}
public String getFrom() {
... | package io.github.imsmobile.fahrplan.model;
import com.google.common.base.Objects;
public class FavoriteModelItem {
private final String from;
private final String to;
FavoriteModelItem(String from, String to) {
this.from = from;
this.to = to;
}
public String getFrom() {
... |
Add isEnable method to the slot for render things | package info.u_team.u_team_core.container;
import info.u_team.u_team_core.api.fluid.IFluidHandlerModifiable;
import net.minecraftforge.fluids.FluidStack;
public class FluidSlot {
private final IFluidHandlerModifiable fluidHandler;
private final int index;
private final int x;
private final int y;
public Flui... | package info.u_team.u_team_core.container;
import info.u_team.u_team_core.api.fluid.IFluidHandlerModifiable;
import net.minecraftforge.fluids.FluidStack;
public class FluidSlot {
private final IFluidHandlerModifiable fluidHandler;
private final int index;
private final int x;
private final int y;
public Flui... |
Replace google tts with voice rss. | <?php
namespace Mo\FlashCardsApiBundle\Controller;
use Symfony\Component\HttpFoundation\Response;
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
/**
* Actions serving different resources.
*/
class ResourceController
{
/**
* Creates an audio/mpeg pronouncing the text parameter.
*
* @ApiDoc(
* ... | <?php
namespace Mo\FlashCardsApiBundle\Controller;
use Symfony\Component\HttpFoundation\Response;
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
/**
* Actions serving different resources.
*/
class ResourceController
{
/**
* Creates an audio/mpeg pronouncing the text parameter.
*
* @ApiDoc(
* ... |
Return the point as a number. | 'use strict';
angular.module('kanbanBoardApp')
.controller('BoardCtrl', ['$scope', 'Task', 'Project', 'Workspace', 'Tag', 'WORKSPACE_ID', 'PROJECT_ID', function ($scope, Task, Project, Workspace, Tag, WORKSPACE_ID, PROJECT_ID) {
$scope.tags = [];
var tagsLoaded = false;
$scope.tagsLoaded = function () {... | 'use strict';
angular.module('kanbanBoardApp')
.controller('BoardCtrl', ['$scope', 'Task', 'Project', 'Workspace', 'Tag', 'WORKSPACE_ID', 'PROJECT_ID', function ($scope, Task, Project, Workspace, Tag, WORKSPACE_ID, PROJECT_ID) {
$scope.tags = [];
var tagsLoaded = false;
$scope.tagsLoaded = function () {... |
Fix password complexity validation: length between 8 and 255 | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.parallax.server.common.cloudsession.service.impl;
import com.parallax.server.common.cloudsession.service.PasswordValidatio... | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.parallax.server.common.cloudsession.service.impl;
import com.parallax.server.common.cloudsession.service.PasswordValidatio... |
Update tag to use for forked psutil | # 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
setup(
name="atsy",
version="0.0.1",
description="AreTheySlimYet",
long_de... | # 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
setup(
name="atsy",
version="0.0.1",
description="AreTheySlimYet",
long_de... |
Add SSH logs when provisioning with RedHat derivatives
Fixes #3507
Signed-off-by: KOBAYASHI Shinji <f11af612650f474cce319970f68085816c4c9a70@jp.fujitsu.com> | package provision
import (
"fmt"
"github.com/docker/machine/libmachine/drivers"
"github.com/docker/machine/libmachine/log"
"github.com/docker/machine/libmachine/ssh"
)
type RedHatSSHCommander struct {
Driver drivers.Driver
}
func (sshCmder RedHatSSHCommander) SSHCommand(args string) (string, error) {
client, ... | package provision
import (
"github.com/docker/machine/libmachine/drivers"
"github.com/docker/machine/libmachine/ssh"
)
type RedHatSSHCommander struct {
Driver drivers.Driver
}
func (sshCmder RedHatSSHCommander) SSHCommand(args string) (string, error) {
client, err := drivers.GetSSHClientFromDriver(sshCmder.Drive... |
Add missing index.html in webpack target | const path = require('path');
const ls = require('ls');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const plugins = [];
const entry = {};
const filenamePrefix = process.env.DEV_SERVER ? 'contribs/gmf/apps/' : '';
for (const filename of ls('contribs/gmf/apps/*/index.h... | const path = require('path');
const ls = require('ls');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const plugins = [];
const entry = {};
const filenamePrefix = process.env.DEV_SERVER ? 'contribs/gmf/apps/' : '';
for (const filename of ls('contribs/gmf/apps/*/index.h... |
Fix generated pages not showing publication on load | $(function () {
var initialTitle = document.title;
$(Z).on('Z:publicationchange', function (ev, publication) {
document.title = [publication.title, initialTitle].join(': ');
if (typeof history.replaceState === 'function') {
history.replaceState(publication, publication.title, Z.slugify(publication));
$(Z).... | $(function () {
var base = '/';
var initialTitle = document.title;
$(Z).on('Z:publicationchange', function (ev, publication) {
document.title = [publication.title, initialTitle].join(': ');
if (typeof history.replaceState === 'function') {
history.replaceState(publication, publication.title, Z.slugify(public... |
Check for existence of isMounted | var Reflux = require('./index'),
_ = require('./utils');
module.exports = function(listenable,key){
return {
getInitialState: function(){
if (!_.isFunction(listenable.getInitialState)) {
return {};
} else if (key === undefined) {
return listenable... | var Reflux = require('./index'),
_ = require('./utils');
module.exports = function(listenable,key){
return {
getInitialState: function(){
if (!_.isFunction(listenable.getInitialState)) {
return {};
} else if (key === undefined) {
return listenable... |
Update the client test to clean up before tests | package cloudwatch
import (
"os"
"testing"
)
func TestDefaultSessionConfig(t *testing.T) {
// Cleanup before the test
os.Unsetenv("AWS_DEFAULT_REGION")
os.Unsetenv("AWS_REGION")
cases := []struct {
expected string
export bool
exportVar string
exportVal string
}{
{
expected: "us-east-1",
e... | package cloudwatch
import (
"os"
"testing"
)
func TestDefaultSessionConfig(t *testing.T) {
cases := []struct {
expected string
export bool
exportVar string
exportVal string
}{
{
expected: "us-east-1",
export: false,
exportVar: "",
exportVal: "",
},
{
expected: "ap-southeast-1... |
Fix summary not showing up in console logs | 'use strict';
const { protocolHandlers } = require('../../protocols');
const { rpcHandlers } = require('../../rpc');
// Build message of events of type `request` as:
// STATUS [ERROR] - PROTOCOL METHOD RPC /PATH COMMAND...
const getRequestMessage = function ({
protocol,
rpc,
method,
path,
error = 'SUCCESS'... | 'use strict';
const { protocolHandlers } = require('../../protocols');
const { rpcHandlers } = require('../../rpc');
// Build message of events of type `request` as:
// STATUS [ERROR] - PROTOCOL METHOD RPC /PATH COMMAND...
const getRequestMessage = function ({
protocol,
rpc,
method,
path,
error = 'SUCCESS'... |
Remove unnecessary setlocale call in templatetags | from __future__ import absolute_import
from json import dumps as json_dumps
from django import template
from django.conf import settings
from django.utils.safestring import mark_safe
from argonauts.serializers import JSONArgonautEncoder
register = template.Library()
@register.filter
def json(a):
"""
Outp... | from __future__ import absolute_import
# `setlocale` is not threadsafe
import locale
locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
from json import dumps as json_dumps
from django import template
from django.conf import settings
from django.utils.safestring import mark_safe
from argonauts.serializers import JSONA... |
Use isinstance check so library can be used for more types | # -*- coding: UTF-8 -*-
import collections
__version__ = '0.1.0'
def flatkeys(d, sep="."):
"""
Flatten a dictionary: build a new dictionary from a given one where all
non-dict values are left untouched but nested ``dict``s are recursively
merged in the new one with their keys prefixed by their parent... | # -*- coding: UTF-8 -*-
__version__ = '0.1.0'
def flatkeys(d, sep="."):
"""
Flatten a dictionary: build a new dictionary from a given one where all
non-dict values are left untouched but nested ``dict``s are recursively
merged in the new one with their keys prefixed by their parent key.
>>> flat... |
Add helper to get project name | // 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, software
// distributed unde... | // 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, software
// distributed unde... |
Add tests for eidos found_by annotation | import os
from indra.sources import eidos
from indra.statements import Influence
path_this = os.path.dirname(os.path.abspath(__file__))
test_json = os.path.join(path_this, 'eidos_test.json')
def test_process_json():
ep = eidos.process_json_file(test_json)
assert ep is not None
assert len(ep.statements) ... | import os
from indra.sources import eidos
from indra.statements import Influence
path_this = os.path.dirname(os.path.abspath(__file__))
test_json = os.path.join(path_this, 'eidos_test.json')
def test_process_json():
ep = eidos.process_json_file(test_json)
assert ep is not None
assert len(ep.statements) ... |
Reformat for easier copy and pasting (needed for usability with AWS Console). | from __future__ import print_function
from timeit import default_timer as timer
import json
import datetime
print('Loading function')
def eratosthenes(n):
sieve = [ True for i in range(n+1) ]
def markOff(pv):
for i in range(pv+pv, n+1, pv):
sieve[i] = False
markOff(2)
f... | from __future__ import print_function
from timeit import default_timer as timer
import json
import datetime
print('Loading function')
def eratosthenes(n):
sieve = [ True for i in range(n+1) ]
def markOff(pv):
for i in range(pv+pv, n+1, pv):
sieve[i] = False
markOff(2)
f... |
Make new test use contains assertion | import sys
from nose.tools import ok_
from _utils import (
_output_eq, IntegrationSpec, _dispatch, trap, expect_exit, assert_contains
)
class ShellCompletion(IntegrationSpec):
"""
Shell tab-completion behavior
"""
def no_input_means_just_task_names(self):
_output_eq('-c simple_ns_list -... | import sys
from nose.tools import ok_
from _utils import _output_eq, IntegrationSpec, _dispatch, trap, expect_exit
class ShellCompletion(IntegrationSpec):
"""
Shell tab-completion behavior
"""
def no_input_means_just_task_names(self):
_output_eq('-c simple_ns_list --complete', "z_toplevel\n... |
Revert "Wrap fact exports in quotes"
This reverts commit bf5b568b05066b3d31b3c7c1f56ef86d4c5c3dca.
Conflicts:
stack-builder/hiera_config.py | #!/usr/bin/env python
"""
stack-builder.hiera_config
~~~~~~~~~~~~~~~~~~~~~~~~~~
This module will read metadata set during instance
launch and override any yaml under the /etc/puppet/data
directory (except data_mappings) that has a key matching
the metadata
"""
import yaml
import os
hiera_dir ... | #!/usr/bin/env python
"""
stack-builder.hiera_config
~~~~~~~~~~~~~~~~~~~~~~~~~~
This module will read metadata set during instance
launch and override any yaml under the /etc/puppet/data
directory (except data_mappings) that has a key matching
the metadata
"""
import yaml
import os
hiera_dir ... |
Fix error when trying to run --remove-all
The error was as follows:
sudo hose --remove-all
/usr/local/share/npm/lib/node_modules/hose/index.js:32
if (!err) {
^
ReferenceError: err is not defined
at /usr/local/share/npm/lib/node_modules/hose/index.js:32:14
at Object.oncomplete (f... | var program = require('commander');
var pkg = require('./package.json');
var settings = require('./settings.js');
program
.usage('[options] <domain>')
.version(pkg.version)
.option('-r, --remove', 'Removes the domain')
.option('-R, --remove-all', 'Wipes the blacklist')
.option('-H, --hosts <hosts>'... | var program = require('commander');
var pkg = require('./package.json');
var settings = require('./settings.js');
program
.usage('[options] <domain>')
.version(pkg.version)
.option('-r, --remove', 'Removes the domain')
.option('-R, --remove-all', 'Wipes the blacklist')
.option('-H, --hosts <hosts>'... |
Fix test for new memory limit | <?php
namespace SlmQueueTest\Options;
use PHPUnit_Framework_TestCase as TestCase;
use SlmQueueTest\Util\ServiceManagerFactory;
use Zend\ServiceManager\ServiceManager;
class WorkerOptionsTest extends TestCase
{
/**
* @var ServiceManager
*/
protected $serviceManager;
public function setUp()
... | <?php
namespace SlmQueueTest\Options;
use PHPUnit_Framework_TestCase as TestCase;
use SlmQueueTest\Util\ServiceManagerFactory;
use Zend\ServiceManager\ServiceManager;
class WorkerOptionsTest extends TestCase
{
/**
* @var ServiceManager
*/
protected $serviceManager;
public function setUp()
... |
FIX opt_out prevention for mailchimp export | ##############################################################################
#
# Copyright (C) 2020 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The licence is in the file __manifest__.py
#
#####################... | ##############################################################################
#
# Copyright (C) 2020 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The licence is in the file __manifest__.py
#
#####################... |
:art: Enhance the main cli entry file | #!/usr/bin/env node
'use strict'
const command = process.argv[2] || ''
const validCommands = ['new', 'build', 'update', 'init']
// TODO: Check for updates
// Note: This is a trick to make multiple commander commands work with single executables
process.argv = process.argv.slice(0, 2).concat(process.argv.slice(3))
l... | #!/usr/bin/env node
'use strict'
import commander from 'commander'
const parameters = require('minimist')(process.argv.slice(2))
const command = parameters['_'][0]
const validCommands = ['new', 'build', 'update', 'init']
// TODO: Check for updates
// Note: This is a trick to make multiple commander commands work wi... |
Fix typo in FXML file name | package com.gitrekt.resort.controller;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
/**
* FXML Controller class for reports home screen.
*/
public class ReportsHomeScreenController implements Initializable {
... | package com.gitrekt.resort.controller;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
/**
* FXML Controller class for reports home screen.
*/
public class ReportsHomeScreenController implements Initializable {
... |
Add test for as_bool bug | from nose2 import config
from nose2.compat import unittest
class TestConfigSession(unittest.TestCase):
def test_can_create_session(self):
config.Session()
class TestConfig(unittest.TestCase):
def setUp(self):
self.conf = config.Config([
('a', ' 1 '), ('b', ' x\n y '), ('c',... | from nose2 import config
from nose2.compat import unittest
class TestConfigSession(unittest.TestCase):
def test_can_create_session(self):
config.Session()
class TestConfig(unittest.TestCase):
def setUp(self):
self.conf = config.Config([('a', ' 1 '), ('b', ' x\n y ')])
def test_as_int(... |
Use root locale when normalising | package net.squanchy.search.engines;
import java.text.Normalizer;
import java.util.Locale;
import java.util.regex.Pattern;
final class StringNormalizer {
private static final String ACCENTS_PATTERN_STRING = "\\p{M}";
private static final Pattern ACCENTS_PATTERN = Pattern.compile(ACCENTS_PATTERN_STRING);
... | package net.squanchy.search.engines;
import java.text.Normalizer;
import java.util.Locale;
import java.util.regex.Pattern;
final class StringNormalizer {
private static final String EMPTY_STRING = "";
private static final String ACCENTS_PATTERN_STRING = "\\p{M}";
private static final Pattern ACCENTS_PATT... |
Update to work with the last version of twig | <?php
namespace Bundle\MarkdownBundle\Twig\Extension;
use Bundle\MarkdownBundle\Helper\MarkdownHelper;
class MarkdownTwigExtension extends \Twig_Extension
{
protected $helper;
function __construct(MarkdownHelper $helper)
{
$this->helper = $helper;
}
public function getFilters()
{
... | <?php
namespace Bundle\MarkdownBundle\Twig\Extension;
use Bundle\MarkdownBundle\Helper\MarkdownHelper;
class MarkdownTwigExtension extends \Twig_Extension
{
protected $helper;
function __construct(MarkdownHelper $helper)
{
$this->helper = $helper;
}
public function getFilters()
{
... |
Use a shorter name for the Camel @RunWith so its easier to remember | /**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may... | /**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may... |
Update trove classifiers with Apache License. | import os
import sys
from setuptools import setup
INSTALL_REQUIRES = ['requests >=1.0.3', 'boto >=2.1.1', 'six >=1.2.0', 'urllib3 >= 1.0.2']
if sys.version_info < (2, 7, 0):
INSTALL_REQUIRES.append('argparse>=1.1')
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
... | import os
import sys
from setuptools import setup
INSTALL_REQUIRES = ['requests >=1.0.3', 'boto >=2.1.1', 'six >=1.2.0', 'urllib3 >= 1.0.2']
if sys.version_info < (2, 7, 0):
INSTALL_REQUIRES.append('argparse>=1.1')
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
... |
Revert "fixed the formatting such that the time has no "0" in front of it."
This reverts commit 0f167142d5329deed444e10cde11a42b634b899b. | var readline = require('readline');
var chalk = require('chalk');
function extractPhoneNumber(phoneString) {
return phoneString.split('@')[0];
}
function timeLeftMin(time) {
var timeLeft = Math.ceil((time - new Date()) / 1000 / 60);
if (timeLeft < 0) {
return "N.A.";
} else {
return ti... | var readline = require('readline');
var chalk = require('chalk');
function extractPhoneNumber(phoneString) {
return phoneString.split('@')[0];
}
function timeLeftMin(time) {
var timeLeft = Math.ceil((time - new Date()) / 1000 / 60);
if (timeLeft < 0) {
return "N.A.";
} else {
return ti... |
Fix flag file paths again | <?php
// echo '<p>Hi I am some random ' . rand() .' output from the server.</p>';
// echo '<strong>Bitcoin is Enabled</strong>';
// echo "Data is";
$domvalue = $_GET['id'];
// Bitcoin controls
switch ($domvalue) {
case "bitcoin_restart":
echo "Bitcoin has been restarted";
shell_exec ('echo "1" > /home/lin... | <?php
// echo '<p>Hi I am some random ' . rand() .' output from the server.</p>';
// echo '<strong>Bitcoin is Enabled</strong>';
// echo "Data is";
$domvalue = $_GET['id'];
// Bitcoin controls
switch ($domvalue) {
case "bitcoin_restart":
echo "Bitcoin has been restarted";
shell_exec ('echo "1" > btflags.t... |
test: Fix doctypes impots in tests | module.exports = {
testURL: 'http://localhost/',
moduleFileExtensions: ['js', 'jsx', 'json', 'styl'],
setupFiles: ['<rootDir>/test/jestLib/setup.js'],
moduleDirectories: ['src', 'node_modules'],
moduleNameMapper: {
'^redux-cozy-client$': '<rootDir>/src/lib/redux-cozy-client',
'^cozy-doctypes$': 'cozy-... | module.exports = {
testURL: 'http://localhost/',
moduleFileExtensions: ['js', 'jsx', 'json', 'styl'],
setupFiles: ['<rootDir>/test/jestLib/setup.js'],
moduleDirectories: ['src', 'node_modules'],
moduleNameMapper: {
'^redux-cozy-client$': '<rootDir>/src/lib/redux-cozy-client',
'\\.(png|gif|jpe?g|svg)$'... |
Make security util to work for mock dashboard server mode. | package org.slc.sli.util;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.slc.sli.security.SLIPrincipal;
/**
* Class, which allows user to access security context
* @author svankina
*
*/
public clas... | package org.slc.sli.util;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.userdetails.UserDetails;
import org.slc.sli.security.SLIPrincipal;
/**
* Class, which allows user to access security context
* @author svankina
*
*/
public clas... |
Remove old ref to AggregateError
- Leftover from converting the nodejs-common package to local functions | import Promise from 'bluebird';
import { logger } from './logging';
/**
* Do a promise returning function with retries.
*/
export function withRetries(promiseFn, maxRetries, delaySeconds, errMsg, expBackoff) {
let retryCount = 0;
function doIt() {
return promiseFn().catch(err => {
// If we've hit th... | import Promise from 'bluebird';
import { logger } from './logging';
/**
* Do a promise returning function with retries.
*/
export function withRetries(promiseFn, maxRetries, delaySeconds, errMsg, expBackoff) {
let retryCount = 0;
function doIt() {
return promiseFn().catch(err => {
// If we've hit th... |
Fix needed trailing spaces in the license | /*
* -\-\-
* Spotify Apollo okhttp Client Module
* --
* Copyright (C) 2013 - 2015 Spotify AB
* --
* 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/licen... | /*
* -\-\-
* Spotify Apollo okhttp Client Module
* --
* Copyright (C) 2013 - 2015 Spotify AB
* --
* 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/licens... |
Fix typo in godoc synopsis | /*
Simplistic asynchronous routines for the masses.
*/
package async
/*
Done types are used for shorthand definitions of the functions that are
passed into each Routine to show that the Routine has completed.
An example a Done function would be:
func ImDone(err error, args ...interface{}) {
if err !... | /*
Simplistic ansynchronous routines for the masses.
*/
package async
/*
Done types are used for shorthand definitions of the functions that are
passed into each Routine to show that the Routine has completed.
An example a Done function would be:
func ImDone(err error, args ...interface{}) {
if err ... |
Increase lambda-k space to better differentiate bottlenecks from startup cost. | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 23 15:23:58 2015
@author: jensv
"""
import skin_core_scanner_simple as scss
reload(scss)
import equil_solver as es
reload(es)
import newcomb_simple as new
reload(new)
(lambda_a_mesh, k_a_mesh,
stability_maps) = scss.scan_lambda_k_space([0.01, 3.0, 25.], [0.01, 1.5, 25]... | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 23 15:23:58 2015
@author: jensv
"""
import skin_core_scanner_simple as scss
reload(scss)
import equil_solver as es
reload(es)
import newcomb_simple as new
reload(new)
(lambda_a_mesh, k_a_mesh,
stability_maps) = scss.scan_lambda_k_space([0.01, 3.0, 10.], [0.01, 1.5, 10]... |
Initialize log using `name` and `version` | import { initLog } from 'roc';
import Dredd from 'dredd';
const { name, version } = require('../../package.json');
const log = initLog(name, version);
export default ({ context: { config: { settings } } }) => () => {
const port = process.env.PORT || settings.runtime.port;
const dredd = new Dredd({
s... | import { initLog } from 'roc';
import Dredd from 'dredd';
const log = initLog();
export default ({ context: { config: { settings } } }) => () => {
const port = process.env.PORT || settings.runtime.port;
const dredd = new Dredd({
server: `http://localhost:${port}`,
options: settings.test.dredd... |
Initialize input for proper behavior | import Ember from 'ember';
import config from 'degenerator-ui/config/environment';
export default Ember.Controller.extend({
filesystem: Ember.inject.service(),
init() {
this._super(...arguments);
this.set('uploadFile', null);
},
actions:{
selectPhoto() {
this.get('filesystem').prompt().then... | import Ember from 'ember';
import fetch from 'ember-network/fetch';
export default Ember.Service.extend({
prompt(){
return new Promise((resolve, reject) => {
const input = document.createElement('input');
input.setAttribute("type","file");
input.click();
Ember.$(input).change(() => {
... |
Correct PHPDoc type for float ttl
It can be null as the Lock instance accepts it. | <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Lock;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\L... | <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Lock;
use Psr\Log\LoggerAwareInterface;
use Psr\Log\L... |
Fix selector for tab selection | $(function() {
var $tabs = $('#search-results-tabs'),
$searchForm = $('.js-search-hash');
if($tabs.length > 0){
$tabs.tabs({ 'defaultTab' : getDefaultSearchTabIndex(), scrollOnload: true });
}
function getDefaultSearchTabIndex(){
var tabIds = $('.search-navigation a').map(function(i, el){
... | $(function() {
var $tabs = $('#search-results-tabs'),
$searchForm = $('.js-search-hash');
if($tabs.length > 0){
$tabs.tabs({ 'defaultTab' : getDefaultSearchTabIndex(), scrollOnload: true });
}
function getDefaultSearchTabIndex(){
var tabIds = $('.nav-tabs a').map(function(i, el){
retur... |
[Java] Fix class used for logging
Change-Id: Ic689a8b5e9ed090330737386ed814fb020afc6ea | /*
* #%L
* %%
* Copyright (C) 2011 - 2017 BMW Car IT GmbH
* %%
* 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... | /*
* #%L
* %%
* Copyright (C) 2011 - 2017 BMW Car IT GmbH
* %%
* 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... |
Use respond instead of create_response | import logging
logger = logging.getLogger()
logger.setLevel(logging.INFO)
from ask import alexa
def lambda_handler(request_obj, context=None):
return alexa.route_request(request_obj)
@alexa.default
def default_handler(request):
logger.info('default_handler')
return alexa.respond('There were 42 accidents ... | import logging
logger = logging.getLogger()
logger.setLevel(logging.INFO)
from ask import alexa
def lambda_handler(request_obj, context=None):
return alexa.route_request(request_obj)
@alexa.default
def default_handler(request):
logger.info('default_handler')
return alexa.respond('There were 42 accidents ... |
Hide a reader for now. | export default {
name: 'ArticleNav',
configure (config) {
config.addLabel('mode', 'Mode')
config.addViewMode({
name: 'open-manuscript',
viewName: 'manuscript',
commandGroup: 'switch-view',
icon: 'fa-align-left',
label: 'Manuscript'
})
config.addViewMode({
name: '... | export default {
name: 'ArticleNav',
configure (config) {
config.addLabel('mode', 'Mode')
config.addViewMode({
name: 'open-manuscript',
viewName: 'manuscript',
commandGroup: 'switch-view',
icon: 'fa-align-left',
label: 'Manuscript'
})
config.addViewMode({
name: '... |
Fix checking invokable $instead of $resource | <?php
namespace Colorium\App\Kernel;
use Colorium\App\Context;
use Colorium\App\Plugin;
use Colorium\Http\Response;
use Colorium\Runtime\Invokable;
class Execution extends Plugin
{
/**
* Handle context
*
* @param Context $context
* @param callable $chain
* @return Context
*/
p... | <?php
namespace Colorium\App\Kernel;
use Colorium\App\Context;
use Colorium\App\Plugin;
use Colorium\Http\Response;
use Colorium\Runtime\Invokable;
class Execution extends Plugin
{
/**
* Handle context
*
* @param Context $context
* @param callable $chain
* @return Context
*/
p... |
Update expanding progress tests to use enzyme. | /* Copyright (C) 2017 Canonical Ltd. */
'use strict';
const React = require('react');
const enzyme = require('enzyme');
const ExpandingProgress = require('./expanding-progress');
describe('ExpandingProgress', function() {
const renderComponent = (options = {}) => enzyme.shallow(
<ExpandingProgress />
);
... | /* Copyright (C) 2017 Canonical Ltd. */
'use strict';
const React = require('react');
const ExpandingProgress = require('./expanding-progress');
const jsTestUtils = require('../../utils/component-test-utils');
const testUtils = require('react-dom/test-utils');
describe('ExpandingProgress', function() {
it('rende... |
Fix s3 upload file extra_args named paramether | import boto3
from boto3.s3.transfer import S3Transfer
from config import AWS_ACCESS_KEY, AWS_SECRET_KEY
def delete_s3_file(file_id):
client = boto3.client(
's3',
aws_access_key_id=AWS_ACCESS_KEY,
aws_secret_access_key=AWS_SECRET_KEY
)
return client.delete_object(
Bucket='d... | import boto3
from boto3.s3.transfer import S3Transfer
from config import AWS_ACCESS_KEY, AWS_SECRET_KEY
def delete_s3_file(file_id):
client = boto3.client(
's3',
aws_access_key_id=AWS_ACCESS_KEY,
aws_secret_access_key=AWS_SECRET_KEY
)
return client.delete_object(
Bucket='d... |
Add debug to prod settings | module.exports = {
port: 3000,
canvas: {
apiUrl: 'https://kth.instructure.com/api/v1'
},
logging: {
log: {
level: 'debug',
src: false
},
stdout: {
enabled: true
},
console: {
enabled: false
}
},
ldap: {
client: {
url: 'ldaps://... | module.exports = {
port: 3000,
canvas: {
apiUrl: 'https://kth.instructure.com/api/v1'
},
logging: {
log: {
level: 'info',
src: false
},
stdout: {
enabled: true
},
console: {
enabled: false
}
},
ldap: {
client: {
url: 'ldaps://l... |
Move deletion of installer folder to the end | <?php
namespace Installer\Handlers;
use Installer\Helpers\File;
final class CleanerHandler extends AbstractHandler implements HandlerInterface
{
public function execute()
{
$this->write('');
$this->writeHeader('Cleaning up <info>(also something you will forget)</info>.');
if($this->a... | <?php
namespace Installer\Handlers;
use Installer\Helpers\File;
final class CleanerHandler extends AbstractHandler implements HandlerInterface
{
public function execute()
{
$this->write('');
$this->writeHeader('Cleaning up <info>(also something you will forget)</info>.');
File::remov... |
Build closure for TRIPS ontology | import os
from indra.preassembler.hierarchy_manager import HierarchyManager
# Make a TRIPS ontology
_fname = os.path.join(os.path.dirname(__file__), 'trips_ontology.rdf')
trips_ontology = HierarchyManager(_fname, uri_as_name=False, build_closure=True)
trips_ontology.relations_prefix = 'http://trips.ihmc.us/relations/'... | import os
from indra.preassembler.hierarchy_manager import HierarchyManager
# Make a TRIPS ontology
_fname = os.path.join(os.path.dirname(__file__), 'trips_ontology.rdf')
trips_ontology = HierarchyManager(_fname, uri_as_name=False)
trips_ontology.relations_prefix = 'http://trips.ihmc.us/relations/'
trips_ontology.init... |
Add Api method for getting rooms of a hostel | <?php
namespace AppBundle\RestApi;
use Doctrine\DBAL\Connection;
use FOS\RestBundle\Controller\FOSRestController;
use FOS\RestBundle\Routing\ClassResourceInterface;
class HostelController extends FOSRestController implements ClassResourceInterface
{
public function cgetAction()
{
$db = $this->getConn... | <?php
namespace AppBundle\RestApi;
use Doctrine\DBAL\Connection;
use FOS\RestBundle\Controller\FOSRestController;
use FOS\RestBundle\Routing\ClassResourceInterface;
class HostelController extends FOSRestController implements ClassResourceInterface
{
public function cgetAction()
{
$db = $this->getConn... |
Fix entry point for blacklist_requests | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name = "images_of",
version = "0.1.0",
author = "acimi-ursi",
description = "Tools for managing the ImagesOfNetwork on reddit",
url = "https://github.com/amici-ursi/ImagesOfNetwork",
packages = find_packages(),
inst... | #!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name = "images_of",
version = "0.1.0",
author = "acimi-ursi",
description = "Tools for managing the ImagesOfNetwork on reddit",
url = "https://github.com/amici-ursi/ImagesOfNetwork",
packages = find_packages(),
inst... |
Make sure the tests exit with status 1 when there are errors or failures | #!/usr/bin/python
import optparse
import sys
import unittest2
USAGE = """%prog SDK_PATH TEST_PATH <THIRD_PARTY>
Run unit tests for App Engine apps.
SDK_PATH Path to the SDK installation
TEST_PATH Path to package containing test modules
THIRD_PARTY Optional path to third party python modules to include."""
def ... | #!/usr/bin/python
import optparse
import sys
import unittest2
USAGE = """%prog SDK_PATH TEST_PATH <THIRD_PARTY>
Run unit tests for App Engine apps.
SDK_PATH Path to the SDK installation
TEST_PATH Path to package containing test modules
THIRD_PARTY Optional path to third party python modules to include."""
def ... |
Add db from config to modals | from config import db
class User(db.Modal):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(100), nullable=False)
asu_id = db.Column(db.Integer,nullable=False)
class_standing = db.Column(db.String(100), nullable=True)
email = db.Column(db.String(100))
phone_number = db.C... | from app import db
class Users(db.Modal):
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(100), nullable=False)
asu_id = db.Column(db.Integer,nullable=False)
class_standing = db.Column(db.String(100), nullable=True)
email = db.Column(db.String(100))
phone_number = db.Col... |
Rename REDUNDANT_PARENTHESIS rule to REDUNDANT_PARENTHESES | package com.sleekbyte.tailor.common;
import com.sleekbyte.tailor.listeners.BlankLineListener;
import com.sleekbyte.tailor.listeners.MultipleImportListener;
import com.sleekbyte.tailor.listeners.RedundantParenthesisListener;
import com.sleekbyte.tailor.listeners.SemicolonTerminatedListener;
import com.sleekbyte.tailor.... | package com.sleekbyte.tailor.common;
import com.sleekbyte.tailor.listeners.BlankLineListener;
import com.sleekbyte.tailor.listeners.MultipleImportListener;
import com.sleekbyte.tailor.listeners.RedundantParenthesisListener;
import com.sleekbyte.tailor.listeners.SemicolonTerminatedListener;
import com.sleekbyte.tailor.... |
Fix for Qt5 in plugins that use matplotlib | #
# Plot.py -- Plotting function for Ginga FITS viewer.
#
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
# GUI imports
from ginga.qtw.QtHelp import QtGui, QtCore
from g... | #
# Plot.py -- Plotting function for Ginga FITS viewer.
#
# Eric Jeschke (eric@naoj.org)
#
# Copyright (c) Eric R. Jeschke. All rights reserved.
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
#
# GUI imports
from ginga.qtw.QtHelp import QtGui, QtCore
from g... |
Reset now deletes and recreates the demo db | <?php
namespace OParl\Server\Commands;
use Illuminate\Console\Command;
use OParl\Server\Model\Body;
use OParl\Server\Model\Consultation;
use OParl\Server\Model\File;
use OParl\Server\Model\Keyword;
use OParl\Server\Model\LegislativeTerm;
use OParl\Server\Model\Location;
use OParl\Server\Model\Meeting;
use OParl\Serve... | <?php
namespace OParl\Server\Commands;
use Illuminate\Console\Command;
use OParl\Server\Model\Body;
use OParl\Server\Model\Consultation;
use OParl\Server\Model\File;
use OParl\Server\Model\Keyword;
use OParl\Server\Model\LegislativeTerm;
use OParl\Server\Model\Location;
use OParl\Server\Model\Meeting;
use OParl\Serve... |
Add Undeclared Faker Instance to PhoneNumber Test in en_NG | <?php
namespace Faker\Test\Provider\ng_NG;
use Faker\Generator;
use Faker\Provider\en_NG\PhoneNumber;
use PHPUnit\Framework\TestCase;
class PhoneNumberTest extends TestCase
{
/**
* @var Generator
*/
private $faker;
public function setUp()
{
$faker = new Generator();
$faker... | <?php
namespace Faker\Test\Provider\ng_NG;
use Faker\Generator;
use Faker\Provider\en_NG\PhoneNumber;
use PHPUnit\Framework\TestCase;
class PhoneNumberTest extends TestCase
{
public function setUp()
{
$faker = new Generator();
$faker->addProvider(new PhoneNumber($faker));
$this->faker... |
Allow to run build from studio for cra. | 'use strict';
const fs = require('fs');
const path = require('path');
const rekitCore = require('rekit-core');
const spawn = require('child_process').spawn;
function runBuild(io) {
const prjRoot = rekitCore.utils.getProjectRoot();
return new Promise((resolve) => {
const isCra = fs.existsSync(path.join(prjRoot... | 'use strict';
const rekitCore = require('rekit-core');
const spawn = require('child_process').spawn;
function runBuild(io) {
const prjRoot = rekitCore.utils.getProjectRoot();
return new Promise((resolve) => {
const child = spawn('node',
[
`${prjRoot}/tools/build.js`
],
{
stdi... |
Remove note about assets directory. | <?php
require('autoloader.php');
$headlinks = new NigeLib\Headlinks(
array(
'$jquery-ui' => array( 'assets/jquery/ui/jquery-ui.js' ),
'assets/jquery/ui/jquery-ui.js' => array( 'assets/jquery/jquery.js', 'assets/jquery/themes/base/jquery-ui.css' ),
'assets/jquery/themes/base/jquery-ui.css' =>... | <?php
// Note: The assets directory is not included in the git repo to keep the size
// down. However this serves to demonstrate the Headlinks class.
require('autoloader.php');
$headlinks = new NigeLib\Headlinks(
array(
'$jquery-ui' => array( 'assets/jquery/ui/jquery-ui.js' ),
'assets/jquery/ui/jque... |
Test for String Object and value mutation of the same | var capitalize = require('../capitalize');
var chai = require('chai');
var expect = chai.expect;
describe('capitalize', function() {
it('capitalizes single words', function() {
expect(capitalize('express')).to.equal('Express');
expect(capitalize('cats')).to.equal('Cats');
});
it('makes the rest of the string ... | var capitalize = require('../capitalize');
var chai = require('chai');
var expect = chai.expect;
describe('capitalize', function() {
it('capitalizes single words', function() {
expect(capitalize('express')).to.equal('Express');
expect(capitalize('cats')).to.equal('Cats');
});
it('makes the rest of the string ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.