text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Remove dev suffix from version
It is not a valid Python version specifier. | #!/usr/bin/env python3
from setuptools import setup
with open("README.rst") as file:
long_description = file.read()
setup(
name="tvnamer",
version="1.0.0",
description="Utility to rename lots of TV video files using the TheTVDB.",
long_description=long_description,
author="Tom Leese",
au... | #!/usr/bin/env python3
from setuptools import setup
with open("README.rst") as file:
long_description = file.read()
setup(
name="tvnamer",
version="1.0.0-dev",
description="Utility to rename lots of TV video files using the TheTVDB.",
long_description=long_description,
author="Tom Leese",
... |
Fix import path for rest plugins | import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), "../"))
from http_test_suite import HTTPTestSuite
from mozdef_util.utilities.dot_dict import DotDict
import mock
from configlib import OptionParser
import importlib
class RestTestDict(DotDict):
@property
def __dict__(self):
... | import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), "../"))
from http_test_suite import HTTPTestSuite
from mozdef_util.utilities.dot_dict import DotDict
import mock
from configlib import OptionParser
class RestTestDict(DotDict):
@property
def __dict__(self):
return self
c... |
Add build world, Lesson 7 | // Preloader.js
BunnyDefender.Preloader = function (game) {
this.preloadBar = null;
this.titleText = null;
this.ready = false;
};
BunnyDefender.Preloader.prototype.preload = function () {
this.preloadBar = this.add.sprite(this.world.centerX, this.world.centerY, 'preloaderBar');
this.preloadBar.anchor.setTo(... | // Preloader.js
BunnyDefender.Preloader = function (game) {
this.preloadBar = null;
this.titleText = null;
this.ready = false;
};
BunnyDefender.Preloader.prototype.preload = function () {
this.preloadBar = this.add.sprite(this.world.centerX, this.world.centerY, 'preloaderBar');
this.preloadBar.anchor.setTo(... |
Update GitHub repos from blancltd to developersociety | #!/usr/bin/env python
from codecs import open
from setuptools import find_packages, setup
with open('README.rst', 'r', 'utf-8') as f:
readme = f.read()
setup(
name='blanc-contentfiles',
version='0.2.4',
description='Blanc Content Files',
long_description=readme,
url='https://github.com/deve... | #!/usr/bin/env python
from codecs import open
from setuptools import find_packages, setup
with open('README.rst', 'r', 'utf-8') as f:
readme = f.read()
setup(
name='blanc-contentfiles',
version='0.2.4',
description='Blanc Content Files',
long_description=readme,
url='https://github.com/blan... |
Add js-enabled class to body if doesn't exist | // Vendor assets
//= require jquery
//= require jquery_ujs
//= require jquery-ui-autocomplete
//= require modernizr-custom
//= require dest/respond.min
// GOVUK modules
//= require govuk_toolkit
//= require vendor/polyfills/bind
//= require govuk/selection-buttons
// MOJ elements
//= require moj
//= require src/moj.T... | // Vendor assets
//= require jquery
//= require jquery_ujs
//= require jquery-ui-autocomplete
//= require modernizr-custom
//= require dest/respond.min
// GOVUK modules
//= require govuk_toolkit
//= require vendor/polyfills/bind
//= require govuk/selection-buttons
// MOJ elements
//= require moj
//= require src/moj.T... |
Switch off debugging func that got through... | import pyrc
import pyrc.utils.hooks as hooks
class GangstaBot(pyrc.Bot):
@hooks.command()
def bling(self, channel, sender):
"will print yo"
self.message(channel, "%s: yo" % sender)
@hooks.command("^repeat\s+(?P<msg>.+)$")
def repeat(self, channel, sender, **kwargs):
"will repeat whatever yo say"
... | import pyrc
import pyrc.utils.hooks as hooks
class GangstaBot(pyrc.Bot):
@hooks.command()
def bling(self, channel, sender):
"will print yo"
self.message(channel, "%s: yo" % sender)
@hooks.command("^repeat\s+(?P<msg>.+)$")
def repeat(self, channel, sender, **kwargs):
"will repeat whatever yo say"
... |
Add comment for future work | import selftest from '../selftest';
import { parse, markBottom } from '../parse-stack';
import _ from 'underscore';
import Fiber from 'fibers';
import Future from 'fibers/future';
selftest.define("parse-stack - parse stack traces without fibers", () => {
const err = new Error();
const parsedStack = parse(err);
... | import selftest from '../selftest';
import { parse, markBottom } from '../parse-stack';
import _ from 'underscore';
import Fiber from 'fibers';
import Future from 'fibers/future';
selftest.define("parse-stack - parse stack traces without fibers", () => {
const err = new Error();
const parsedStack = parse(err);
... |
Check for subclasses of ElementpageExtension as well | <?php
/**
* @package elemental
*/
class ElementalArea extends WidgetArea {
public function Elements() {
$result = $this->getComponents('Widgets');
$list = new HasManyList('BaseElement', $result->getForeignKey());
$list->setDataModel($this->model);
$list->sort('Sort ASC');
$list = $list->forForeignID($t... | <?php
/**
* @package elemental
*/
class ElementalArea extends WidgetArea {
public function Elements() {
$result = $this->getComponents('Widgets');
$list = new HasManyList('BaseElement', $result->getForeignKey());
$list->setDataModel($this->model);
$list->sort('Sort ASC');
$list = $list->forForeignID(... |
Remove subclassing of exception, since there is only one. | # -*- encoding: utf-8 -*-
# Odoo, Open Source Management Solution
# Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either versio... | # -*- encoding: utf-8 -*-
# Odoo, Open Source Management Solution
# Copyright (C) 2014-2015 Grupo ESOC <www.grupoesoc.es>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either versio... |
Fix bug in endpoint test opn heroku | import express from 'express';
import logger from 'morgan';
import bodyParser from 'body-parser';
import routes from './routes';
const app = express();
const port = process.env.PORT || 3001;
app.use(logger('dev'));
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use('/api-docs', ... | import express from 'express';
import logger from 'morgan';
import bodyParser from 'body-parser';
import routes from './routes';
const app = express();
const port = process.env.PORT || 3001;
app.use(logger('dev'));
app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());
app.use('/api-docs', ... |
Disable parallelism, caching for terser | // @ts-check
const path = require("path")
const WebpackManifestPlugin = require("webpack-manifest-plugin")
const { HashedModuleIdsPlugin } = require("webpack")
const { getCSSManifest } = require("../utils/getCSSManifest")
const TerserPlugin = require("terser-webpack-plugin")
const {
BUILD_SERVER,
NODE_ENV,
isPr... | // @ts-check
const path = require("path")
const WebpackManifestPlugin = require("webpack-manifest-plugin")
const { HashedModuleIdsPlugin } = require("webpack")
const { getCSSManifest } = require("../utils/getCSSManifest")
const {
BUILD_SERVER,
NODE_ENV,
isProduction,
} = require("../../src/lib/environment")
co... |
Add Lunar scene to menu | import React from 'react';
import DinoScene from '../../aframe/components/DinoScene';
import WarScene from '../../aframe/components/WarScene';
import MoonScene from '../../aframe/components/MoonScene';
const pooScenes = {
war: WarScene,
dino: DinoScene,
moon: MoonScene,
}
class PickYourPoo extends React.Compone... | import React from 'react';
import DinoScene from '../../aframe/components/DinoScene';
import WarScene from '../../aframe/components/WarScene';
const pooScenes = {
war: WarScene,
dino: DinoScene,
}
class PickYourPoo extends React.Component {
constructor(props) {
super(props);
this.state = {};
}
load... |
Test(script): Rewrite to new code rewrite | /*
Name: openkvk - test.js
Description: Test script for openkvk.js
Author: Franklin van de Meent (https://frankl.in)
Source & docs: https://github.com/fvdm/nodejs-openkvk
Feedback: https://github.com/fvdm/nodejs-openkvk/issues
License: Unlicense (Public Domain) - see LICENSE file
*/
... | /*
Name: openkvk - test.js
Description: Test script for openkvk.js
Author: Franklin van de Meent (https://frankl.in)
Source & docs: https://github.com/fvdm/nodejs-openkvk
Feedback: https://github.com/fvdm/nodejs-openkvk/issues
License: Unlicense (Public Domain) - see LICENSE file
*/
... |
Fix 'In the Media' title | <article id="post-<?php the_ID(); ?>" <?php post_class('index-card'); ?>>
<header>
<h2><a href="<?php echo esc_attr( get_field('in_the_media_url', get_the_ID()) ); ?>"><?php the_title(); ?></a></h2>
<span class="byline author">
Published by <?php echo get_the_publisher_link(get_the_ID())... | <article id="post-<?php the_ID(); ?>" <?php post_class('index-card'); ?>>
<header>
<h2><a href="<?php echo esc_attr( get_field('article_url', get_the_ID()) ); ?>"><?php the_title(); ?></a></h2>
<span class="byline author">
Published by <?php echo get_the_publisher_link(get_the_ID()) ?>
... |
Remove conversion to set, as the new file format uses sets in tuples. | """
Derive a list of impossible differentials.
"""
from ast import literal_eval
import sys
def parse(line):
return literal_eval(line)
def in_set(s, xs):
return any(i in s for i in xs)
def main():
if len(sys.argv) != 3:
print("usage: ./find_ids.py [forward differentials file] [backward differenti... | """
Derive a list of impossible differentials.
"""
from ast import literal_eval
import sys
def parse(line):
return literal_eval(line)
def in_set(s, xs):
return any(i in s for i in xs)
def main():
if len(sys.argv) != 3:
print("usage: ./find_ids.py [forward differentials file] [backward differenti... |
Add entry_point for command-line application
Closes #31. | # -*- coding: utf-8 -*-
from distutils.core import setup
import refmanage
setup(name="refmanage",
version=refmanage.__version__,
author="Joshua Ryan Smith",
author_email="joshua.r.smith@gmail.com",
packages=["refmanage"],
url="https://github.com/jrsmith3/refmanage",
description="Man... | # -*- coding: utf-8 -*-
from distutils.core import setup
import refmanage
setup(name="refmanage",
version=refmanage.__version__,
author="Joshua Ryan Smith",
author_email="joshua.r.smith@gmail.com",
packages=["refmanage"],
url="https://github.com/jrsmith3/refmanage",
description="Man... |
Add autofocus on the first input text or textarea | $(function() {
// toggle on/off switch
$(document).on('click', '[data-toggle]', function() {
targetHide = $(this).data('toggle-hide')
targetShow = $(this).data('toggle-show')
$('[data-toggle-name="' + targetHide + '"]').addClass('hide')
$('[data-toggle-name="' + targetShow + '"]').removeClass('hi... | $(function() {
// toggle on/off switch
$(document).on('click', '[data-toggle]', function() {
targetHide = $(this).data('toggle-hide')
targetShow = $(this).data('toggle-show')
$('[data-toggle-name="' + targetHide + '"]').addClass('hide')
$('[data-toggle-name="' + targetShow + '"]').removeClass('hi... |
Replace LHS with replacement values | package matlab.syntax;
import java.util.*;
import dl.syntax.*;
public class MatlabAssignment extends MatlabProgram {
private final RealVariable lhs;
private final Term rhs;
public MatlabAssignment( RealVariable lhs, Term rhs ) {
this.lhs = lhs;
this.rhs = rhs;
}
public RealVariable getLHS() {
return l... | package matlab.syntax;
import java.util.*;
import dl.syntax.*;
public class MatlabAssignment extends MatlabProgram {
private final RealVariable lhs;
private final Term rhs;
public MatlabAssignment( RealVariable lhs, Term rhs ) {
this.lhs = lhs;
this.rhs = rhs;
}
public RealVariable getLHS() {
return l... |
Clean up File edit view | from __future__ import unicode_literals
from flask import url_for
from flask_mongoengine.wtf import model_form
from mongoengine import *
from core.observables import Observable
from core.database import StringListField
class File(Observable):
value = StringField(verbose_name="Value")
mime_type = StringFie... | from __future__ import unicode_literals
from mongoengine import *
from core.observables import Observable
from core.observables import Hash
class File(Observable):
value = StringField(verbose_name="SHA256 hash")
mime_type = StringField(verbose_name="MIME type")
hashes = DictField(verbose_name="Hashes"... |
Fix bbl up for AWS
- Different calls to AWS return different lists of availability zones
- Short-term fix ignores the az that is not returned by cloudformation
call
[#139857703] | package ec2
import (
"errors"
goaws "github.com/aws/aws-sdk-go/aws"
awsec2 "github.com/aws/aws-sdk-go/service/ec2"
)
type AvailabilityZoneRetriever struct {
ec2ClientProvider ec2ClientProvider
}
func NewAvailabilityZoneRetriever(ec2ClientProvider ec2ClientProvider) AvailabilityZoneRetriever {
return Availabili... | package ec2
import (
"errors"
goaws "github.com/aws/aws-sdk-go/aws"
awsec2 "github.com/aws/aws-sdk-go/service/ec2"
)
type AvailabilityZoneRetriever struct {
ec2ClientProvider ec2ClientProvider
}
func NewAvailabilityZoneRetriever(ec2ClientProvider ec2ClientProvider) AvailabilityZoneRetriever {
return Availabili... |
Fix url pattern for main | """cv URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/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-based vi... | """cv URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/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-based vi... |
Fix annotation link. EncodedPath is gone. | package retrofit;
/** Intercept every request before it is executed in order to add additional data. */
public interface RequestInterceptor {
/** Called for every request. Add data using methods on the supplied {@link RequestFacade}. */
void intercept(RequestFacade request);
interface RequestFacade {
/** Ad... | package retrofit;
/** Intercept every request before it is executed in order to add additional data. */
public interface RequestInterceptor {
/** Called for every request. Add data using methods on the supplied {@link RequestFacade}. */
void intercept(RequestFacade request);
interface RequestFacade {
/** Ad... |
Convert reply from bytes to string
The GET message reply is a byte string and it needs to be converted to
a string before being passed to the JSON parser. | # -*- coding: utf-8 -*-
"""Unit tests for the Master Controller REST variant.
- http://flask.pocoo.org/docs/0.12/testing/
"""
import unittest
import json
from app.app import APP
class MasterControllerTests(unittest.TestCase):
"""Tests of the Master Controller"""
def setUp(self):
"""Executed prior t... | # -*- coding: utf-8 -*-
"""Unit tests for the Master Controller REST variant.
- http://flask.pocoo.org/docs/0.12/testing/
"""
import unittest
import json
from app.app import APP
class MasterControllerTests(unittest.TestCase):
"""Tests of the Master Controller"""
def setUp(self):
"""Executed prior t... |
Disable pylint signature-differs in md.py | import os
import multiprocessing.util
def apply_workaround():
# Implements:
# https://github.com/python/cpython/commit/e8a57b98ec8f2b161d4ad68ecc1433c9e3caad57
#
# Detection of fix: os imported to compare pids, before the fix os has not
# been imported
if getattr(multiprocessing.util, 'os', No... | import os
import multiprocessing.util
def apply_workaround():
# Implements:
# https://github.com/python/cpython/commit/e8a57b98ec8f2b161d4ad68ecc1433c9e3caad57
#
# Detection of fix: os imported to compare pids, before the fix os has not
# been imported
if getattr(multiprocessing.util, 'os', No... |
Add overflow: auto to allow scrolling of menu items by default | 'use strict';
let styles = {
overlay(isOpen) {
return {
position: 'fixed',
zIndex: 1,
width: '100%',
height: '100%',
background: 'rgba(0, 0, 0, 0.3)',
opacity: isOpen ? 1 : 0,
transform: isOpen ? '' : 'translate3d(-100%, 0, 0)',
transition: isOpen ? 'opacity 0.3s'... | 'use strict';
let styles = {
overlay(isOpen) {
return {
position: 'fixed',
zIndex: 1,
width: '100%',
height: '100%',
background: 'rgba(0, 0, 0, 0.3)',
opacity: isOpen ? 1 : 0,
transform: isOpen ? '' : 'translate3d(-100%, 0, 0)',
transition: isOpen ? 'opacity 0.3s'... |
Disable voting if already voted | jQuery(function() {
jQuery('[data-star-rating]').each(function(index, element) {
element = $(element);
var data = element.data('star-rating'),
globalOptions = window.StarRatingsOptions ? window.StarRatingsOptions : {},
options = jQuery.extend(data.options, globalOptions, {
... | jQuery(function() {
jQuery('[data-star-rating]').each(function(index, element) {
element = $(element);
var data = element.data('star-rating'),
globalOptions = window.StarRatingsOptions ? window.StarRatingsOptions : {},
options = jQuery.extend(data.options, globalOptions, {
... |
Add picture display after taken on mirror, need to set a timer for that | Module.register("recognizer",{
start() {
this.display = false;
this.image = "";
console.log("Recognizer started");
this.sendSocketNotification("RECOGNIZER_STARTUP");
return;
},
socketNotificationReceived: function(notification) {
console.log("Recognizer recieved a notification: " + notif... | Module.register("recognizer",{
start() {
this.display = false;
this.image = "";
console.log("Recognizer started");
this.sendSocketNotification("RECOGNIZER_STARTUP");
return;
},
socketNotificationReceived: function(notification) {
console.log("Recognizer recieved a notification: " + notif... |
Make the HLTV search escape uri fragments | 'use strict';
var request = require( 'request' );
module.exports = {
baseUrl : 'http://www.hltv.org/?pageid=255&res=5&team=1&term=',
search : function( searchPhrase, callback ){
var _this = this,
rawTeamList = false,
teamList = [],
i;
request( _this.baseUrl... | 'use strict';
var request = require( 'request' );
module.exports = {
baseUrl : 'http://www.hltv.org/?pageid=255&res=5&team=1&term=',
search : function( searchPhrase, callback ){
var _this = this,
rawTeamList = false,
teamList = [],
i;
request( _this.baseUrl... |
Rename the control script to "cobe" | #!/usr/bin/env python
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
setup(
name = "cobe",
version = "0.5",
author = "Peter Teichman",
author_email = "peter@teichman.org",
packages = ["cobe"],
test_suite = "tests.cobe_suite",
install_requir... | #!/usr/bin/env python
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
setup(
name = "cobe",
version = "0.5",
author = "Peter Teichman",
author_email = "peter@teichman.org",
packages = ["cobe"],
test_suite = "tests.cobe_suite",
install_requir... |
Fix kebab-to-camel conversion for CLI arguments | #! /usr/bin/env node
/* Copyright (c) 2018 Looker Data Sciences, Inc. See https://github.com/looker-open-source/look-at-me-sideways/blob/master/LICENSE.txt */
const minimist = require('minimist')
const lams = require('./index.js')
const fromEntries = require('fromentries')
const cliArgs = fromEntries( // ponyfill for O... | #! /usr/bin/env node
/* Copyright (c) 2018 Looker Data Sciences, Inc. See https://github.com/looker-open-source/look-at-me-sideways/blob/master/LICENSE.txt */
const minimist = require('minimist')
const lams = require('./index.js')
const fromEntries = require('fromentries')
const cliArgs = fromEntries( // ponyfill for O... |
Update with modern class definition | from tip.algorithms.sorting.mergesort import mergesort
class TestMergesort:
"""Test class for Merge Sort algorithm."""
def test_mergesort_basic(self):
"""Test basic sorting."""
unsorted_list = [5, 3, 7, 8, 9, 3]
sorted_list = mergesort(unsorted_list)
assert sorted_list == sort... | from tip.algorithms.sorting.mergesort import mergesort
class TestMergesort():
"""Test class for Merge Sort algorithm."""
def test_mergesort_basic(self):
"""Test basic sorting."""
unsorted_list = [5, 3, 7, 8, 9, 3]
sorted_list = mergesort(unsorted_list)
assert sorted_list == so... |
Fix unread count in notifications (again) | package com.fsck.k9.helper;
import android.app.Notification;
import android.content.Context;
import android.os.Build;
import android.support.v4.app.NotificationCompat;
/**
* Notification builder that will set {@link Notification#number} on pre-Honeycomb devices.
*
* @see <a href="http://code.google.com/p/android/i... | package com.fsck.k9.helper;
import android.app.Notification;
import android.content.Context;
import android.os.Build;
import android.support.v4.app.NotificationCompat;
/**
* Notification builder that will set {@link Notification#number} on pre-Honeycomb devices.
*
* @see <a href="http://code.google.com/p/android/i... |
Change the serial number of the problem
Change the serial number of the problem | package com.insightfullogic.java8.answers.chapter3;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
public class StringExercises {
// Question 6
public static int countLowercaseLetters(String string) {
return (int) string.chars()
.filter(Chara... | package com.insightfullogic.java8.answers.chapter3;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
public class StringExercises {
// Question 7
public static int countLowercaseLetters(String string) {
return (int) string.chars()
.filter(Chara... |
Use a non static Joker again | /*
For step-by-step instructions on connecting your Android application to this backend module,
see "App Engine Java Endpoints Module" template documentation at
https://github.com/GoogleCloudPlatform/gradle-appengine-templates/tree/master/HelloEndpoints
*/
package com.example.Jose.myapplication.backend;
impo... | /*
For step-by-step instructions on connecting your Android application to this backend module,
see "App Engine Java Endpoints Module" template documentation at
https://github.com/GoogleCloudPlatform/gradle-appengine-templates/tree/master/HelloEndpoints
*/
package com.example.Jose.myapplication.backend;
impo... |
Add urldecode to query string class | <?
//Get query string because $_GET does not work with mod rewrite
//This code should be rewritten at some point... It's ugly
//
//Multiple identical keys cannot be passed into pooch. This is a Limitation of this implimentation.
//Example: Give the query string "id=2&id=3" the value of $query_string['id'] would be 3.
f... | <?
//Get query string because $_GET does not work with mod rewrite
//This code should be rewritten at some point... It's ugly
//
//Multiple identical keys cannot be passed into pooch. This is a Limitation of this implimentation.
//Example: Give the query string "id=2&id=3" the value of $query_string['id'] would be 3.
f... |
Handle factions >5
Nobody knows what they are and where they come from. | package com.faforever.api.data.domain;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import javax.persistence.AttributeConverter;
import javax.persistence.Converter;
import java.util.HashMap;
public enum Faction {
// Order is crucial
AEON("aeon"), CYBRAN(... | package com.faforever.api.data.domain;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import javax.persistence.AttributeConverter;
import javax.persistence.Converter;
import java.util.HashMap;
public enum Faction {
// Order is crucial
AEON("aeon"), CYBRAN(... |
Use $.ajaxSuccess to show "add new course" button | this.mmooc=this.mmooc||{};
this.mmooc.courseList = function() {
return {
listCourses: function(parentId) {
mmooc.api.getEnrolledCourses(function(courses) {
var html = mmooc.util.renderTemplateWithData("courselist", {courses: courses});
document.getElementById(pa... | this.mmooc=this.mmooc||{};
this.mmooc.courseList = function() {
return {
listCourses: function(parentId) {
mmooc.api.getEnrolledCourses(function(courses) {
var html = mmooc.util.renderTemplateWithData("courselist", {courses: courses});
document.getElementById(pa... |
Fix prepend BASE_URL for ACCOUNT_LOGOUT_REDIRECT_URL | import os
# include settimgs from daiquiri
from daiquiri.core.settings import *
# include settings from base.py
from .base import *
# include settings from local.py
from .local import *
# include 3rd party apps after the daiquiri apps from base.py
INSTALLED_APPS = DJANGO_APPS + DAIQUIRI_APPS + ADDITIONAL_APPS + INS... | import os
# include settimgs from daiquiri
from daiquiri.core.settings import *
# include settings from base.py
from .base import *
# include settings from local.py
from .local import *
# include 3rd party apps after the daiquiri apps from base.py
INSTALLED_APPS = DJANGO_APPS + DAIQUIRI_APPS + ADDITIONAL_APPS + INS... |
Use phantomJs and headless chrome as browsers
Especially useful for CI | module.exports = function(config) {
config.set({
frameworks: ["jasmine", "karma-typescript"],
files: [
{ pattern: "src/**/*.ts" },
{ pattern: "src/**/*.tsx" },
],
preprocessors: {
"**/*.ts": ["karma-typescript"],
"**/*.tsx": ["karma-typ... | module.exports = function(config) {
config.set({
frameworks: ["jasmine", "karma-typescript"],
files: [
{ pattern: "src/**/*.ts" },
{ pattern: "src/**/*.tsx" },
],
preprocessors: {
"**/*.ts": ["karma-typescript"],
"**/*.tsx": ["karma-typ... |
IBM-109: Remove quotes from url query string | (function () {
const UNAUTHORIZED = 401;
const REQUEST_FINISHED = 4;
var keycloakRedirect = {
authenticate: (config, client, window) => {
if (config.backend === void 0) {
throw "Missing backend in config.";
}
if (config.clientId === void 0) {
throw "Missing clientId in config... | (function () {
const UNAUTHORIZED = 401;
const REQUEST_FINISHED = 4;
var keycloakRedirect = {
authenticate: (config, client, window) => {
if (config.backend === void 0) {
throw "Missing backend in config.";
}
if (config.clientId === void 0) {
throw "Missing clientId in config... |
HV-426: Use Hibernate Validator in version logging message. | /*
* JBoss, Home of Professional Open Source
* Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* y... | /*
* JBoss, Home of Professional Open Source
* Copyright 2010, Red Hat, Inc. and/or its affiliates, and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* y... |
Fix private discussions page breaking when user is loaded async | import UserPage from 'flarum/components/UserPage';
import PrivateDiscussionList from './PrivateDiscussionList';
export default class PrivateDiscussionsUserPage extends UserPage {
init() {
super.init();
this.loadUser(m.route.param('username'));
}
show(user) {
// We can not create t... | import UserPage from 'flarum/components/UserPage';
import PrivateDiscussionList from './PrivateDiscussionList';
export default class PrivateDiscussionsUserPage extends UserPage {
init() {
super.init();
this.loadUser(m.route.param('username'));
this.list = new PrivateDiscussionList({
... |
FIX minor bug with UEs not calculating after populating planner with full 160 mcs | import { searchByModuleCode } from '../../../../../../../database-controller/module/methods';
export const findUnrestrictedElectivesRequirementModules = function findUnrestrictedElectivesRequirementModules(totalRequiredMCs, graduationMCs, studentSemesters) {
// get total required MC to graduate
let totalMCsInPlann... | import { searchByModuleCode } from '../../../../../../../database-controller/module/methods';
export const findUnrestrictedElectivesRequirementModules = function findUnrestrictedElectivesRequirementModules(totalRequiredMCs, graduationMCs, studentSemesters) {
// get total required MC to graduate
let totalMCsInPlann... |
Add simple helper properties to Problem. | from src.data import meta
class Problem(object):
def __init__(self, name, lines):
self.name = name
self.lines = lines
self._solutions = None
self._constraints = []
@property
def kind(self):
return str(type(self)).strip("'<>").split('.').pop()
@property
def solution(self):
return se... | from src.data import meta
class Problem(object):
def __init__(self, name, lines):
self.name = name
self.lines = lines
self._solutions = None
self._constraints = []
def constrain(self, fn):
self._constraints.append(fn)
# Invalidate solutions.
self._solutions = None
def solutions(sel... |
Add favName field to addFavorite() | var Storage = require('FuseJS/Storage');
var data = 'favorites';
/* ...
-----------------------------------------------------------------------------*/
var addFavorite
, deleteFavorite
, getFavorites;
/* Functions
-----------------------------------------------------------------------------*/
addFavorite = functi... | var Storage = require('FuseJS/Storage');
var data = 'favorites';
/* ...
-----------------------------------------------------------------------------*/
var addFavorite
, deleteFavorite
, getFavorites;
/* Functions
-----------------------------------------------------------------------------*/
addFavorite = functi... |
Replace Ember bindings with aliases | define([
"Ember",
"text!templates/components/infinitescroll.html.hbs"
], function( Ember, template ) {
var get = Ember.get;
var alias = Ember.computed.alias;
var or = Ember.computed.or;
return Ember.Component.extend({
layout: Ember.HTMLBars.compile( template ),
tagName: "button",
classNameBindings: [ ":bt... | define([
"Ember",
"text!templates/components/infinitescroll.html.hbs"
], function( Ember, template ) {
var get = Ember.get;
var or = Ember.computed.or;
return Ember.Component.extend({
layout: Ember.HTMLBars.compile( template ),
tagName: "button",
classNameBindings: [ ":btn", ":btn-with-icon", ":infinitescr... |
Fix - removed "public" access modifiers on interface methods | package com.maxmind.geoip2;
import com.maxmind.geoip2.exception.GeoIp2Exception;
import com.maxmind.geoip2.model.CityResponse;
import com.maxmind.geoip2.model.CountryResponse;
import java.io.IOException;
import java.net.InetAddress;
public interface GeoIp2Provider {
/**
* @param ipAddress IPv4 or IPv6 addr... | package com.maxmind.geoip2;
import com.maxmind.geoip2.exception.GeoIp2Exception;
import com.maxmind.geoip2.model.CityResponse;
import com.maxmind.geoip2.model.CountryResponse;
import java.io.IOException;
import java.net.InetAddress;
public interface GeoIp2Provider {
/**
* @param ipAddress IPv4 or IPv6 addr... |
Allow actions to use `publish.when`.
Since publish was being defined and not alias, actions could not use ``publish.when`.
In addition, publish and publish.when must be defined on the instance as publish.when calls
will not have the right `this` context. | import App from "./App";
export default class Action {
constructor() {
// Need to save publishers on this instance so we can mutate the publish w/ when.
this.publish = this.publish.bind(this);
this.publish.when = this.publishWhen.bind(this);
}
dispatchAction(...args) {
retu... | import App from "./App";
export default class Action {
dispatchAction(...args) {
return App.dispatchAction(...args);
}
get logger() {
return App.logger(this.ns);
}
get events() {
return App.events;
}
publish(ev, ...args) {
return App.events.publish(`${this... |
Change where legacy outputs to in order to match current components. | module.exports = function(grunt) {
'use strict';
grunt.initConfig({
/**
* Pull in the package.json file so we can read its metadata.
*/
pkg: grunt.file.readJSON('package.json'),
/**
* LESS: https://github.com/gruntjs/grunt-contrib-less
*
* Compile LESS files to CSS.
*/... | module.exports = function(grunt) {
'use strict';
grunt.initConfig({
/**
* Pull in the package.json file so we can read its metadata.
*/
pkg: grunt.file.readJSON('package.json'),
/**
* LESS: https://github.com/gruntjs/grunt-contrib-less
*
* Compile LESS files to CSS.
*/... |
Add a stub implementation of onWritabilityChange | package io.elssa.net;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import io.netty.channel.ChannelHandlerContext;
public abstract class MessageRouterBase {
private List<MessageListener> listeners
= Collections.synchronizedList(new ArrayList<>());
/**
* Adds ... | package io.elssa.net;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public abstract class MessageRouterBase {
private List<MessageListener> listeners
= Collections.synchronizedList(new ArrayList<>());
/**
* Adds a message listener (consumer) to this MessageRou... |
Add charset to HTML5 doc (and make more XHTML friendly)
git-svn-id: e52e7dec99011c9686d89c3d3c01e7ff0d333eee@2609 eee81c28-f429-11dd-99c0-75d572ba1ddd | <!DOCTYPE html>
<?php
/*
* fileopen.php
* To be used with ext-server_opensave.js for SVG-edit
*
* Licensed under the MIT License
*
* Copyright(c) 2010 Alexis Deveria
*
*/
// Very minimal PHP file, all we do is Base64 encode the uploaded file and
// return it to the editor
$file = $_FILES['svg_file']['tmp_n... | <!doctype html>
<?php
/*
* fileopen.php
* To be used with ext-server_opensave.js for SVG-edit
*
* Licensed under the MIT License
*
* Copyright(c) 2010 Alexis Deveria
*
*/
// Very minimal PHP file, all we do is Base64 encode the uploaded file and
// return it to the editor
$file = $_FILES['svg_file']['tmp_n... |
Include providerData for queue items | const db = require('sqlite')
const squel = require('squel')
async function getQueue (roomId) {
const result = []
const entities = {}
try {
const q = squel.select()
.field('queueId, mediaId, userId')
.field('media.title, media.duration, media.provider, media.providerData')
.field('users.nam... | const db = require('sqlite')
const squel = require('squel')
async function getQueue (roomId) {
const result = []
const entities = {}
try {
const q = squel.select()
.field('queueId, mediaId, userId')
.field('media.title, media.duration, media.provider, users.name AS username, artists.name AS arti... |
Kill this use strict for now
Should explicitly assign to global at some point I guess. | /*global browser:true, protractor:true, httpBackend:true, By:true, expect:true, Promise:true */
var CustomWorld = (function () {
var chai = require('chai');
var chaiAsPromised = require('chai-as-promised');
var HttpBackendProxy = require('http-backend-proxy');
var CustomWorld = function CustomWorld ()... | /*global browser:true, protractor:true, httpBackend:true, By:true, expect:true, Promise:true */
'use strict';
var CustomWorld = (function () {
var chai = require('chai');
var chaiAsPromised = require('chai-as-promised');
var HttpBackendProxy = require('http-backend-proxy');
var CustomWorld = function ... |
Fix regex to include .jsx | var path = require('path');
var webpack = require('webpack');
module.exports = {
devtool: 'eval',
entry: [
'webpack-dev-server/client?http://localhost:3000',
'webpack/hot/only-dev-server',
'./index'
],
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js',
publicPath: '/st... | var path = require('path');
var webpack = require('webpack');
module.exports = {
devtool: 'eval',
entry: [
'webpack-dev-server/client?http://localhost:3000',
'webpack/hot/only-dev-server',
'./index'
],
output: {
path: path.join(__dirname, 'dist'),
filename: 'bundle.js',
publicPath: '/st... |
Switch sitemap index extractor to use sax speediness | <?php
namespace webignition\WebResource\Sitemap\UrlExtractor;
class SitemapsOrgXmlIndexUrlExtractor extends UrlExtractor {
public function extract($content) {
$urls = array();
$xmlParser = new \Hobnob\XmlStreamReader\Parser();
$xmlParser->registerCallback(
'/s... | <?php
namespace webignition\WebResource\Sitemap\UrlExtractor;
class SitemapsOrgXmlIndexUrlExtractor extends UrlExtractor {
public function extract($content) {
$urls = array();
$queryPath = new \QueryPath();
try {
$queryPath->withXML($content, 'sitemap loc')->each(func... |
Return early from main fn instead of using conditionals | 'use strict'
var toArray = require('stream-to-array')
var Promise = require('bluebird')
module.exports = streamToPromise
function streamToPromise (stream) {
if (stream.readable) return fromReadable(stream)
if (stream.writable) return fromWritable(stream)
return Promise.resolve()
}
function fromReadable (strea... | 'use strict'
var toArray = require('stream-to-array')
var Promise = require('bluebird')
module.exports = streamToPromise
function streamToPromise (stream) {
var promise
if (stream.readable) {
promise = fromReadable(stream)
} else if (stream.writable) {
promise = fromWritable(stream)
} else {
prom... |
Include the examples in the LiSE package | # This file is part of LiSE, a framework for life simulation games.
# Copyright (c) Zachary Spector, zacharyspector@gmail.com
import sys
if sys.version_info[0] < 3 or (
sys.version_info[0] == 3 and
sys.version_info[1] < 3
):
raise RuntimeError("LiSE requires Python 3.3 or later")
from setuptools i... | # This file is part of LiSE, a framework for life simulation games.
# Copyright (c) Zachary Spector, zacharyspector@gmail.com
import sys
if sys.version_info[0] < 3 or (
sys.version_info[0] == 3 and
sys.version_info[1] < 3
):
raise RuntimeError("LiSE requires Python 3.3 or later")
from setuptools i... |
Set base url for production env | /* jshint node: true */
module.exports = function(environment) {
var ENV = {
modulePrefix: 'dummy',
environment: environment,
baseURL: '/',
locationType: 'auto',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. 'with-contr... | /* jshint node: true */
module.exports = function(environment) {
var ENV = {
modulePrefix: 'dummy',
environment: environment,
baseURL: '/',
locationType: 'auto',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. 'with-contr... |
Add ENFORCE_PRIVACY to Travis testing settings. | SQLALCHEMY_DATABASE_TEST_URI = 'postgresql://postgres:@localhost/pybossa'
GOOGLE_CLIENT_ID = ''
GOOGLE_CLIENT_SECRET = ''
TWITTER_CONSUMER_KEY=''
TWITTER_CONSUMER_SECRET=''
FACEBOOK_APP_ID=''
FACEBOOK_APP_SECRET=''
TERMSOFUSE = 'http://okfn.org/terms-of-use/'
DATAUSE = 'http://opendatacommons.org/licenses/by/'
ITSDANGE... | SQLALCHEMY_DATABASE_TEST_URI = 'postgresql://postgres:@localhost/pybossa'
GOOGLE_CLIENT_ID = ''
GOOGLE_CLIENT_SECRET = ''
TWITTER_CONSUMER_KEY=''
TWITTER_CONSUMER_SECRET=''
FACEBOOK_APP_ID=''
FACEBOOK_APP_SECRET=''
TERMSOFUSE = 'http://okfn.org/terms-of-use/'
DATAUSE = 'http://opendatacommons.org/licenses/by/'
ITSDANGE... |
Add "short" param serialized name. | package com.github.daniel_sc.rocketchat.modern_client.request;
import com.google.gson.annotations.SerializedName;
/**
* {@link} https://rocket.chat/docs/developer-guides/rest-api/chat/postmessage/#attachments-detail
*
*/
public class AttachmentField {
/**
* Whether this field should be a short field. *
*/... | package com.github.daniel_sc.rocketchat.modern_client.request;
/**
* {@link} https://rocket.chat/docs/developer-guides/rest-api/chat/postmessage/#attachments-detail
*
*/
public class AttachmentField {
/**
* Whether this field should be a short field.
*/
public boolean _short = false;
/**
* The title of... |
Revert "Add angular to document directly"
This reverts commit 09212f1a5b650856cab67ffa080830f1505a3944. | import test from 'ava';
import jsdom from 'jsdom';
test.before(t => {
// Angular dependencies
global.document = jsdom.jsdom('<!doctype html><html><head><meta charset="utf-8"></head><body></body></html>');
global.window = document.defaultView;
global.Node = global.window.Node;
require('angular/angular');
... | import test from 'ava';
import jsdom from 'jsdom';
import fs from 'fs';
test.before(t => {
// Angular dependencies
const angularScript = fs.readFileSync('../node_modules/angular/angular.js', 'utf8');
global.document = jsdom.jsdom(`<!doctype html><html><head><meta charset="utf-8"><script>${angularScript}</script... |
Add missing import for navigation | import React from 'react';
import Router from 'react-router';
import stores from 'stores';
import SecondaryAdminNavigation from './SecondaryAdminNavigation.react';
import ResourceMaster from './ResourceMaster.react';
import ImageMaster from './ImageMaster.react';
let RouteHandler = Router.RouteHandler;
export defaul... | import React from 'react';
import Router from 'react-router';
import stores from 'stores';
import ResourceMaster from './ResourceMaster.react';
import ImageMaster from './ImageMaster.react';
let RouteHandler = Router.RouteHandler;
export default React.createClass({
mixins: [Router.State],
render: function ... |
Put database and nonces in modals | <?php
define('COOKIE_SESSION', true);
require_once("../config.php");
session_start();
require_once("gate.php");
if ( $REDIRECTED === true || ! isset($_SESSION["admin"]) ) return;
setcookie("adminmenu","true", 0, "/");
\Tsugi\Core\LTIX::getConnection();
$OUTPUT->header();
$OUTPUT->bodyStart();
$OUTPUT->topNav();
requ... | <?php
define('COOKIE_SESSION', true);
require_once("../config.php");
session_start();
require_once("gate.php");
if ( $REDIRECTED === true || ! isset($_SESSION["admin"]) ) return;
setcookie("adminmenu","true", 0, "/");
\Tsugi\Core\LTIX::getConnection();
$OUTPUT->header();
$OUTPUT->bodyStart();
$OUTPUT->topNav();
requ... |
Fix long description format to be markdown | #! /usr/bin/env python
from setuptools import setup
import re
from os import path
version = ''
with open('cliff/__init__.py', 'r') as fd:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1)
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_... | #! /usr/bin/env python
from setuptools import setup
import re
from os import path
version = ''
with open('cliff/__init__.py', 'r') as fd:
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE).group(1)
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_... |
Add PIN variables and constants | package org.cryptonit;
import javacard.framework.APDU;
import javacard.framework.Applet;
import javacard.framework.ISO7816;
import javacard.framework.ISOException;
import javacard.framework.OwnerPIN;
public class CryptonitApplet extends Applet {
private OwnerPIN pin;
private final static byte PIN_MAX_LENGTH ... | package org.cryptonit;
import javacard.framework.APDU;
import javacard.framework.Applet;
import javacard.framework.ISO7816;
import javacard.framework.ISOException;
public class CryptonitApplet extends Applet {
protected CryptonitApplet(byte[] bArray, short bOffset, byte bLength) {
register();
}
p... |
Discard active tabs if their window is minimized | (function(tabs, windows){
"use strict";
const specialUrls =/chrome-extension:|chrome:|chrome-devtools:|file:|chrome.google.com\/webstore/;
let discardAllTabs = () => {
windows.getAll({populate: true}, windowsList => windowsList.forEach( win => {
const minimized = win.state === 'minimi... | (function(tabs, windows){
"use strict";
const specialUrls =/chrome-extension:|chrome:|chrome-devtools:|file:|chrome.google.com\/webstore/;
let discardAllTabs = () => {
windows.getAll({populate: true}, windowsList => windowsList.forEach( win => {
win.tabs.forEach( tab => {
... |
Add getLanguage method to languages mixin.
This is more suitable for passing to JST template | window.ModelWithLanguageMixin = {
LANGUAGE_CHOICES: {
en: 'English',
es: 'Spanish',
hi: 'Hindi',
pt: 'Portuguese',
ru: 'Russian',
ja: 'Japanese',
de: 'German',
id: 'Malay/Indonesian',
vi: 'Vietnamese',
ko: 'Korean',
fr: 'French',
fa: 'Persian',
... | window.ModelWithLanguageMixin = {
LANGUAGE_CHOICES: {
en: 'English',
es: 'Spanish',
hi: 'Hindi',
pt: 'Portuguese',
ru: 'Russian',
ja: 'Japanese',
de: 'German',
id: 'Malay/Indonesian',
vi: 'Vietnamese',
ko: 'Korean',
fr: 'French',
fa: 'Persian',
... |
Use multiple WebKit web processes.
A new feature for WebKit2GTK+ 2.4, we can now specify to use multiple
webkit web processes rather than all webviews sharing the same
process.
If a tab's web process is not shared with any other's (although
currently unimplemented, this may happen when a tab is opened by
another webv... | // Copyright (c) 2014 Josh Rickmar.
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package main
import (
"runtime"
"github.com/conformal/gotk3/gtk"
"github.com/jrick/go-webkit2/wk2"
)
const HomePage HTMLPageDescription = "https://www.duckduckgo.com/lite"
const... | // Copyright (c) 2014 Josh Rickmar.
// Use of this source code is governed by an ISC
// license that can be found in the LICENSE file.
package main
import (
"github.com/conformal/gotk3/gtk"
"runtime"
)
const HomePage HTMLPageDescription = "https://www.duckduckgo.com/lite"
const (
defaultWinWidth = 1024
default... |
Fix equality statement to use === rather than ==. | Application.Services.factory('watcher',
function () {
var watcherService = {};
watcherService.watch = function (scope, variable, fn) {
scope.$watch(variable, function (newval, oldval) {
if (!newval && !oldval) {
return;
}
... | Application.Services.factory('watcher',
function () {
var watcherService = {};
watcherService.watch = function (scope, variable, fn) {
scope.$watch(variable, function (newval, oldval) {
if (!newval && !oldval) {
return;
}
... |
Use transfer to xml in refactor script | <?php
require_once(__DIR__ . '/../vendor/autoload.php');
spl_autoload_register(function ($class) {
$class = str_replace(['ReneFactor', '\\'], ['', DIRECTORY_SEPARATOR], $class);
$classPath = __DIR__ . DIRECTORY_SEPARATOR . $class . '.php';
require_once $classPath;
});
use Symfony\Component\Console\Outpu... | <?php
require_once(__DIR__ . '/../vendor/autoload.php');
spl_autoload_register(function ($class) {
$class = str_replace(['ReneFactor', '\\'], ['', DIRECTORY_SEPARATOR], $class);
$classPath = __DIR__ . DIRECTORY_SEPARATOR . $class . '.php';
require_once $classPath;
});
use Symfony\Component\Console\Outpu... |
784: Remove the type field as its not required. | const config = require('../../../knexfile').web
const knex = require('knex')(config)
module.exports = function (id) {
var table = 'team_caseload_overview'
var whereObject = {}
if (id !== undefined) {
whereObject.id = id
}
return knex(table)
.where(whereObject)
.select('name',
'grade_c... | const config = require('../../../knexfile').web
const knex = require('knex')(config)
module.exports = function (id, type) {
var table = 'team_caseload_overview'
var whereObject = {}
if (id !== undefined) {
whereObject.id = id
}
return knex(table)
.where(whereObject)
.select('name',
'g... |
chore: Add a 10s timeout to reachable-url | #!/usr/bin/env node
'use strict';
var stdin = process.openStdin();
var async = require('async');
var reachableUrl = require('reachable-url')
if (require.main === module) {
main();
} else {
module.exports = resolveUrls;
}
function main() {
stdin.setEncoding('utf8');
stdin.on('data', function(err, da... | #!/usr/bin/env node
'use strict';
var stdin = process.openStdin();
var async = require('async');
var reachableUrl = require('reachable-url')
if (require.main === module) {
main();
} else {
module.exports = resolveUrls;
}
function main() {
stdin.setEncoding('utf8');
stdin.on('data', function(err, da... |
Make key_sizes a frozenset, since these are/should be immutable | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... | # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the... |
Disable SSL in database connection for now | package db
import (
"database/sql"
"fmt"
"github.com/rafaeljusto/cctldstats/config"
)
// Connection database connection.
var Connection *sql.DB
// Connect performs the database connection. Today the following databases are supported: mysql and postgres
func Connect() (err error) {
var connParams string
switch ... | package db
import (
"database/sql"
"fmt"
"github.com/rafaeljusto/cctldstats/config"
)
// Connection database connection.
var Connection *sql.DB
// Connect performs the database connection. Today the following databases are supported: mysql and postgres
func Connect() (err error) {
var connParams string
switch ... |
Fix for Authentication scenario to correctly use self.clients
Scenario has recently been refactored, self.clients in Scenario
now takes the name of the CLI client. During the refactoring,
the Authenticate scenario was not correctly updated, which
causes the authentication scenario to fail. This patch fixes
that.
Chan... | # Copyright 2014 Red Hat, Inc. <http://www.redhat.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 2014 Red Hat, Inc. <http://www.redhat.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... |
Allow empty strings as instructions | from django.db import models
from experiment_session.models import ExperimentSession
from django.core.validators import MinValueValidator
class Experiment(models.Model):
LIGHTOFF_FIXED = 'fixed'
LIGHTOFF_WAITING = 'waiting'
_LIGHTOFF_CHOICES = (
(LIGHTOFF_FIXED, 'Fixed'),
(LIGHTOFF_WAITING... | from django.db import models
from experiment_session.models import ExperimentSession
from django.core.validators import MinValueValidator
class Experiment(models.Model):
LIGHTOFF_FIXED = 'fixed'
LIGHTOFF_WAITING = 'waiting'
_LIGHTOFF_CHOICES = (
(LIGHTOFF_FIXED, 'Fixed'),
(LIGHTOFF_WAITING... |
Make stetho agent when install stetho | # Copyright 2015 UnitedStack, Inc.
# All Rights Reserved.
#
# 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 require... | # Copyright 2015 UnitedStack, Inc.
# All Rights Reserved.
#
# 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 require... |
Fix in ModuleRegistry to properly disable module without unloading them | /***************************** BEGIN LICENSE BLOCK ***************************
The contents of this file are subject to the Mozilla Public License, v. 2.0.
If a copy of the MPL was not distributed with this file, You can obtain one
at http://mozilla.org/MPL/2.0/.
Software distributed under the License is distri... | /***************************** BEGIN LICENSE BLOCK ***************************
The contents of this file are subject to the Mozilla Public License, v. 2.0.
If a copy of the MPL was not distributed with this file, You can obtain one
at http://mozilla.org/MPL/2.0/.
Software distributed under the License is distri... |
Return the right URL when a file is posted | # -*- coding: utf-8 -*-
# vim: set ts=4
from django.forms import ModelForm
from django.http import Http404, HttpResponse
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.views.decorators.csrf import csrf_exempt
from Artifactor.models import Artifact
def index(re... | # -*- coding: utf-8 -*-
# vim: set ts=4
from django.forms import ModelForm
from django.http import Http404, HttpResponseRedirect
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.views.decorators.csrf import csrf_exempt
from Artifactor.models import Artifact
def ... |
Use command's hash code method | package tests;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertSame;
import com.github.sormuras.bach.Command;
import org.junit.jupiter.api.Test;
import tests.util.Print;
class CommandTests {
@Test
void withoutArguments() {
var command = Comma... | package tests;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertSame;
import com.github.sormuras.bach.Command;
import org.junit.jupiter.api.Test;
import tests.util.Print;
class CommandTests {
@Test
void withoutArguments() {
var command = Comma... |
Fix url when using cdnUrl with S3. Null url was incorrectly used as path | <?php
namespace FoF\Upload\Adapters;
use FoF\Upload\Contracts\UploadAdapter;
use FoF\Upload\File;
use FoF\Upload\Helpers\Settings;
use Illuminate\Support\Arr;
class AwsS3 extends Flysystem implements UploadAdapter
{
protected function generateUrl(File $file)
{
/** @var Settings $settings */
$... | <?php
namespace FoF\Upload\Adapters;
use FoF\Upload\Contracts\UploadAdapter;
use FoF\Upload\File;
use FoF\Upload\Helpers\Settings;
use Illuminate\Support\Arr;
class AwsS3 extends Flysystem implements UploadAdapter
{
protected function generateUrl(File $file)
{
/** @var Settings $settings */
$... |
Change sleep function to the end to do repeat everytime | # coding=utf8
# 31.220.16.242
# 216.58.222.46
import socket
import time
import webbrowser
def checkdns():
print time.ctime()
retorno = True
try:
ip = socket.gethostbyname('google.com')
print ("O IP do host verificado é: " + ip)
if ip == "216.58.22.46":
... | # coding=utf8
# 31.220.16.242
# 216.58.222.46
import socket
import time
import webbrowser
def checkdns():
print time.ctime()
retorno = True
try:
ip = socket.gethostbyname('google.com')
print ("O IP do host verificado é: " + ip)
if ip == "216.58.222.46":
... |
Add teardown function as well | import unittest
import os
from main import generate_files
class WordsTest(unittest.TestCase):
def setUp(self):
# Make sure the expected files don't exist yet
for fname in ["test_sequences", "test_words"]:
if os.path.exists(fname):
os.remove(fname)
def test_files_cr... | import unittest
import os
from main import generate_files
class WordsTest(unittest.TestCase):
def setUp(self):
for fname in ["test_sequences", "test_words"]:
if os.path.exists(fname):
os.remove(fname)
def test_files_created(self):
self.assertFalse(os.path.exists("t... |
Update maintainer to Blanc Ltd | #!/usr/bin/env python
from setuptools import find_packages, setup
# Use quickphotos.VERSION for version numbers
version_tuple = __import__('quickphotos').VERSION
version = '.'.join([str(v) for v in version_tuple])
setup(
name='django-quick-photos',
version=version,
description='Latest Photos from Instagra... | #!/usr/bin/env python
from setuptools import find_packages, setup
# Use quickphotos.VERSION for version numbers
version_tuple = __import__('quickphotos').VERSION
version = '.'.join([str(v) for v in version_tuple])
setup(
name='django-quick-photos',
version=version,
description='Latest Photos from Instagra... |
Fix return of Terminal instance when term method accept string | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 23.06.2017 16:39
:Licence GNUv3
Part of grammpy
"""
from .RawGrammar import RawGrammar as Grammar
class StringGrammar(Grammar):
@staticmethod
def __to_string_arr(t):
if isinstance(t, str):
return [t]
retu... | #!/usr/bin/env python
"""
:Author Patrik Valkovic
:Created 23.06.2017 16:39
:Licence GNUv3
Part of grammpy
"""
from .RawGrammar import RawGrammar as Grammar
class StringGrammar(Grammar):
@staticmethod
def __to_string_arr(t):
if isinstance(t, str):
return [t]
retu... |
Fix up mixpanel course tracking | from modules.mixpanel.mixpanel import track_event_mixpanel
from modules.decorators import view, query, event_handler
import re
SINGLE_PAGES_TO_TRACK = ['/', '/dashboard', '/create_account']
COURSE_PAGES_TO_TRACK = ['/courses', '/about']
@event_handler()
def single_page_track_event(fs, db, response):
for resp in re... | from modules.mixpanel.mixpanel import track_event_mixpanel
from modules.decorators import view, query, event_handler
import re
SINGLE_PAGES_TO_TRACK = ['/', '/dashboard', '/create_account']
REGEX_PAGES_TO_TRACK = ['/course', '/about']
@event_handler()
def single_page_track_event(fs, db, response):
for resp in resp... |
Remove foreign keys as Laravel cant detect class | <?php
/*
* This file is part of Laravel CrowdAuth
*
* (c) Daniel McAssey <hello@glokon.me>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
c... | <?php
/*
* This file is part of Laravel CrowdAuth
*
* (c) Daniel McAssey <hello@glokon.me>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
c... |
tools: Fix Python 3 incompatibility for building with Eclipse on Windows | #!/usr/bin/env python
#
# Wrapper to run make and preprocess any paths in the output from MSYS Unix-style paths
# to Windows paths, for Eclipse
from __future__ import print_function, division
import sys
import subprocess
import os.path
import re
UNIX_PATH_RE = re.compile(r'(/[^ \'"]+)+')
paths = {}
def check_path(p... | #!/usr/bin/env python
#
# Wrapper to run make and preprocess any paths in the output from MSYS Unix-style paths
# to Windows paths, for Eclipse
from __future__ import print_function, division
import sys
import subprocess
import os.path
import re
UNIX_PATH_RE = re.compile(r'(/[^ \'"]+)+')
paths = {}
def check_path(p... |
Fix Test by ensuring non-interactivity | <?php
/*
* This file is part of the kreait eZ Publish Migrations Bundle.
*
* This source file is subject to the license that is bundled
* with this source code in the file LICENSE.
*/
namespace Kreait\EzPublish\MigrationsBundle\Tests\Command;
use Kreait\EzPublish\MigrationsBundle\Command\VersionCommand;
use Kre... | <?php
/*
* This file is part of the kreait eZ Publish Migrations Bundle.
*
* This source file is subject to the license that is bundled
* with this source code in the file LICENSE.
*/
namespace Kreait\EzPublish\MigrationsBundle\Tests\Command;
use Kreait\EzPublish\MigrationsBundle\Command\VersionCommand;
use Kre... |
Revert "Temporarily disallow rule cloning (for benchmarks)"
This reverts commit 15c01bdcc559e04fad09f19672e7306b3e316f2a. | package org.metaborg.meta.lang.dynsem.interpreter.nodes.rules;
import org.metaborg.meta.lang.dynsem.interpreter.DynSemLanguage;
import org.metaborg.meta.lang.dynsem.interpreter.nodes.DynSemRootNode;
import com.oracle.truffle.api.frame.FrameDescriptor;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracl... | package org.metaborg.meta.lang.dynsem.interpreter.nodes.rules;
import org.metaborg.meta.lang.dynsem.interpreter.DynSemLanguage;
import org.metaborg.meta.lang.dynsem.interpreter.nodes.DynSemRootNode;
import com.oracle.truffle.api.frame.FrameDescriptor;
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracl... |
Fix route binding for nested recipes | // This file defines all routes and function handling these routes.
// All routes are accessible using GET and POST methods.
const routes = {
'/item': require('../controllers/items/byId.js'),
'/item/:id': require('../controllers/items/byId.js'),
'/items': require('../controllers/items/byIds.js'),
'/items/all':... | // This file defines all routes and function handling these routes.
// All routes are accessible using GET and POST methods.
const routes = {
'/item': require('../controllers/items/byId.js'),
'/item/:id': require('../controllers/items/byId.js'),
'/items': require('../controllers/items/byIds.js'),
'/items/all':... |
Fix for missing default in currency filter | from decimal import Decimal as D
from decimal import InvalidOperation
from babel.numbers import format_currency
from django import template
from django.conf import settings
from django.utils.translation import get_language, to_locale
register = template.Library()
@register.filter(name='currency')
def currency(value... | from decimal import Decimal as D
from decimal import InvalidOperation
from babel.numbers import format_currency
from django import template
from django.conf import settings
from django.utils.translation import get_language, to_locale
register = template.Library()
@register.filter(name='currency')
def currency(value... |
Update to the new drive state | 'use strict';
var should = require('should');
var config = require('../config/configuration.js');
var retrieve = require('../lib/provider-google-drive/helpers/retrieve.js');
describe("Retrieve files", function () {
it("should list files when no id passed and return the id of the last document", function(done) {
... | 'use strict';
var should = require('should');
var config = require('../config/configuration.js');
var retrieve = require('../lib/provider-google-drive/helpers/retrieve.js');
describe("Retrieve files", function () {
it("should list files when no id passed and return the id of the last document", function(done) {
... |
Update icons div to h4 | import React from 'react';
import WeatherIcons from '../weather_icons/WeatherIcons';
const TenDay = ({ tenDayForecast }) => {
if(!tenDayForecast) {
return(
<div></div>
)
}
const forecastArray = tenDayForecast.simpleforecast.forecastday;
const icons = new WeatherIcons();
const tenDayDataLoop = ... | import React from 'react';
import WeatherIcons from '../weather_icons/WeatherIcons';
const TenDay = ({ tenDayForecast }) => {
if(!tenDayForecast) {
return(
<div></div>
)
}
const forecastArray = tenDayForecast.simpleforecast.forecastday;
const icons = new WeatherIcons();
const tenDayDataLoop = ... |
Replace local tile URL with Chattanooga Public Library map tiles on GitHub. | var southWest = L.latLng(34.9816, -85.4719);
var northEast = L.latLng(35.217, -85.0462);
var center = L.latLng(35.0657, -85.241);
var bounds = L.latLngBounds(southWest, northEast);
var map = L.map('map', {
maxZoom: 18,
minZoom: 11,
maxBounds: bounds,
center: center,
zoom: 12
});
L.tileLayer('http://chattano... | var southWest = L.latLng(34.9816, -85.4719);
var northEast = L.latLng(35.217, -85.0462);
var center = L.latLng(35.0657, -85.241);
var bounds = L.latLngBounds(southWest, northEast);
var map = L.map('map', {
maxZoom: 18,
minZoom: 11,
maxBounds: bounds,
center: center,
zoom: 12
});
L.tileLayer('static/tiles/{z... |
Add OK reaction to reload command | import discord
from discord.ext import commands
class Owner:
"""Admin-only commands that make the bot dynamic."""
def __init__(self, bot):
self.bot = bot
@commands.command()
@commands.is_owner()
async def close(self, ctx: commands.Context):
"""Closes the bot safely. Can only be u... | import discord
from discord.ext import commands
class Owner:
"""Admin-only commands that make the bot dynamic."""
def __init__(self, bot):
self.bot = bot
@commands.command()
@commands.is_owner()
async def close(self, ctx: commands.Context):
"""Closes the bot safely. Can only be u... |
Remove test of built-in "NotImplementedError" exception. | import unittest
from pymodbus3.exceptions import *
class SimpleExceptionsTest(unittest.TestCase):
"""
This is the unittest for the pymodbus3.exceptions module
"""
def setUp(self):
""" Initializes the test environment """
self.exceptions = [
ModbusException("bad base"),
... | import unittest
from pymodbus3.exceptions import *
class SimpleExceptionsTest(unittest.TestCase):
"""
This is the unittest for the pymodbus3.exceptions module
"""
def setUp(self):
""" Initializes the test environment """
self.exceptions = [
ModbusException("bad base"),
... |
Add method for instrument bank | #import pygame.midi.Output
from pygame.midi import Output
class Output(Output):#pygame.midi.Output):
def set_pan(self, pan, channel):
assert (0 <= channel <= 15)
assert pan <= 127
self.write_short(0xB0 + channel, 0x0A, pan)
def set_volume(self, volume, channel):
... | #import pygame.midi.Output
from pygame.midi import Output
class Output(Output):#pygame.midi.Output):
def set_pan(self, pan, channel):
assert (0 <= channel <= 15)
assert pan <= 127
self.write_short(0xB0 + channel, 0x0A, pan)
def set_volume(self, volume, channel):
... |
Use watchify instead of grunt-contrib-watch for faster watched builds. | module.exports = function (grunt) {
'use strict';
grunt.loadNpmTasks('grunt-browserify');
// Project configuration.
grunt.initConfig({
browserify: {
options: {
browserifyOptions: {
debug: true // Ask for source maps
},
// Don't ignore transpilation in node_module... | module.exports = function (grunt) {
'use strict';
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-contrib-watch');
// Project configuration.
grunt.initConfig({
browserify: {
options: {
browserifyOptions: {
debug: true // Ask for source maps
},
... |
Return an array instead of a json file | 'use strict';
const fs = require('fs');
const dss = require('dss');
const glob = require('glob');
class Doki {
constructor(files) {
this.files = files;
this.parsedArray = [];
}
parse(destFile, options) {
let files;
options || {};
if (Array.isArray(this.files)) {
files = this.files... | 'use strict';
const fs = require('fs');
const dss = require('dss');
const glob = require('glob');
class Doki {
constructor(files) {
this.files = files;
this.parsedArray = [];
}
parse(destFile, options) {
let files;
options || {};
if (Array.isArray(this.files)) {
files = this.files... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.