text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Update name of pyramid function in pyramid example description | """
====================
Build image pyramids
====================
The `pyramid_gaussian` function takes an image and yields successive images
shrunk by a constant scale factor. Image pyramids are often used, e.g., to
implement algorithms for denoising, texture discrimination, and scale- invariant
detection.
"""
imp... | """
====================
Build image pyramids
====================
The `build_gaussian_pyramid` function takes an image and yields successive
images shrunk by a constant scale factor. Image pyramids are often used, e.g.,
to implement algorithms for denoising, texture discrimination, and scale-
invariant detection.
"""... |
Test that Add actually works. | package main
import (
"bsearch/index"
"bsearch/ops"
"fmt"
"os"
"flag"
)
func usage() {
fmt.Fprintf(os.Stderr, "usage: bsearch <path to index blob>\n")
flag.PrintDefaults()
os.Exit(1)
}
func main() {
flag.Parse()
if flag.NArg() != 1 {
usage()
}
dbname := flag.Arg(0)
in, err := index.Open(dbname)
if er... | package main
import (
"bsearch/index"
"bsearch/ops"
"fmt"
"os"
"flag"
)
func usage() {
fmt.Fprintf(os.Stderr, "usage: bsearch <path to index blob>\n")
flag.PrintDefaults()
os.Exit(1)
}
func main() {
flag.Parse()
if flag.NArg() != 1 {
usage()
}
dbname := flag.Arg(0)
in, err := index.Open(dbname)
if er... |
Complete operators tests to pass |
module("About Operators (topics/about_operators.js)");
test("addition", function() {
var result = 0;
//starting i at 0, add i to result and increment i by 1 until i is equal to 5
for (var i = 0; i <= 5; i++) {
result = result + i;
}
equal(15, result, "What is the value of result?");
});
test("assignmen... |
module("About Operators (topics/about_operators.js)");
test("addition", function() {
var result = 0;
//starting i at 0, add i to result and increment i by 1 until i is equal to 5
for (var i = 0; i <= 5; i++) {
result = result + i;
}
equal(__, result, "What is the value of result?");
});
test("assignmen... |
Change the controller to reflect the changes on read file | app.controller('MyIndexController', ['$scope', function ($scope) {
$scope.searchTable = false;
$scope.files = [];
$scope.searchFiles = [];
$scope.instance = new Index();
$scope.showIndex = false;
$scope.showSearch = false;
$scope.indexData = {};
$scope.objKeys = Object.keys;
$scope.getFile = () => {
... | app.controller('MyIndexController', ['$scope', function ($scope) {
$scope.searchTable = false;
$scope.files = [];
$scope.searchFiles = [];
$scope.instance = new Index();
$scope.showIndex = false;
$scope.showSearch = false;
$scope.indexData = {};
$scope.objKeys = Object.keys;
$scope.getFile = () => {
... |
Change PDF font to Helvetica
Changing the PDF font from the default to Helvetica | from ..converter import KnowledgePostConverter
from .html import HTMLConverter
class PDFConverter(KnowledgePostConverter):
'''
Use this as a template for new KnowledgePostConverters.
'''
_registry_keys = ['pdf']
@property
def dependencies(self):
# Dependencies required for this conve... | from ..converter import KnowledgePostConverter
from .html import HTMLConverter
class PDFConverter(KnowledgePostConverter):
'''
Use this as a template for new KnowledgePostConverters.
'''
_registry_keys = ['pdf']
@property
def dependencies(self):
# Dependencies required for this conve... |
Update column type (json to text) for media table | <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateMediaTable extends Migration
{
/**
* Run the migrations.
*/
public function up()
{
Schema::create('media', function (Blueprint $table) {
... | <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateMediaTable extends Migration
{
/**
* Run the migrations.
*/
public function up()
{
Schema::create('media', function (Blueprint $table) {
... |
Move period label to a config property | define([
'extensions/views/single-stat'
],
function (SingleStatView) {
var ResponeTimeNumberView = SingleStatView.extend({
changeOnSelected: true,
getValue: function () {
var responseTime = Math.round(this.collection.getAverageResponseTime());
return this.formatDuration(responseTime, 4);
}... | define([
'extensions/views/single-stat'
],
function (SingleStatView) {
var ResponeTimeNumberView = SingleStatView.extend({
changeOnSelected: true,
getValue: function () {
var responseTime = Math.round(this.collection.getAverageResponseTime());
return this.formatDuration(responseTime, 4);
}... |
Remove last reference to array returns | /**
* Exports
*/
module.exports = Dispatcher;
/**
* Dispatcher prototype
*/
var dispatcher = Dispatcher.prototype;
/**
* Dispatcher
*
* @return {Object}
* @api public
*/
function Dispatcher() {
if (!(this instanceof Dispatcher)) return new Dispatcher;
this.callbacks = [];
};
/**
* Register a new sto... | /**
* Dispatcher prototype
*/
var dispatcher = Dispatcher.prototype;
/**
* Exports
*/
module.exports = Dispatcher;
/**
* Dispatcher
*
* @return {Object}
* @api public
*/
function Dispatcher() {
if (!(this instanceof Dispatcher)) return new Dispatcher;
this.callbacks = [];
};
/**
* Register a new sto... |
Update CSS selector which matched two img elements | from comics.aggregator.crawler import CrawlerBase, CrawlerResult
from comics.meta.base import MetaBase
class Meta(MetaBase):
name = 'The PC Weenies'
language = 'en'
url = 'http://www.pcweenies.com/'
start_date = '1998-10-21'
rights = 'Krishna M. Sadasivam'
class Crawler(CrawlerBase):
history_c... | from comics.aggregator.crawler import CrawlerBase, CrawlerResult
from comics.meta.base import MetaBase
class Meta(MetaBase):
name = 'The PC Weenies'
language = 'en'
url = 'http://www.pcweenies.com/'
start_date = '1998-10-21'
rights = 'Krishna M. Sadasivam'
class Crawler(CrawlerBase):
history_c... |
Add a method to create a measurement. | # -*- coding: utf-8 -*-
from sqlalchemy import (
Column,
Date,
Integer,
MetaData,
Numeric,
String,
Table,
)
def define_tables(metadata):
Table('measurement', metadata,
Column('id', Integer, primary_key=True),
Column('weight', Numeric(4, 1), nullable=False),
Col... | # -*- coding: utf-8 -*-
from sqlalchemy import (
Column,
Date,
Integer,
MetaData,
Numeric,
String,
Table,
)
def define_tables(metadata):
Table('measurement', metadata,
Column('id', Integer, primary_key=True),
Column('weight', Numeric(4, 1), nullable=False),
Col... |
Remove the ability to create messages through repository | <?php
/*
* This file is apart of the DiscordPHP project.
*
* Copyright (c) 2016-2020 David Cole <david.cole1340@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the LICENSE.md file.
*/
namespace Discord\Repository\Channel;
use Discord\Parts\Channel\Messa... | <?php
/*
* This file is apart of the DiscordPHP project.
*
* Copyright (c) 2016-2020 David Cole <david.cole1340@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the LICENSE.md file.
*/
namespace Discord\Repository\Channel;
use Discord\Parts\Channel\Messa... |
Create a date object from a string representing a date | package chap3CoreJavaAPIs;
import java.util.Calendar;
import java.time.Month;
import java.time.*;
class Dates {
public void createDateFromString() {
Date date = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'").parse("2012-05-20T09:00:00.000Z");
String formattedDate = new SimpleDateFormat("yyyy-MM-... | package chap3CoreJavaAPIs;
import java.util.Calendar;
import java.time.Month;
import java.time.*;
class Dates{
public static void main(String... args){
// Be careful, old API Calendar starts at 0, new Month starts at 1
System.out.println(Calendar.APRIL);
System.out.println(Month.APRIL);
System.out... |
Add array to sentence filter | <?php
/**
* SiteFilter.php
*
* Created By: jonathan
* Date: 28/09/2017
* Time: 13:33
*/
namespace Stati\Liquid\Filter;
class SiteFilter
{
/**
* Escapes an xml string
*
* @param string $input
*
* @return string
*/
public static function xml_escape($input)
{
retur... | <?php
/**
* SiteFilter.php
*
* Created By: jonathan
* Date: 28/09/2017
* Time: 13:33
*/
namespace Stati\Liquid\Filter;
class SiteFilter
{
/**
* Escapes an xml string
*
* @param string $input
*
* @return string
*/
public static function xml_escape($input)
{
retur... |
Add period on line 9
Added period on line 9 to match other comments | import createStore from './createStore'
import combineReducers from './combineReducers'
import bindActionCreators from './bindActionCreators'
import applyMiddleware from './applyMiddleware'
import compose from './compose'
/*
* This is a dummy function to check if the function name has been altered by minification.
* I... | import createStore from './createStore'
import combineReducers from './combineReducers'
import bindActionCreators from './bindActionCreators'
import applyMiddleware from './applyMiddleware'
import compose from './compose'
/*
* This is a dummy function to check if the function name has been altered by minification.
* I... |
Update config file for gh-pages assests path | /* jshint node: true */
module.exports = function(environment) {
var ENV = {
modulePrefix: 'dummy',
environment: environment,
baseURL: '/',
locationType: 'auto',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. 'with-contr... | /* jshint node: true */
module.exports = function(environment) {
var ENV = {
modulePrefix: 'dummy',
environment: environment,
baseURL: '/',
locationType: 'auto',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. 'with-contr... |
Order questions by published date
Closes #23 | from django.db import models
class Question(models.Model):
question_text = models.CharField(max_length=140)
published_at = models.DateTimeField(auto_now_add=True)
class Meta:
get_latest_by = 'published_at'
ordering = ('-published_at',)
def __str__(self):
return self.question_... | from django.db import models
class Question(models.Model):
question_text = models.CharField(max_length=140)
published_at = models.DateTimeField(auto_now_add=True)
class Meta:
get_latest_by = 'published_at'
def __str__(self):
return self.question_text
class Choice(models.Model):
... |
Use the fastest speed for png | package core
import (
"errors"
"fmt"
"image"
"image/png"
"io"
"os"
"os/exec"
)
type PNGHandler struct {
}
func (p *PNGHandler) ImageType() string {
return "image/png"
}
func (p *PNGHandler) Decode(reader io.Reader) (image.Image, error) {
return png.Decode(reader)
}
func (p *PNGH... | package core
import (
"errors"
"fmt"
"image"
"image/png"
"io"
"os"
"os/exec"
)
type PNGHandler struct {
}
func (p *PNGHandler) ImageType() string {
return "image/png"
}
func (p *PNGHandler) Decode(reader io.Reader) (image.Image, error) {
return png.Decode(reader)
}
func (p *PNGH... |
Speed up audio extraction by using input seeking | import path from 'path';
import { getBinariesPath } from '../util/appPaths';
const tmp = window.require('tmp-promise');
const { spawn } = window.require('child_process');
const fs = window.require('fs-extra');
const getBinaryFilename = () => {
const ffmpegDir = path.join(getBinariesPath(), 'ffmpeg');
let result =... | import path from 'path';
import { getBinariesPath } from '../util/appPaths';
const tmp = window.require('tmp-promise');
const { spawn } = window.require('child_process');
const fs = window.require('fs-extra');
const getBinaryFilename = () => {
const ffmpegDir = path.join(getBinariesPath(), 'ffmpeg');
let result =... |
Update 2019 day 5, first part, for new intcode computer | package main
import (
"fmt"
"strings"
"github.com/bewuethr/advent-of-code/go/convert"
"github.com/bewuethr/advent-of-code/go/intcode"
"github.com/bewuethr/advent-of-code/go/ioutil"
"github.com/bewuethr/advent-of-code/go/log"
)
func main() {
scanner, err := ioutil.GetInputScanner()
if err != nil {
log.Die("... | package main
import (
"strings"
"github.com/bewuethr/advent-of-code/go/convert"
"github.com/bewuethr/advent-of-code/go/intcode"
"github.com/bewuethr/advent-of-code/go/ioutil"
"github.com/bewuethr/advent-of-code/go/log"
)
func main() {
scanner, err := ioutil.GetInputScanner()
if err != nil {
log.Die("getting... |
Fix app initialization and use backbones navigate function for default route | Andamio.Application = function (options) {
_.extend(this, options);
this.vent = _.extend({}, Backbone.Events);
};
_.extend(Andamio.Application.prototype, Backbone.Events, Andamio.Region, {
// selector where the main appview will be rendered
container: 'main',
// data-region where every page will be displaye... | Andamio.Application = function (options) {
_.extend(this, options);
this.vent = _.extend({}, Backbone.Events);
};
_.extend(Andamio.Application.prototype, Backbone.Events, Andamio.Region, {
// selector where the main appview will be rendered
container: 'main',
// data-region where every page will be displaye... |
Make mocha run not only once, seems something has changed. | var expect = require('referee/lib/expect');
var should = require('should');
var assert = require('assert');
function consumeMessage(messageData) {
var sender = messageData.source;
var specCode = messageData.data;
// Reset mocha env
document.getElementById('mocha').innerHTML = '';
var mocha = new Mocha({repo... | var expect = require('referee/lib/expect');
var should = require('should');
var assert = require('assert');
function consumeMessage(messageData) {
var sender = messageData.source;
var specCode = messageData.data;
// Reset mocha env
document.getElementById('mocha').innerHTML = '';
var mocha = new Mocha({repo... |
Remove reference that our forthcoming Copybara config doesn't like.
RELNOTES=n/a
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=315774875 | /*
* Copyright (C) 2019 The Dagger Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or ag... | /*
* Copyright (C) 2019 The Dagger Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or ag... |
Test works only for locale=es_US. | /*
* Copyright (C) 2010-2013 by PhonyTive LLC (http://phonytive.com)
* http://astivetoolkit.org
*
* This file is part of Astive Toolkit(ATK)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with
* the License. You may obtain a copy of the Licen... | /*
* Copyright (C) 2010-2013 by PhonyTive LLC (http://phonytive.com)
* http://astivetoolkit.org
*
* This file is part of Astive Toolkit(ATK)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with
* the License. You may obtain a copy of the Licen... |
Update language trove classifier list to include Python 3
The Python 3.x support is now reasonably well-tested (74% coverage), so this closes #5. | from setuptools import setup
from timebook import get_version
setup(
name='timebook',
version=get_version(),
url='http://bitbucket.org/trevor/timebook/',
description='track what you spend time on',
author='Trevor Caira',
author_email='trevor@caira.com',
classifiers=[
'Development S... | from setuptools import setup
from timebook import get_version
setup(
name='timebook',
version=get_version(),
url='http://bitbucket.org/trevor/timebook/',
description='track what you spend time on',
author='Trevor Caira',
author_email='trevor@caira.com',
classifiers=[
'Development S... |
Revert "Breaking change to test Travis"
This reverts commit 795475b070ef56ce7d4ba50bce4f84a9b664b67b. | var test = require('tape');
var toDo = require('../libs/to-do-handler');
test('shouldGetToDoListForUsername', function(t) {
t.plan(2);
toDo.getToDoListForUsername('bhish',
function(result) {
var parsedToDo = result;
var expected = [
['Make to-do app', 'A to-do application should be made fo... | var test = require('tape');
var toDo = require('../libs/to-do-handler');
test('shouldGetToDoListForUsername', function(t) {
t.plan(2);
toDo.getToDoListForUsername('bhish',
function(result) {
var parsedToDo = result;
var expected = [
['Make to-do app', 'A to-do application should be made fo... |
Improve help messages from release_test | import argparse, common, sys, tests
from features import check_features, get_features, FEATURES
def arguments(argv=sys.argv[1:]):
parser = argparse.ArgumentParser()
names = [t.__name__.split('.')[1] for t in tests.__all__]
names = ', '.join(names)
parser.add_argument(
'tests', nargs='*',
... | import argparse, common, sys, tests
from features import check_features, get_features
def arguments(argv=sys.argv[1:]):
parser = argparse.ArgumentParser()
parser.add_argument(
'tests', nargs='*', help='The list of tests to run')
parser.add_argument(
'--features', '-f', default=[], action... |
Enable logging for test environment | const dotenv = require('dotenv');
dotenv.config({silent: true});
const config = {
"development": {
"username": process.env.DB_DEV_USER,
"password": process.env.DB_DEV_PASS,
"database": process.env.DB_DEV_NAME,
"host": process.env.DB_DEV_HOST,
"secrete": process.env.AUTH_SECRETE,
"dialect": "po... | const dotenv = require('dotenv');
dotenv.config({silent: true});
const config = {
"development": {
"username": process.env.DB_DEV_USER,
"password": process.env.DB_DEV_PASS,
"database": process.env.DB_DEV_NAME,
"host": process.env.DB_DEV_HOST,
"secrete": process.env.AUTH_SECRETE,
"dialect": "po... |
Adjust package of SSPerformanceTest for latest Apache POI sources | package org.apache.poi.benchmark.suite;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Setup;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
public class SSPerformanceBenchmarks extends BaseBenchmark {
@Setup
public void setUp() throws IOException {
... | package org.apache.poi.benchmark.suite;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Setup;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
public class SSPerformanceBenchmarks extends BaseBenchmark {
@Setup
public void setUp() throws IOException {
... |
BAP-11622: Optimize email body cleanup process
- Add migration message queue | <?php
namespace Oro\Bundle\EmailBundle\Migrations\Schema\v1_28;
use Doctrine\DBAL\Schema\Schema;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Oro\Bundle\MigrationBundle\Migration\Migration;
use Oro\Bundle\MigrationBundle\Migrati... | <?php
namespace Oro\Bundle\EmailBundle\Migrations\Schema\v1_28;
use Doctrine\DBAL\Schema\Schema;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Oro\Bundle\MigrationBundle\Migration\Migration;
use Oro\Bundle\MigrationBundle\Migrati... |
Move threads column to the
Put column after CPU, not at the end. | <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddThreadsColumnToServersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('serv... | <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddThreadsColumnToServersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('serv... |
Fix JSHint issue with requirejs & require. | /* global requirejs */
/* global require */
function registerComponents(container) {
var seen = requirejs._eak_seen;
var templates = seen, match;
if (!templates) { return; }
for (var prop in templates) {
if (match = prop.match(/components\/(.*)$/)) {
require(prop, null, null, true);
registerCo... | function registerComponents(container) {
var seen = requirejs._eak_seen;
var templates = seen, match;
if (!templates) { return; }
for (var prop in templates) {
if (match = prop.match(/components\/(.*)$/)) {
require(prop, null, null, true);
registerComponent(container, match[1]);
}
}
}
f... |
Fix editor font size brokenness | import { SET_SETTINGS, EDITOR_DECREASE_FONT_SIZE, EDITOR_INCREASE_FONT_SIZE } from '../actions';
const MINIMUM_FONT_SIZE = 8;
const initialState = {
editorFontSize: 14,
};
const settings = (state = initialState, action) => {
// The settings is an object with an arbitrary set of properties.
// The only pr... | import { SET_SETTINGS, EDITOR_DECREASE_FONT_SIZE, EDITOR_INCREASE_FONT_SIZE } from '../actions';
const initialState = {};
const MINIMUM_FONT_SIZE = 8;
const settings = (state = initialState, action) => {
// The settings is an object with an arbitrary set of properties.
// The only property we don't want to co... |
Replace storybook-state usage from radio story with useState | import React, { useState } from 'react';
import { addStoryInGroup, LOW_LEVEL_BLOCKS } from '../../../.storybook/utils';
import { RadioGroup, RadioButton } from '../../index';
const values = ['Option one', 'Option two', 'Option three'];
export default {
component: RadioButton,
title: addStoryInGroup(LOW_LEVEL_BLOC... | import React from 'react';
import { addStoryInGroup, LOW_LEVEL_BLOCKS } from '../../../.storybook/utils';
import { Store, State } from '@sambego/storybook-state';
import { RadioGroup, RadioButton } from '../../index';
const values = ['Option one', 'Option two', 'Option three'];
const store = new Store({
value: 'Opt... |
Change background related to search | import React, {Component} from 'react'
import {bindActionCreators} from 'redux'
import {connect} from 'react-redux'
import Card from '../components/Card'
import Search from '../components/Search'
import * as appActions from '../actions'
import './background-location.scss'
class Main extends Component {
componentDidM... | import React, {Component} from 'react'
import {bindActionCreators} from 'redux'
import {connect} from 'react-redux'
import Card from '../components/Card'
import Search from '../components/Search'
import * as appActions from '../actions'
import './background-location.scss'
class Main extends Component {
componentDidM... |
Adjust form templatetag to handle missing field var
When a non-existant field gets passed, the templatetag was raising an
unseemly AttributeError. This change checks to see if the passed var is
actually a form field to avoid said error. | from django import template
register = template.Library()
@register.tag
def annotate_form_field(parser, token):
"""
Set an attribute on a form field with the widget type
This means templates can use the widget type to render things differently
if they want to. Django doesn't make this available by ... | from django import template
register = template.Library()
@register.tag
def annotate_form_field(parser, token):
"""
Set an attribute on a form field with the widget type
This means templates can use the widget type to render things differently
if they want to. Django doesn't make this available by ... |
Change Dotenv contruction to app root directory | <?php
require __DIR__.'/../../vendor/autoload.php';
require 'path.php';
$dotenv = new Dotenv\Dotenv(dirname(dirname(__DIR__)));
$dotenv->load();
date_default_timezone_set(getenv('DATE_TIMEZONE') ?: 'Asia/Jakarta');
use Illuminate\Database\Capsule\Manager as Capsule;
$capsule = new Capsule;
$capsule->addConnection... | <?php
require __DIR__.'/../../vendor/autoload.php';
require 'path.php';
$dotenv = new Dotenv\Dotenv(dirname(__DIR__));
$dotenv->load();
date_default_timezone_set(getenv('DATE_TIMEZONE') ?: 'Asia/Jakarta');
use Illuminate\Database\Capsule\Manager as Capsule;
$capsule = new Capsule;
$capsule->addConnection(array(
... |
Make it so a parameter is required for the test to pass. | // 26: class - more-extends
// To do: make all tests pass, leave the assert lines unchanged!
describe('class can inherit from another', () => {
it('extend an `old style` "class", a function, still works', () => {
let A;
class B extends A {}
assert.equal(new B() instanceof A, true);
});
descr... | // 26: class - more-extends
// To do: make all tests pass, leave the assert lines unchanged!
describe('class can inherit from another', () => {
it('extend an `old style` "class", a function, still works', () => {
let A;
class B extends A {}
assert.equal(new B() instanceof A, true);
});
descr... |
[JENKINS-25940] Add workaround to prevent NPE in Maven projects | /*
* 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 hudson.plugins.emailext;
import java.util.Collection;
import java.util.Collections;
import hudson.Extension;
imp... | /*
* 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 hudson.plugins.emailext;
import java.util.Collection;
import java.util.Collections;
import hudson.Extension;
imp... |
Set SO_REUSEADDR in client test. | #!/usr/bin/python
# Test whether a client produces a correct connect and subsequent disconnect.
import os
import subprocess
import socket
import sys
import time
from struct import *
rc = 1
keepalive = 60
connect_packet = pack('!BBH6sBBHH21s', 16, 12+2+21,6,"MQIsdp",3,2,keepalive,21,"01-con-discon-success")
connack_p... | #!/usr/bin/python
# Test whether a client produces a correct connect and subsequent disconnect.
import os
import subprocess
import socket
import sys
import time
from struct import *
rc = 1
keepalive = 60
connect_packet = pack('!BBH6sBBHH21s', 16, 12+2+21,6,"MQIsdp",3,2,keepalive,21,"01-con-discon-success")
connack_p... |
Change env var name to match our new standard
This environment variable was not getting used previously, and was only
put in because we knew we would eventually start using it. However, when
we started using it we decided to simply make it 'CODE_VERSION' instead
of 'DEPLOYED_CODE_VERSION'. | 'use strict';
var RB = require('./ResponseBuilder');
module.exports = RB.extend({
init: function() {
var now = new Date(),
builtOn = [];
this._super();
this.allowCORS();
this.supportJSONP('callback');
this.cacheForMinutes(30);
builtOn.push(process.env.AWS_REGION);
... | 'use strict';
var RB = require('./ResponseBuilder');
module.exports = RB.extend({
init: function() {
var now = new Date(),
builtOn = [];
this._super();
this.allowCORS();
this.supportJSONP('callback');
this.cacheForMinutes(30);
builtOn.push(process.env.AWS_REGION);
... |
Add a projectile hit handler, and allow for hit FX on projectiles | package com.elmakers.mine.bukkit.api.spell;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
/**
* Represents a Spell that may be cast by a Mage.
*
* Each Spell is based on a SpellTemplate, which a... | package com.elmakers.mine.bukkit.api.spell;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
/**
* Represents a Spell that may be cast by a Mage.
*
* Each Spell is based on a SpellTemplate, which a... |
Return the status line of response header. | package org.yukung.sandbox.http;
import static org.yukung.sandbox.http.HttpRequest.CRLF;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.net.ServerSocket;
import java.net.Socket;
/**
* @author yukung
*/
public class Main {
pu... | package org.yukung.sandbox.http;
import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;
/**
* @author yukung
*/
public class Main {
public static void main(String[] args) throws IOException {
System.out.println("start >>>");
try (
... |
Remove unnecessary logging, emit card click data as object | "use strict";
var socket = io();
var username;
$(window).load(function() {
username = prompt("Please enter your name");
socket.emit('log on', username);
});
$(window).on('beforeunload', function() {
socket.emit('log off', username);
});
function userActivity(name, joinedOrLeft) {
alert(name + " " + join... | "use strict";
var socket = io();
var username;
$(window).load(function() {
username = prompt("Please enter your name");
socket.emit('log on', username);
});
$(window).on('beforeunload', function() {
socket.emit('log off', username);
});
function userActivity(name, joinedOrLeft) {
alert(name + " " + join... |
Fix initializing logger in wizards plugin | package org.perfclipse.wizards;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
import org.perfclipse.core.logging.Logger;
/**
* The activator class controls the plug-in life cycle
*/
public class Activator extends AbstractUIPlugin {
private Logger logger;
// The plug-in ... | package org.perfclipse.wizards;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
import org.perfclipse.core.logging.Logger;
/**
* The activator class controls the plug-in life cycle
*/
public class Activator extends AbstractUIPlugin {
private Logger logger;
// The plug-in ... |
Correct version for deploy to GAE | //Command to run test version:
//goapp serve app.yaml
//Command to deploy/update application:
//goapp deploy -application golangnode0 -version 0
package main
import (
"fmt"
"net/http"
)
func helloWorld(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello World!")
}
func startPage(w http.ResponseWriter... | //Command to run test version:
//goapp serve app.yaml
//Command to deploy/update application:
//goapp deploy -application golangnode0 -version 0
package main
import (
"fmt"
"net/http"
)
func helloWorld(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello World!")
}
func startPage(w http.ResponseWriter... |
Make db a required option | package app
import (
"database/sql"
"github.com/goph/stdlib/errors"
"github.com/goph/stdlib/log"
)
// ServiceOption sets options in the Service.
type ServiceOption func(s *Service)
// Logger returns a ServiceOption that sets the logger for the service.
func Logger(l log.Logger) ServiceOption {
return func(s *Se... | package app
import (
"database/sql"
"github.com/goph/stdlib/errors"
"github.com/goph/stdlib/log"
)
// ServiceOption sets options in the Service.
type ServiceOption func(s *Service)
// DB returns a ServiceOption that sets the DB object for the service.
func DB(db *sql.DB) ServiceOption {
return func(s *Service) ... |
Remove the lazy signup backend's hard dependency on django.contrib.auth.user (and remove the inconsistency in checking for whether a user is lazy or not). | from django.contrib.auth.backends import ModelBackend
from lazysignup.models import LazyUser
class LazySignupBackend(ModelBackend):
def authenticate(self, username=None):
lazy_users = LazyUser.objects.filter(
user__username=username
).select_related('user')
try:
ret... | from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.models import User
class LazySignupBackend(ModelBackend):
def authenticate(self, username=None):
users = [u for u in User.objects.filter(username=username)
if not u.has_usable_password()]
if len(users) ... |
Allow version check to actually run on older node versions | #!/usr/bin/env node
// eslint messages suppressed to allow this to work
// in older node versions.
/* eslint-disable strict */
/* eslint-disable no-var */
/* eslint-disable no-console */
/* eslint-disable prefer-template */
'use strict';
// A simple check that node + npm versions
// meet the expected minimums.
var... | #!/usr/bin/env node
/* eslint-disable strict */
/* eslint-disable no-console */
/* eslint-disable prefer-template */
'use strict';
// A simple check that node + npm versions
// meet the expected minimums.
const exec = require('shelljs').exec;
const chalk = require('chalk');
const semver = require('semver');
const ... |
Add test for reordering elements in an Array. | describe("Utilities", function() {
it("should get the domain", function() {
expect(getDomain('http://www.google.com')).toMatch('www.google.com');
expect(getDomain('http://www.google.com/')).toMatch('www.google.com');
expect(getDomain('http://www.google.com/kitty')).toMatch('www.google.com');
expect(getDomain(... | describe("Utilities", function() {
it("should get the domain", function() {
expect(getDomain('http://www.google.com')).toMatch('www.google.com');
expect(getDomain('http://www.google.com/')).toMatch('www.google.com');
expect(getDomain('http://www.google.com/kitty')).toMatch('www.google.com');
expect(getDomain(... |
Fix django logger issue when error has no attached request object | import copy
import logging
import traceback
def dump(obj):
for attr in dir(obj):
print("obj.%s = %r" % (attr, getattr(obj, attr)))
def dump_request_summary(request):
user = request.user.username if request.user.is_authenticated() else ''
url = request.path
method = request.method
body = ... | import copy
import logging
import traceback
def dump(obj):
for attr in dir(obj):
print("obj.%s = %r" % (attr, getattr(obj, attr)))
def dump_request_summary(request):
user = request.user.username if request.user.is_authenticated() else ''
url = request.path
method = request.method
body = ... |
Improve unicode for motivational texts | from django.db import models
from patient.models import Patient
from django.utils.encoding import smart_unicode
class MotivationText(models.Model):
patient = models.ForeignKey(Patient, null=False)
text = models.TextField(default='', blank=False)
time_created = models.DateTimeField(null=False, auto_now_ad... | from django.db import models
from patient.models import Patient
from django.utils.encoding import smart_unicode
class MotivationText(models.Model):
patient = models.ForeignKey(Patient, null=False)
text = models.TextField(default='', blank=False)
time_created = models.DateTimeField(null=False, auto_now_ad... |
Fix a bug in Node.js | /**
* Add shim config for configuring the dependencies and exports for
* older, traditional "browser globals" scripts that do not use define()
* to declare the dependencies and set a module value.
*/
(function(seajs, global) {
// seajs.config({
// shim: {
// "jquery": {
// src: "lib/jquery.js",
// ... | /**
* Add shim config for configuring the dependencies and exports for
* older, traditional "browser globals" scripts that do not use define()
* to declare the dependencies and set a module value.
*/
(function(seajs, global) {
// seajs.config({
// shim: {
// "jquery": {
// src: "lib/jquery.js",
// ... |
Fix tests for PHP < 5.5 | <?php
namespace Omnipay\Swish\Message;
use Omnipay\Common\Message\AbstractResponse;
use Omnipay\Common\Message\RequestInterface;
class PurchaseResponse extends AbstractResponse
{
protected $statusCode;
protected $response;
public function __construct(RequestInterface $request, $response, $data, $statusC... | <?php
namespace Omnipay\Swish\Message;
use Omnipay\Common\Message\AbstractResponse;
use Omnipay\Common\Message\RequestInterface;
class PurchaseResponse extends AbstractResponse
{
protected $statusCode;
protected $response;
public function __construct(RequestInterface $request, $response, $data, $statusC... |
Add bearer to qp token | 'use strict';
var authHeader = require('auth-header');
var tokenUtils = require('./token');
module.exports = function (options) {
return function (req, res, next) {
var authorization = req.get('authorization') || 'Bearer ' + req.query.token;
req.challenge = authorization;
var auth = authHeader.parse(a... | 'use strict';
var authHeader = require('auth-header');
var tokenUtils = require('./token');
module.exports = function (options) {
return function (req, res, next) {
var authorization = req.get('authorization') || req.query.token;
req.challenge = authorization;
var auth = authHeader.parse(authorization... |
Remove a line of debugging code | from __future__ import division # for Python 2.x compatibility
import numpy
class EuclidField(object):
p = 5.0
r = 30.0
@staticmethod
def dist(x, y):
return numpy.hypot(x[0]-y[0], x[1]-y[1])
def __init__(self, size, dst, obstacles):
w, h = size
self.shape = (h, w)
se... | from __future__ import division # for Python 2.x compatibility
import numpy
class EuclidField(object):
p = 5.0
r = 30.0
@staticmethod
def dist(x, y):
return numpy.hypot(x[0]-y[0], x[1]-y[1])
def __init__(self, size, dst, obstacles):
w, h = size
self.shape = (h, w)
se... |
Add flag for new module loader. | /*
___ usage ___ en_US ___
usage: prolific stdio
-o, --stdout use stdout (default)
-e, --stderr use stderr
--help display this message
___ $ ___ en_US ___
log is required:
the `--log` address and po... | /*
___ usage ___ en_US ___
usage: prolific stdio
-o, --stdout use stdout (default)
-e, --stderr use stderr
--help display this message
___ $ ___ en_US ___
log is required:
the `--log` address and po... |
Remove tests that are not relevant anymore. | /**
* Internal dependencies
*/
import { addAMPExtraProps } from '../';
describe( 'addAMPExtraProps', () => {
it( 'does not modify non-child blocks', () => {
const props = addAMPExtraProps( {}, { name: 'foo/bar' }, {} );
expect( props ).toStrictEqual( {} );
} );
it( 'adds a font family attribute', () => {
... | /**
* Internal dependencies
*/
import { addAMPExtraProps } from '../';
describe( 'addAMPExtraProps', () => {
it( 'does not modify non-child blocks', () => {
const props = addAMPExtraProps( {}, { name: 'foo/bar' }, {} );
expect( props ).toStrictEqual( {} );
} );
it( 'generates a unique ID', () => {
const p... |
Clear old store instance on ctor | /*
* Copyright (c) 2002-2003 by OpenSymphony
* All rights reserved.
*/
package com.opensymphony.workflow;
import com.opensymphony.workflow.basic.BasicWorkflow;
import com.opensymphony.workflow.config.ConfigLoader;
import com.opensymphony.workflow.spi.StoreFactory;
import java.net.URL;
/**
* @author Hani Suleima... | /*
* Copyright (c) 2002-2003 by OpenSymphony
* All rights reserved.
*/
package com.opensymphony.workflow;
import com.opensymphony.workflow.basic.BasicWorkflow;
import com.opensymphony.workflow.config.ConfigLoader;
import java.net.URL;
/**
* @author Hani Suleiman (hani@formicary.net)
* Date: May 10, 2003
* Tim... |
Use getMapAsync, original file was renamed | package com.mapzen.android.sample;
import com.mapzen.android.MapFragment;
import com.mapzen.android.MapManager;
import com.mapzen.tangram.MapController;
import com.mapzen.tangram.MapView;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
/**
* Basic SDK demo, tracks user's current location... | package com.mapzen.android.sample;
import com.mapzen.android.MapFragment;
import com.mapzen.android.MapManager;
import com.mapzen.tangram.MapController;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
/**
* Basic SDK demo, tracks user's current location on map.
*/
public class BasicMapz... |
Implement CLI classes for MVC (unstable) | <?php
/**
* CLIResponse
*/
namespace Orpheus\InputController\CLIController;
use Orpheus\InputController\OutputResponse;
/**
* The CLIResponse class
*
* @author Florent Hazard <contact@sowapps.com>
*
*/
class CLIResponse extends OutputResponse {
/**
* The HTML body of the response
*
* @var string
... | <?php
/**
* CLIResponse
*/
namespace Orpheus\InputController\CLIController;
use Orpheus\InputController\OutputResponse;
/**
* The CLIResponse class
*
* @author Florent Hazard <contact@sowapps.com>
*
*/
class CLIResponse extends OutputResponse {
/**
* The HTML body of the response
*
* @var string
... |
Support larger thumbnails on screenr.com | package com.todoist.mediaparser.mediaparser;
import com.todoist.mediaparser.util.MediaType;
import java.util.regex.Pattern;
public class ScreenrParser extends BaseOEmbedMediaParser {
private static Pattern sMatchingPattern;
ScreenrParser(String url) {
super(url);
}
@Override
public MediaType getContentMedia... | package com.todoist.mediaparser.mediaparser;
import com.todoist.mediaparser.util.MediaType;
import java.util.regex.Pattern;
public class ScreenrParser extends BaseOEmbedMediaParser {
private static Pattern sMatchingPattern;
ScreenrParser(String url) {
super(url);
}
@Override
public MediaType getContentMedia... |
Allow running outside from a phar archive | #!/usr/bin/env php
<?php
error_reporting(E_ALL);
function gtk_die($message) {
$dialog = new \GtkMessageDialog(null, 0, \Gtk::MESSAGE_ERROR, \Gtk::BUTTONS_OK, $message);
$dialog->set_markup($message);
$dialog->run();
$dialog->destroy();
die($message."\n");
}
if (!extension_loaded('php-gtk')) {
... | #!/usr/bin/env php
<?php
error_reporting(E_ALL);
function gtk_die($message) {
$dialog = new \GtkMessageDialog(null, 0, \Gtk::MESSAGE_ERROR, \Gtk::BUTTONS_OK, $message);
$dialog->set_markup($message);
$dialog->run();
$dialog->destroy();
die($message."\n");
}
if (!extension_loaded('php-gtk')) {
... |
Change the context link URL to the result link | // Returns the contexts (short description with bolded matched words) of the
// search results. This is only a function to allow the implementation to be
// changed if Google ever changes the format of their HTML.
function getSearchContexts() {
return document.querySelectorAll(".st");
}
// Returns the relevant URL f... | // Returns the contexts (short description with bolded matched words) of the
// search results. This is only a function to allow the implementation to be
// changed if Google ever changes the format of their HTML.
function getSearchContexts() {
return document.querySelectorAll(".st");
}
function forEverySubContext(c... |
Fix issue where errors aren't being propagated. | function DeferredChain() {
var self = this;
this.chain = new Promise(function(accept, reject) {
self._accept = accept;
self._reject = reject;
});
this.await = new Promise(function() {
self._done = arguments[0];
self._error = arguments[1];
});
this.started = false;
};
DeferredChain.prototyp... | function DeferredChain() {
var self = this;
this.chain = new Promise(function(accept, reject) {
self._accept = accept;
self._reject = reject;
});
this.await = new Promise(function() {
self._done = arguments[0];
});
this.started = false;
};
DeferredChain.prototype.then = function(fn) {
var se... |
lathe[cuboid]: Generalize BoxGeometry translation helpers to scaling. | /* eslint-env es6 */
/* global THREE, Indices */
function transformBoxVertices( method ) {
'use strict';
const vector = new THREE.Vector3();
const zero = new THREE.Vector3();
return function transform( geometry, vectors ) {
Object.keys( vectors ).forEach( key => {
const delta = vectors[ key ];
... | /* eslint-env es6 */
/* global THREE, Indices */
window.translateBoxVertices = (function() {
'use strict';
const vector = new THREE.Vector3();
const zero = new THREE.Vector3();
return function translate( geometry, vectors ) {
Object.keys( vectors ).forEach( key => {
const delta = vectors[ key ];
... |
Make 0 the default version | # 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 missing font awesome icons for the datetime picker | var coupon = function () {
var durationSelector = '#duration';
var $body = $('body');
var $duration = $(durationSelector);
var $durationInMonths = $('#duration-in-months');
var $redeem_by = $('#redeem_by');
$body.on('change', durationSelector, function () {
if ($duration.val() === 'rep... | var coupon = function () {
var durationSelector = '#duration';
var $body = $('body');
var $duration = $(durationSelector);
var $durationInMonths = $('#duration-in-months');
var $redeem_by = $('#redeem_by');
$body.on('change', durationSelector, function () {
if ($duration.val() === 'rep... |
Fix height of blockconfirmation icon and reduces row height | package io.bisq.gui.components;
import de.jensd.fx.fontawesome.AwesomeDude;
import de.jensd.fx.fontawesome.AwesomeIcon;
import javafx.geometry.Insets;
import javafx.scene.control.ContentDisplay;
import javafx.scene.control.Hyperlink;
import javafx.scene.control.Label;
public class HyperlinkWithIcon extends Hyperlink ... | package io.bisq.gui.components;
import de.jensd.fx.fontawesome.AwesomeDude;
import de.jensd.fx.fontawesome.AwesomeIcon;
import javafx.scene.control.ContentDisplay;
import javafx.scene.control.Hyperlink;
import javafx.scene.control.Label;
public class HyperlinkWithIcon extends Hyperlink {
public HyperlinkWithIcon... |
Fix static page sitemap urls | from common.helpers.constants import FrontEndSection
from django.contrib.sitemaps import Sitemap
from .models import Project
from datetime import date
class SectionSitemap(Sitemap):
protocol = "https"
changefreq = "monthly"
priority = 0.5
# TODO: Update this date for each release
lastmod = date(ye... | from common.helpers.constants import FrontEndSection
from django.contrib.sitemaps import Sitemap
from .models import Project
from datetime import date
class SectionSitemap(Sitemap):
protocol = "https"
changefreq = "monthly"
priority = 0.5
# TODO: Update this date for each release
lastmod = date(ye... |
Remove fancybox afterLoad / afterClose event on destroy. | "use strict";
angular.module("hikeio").
directive("fancybox", ["$rootScope", function($rootScope) {
return {
link: function (scope, element, attrs) {
var context = {
afterLoad: function(current, previous) {
$rootScope.$broadcast("fancyboxLoaded");
},
afterClose: function(current, previou... | "use strict";
angular.module("hikeio").
directive("fancybox", ["$rootScope", function($rootScope) {
return {
link: function (scope, element, attrs) {
scope.$on("$routeChangeStart", function () {
$.fancybox.close();
});
scope.$on("fancyboxClose", function () {
$.fancybox.close();
});
... |
Define Alternate Names for city rather than this shortname, long name etc. | package com.sarality.app.data.location;
import com.sarality.app.data.BaseEnumData;
import java.util.List;
/**
* Enum Data for a City.
*
* @author abhideep@ (Abhideep Singh)
*/
public class City extends BaseEnumData<City> {
private final String name;
private final Country country;
private final List<String... | package com.sarality.app.data.location;
import com.sarality.app.data.BaseEnumData;
/**
* Enum Data for a City.
*
* @author abhideep@ (Abhideep Singh)
*/
public class City extends BaseEnumData<City> {
private final String shortName;
private final String fullName;
private final String oldName;
private fina... |
Refactor getting the default team id | <?php
# See application/core/MY_Model for this parent model
class Team_stats_model extends Crud_model
{
public function __construct()
{
parent::__construct();
$this->table = 'team_stats';
}
public function all()
{
$res = $this->db->get($this->table)->result();
/* we strip off useless zero... | <?php
# See application/core/MY_Model for this parent model
class Team_stats_model extends Crud_model
{
public function __construct()
{
parent::__construct();
$this->table = 'team_stats';
}
public function all()
{
$res = $this->db->get($this->table)->result();
/* we strip off useless zero... |
Add inter-month padding trait to factory. | #------------------------------------------------------------------------------
#
# Copyright (c) 2008, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions... | #------------------------------------------------------------------------------
#
# Copyright (c) 2008, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions... |
Add support for including the domain the the analytics asset | package assets
import (
"fmt"
)
const (
analyticsScript = `<script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,... | package assets
import (
"fmt"
)
const (
analyticsScript = `<script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,... |
Use a lock file to avoid parallel-saving | <?php
include("init_local.php");
loadlib("wof_save");
loadlib("offline_tasks");
loadlib("uuid");
loadlib("logstash");
$lockfile = "{$GLOBALS['cfg']['pending_log_dir']}SAVE_LOCKFILE";
if (file_exists($lockfile)) {
die("Looks like save_pending.php might already be running.\n");
}
// Set a lock file so we do... | <?php
include("init_local.php");
loadlib("wof_save");
loadlib("offline_tasks");
loadlib("uuid");
loadlib("logstash");
$task_id = uuid_v4();
$now = offline_tasks_microtime();
$event = array(
'action' => 'schedule',
'task_id' => $task_id,
'task' => 'save_pending',
'data' => array(),
'rsp' => array(),
... |
fix(json): Fix generator type serializer not serializing properties | package valandur.webapi.json.serializers.world;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import org.spongepowered.api.data.DataQuery;
import org.spongepowered.api.world.GeneratorType;
import ... | package valandur.webapi.json.serializers.world;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
import org.spongepowered.api.world.GeneratorType;
import java.io.IOException;
public class GeneratorT... |
Clean up BQ test data properly
If you delete datasets while iterating over datasets, you eventually get
errors. This fixes that by building a list of all datasets before we
delete any. | import os
from django.core.management import BaseCommand, CommandError
from gcutils.bigquery import Client
class Command(BaseCommand):
help = 'Removes any datasets whose tables have all expired'
def handle(self, *args, **kwargs):
if os.environ['DJANGO_SETTINGS_MODULE'] != \
'openpresc... | import os
from django.core.management import BaseCommand, CommandError
from gcutils.bigquery import Client
class Command(BaseCommand):
help = 'Removes any datasets whose tables have all expired'
def handle(self, *args, **kwargs):
if os.environ['DJANGO_SETTINGS_MODULE'] != \
'openpresc... |
Add updateTime check to test. | //
// Tests for BitGo Object
//
// Copyright 2014, BitGo, Inc. All Rights Reserved.
//
var assert = require('assert');
var should = require('should');
var BitGoJS = require('../src/index');
describe('BitGo', function() {
describe('methods', function() {
it('includes version', function() {
var bitgo = n... | //
// Tests for BitGo Object
//
// Copyright 2014, BitGo, Inc. All Rights Reserved.
//
var assert = require('assert');
var should = require('should');
var BitGoJS = require('../src/index');
describe('BitGo', function() {
describe('methods', function() {
it('includes version', function() {
var bitgo = n... |
Use type instead of uint8. | package models
import "github.com/brocaar/lorawan"
// NodeSession contains the informatio of a node-session (an activated node).
type NodeSession struct {
DevAddr lorawan.DevAddr `json:"devAddr"`
AppEUI lorawan.EUI64 `json:"appEUI"`
DevEUI lorawan.EUI64 `json:"devEUI"`
AppSKey lorawan.AES128Key `j... | package models
import "github.com/brocaar/lorawan"
// NodeSession contains the informatio of a node-session (an activated node).
type NodeSession struct {
DevAddr lorawan.DevAddr `json:"devAddr"`
AppEUI lorawan.EUI64 `json:"appEUI"`
DevEUI lorawan.EUI64 `json:"devEUI"`
AppSKey lorawan.AES128Key `j... |
Revert "catch service worker error?"
This reverts commit c14cfe8917c1f1c23ccd4bbd25a7b40d6c5d6b2b. | /*jslint browser: true*/
if (navigator.serviceWorker && location.host !== 'localhost:8000') {
navigator.serviceWorker.register('/serviceworker.js', {
scope: '/'
});
window.addEventListener('load', function () {
if (navigator.serviceWorker.controller) {
navigator.serviceWorker.co... | /*jslint browser: true*/
if (navigator.serviceWorker && location.protocol === 'https://') {
try {
navigator.serviceWorker.register('/serviceworker.js', {
scope: '/'
});
window.addEventListener('load', function () {
if (navigator.serviceWorker.controller) {
... |
Fix var type convention conflict | var config = require('../../config');
var sparqlQueryBuilder = require('../utils/sparql-query-builder');
var sparqlClient = require('sparql-client');
var util = require('util');
/* To be moved to its own file */
class Resource {
constructor(uri, properties = {}, relationships = {}) {
this.uri = uri,
this.pro... | const config = require('../../config'),
sparqlQueryBuilder = require('../utils/sparql-query-builder'),
sparqlClient = require('sparql-client'),
util = require('util');
/* To be moved to its own file */
class Resource {
constructor(uri, properties = {}, relationships = {}) {
this.uri = uri,
... |
Normalize the file dir path. Fixes the problem with UI not working if file dir was specified with a trailing slash. |
var argv = require('optimist').argv;
var fs = require('fs');
var config = require('./config/config.defaults.js');
if (argv['h']) { config.serverHost = argv['h']; }
if (argv['host']) { config.serverHost = argv['host']; }
if (argv['p']) { config.serverPort = argv['p']; }
if ... |
var argv = require('optimist').argv;
var config = require('./config/config.defaults.js');
if (argv['h']) { config.serverHost = argv['h']; }
if (argv['host']) { config.serverHost = argv['host']; }
if (argv['p']) { config.serverPort = argv['p']; }
if (argv['port']) { co... |
Allow S3 to properly serve to the cache servers | <?php
class UploadFile {
public function fire($job, $data)
{
$object = Object::where('name', $data['name'])->first();
// Take file
$path = base_path().DIRECTORY_SEPARATOR.'storage'.DIRECTORY_SEPARATOR.$object->name;
// Upload to S3
$s3 = App::make('aws')->ge... | <?php
class UploadFile {
public function fire($job, $data)
{
$object = Object::where('name', $data['name'])->first();
// Take file
$path = base_path().DIRECTORY_SEPARATOR.'storage'.DIRECTORY_SEPARATOR.$object->name;
// Upload to S3
$s3 = App::make('aws')->ge... |
Remove some lines as defined in ADR1. | // 25: class - extends
// To do: make all tests pass, leave the assert lines unchanged!
describe('Classes can inherit from another using `extends`', () => {
describe('the default super class is `Object`', () => {
it('a `class A` is an instance of `Object`', () => {
//// let A
class A {}
assert.... | // 25: class - extends
// To do: make all tests pass, leave the assert lines unchanged!
describe('Classes can inherit from another using `extends`', () => {
describe('the default super class is `Object`', () => {
it('a `class A` is an instance of `Object`', () => {
//// let A
class A {}
assert.... |
Return Arrays Instead of Objects | var rootView = null;
export function isAttached(view) {
if (!view) throw new Error("'view' param is required.");
return view.parentElement !== null;
}
export function setRootView(view) {
if (!view) throw new Error("'view' param is required.");
rootView = view;
}
export function getRootView() {
return rootV... | var rootView = null;
export function isAttached(view) {
if (!view) throw new Error("'view' param is required.");
return view.parentElement !== null;
}
export function setRootView(view) {
if (!view) throw new Error("'view' param is required.");
rootView = view;
}
export function getRootView() {
return rootV... |
Revert "Revert "PRA-410: resp changed to interface""
This reverts commit d12fdf8244766409cf0afba7eab9eeb75e0f2708. | package activity
import (
"time"
"github.com/tolexo/aero/activity/model"
"github.com/tolexo/aero/db/tmongo"
mgo "gopkg.in/mgo.v2"
)
const (
DB_CONTAINER = "database.omni"
)
//Log User activity
func LogActivity(url string, body interface{},
resp interface{}, respCode int, respTime float64) {
apiDetail := mode... | package activity
import (
"reflect"
"time"
"github.com/tolexo/aero/activity/model"
"github.com/tolexo/aero/db/tmongo"
mgo "gopkg.in/mgo.v2"
)
const (
DB_CONTAINER = "database.omni"
)
//Log User activity
func LogActivity(url string, body interface{},
resp reflect.Value, respCode int, respTime float64) {
apiD... |
Replace dots with something else on user create and edit screens |
<div class="toggle-switch-list dual-column-content">
@foreach($roles as $role)
<div>
@include('components.custom-checkbox', [
'name' => $name . '[' . str_replace('.', 'DOT', $role->name) . ']',
'label' => $role->display_name,
'value' => $role->id,... |
<div class="toggle-switch-list dual-column-content">
@foreach($roles as $role)
<div>
@include('components.custom-checkbox', [
'name' => $name . '[' . $role->name . ']',
'label' => $role->display_name,
'value' => $role->id,
'checked... |
Include devDependencies in get dependency | // Get the appropriate dependency for a package.
var childProcess = require('child_process');
var path = require('path');
var glob = require('glob');
var name = process.argv[2];
// Look in all of the packages.
var basePath = path.resolve('.');
var files = glob.sync(path.join(basePath, 'packages/*'));
for (var j = 0... | // Get the appropriate dependency for a package.
var childProcess = require('child_process');
var path = require('path');
var glob = require('glob');
var name = process.argv[2];
// Look in all of the packages.
var basePath = path.resolve('.');
var files = glob.sync(path.join(basePath, 'packages/*'));
for (var j = 0... |
Update channel object to store ID as a string. | // Copyright 2013 Judson D Neer
package com.singledsoftware.mixmaestro;
import java.io.Serializable;
/**
* Stores data for an individual channel.
*
* @see Serializable
* @author Judson D Neer
*/
public class Channel implements Serializable {
// Unique serializable version ID
private static final long s... | // Copyright 2013 Judson D Neer
package com.singledsoftware.mixmaestro;
import java.io.Serializable;
/**
* Stores data for an individual channel.
*
* @see Serializable
* @author Judson D Neer
*/
public class Channel implements Serializable {
// Unique serializable version ID
private static final long s... |
Fix typo: notifcation -> notification | 'use strict';
/**
* Module dependencies
*/
import * as mongo from 'mongodb';
import Notification from '../../../models/notification';
import serialize from '../../../serializers/notification';
import event from '../../../event';
/**
* Mark as read a notification
*
* @param {Object} params
* @param {Object} user... | 'use strict';
/**
* Module dependencies
*/
import * as mongo from 'mongodb';
import Notification from '../../../models/notification';
import serialize from '../../../serializers/notification';
import event from '../../../event';
/**
* Mark as read a notification
*
* @param {Object} params
* @param {Object} user... |
Fix the order of Session model behaviors. | /* global window */
import feathersClient from './feathers-client';
import feathersSession from 'can-connect-feathers/session';
import connect from 'can-connect';
import dataParse from 'can-connect/data/parse/';
import construct from 'can-connect/constructor/';
import constructStore from 'can-connect/constructor/store/... | /* global window */
import feathersClient from './feathers-client';
import feathersSession from 'can-connect-feathers/session';
import connect from 'can-connect';
import dataParse from 'can-connect/data/parse/';
import construct from 'can-connect/constructor/';
import constructStore from 'can-connect/constructor/store/... |
Fix duplicated calls of sagas based on history | import { createStore, applyMiddleware, compose } from 'redux'
import { browserHistory } from 'react-router'
import { syncHistoryWithStore, routerMiddleware } from 'react-router-redux'
import createReducer from './reducers'
import createSagaMiddleware from 'redux-saga'
import rootSaga from './sagas'
export default fun... | import { createStore, applyMiddleware, compose } from 'redux'
import { browserHistory} from 'react-router'
import { syncHistoryWithStore, routerMiddleware } from 'react-router-redux'
import createReducer from './reducers'
import createSagaMiddleware from 'redux-saga'
import rootSaga from './sagas'
export default func... |
:guitar: Make posts insertable/editable by members | import { Posts } from 'meteor/example-forum';
/*
Let's assign a color to each post (why? cause we want to, that's why).
We'll do that by adding a custom field to the Posts collection.
Note that this requires our custom package to depend on vulcan:posts and vulcan:users.
*/
Posts.addField([
{
fieldName: 'soundcl... | import { Posts } from 'meteor/example-forum';
/*
Let's assign a color to each post (why? cause we want to, that's why).
We'll do that by adding a custom field to the Posts collection.
Note that this requires our custom package to depend on vulcan:posts and vulcan:users.
*/
Posts.addField([
{
fieldName: 'soundcl... |
Fix menu items for noi/tickets | # -*- coding: UTF-8 -*-
# Copyright 2016 Luc Saffre
# License: BSD (see file COPYING for details)
"""Fixtures specific for the Team variant of Lino Noi.
.. autosummary::
:toctree:
models
"""
from lino_xl.lib.tickets import *
class Plugin(Plugin):
"""Adds the :mod:`lino_xl.lib.votes` plugin.
"""
... | # -*- coding: UTF-8 -*-
# Copyright 2016 Luc Saffre
# License: BSD (see file COPYING for details)
"""Fixtures specific for the Team variant of Lino Noi.
.. autosummary::
:toctree:
models
"""
from lino_xl.lib.tickets import *
class Plugin(Plugin):
"""Adds the :mod:`lino_xl.lib.votes` plugin.
"""
... |
Disable formatting for renderer logs to file | import { createStore, applyMiddleware } from 'redux';
import thunkMiddleware from 'redux-thunk';
import rootReducer from '../reducers';
import { createLogger } from '../../browser/remote';
const middlewares = [thunkMiddleware];
/* eslint global-require:0 */
if (global.SQLECTRON_CONFIG.log.console) {
const loggerCo... | import { createStore, applyMiddleware } from 'redux';
import thunkMiddleware from 'redux-thunk';
import rootReducer from '../reducers';
import { createLogger } from '../../browser/remote';
const middlewares = [thunkMiddleware];
/* eslint global-require:0 */
if (global.SQLECTRON_CONFIG.log.console) {
const loggerCo... |
Make sure the tail subprocess does not actually list any prior records
Signed-off-by: Jason Bernardino Alonso <f71c42a1353bbcdbe07e24c2a1c893f8ea1d05ee@hackorp.com> | """
Utility functions for dhcp2nest
"""
from queue import Queue
from subprocess import Popen, PIPE
from threading import Thread
def follow_file(fn, max_lines=100):
"""
Return a Queue that is fed lines (up to max_lines) from the given file (fn)
continuously
The implementation given here was inspired b... | """
Utility functions for dhcp2nest
"""
from queue import Queue
from subprocess import Popen, PIPE
from threading import Thread
def follow_file(fn, max_lines=100):
"""
Return a Queue that is fed lines (up to max_lines) from the given file (fn)
continuously
The implementation given here was inspired b... |
Use RTS URL passed through | /*
Copyright 2016 OpenMarket Ltd
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
... | /*
Copyright 2016 OpenMarket Ltd
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
... |
Update password reminders with new configuration.
Signed-off-by: crynobone <e1a543840a942eb68427510a8a483282a7bfeddf@gmail.com> | <?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class OrchestraAuthCreatePasswordRemindersTable extends Migration
{
/**
* Table name.
*
* @var string
*/
protected $table;
/**
* Construct a new pa... | <?php
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class OrchestraAuthCreatePasswordRemindersTable extends Migration
{
/**
* Table name.
*
* @var string
*/
protected $ta... |
Fix formatting and typo in docblock | <?php
namespace MikeVrind\Deployer\Controllers;
use Illuminate\Console\Command;
use MikeVrind\Deployer\Deployer;
class DeployCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'deployer:deploy';
/**
* The console command... | <?php
namespace MikeVrind\Deployer\Controllers;
use Illuminate\Console\Command;
use MikeVrind\Deployer\Deployer;
class DeployCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'deployer:deploy';
/**
* The console command descripti... |
Fix issues when response is 200 with no content. | import 'isomorphic-fetch'
import { call, select } from 'redux-saga/effects'
import { accessTokenSelector } from './selectors'
export function* fetchCredentials() {
const accessToken = yield select(accessTokenSelector)
if (accessToken) {
return {
token: {
access_token: accessToken,
},
}
... | import 'isomorphic-fetch'
import { call, select } from 'redux-saga/effects'
import { accessTokenSelector } from './selectors'
export function* fetchCredentials() {
const accessToken = yield select(accessTokenSelector)
if (accessToken) {
return {
token: {
access_token: accessToken,
},
}
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.