text stringlengths 17 1.47k | positive stringlengths 673 4.43k | negative stringlengths 677 2.81k |
|---|---|---|
Normalize trailing spaces as well
This doesn't remove spaces at the end, it just converts
the last one to make it visible. I think the strategy of not
having spaces at all in the end should go in a config
option and shouldn't be a task of normalizeSpaces.
Conflicts:
src/content.js | var content = (function() {
return {
normalizeTags: function(element) {
var i, j, node, sibling;
var fragment = document.createDocumentFragment();
for (i = 0; i < element.childNodes.length; i++) {
node = element.childNodes[i];
if(!node) continue;
// skip empty tags, so... | var content = (function() {
return {
normalizeTags: function(element) {
var i, j, node, sibling;
var fragment = document.createDocumentFragment();
for (i = 0; i < element.childNodes.length; i++) {
node = element.childNodes[i];
if(!node) continue;
// skip empty tags, so... |
Remove migration dependency from Django 1.8 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.Create... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('contenttypes', '0002_remove_content_type_name'),
migrations.swappable_dependency(settings.AUTH_USER_... |
Use object destructuring for resident attributes | import newResidentAndResidencySchema from '/both/schemas/newResidentAndResidencySchema';
Meteor.methods({
addNewResidentAndResidency (document) {
// set up validation context based on new resident and residency schama
const validationContext = newResidentAndResidencySchema.newContext();
// Check if subm... | import newResidentAndResidencySchema from '/both/schemas/newResidentAndResidencySchema';
Meteor.methods({
addNewResidentAndResidency (document) {
// set up validation context based on new resident and residency schama
const validationContext = newResidentAndResidencySchema.newContext();
// Check if subm... |
Set default time out for publish with confirm to 0 | <?php
namespace Fsalehpour\RabbitMQ\Facades;
use Illuminate\Support\Facades\Facade;
use PhpAmqpLib\Message\AMQPMessage;
class AMQPFacade extends Facade
{
public static function basic_publish_with_response($channel, $exchange, $routing_key, $body, $headers = [])
{
$response = null;
$corr_id = ... | <?php
namespace Fsalehpour\RabbitMQ\Facades;
use Illuminate\Support\Facades\Facade;
use PhpAmqpLib\Message\AMQPMessage;
class AMQPFacade extends Facade
{
public static function basic_publish_with_response($channel, $exchange, $routing_key, $body, $headers = [])
{
$response = null;
$corr_id = ... |
Remove unused ObjectDoesNotExist exception import | from django.core.management.base import BaseCommand, CommandError
from subscriptions.models import Subscription
class Command(BaseCommand):
help = ("Active subscription holders need to be informed via audio file "
"about the new missed call service.")
def add_arguments(self, parser):
par... | from django.core.exceptions import ObjectDoesNotExist
from django.core.management.base import BaseCommand, CommandError
from subscriptions.models import Subscription
class Command(BaseCommand):
help = ("Active subscription holders need to be informed via audio file "
"about the new missed call servic... |
Join channels where the bot isn't already on | #!/usr/bin/env python
import asyncio
import asyncio_redis
import asyncio_redis.encoders
import json
import irc3
import traceback
__version__ = '3.0alpha'
class Redis2Irc(irc3.IrcBot):
def __init__(self, conf, **kwargs):
"""
:type conf: dict
"""
super(Redis2Irc, self).__init__(**... | #!/usr/bin/env python
import asyncio
import asyncio_redis
import asyncio_redis.encoders
import json
import irc3
import traceback
__version__ = '3.0alpha'
class Redis2Irc(irc3.IrcBot):
def __init__(self, conf, **kwargs):
"""
:type conf: dict
"""
super(Redis2Irc, self).__init__(**... |
Add JSON convenience to InvalidRegistrationRequest. | import json
from oic.oauth2.message import ErrorResponse
from .util import should_fragment_encode
class BearerTokenError(ValueError):
pass
class InvalidAuthorizationCode(ValueError):
pass
class InvalidAccessToken(ValueError):
pass
class InvalidRefreshToken(ValueError):
pass
class InvalidSubj... | from oic.oauth2.message import ErrorResponse
from .util import should_fragment_encode
class BearerTokenError(ValueError):
pass
class InvalidAuthorizationCode(ValueError):
pass
class InvalidAccessToken(ValueError):
pass
class InvalidRefreshToken(ValueError):
pass
class InvalidSubjectIdentifier... |
Fix bug due to wrong arguments order. | """This module contains the main wrapper class."""
class BaseWrapper:
"""Define base template for function wrapper classes. """
def __init__(self, func):
self.func = func
self.__doc__ = func.__doc__
def __call__(self, *args, **kwargs):
raise NotImplementedError
class NumpyWrapp... | """This module contains the main wrapper class."""
class BaseWrapper:
"""Define base template for function wrapper classes. """
def __init__(self, func):
self.func = func
self.__doc__ = func.__doc__
def __call__(self, *args, **kwargs):
raise NotImplementedError
class NumpyWrapp... |
Add balance checking test round | from django.test import TestCase
from breach.models import SampleSet, Victim, Target, Round
class RuptureTestCase(TestCase):
def setUp(self):
target = Target.objects.create(
endpoint='https://di.uoa.gr/?breach=%s',
prefix='test',
alphabet='0123456789'
)
... | from django.test import TestCase
from breach.models import SampleSet, Victim, Target, Round
class RuptureTestCase(TestCase):
def setUp(self):
target = Target.objects.create(
endpoint='https://di.uoa.gr/?breach=%s',
prefix='test',
alphabet='0123456789'
)
... |
Change name of test to avoid collision
This was spotted by coveralls. | import sys
if sys.hexversion < 0x02070000:
import unittest2 as unittest
else:
import unittest
from hypothesis import given, example
from hypothesis.extra.datetime import datetimes
from calexicon.calendars import ProlepticGregorianCalendar, JulianCalendar
from calexicon.dates import DateWithCalendar, Invalid... | import sys
if sys.hexversion < 0x02070000:
import unittest2 as unittest
else:
import unittest
from hypothesis import given, example
from hypothesis.extra.datetime import datetimes
from calexicon.calendars import ProlepticGregorianCalendar, JulianCalendar
from calexicon.dates import DateWithCalendar, Invalid... |
Read all records from the file | import argparse, csv, datetime, time
def run_main():
fails = list()
succeeds = list()
not_yet = list()
path = file_path()
# read file
with open(path) as f:
reader = csv.reader(f)
for row in reader:
status = row[0]
if status == 'F':
fails.a... | import argparse, csv, datetime, time
def run_main():
fails = 0
succeeds = 0
not_yet = list()
path = file_path()
# read file
with open(path) as f:
reader = csv.reader(f)
for row in reader:
status = row[0]
if status == 'F':
fails = fails + 1... |
Increase only minor in version number | from os.path import dirname, join
from setuptools import setup, find_packages
version = '0.2.1'
def read(fname):
return open(join(dirname(__file__), fname)).read()
setup(name='django-apptemplates',
version=version,
description='Django template loader that allows you to load and'
'o... | from os.path import dirname, join
from setuptools import setup, find_packages
version = '0.3'
def read(fname):
return open(join(dirname(__file__), fname)).read()
setup(name='django-apptemplates',
version=version,
description='Django template loader that allows you to load and'
'ove... |
Delete any files that get moved. | # -*- coding: utf-8 -*-
"""
test_collectr
-------------
Some functions to test the collectr library.
:copyright: (c) 2013 Cory Benfield
:license: MIT License, for details see LICENSE.
"""
import unittest
import collectr
class CollectrTest(unittest.TestCase):
"""
Tests for the collectr library.
"""
d... | # -*- coding: utf-8 -*-
"""
test_collectr
-------------
Some functions to test the collectr library.
:copyright: (c) 2013 Cory Benfield
:license: MIT License, for details see LICENSE.
"""
import unittest
import collectr
class CollectrTest(unittest.TestCase):
"""
Tests for the collectr library.
"""
d... |
Comment out some useless code in challenges | from django.http import HttpResponse
from django.shortcuts import render
from .models import Challenge
def download(req):
response = HttpResponse(content_type='application/zip')
response['Content-Disposition'] = 'attachment; filename=myfile.zip'
return response
def index(request):
challenges = Chal... | from django.core.files.storage import FileSystemStorage
from django.shortcuts import render, redirect
from django.http import HttpResponse
from .models import Challenge
# from .forms import DocumentForm
def download(req):
response = HttpResponse(content_type='application/zip')
response['Content-Disposition']... |
Check that query params are actually strings
Previously `toLowerCase` could fail because it tried to perform the
operation on something else than a string. | var minimatch = require('minimatch');
var is = require('annois');
var fp = require('annofp');
var zip = require('annozip');
module.exports = function(model, query, cb) {
if(!is.object(query) || fp.count(query) === 0) {
return is.fn(cb)? cb(null, model._data): query(null, model._data);
}
var fields... | var minimatch = require('minimatch');
var is = require('annois');
var fp = require('annofp');
var zip = require('annozip');
module.exports = function(model, query, cb) {
if(!is.object(query) || fp.count(query) === 0) {
return is.fn(cb)? cb(null, model._data): query(null, model._data);
}
var fields... |
Fix api controller lookup dir | <?php
namespace App\Http\Controllers\API;
use function OpenApi\scan;
/**
* @OA\OpenApi(
* openapi="3.0.0",
* @OA\Info(
* title="OParl Developer Platform API",
* description="Meta information concerning the OParl ecosystem",
* version="0",
* @OA\License(
* n... | <?php
namespace App\Http\Controllers\API;
use function OpenApi\scan;
/**
* @OA\OpenApi(
* openapi="3.0.0",
* @OA\Info(
* title="OParl Developer Platform API",
* description="Meta information concerning the OParl ecosystem",
* version="0",
* @OA\License(
* n... |
Fix problem with english system |
document.addEventListener("DOMContentLoaded", function(event) {
safari.self.addEventListener("message", messageHandler);
safari.self.addEventListener("refreshVideoState",messageHandler);
});
safari.self.addEventListener("activate", tabChanged);
function messageHandler(event)
{
if (event.name === "enab... |
document.addEventListener("DOMContentLoaded", function(event) {
safari.self.addEventListener("message", messageHandler);
safari.self.addEventListener("refreshVideoState",messageHandler);
});
safari.self.addEventListener("activate", tabChanged);
function messageHandler(event)
{
if (event.name === "enab... |
Fix missing service in lecturerFactory | (function() {
'use strict';
angular
.module('lecturer')
.factory('lecturerFactory', lecturerFactory);
/* @ngInject */
function lecturerFactory(lecturerService, $location) {
var username = '';
var observerCallbacks = [];
var Login = false;
var se... | (function() {
'use strict';
angular
.module('lecturer')
.factory('lecturerFactory', lecturerFactory);
/* @ngInject */
function lecturerFactory(lecturerService) {
var username = '';
var observerCallbacks = [];
var Login = false;
var service = {
... |
Add missing article to DummyConfigResource docstring | var _ = require('lodash');
var resources = require('../dummy/resources');
var DummyResource = resources.DummyResource;
var DummyConfigResource = DummyResource.extend(function(self, name, store) {
/**class:DummyConfigResource(name)
Handles api requests to the config resource from :class:`DummyApi`.
... | var _ = require('lodash');
var resources = require('../dummy/resources');
var DummyResource = resources.DummyResource;
var DummyConfigResource = DummyResource.extend(function(self, name, store) {
/**class:DummyConfigResource(name)
Handles api requests to the config resource from :class:`DummyApi`.
... |
Fix bug where reseting jobs would cause vue iso_date filter to break. | const utilitiesMixin = {
methods: {
getStatus: function(job) {
if (!job.pid && !job.start && !job.end && !job.message)
return "pending";
else if (job.pid && job.start && !job.end && !job.message)
return "running";
else if (job.pid && job.start ... | const utilitiesMixin = {
methods: {
getStatus: function(job) {
if (!job.pid && !job.start && !job.end && !job.message)
return "pending";
else if (job.pid && job.start && !job.end && !job.message)
return "running";
else if (job.pid && job.start ... |
Remove creating multiple instances of target for execution | var CronJob = require('cron').CronJob,
logger = require('./logger'),
TargetNodes = require('./targets/nodes').TargetNodes,
job,
state,
target = new TargetNodes({}),
STATE = {
IDLE: 0,
ACTIVE: 1
};
function setIdle() {
state = STATE.IDLE;
}
function setActive() {
... | var CronJob = require('cron').CronJob,
logger = require('./logger'),
TargetNodes = require('./targets/nodes').TargetNodes,
job,
state,
STATE = {
IDLE: 0,
ACTIVE: 1
};
function setIdle() {
state = STATE.IDLE;
}
function setActive() {
state = STATE.ACTIVE;
}
function ... |
Fix possible ClassCastException in closeables composer | package com.annimon.stream.internal;
import java.io.Closeable;
public final class Compose {
private Compose() { }
public static Runnable runnables(final Runnable a, final Runnable b) {
return new Runnable() {
@Override
public void run() {
try {
... | package com.annimon.stream.internal;
import java.io.Closeable;
public final class Compose {
private Compose() { }
public static Runnable runnables(final Runnable a, final Runnable b) {
return new Runnable() {
@Override
public void run() {
try {
... |
Fix es6 error on node 5 | /* eslint-disable */
var WebpackIsomorphicToolsPlugin = require('webpack-isomorphic-tools/plugin');
module.exports = {
// debug: true,
// webpack_assets_file_path: 'webpack-assets.json',
// webpack_stats_file_path: 'webpack-stats.json',
assets: {
images: {
extensions: ['png', 'jpg', 'jpeg', 'gif'],
... | /* eslint object-shorthand:0 func-names:0 */
const WebpackIsomorphicToolsPlugin = require('webpack-isomorphic-tools/plugin');
module.exports = {
// debug: true,
// webpack_assets_file_path: 'webpack-assets.json',
// webpack_stats_file_path: 'webpack-stats.json',
assets: {
images: {
extensions: ['png... |
Make the '--add-home-links' option work for any value that evaluates to a bool | # -*- coding: utf-8 -*-
import logging
from django.core.management.base import BaseCommand
from wagtail.wagtailcore.models import Site
from wagtailmenus import app_settings
logger = logging.getLogger(__name__)
class Command(BaseCommand):
help = (
"Create a 'main menu' for any 'Site' that doesn't alread... | # -*- coding: utf-8 -*-
import logging
from django.core.management.base import BaseCommand
from wagtail.wagtailcore.models import Site
from wagtailmenus import app_settings
logger = logging.getLogger(__name__)
class Command(BaseCommand):
help = (
"Create a 'main menu' for any 'Site' that doesn't alread... |
Set minimum numpy version to 1.11, due to backwards compatibility issues for numpy.datetime64 (localtime used by default) | from setuptools import setup
from tools.generate_pyi import generate_pyi
def main():
# Generate .pyi files
import pyxtf.xtf_ctypes
generate_pyi(pyxtf.xtf_ctypes)
import pyxtf.vendors.kongsberg
generate_pyi(pyxtf.vendors.kongsberg)
# Run setup script
setup(name='pyxtf',
version='0... | from setuptools import setup
from tools.generate_pyi import generate_pyi
def main():
# Generate .pyi files
import pyxtf.xtf_ctypes
generate_pyi(pyxtf.xtf_ctypes)
import pyxtf.vendors.kongsberg
generate_pyi(pyxtf.vendors.kongsberg)
# Run setup script
setup(name='pyxtf',
version='0... |
Allow auditor to create relationship in context
This allows the auditor to map objects to the audit but not to unmap them while
not giving him edit permissions on the audit. | # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: anze@reciprocitylabs.com
# Maintained By: anze@reciprocitylabs.com
scope = "Audit"
description = """
The permissions required by an auditor to ac... | # Copyright (C) 2015 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: anze@reciprocitylabs.com
# Maintained By: anze@reciprocitylabs.com
scope = "Audit"
description = """
The permissions required by an auditor to ac... |
Add assertions to ensure only valid s3content ids can be created | package org.springframework.content.s3;
import org.springframework.util.Assert;
import java.io.Serializable;
public final class S3ContentId implements Serializable {
private String bucket;
private String objectId;
public S3ContentId(String bucket, String objectId) {
Assert.hasText(bucket, "bucke... | package org.springframework.content.s3;
import java.io.Serializable;
public final class S3ContentId implements Serializable {
private String bucket;
private String objectId;
public S3ContentId(String bucket, String objectId) {
this.bucket = bucket;
this.objectId = objectId;
}
pub... |
Add test for removing item | import jsonsempai
import os
import shutil
import sys
import tempfile
TEST_FILE = '''{
"three": 3,
"one": {
"two": {
"three": 3
}
}
}'''
class TestSempai(object):
def setup(self):
self.direc = tempfile.mkdtemp(prefix='jsonsempai')
sys.path.append(self.dire... | import jsonsempai
import os
import shutil
import sys
import tempfile
TEST_FILE = '''{
"three": 3,
"one": {
"two": {
"three": 3
}
}
}'''
class TestSempai(object):
def setup(self):
self.direc = tempfile.mkdtemp(prefix='jsonsempai')
sys.path.append(self.dire... |
Add missing canvas context methods | module.exports = function() {
global.expect = global.chai.expect;
global.THREE = require('three');
// Mock 'document.createElement()' to return a fake canvas.
// This is a bit more convenient rather than requiring both the canvas
// and jsdom node modules to be installed as well.
const context = {
cle... | module.exports = function() {
global.expect = global.chai.expect;
global.THREE = require('three');
// Mock 'document.createElement()' to return a fake canvas.
// This is a bit more convenient rather than requiring both the canvas
// and jsdom node modules to be installed as well.
const context = {
cle... |
Fix update checks never returning anything. | var Promise = require('bluebird');
var fs = Promise.promisifyAll(require('fs'));
var _ = require('lodash');
module.exports = {
createIfNotExists: function(inPath) {
return fs.statAsync(inPath).catch(function(e) {
return fs.openAsync(inPath, 'w').then(fs.closeAsync);
});
},
creat... | var Promise = require('bluebird');
var fs = Promise.promisifyAll(require('fs'));
var _ = require('lodash');
module.exports = {
createIfNotExists: function(inPath) {
return fs.statAsync(inPath).catch(function(e) {
return fs.openAsync(inPath, 'w').then(fs.closeAsync);
});
},
creat... |
Add dependency on Django 1.3. | #/usr/bin/env python
import os
from setuptools import setup, find_packages
ROOT_DIR = os.path.dirname(__file__)
SOURCE_DIR = os.path.join(ROOT_DIR)
# Dynamically calculate the version based on photologue.VERSION
version_tuple = __import__('photologue').VERSION
if len(version_tuple) == 3:
version = "%d.%d_%s" % ve... | #/usr/bin/env python
import os
from setuptools import setup, find_packages
ROOT_DIR = os.path.dirname(__file__)
SOURCE_DIR = os.path.join(ROOT_DIR)
# Dynamically calculate the version based on photologue.VERSION
version_tuple = __import__('photologue').VERSION
if len(version_tuple) == 3:
version = "%d.%d_%s" % ve... |
Change the back-off algo for failures |
import time
import multiprocessing
try:
from setproctitle import setproctitle
except ImportError:
def setproctitle(title):
pass
class StatsCollector(multiprocessing.Process):
def __init__(self, queue):
super(StatsCollector, self).__init__()
self.queue = queue
def close(sel... |
import time
import multiprocessing
try:
from setproctitle import setproctitle
except ImportError:
def setproctitle(title):
pass
class StatsCollector(multiprocessing.Process):
def __init__(self, queue):
super(StatsCollector, self).__init__()
self.queue = queue
def close(sel... |
IMPROVE (bugsnag): Stop bugsnag to send AJAX errors for user errors | (function () {
'use strict';
angular
.module('gisto')
.factory('bugsnagHttpInterceptor', bugsnagHttpInterceptor);
bugsnagHttpInterceptor.$inject = ['$q', 'bugsnag'];
/* @ngInject */
function bugsnagHttpInterceptor($q, bugsnag) {
return {
requestError: handleErr... | (function () {
'use strict';
angular
.module('gisto')
.factory('bugsnagHttpInterceptor', bugsnagHttpInterceptor);
bugsnagHttpInterceptor.$inject = ['$q', 'bugsnag'];
/* @ngInject */
function bugsnagHttpInterceptor($q, bugsnag) {
return {
requestError: handleErr... |
Add support for intent slot's value as a object | 'use strict';
const _ = require('underscore');
function buildSlots(slots) {
const res = {};
_.each(slots, (value, key) => {
if( _.isString(value)){
res[key] = {
name: key,
value: value
}
}else{
res[key] = {
name: key,
...value
}
}
});
return ... | 'use strict';
const _ = require('underscore');
function buildSlots(slots) {
const res = {};
_.each(slots, (value, key) => {
res[key] = {
name: key,
value: value
};
if(! _.isString(value)){
res[key] = {...res[key],...value}
}
});
return res;
}
function buildSession(e) {
ret... |
Change CloudWatch metrics timer to 1 minute. | var async = require('async');
var context;
var publishTimer;
function publishToDashboard() {
async.waterfall([
function(callback) {
context.consuler.getKeyValue(context.keys.request, function(result) {
callback(null, result);
});
},
function(requests... | var async = require('async');
var context;
var publishTimer;
function publishToDashboard() {
async.waterfall([
function(callback) {
context.consuler.getKeyValue(context.keys.request, function(result) {
callback(null, result);
});
},
function(requests... |
Send vote count to interface | package ch.ethz.geco.bass.audio.gson;
import ch.ethz.geco.bass.audio.util.AudioTrackMetaData;
import com.google.gson.*;
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
import com.sedmelluq.discord.lavaplayer.track.AudioTrackInfo;
import java.lang.reflect.Type;
import java.util.Map;
/**
* Serializes an Aud... | package ch.ethz.geco.bass.audio.gson;
import ch.ethz.geco.bass.audio.util.AudioTrackMetaData;
import com.google.gson.*;
import com.sedmelluq.discord.lavaplayer.track.AudioTrack;
import com.sedmelluq.discord.lavaplayer.track.AudioTrackInfo;
import java.lang.reflect.Type;
import java.util.Map;
/**
* Serializes an Aud... |
Add case param in accept/reject urls. | <?php
function modal ($id, $title, $body, $data) {
$html = '<div id="'.$id.'" class="modal fade" style="display:none" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div clas... | <?php
function modal ($id, $title, $body, $data) {
$html = '<div id="'.$id.'" class="modal fade" style="display:none" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div clas... |
Update from small pipeline changes | /*global define*/
define([], function() {
'use strict';
/**
* Utility function for retrieving the number of components in a given type.
* As per the spec:
* 'SCALAR' : 1
* 'VEC2' : 2
* 'VEC3' : 3
* 'VEC4' : 4
* 'MAT2' : 4
* 'MAT3' : 9
... | /*global define*/
define([], function() {
'use strict';
/**
* Utility function for retrieving the number of components in a given type.
* As per the spec:
* 'SCALAR' : 1
* 'VEC2' : 2
* 'VEC3' : 3
* 'VEC4' : 4
* 'MAT2' : 4
* 'MAT3' : 9
... |
Change stride semantic in MaxPool | """Pooling layer."""
from theano.tensor.signal import downsample
from athenet.layers import Layer
class MaxPool(Layer):
"""Max-pooling layer."""
def __init__(self, poolsize, stride=None):
"""Create max-pooling layer.
:poolsize: Pooling factor in the format (height, width).
:stride: ... | """Pooling layer."""
from theano.tensor.signal import downsample
from athenet.layers import Layer
class MaxPool(Layer):
"""Max-pooling layer."""
def __init__(self, poolsize, stride=None):
"""Create max-pooling layer.
:poolsize: Pooling factor in the format (height, width).
:stride: ... |
Set readme content type to markdown | """setup.py"""
from codecs import open as codecs_open
from setuptools import setup
with codecs_open('README.md', 'r', 'utf-8') as f:
README = f.read()
with codecs_open('HISTORY.md', 'r', 'utf-8') as f:
HISTORY = f.read()
setup(
author='Beau Barker',
author_email='beauinmelbourne@gmail.com',
classi... | """setup.py"""
from codecs import open as codecs_open
from setuptools import setup
with codecs_open('README.md', 'r', 'utf-8') as f:
README = f.read()
with codecs_open('HISTORY.md', 'r', 'utf-8') as f:
HISTORY = f.read()
setup(
name='jsonrpcserver',
version='3.5.3',
description='Process JSON-RPC ... |
Hide Exscript.protocols.AbstractMethod from the API docs. | #!/usr/bin/env python
# Generates the API documentation.
import os, re, sys
project = 'Exscript'
base_dir = os.path.join('..', 'src', project)
doc_dir = 'api'
# Create the documentation directory.
if not os.path.exists(doc_dir):
os.makedirs(doc_dir)
# Generate the API documentation.
os.system('epydoc ' + ' '.j... | #!/usr/bin/env python
# Generates the API documentation.
import os, re, sys
project = 'Exscript'
base_dir = os.path.join('..', 'src', project)
doc_dir = 'api'
# Create the documentation directory.
if not os.path.exists(doc_dir):
os.makedirs(doc_dir)
# Generate the API documentation.
os.system('epydoc ' + ' '.j... |
Fix 404 page font issue | import React from 'react';
import { Link } from 'react-router';
import classNames from 'classnames';
import Title from 'react-title-component';
import main from '../../assets/css/main.scss';
const primaryBtnClassnames = classNames(main['primary-btn'], main.btn, main.a);
import styles from '../../assets/css/pages/not... | import React from 'react';
import { Link } from 'react-router';
import classNames from 'classnames';
import Title from 'react-title-component';
import main from '../../assets/css/main.scss';
const primaryBtnClassnames = classNames(main['primary-btn'], main.btn, main.a);
import styles from '../../assets/css/pages/not... |
Add simple back-end validation on signup | <?php
namespace App\Http\Controllers\Auth;
use App\User;
use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\Request;
use Illuminate\Support\Facades\Auth;
class AuthController extends \App\Http\Controllers\Controller
{
public function login()
{
if (Auth::check() === true)
... | <?php
namespace App\Http\Controllers\Auth;
use App\User;
use Illuminate\Database\QueryException;
use Illuminate\Support\Facades\Request;
use Illuminate\Support\Facades\Auth;
class AuthController extends \App\Http\Controllers\Controller
{
public function login()
{
if (Auth::check() === true)
... |
Fix a pydocstyle warning in .travis.yml | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Copyright (c) 2014 CorvisaCloud, LLC
#
# License: MIT
#
"""This module exports the Luacheck plugin class."""
from SublimeLinter.lint import Linter
class Luacheck(Linter):
"""Provides an interface to luacheck."""
syn... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Copyright (c) 2014 CorvisaCloud, LLC
#
# License: MIT
#
"""This module exports the Luacheck plugin class."""
from SublimeLinter.lint import Linter
class Luacheck(Linter):
"""Provides an interface to luacheck."""
sy... |
Add handler and logger for management commands | import os
from .toggles import *
if not DEBUG:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = os.environ.get('RCAMP_EMAIL_HOST')
EMAIL_PORT = int(os.environ.get('RCAMP_EMAIL_PORT'))
else:
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
LOGGING = {
'vers... | import os
from .toggles import *
if not DEBUG:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = os.environ.get('RCAMP_EMAIL_HOST')
EMAIL_PORT = int(os.environ.get('RCAMP_EMAIL_PORT'))
else:
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
LOGGING = {
'vers... |
Use trailing slashes for angular routing urls
Currently angular js still strips the trailing slashes from the url. With
angular 1.3 this cane be changed via a resourceProvider. | // -*- coding: utf-8 -*-
//
// (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com>
//
// See LICENSE comming with the source of 'trex' for details.
//
'use strict';
var trexApp = angular.module('trex.app',
['ngRoute', 'ngCookies', 'ngTagsInput', 'ngResource',
'angular-loading-bar',
'trex.controlle... | // -*- coding: utf-8 -*-
//
// (c) 2014 Bjoern Ricks <bjoern.ricks@gmail.com>
//
// See LICENSE comming with the source of 'trex' for details.
//
'use strict';
var trexApp = angular.module('trex.app',
['ngRoute', 'ngCookies', 'ngTagsInput', 'angular-loading-bar',
'trex.controllers', 'trex.filters',
... |
Upgrade to working MozillaPulse version | from setuptools import setup, find_packages
deps = [
'ijson==2.2',
'mozci==0.15.1',
'MozillaPulse==1.2.2',
'requests==2.7.0', # Maximum version taskcluster will work with
'taskcluster==0.0.27',
'treeherder-client==1.7.0',
]
setup(name='pulse-actions',
version='0.2.0',
description='... | from setuptools import setup, find_packages
deps = [
'ijson==2.2',
'mozci==0.15.1',
'MozillaPulse==1.2.1',
'requests==2.7.0', # Maximum version taskcluster will work with
'taskcluster==0.0.27',
'treeherder-client==1.7.0',
]
setup(name='pulse-actions',
version='0.2.0',
description='... |
Improve code structure in preparation for implementation of localization for projects page. | 'use strict';
angular.module('arachne.controllers')
/**
* TODO adjust title according to language
* for now, set it to german language
*
* @author: Daniel M. de Oliveira
* @author: Sebastian Cuy
*/
.controller('ProjectsController', ['$scope', '$http',
function ($scope, $http ) {
var restructureB... | 'use strict';
angular.module('arachne.controllers')
/**
* @author: Daniel M. de Oliveira
* @author: Sebastian Cuy
*/
.controller('ProjectsController', ['$scope', '$http',
function ($scope, $http ) {
$scope.columns = [];
$http.get('con10t/projects.json').success(function(data){
$s... |
Change to app from dist | var http = require("http");
var fs = require("fs");
var path = require("path");
var mime = require("mime");
function send404(response) {
response.writeHead(404, {"Content-type" : "text/plain"});
response.write("Error 404: resource not found");
response.end();
}
function sendPage(response, filePath, fileCo... | var http = require("http");
var fs = require("fs");
var path = require("path");
var mime = require("mime");
function send404(response) {
response.writeHead(404, {"Content-type" : "text/plain"});
response.write("Error 404: resource not found");
response.end();
}
function sendPage(response, filePath, fileCo... |
Refactor usage cssProperties in $.fn.anim | // Zepto.js
// (c) 2010, 2011 Thomas Fuchs
// Zepto.js may be freely distributed under the MIT license.
(function($, undefined){
var supportedTransforms = [
'scale scaleX scaleY',
'translate', 'translateX', 'translateY', 'translate3d',
'skew', 'skewX', 'skewY',
'rotate', 'rot... | // Zepto.js
// (c) 2010, 2011 Thomas Fuchs
// Zepto.js may be freely distributed under the MIT license.
(function($, undefined){
var supportedTransforms = [
'scale scaleX scaleY',
'translate', 'translateX', 'translateY', 'translate3d',
'skew', 'skewX', 'skewY',
'rotate', 'rot... |
Use markitup widget in talk form | from django import forms
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
from crispy_forms.bootstrap import FormActions
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit, HTML
from markitup.widgets import MarkItUpWidget
from wafer.talks.m... | from django import forms
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
from crispy_forms.bootstrap import FormActions
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit, HTML
from wafer.talks.models import Talk
class TalkForm(forms.Mod... |
Update the version to 0.1.0 | #!/usr/bin/env python
# http://stackoverflow.com/questions/9810603/adding-install-requires-to-setup-py-when-making-a-python-package
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(
name='molml',
version='0.1.0',
description='An interface between molecul... | #!/usr/bin/env python
# http://stackoverflow.com/questions/9810603/adding-install-requires-to-setup-py-when-making-a-python-package
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
setup(
name='molml',
version='0.0.1',
description='An interface between molecul... |
Use const instead of let on never reassigned var
Signed-off-by: Julen Landa Alustiza <9f547bdd49d2612aea2f3e70f57e0c5f51269763@zokormazo.info> | const templateUrl = require('~components/layout/side-nav.partial.html');
function atSideNavLink (scope, element, attrs, ctrl) {
scope.layoutVm = ctrl;
document.on('click', (e) => {
if ($(e.target).parents('.at-Layout-side').length === 0) {
scope.$emit('clickOutsideSideNav');
}
... | const templateUrl = require('~components/layout/side-nav.partial.html');
function atSideNavLink (scope, element, attrs, ctrl) {
scope.layoutVm = ctrl;
document.on('click', (e) => {
if ($(e.target).parents('.at-Layout-side').length === 0) {
scope.$emit('clickOutsideSideNav');
}
... |
Set methods that don't use any fields as static | package com.alexstyl.specialdates.contact;
import android.content.ContentResolver;
import android.database.Cursor;
import android.provider.ContactsContract;
import com.alexstyl.specialdates.DisplayName;
class DeviceContactFactory {
private final ContentResolver resolver;
DeviceContactFactory(ContentResolve... | package com.alexstyl.specialdates.contact;
import android.content.ContentResolver;
import android.database.Cursor;
import android.provider.ContactsContract;
import com.alexstyl.specialdates.DisplayName;
class DeviceContactFactory {
private final ContentResolver resolver;
DeviceContactFactory(ContentResolve... |
Support replacing all instances of the string in a html file | function HtmlReplaceWebpackPlugin(options)
{
options = Array.isArray(options) ? options : [options]
options.forEach(function(option)
{
if(typeof option.pattern == 'undefined' ||
typeof option.replacement == 'undefined')
{
throw new Error('Both `pattern` and `replacement` options must be defin... | function HtmlReplaceWebpackPlugin(options)
{
options = Array.isArray(options) ? options : [options]
options.forEach(function(option)
{
if(typeof option.pattern == 'undefined' ||
typeof option.replacement == 'undefined')
{
throw new Error('Both `pattern` and `replacement` options must be defin... |
Update to make Travis-CI happier. | package myessentials.chat.api;
import myessentials.localization.api.LocalManager;
import net.minecraft.command.ICommandSender;
import net.minecraft.util.IChatComponent;
import net.minecraft.entity.player.EntityPlayerMP;
import java.util.List;
public class ChatManager {
/**
* Global method for sending local... | package myessentials.chat.api;
import myessentials.localization.api.LocalManager;
import net.minecraft.command.ICommandSender;
import net.minecraft.util.IChatComponent;
import net.minecraft.entity.player.EntityPlayerMP;
import java.util.List;
public class ChatManager {
/**
* Global method for sending local... |
Fix room not recalculating sources | SetupPrototypes();
SetupRooms();
SpawnCreeps();
HandleCreeps();
EndTick();
function SetupPrototypes() {
Room.prototype.getLOIs = function() {
var lois = [];
this.memory.sources.forEach(function(sourceId) {
lois.push(sourceId);
});
if(this.controller) {
l... | SetupPrototypes();
SetupRooms();
SpawnCreeps();
HandleCreeps();
EndTick();
function SetupPrototypes() {
Room.prototype.getLOIs = function() {
var lois = [];
this.memory.sources.forEach(function(sourceId) {
lois.push(sourceId);
});
if(this.controller) {
l... |
Simplify test task since typescript coverage is not supported | "use strict";
require('babel-core/register');
const Task = require('../Task'),
gulp = require('gulp'),
mocha = require('gulp-mocha'),
istanbul = require('gulp-istanbul'),
isparta = require('isparta'),
Promise = require('bluebird');
class TestTask extends Task {
constructor(buildManager) {
... | "use strict";
const Task = require('../Task'),
gulp = require('gulp'),
mocha = require('gulp-mocha'),
istanbul = require('gulp-istanbul'),
isparta = require('isparta'),
Promise = require('bluebird');
class TestTask extends Task {
constructor(buildManager) {
super(buildManager);
... |
Fix extension loading, namespace extensions behind ext | <?php
namespace Prontotype\Extension;
class Manager
{
public function __construct($extpath, $app)
{
$this->app = $app;
$this->path = rtrim($extpath,'/');
$this->extensions = array();
}
public function loadExtensions($extensions)
{
if ( count($extens... | <?php
namespace Prontotype\Extension;
class Manager
{
public function __construct($extpath, $app)
{
$this->app = $app;
$this->path = rtrim($extpath,'/');
$this->extensions = array();
}
public function loadExtensions($extensions)
{
if ( count($extension... |
Remove superfluous option from print_row. | import fileinput
import textwrap
import sys
class Table(object):
def __init__(self):
self.lines = []
self.width = 20
def feed(self,line):
self.lines.append(line.split("\t"))
def print_sep(self):
for _ in range(len(self.lines[0])):
print "-"*self.width,
... | import fileinput
import textwrap
import sys
class Table(object):
def __init__(self):
self.lines = []
self.width = 20
def feed(self,line):
self.lines.append(line.split("\t"))
def print_sep(self):
for _ in range(len(self.lines[0])):
print "-"*self.width,
... |
Update tasks to generate docs on watch | module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
concat: {
all: {
src: [
'src/module.js',
'src/*/**/*.js'
],
dest: 'build/ng-drag.js'
}
},
... | module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
concat: {
all: {
src: [
'src/module.js',
'src/*/**/*.js'
],
dest: 'build/ng-drag.js'
}
},
... |
Fix the cleaning of the message once it is sent. | $(window).load(function () {
var Ector = require('ector');
var ector = new Ector();
var previousResponseNodes = null;
var user = { username: "Guy"};
var msgtpl = $('#msgtpl').html();
var lastmsg = false;
$('#msgtpl').remove();
var message;
$('#send').on('click', function () {
... | $(window).load(function () {
var Ector = require('ector');
var ector = new Ector();
var previousResponseNodes = null;
var user = { username: "Guy"}
var msgtpl = $('#msgtpl').html();
var lastmsg = false;
$('#msgtpl').remove();
var message;
$('#send').on('click', function () {
... |
Simplify state setting internally (lose immutability) | import { select, local } from "d3-selection";
var stateLocal = local(),
renderLocal = local(),
noop = function (){};
export default function (tagName, className){
var render = noop, create, destroy,
selector = className ? "." + className : tagName;
function component(selection, props){
var updat... | import { select, local } from "d3-selection";
var stateLocal = local(),
renderLocal = local(),
noop = function (){};
export default function (tagName, className){
var render = noop, create, destroy,
selector = className ? "." + className : tagName;
function component(selection, props){
var updat... |
Fix a crash in the gear tab when an Artifact's relics are not known | import React from 'react';
import PropTypes from 'prop-types';
import Icon from 'common/Icon';
import ItemLink from 'common/ItemLink';
import ITEM_QUALITIES from 'common/ITEM_QUALITIES';
class Gear extends React.PureComponent {
static propTypes = {
selectedCombatant: PropTypes.object.isRequired,
};
render()... | import React from 'react';
import PropTypes from 'prop-types';
import Icon from 'common/Icon';
import ItemLink from 'common/ItemLink';
import ITEM_QUALITIES from 'common/ITEM_QUALITIES';
class Gear extends React.PureComponent {
static propTypes = {
selectedCombatant: PropTypes.object.isRequired,
};
render()... |
Use the 'should expose some global scope' test
As seen in examples when there doesn't seem to be anything else to test. | 'use strict';
(function() {
describe("voteeHome", function() {
beforeEach(function() {
module('mean');
module('mean.voteeHome');
});
var $controller;
var $scope;
beforeEach(inject(function(_$controller_){
// The injector unwraps the un... | 'use strict';
(function() {
describe("voteeHome", function() {
beforeEach(function() {
module('mean');
module('mean.voteeHome');
});
var $controller;
var $scope;
beforeEach(inject(function(_$controller_){
// The injector unwraps the un... |
Use ponyfil for base error | var captureStackTrace = require('capture-stack-trace');
function BaseError(data){
var oldLimit = Error.stackTraceLimit,
error;
Error.stackTraceLimit = 20;
error = Error.apply(this, arguments);
Error.stackTraceLimit = oldLimit;
captureStackTrace(this, BaseError);
this.__genericError... | function BaseError(data){
var oldLimit = Error.stackTraceLimit,
error;
Error.stackTraceLimit = 20;
error = Error.apply(this, arguments);
Error.stackTraceLimit = oldLimit;
if(Error.captureStackTrace){
Error.captureStackTrace(this, BaseError);
}
this.__genericError = true;... |
Change lock name to use a name for this app | package com.markupartist.sthlmtraveling.service;
import android.app.IntentService;
import android.content.Context;
import android.content.Intent;
import android.os.PowerManager;
import android.util.Log;
abstract public class WakefulIntentService extends IntentService {
private static String TAG = "WakefulIntentSe... | package com.markupartist.sthlmtraveling.service;
import android.app.IntentService;
import android.content.Context;
import android.content.Intent;
import android.os.PowerManager;
import android.util.Log;
abstract public class WakefulIntentService extends IntentService {
private static String TAG = "WakefulIntentSe... |
Set the host for the cli command | <?php
namespace Forex\Bundle\EmailBundle\Command;
use Forex\Bundle\EmailBundle\Entity\EmailMessage;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterf... | <?php
namespace Forex\Bundle\EmailBundle\Command;
use Forex\Bundle\EmailBundle\Entity\EmailMessage;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterf... |
Add sub views to the router. | "use strict";
(function () {
angular
.module("argo")
.config(config)
.run(setup);
config.$inject = ["$stateProvider", "$urlRouterProvider"];
function config($stateProvider, $urlRouterProvider) {
$stateProvider
.state("default", {
abstract: true,
... | "use strict";
(function () {
angular
.module("argo")
.config(config)
.run(setup);
config.$inject = ["$stateProvider", "$urlRouterProvider"];
function config($stateProvider, $urlRouterProvider) {
$stateProvider
.state("index", {
abstract: true,
... |
Fix for markdown handler when using application objects branch | <?php
namespace Rhubarb\Website\UrlHandlers;
use Rhubarb\Crown\UrlHandlers\UrlHandler;
require_once "vendor/rhubarbphp/rhubarb/src/UrlHandlers/UrlHandler.php";
require_once "vendor/geeks-dev/php-markdown-extra-extended-stylish/markdown_extended_stylish.php";
class MarkdownUrlHandler extends UrlHandler
{
/**
... | <?php
namespace Rhubarb\Website\UrlHandlers;
use Rhubarb\Crown\UrlHandlers\UrlHandler;
require_once "vendor/rhubarbphp/rhubarb/src/UrlHandlers/UrlHandler.php";
require_once "vendor/geeks-dev/php-markdown-extra-extended-stylish/markdown_extended_stylish.php";
class MarkdownUrlHandler extends UrlHandler
{
/**
... |
Check the existence of the images_path
ERROR:planetstack.log:[Errno 2] No such file or directory: '/opt/xos/images' BEG TRACEBACK
Traceback (most recent call last):
File "/opt/xos/observer/event_loop.py", line 349, in sync
failed_objects = sync_step(failed=list(self.failed_step_objects), deletion=deletion)
Fil... | import os
import base64
from django.db.models import F, Q
from xos.config import Config
from observer.openstacksyncstep import OpenStackSyncStep
from core.models.image import Image
class SyncImages(OpenStackSyncStep):
provides=[Image]
requested_interval=0
observes=Image
def fetch_pending(self, deleted... | import os
import base64
from django.db.models import F, Q
from xos.config import Config
from observer.openstacksyncstep import OpenStackSyncStep
from core.models.image import Image
class SyncImages(OpenStackSyncStep):
provides=[Image]
requested_interval=0
observes=Image
def fetch_pending(self, deleted... |
Use bind instead of wrapping the function to forward errors. |
'use strict';
var https = require("https"),
EventEmitter = require('events');
/**
* Forward an error to another emitter.
*/
var forwardError = function (emitter) {
return emitter.emit.bind(emitter, 'error');
};
/**
* Request a JSON object over HTTPS. Returns an emitter. Emits 'response',
* 'data' and 'e... |
'use strict';
var https = require("https"),
EventEmitter = require('events');
/**
* Forward an error to another emitter.
*/
var forwardError = function (emitter) {
return function (error) {
emitter.emit('error', error);
};
};
/**
* Request a JSON object over HTTPS. Returns an emitter. Emits '... |
[Form] Allow setting different options to repeating fields | <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\... | <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Extension\Core\Type;
use Symfony\Component\Form\... |
Fix bind shared with singleton when registering the HTML service provider | <?php namespace Aginev\Datagrid;
use Collective\Html\FormFacade;
use Collective\Html\HtmlFacade;
use Collective\Html\HtmlServiceProvider;
use Illuminate\Foundation\AliasLoader;
use Illuminate\Support\Facades\App;
use Illuminate\Support\ServiceProvider;
class DatagridServiceProvider extends ServiceProvider
{
/**
... | <?php namespace Aginev\Datagrid;
use Collective\Html\FormFacade;
use Collective\Html\HtmlFacade;
use Collective\Html\HtmlServiceProvider;
use Illuminate\Foundation\AliasLoader;
use Illuminate\Support\Facades\App;
use Illuminate\Support\ServiceProvider;
class DatagridServiceProvider extends ServiceProvider
{
/**
... |
Add signal handler for sigterm. | import logging.config
from setproctitle import setproctitle
import signal
def process_setup():
exitcmd = lambda *_: exit(0)
signal.signal(signal.SIGINT, exitcmd)
signal.signal(signal.SIGTERM, exitcmd)
setproctitle('ksurctrobot')
logging.config.dictConfig({
'version': 1,
'formatter... | import logging.config
from setproctitle import setproctitle
def process_setup():
setproctitle('ksurctrobot')
logging.config.dictConfig({
'version': 1,
'formatters': {
'long': {
'format':
'%(relativeCreated)d %(threadName)-12s %(levelname)-5s %(... |
Support base url in front-end url resolver. | <?php
/*
* Copyright 2015 Jack Sleight <http://jacksleight.com/>
* This source file is subject to the MIT license that is bundled with this package in the file LICENCE.
*/
namespace Chalk\Frontend;
use Chalk\Chalk;
use Closure;
use Coast\UrlResolver as CoastUrlResolver;
class UrlResolver extends CoastUrlResolver... | <?php
/*
* Copyright 2015 Jack Sleight <http://jacksleight.com/>
* This source file is subject to the MIT license that is bundled with this package in the file LICENCE.
*/
namespace Chalk\Frontend;
use Chalk\Chalk;
use Closure;
use Coast\UrlResolver as CoastUrlResolver;
class UrlResolver extends CoastUrlResolver... |
Use code argument for `timeit`, only time execution | <?php
namespace Psy\Command;
use Psy\Configuration;
use Psy\Input\CodeArgument;
use Psy\Shell;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Class TimeitCommand
* @package Psy\Command
*/
class Time... | <?php
namespace Psy\Command;
use Psy\Configuration;
use Psy\Shell;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputArgument;
/**
* Class TimeitCommand
* @package Psy\Command
*/
class TimeitCommand extends Command
{
... |
Put time and day in separate columns | import moment from 'moment'
import textTable from 'text-table'
const find = (apiWrapper) => (search, options) => {
const {
startdate,
enddate,
businessunitids
} = options
return new Promise((resolve, reject) => {
apiWrapper.getActivities({
startdate,
enddate,
businessunitids
... | import moment from 'moment'
import textTable from 'text-table'
const find = (apiWrapper) => (search, options) => {
const {
startdate,
enddate,
businessunitids
} = options
return new Promise((resolve, reject) => {
apiWrapper.getActivities({
startdate,
enddate,
businessunitids
... |
Fix problem with array values. | import numpy as np
class LowPassFilter(object):
'''
First order discrete IIR filter.
'''
def __init__(self, feedback_gain, initial_value=0.0):
self.feedback_gain = np.ones_like(initial_value) * feedback_gain
self.initial_value = initial_value
self.output_gain = 1.0 - feedback_ga... | import numpy as np
class LowPassFilter(object):
'''
First order discrete IIR filter.
'''
def __init__(self, feedback_gain, initial_value=0.0):
self.feedback_gain = np.ones_like(initial_value) * feedback_gain
self.initial_value = initial_value
self.output_gain = 1.0 - feedback_ga... |
Test to only use Media if phone-gap version of HTML/JS |
var StartView = function(homeView) {
this.homeView = homeView;
this.initialize = function() {
// 'div' wrapper to attach html and events to
this.el = $('<div/>');
};
this.render = function() {
if (!this.homeView) {
this.homeView = { enteredName: "" }
}
... |
var StartView = function(homeView) {
this.homeView = homeView;
this.initialize = function() {
// 'div' wrapper to attach html and events to
this.el = $('<div/>');
};
this.render = function() {
if (!this.homeView) {
this.homeView = { enteredName: "" }
}
... |
Add node specific tag generation | import io
import os
import yaml
from solar.extensions import base
class Discovery(base.BaseExtension):
VERSION = '1.0.0'
ID = 'discovery'
PROVIDES = ['nodes_resources']
COLLECTION_NAME = 'nodes'
FILE_PATH = os.path.join(
# TODO(pkaminski): no way we need '..' here...
os.path.d... | import io
import os
import yaml
from solar.extensions import base
class Discovery(base.BaseExtension):
VERSION = '1.0.0'
ID = 'discovery'
PROVIDES = ['nodes_resources']
COLLECTION_NAME = 'nodes'
FILE_PATH = os.path.join(
# TODO(pkaminski): no way we need '..' here...
os.path.d... |
Resolve all the JS errors | $(document).ready(function () {
/*Navigation initialization*/
var navigation = $('#navigation');
var navShown = false;
var navController = $('#nav-controller');
if (navController) {
navController.on('click', function () {
if (navShown) {
navigation.removeClass('s... | $(document).ready(function () {
/*Navigation initialization*/
var navigation = $('#navigation');
var navShown = false;
$('#nav-controller').on('click', function () {
if (navShown) {
navigation.removeClass('show-nav');
navigation.addClass('hide-nav');
navShown... |
Add 'handlers' package to distribution. | import os
from setuptools import setup
setup(
name = "prometheus_client",
version = "0.0.18",
author = "Brian Brazil",
author_email = "brian.brazil@robustperception.io",
description = ("Python client for the Prometheus monitoring system."),
long_description = ("See https://github.com/prometheus... | import os
from setuptools import setup
setup(
name = "prometheus_client",
version = "0.0.18",
author = "Brian Brazil",
author_email = "brian.brazil@robustperception.io",
description = ("Python client for the Prometheus monitoring system."),
long_description = ("See https://github.com/prometheus... |
Fix admin table on mobile devices | @extends('layouts.master')
@section('title', 'Admin Dashboard')
@section('content')
<div class="row justify-content-center mt-2">
<div class="col-8">
<div class="card">
<div class="card-header">
Admin
</div>
<div class="card-b... | @extends('layouts.master')
@section('title', 'Admin Dashboard')
@section('content')
<div class="row justify-content-center mt-2">
<div class="col-8">
<div class="card">
<div class="card-header">
Admin
</div>
<div class="card-b... |
Use basic properties and make public properties consistent with other interfaces. |
var Proteus = require("proteus");
module.exports = Proteus.Class.derive(Object.defineProperties({
init: function () {
this.members = [];
Proteus.slice(arguments).forEach(this.add, this);
},
get: function (idx) {
return this.members[idx];
},
add: function (exp... |
var Proteus = require("proteus");
module.exports = Proteus.Class.derive(Object.defineProperties({
init: function () {
Object.defineProperties(this, {
members: { value: [], enumerable: true }
});
Proteus.slice(arguments).forEach(this.add, this);
},
add... |
Use restRequest for Ajax requests to Girder servers | import View from 'girder/views/View';
import { AccessType } from 'girder/constants';
import { restRequest } from 'girder/rest';
import VegaWidgetTemplate from '../templates/vegaWidget.pug';
import '../stylesheets/vegaWidget.styl';
import vg from 'vega';
var VegaWidget = View.extend({
initialize: function (settin... | import View from 'girder/views/View';
import { AccessType } from 'girder/constants';
import VegaWidgetTemplate from '../templates/vegaWidget.pug';
import '../stylesheets/vegaWidget.styl';
import vg from 'vega';
var VegaWidget = View.extend({
initialize: function (settings) {
this.item = settings.item;
... |
Fix sass custom functions fileExists | var sizeOf = require('image-size');
var sass = require('node-sass');
var config = require('../config.js');
var fileExists = require('file-exists');
if (fileExists('./src/sass/styles.json')) {
var styles = require('../../src/sass/styles.json');
}
var customFunctions = {
'file-exists($path: "")': function(path)... | var sizeOf = require('image-size');
var sass = require('node-sass');
var project = require('../../package.json');
var config = require('../config.js');
var fileExists = require('file-exists');
if (fileExists('../../src/sass/styles.json')) {
var styles = require('../../src/sass/styles.json');
}
var customFunctions... |
Fix the grunt base path | module.exports = function(grunt) {
grunt.file.setBase('..');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-shell-spawn');
grunt.initConfig({
pkg: {
main: grunt.file.readJSON("../src/package.json")
},
uglify: {
main: {
options: {
banner: '/*! <%= ... | module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-shell-spawn');
grunt.initConfig({
pkg: {
main: grunt.file.readJSON("../src/package.json")
},
uglify: {
main: {
options: {
banner: '/*! <%= pkg.main.name %> v<%= pkg.ma... |
Remove terminal Unicode Escape codes | import sublime
import sys
import re
class CrossPlaformCodecs():
@classmethod
def decode_line(self, line):
line = line.rstrip()
decoded_line = self.force_decode(line) if sys.version_info >= (3, 0) else line
decoded_line = re.sub(r'\033\[(\d{1,2}m|\d\w)', '', str(decoded_line))
re... | import sublime
import sys
class CrossPlaformCodecs():
@classmethod
def decode_line(self, line):
line = line.rstrip()
decoded_line = self.force_decode(line) if sys.version_info >= (3, 0) else line
return str(decoded_line) + "\n"
@classmethod
def force_decode(self, text):
... |
Add proper css classes to action buttons | from django.utils.translation import ugettext as _
from achilles import blocks, tables
import nazs
register = blocks.Library('core')
@register.block(template_name='web/core/welcome.html')
def home():
return {'version': nazs.__version__}
@register.block(template_name='web/core/apply_button.html')
def apply_but... | from django.utils.translation import ugettext as _
from achilles import blocks, tables
import nazs
register = blocks.Library('core')
@register.block(template_name='web/core/welcome.html')
def home():
return {'version': nazs.__version__}
@register.block(template_name='web/core/apply_button.html')
def apply_but... |
Add notifications count to global envar | # -*- coding: utf8 -*-
"""Jinja globals module for pybossa-discourse."""
from flask import Markup, request
from . import discourse_client
class DiscourseGlobals(object):
"""A class to implement Discourse Global variables."""
def __init__(self, app):
self.url = app.config['DISCOURSE_URL']
app... | # -*- coding: utf8 -*-
"""Jinja globals module for pybossa-discourse."""
from flask import Markup, request
class DiscourseGlobals(object):
"""A class to implement Discourse Global variables."""
def __init__(self, app):
self.url = app.config['DISCOURSE_URL']
app.jinja_env.globals.update(disco... |
Send email to acadoffice when user acknowledge his AWS.
Former-commit-id: 3285ac8554522192665d8a9d65ffd3d25240fd35
Former-commit-id: c262a061a641e53d217875a578a08ca0584cfc74 | <?php
include_once( "header.php" );
include_once( "methods.php" );
include_once( 'tohtml.php' );
include_once( "check_access_permissions.php" );
mustHaveAnyOfTheseRoles( Array( 'USER' ) );
echo userHTML( );
$user = $_SESSION[ 'user' ];
if( $_POST )
{
$data = array( 'speaker' => $user );
$data = array_merge( ... | <?php
include_once( "header.php" );
include_once( "methods.php" );
include_once( 'tohtml.php' );
include_once( "check_access_permissions.php" );
mustHaveAnyOfTheseRoles( Array( 'USER' ) );
echo userHTML( );
$user = $_SESSION[ 'user' ];
if( $_POST )
{
$data = array( 'speaker' => $user );
$data = array_merge( ... |
Disable animation effects on barogram. | import React, { PropTypes } from 'react';
import Chart from 'chart.js';
class LineChart extends React.Component {
constructor(props, context) {
super(props, context);
}
componentDidMount() {
const { data } = this.props;
this.chart = new Chart(this.chartCanvas, {
type: 'line',
data: {
... | import React, { PropTypes } from 'react';
import Chart from 'chart.js';
class LineChart extends React.Component {
constructor(props, context) {
super(props, context);
}
componentDidMount() {
const { data } = this.props;
this.chart = new Chart(this.chartCanvas, {
type: 'line',
data: {
... |
Change timeout for events reporting | // Requires
var _ = require('underscore');
var wireFriendly = require('../utils').wireFriendly;
var timestamp = require('../utils').timestamp;
function setup(options, imports, register) {
// Import
var events = imports.events;
var workspace = imports.workspace;
var hooks = imports.hooks;
var logg... | // Requires
var _ = require('underscore');
var wireFriendly = require('../utils').wireFriendly;
var timestamp = require('../utils').timestamp;
function setup(options, imports, register) {
// Import
var events = imports.events;
var workspace = imports.workspace;
var hooks = imports.hooks;
var logg... |
Fix res returned on delegate | # -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: David Coninckx <david@coninckx.com>
#
# The licence is in the file __ope... | # -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: David Coninckx <david@coninckx.com>
#
# The licence is in the file __ope... |
Introduce optional into the configuration util to simplify the code
Signed-off-by: l-1sqared <927badf1468b689b17391b1b1cb5895e9b797b96@users.noreply.github.com> | package com.tngtech.jgiven.config;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.tngtech.jgiven.annotation.JGivenConfiguration;
import com.tngtech.jgiven.impl.util.ReflectionUtil;
import java.util.Optional;
import java.u... | package com.tngtech.jgiven.config;
import java.util.concurrent.ExecutionException;
import com.google.common.base.Throwables;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import com.tngtech.jgiven.annotation.JGivenConfiguration;
i... |
Return xls as type for application/vnd.ms-excel. | (function(module) {
module.directive("displayFileContents", displayFileContentsDirective);
function displayFileContentsDirective() {
return {
restrict: "E",
controller: 'DisplayFileContentsDirectiveController',
controllerAs: 'view',
bindToController: true,... | (function(module) {
module.directive("displayFileContents", displayFileContentsDirective);
function displayFileContentsDirective() {
return {
restrict: "E",
controller: 'DisplayFileContentsDirectiveController',
controllerAs: 'view',
bindToController: true,... |
Create the directory before calling the startprojcet command | import os
import logging
from django.core.management.base import BaseCommand
from optparse import make_option
class Command(BaseCommand):
help = "Init the static site project"
args = '[directory]'
option_list = (
make_option(
'--title', '-t', dest='title', default='Default site',
... | import os
from optparse import make_option
from django.core.management.base import BaseCommand
class Command(BaseCommand):
help = "Init the static site project"
args = '[directory]'
option_list = (
make_option(
'--title', '-t', dest='title', default='Default site',
help=... |
Fix for error: Cannot find module '../modules' when --ls specified. | #!/usr/bin/env node
var fs = require('fs');
var version = JSON.parse(fs.readFileSync(__dirname + '/../package.json', 'utf8')).version
var opt = require('optimist')
.usage('jQuery Builder '+ version +'\nUsage: $0')
.options('e', {
alias: 'exclude',
describe: 'Modules to exclude [module,module]',
... | #!/usr/bin/env node
var fs = require('fs');
var version = JSON.parse(fs.readFileSync(__dirname + '/../package.json', 'utf8')).version
var opt = require('optimist')
.usage('jQuery Builder '+ version +'\nUsage: $0')
.options('e', {
alias: 'exclude',
describe: 'Modules to exclude [module,module]',
... |
Make tests fail if jshint does not pass correctly | var gulp = require('gulp');
var jshint = require('gulp-jshint');
var concat = require('gulp-concat');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var sourcemaps = require('gulp-sourcemaps');
var coveralls = require('gulp-coveralls');
var del = require('del');
gulp.task('clean', function()... | var gulp = require('gulp');
var jshint = require('gulp-jshint');
var concat = require('gulp-concat');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var sourcemaps = require('gulp-sourcemaps');
var coveralls = require('gulp-coveralls');
var del = require('del');
gulp.task('clean', function()... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.