text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Revert escape nickname, desc, etc in user profile | # encoding: utf-8
from django import forms
from seahub.profile.models import Profile, DetailedProfile
class ProfileForm(forms.Form):
nickname = forms.CharField(max_length=64, required=False)
intro = forms.CharField(max_length=256, required=False)
def save(self, username):
nickname = self.cleaned_... | # encoding: utf-8
from django import forms
from django.utils.html import escape
from seahub.profile.models import Profile, DetailedProfile
class ProfileForm(forms.Form):
nickname = forms.CharField(max_length=64, required=False)
intro = forms.CharField(max_length=256, required=False)
def save(self, userna... |
Move short option tests into top level tests | var child = require('child_process');
var http = require('http');
var test = require('tape');
var fs = require('fs');
var path = require('path');
var url = require('url');
var version = [
'-V',
'--version',
];
version.forEach(function (arg) {
var args = ['bin/amok.js', arg];
test(args.join(' '), function (tes... | var child = require('child_process');
var http = require('http');
var test = require('tape');
var fs = require('fs');
var path = require('path');
var url = require('url');
test('bin print version', function (test) {
test.plan(4);
var options = [
'-V',
'--version'
];
options.forEach(function (option) {... |
Fix route for create version | var users = require('./controllers/usersController.js');
var recipes = require('./controllers/recipesController.js');
var branches = require('./controllers/branchesController.js');
var versions = require('./controllers/versionsController.js');
module.exports = function(app, express) {
// /*** Sign up / Sign in / Log... | var users = require('./controllers/usersController.js');
var recipes = require('./controllers/recipesController.js');
var branches = require('./controllers/branchesController.js');
var versions = require('./controllers/versionsController.js');
module.exports = function(app, express) {
// /*** Sign up / Sign in / Log... |
Modify script to allow warnings | var page = require('webpage').create()
page.onConsoleMessage = function(arg) {
var parts = arg.split('`')
var msg = parts[1] || '[LOG] ' + arg
console.log(color(msg, parts[0]))
if (msg === 'END') {
var result = page.evaluate(function() {
return result
})
if (result.error.count + result.fai... | var page = require('webpage').create()
page.onConsoleMessage = function(arg) {
var parts = arg.split('`')
var msg = parts[1] || '[LOG] ' + arg
console.log(color(msg, parts[0]))
if (msg === 'END') {
var result = page.evaluate(function() {
return result
})
if (result.error.count + result.fai... |
Fix config api class again | from ..cw_controller import CWController
# Class for /company/configurations
from . import configuration
class ConfigurationsAPI(CWController):
def __init__(self):
self.module_url = 'company'
self.module = 'configurations'
self._class = configuration.Configuration
super()... | from ..cw_controller import CWController
# Class for /company/configurations
from connectpyse.company import configuration
class ConfigurationsAPI(CWController):
def __init__(self):
self.module_url = 'company'
self.module = 'configurations'
self._class = configuration.Configuratio... |
Add service flag for NODE_NETWORK_LIMITED (BIP159) | <?php
function format_bytes( $size, $precision = 2 ) {
$base = log( $size, 1024 );
$suffixes = array( '', 'KB', 'MB', 'GB', 'TB' );
return round( pow( 1024, $base - floor( $base ) ), $precision ) .' '. $suffixes[ floor( $base ) ];
}
// https://stackoverflow.com/a/19680778
function seconds_to_time($second... | <?php
function format_bytes( $size, $precision = 2 ) {
$base = log( $size, 1024 );
$suffixes = array( '', 'KB', 'MB', 'GB', 'TB' );
return round( pow( 1024, $base - floor( $base ) ), $precision ) .' '. $suffixes[ floor( $base ) ];
}
// https://stackoverflow.com/a/19680778
function seconds_to_time($second... |
Make Serializer work with nest API
This fixes the root resource name to match what the API expects. | import DS from "ember-data";
import Ember from 'ember';
var dasherize = Ember.String.dasherize;
var pluralize = Ember.String.pluralize;
export default DS.RESTSerializer.extend({
normalize: function(type, hash, prop) {
var links = hash.links;
for (var key in links) {
var linkedData = links[key];
... | import DS from "ember-data";
import Ember from 'ember';
var singularize = Ember.String.singularize;
var camelize = Ember.String.camelize;
export default DS.RESTSerializer.extend({
normalize: function(type, hash, prop) {
var links = hash.links;
for (var key in links) {
var linkedData = links[key];
... |
Fix invalid column error in membership seeder | module.exports = {
up: (queryInterface) => {
return queryInterface.bulkInsert('Memberships',
[
{
memberId: '75b936c0-ba72-11e7-84e1-058ffffd96c5',
groupId: 'c46ebe90-bd68-11e7-922f-4d48c5331440',
userRole: 'admin',
createdAt: new Date(),
updatedAt: n... | module.exports = {
up: (queryInterface) => {
return queryInterface.bulkInsert('Memberships',
[
{
memberId: '75b936c0-ba72-11e7-84e1-058ffffd96c5',
groupId: 'c46ebe90-bd68-11e7-922f-4d48c5331440',
memberRole: 'admin',
createdAt: new Date(),
updatedAt:... |
Remove logging in overview data parser | 'use strict';
const D3 = require('D3');
exports.parser = function(rows) {
var overviewResponse = rows;
var overview = D3.nest()
.key(function(d) {
return d.region_code;
})
.rollup(function(v) {
return {
'region_code': v[0].region_code,
... | 'use strict';
const D3 = require('D3');
exports.parser = function(rows) {
var overviewResponse = rows;
var overview = D3.nest()
.key(function(d) {
return d.region_code;
})
.rollup(function(v) {
console.log(v)
return {
'region_code':... |
Revert modules update to file in app directory | import Ember from 'ember';
import ENV from '../config/environment';
const { computed, Service } = Ember;
function computedFromConfig(prop) {
return computed(function(){
return ENV['ember-modal-dialog'] && ENV['ember-modal-dialog'][prop];
});
}
export default Service.extend({
hasEmberTether: computedFromCon... | import { computed } from '@ember/object';
import Service from '@ember/service';
import ENV from '../config/environment';
function computedFromConfig(prop) {
return computed(function(){
return ENV['ember-modal-dialog'] && ENV['ember-modal-dialog'][prop];
});
}
export default Service.extend({
hasEmberTether: ... |
Add deprecated >= 1.2.0 to install_requires | from setuptools import setup
from os import path
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='gopay',
version='1.2.4',
long_description=long_description,
long_description_con... | from setuptools import setup
from os import path
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setup(
name='gopay',
version='1.2.4',
long_description=long_description,
long_description_con... |
Remove permission check on backend | var flash = require('connect-flash');
module.exports = function (app, security) {
var isAuthenticated = security.middleware.isAuthenticated({redirect:'/backend/login'});
var hasPermission = security.middleware.hasPermission;
// update install before requesting permissions
// hasPermission(['backend:... | var flash = require('connect-flash');
module.exports = function (app, security) {
var isAuthenticated = security.middleware.isAuthenticated({redirect:'/backend/login'});
var hasPermission = security.middleware.hasPermission;
app.get('/', [isAuthenticated, hasPermission(['backend:login'], {redirect:'/bac... |
Use the new notation for collections to get elements by key | <?php
use Galahad\LaravelAddressing\AdministrativeArea;
use Galahad\LaravelAddressing\Country;
/**
* Class CountryTest
*
* @author Junior Grossi <juniorgro@gmail.com>
*/
class CountryTest extends PHPUnit_Framework_TestCase
{
public function testFindByCodeAndName()
{
$country = new Country;
... | <?php
use Galahad\LaravelAddressing\AdministrativeArea;
use Galahad\LaravelAddressing\Country;
/**
* Class CountryTest
*
* @author Junior Grossi <juniorgro@gmail.com>
*/
class CountryTest extends PHPUnit_Framework_TestCase
{
public function testFindByCodeAndName()
{
$country = new Country;
... |
Mark unsigned hyper as unsigned | import Long from 'long';
import includeIoMixin from './io-mixin';
export class UnsignedHyper extends Long {
static read(io) {
let high = io.readInt32BE();
let low = io.readInt32BE();
return this.fromBits(low, high);
}
static write(value, io) {
if(!(value instanceof this)) {
throw new Err... | import Long from 'long';
import includeIoMixin from './io-mixin';
export class UnsignedHyper extends Long {
static read(io) {
let high = io.readInt32BE();
let low = io.readInt32BE();
return this.fromBits(low, high);
}
static write(value, io) {
if(!(value instanceof this)) {
throw new Err... |
Fix invalid properties for default value of argument | #!/usr/bin/env node
const ArgumentParser = require('argparse').ArgumentParser
const opn = require('opn')
const packageJson = require('../package.json')
const { createServer } = require('../lib/backend')
if (process.env.NODE_ENV === 'production') {
console.error(clc.red('Do not run this in production!'))
process.... | #!/usr/bin/env node
const ArgumentParser = require('argparse').ArgumentParser
const opn = require('opn')
const packageJson = require('../package.json')
const { createServer } = require('../lib/backend')
if (process.env.NODE_ENV === 'production') {
console.error(clc.red('Do not run this in production!'))
process.... |
tests: Increase timout of autofuzz @FuzzTest | // Copyright 2022 Code Intelligence 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 by applicable law or a... | // Copyright 2022 Code Intelligence 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 by applicable law or a... |
Add height is not absoulte note | var WebPage = require('webpage'),
System = require('system'),
address = System.args[1],
index = 0;
// All the sizes to screenshot.
// Note: PhantomJs uses the heights specified here as a min-height criteria
var screenshots = [
{"dimensions" : [970,300],
"filename": './screenshots/screenshot_l.png'},
... | var WebPage = require('webpage');
var System = require('system');
address = System.args[1];
var index = 0;
var screenshots = [
{"dimensions" : [975,500],
"filename": './screenshots/screenshot_l.png'},
{"dimensions" : [720,400],
"filename": './screenshots/screenshot_m.png'},
{"dimensions" : [400,200],
"file... |
Fix Message for PHP-FPM / PHP-FCGI | <?php
//-- unixman
ini_set('display_errors', '1'); // display runtime errors
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED); // error reporting
ini_set('html_errors', '0');
ini_set('log_errors', '1');
ini_set('error_log', 'data/logs/phperrors.log'); // record them to a log
ini_set('default_charset', 'U... | <?php
//-- unixman
ini_set('display_errors', '1'); // display runtime errors
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED); // error reporting
ini_set('html_errors', '0');
ini_set('log_errors', '1');
ini_set('error_log', 'data/logs/phperrors.log'); // record them to a log
ini_set('default_charset', 'U... |
Make the rotating direction go back and forth | (function (PIXI) {
'use strict';
var stage = new PIXI.Stage(0x66FF99);
var renderer = PIXI.autoDetectRenderer(400, 300);
document.body.appendChild(renderer.view);
window.requestAnimationFrame(animate);
var texture = PIXI.Texture.fromImage('bunny.png');
var bunny = new PIXI.Sprite(texture);
var direc... | (function (PIXI) {
'use strict';
var stage = new PIXI.Stage(0x66FF99);
var renderer = PIXI.autoDetectRenderer(400, 300);
document.body.appendChild(renderer.view);
window.requestAnimationFrame(animate);
var texture = PIXI.Texture.fromImage('bunny.png');
var bunny = new PIXI.Sprite(texture);
bunny.anc... |
Fix bug left over from the namespacing | from django.db.models import Q
from django.core.urlresolvers import reverse
class TeamDefaultHookset(object):
def build_team_url(self, url_name, team_slug):
return reverse(url_name, args=[team_slug])
def get_autocomplete_result(self, user):
return {"pk": user.pk, "email": user.email, "name"... | from django.db.models import Q
from django.core.urlresolvers import reverse
class TeamDefaultHookset(object):
def build_team_url(self, url_name, team_slug):
return reverse(url_name, args=[team_slug])
def get_autocomplete_result(self, user):
return {"pk": user.pk, "email": user.email, "name"... |
Support loose option on readFile | 'use strict';
var compact = require('es5-ext/array/#/compact')
, callable = require('es5-ext/object/valid-callable')
, path = require('path')
, common = require('path2/common')
, defaultReadFile = require('fs2/read-file')
, dirname = path.dirname, resolve = path.resolve;
... | 'use strict';
var callable = require('es5-ext/object/valid-callable')
, path = require('path')
, common = require('path2/common')
, defaultReadFile = require('fs2/read-file')
, dirname = path.dirname, resolve = path.resolve;
module.exports = function (indexPath/*, options */) {
va... |
Change to cb_story, clean up TZ handling some more | """
Add a 'w3cdate' key to every entry -- this contains the date in ISO8601 format
WARNING: you must have PyXML installed as part of your python installation
in order for this plugin to work
Place this plugin early in your load_plugins list, so that the w3cdate will
be available to subsequent plugins
"""
__author__ ... | """
Add a 'w3cdate' key to every entry -- this contains the date in ISO8601 format
WARNING: you must have PyXML installed as part of your python installation
in order for this plugin to work
Place this plugin early in your load_plugins list, so that the w3cdate will
be available to subsequent plugins
"""
__author__ ... |
Fix update on fake slot | package openmods.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class FakeSlot extends Slot implements ICustomSlot {
private final boolean keepSize;
public FakeSlot(IInventory i... | package openmods.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class FakeSlot extends Slot implements ICustomSlot {
private final boolean keepSize;
public FakeSlot(IInventory i... |
Convert main to a verticle | package net.trajano.ms.engine.sample;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.Vertx;
import io.vertx.core.VertxOptions;
import io.vertx.core.http.HttpServer;
import io.vertx.ext.web.Router;
import net.trajano.ms.engine.JaxRsRoute;
public class Main extends AbstractVerticle {
public static voi... | package net.trajano.ms.engine.sample;
import io.vertx.core.Vertx;
import io.vertx.core.VertxOptions;
import io.vertx.core.http.HttpServer;
import io.vertx.ext.web.Router;
import net.trajano.ms.engine.JaxRsRoute;
public class Main {
public static void main(final String[] args) {
final VertxOptions option... |
Tweak artisan command output lines | <?php
declare(strict_types=1);
namespace Cortex\Fort\Console\Commands;
use Illuminate\Console\Command;
class InstallCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'cortex:install:fort';
/**
* The console ... | <?php
declare(strict_types=1);
namespace Cortex\Fort\Console\Commands;
use Illuminate\Console\Command;
class InstallCommand extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'cortex:install:fort';
/**
* The console ... |
Update packaging script to include uninstall.php file. | /**
* External dependencies
*/
import gulp from 'gulp';
import del from 'del';
gulp.task( 'copy', () => {
del.sync( [ './release/**/*' ] );
gulp.src(
[
'readme.txt',
'google-site-kit.php',
'uninstall.php',
'dist/*.js',
'dist/assets/**/*',
'bin/**/*',
'includes/**/*',
'third-party/**/*',
... | /**
* External dependencies
*/
import gulp from 'gulp';
import del from 'del';
gulp.task( 'copy', () => {
del.sync( [ './release/**/*' ] );
gulp.src(
[
'readme.txt',
'google-site-kit.php',
'dist/*.js',
'dist/assets/**/*',
'bin/**/*',
'includes/**/*',
'third-party/**/*',
'!third-party/**/... |
Refactor template assignment of top menu + isFileWritable() | <?php
/**
* Piwik - Open source web analytics
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
* @category Piwik_Plugins
* @package Piwik_SecurityInfo
*/
/**
* @package Piwik_SecurityInfo
*/
class Piwik_SecurityInfo_Controller extends Piwik_Controller_Admin
{
... | <?php
/**
* Piwik - Open source web analytics
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
* @category Piwik_Plugins
* @package Piwik_SecurityInfo
*/
/**
* @package Piwik_SecurityInfo
*/
class Piwik_SecurityInfo_Controller extends Piwik_Controller_Admin
{
... |
Check that notification onclick is a function before calling | const { ipcRenderer } = require('electron');
const uuidV1 = require('uuid/v1');
class Notification {
static permission = 'granted';
constructor(title = '', options = {}) {
this.title = title;
this.options = options;
this.notificationId = uuidV1();
ipcRenderer.sendToHost('notification', this.onNot... | const { ipcRenderer } = require('electron');
const uuidV1 = require('uuid/v1');
class Notification {
static permission = 'granted';
constructor(title = '', options = {}) {
this.title = title;
this.options = options;
this.notificationId = uuidV1();
ipcRenderer.sendToHost('notification', this.onNot... |
Fix inclusion of server hook to use proper relative path | #!/usr/bin/env node
// Modules
var connect = require('connect'),
fs = require('fs'),
http = require('http'),
path = require('path'),
serveStatic = require('serve-static'),
serveIndex = require('serve-index');
// Variables
var app = connect(),
hookFile = 'web-server-hook.js';
function main(por... | #!/usr/bin/env node
// Modules
var connect = require('connect'),
fs = require('fs'),
http = require('http'),
path = require('path'),
serveStatic = require('serve-static'),
serveIndex = require('serve-index');
// Variables
var app = connect(),
hookFile = 'web-server-hook.js';
function main(por... |
Set y-axis min to 0 | boilerplate = {
'chart': {
'renderTo': 'container',
'plotBackgroundColor': 'none',
'backgroundColor': 'none',
'spacingTop': 5
},
'title': {'text': None},
'subtitle': {'text': None},
'yAxis': {
'min': 0,
'title':{
'text': None
},
... | boilerplate = {
'chart': {
'renderTo': 'container',
'plotBackgroundColor': 'none',
'backgroundColor': 'none',
'spacingTop': 5
},
'title': {'text': None},
'subtitle': {'text': None},
'yAxis': {
'title':{
'text': None
},
'gridLineColo... |
Make remove first array element logic less complex than it needs to be | <?php
function backTrace($backtrace)
{
require_once 'plugins/sourcetag/geshi.php';
foreach ($backtrace as $bt) {
$args = '';
foreach ($bt['args'] as $a) {
if ($args) {
$args .= ', ';
}
if (in_array(strtolower($bt['function']), array('rawquery', 'query', 'fetchresult')) && !$args)
if (is_array($... | <?php
function var_export_callback($object) {
return var_export($object, true);
}
function backTrace($backtrace)
{
require_once 'plugins/sourcetag/geshi.php';
foreach ($backtrace as $bt) {
$args = '';
foreach ($bt['args'] as $a) {
if ($args) {
$args .= ', ';
}
if (in_array(strtolower($bt['functio... |
Add an 'ANY' object type | package object
type Type string
const (
/* Internal Types */
RETURN_VALUE Type = "<return value>"
FUNCTION Type = "<function>"
NEXT Type = "<next>"
BREAK Type = "<break>"
APL_BLOCK Type = "<applied block>"
/* Special Types */
COLLECTION Type = "<collection>"
CONTAINER Type = "<contain... | package object
type Type string
const (
/* Internal Types */
RETURN_VALUE Type = "<return value>"
FUNCTION Type = "<function>"
NEXT Type = "<next>"
BREAK Type = "<break>"
APL_BLOCK Type = "<applied block>"
/* Special Types */
COLLECTION Type = "<collection>"
CONTAINER Type = "<contain... |
hack: Print date in fr_CA locale | # -*- encoding:utf-8 -*-
# Template tag
from django.template.defaultfilters import stringfilter
from datetime import datetime, timedelta
from django import template
import locale
register = template.Library()
@register.filter
def event_time(start, end):
today = datetime.today ()
result = ""
# Hack! get t... | # -*- encoding:utf-8 -*-
# Template tag
from django.template.defaultfilters import stringfilter
from datetime import datetime, timedelta
from django import template
register = template.Library()
@register.filter
def event_time(start, end):
today = datetime.today ()
result = ""
if start == today:
... |
Fix test missing the container element | $(document).ready(function() {
module("Canvas presentations");
test("Check Canvas Presentations", function() {
expect(1);
ok(MITHGrid.Presentation.RaphSVG !== undefined, "RaphSVG Presentation exists");
});
test("Check Canvas availability", function() {
var presentation;
expect(3);
try {
pres... | $(document).ready(function() {
module("Canvas presentations");
test("Check Canvas Presentations", function() {
expect(1);
ok(MITHGrid.Presentation.RaphSVG !== undefined, "RaphSVG Presentation exists");
//ok(MITHGrid.Presentation.SVGRect !== undefined, "SVGRect Presentation exists");
});
test("Check C... |
Set standard iri for literal. | package de.uni_stuttgart.vis.vowl.owl2vowl.model.nodes.datatypes;
import de.uni_stuttgart.vis.vowl.owl2vowl.constants.Node_Types;
import de.uni_stuttgart.vis.vowl.owl2vowl.constants.Standard_Iris;
import de.uni_stuttgart.vis.vowl.owl2vowl.constants.Vowl_Lang;
import de.uni_stuttgart.vis.vowl.owl2vowl.export.JsonGenera... | package de.uni_stuttgart.vis.vowl.owl2vowl.model.nodes.datatypes;
import de.uni_stuttgart.vis.vowl.owl2vowl.constants.Node_Types;
import de.uni_stuttgart.vis.vowl.owl2vowl.constants.Vowl_Lang;
import de.uni_stuttgart.vis.vowl.owl2vowl.export.JsonGeneratorVisitor;
public class RdfsLiteral extends BaseDatatype {
publ... |
Fix issue where 24h format needed additional configuration for the plugin | $(document).on('ajaxComplete ready', function () {
// Initialize inputs
$('input[data-provides="anomaly.field_type.datetime"]:not([data-initialized])').each(function () {
var $this = $(this);
var inputMode = $this.data('input-mode');
var options = {
altInput: true,
... | $(document).on('ajaxComplete ready', function () {
// Initialize inputs
$('input[data-provides="anomaly.field_type.datetime"]:not([data-initialized])').each(function () {
var $this = $(this);
var inputMode = $this.data('input-mode');
var options = {
altInput: true,
... |
Fix errors revealed by tests | <?php
namespace TheCrypticAce\Suitey\Steps;
use Closure;
use TheCrypticAce\Suitey\IO;
use TheCrypticAce\Suitey\Process;
class Migrate implements Step
{
public function __construct($database = null, $path = null)
{
$this->path = $path;
$this->database = $database;
}
public function na... | <?php
namespace TheCrypticAce\Suitey\Steps;
use Closure;
use TheCrypticAce\Suitey\IO;
use TheCrypticAce\Suitey\Process;
class Migrate implements Step
{
public function __construct($database = null, $path = null)
{
$this->path = $path;
$this->database = $database;
}
public function na... |
Test work of API communication | (function () {
'use strict';
angular
.module('scrum_retroboard')
.controller('UserController', ['$scope', '$http', 'sessionService', 'userService', UserController]);
function UserController($scope, $http, sessionService, userService) {
var userVm = this;
//scope models
... | (function () {
'use strict';
angular
.module('scrum_retroboard')
.controller('UserController', ['$scope', '$http', 'sessionService', 'userService', UserController]);
function UserController($scope, $http, sessionService, userService) {
var userVm = this;
//scope models
... |
Resolve path names relatives to cwd when using via CLI | #!/usr/bin/env node
var path = require('path')
var express = require('express')
var app = express()
var dafuq = require('./')
var argv = require('yargs')
.usage('$0 Leverages command-based api')
.describe('commands', 'the path to commands directory')
.alias('commands', 'c')
.alias('commands', 'path')
... | #!/usr/bin/env node
var express = require('express')
var app = express()
var dafuq = require('./')
var argv = require('yargs')
.usage('$0 Leverages command-based api')
.describe('commands', 'the path to commands directory')
.alias('commands', 'c')
.alias('commands', 'path')
.alias('commands', 'directo... |
Add new work time value - 3/8 | // User roles
app.constant('USER_ROLES', {
all: ['ROLES_ADMIN', 'ROLES_LEADER', 'ROLES_WORKER'],
admin: 'ROLES_ADMIN',
worker: 'ROLES_WORKER',
leader: 'ROLES_LEADER'
});
// Authentication events
app.constant('AUTH_EVENTS', {
loginSuccess: 'auth-login-success',
badRequest: 'auth-bad-request',
... | // User roles
app.constant('USER_ROLES', {
all: ['ROLES_ADMIN', 'ROLES_LEADER', 'ROLES_WORKER'],
admin: 'ROLES_ADMIN',
worker: 'ROLES_WORKER',
leader: 'ROLES_LEADER'
});
// Authentication events
app.constant('AUTH_EVENTS', {
loginSuccess: 'auth-login-success',
badRequest: 'auth-bad-request',
... |
Add the company to the main controller | <?php
namespace frontend\controllers;
use Yii;
use yii\web\Controller;
use common\models\Company;
class MainController extends Controller
{
private $company;
public function init()
{
parent::init();
// Set the language
if (isset($_GET['lang'])) {
\Yii::$ap... | <?php
namespace frontend\controllers;
use Yii;
use yii\web\Controller;
class MainController extends Controller
{
public function init()
{
parent::init();
// Set the language
if (isset($_GET['lang'])) {
\Yii::$app->language = $_GET['lang'];
\Yii::$app->... |
Add back operators_in_feed from feedinfo response | import Ember from 'ember';
export default Ember.Route.extend({
createFeedFromGtfsService: Ember.inject.service('create-feed-from-gtfs'),
beforeModel: function(transition) {
var controller = this;
var feedModel = this.get('createFeedFromGtfsService').feedModel;
var url = feedModel.get('url');
var ad... | import Ember from 'ember';
export default Ember.Route.extend({
createFeedFromGtfsService: Ember.inject.service('create-feed-from-gtfs'),
beforeModel: function(transition) {
var controller = this;
var feedModel = this.get('createFeedFromGtfsService').feedModel;
var url = feedModel.get('url');
var ad... |
Use raw strings for regexp URLs. |
from django.conf.urls.defaults import patterns, url
from django.views.generic import ListView
from review import views
from extensions.models import ExtensionVersion, STATUS_LOCKED
urlpatterns = patterns('',
url(r'^$', ListView.as_view(queryset=ExtensionVersion.objects.filter(status=STATUS_LOCKED),
... |
from django.conf.urls.defaults import patterns, url
from django.views.generic import ListView
from review import views
from extensions.models import ExtensionVersion, STATUS_LOCKED
urlpatterns = patterns('',
url(r'^$', ListView.as_view(queryset=ExtensionVersion.objects.filter(status=STATUS_LOCKED),
... |
FIX public attribute issue while creating defect | <?php
namespace Solidifier\Visitors\Property;
use Solidifier\Visitors\AbstractClassVisitor;
use PhpParser\Node;
use PhpParser\Node\Stmt\Property;
class PublicAttributes extends AbstractClassVisitor
{
public function enterNode(Node $node)
{
parent::enterNode($node);
if($node instanceo... | <?php
namespace Solidifier\Visitors\Property;
use Solidifier\Visitors\AbstractClassVisitor;
use PhpParser\Node;
use PhpParser\Node\Stmt\Property;
class PublicAttributes extends AbstractClassVisitor
{
public function enterNode(Node $node)
{
parent::enterNode($node);
if($node instanceo... |
Fix uploader when there is nothing to upload | #!/usr/bin/env python
# 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/.
import glob
import os
import requests
import stoneridge
class StoneRidgeUploader(object):
""... | #!/usr/bin/env python
# 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/.
import glob
import os
import requests
import stoneridge
class StoneRidgeUploader(object):
""... |
Revise doc string with highlighting "weighted" graph | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
def dijkstra(weighted_graph_d, start_vertex):
"""Dijkstra algorithm for "weighted" graph.
Finds shortest path in a weighted graph from a particular node
to all vertices that are reachable from it... | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
def dijkstra(weighted_graph_d, start_vertex):
"""Dijkstra algorithm for weighted graph.
Finds shortest path in a weighted graph from a particular node
to all vertices that are reachable from it.
... |
Add clone function, required by chunk. | function d3_treemap_rect(x, y, width, height) {
var rect = {};
rect.clone = function() {
return d3_treemap_rect(x, y, width, height);
}
rect.x = function(_) {
if (!arguments.length) return x;
x = _;
return rect;
};
rect.y = function(_) {
if (!arguments.length) ... | function d3_treemap_rect(x, y, width, height) {
var rect = {};
rect.x = function(_) {
if (!arguments.length) return x;
x = _;
return rect;
};
rect.y = function(_) {
if (!arguments.length) return y;
y = _;
return rect;
};
rect.width = function(_) {
i... |
Fix formatting of config errors. | package com.yammer.dropwizard.config;
import java.io.File;
/**
* An exception thrown where there is an error parsing a configuration object.
*/
public class ConfigurationException extends Exception {
private static final long serialVersionUID = 5325162099634227047L;
/**
* Creates a new {@link Configur... | package com.yammer.dropwizard.config;
import java.io.File;
/**
* An exception thrown where there is an error parsing a configuration object.
*/
public class ConfigurationException extends Exception {
private static final long serialVersionUID = 5325162099634227047L;
/**
* Creates a new {@link Configur... |
Add javadoc for authentication utility | package util;
import com.google.appengine.api.users.User;
import com.google.appengine.api.users.UserService;
import com.google.appengine.api.users.UserServiceFactory;
public class UserAuthUtil {
/**
* Returns a boolean for the user's login status
* @return user login status
*/
public static boolean isUse... | package util;
import com.google.appengine.api.users.User;
import com.google.appengine.api.users.UserService;
import com.google.appengine.api.users.UserServiceFactory;
public class UserAuthUtil {
/**
* Returns a boolean for the user's login status
* @return user login status
*/
public static boolean isUse... |
[TaxationBundle] Add event subscriber AddCodeFormSubscriber to TaxRateType and TaxCategoryType
[TaxationBundle] Add validation for filed 'code' from TaxRate and TaxCategory
[Taxation] Add field 'code' to TaxCategory and TaxRate, TaxCategoryInterface and TaxRateInterface extend AwareCodeInterface
[WebBundle] Add code f... | <?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Component\Shipping\Model;
use Sylius\Component\Resource\Model\ResourceInterface;
use... | <?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Component\Shipping\Model;
use Sylius\Component\Resource\Model\ResourceInterface;
us... |
FIX: Set REQUEST_URI to go back to page requested before logging in | <?php
namespace phorkie;
/**
* security levels + login requirement:
*/
if (!isset($GLOBALS['phorkie']['auth']['secure'])) {
//not set? highest level of security
$GLOBALS['phorkie']['auth']['secure'] = 2;
}
if ($GLOBALS['phorkie']['auth']['secure'] == 0) {
//everyone may do everything
return;
}
$log... | <?php
namespace phorkie;
/**
* security levels + login requirement:
*/
if (!isset($GLOBALS['phorkie']['auth']['secure'])) {
//not set? highest level of security
$GLOBALS['phorkie']['auth']['secure'] = 2;
}
if ($GLOBALS['phorkie']['auth']['secure'] == 0) {
//everyone may do everything
return;
}
$log... |
Improve the way that import middlewares | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from flask import Flask
from werkzeug.utils import import_string
from me_api.middleware.me import me
from me_api.cache import cache
middlewares = {
'douban': 'me_api.middleware.douban:douban_api',
'githu... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from flask import Flask
from .middleware.me import me
from .cache import cache
def _register_module(app, module):
if module == 'douban':
from .middleware import douban
app.register_blueprint(... |
Change font of ASCII to Courier | import tkinter as tk
from time import sleep
from movie01 import reel
window = tk.Tk()
def main():
window.title("Tkinter Movie Player")
button = tk.Button(window, text = "Play", command = processPlay)
button.pack()
window.mainloop()
def processPlay():
TIME_STEP = 0.3
label =... | import tkinter as tk
from time import sleep
from movie01 import reel
window = tk.Tk()
def main():
window.title("Tkinter Movie Player")
button = tk.Button(window, text = "Play", command = processPlay)
button.pack()
window.mainloop()
def processPlay():
TIME_STEP = 0.3
label =... |
Create form: prevent refresh, clean forms after enter. | var createBetNotification = function(bet){
var bet = Bets.findOne({ _id: bet });
BetNotifications.insert({
toNotify: bet.bettors[1],
betBy: bet.bettors[0]
});
}
Template.createBetForm.events({
"submit .create-bet" : function(event){
event.preventDefault();
var status = "open",
title =... | var createBetNotification = function(bet){
var bet = Bets.findOne({ _id: bet });
BetNotifications.insert({
toNotify: bet.bettors[1],
betBy: bet.bettors[0]
});
}
Template.createBetForm.events({
"submit .create-bet" : function(event){
var status = "open",
title = event.target.betTitle.value;... |
Modify createdAt and updatedAt field type to dateonly | 'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
queryInterface.createTable('Documents', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
title: {
type: Sequelize.STRING
},
access... | 'use strict';
module.exports = {
up: (queryInterface, Sequelize) => {
queryInterface.createTable('Documents', {
id: {
allowNull: false,
autoIncrement: true,
primaryKey: true,
type: Sequelize.INTEGER
},
title: {
type: Sequelize.STRING
},
access... |
Fix bug issue in Settings Ctrl | (function() {
var SettingsCtrl = function($scope, $ionicModal, Auth) {
var vm = this
$ionicModal
.fromTemplateUrl("js/modules/tabs/settings/views/login.html", {
scope: $scope,
animation: "slide-in-up"
})
.then(function(modal) {
vm.loginModal = modal;
})
... | (function() {
var SettingsCtrl = function($scope, $ionicModal, Auth) {
var vm = this
$ionicModal
.fromTemplateUrl("js/modules/tabs/settings/views/login.html", {
scope: $scope,
animation: "slide-in-up"
})
.then(function(modal) {
vm.loginModal = modal;
})
... |
Test all the code paths | import unittest
import cbs
class AttrSettings():
PROJECT_NAME = 'fancy_project'
class MethodSettings():
def PROJECT_NAME(self):
return 'fancy_project'
class TestApply(unittest.TestCase):
def test_apply_settings_attr(self):
g = {}
cbs.apply(AttrSettings, g)
self.assert... | import unittest
import cbs
class AttrSettings():
PROJECT_NAME = 'fancy_project'
class MethodSettings():
def PROJECT_NAME(self):
return 'fancy_project'
class TestApply(unittest.TestCase):
def test_apply_settings_attr(self):
g = {}
cbs.apply(AttrSettings, g)
self.assert... |
Access the base file in the JAR. | package com.github.googlei18n.tachyfont;
import java.io.IOException;
import java.io.InputStream;
import java.util.Enumeration;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import javax.servlet.http.*;
@SuppressWarnings("serial")
public class TachyFontServlet extends HttpServlet {
@Override
public... | package com.github.googlei18n.tachyfont;
import java.io.IOException;
import java.util.Enumeration;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import javax.servlet.http.*;
@SuppressWarnings("serial")
public class TachyFontServlet extends HttpServlet {
@Override
public void doGet(HttpServletReque... |
Improve test by removing a hard coded value
Small things make life sweet. | var common = require('../../common');
var connection = common.createConnection();
var assert = require('assert');
common.useTestDb(connection);
var table = 'stream_test';
connection.query([
'CREATE TEMPORARY TABLE `' + table + '` (',
'`id` int(11) unsigned NOT NULL AUTO_INCREMENT,',
'`title` varchar(255... | var common = require('../../common');
var connection = common.createConnection();
var assert = require('assert');
common.useTestDb(connection);
var table = 'stream_test';
connection.query([
'CREATE TEMPORARY TABLE `' + table + '` (',
'`id` int(11) unsigned NOT NULL AUTO_INCREMENT,',
'`title` varchar(255... |
Stop event propagation in form-selector | "use strict";
annotationApp.directive('formSelector', function() {
return {
restrict: 'E',
replace: true,
controller: function($scope, $element, $attrs) {
var id = $scope.id;
var form = $scope.form;
$scope.text = 'Select';
$scope.action = function(event) {
event.stopPropag... | "use strict";
annotationApp.directive('formSelector', function() {
return {
restrict: 'E',
replace: true,
controller: function($scope, $element, $attrs) {
var id = $scope.id;
var form = $scope.form;
$scope.text = 'Select';
$scope.action = function() {
if ($scope.plugin.isF... |
Revert "Update CORS provider, again..."
This reverts commit cdd91c9eca4ea4675296e96c8ede6c8f8d7a3236. | $(document).ready(function() {
var menuUrl = "https://www.bin4burgerlounge.com/our-downtown-menu/";
$.ajax({
url: "https://cors-anywhere.herokuapp.com/" + menuUrl,
dataType: "html",
crossDomain: true,
success: writeData
});
function writeData(data, textStatus, jqXHR) {
... | $(document).ready(function() {
var menuUrl = "https://www.bin4burgerlounge.com/our-downtown-menu/";
$.ajax({
url: "http://www.corsmirror.com/v1/cors?url=" + menuUrl,
dataType: "html",
crossDomain: true,
success: writeData
});
function writeData(data, textStatus, jqXHR) ... |
Check PHP Version before everything | <?php
// Check for required PHP version
if (version_compare(PHP_VERSION, '5.6.0', '<'))
{
exit(sprintf('This app requires PHP 5.6 or higher. Your PHP version is: %s.', PHP_VERSION));
}
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', true);
// Import external libraries.
if (file_exists('./vendor/a... | <?php
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', true);
// Check for required PHP version
if (version_compare(PHP_VERSION, '5.6.0', '<'))
{
exit(sprintf('This app requires PHP 5.6 or higher. Your PHP version is: %s.', PHP_VERSION));
}
// Import external libraries.
if (file_exists('./vendor/... |
Change the rules for infix coordinario | __author__ = 's7a'
# All imports
from nltk.tree import Tree
# The infix coordination class
class InfixCoordination:
# Constructor for the infix coordination
def __init__(self):
self.has_infix_coordination = False
# Break the tree
def break_tree(self, tree):
self.has_infix_coordinati... | __author__ = 's7a'
# All imports
from nltk.tree import Tree
# The infix coordination class
class InfixCoordination:
# Constructor for the infix coordination
def __init__(self):
self.has_infix_coordination = False
self.result_string = ""
# Break the tree
def break_tree(self, tree):
... |
Replace solve with solveset in sympy.calculus | from sympy.solvers import solve
from sympy.solvers.solveset import solveset
from sympy.simplify import simplify
def singularities(expr, sym):
"""
Finds singularities for a function.
Currently supported functions are:
- univariate real rational functions
Examples
========
>>> from sympy.c... | from sympy.solvers import solve
from sympy.simplify import simplify
def singularities(expr, sym):
"""
Finds singularities for a function.
Currently supported functions are:
- univariate real rational functions
Examples
========
>>> from sympy.calculus.singularities import singularities
... |
Allow to run out of browser | import Component from 'substance/ui/Component'
import emojione from 'emojione'
// Consistent with making everying served locally (for offline use etc)...
if (typeof window !== 'undefined') {
emojione.imagePathPNG = (window.stencila.root || '/web') + '/emojione/png/'
}
class EmojiComponent extends Component {
did... | import Component from 'substance/ui/Component'
import emojione from 'emojione'
// Consistent with making everying served locally (for offline use etc)...
emojione.imagePathPNG = (window.stencila.root || '/web') + '/emojione/png/'
class EmojiComponent extends Component {
didMount () {
this.props.node.on('name:c... |
:art: Move tooltip to only show on hovering info-icon | 'use babel'
import {React} from 'react-for-atom'
export default React.createClass({
propTypes: {
readyCount: React.PropTypes.number,
totalCount: React.PropTypes.number
},
render () {
if (isNaN(this.props.readyCount) || isNaN(this.props.totalCount)) {
return <span />
} else {
return... | 'use babel'
import {React} from 'react-for-atom'
export default React.createClass({
propTypes: {
readyCount: React.PropTypes.number,
totalCount: React.PropTypes.number
},
render () {
if (isNaN(this.props.readyCount) || isNaN(this.props.totalCount)) {
return <span />
} else {
return... |
Add the option to enable debug mode with Heroku
Don't do this public servers, use it locally with foreman. | #!/usr/bin/env python
from evesrp import create_app
from evesrp.killmail import CRESTMail, ShipURLMixin
import evesrp.auth.testauth
from flask.ext.heroku import Heroku
from os import environ as env
from binascii import unhexlify
skel_url = 'https://wiki.eveonline.com/en/wiki/{name}'
class EOWikiCREST(CRESTMail, Ship... | #!/usr/bin/env python
from evesrp import create_app
from evesrp.killmail import CRESTMail, ShipURLMixin
import evesrp.auth.testauth
from flask.ext.heroku import Heroku
from os import environ as env
from binascii import unhexlify
skel_url = 'https://wiki.eveonline.com/en/wiki/{name}'
class EOWikiCREST(CRESTMail, Ship... |
Include contrib module in installed package
See https://github.com/yola/yolacom/pull/1775#issuecomment-76513787 | from setuptools import find_packages, setup
import proxyprefix
setup(
name='proxyprefix',
version=proxyprefix.__version__,
description='Prefix SCRIPT_NAME with X-Forwarded-Prefix header',
long_description=proxyprefix.__doc__,
author='Yola',
author_email='engineers@yola.com',
license='MIT ... | from setuptools import setup
import proxyprefix
setup(
name='proxyprefix',
version=proxyprefix.__version__,
description='Prefix SCRIPT_NAME with X-Forwarded-Prefix header',
long_description=proxyprefix.__doc__,
author='Yola',
author_email='engineers@yola.com',
license='MIT (Expat)',
u... |
Fix reference error due to missing comma | 'use strict';
/**
* Main AngularJS Entry Point.
*
* @author Mohamed Mansour 2015 (http://mohamedmansour.com)
*/
var App = angular
.module('personalDataDashboardApp', [
'ui.router',
'ngAnimate',
'ngMaterial'
])
.run(['$rootScope', '$state', '$stateParams', '$location', function (... | 'use strict';
/**
* Main AngularJS Entry Point.
*
* @author Mohamed Mansour 2015 (http://mohamedmansour.com)
*/
var App = angular
.module('personalDataDashboardApp', [
'ui.router',
'ngAnimate'
'ngMaterial'
])
.run(['$rootScope', '$state', '$stateParams', '$location', function ($... |
Swap out link with unread: 0 on download | $(function () {
var all = $("#select_all");
var none = $("#select_none");
var checkboxes = $(":checkbox");
all.css('cursor', 'pointer');
none.css('cursor', 'pointer');
all.click( function() { checkboxes.prop('checked', true); });
none.click( function() { checkboxes.prop('checked', false); });
$("#del... | $(function () {
var all = $("#select_all");
var none = $("#select_none");
var checkboxes = $(":checkbox");
all.css('cursor', 'pointer');
none.css('cursor', 'pointer');
all.click( function() { checkboxes.prop('checked', true); });
none.click( function() { checkboxes.prop('checked', false); });
$("#del... |
Add fake HTTP_CLIENT_IP for command line use | <?php
// This is global bootstrap for autoloading
namespace Grav;
use Codeception\Util\Fixtures;
use Faker\Factory;
// Ensure vendor libraries exist
$autoload = __DIR__ . '/../vendor/autoload.php';
if (!is_file($autoload)) {
throw new \RuntimeException("Please run: <i>bin/grav install</i>");
}
use Grav\Common\... | <?php
// This is global bootstrap for autoloading
namespace Grav;
use Codeception\Util\Fixtures;
use Faker\Factory;
// Ensure vendor libraries exist
$autoload = __DIR__ . '/../vendor/autoload.php';
if (!is_file($autoload)) {
throw new \RuntimeException("Please run: <i>bin/grav install</i>");
}
use Grav\Common\... |
tests: Fix typo in mock usage
The error was made evident by a newer mock version that no longer
swallowed the wrong assert as regular use of a spec-less mock. | from __future__ import absolute_import, unicode_literals
from mock import patch
from tests.mpd import protocol
class ConnectionHandlerTest(protocol.BaseTestCase):
def test_close_closes_the_client_connection(self):
with patch.object(self.session, 'close') as close_mock:
self.send_request('clo... | from __future__ import absolute_import, unicode_literals
from mock import patch
from tests.mpd import protocol
class ConnectionHandlerTest(protocol.BaseTestCase):
def test_close_closes_the_client_connection(self):
with patch.object(self.session, 'close') as close_mock:
self.send_request('clo... |
Revert "Add compile_to_json invocation in Myrial test fixture"
This reverts commit ceb848021d5323b5bad8518ac7ed850a51fc89ca. |
import collections
import math
import unittest
import raco.fakedb
import raco.myrial.interpreter as interpreter
import raco.myrial.parser as parser
class MyrialTestCase(unittest.TestCase):
def setUp(self):
self.db = raco.fakedb.FakeDatabase()
self.parser = parser.Parser()
self.processor ... |
import collections
import math
import unittest
import raco.fakedb
import raco.myrial.interpreter as interpreter
import raco.myrial.parser as parser
from raco.myrialang import compile_to_json
class MyrialTestCase(unittest.TestCase):
def setUp(self):
self.db = raco.fakedb.FakeDatabase()
self.parse... |
Print more statistics on exit | package cz.cuni.mff.d3s.spl.example.newton.checker;
import cz.cuni.mff.d3s.spl.core.data.SerieDataSource;
import cz.cuni.mff.d3s.spl.core.data.Statistics;
import cz.cuni.mff.d3s.spl.core.data.instrumentation.InstrumentingDataSource;
import cz.cuni.mff.d3s.spl.core.formula.Formula;
import cz.cuni.mff.d3s.spl.core.formu... | package cz.cuni.mff.d3s.spl.example.newton.checker;
import cz.cuni.mff.d3s.spl.core.data.SerieDataSource;
import cz.cuni.mff.d3s.spl.core.data.instrumentation.InstrumentingDataSource;
import cz.cuni.mff.d3s.spl.core.formula.Formula;
import cz.cuni.mff.d3s.spl.core.formula.Result;
import cz.cuni.mff.d3s.spl.core.formul... |
[binance] Include timestamp in balance requests | package org.knowm.xchange.binance.dto.account;
import java.math.BigDecimal;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
public final class BinanceAccountInformation {
public final BigDecimal makerCommission;
public final BigDecimal takerCommission;
public final BigDecimal buye... | package org.knowm.xchange.binance.dto.account;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.math.BigDecimal;
import java.util.List;
public final class BinanceAccountInformation {
public final BigDecimal makerCommission;
public final BigDecimal takerCommission;
public final BigDecimal buyer... |
Change the parsing doc comments algorithm to show full method documentation but not just the first string | <?php
/**
* Created by PhpStorm.
* User: alex
* Date: 20/10/2016
* Time: 23:36
*/
namespace vr\api\doc\components;
use yii\base\BaseObject;
/**
* Class DocCommentParser
* @package vr\api\doc\components
* @property string $description
*/
class DocCommentParser extends BaseObject
{
/**
* @var
*/... | <?php
/**
* Created by PhpStorm.
* User: alex
* Date: 20/10/2016
* Time: 23:36
*/
namespace vr\api\doc\components;
use yii\base\BaseObject;
/**
* Class DocCommentParser
* @package vr\api\doc\components
* @property string $description
*/
class DocCommentParser extends BaseObject
{
/**
* @var
*/... |
Change default Freenode server URL to recommended one | module.exports = {
public: false,
host: "0.0.0.0",
port: 9000,
bind: undefined,
theme: "themes/{{ shout_theme }}.css",
autoload: true,
prefetch: false,
displayNetwork: true,
logs: {
format: "YYYY-MM-DD HH:mm:ss",
timezone: "UTC+00:00"
},
defaults: {
name: "Freenode",
host: "chat.freenode.net",
port... | module.exports = {
public: false,
host: "0.0.0.0",
port: 9000,
bind: undefined,
theme: "themes/{{ shout_theme }}.css",
autoload: true,
prefetch: false,
displayNetwork: true,
logs: {
format: "YYYY-MM-DD HH:mm:ss",
timezone: "UTC+00:00"
},
defaults: {
name: "Freenode",
host: "irc.freenode.org",
port:... |
Change Main Response to Json | <?php
namespace App\Http\Controllers\Article;
use App\Article;
use App\Http\Requests;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Http\Request;
class ArticlesController extends BaseController
{
/**
Article
*/
protected $article;
public function __construct(Article $articl... | <?php
namespace App\Http\Controllers\Article;
use App\Article;
use App\Http\Requests;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Http\Request;
class ArticlesController extends BaseController
{
/**
Article
*/
protected $article;
public function __construct(Article $articl... |
Allow nested routes, and even functions to be passed as routes | Andamio.Router = Backbone.Router.extend({
// Override Backbone.Router._bindRoutes
_bindRoutes: function () {
if (!this.routes) {
return;
}
this.routes = _.result(this, 'routes');
_.each(this.routes, function (route) {
var urls = _.isArray(route.url) ? route.url : [route.url];
va... | Andamio.Router = Backbone.Router.extend({
_bindRoutes: function () {
if (!this.routes) {
return;
}
_.each(this.routes, function (route) {
var callback = this._createCallback(route.url, route.name, route.view);
this.route(route.url, route.name, callback);
}, this);
},
_createCal... |
Switch Calc to extend View instead of AbstractView | // Experimental Animated Views
FOAModel({
name: 'ALabel',
extendsModel: 'View',
properties: [
{
name: 'data'
},
{
name: 'className',
defaultValue: 'alabel'
},
{
name: 'left',
postSet: function(_, l) {
this.$.querySelector('.f1').style.left = l;
}
... | // Experimental Animated Views
FOAModel({
name: 'ALabel',
extendsModel: 'AbstractView',
properties: [
{
name: 'data'
},
{
name: 'className',
defaultValue: 'alabel'
},
{
name: 'left',
postSet: function(_, l) {
this.$.querySelector('.f1').style.left = l;
... |
Update withId to use the passed parameter | package com.github.davidmoten.rx;
import rx.Scheduler;
public final class Schedulers {
public static Scheduler computation(String id) {
return new SchedulerWithId(rx.schedulers.Schedulers.computation(), id);
}
public static Scheduler computation() {
return withId(rx.schedulers.Schedulers... | package com.github.davidmoten.rx;
import rx.Scheduler;
public final class Schedulers {
public static Scheduler computation(String id) {
return new SchedulerWithId(rx.schedulers.Schedulers.computation(), id);
}
public static Scheduler computation() {
return withId(rx.schedulers.Schedulers... |
Add setting to optionally enforce PR deadlines | # This file is part of Indico.
# Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN).
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (a... | # This file is part of Indico.
# Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN).
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (a... |
Remove deffered and simplify script. | 'use strict'
// Make callback function
const prepare = function(resolve, reject, withoutErrorAttr) {
// By default start with a second attribute
let base = 2
// But if it's not node style callback switch to the first one
if (withoutErrorAttr)
--base
return function () {
// If node style function r... | 'use strict'
// Defer function using native promises
const defer = function() {
let result = {}
result.promise = new Promise(function(resolve, reject) {
result.resolve = resolve
result.reject = reject
})
return result
}
// Make callback function
const prepareCallback = function(deferred, withoutError... |
Allow enumerable to be specified | module.exports = function (Model) {
Model.on('initialize', function (model) {
Object.keys(Model.attrs).forEach(function (key) {
var options = Model.attrs[key]
// enumerable defaults to false
var enumerable = !!options.enumerable || false
if (Object.hasOwnProperty.call(options, 'value')... | module.exports = function (Model) {
Model.on('initialize', function (model) {
Object.keys(Model.attrs).forEach(function (key) {
var options = Model.attrs[key]
if (Object.hasOwnProperty.call(options, 'value')) {
return Object.defineProperty(model.attrs, key, {
value: options.value,... |
10: Test all scripts on Windows
Task-Url: http://github.com/stoeps13/ibmcnx2/issues/issue/10 | ######
# Create a backup of J2EE Security Roles
#
# Author: Christoph Stoettner
# Mail: christoph.stoettner@stoeps.de
# Documentation: http://scripting101.stoeps.de
#
# Version: 2.0
# Date: 2014-06-04
#
# License: Apache 2.0
#
#
import sys
import os
import ibmcnx.functions
... | ######
# Create a backup of J2EE Security Roles
#
# Author: Christoph Stoettner
# Mail: christoph.stoettner@stoeps.de
# Documentation: http://scripting101.stoeps.de
#
# Version: 2.0
# Date: 2014-06-04
#
# License: Apache 2.0
#
#
import sys
import os
import ibmcnx.functions
... |
Update return docbblock and reorder plainText method | <?php
namespace PhpWatson\Sdk\Language\ToneAnalyser\V3;
use PhpWatson\Sdk\Response;
use PhpWatson\Sdk\Service;
class ToneAnalyserService extends Service
{
/**
* Base url for the service
*
* @var string
*/
protected $url = "https://gateway.watsonplatform.net/tone-analyzer/api";... | <?php
namespace PhpWatson\Sdk\Language\ToneAnalyser\V3;
use PhpWatson\Sdk\Service;
class ToneAnalyserService extends Service
{
/**
* Base url for the service
*
* @var string
*/
protected $url = "https://gateway.watsonplatform.net/tone-analyzer/api";
/**
* API servi... |
Create line break for icons. | import React from 'react';
import icons from '../weather_icons/WeatherIcons';
const SevenHour = ({ hourlyForecast }) => {
if (!hourlyForecast) {
return null;
}
const sevenHourForecast = hourlyForecast.slice(0, 7);
const sevenHourDataLoop = sevenHourForecast.map((hour, i) => {
return (
<div key={... | import React from 'react';
import icons from '../weather_icons/WeatherIcons';
const SevenHour = ({ hourlyForecast }) => {
if (!hourlyForecast) {
return null;
}
const sevenHourForecast = hourlyForecast.slice(0, 7);
const sevenHourDataLoop = sevenHourForecast.map((hour, i) => {
return (
<div key={... |
Fix dumb bug in link-props handling | /*import * as reactRouter3 from 'react-router';
export const Link = reactRouter3.Link;
export const withRouter = reactRouter3.withRouter;*/
import React from 'react';
import * as reactRouter from 'react-router';
import * as reactRouterDom from 'react-router-dom';
import { parseQuery } from './routeUtil'
import qs f... | /*import * as reactRouter3 from 'react-router';
export const Link = reactRouter3.Link;
export const withRouter = reactRouter3.withRouter;*/
import React from 'react';
import * as reactRouter from 'react-router';
import * as reactRouterDom from 'react-router-dom';
import { parseQuery } from './routeUtil'
import qs f... |
Reset root path config for each test. | package org.rapidoid.test;
/*
* #%L
* rapidoid-commons
* %%
* Copyright (C) 2014 - 2015 Nikolche Mihajlovski and contributors
* %%
* 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
*
... | package org.rapidoid.test;
/*
* #%L
* rapidoid-commons
* %%
* Copyright (C) 2014 - 2015 Nikolche Mihajlovski and contributors
* %%
* 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
*
... |
Improve Inferno example. Thanks Scotty! | import { render } from "inferno";
import { h as hyper } from "inferno-hyperscript";
import { setup } from "../common";
import { sv } from "seview";
const processAttrs = (attrs = {}) => {
Object.keys(attrs).forEach(key => {
if (key === "htmlFor") {
const value = attrs[key];
delete attrs[key];
at... | import { render } from "inferno";
import { h as hyper } from "inferno-hyperscript";
import { setup } from "../common";
import { sv } from "seview";
const processAttrs = (attrs = {}) => {
Object.keys(attrs).forEach(key => {
if (key === "htmlFor") {
const value = attrs[key];
delete attrs[key];
at... |
Fix tag creation with non-ascii chars. (Dammit bottle!) | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from common import init, globaldata, tag_clean, tag_prefix, tag_post, tagtypes
from bottle import post, request, redirect, mako_view as view
@post("/post-tag")
@view("post-tag")
def r_post_tag():
client = init()
m = request.forms.post
post = client.get_post(m)
tags = ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from common import init, globaldata, tag_clean, tag_prefix, tag_post, tagtypes
from bottle import post, request, redirect, mako_view as view
@post("/post-tag")
@view("post-tag")
def r_post_tag():
client = init()
m = request.forms.post
post = client.get_post(m)
tags = ... |
Improve performance of jQuery selector | (function () {
'use strict';
$.easing.easeInOutQuint = function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
return c/2*((t-=2)*t*t*t*t + 2) + b;
};
// smooth scroll
$('a[href*="#"]:not([href="#"])').click(function () {
if (location.pathname.replace(/^\//,'') === this.pathname.replace(/^\/... | (function () {
'use strict';
$.easing.easeInOutQuint = function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
return c/2*((t-=2)*t*t*t*t + 2) + b;
};
// smooth scroll
$('a[href*=#]:not([href=#])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') ... |
Disable no-useless-escape of eslint rule on repository regular expression line | 'use strict';
var rRepoURL = /^(?:(?:git|https?|git\+https|git\+ssh):\/\/)?(?:[^@]+@)?([^\/]+?)[\/:](.+?)\.git$/; // eslint-disable-line no-useless-escape
var rGithubPage = /\.github\.(io|com)$/;
function parseRepo(repo) {
var split = repo.split(',');
var url = split.shift();
var branch = split[0];
if (!bran... | 'use strict';
var rRepoURL = /^(?:(?:git|https?|git\+https|git\+ssh):\/\/)?(?:[^@]+@)?([^\/]+?)[\/:](.+?)\.git$/;
var rGithubPage = /\.github\.(io|com)$/;
function parseRepo(repo) {
var split = repo.split(',');
var url = split.shift();
var branch = split[0];
if (!branch && rRepoURL.test(url)) {
var match... |
Add error handling to nuget restore task | import gulp from 'gulp';
import nugetRestore from 'gulp-nuget-restore';
export default {
/**
* Task name
* @type {String}
*/
name: 'sitecore:nuget-restore',
/**
* Task description
* @type {String}
*/
description: 'Restore all nuget packages for solution.',
/**
* Task default configurat... | import gulp from 'gulp';
import nugetRestore from 'gulp-nuget-restore';
export default {
/**
* Task name
* @type {String}
*/
name: 'sitecore:nuget-restore',
/**
* Task description
* @type {String}
*/
description: 'Restore all nuget packages for solution.',
/**
* Task default configurat... |
Set order to a low-priority but uncommon value
Without the order, it takes the default value (100), which can
easily collide with another WebConfigurerAdapter in the application
using the library | package org.zalando.problem.spring.web.autoconfigure.security;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
im... | package org.zalando.problem.spring.web.autoconfigure.security;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
im... |
Include bin/ansible-pull as part of the sdist in distutils. | #!/usr/bin/env python
# NOTE: setup.py does NOT install the contents of the library dir
# for you, you should go through "make install" or "make RPMs"
# for that, or manually copy modules over.
import os
import sys
sys.path.insert(0, os.path.abspath('lib'))
from ansible import __version__, __author__
from distutils.... | #!/usr/bin/env python
# NOTE: setup.py does NOT install the contents of the library dir
# for you, you should go through "make install" or "make RPMs"
# for that, or manually copy modules over.
import os
import sys
sys.path.insert(0, os.path.abspath('lib'))
from ansible import __version__, __author__
from distutils.... |
Fix MySQL agent for broken DSN. | package mysql
import (
"database/sql"
"strconv"
"github.com/gansoi/gansoi/plugins"
// We need the MySQL driver for this.
_ "github.com/go-sql-driver/mysql"
)
// MySQL retrieves metrics from a MySQL server.
type MySQL struct {
DSN string `toml:"dsn" json:"dsn" description:"Mysql DSN"`
}
func init() {
plugins... | package mysql
import (
"database/sql"
"strconv"
"github.com/gansoi/gansoi/plugins"
// We need the MySQL driver for this.
_ "github.com/go-sql-driver/mysql"
)
// MySQL retrieves metrics from a MySQL server.
type MySQL struct {
DSN string `toml:"dsn" json:"dsn" description:"Mysql DSN"`
}
func init() {
plugins... |
Fix perspective initialization issue when clicking on top menu navbar | package org.gitcontrib.client.perspectives;
import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import org.uberfire.client.annotations.Perspective;
import org.uberfire.client.annotations.WorkbenchPerspective;
import org.uberfire.mvp.impl.DefaultPlaceRequest;
import org.uberfire.w... | package org.gitcontrib.client.perspectives;
import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import org.uberfire.client.annotations.Perspective;
import org.uberfire.client.annotations.WorkbenchPerspective;
import org.uberfire.mvp.impl.DefaultPlaceRequest;
import org.uberfire.w... |
[sniper_stats] Read metric names on startup for jobid-based stats so self.names is available as expected | import sniper_stats, intelqueue, iqclient
class SniperStatsJobid(sniper_stats.SniperStatsBase):
def __init__(self, jobid):
self.jobid = jobid
self.ic = iqclient.IntelClient()
self.names = self.read_metricnames()
def read_metricnames(self):
return self.ic.graphite_dbresults(self.jobid, 'read_metri... | import sniper_stats, intelqueue, iqclient
class SniperStatsJobid(sniper_stats.SniperStatsBase):
def __init__(self, jobid):
self.jobid = jobid
self.ic = iqclient.IntelClient()
def read_metricnames(self):
return self.ic.graphite_dbresults(self.jobid, 'read_metricnames')
def get_snapshots(self):
... |
Add config for client ID for premium g maps users | /* jshint node: true */
'use strict';
module.exports = {
name: 'ember-place-autocomplete',
contentFor: function(type, config) {
var content = '';
if (type === 'body-footer') {
var src = "//maps.googleapis.com/maps/api/js",
placeAutocompleteConfig = config['place-autocomplete'] || {},
... | /* jshint node: true */
'use strict';
module.exports = {
name: 'ember-place-autocomplete',
contentFor: function(type, config) {
var content = '';
if (type === 'body-footer') {
var src = "//maps.googleapis.com/maps/api/js",
placeAutocompleteConfig = config['place-autocomplete'] || {},
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.