text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Change openness users icon by unlock icon | import React from 'react'
import PieChart from '../../Charts/PieChart/PieChart'
import BarChart from '../../Charts/BarChart/BarChart'
import Percent from '../../Statistics/Percent/Percent'
const StatisticsSection = ({metrics}) => {
return (
<div className="ui equal width center aligned stackable grid">
... | import React from 'react'
import PieChart from '../../Charts/PieChart/PieChart'
import BarChart from '../../Charts/BarChart/BarChart'
import Percent from '../../Statistics/Percent/Percent'
const StatisticsSection = ({metrics}) => {
return (
<div className="ui equal width center aligned stackable grid">
... |
Increase chan buffer size in snake observer | package observers
import (
"github.com/sirupsen/logrus"
"github.com/ivan1993spb/snake-server/objects/corpse"
"github.com/ivan1993spb/snake-server/objects/snake"
"github.com/ivan1993spb/snake-server/world"
)
const chanSnakeObserverEventsBuffer = 64
type SnakeObserver struct{}
func (SnakeObserver) Observe(stop <... | package observers
import (
"github.com/sirupsen/logrus"
"github.com/ivan1993spb/snake-server/objects/corpse"
"github.com/ivan1993spb/snake-server/objects/snake"
"github.com/ivan1993spb/snake-server/world"
)
const chanSnakeObserverEventsBuffer = 32
type SnakeObserver struct{}
func (SnakeObserver) Observe(stop <... |
Add matter, generate and help commands to switch | #!/usr/bin/env node
'use strict';
var pkg = require('../package.json');
var docopt = require('docopt').docopt;
var updateNotifier = require('update-notifier');
updateNotifier({ pkg }).notify();
var doc = `
usage: collider [--version] [--help] <command> [<args>...]
options:
-h, --help Show help information.
... | #!/usr/bin/env node
'use strict';
var pkg = require('../package.json');
var docopt = require('docopt').docopt;
var updateNotifier = require('update-notifier');
updateNotifier({ pkg }).notify();
var doc = `
usage: collider [--version] [--help] <command> [<args>...]
options:
-h, --help Show help information.
... |
Remove vaccine from redux store persistance blacklist | /**
* mSupply Mobile
* Sustainable Solutions (NZ) Ltd. 2020
*/
import Bugsnag from '@bugsnag/react-native';
import AsyncStorage from '@react-native-community/async-storage';
import { persistStore, persistReducer } from 'redux-persist';
import { applyMiddleware, createStore } from 'redux';
import thunk from 'redux-th... | /**
* mSupply Mobile
* Sustainable Solutions (NZ) Ltd. 2020
*/
import Bugsnag from '@bugsnag/react-native';
import AsyncStorage from '@react-native-community/async-storage';
import { persistStore, persistReducer } from 'redux-persist';
import { applyMiddleware, createStore } from 'redux';
import thunk from 'redux-th... |
Increase some intervals to further reduce stress on the jobtracker.
git-svn-id: 4d48d1092ee340c9ada5711cdbe4355b138bc22b@383623 13f79535-47bb-0310-9956-ffa450edef68 | /**
* Copyright 2005 The Apache Software Foundation
*
* 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 applicab... | /**
* Copyright 2005 The Apache Software Foundation
*
* 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 applicab... |
Test we have access to envvar when we have no file | # coding: utf-8
import os
import pytest
from mock import patch
from decouple import AutoConfig
def test_autoconfig_env():
config = AutoConfig()
path = os.path.join(os.path.dirname(__file__), 'autoconfig', 'env', 'project')
with patch.object(config, '_caller_path', return_value=path):
assert 'ENV' ... | # coding: utf-8
import os
import pytest
from mock import patch
from decouple import AutoConfig
def test_autoconfig_env():
config = AutoConfig()
path = os.path.join(os.path.dirname(__file__), 'autoconfig', 'env', 'project')
with patch.object(config, '_caller_path', return_value=path):
assert 'ENV' ... |
Add js tasks to fabric update | # -*- coding: utf-8 -*-
u"""
.. module:: fabfile
Be aware, that becaus fabric doesn't support py3k You need to execute this
particular script using Python 2.
"""
import contextlib
from fabric.api import cd
from fabric.api import env
from fabric.api import prefix
from fabric.api import run
env.user = 'root'
env.host... | # -*- coding: utf-8 -*-
u"""
.. module:: fabfile
Be aware, that becaus fabric doesn't support py3k You need to execute this
particular script using Python 2.
"""
import contextlib
from fabric.api import cd
from fabric.api import env
from fabric.api import prefix
from fabric.api import run
env.user = 'root'
env.host... |
Update zopfli binary URL to the latest commit
https://github.com/google/zopfli/commit/64c6f362fefd56dccbf31906fdb3e31f6a6faf80 | 'use strict';
const BinBuild = require('bin-build');
const log = require('logalot');
const bin = require('.');
bin.run(['--help'], err => {
if (err) {
log.warn(err.message);
log.warn('zopflipng pre-build test failed');
log.info('compiling from source');
let makeBin = 'make';
let makeArgs = '';
if (proce... | 'use strict';
const BinBuild = require('bin-build');
const log = require('logalot');
const bin = require('.');
bin.run(['--help'], err => {
if (err) {
log.warn(err.message);
log.warn('zopflipng pre-build test failed');
log.info('compiling from source');
let makeBin = 'make';
let makeArgs = '';
if (proce... |
Add onerror retry for flag loader | import {generateQuizOptions} from '../data/quiz';
export const SELECT_COUNTRY = 'SELECT_COUNTRY';
export const SET_QUIZ = 'SET_QUIZ';
export const setQuiz = (quiz) => ({
type: SET_QUIZ,
payload: quiz
});
export const loadImg = (src) => {
return new Promise((resolve, reject) => {
const img = new Image();
... | import {generateQuizOptions} from '../data/quiz';
export const SELECT_COUNTRY = 'SELECT_COUNTRY';
export const SET_QUIZ = 'SET_QUIZ';
export const setQuiz = (quiz) => ({
type: SET_QUIZ,
payload: quiz
});
export const fetchFlag = (country) => {
return new Promise(resolve => {
const flag = new Image();
f... |
Add tweet and like interval | // This module is the server of my site.
// Require external dependecies.
var http = require('http');
var filed = require('filed');
var path = require('path');
var readFile = require('fs').readFile;
var publish = require('./publish');
var bake = require('blake').bake;
// Start the site.
module.exports = function (con... | // This module is the server of my site.
// Require external dependecies.
var http = require('http');
var filed = require('filed');
var path = require('path');
var readFile = require('fs').readFile;
var publish = require('./publish');
// Start the site.
module.exports = function (config) {
var isInvalid
= !conf... |
Add more private pages to access denied list | /*****************************************************************************/
/* Client and Server Routes */
/*****************************************************************************/
Router.configure({
layoutTemplate: 'MasterLayout',
loadingTemplate: 'Loading',
notFoundTemplate: 'NotFound'
});
Router.rou... | /*****************************************************************************/
/* Client and Server Routes */
/*****************************************************************************/
Router.configure({
layoutTemplate: 'MasterLayout',
loadingTemplate: 'Loading',
notFoundTemplate: 'NotFound'
});
Router.rou... |
Rename misleading parameter name: UnicodeDictReader should have the same interface as csv.DictReader | # work around python2's csv.py's difficulty with utf8
# partly cribbed from http://stackoverflow.com/questions/5478659/python-module-like-csv-dictreader-with-full-utf8-support
import csv
class EmptyCSVError(Exception):
pass
class UnicodeDictReader(object):
def __init__(self, fp, encoding='utf8', **kwargs):
... | # work around python2's csv.py's difficulty with utf8
# partly cribbed from http://stackoverflow.com/questions/5478659/python-module-like-csv-dictreader-with-full-utf8-support
import csv
class EmptyCSVError(Exception):
pass
class UnicodeDictReader(object):
def __init__(self, file_or_str, encoding='utf8', **... |
Revert some stuff due to an issue where artisan would eager load all providers, causing an issue here.
Signed-off-by: crynobone <e1a543840a942eb68427510a8a483282a7bfeddf@gmail.com> | <?php namespace Orchestra\Foundation\Providers;
use Illuminate\Support\ServiceProvider;
class ExtensionServiceProvider extends ServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var boolean
*/
protected $defer = true;
/**
* Available orchestra extensio... | <?php namespace Orchestra\Foundation\Providers;
use Illuminate\Support\ServiceProvider;
class ExtensionServiceProvider extends ServiceProvider
{
/**
* Indicates if loading of the provider is deferred.
*
* @var boolean
*/
protected $defer = true;
/**
* Available orchestra extensio... |
Fix this janky script and autoformat. | $(document).ready(function() {
$('a.menu').click(function() {
$('.site-header nav').slideToggle(100);
return false;
});
$(window).resize(function() {
var w = $(window).width();
var menu = $('.site-header nav');
if (w > 680 && menu.is(':hidden')) {
menu.removeAttr('style');
}
});
... | $(document).ready(function() {
$('a.menu').click(function() {
$('.site-header nav').slideToggle(100);
return false;
});
$(window).resize(function(){
var w = $(window).width();
var menu = $('.site-header nav');
if(w > 680 && menu.is(':hidden')) {
menu.removeAttr('style');
}
});
... |
Install the treepriors package along with everything else. Feels very wrong that these need to be manually declared one-by-one, but oh well. | #!/usr/bin/env python
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
from beastling import __version__ as version
requires = [
'six',
'newick>=0.6.0',
'appdirs',
'clldutils~=2.0',
'pycldf',
]
setup(
name='beastling',
version=version,
d... | #!/usr/bin/env python
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
from beastling import __version__ as version
requires = [
'six',
'newick>=0.6.0',
'appdirs',
'clldutils~=2.0',
'pycldf',
]
setup(
name='beastling',
version=version,
d... |
Add id of node generating the supervisor event | #!/usr/bin/env python
import json
import sys
from utils import serf_event
def write_stdout(s):
sys.stdout.write(s)
sys.stdout.flush()
def write_stderr(s):
sys.stderr.write(s)
sys.stderr.flush()
def main():
while True:
write_stdout('READY\n') # transition from ACKNOWLEDGED to READY
... | #!/usr/bin/env python
import json
import sys
from utils import serf_event
def write_stdout(s):
sys.stdout.write(s)
sys.stdout.flush()
def write_stderr(s):
sys.stderr.write(s)
sys.stderr.flush()
def main():
while True:
write_stdout('READY\n') # transition from ACKNOWLEDGED to READY
... |
Fix problem with highlighting tokens after whitespace | CodeMirror.defineMode("roy", function(config, parserConfig) {
return {
token: function(stream, state) {
var token, sliced = stream.string.slice(stream.pos);
try {
token = roy.lexer.tokenise(sliced)[0];
if(!token[1].length) {
stream.next();
return;
}
... | CodeMirror.defineMode("roy", function(config, parserConfig) {
return {
token: function(stream, state) {
var token;
try {
token = roy.lexer.tokenise(stream.string.slice(stream.pos))[0];
if(!token[1].length) {
stream.next();
return;
}
stream.pos += tok... |
Add description to ethnicity model | # -*- coding: utf-8 -*-
# #############################################################################
#
# Tech-Receptives Solutions Pvt. Ltd.
# Copyright (C) 2004-TODAY Tech-Receptives(<http://www.techreceptives.com>)
# Special Credit and Thanks to Thymbra Latinoamericana S.A.
#
# This program is free softwa... | # -*- coding: utf-8 -*-
# #############################################################################
#
# Tech-Receptives Solutions Pvt. Ltd.
# Copyright (C) 2004-TODAY Tech-Receptives(<http://www.techreceptives.com>)
# Special Credit and Thanks to Thymbra Latinoamericana S.A.
#
# This program is free softwa... |
Fix spelling of HTTP referer header | /*
* Copyright (c) 2014-2020 Bjoern Kimminich.
* SPDX-License-Identifier: MIT
*/
const models = require('../models/index')
const insecurity = require('../lib/insecurity')
const utils = require('../lib/utils')
const cache = require('../data/datacache')
const challenges = cache.challenges
module.exports = function u... | /*
* Copyright (c) 2014-2020 Bjoern Kimminich.
* SPDX-License-Identifier: MIT
*/
const models = require('../models/index')
const insecurity = require('../lib/insecurity')
const utils = require('../lib/utils')
const cache = require('../data/datacache')
const challenges = cache.challenges
module.exports = function u... |
Use a more randomly made number for the system | package com.skelril.aurora.util;
import java.util.Random;
/**
* @author Turtle9598
*/
public class ChanceUtil {
private static Random r = new Random(1374633257);
public static int getRandom(int highestValue) {
return highestValue < 0 ? (r.nextInt(highestValue * -1) + 1) * -1 : r.nextInt(highestVa... | package com.skelril.aurora.util;
import java.util.Random;
/**
* @author Turtle9598
*/
public class ChanceUtil {
private static Random r = new Random(8888);
public static int getRandom(int highestValue) {
return highestValue < 0 ? (r.nextInt(highestValue * -1) + 1) * -1 : r.nextInt(highestValue) +... |
Update problem 67 to be legible | # Project Euler Problem 67
def import_triangle():
with open('problem67.txt') as f:
# Split each line by spaces and convert to integers
return [list(map(int, line.split(' '))) for line in f]
# The max of this row is the maximum sum up to its parent items plus the value
# in this row. But no... | # Project Euler Problem 67
# Created on: 2012-06-18
# Created by: William McDonald
def importTri():
t = []
f = open("problem67.txt")
for line in f:
t.append(map(int, line.split(" ")))
return t
def getMax(lm, cur):
l = len(cur) - 1
maxL = [lm[0] + cur[0]]
i = 1
wh... |
Add parse error test for bad URL case | package kitsu
import (
"net/url"
"testing"
)
func TestNewClient(t *testing.T) {
c := NewClient(nil)
if got, want := c.BaseURL.String(), defaultBaseURL; got != want {
t.Errorf("NewClient BaseURL is %v, want %v", got, want)
}
}
func TestClient_NewRequest(t *testing.T) {
c := NewClient(nil)
inURL, outURL := ... | package kitsu
import "testing"
func TestNewClient(t *testing.T) {
c := NewClient(nil)
if got, want := c.BaseURL.String(), defaultBaseURL; got != want {
t.Errorf("NewClient BaseURL is %v, want %v", got, want)
}
}
func TestNewRequest(t *testing.T) {
c := NewClient(nil)
inURL, outURL := "/foo", defaultBaseURL+... |
Add support for brotli content encoding and alias for none | from setuptools import setup
setup(
name='icapservice',
version='0.2.0',
description='ICAP service library for Python',
author='Giles Brown',
author_email='giles_brown@hotmail.com',
url='https://github.com/gilesbrown/icapservice',
license='MIT',
packages=['icapservice'],
zip_safe=F... | from setuptools import setup
setup(
name='icapservice',
version='0.1.1',
description='ICAP service library for Python',
author='Giles Brown',
author_email='giles_brown@hotmail.com',
url='https://github.com/gilesbrown/icapservice',
license='MIT',
packages=['icapservice'],
zip_safe=F... |
Fix testing if element exists. | $(function() {
var cookieName = '_wheelmap_splash_seen';
var setCookie = function() {
$.cookie(cookieName, true, { expires: 1000 });
};
if(!$.cookie(cookieName)) {
var width = 600; // splash width
// calculate left edge so it is centered
var left = (0.5 - (width / 2)/($(window).width())) * 100... | $(function() {
var cookieName = '_wheelmap_splash_seen';
var setCookie = function() {
$.cookie(cookieName, true, { expires: 1000 });
};
if(!$.cookie(cookieName)) {
var width = 600; // splash width
// calculate left edge so it is centered
var left = (0.5 - (width / 2)/($(window).width())) * 100... |
Check query string for access_token before checking in headers | module.exports = function (req) {
function getParam(paramName) {
if (req.query && typeof req.query[paramName] !== 'undefined')
return req.query[paramName];
else if (req.body && typeof req.body[paramName] !== 'undefined')
return req.body[paramName];
else
return null;
};
function getAccessToken() {
i... | module.exports = function (req) {
function getParam(paramName) {
if (req.query && typeof req.query[paramName] !== 'undefined')
return req.query[paramName];
else if (req.body && typeof req.body[paramName] !== 'undefined')
return req.body[paramName];
else
return null;
};
function getAccessToken() {
i... |
Add load communication in /jobs | <?php
/**
Copyright (C) 2010-2016 by the FusionInventory Development Team
Copyright (C) 2016 Teclib'
This file is part of Armadito Plugin for GLPI.
Armadito Plugin for GLPI is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published ... | <?php
/**
Copyright (C) 2010-2016 by the FusionInventory Development Team
Copyright (C) 2016 Teclib'
This file is part of Armadito Plugin for GLPI.
Armadito Plugin for GLPI is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published ... |
Add raw option (even if ignored by esprima 1.1.x) | /**
* power-assert - Empower your assertions
*
* https://github.com/twada/power-assert
*
* Copyright (c) 2013-2014 Takuto Wada
* Licensed under the MIT license.
* https://raw.github.com/twada/power-assert/master/MIT-LICENSE.txt
*/
var espower = require('espower'),
esprima = require('esprima'),
escodeg... | /**
* power-assert - Empower your assertions
*
* https://github.com/twada/power-assert
*
* Copyright (c) 2013-2014 Takuto Wada
* Licensed under the MIT license.
* https://raw.github.com/twada/power-assert/master/MIT-LICENSE.txt
*/
var espower = require('espower'),
esprima = require('esprima'),
escodeg... |
Update delayJob test to use TimeKeeper | 'use strict';
require('../helpers');
const assert = require('assert');
const Ironium = require('../..');
const ms = require('ms');
const TimeKeeper = require('timekeeper');
describe('Queue with delay', function() {
const captureQueue = Ironium.queue('capture');
// Capture processed jobs here.... | 'use strict';
require('../helpers');
const assert = require('assert');
const Ironium = require('../..');
describe('Queue with delay', function() {
const captureQueue = Ironium.queue('capture');
// Capture processed jobs here.
const processed = [];
before(function() {
captureQueue.eachJob(function(job)... |
Enable markdown for PyPI README | import subprocess
import sys
from setuptools import Command, setup
class RunTests(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
errno = subprocess.call([sys.executable, '-m', 'unittest', 'parserutils.tests.tes... | import subprocess
import sys
from setuptools import Command, setup
class RunTests(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
errno = subprocess.call([sys.executable, '-m', 'unittest', 'parserutils.tests.tes... |
Add object method instead of the property | const Reporter = require('./src/Reporter');
const PostReporter = require('./src/PostReport');
const Verification = require('./src/Verification');
const Joi = require('joi');
module.exports = [
{
method: 'GET',
path: '/report/',
handler: Reporter,
config: {
validate: {
query: {
... | const Reporter = require('./src/Reporter');
const PostReporter = require('./src/PostReport');
const Verification = require('./src/Verification');
const Joi = require('joi');
module.exports = [
{
method: 'GET',
path: '/report/',
handler: Reporter,
config: {
validate: {
query: {
... |
Migrate link tests to pytest | from unittest.mock import MagicMock
from buffpy.models.link import Link
def test_links_shares():
""" Test link"s shares retrieving from constructor. """
mocked_api = MagicMock()
mocked_api.get.return_value = {"shares": 123}
link = Link(api=mocked_api, url="www.google.com")
assert link["shares"... | from nose.tools import eq_
from mock import MagicMock
from buffpy.models.link import Link
def test_links_shares():
'''
Test link's shares retrieving from constructor
'''
mocked_api = MagicMock()
mocked_api.get.return_value = {'shares': 123}
link = Link(api=mocked_api, url='www.google.com')
eq_(link... |
refactor(settings): Remove extra withTheme hoc on styled components. | /* @flow */
import React from 'react'
import styled from 'styled-components'
import Label from 'components/Label'
import Input from 'components/Input'
import editable from 'hoc/editable'
type Props = {
name: string,
onChange: Function
}
const Editable = editable(
styled.div`
position: relative;
line-hei... | /* @flow */
import React from 'react'
import styled, { withTheme } from 'styled-components'
import Label from 'components/Label'
import Input from 'components/Input'
import editable from 'hoc/editable'
type Props = {
name: string,
onChange: Function
}
const Editable = editable(
withTheme(styled.div`
positio... |
migrations: Disable atomic for delivery_email migration.
I'm not sure theoretically why this should be required only for some
installations, but these articles all suggest the root problem is
doing these two migrations together atomically (creating the field and
setting a value for it), so the right answer is to decla... | # -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-07-05 17:57
from __future__ import unicode_literals
from django.db import migrations, models
from django.apps import apps
from django.db.models import F
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
from django.db.migration... | # -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-07-05 17:57
from __future__ import unicode_literals
from django.db import migrations, models
from django.apps import apps
from django.db.models import F
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
from django.db.migration... |
Put language modal in alphabetical order LMS-2302 | """
Models for the dark-launching languages
"""
from django.db import models
from config_models.models import ConfigurationModel
class DarkLangConfig(ConfigurationModel):
"""
Configuration for the dark_lang django app
"""
released_languages = models.TextField(
blank=True,
help_text="A... | """
Models for the dark-launching languages
"""
from django.db import models
from config_models.models import ConfigurationModel
class DarkLangConfig(ConfigurationModel):
"""
Configuration for the dark_lang django app
"""
released_languages = models.TextField(
blank=True,
help_text="A... |
fix(checkbox): Change default value for indeterminate | import {CheckableComponentViewModel} from './mdc-knockout-base';
import template from './templates/checkbox.html';
export default class CheckboxViewModel extends CheckableComponentViewModel {
initialize () {
const checked = this.bindings.checked;
const instance = this.instance();
instance.indeterminate =... | import {CheckableComponentViewModel} from './mdc-knockout-base';
import template from './templates/checkbox.html';
export default class CheckboxViewModel extends CheckableComponentViewModel {
initialize () {
const checked = this.bindings.checked;
const instance = this.instance();
instance.indeterminate =... |
Increase Core and Maximum ThreadPool Size | package sg.ncl;
import nz.net.ultraq.thymeleaf.LayoutDialect;
import org.springframework.boot.autoconfigure.web.ErrorAttributes;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
imp... | package sg.ncl;
import nz.net.ultraq.thymeleaf.LayoutDialect;
import org.springframework.boot.autoconfigure.web.ErrorAttributes;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
imp... |
Update capabilities to fix fetch detection in chrome
Spec now uses ReadableStream rather than ReadableByteStream. In chrome ReadableByteStream is no longer available on window so the existing check in capabilities for fetch was failing. The fix is to check both. | exports.fetch = isFunction(window.fetch) && (isFunction(window.ReadableStream) || isFunction(window.ReadableByteStream))
exports.blobConstructor = false
try {
new Blob([new ArrayBuffer(1)])
exports.blobConstructor = true
} catch (e) {}
var xhr = new window.XMLHttpRequest()
xhr.open('GET', '/')
function checkTypeSu... | exports.fetch = isFunction(window.fetch) && isFunction(window.ReadableByteStream)
exports.blobConstructor = false
try {
new Blob([new ArrayBuffer(1)])
exports.blobConstructor = true
} catch (e) {}
var xhr = new window.XMLHttpRequest()
xhr.open('GET', '/')
function checkTypeSupport (type) {
try {
xhr.responseTyp... |
Use an atomic update operation | // TODO: should the baseScore be stored, and updated at vote time?
// This interface should change and become more OO, this'll do for now
var Scoring = {
// re-run the scoring algorithm on a single object
updateObject: function(object) {
// just count the number of votes for now
var baseScore = object... | // TODO: should the baseScore be stored, and updated at vote time?
// This interface should change and become more OO, this'll do for now
var Scoring = {
// re-run the scoring algorithm on a single object
updateObject: function(object) {
// just count the number of votes for now
var baseScore = MyVote... |
Set comp info boxes opened as default | 'use strict';
angular.module('konehuone.competitionInfos')
.controller('CompetitionInfosCtrl', function ($scope, lodash, apiService) {
var _ = lodash;
// # Variables
$scope.uiClosed = {
jj1: false,
jj2: false,
rc: false
};
$scope.compData = {};
$scope.igImages = [];
... | 'use strict';
angular.module('konehuone.competitionInfos')
.controller('CompetitionInfosCtrl', function ($scope, lodash, apiService) {
var _ = lodash;
// # Variables
$scope.uiClosed = {
jj1: true,
jj2: true,
rc: true
};
$scope.compData = {};
$scope.igImages = [];
... |
Fix bug where admin panel was redirected to semesterpage app | """kokekunster URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class... | """kokekunster URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class... |
Revert "Don't start crash reporter on Windows."
This reverts commit 684f15ab89eae5088688955721876271798d9b38. | window.onload = function() {
var path = require('path');
var ipc = require('ipc');
try {
// Skip "?loadSettings=".
var loadSettings = JSON.parse(decodeURIComponent(location.search.substr(14)));
// Start the crash reporter before anything else.
require('crash-reporter').start({
productName: ... | window.onload = function() {
var path = require('path');
var ipc = require('ipc');
try {
// Skip "?loadSettings=".
var loadSettings = JSON.parse(decodeURIComponent(location.search.substr(14)));
// Start the crash reporter before anything else.
if (process.platform != 'win32')
require('crash... |
Save output language after conversion. | /*
Extracts the code elements and returns array of source-code and code elements
*/
export default function convertSourceCode(el, converter) {
let miniSource = el.find('code[language=mini]')
let nativeSource = el.find('code:not([language=mini])')
let output = el.find('code[specific-use=output]')
let miniSourc... | /*
Extracts the code elements and returns array of source-code and code elements
*/
export default function convertSourceCode(el, converter) {
let miniSource = el.find('code[language=mini]')
let nativeSource = el.find('code:not([language=mini])')
let output = el.find('code[specific-use=output]')
let miniSourc... |
Handle case where rule shows before severity
Thank you @suprMax ! | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Jack Brewer
# Copyright (c) 2015 Jack Brewer
#
# License: MIT
"""Exports the Stylint plugin class."""
from SublimeLinter.lint import NodeLinter, util
class Stylint(NodeLinter):
"""Provides an interface to sty... | #
# linter.py
# Linter for SublimeLinter3, a code checking framework for Sublime Text 3
#
# Written by Jack Brewer
# Copyright (c) 2015 Jack Brewer
#
# License: MIT
"""Exports the Stylint plugin class."""
from SublimeLinter.lint import NodeLinter, util
class Stylint(NodeLinter):
"""Provides an interface to sty... |
Fix a wrong line problem
This problem will cause compilation error when after license header
formatting, which is caused by the package line removed. | /**
* Copyright (C) 2011-2020 Red Hat, Inc. (https://github.com/Commonjava/indy)
*
* 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
... | /**
* Copyright (C) 2011-2020 Red Hat, Inc. (https://github.com/Commonjava/indy)
*
* 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
... |
Remove temporary test for ResultDetailCtrl | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you... | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you... |
Remove self references from setup/teardown | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_get_user_config
--------------------
Tests formerly known from a unittest residing in test_config.py named
"""
import os
import shutil
import pytest
@pytest.fixture(scope='function')
def back_up_rc(request):
"""
Back up an existing cookiecutter rc and ... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_get_user_config
--------------------
Tests formerly known from a unittest residing in test_config.py named
"""
import pytest
@pytest.fixture(scope='function')
def back_up_rc(request):
"""
Back up an existing cookiecutter rc and restore it after the tes... |
Set up the production environment of heap analytics instead of development | window.heap = window.heap || [], heap.load = function(t, e) {
window.heap.appid = t, window.heap.config = e;
var a = document.createElement("script");
a.type = "text/javascript", a.async = !0, a.src = ("https:" === document.location.protocol ? "https:" : "http:") + "//cdn.heapanalytics.com/js/heap.js";
... | window.heap = window.heap || [], heap.load = function(t, e) {
window.heap.appid = t, window.heap.config = e;
var a = document.createElement("script");
a.type = "text/javascript", a.async = !0, a.src = ("https:" === document.location.protocol ? "https:" : "http:") + "//cdn.heapanalytics.com/js/heap.js";
... |
Make tag classes functions non-anonymous | iD.svg.TagClasses = function() {
var keys = iD.util.trueObj([
'highway', 'railway', 'motorway', 'amenity', 'natural',
'landuse', 'building', 'oneway', 'bridge'
]), tagClassRe = /^tag-/;
return function tagClassesSelection(selection) {
selection.each(function tagClassesEach(d, i) {
... | iD.svg.TagClasses = function() {
var keys = iD.util.trueObj([
'highway', 'railway', 'motorway', 'amenity', 'natural',
'landuse', 'building', 'oneway', 'bridge'
]), tagClassRe = /^tag-/;
return function(selection) {
selection.each(function(d, i) {
var classes, value = thi... |
Improve thread safety around adding and removing IDataListener's
Previously deadlock was possible if a listener was running in the same
thread as a call attempting to add or remove listeners. As might be
commonly the case for the UI thread.
Also replaced the listeners List with a Set to prevent duplicate
listeners be... | /*-
* Copyright 2015, 2016 Diamond Light Source Ltd.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.... | /*-
* Copyright 2015, 2016 Diamond Light Source Ltd.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.... |
Update the comment for VcapPassword | package common
import (
bosherr "github.com/cloudfoundry/bosh-utils/errors"
)
type AgentOptions struct {
// e.g. "https://user:password@127.0.0.1:4321/agent"
Mbus string
// e.g. ["0.us.pool.ntp.org"]. Ok to be empty
NTP []string
Blobstore BlobstoreOptions
//The SHA-512 encrypted vcap password
VcapPassword ... | package common
import (
bosherr "github.com/cloudfoundry/bosh-utils/errors"
)
type AgentOptions struct {
// e.g. "https://user:password@127.0.0.1:4321/agent"
Mbus string
// e.g. ["0.us.pool.ntp.org"]. Ok to be empty
NTP []string
Blobstore BlobstoreOptions
//vcap password
VcapPassword string
}
type Registr... |
Compress Discord event connectors into single function | """
byceps.announce.discord.connections
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Announce events on Discord.
:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from typing import Optional
from ...events.base import _BaseEvent
from ...events.board import BoardPostingCrea... | """
byceps.announce.discord.connections
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Announce events on Discord.
:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Revised BSD (see `LICENSE` file for details)
"""
from typing import Optional
from ...events.board import BoardPostingCreated, BoardTopicCreated
from ...events.... |
Fix app constructor not being exported | var express = require('express');
var serveStatic = require('serve-static');
var bodyParser = require('body-parser');
var session = require('express-session');
var RedisStore = require('connect-redis')(session);
function appCtor(cfg, pool) {
var app = express();
app.set('trust proxy', true);
app.set('view engin... | var express = require('express');
var serveStatic = require('serve-static');
var bodyParser = require('body-parser');
var session = require('express-session');
var RedisStore = require('connect-redis')(session);
function appCtor(cfg, pool) {
var app = express();
app.set('trust proxy', true);
app.set('view engin... |
Add empty check to earliestMatchingOrder query. This was throwing an error when the subscription was brand-new and had no orders yet | <?php
class Infusionsoft_RecurringOrder extends Infusionsoft_Generated_RecurringOrder{
var $customFieldFormId = -10;
public function __construct($id = null, $app = null){
parent::__construct($id, $app);
}
//Find the Id first order charged for this subscription
public static f... | <?php
class Infusionsoft_RecurringOrder extends Infusionsoft_Generated_RecurringOrder{
var $customFieldFormId = -10;
public function __construct($id = null, $app = null){
parent::__construct($id, $app);
}
//Find the Id first order charged for this subscription
public static f... |
[TEXT-113] Add an interpolator string lookup. No long needs to subclass
StrLookup. | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache license, Version 2.0
* (the "License"); you ... | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache license, Version 2.0
* (the "License"); you ... |
Replace enum34 with enum-compat to allow use with Py3.6+ | #!/usr/bin/env python
from setuptools import setup
from Registry import _version_
setup(name='python-registry',
version=_version_,
description='Read access to Windows Registry files.',
author='Willi Ballenthin',
author_email='willi.ballenthin@gmail.com',
url='http://www.williballenthin.c... | #!/usr/bin/env python
from setuptools import setup
from Registry import _version_
setup(name='python-registry',
version=_version_,
description='Read access to Windows Registry files.',
author='Willi Ballenthin',
author_email='willi.ballenthin@gmail.com',
url='http://www.williballenthin.c... |
Implement 'Delete' action for polls sample app | from django.shortcuts import render
from django.core.urlresolvers import reverse_lazy
from singleurlcrud.views import CRUDView
from .models import *
# Create your views here.
class AuthorCRUDView(CRUDView):
model = Author
list_display = ('name',)
class QuestionCRUDView(CRUDView):
model = Question
lis... | from django.shortcuts import render
from django.core.urlresolvers import reverse_lazy
from singleurlcrud.views import CRUDView
from .models import *
# Create your views here.
class AuthorCRUDView(CRUDView):
model = Author
list_display = ('name',)
class QuestionCRUDView(CRUDView):
model = Question
lis... |
Update procedure to restart controller on quarantined condition.
There was a behavior change in Karaf [0] because of which restarting
the container now requires the system property karaf.restart to be
set to true in addition to karaf.restart.jvm property. Update
controller restart logic on quarantined condition for th... | /*
* Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
pac... | /*
* Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
pac... |
Remove music button for now | import { createDownloadMP3Button } from './youtubeinmp3';
let playerIframe;
export default function startMixerBoxMainScript() {
console.log('MixerBox+ loaded.');
playerIframe = document.getElementById('MB-player-iframe');
if (!playerIframe) {
return;
}
playerIframe.setAttribute('allowfullscreen', '');... | import { createDownloadMP3Button } from './youtubeinmp3';
let playerIframe;
export default function startMixerBoxMainScript() {
console.log('MixerBox+ loaded.');
playerIframe = document.getElementById('MB-player-iframe');
if (!playerIframe) {
return;
}
playerIframe.setAttribute('allowfullscreen', '');... |
Fix for sending XML before async call returns | "use strict";
var BlogController = require('./controllers/blog');
var BloggerController = require('./controllers/blogger');
var RSS = require('rss');
exports.serveRoutes = function(router) {
router.get('/main', function(req, res) {
var mainFeed = new RSS({
title: "CS Blogs Main Feed",
description: "All of th... | "use strict";
var BlogController = require('./controllers/blog');
var BloggerController = require('./controllers/blogger');
var RSS = require('rss');
exports.serveRoutes = function(router) {
router.get('/main', function(req, res) {
var mainFeed = new RSS({
title: "CS Blogs Main Feed",
description: "All of th... |
[NCL-3741] Remove user token from logs | import asyncio
import logging
from jose import jwt, JWTError
from repour.config import config
logger = logging.getLogger(__name__)
@asyncio.coroutine
def verify_token(token):
c = yield from config.get_configuration()
logger.info('Got token!')
OPTIONS = {
'verify_signature': True,
'veri... | import asyncio
import logging
from jose import jwt, JWTError
from repour.config import config
logger = logging.getLogger(__name__)
@asyncio.coroutine
def verify_token(token):
c = yield from config.get_configuration()
logger.info('Got token: ' + str(token))
OPTIONS = {
'verify_signature': True,... |
Use ms timestamp on log messages
The previous string was just outputting the date, which is sort of
useless. We could look into a better formatted string but for now the ms
version is actually helpful since I can better debug timing issues. | import winston from 'winston';
import Configuration from './Configuration';
import rerouteConsoleLog from './rerouteConsoleLog';
function initializeLogging(pathToLogFile) {
// The `importjs` here is mostly a dummy file because config relies on a
// `pathToCurrentFile`. Normally, this is the javascript file you ar... | import winston from 'winston';
import Configuration from './Configuration';
import rerouteConsoleLog from './rerouteConsoleLog';
function initializeLogging(pathToLogFile) {
// The `importjs` here is mostly a dummy file because config relies on a
// `pathToCurrentFile`. Normally, this is the javascript file you ar... |
Change serialization date format again | /*
* Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com)
*
* 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 b... | /*
* Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com)
*
* 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 b... |
Change New Todo to Modal. | import NavigationBar from 'react-native-navbar';
import React, { Component, PropTypes } from 'react';
import {
View,
ScrollView,
Modal,
} from 'react-native';
import {default as AddTodo} from '../components/add-todo';
class NewTodo extends Component {
constructor(props) {
super(props);
this.cancel = t... | import NavigationBar from 'react-native-navbar';
import React, { Component, PropTypes } from 'react';
import {
View,
ScrollView,
} from 'react-native';
import {default as AddTodo} from '../components/add-todo';
class NewTodo extends Component {
constructor(props) {
super(props);
this.cancel = this.backT... |
Put a blank line before section headings, courtesy spiv. | """Formatters for creating documents.
A formatter is an object which accepts an output stream (usually a file or
standard output) and then provides a structured way for writing to that stream.
All formatters should provide 'title', 'section', 'subsection' and 'paragraph'
methods which write to the stream.
"""
class ... | """Formatters for creating documents.
A formatter is an object which accepts an output stream (usually a file or
standard output) and then provides a structured way for writing to that stream.
All formatters should provide 'title', 'section', 'subsection' and 'paragraph'
methods which write to the stream.
"""
class ... |
[SMALLFIX] Use static import for standard test utilities
pr-link: Alluxio/alluxio#8981
change-id: cid-e8e2596b0f3cb68489b88cbf42646844098151dc | /*
* The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
* (the "License"). You may not use this work except in compliance with the License, which is
* available at www.apache.org/licenses/LICENSE-2.0
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDI... | /*
* The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
* (the "License"). You may not use this work except in compliance with the License, which is
* available at www.apache.org/licenses/LICENSE-2.0
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDI... |
Fix issue where add account would not appear | /*
* Copyright (C) 2012 Brian Muramatsu
*
* 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 (C) 2012 Brian Muramatsu
*
* 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... |
Set Development Status to Beta | from setuptools import setup
import os
def read(*names):
values = dict()
for name in names:
filename = name + '.rst'
if os.path.isfile(filename):
fd = open(filename)
value = fd.read()
fd.close()
else:
value = ''
values[name] = valu... | from setuptools import setup
import os
def read(*names):
values = dict()
for name in names:
filename = name + '.rst'
if os.path.isfile(filename):
fd = open(filename)
value = fd.read()
fd.close()
else:
value = ''
values[name] = valu... |
tests/initializer-addon: Use alternative blueprint test helpers | 'use strict';
var blueprintHelpers = require('ember-cli-blueprint-test-helpers/helpers');
var setupTestHooks = blueprintHelpers.setupTestHooks;
var emberNew = blueprintHelpers.emberNew;
var emberGenerateDestroy = blueprintHelpers.emberGenerateDestroy;
var chai = require('ember-cli-blueprint-test-helpers/chai');
var e... | 'use strict';
var setupTestHooks = require('ember-cli-blueprint-test-helpers/lib/helpers/setup');
var BlueprintHelpers = require('ember-cli-blueprint-test-helpers/lib/helpers/blueprint-helper');
var generateAndDestroy = BlueprintHelpers.generateAndDestroy;
describe('Acceptance: ember generate and destroy initia... |
Add support for alternate URLs for input logging (aka ec2) | /*
* config.js: Configuration information for your Loggly account.
* This information is only used for require('loggly')./\.+/ methods
*
* (C) 2010 Nodejitsu Inc.
* MIT LICENSE
*
*/
//
// function createConfig (defaults)
// Creates a new instance of the configuration
// object based on default ... | /*
* config.js: Configuration information for your Loggly account.
* This information is only used for require('loggly')./\.+/ methods
*
* (C) 2010 Nodejitsu Inc.
* MIT LICENSE
*
*/
//
// function createConfig (defaults)
// Creates a new instance of the configuration
// object based on default ... |
Define 'city' at top decorator | from functools import wraps
from django.http import HttpResponseNotFound
from django.shortcuts import redirect
from core.utils import get_event_page
def organiser_only(function):
"""
Decorator for views that checks that the user is logged in and that
they are a team member for a particular page. Returns... | from functools import wraps
from django.http import HttpResponseNotFound
from django.shortcuts import redirect
from core.utils import get_event_page
def organiser_only(function):
"""
Decorator for views that checks that the user is logged in and that
they are a team member for a particular page. Returns... |
Increase daemon shutdown timeout to 20s for slow Travis CI Windows runs | import time
import pytest
def test_version(client):
expected_keys = {"Repo", "Commit", "Version"}
resp_version = client.version()
assert set(resp_version.keys()).issuperset(expected_keys)
def test_id(client):
expected_keys = {"PublicKey", "ProtocolVersion", "ID", "AgentVersion", "Addresses"}
resp_id = client... | import time
import pytest
def test_version(client):
expected_keys = {"Repo", "Commit", "Version"}
resp_version = client.version()
assert set(resp_version.keys()).issuperset(expected_keys)
def test_id(client):
expected_keys = {"PublicKey", "ProtocolVersion", "ID", "AgentVersion", "Addresses"}
resp_id = client... |
Upgrade Django for security vulnerability | from setuptools import setup
setup(
name='tablo',
description='A PostGIS table to feature service app for Django',
keywords='feature service, map server, postgis, django',
version='1.3.0',
packages=['tablo', 'tablo.migrations', 'tablo.interfaces', 'tablo.interfaces.arcgis'],
install_requires=[
... | from setuptools import setup
setup(
name='tablo',
description='A PostGIS table to feature service app for Django',
keywords='feature service, map server, postgis, django',
version='1.3.0',
packages=['tablo', 'tablo.migrations', 'tablo.interfaces', 'tablo.interfaces.arcgis'],
install_requires=[
... |
Make accompanying changes to DB when cancelling Gift Aid declaration. | import React from 'react'
export default class GiftAidButton extends React.Component {
constructor (props) {
super (props)
this.state = { confirmation: false }
}
cancel () {
this.props.update_member_user(
{ gift_aid_cancelled: true
, date_gift_aid_cancelled: new Date().toISOString()
... | import React from 'react'
export default class GiftAidButton extends React.Component {
constructor (props) {
super (props)
this.state = { confirmation: false }
}
cancel () {
this.props.update_member_user({ gift_aid_signed: false, gift_aid_cancelled: true })
}
attempt_cancel () {
this.setSta... |
Add backwards compatibility with pip v9 | #!/usr/bin/env python
import json
import sys
try:
from pip._internal.req import parse_requirements
except ImportError:
from pip.req import parse_requirements
try:
from pip._internal.download import PipSession
except ImportError:
from pip.download import PipSession
from pip._vendor imp... | #!/usr/bin/env python
import json
import sys
from pip._internal.req import parse_requirements
from pip._internal.download import PipSession
from pip._vendor import pkg_resources
from pip._vendor.six import print_
requirements = [pkg_resources.Requirement.parse(str(req.req)) for req
in parse_requiremen... |
Add picture field in user schema
for loading from google profile data | <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function(Blueprint $table)
{
$table->increments('id');
$table->str... | <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function(Blueprint $table)
{
$table->increments('id');
$table->str... |
Disable updating serviceInfo when retrieving daily data. | #!/usr/bin/env python
import json, os, requests
from awsauth import S3Auth
key = os.environ.get('UWOPENDATA_APIKEY')
ACCESS_KEY = os.environ.get('AWS_ACCESS_KEY_ID')
SECRET_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY')
def getData(service):
payload = {'key': key, 'service': service}
r = requests.get('http://api.uwa... | #!/usr/bin/env python
import json, os, requests
from awsauth import S3Auth
key = os.environ.get('UWOPENDATA_APIKEY')
ACCESS_KEY = os.environ.get('AWS_ACCESS_KEY_ID')
SECRET_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY')
def getData(service):
payload = {'key': key, 'service': service}
r = requests.get('http://api.uwa... |
Move path strings into a config object | #!/usr/bin/env node
'use strict';
var program = require('commander')
, gulp = require('gulp')
, chalk = require('chalk')
, exec = require('exec')
, pjson = require('./package.json')
var strings = {
create: 'Creating new project',
install: 'Installing dependencies',
complete: 'Done!'
}
var pa... | #!/usr/bin/env node
'use strict';
var program = require('commander')
, gulp = require('gulp')
, chalk = require('chalk')
, exec = require('exec')
, pjson = require('./package.json')
var strings = {
create: 'Creating new project',
install: 'Installing dependencies',
complete: 'Done!'
}
functi... |
Add wait of 1 second waiting for further events | package main
import (
"fmt"
"github.com/sdegutis/go.fsevents"
"log"
"os"
"os/exec"
"time"
)
func main() {
if len(os.Args) < 3 {
fmt.Fprintln(os.Stderr, "Usage: aroc DIRECTORY|FILE COMMAND [ARGS…]")
os.Exit(1)
}
ch := fsevents.WatchPaths([]string{os.Args[1]})
var cmd *exec.Cmd
go func() {
for _ = r... | package main
import (
"fmt"
"github.com/sdegutis/go.fsevents"
"log"
"os"
"os/exec"
)
func main() {
if len(os.Args) < 3 {
fmt.Fprintln(os.Stderr, "Usage: aroc DIRECTORY|FILE COMMAND [ARGS…]")
os.Exit(1)
}
ch := fsevents.WatchPaths([]string{os.Args[1]})
var cmd *exec.Cmd
go func() {
for _ = range ch ... |
Add timeout to preview rendering | // function that reloads the DOM for
// MathJax (http://www.mathjax.org/docs/1.1/typeset.html)
function reloadDOM() {
MathJax.Hub.Queue(["Typeset", MathJax.Hub]);
}
var timeout;
function updateAnnotationPreview(){
var updatedAnnotation = document.getElementById("new_annotation_content").value;
var preview... | // function that reloads the DOM for
// MathJax (http://www.mathjax.org/docs/1.1/typeset.html)
function reloadDOM() {
MathJax.Hub.Queue(["Typeset", MathJax.Hub]);
}
function updateAnnotationPreview(){
var updatedAnnotation = document.getElementById("new_annotation_content").value;
var previewParagraph = d... |
Change the runserver command to run a server at a host ip of 127.0.0.1 to easily change the xternal visibility of the application later | import os
from app import create_app, db
from app.models import User, Category
from flask_script import Manager, Server
from flask_migrate import Migrate, MigrateCommand
app = create_app(os.getenv('FLASK_CONFIG') or 'default')
manager = Manager(app)
migrate = Migrate(app, db)
manager.add_command('db', MigrateCommand... | import os
from app import create_app, db
from app.models import User, Category
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
app = create_app(os.getenv('FLASK_CONFIG') or 'default')
manager = Manager(app)
migrate = Migrate(app, db)
manager.add_command('db', MigrateCommand)
#pyli... |
Move algorithm types to static strings on top | package login;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class PasswordHelper
{
private static String hashAlgorithm = "MD5";
private static String stringEncodingFormat = "UTF-8";
public static String generatePasswordHas... | package login;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class PasswordHelper
{
public static String generatePasswordHash(String password)
{
//Create instances of digest and password char array
MessageDigest passDigest;... |
Add a test that a non-GET method is rejected | # -*- encoding: utf-8 -*-
import uuid
import pytest
import archive_report_ingest_status as report_ingest_status
def test_get_returns_status(dynamodb_resource, table_name):
guid = str(uuid.uuid4())
table = dynamodb_resource.Table(table_name)
table.put_item(Item={'id': guid})
event = {
'req... | # -*- encoding: utf-8 -*-
import uuid
import archive_report_ingest_status as report_ingest_status
def test_get_returns_status(dynamodb_resource, table_name):
guid = str(uuid.uuid4())
table = dynamodb_resource.Table(table_name)
table.put_item(Item={'id': guid})
event = {
'request_method': '... |
Set underscored to true so that authorId becomes author_id and is consistent with other column names | import Sequelize from 'sequelize';
import database from '../';
import User from './user';
const blogPostDatabaseDefinition = database.define('blog_post', {
id: {
type: Sequelize.INTEGER,
autoIncrement: true,
primaryKey: true,
field: 'id',
allowNull: false
},
title: {
type: Sequelize.STRIN... | import Sequelize from 'sequelize';
import database from '../';
import User from './user';
const blogPostDatabaseDefinition = database.define('blog_post', {
id: {
type: Sequelize.INTEGER,
autoIncrement: true,
primaryKey: true,
field: 'id',
allowNull: false
},
title: {
type: Sequelize.STRIN... |
[fix] Replace Unicode space (U+00A0) with ASCII space | /*
* config.js: Configuration information for your Loggly account.
* This information is only used for require('loggly')./\.+/ methods
*
* (C) 2010 Nodejitsu Inc.
* MIT LICENSE
*
*/
//
// function createConfig (defaults)
// Creates a new instance of the configuration
// object based on default ... | /*
* config.js: Configuration information for your Loggly account.
* This information is only used for require('loggly')./\.+/ methods
*
* (C) 2010 Nodejitsu Inc.
* MIT LICENSE
*
*/
//
// function createConfig (defaults)
// Creates a new instance of the configuration
// object based on default ... |
Test access token csv download
Signed-off-by: Chris Lamb <711c73f64afdce07b7e38039a96d2224209e9a6c@chris-lamb.co.uk> | from takeyourmeds.utils.test import SuperuserTestCase
class SmokeTest(SuperuserTestCase):
def test_index(self):
self.assertGET(200, 'groups:admin:index', login=True)
def test_view(self):
self.assertGET(
200,
'groups:admin:view',
self.user.profile.group_id,
... | from takeyourmeds.utils.test import SuperuserTestCase
class SmokeTest(SuperuserTestCase):
def test_index(self):
self.assertGET(200, 'groups:admin:index', login=True)
def test_view(self):
self.assertGET(
200,
'groups:admin:view',
self.user.profile.group_id,
... |
Fix query to WHERE In from WHERE | <?php
namespace app\controllers;
use app\models\FlightFilterForm;
use app\models\OutdoorLogs;
use app\models\forge\Brand;
use yii\helpers\VarDumper;
class FlightController extends \yii\web\Controller
{
public function actionIndex()
{
$model = new FlightFilterForm();
// profile
$profi... | <?php
namespace app\controllers;
use app\models\FlightFilterForm;
use app\models\OutdoorLogs;
use app\models\forge\Brand;
use yii\helpers\VarDumper;
class FlightController extends \yii\web\Controller
{
public function actionIndex()
{
$model = new FlightFilterForm();
// profile
$profi... |
Set a flag when config is loaded on a browser | // Copyright (c) 2014 Readium Foundation and/or its licensees. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
// 1. Redistributions of source code must retain the above copyright notice, thi... | // Copyright (c) 2014 Readium Foundation and/or its licensees. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
// 1. Redistributions of source code must retain the above copyright notice, thi... |
Fix a bug in the mesh optimizer. | # -*- coding: utf-8 -*-
import re
import uuid
from abc import ABCMeta, abstractmethod
import numpy as np
class BaseReader(object):
__metaclass__ = ABCMeta
@abstractmethod
def __init__(self):
pass
@abstractmethod
def _to_raw_pyfrm(self):
pass
def _optimize(self, mesh):
... | # -*- coding: utf-8 -*-
import re
import uuid
import itertools as it
from abc import ABCMeta, abstractmethod
import numpy as np
class BaseReader(object):
__metaclass__ = ABCMeta
@abstractmethod
def __init__(self):
pass
@abstractmethod
def _to_raw_pyfrm(self):
pass
def _op... |
Add dot also to env prefix | package com.coding4people.mosquitoreport.api.factories;
import java.util.Optional;
import javax.inject.Inject;
import org.glassfish.hk2.api.Factory;
import com.amazonaws.services.dynamodbv2.AmazonDynamoDB;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper;
import com.amazonaws.services.dynamodbv2... | package com.coding4people.mosquitoreport.api.factories;
import java.util.Optional;
import javax.inject.Inject;
import org.glassfish.hk2.api.Factory;
import com.amazonaws.services.dynamodbv2.AmazonDynamoDB;
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper;
import com.amazonaws.services.dynamodbv2... |
Include threadName in DEBUG format | import sys
import logging
DEBUG_FORMAT = ("[%(asctime)s] %(levelname)s %(threadName)s "
"%(name)s:%(lineno)d(%(funcName)s): %(message)s")
INFO_FORMAT = ("[%(asctime)s] %(message)s")
COLOR_FORMAT = ("[%(asctime)s] \033[%(color)sm%(message)s\033[39m")
ISO_8601 = "%Y-%m-%dT%H:%M:%S"
class ColorFormatte... | import sys
import logging
DEBUG_FORMAT = ("[%(asctime)s] %(levelname)s %(name)s:%(lineno)d"
"(%(funcName)s): %(message)s")
INFO_FORMAT = ("[%(asctime)s] %(message)s")
COLOR_FORMAT = ("[%(asctime)s] \033[%(color)sm%(message)s\033[39m")
ISO_8601 = "%Y-%m-%dT%H:%M:%S"
class ColorFormatter(logging.Forma... |
Print stack traces from failed `meteor {node,npm}` commands. | // Note that this file is required before we install our Babel hooks in
// ../tool-env/install-babel.js, so we can't use ES2015+ syntax here.
var win32Extensions = {
node: ".exe",
npm: ".cmd"
};
// The dev_bundle/bin command has to come immediately after the meteor
// command, as in `meteor npm` or `meteor node`,... | // Note that this file is required before we install our Babel hooks in
// ../tool-env/install-babel.js, so we can't use ES2015+ syntax here.
var win32Extensions = {
node: ".exe",
npm: ".cmd"
};
// The dev_bundle/bin command has to come immediately after the meteor
// command, as in `meteor npm` or `meteor node`,... |
Fix to CHT station name | from data_importers.management.commands import BaseHalaroseCsvImporter
class Command(BaseHalaroseCsvImporter):
council_id = "CHT"
addresses_name = (
"2022-05-05/2022-02-25T12:48:35.558843/polling_station_export-2022-02-25.csv"
)
stations_name = (
"2022-05-05/2022-02-25T12:48:35.558843/... | from data_importers.management.commands import BaseHalaroseCsvImporter
class Command(BaseHalaroseCsvImporter):
council_id = "CHT"
addresses_name = (
"2022-05-05/2022-02-25T12:48:35.558843/polling_station_export-2022-02-25.csv"
)
stations_name = (
"2022-05-05/2022-02-25T12:48:35.558843/... |
Make port dynamic for Heroku | var express = require('express'),
cons = require('consolidate'),
app = express(),
mustacheRender = require("./lib/mustacheRender").mustacheRender,
port = (process.env.PORT || 3000);
// Application settings
app.engine('html', cons.mustache);
app.set('view engine', 'html');
app.set('views', __dirname + '... | var express = require('express'),
cons = require('consolidate'),
app = express(),
mustacheRender = require("./lib/mustacheRender").mustacheRender;
// Application settings
app.engine('html', cons.mustache);
app.set('view engine', 'html');
app.set('views', __dirname + '/views');
// Middleware to serve stati... |
Allow partial maches in span names | 'use strict';
define(
[
'flight/lib/component'
],
function (defineComponent) {
return defineComponent(spanName);
function spanName() {
this.updateSpans = function(ev, data) {
var html =
"<option value='all'>all</option>" +
$.map(data.spans, function(span) {
... | 'use strict';
define(
[
'flight/lib/component'
],
function (defineComponent) {
return defineComponent(spanName);
function spanName() {
this.updateSpans = function(ev, data) {
var html =
"<option value='all'>all</option>" +
$.map(data.spans, function(span) {
... |
Check for errors from SetKeepAlive and SetKeepAlivePeriod in TCPKeepAliveListener Accept method | // Copyright (c) 2017, Janoš Guljaš <janos@resenje.org>
// All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package web
import (
"net"
"time"
)
// TCPKeepAliveListener sets TCP keep alive period.
type TCPKeepAliveListener struct {
*net.TC... | // Copyright (c) 2017, Janoš Guljaš <janos@resenje.org>
// All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package web
import (
"net"
"time"
)
// TCPKeepAliveListener sets TCP keep alive period.
type TCPKeepAliveListener struct {
*net.TC... |
Add forgotten dependency on mock | from setuptools import setup, find_packages
from annotator import __version__, __license__, __author__
setup(
name = 'annotator',
version = __version__,
packages = find_packages(),
install_requires = [
'Flask==0.8',
'Flask-WTF==0.5.2',
'Flask-SQLAlchemy==0.15',
'SQLAlch... | from setuptools import setup, find_packages
from annotator import __version__, __license__, __author__
setup(
name = 'annotator',
version = __version__,
packages = find_packages(),
install_requires = [
'Flask==0.8',
'Flask-WTF==0.5.2',
'Flask-SQLAlchemy==0.15',
'SQLAlch... |
Webpack: Add library target to run it in browser | const path = require('path');
const webpack = require('webpack');
module.exports = {
entry: {algorithms: './src/index.js', 'algorithms.min': './src/index.js'},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].js',
library: 'alds'
},
module: {
rules: [{
test: [/\.es6$/, /... | const path = require('path');
const webpack = require('webpack');
module.exports = {
entry: {
algorithms: './src/index.js',
'algorithms.min': './src/index.js'
},
output: { path: path.resolve(__dirname, 'dist'), filename: '[name].js' },
module: {
rules: [{
test: [/\.es6$/, /\.js$/],
excl... |
Change paths to hash-based for "development" env | /* jshint node: true */
module.exports = function(environment) {
var ENV = {
environment: environment,
baseURL: '/',
locationType: 'auto',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. 'with-controller': true
}
},... | /* jshint node: true */
module.exports = function(environment) {
var ENV = {
environment: environment,
baseURL: '/',
locationType: 'auto',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. 'with-controller': true
}
},... |
Change detection to ignore borders | ;(function(window, document){
document.addEventListener('touchmove', function(e) {
isScrollElement(e.target) || e.preventDefault();
}, false);
document.addEventListener('touchstart', function(e){
var elem = isScrollElement(e.target);
var startTopScroll = 0;
if(elem) {
startTopScroll = elem.scrollTop;
i... | ;(function(window, document){
document.addEventListener('touchmove', function(e) {
isScrollElement(e.target) || e.preventDefault();
}, false);
document.addEventListener('touchstart', function(e){
var elem = isScrollElement(e.target);
if(elem) {
var startTopScroll = elem.scrollTop;
if(startTopScroll <= 0)... |
Move class list logic to it's own function | CenterScout.controller('HomeController', ['$scope', 'gradeData', 'assignmentData', function($scope, gradeData, assignmentData) {
$scope.grades = [{ name: 'Loading...', class: '', date: '', percent: '', fraction: ''}];
$scope.assignments = [{ done: false, name: 'Loading...', class: '', date: ''}]; // TODO: Find... | CenterScout.controller('HomeController', ['$scope', 'gradeData', 'assignmentData', function($scope, gradeData, assignmentData) {
$scope.grades = [{ name: 'Loading...', class: '', date: '', percent: '', fraction: ''}];
$scope.assignments = [{ done: false, name: 'Loading...', class: '', date: ''}]; // TODO: Find... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.