text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Check membership when a Member is saved | import datetime
from django.conf import settings
from django.core.mail import EmailMultiAlternatives
from django.db.models.signals import pre_save
from django.dispatch import receiver
from django.template import loader
from django.utils import timezone
from simple_email_confirmation import unconfirmed_email_created
fr... | from django.conf import settings
from django.core.mail import EmailMultiAlternatives
from django.dispatch import receiver
from django.template import loader
from simple_email_confirmation import unconfirmed_email_created
@receiver(unconfirmed_email_created, dispatch_uid='send_email_confirmation')
def send_confirmati... |
Fix compilation on OS X
As OS X doesn't have it's own interrupts provider, don't build
interrupts_common on OS X as well. Otherwise build fails, because
interrupts_common depends on variables provided by platform-specific
files.
Signed-off-by: Pavel Borzenkov <073b1820d4178210f16262dddeb2ba44fb7467d3@gmail.com> | // Copyright 2015 The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to... | // Copyright 2015 The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to... |
Use the png module in test. | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import unittest
import faint
from faint import png
import os
import py_ext_tests
class TestPng(unittest.TestCase):
def test_write_png(self):
out_dir = py_ext_tests.make_test_dir(self)
b1 = faint.Bitmap((5,7))
b1.set_pixel((0,0... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import unittest
import faint
import os
import py_ext_tests
class TestPng(unittest.TestCase):
def test_write_png(self):
out_dir = py_ext_tests.make_test_dir(self)
b1 = faint.Bitmap((5,7))
b1.set_pixel((0,0),(255,0,255))
... |
Add update to useReducer comments
Co-Authored-By: Chris Petty <637933a5c948ed3d23257417b9455449bf8cfd77@gmail.com> | import { useReducer, useCallback } from 'react';
import getReducer from '../pages/dataTableUtilities/reducer/getReducer';
import getColumns from '../pages/dataTableUtilities/columns';
import { debounce } from '../utilities/index';
/**
* useReducer wrapper for pages within the app. Creates a
* composed reducer throug... | import { useReducer, useCallback } from 'react';
import getReducer from '../pages/dataTableUtilities/reducer/getReducer';
import getColumns from '../pages/dataTableUtilities/columns';
import { debounce } from '../utilities/index';
/**
* useReducer wrapper for pages within the app. Creaates a
* composed reducer throu... |
Fix up wmata controller tests | /* eslint-env mocha */
const redisMock = require('redis-mock');
const chai = require('chai');
chai.should();
const db = {
redis: redisMock.createClient(),
};
const fakeRedis = redisMock.createClient();
const wmata = require('../../controllers/wmata.js')(db);
describe('WMATA Controllers - ', () => {
it('Method get... | /* eslint-env mocha */
const redisMock = require('redis-mock');
const chai = require('chai');
chai.should();
const db = {
redis: redisMock.createClient(),
};
const fakeRedis = redisMock.createClient();
const wmata = require('../../controllers/wmata.js')(db);
describe('WMATA Controllers - ', () => {
it('Method get... |
[KARAF-1109] Update the archetypes itest to reflect the new karaf-command-archetype artifactId
git-svn-id: 71d8a689455c5fbb0f077bc40adcfc391e14cb9d@1214843 13f79535-47bb-0310-9956-ffa450edef68 | /*
* 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 may ... | /*
* 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 may ... |
docs(gh-pages): Fix refresh 404 with hash URL | /* jshint node: true */
module.exports = function(environment) {
var ENV = {
modulePrefix: 'dummy',
environment: environment,
baseURL: '/',
locationType: 'auto',
contentSecurityPolicy: {
'img-src': "'self' data: emberjs.com assets-cdn.github.com",
},
EmberENV: {
FEATURES: {
... | /* jshint node: true */
module.exports = function(environment) {
var ENV = {
modulePrefix: 'dummy',
environment: environment,
baseURL: '/',
locationType: 'auto',
contentSecurityPolicy: {
'img-src': "'self' data: emberjs.com assets-cdn.github.com",
},
EmberENV: {
FEATURES: {
... |
Add message if you're using default settings | # Copyright 2014 0xc0170
#
# 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, soft... | # Copyright 2014 0xc0170
#
# 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, soft... |
Update wiki link for new year | import React from 'react';
const Fadder = () => {
return (
<div id="fadder">
<div className="component fadder-content">
<div className="fadder-description">
<h1>Fadderukene.</h1>
<p>
I fadderukene skal du få bli kjent med både linjeforeningen, NTNU og mange medstuden... | import React from 'react';
const Fadder = () => {
return (
<div id="fadder">
<div className="component fadder-content">
<div className="fadder-description">
<h1>Fadderukene.</h1>
<p>
I fadderukene skal du få bli kjent med både linjeforeningen, NTNU og mange medstuden... |
Add enum value `start` used for files with pending multipart upload. | package synapticloop.b2;
/*
* Copyright (c) 2016 synapticloop.
*
* All rights reserved.
*
* This code may contain contributions from other parties which, where
* applicable, will be listed in the default build file for the project
* ~and/or~ in a file named CONTRIBUTORS.txt in the root of the project.
*
... | package synapticloop.b2;
/*
* Copyright (c) 2016 synapticloop.
*
* All rights reserved.
*
* This code may contain contributions from other parties which, where
* applicable, will be listed in the default build file for the project
* ~and/or~ in a file named CONTRIBUTORS.txt in the root of the project.
*
... |
Make doc blocks bc compliant | <?php
/**
* Copyright 2016 SURFnet B.V.
*
* 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... | <?php
/**
* Copyright 2016 SURFnet B.V.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... |
Add important withCredentials flag to API calls | import axios from 'axios';
import createApiUrl from 'helpers/createApiUrl';
import queryParams from 'query-params';
const apiUrl = (requestPath) => {
const prefix = process.env.API_URL;
if (!prefix) {
throw new Error('Please define an API_URL in .env');
}
return createApiUrl(prefix, requestPath);
};
exp... | import axios from 'axios';
import createApiUrl from 'helpers/createApiUrl';
import queryParams from 'query-params';
const apiUrl = (requestPath) => {
const prefix = process.env.API_URL;
if (!prefix) {
throw new Error('Please define an API_URL in .env');
}
return createApiUrl(prefix, requestPath);
};
exp... |
Add map argument to PostCSSPlugin constructor
And simplify the default options | var PostcssCompiler = require('broccoli-postcss');
var checker = require('ember-cli-version-checker');
// PostCSSPlugin constructor
function PostCSSPlugin (options) {
this.name = 'ember-cli-postcss';
this.options = options;
this.plugins = options.plugins;
this.map = options.map;
}
PostCSSPlugin.prototype.toTr... | var PostcssCompiler = require('broccoli-postcss');
var checker = require('ember-cli-version-checker');
function PostCSSPlugin (plugins, options) {
this.name = 'ember-cli-postcss';
options = options || {};
options.inputFile = options.inputFile || 'app.css';
options.outputFile = options.outputFile || 'app.css';
... |
Test exception handling in `check_database` | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_django-watchman
------------
Tests for `django-watchman` views module.
"""
import json
import unittest
from mock import patch
from watchman import views
class TestWatchman(unittest.TestCase):
def setUp(self):
pass
@patch('watchman.views.che... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_django-watchman
------------
Tests for `django-watchman` views module.
"""
import json
import unittest
from mock import patch
from watchman import views
class TestWatchman(unittest.TestCase):
def setUp(self):
pass
@patch('watchman.views.che... |
Fix Charged Hammer / Lightning Jolt | from ..utils import *
##
# Minions
# Tuskarr Totemic
class AT_046:
play = Summon(CONTROLLER, RandomTotem())
# Draenei Totemcarver
class AT_047:
play = Buff(SELF, "AT_047e") * Count(FRIENDLY_MINIONS + TOTEM)
# Thunder Bluff Valiant
class AT_049:
inspire = Buff(FRIENDLY_MINIONS + TOTEM, "AT_049e")
# The Mistc... | from ..utils import *
##
# Hero Powers
# Lightning Jolt
class AT_050t:
play = Hit(TARGET, 2)
##
# Minions
# Tuskarr Totemic
class AT_046:
play = Summon(CONTROLLER, RandomTotem())
# Draenei Totemcarver
class AT_047:
play = Buff(SELF, "AT_047e") * Count(FRIENDLY_MINIONS + TOTEM)
# Thunder Bluff Valiant
class... |
Add existence check for dash source
Safari complains about removing a non-existent child. | import {browser} from '../browser';
export const filterSources = function(playerElement) {
if (playerElement.tagName.toLowerCase() !== 'video') {
return playerElement;
}
var changed = false;
if (browser.has('mp4 support only')) {
// keep only mp4 source
playerElement.querySelectorAll('source').fo... | import {browser} from '../browser';
export const filterSources = function(playerElement) {
if (playerElement.tagName.toLowerCase() !== 'video') {
return playerElement;
}
var changed = false;
if (browser.has('mp4 support only')) {
// keep only mp4 source
playerElement.querySelectorAll('source').fo... |
Add entity id to sync message. | package aeronicamc.mods.mxtune.caps;
import aeronicamc.mods.mxtune.managers.PlayIdSupplier;
import aeronicamc.mods.mxtune.network.PacketDispatcher;
import aeronicamc.mods.mxtune.network.messages.LivingEntityModCapSync;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.RegistryKey;
import net.minecraf... | package aeronicamc.mods.mxtune.caps;
import aeronicamc.mods.mxtune.managers.PlayIdSupplier;
import aeronicamc.mods.mxtune.network.PacketDispatcher;
import aeronicamc.mods.mxtune.network.messages.LivingEntityModCapSync;
import net.minecraft.entity.LivingEntity;
import net.minecraft.util.RegistryKey;
import net.minecraf... |
Test all rules but refnames. | #!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Check the rules
"""
import os
import pkg_resources
import json
import re
import seabird
def test_load_available_rules():
""" Try to read all available rules
https://github.com/castelao/seabird/issues/7
"""
rules_dir = 'rules'
rule_files = pk... | #!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Check the rules
"""
import os
import pkg_resources
import json
import re
import seabird
def test_load_available_rules():
""" Try to read all available rules
https://github.com/castelao/seabird/issues/7
"""
rules_dir = 'rules'
rule_files = pk... |
Use an identity with test data. | package com.facetedworlds.honeydolist.collaboration;
import android.app.Activity;
import com.facetedworlds.honeydolist.ActivityTaskDispatcher;
import com.updatecontrols.correspondence.Community;
import com.updatecontrols.correspondence.CorrespondenceException;
import com.updatecontrols.correspondence.binary.BinaryHTT... | package com.facetedworlds.honeydolist.collaboration;
import android.app.Activity;
import com.facetedworlds.honeydolist.ActivityTaskDispatcher;
import com.updatecontrols.correspondence.Community;
import com.updatecontrols.correspondence.CorrespondenceException;
import com.updatecontrols.correspondence.binary.BinaryHTT... |
Send & read off a channel | package main
import (
"fmt"
"github.com/kidoman/embd"
"bufio"
"os"
"strconv"
"strings"
"time"
)
var blinker Blinker
func output(c chan int) {
seconds := <-c
fmt.Printf("Outputting Hi for %d s\n", seconds)
time.Sleep(time.Duration(seconds) * time.Second)
fmt.Println("Finished outputting Hi")
}
func main(... | package main
import (
"fmt"
"github.com/kidoman/embd"
"bufio"
"os"
"strconv"
"strings"
)
var blinker Blinker
func main() {
var blinker Blinker
err := embd.InitGPIO()
if err != nil {
blinker = new (MockBlinker)
} else {
blinker = new (GPIOBlinker)
}
reader := bufio.NewReader(os.Stdin)
fmt.Print("Ente... |
Add istanbul ignore. Line is tested.
Istanbul isn't picking it up. | // @flow
import type { MessageThemeContext } from './types'
import React, { PureComponent } from 'react'
import styled from '../styled'
import Chat from './Chat'
import classNames from '../../utilities/classNames'
import css from './styles/Embed.css.js'
type Props = {
className?: string,
html: string,
}
type Cont... | // @flow
import type { MessageThemeContext } from './types'
import React, { PureComponent } from 'react'
import styled from '../styled'
import Chat from './Chat'
import classNames from '../../utilities/classNames'
import css from './styles/Embed.css.js'
type Props = {
className?: string,
html: string,
}
type Cont... |
Change My Library auth url |
(function () {
Polymer({
is: 'uql-apps-button',
properties: {
/** Whether to display title of the button */
showTitle: {
type: Boolean,
value: true
},
/** Button title text */
buttonTitle: {
type: String,
value: "My Library"
},
/** Val... |
(function () {
Polymer({
is: 'uql-apps-button',
properties: {
/** Whether to display title of the button */
showTitle: {
type: Boolean,
value: true
},
/** Button title text */
buttonTitle: {
type: String,
value: "My Library"
},
/** Val... |
Change progress callback to a function instead of null | const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const bcrypt = require('bcrypt-nodejs');
const userSchema = new Schema({
username: { type: String, lowercase: true, unique: true },
password: String,
classes: [
{
type: Schema.Types.ObjectId,
ref: 'user-class'
}
]
});
//... | const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const bcrypt = require('bcrypt-nodejs');
const userSchema = new Schema({
username: { type: String, lowercase: true, unique: true },
password: String,
classes: [
{
type: Schema.Types.ObjectId,
ref: 'user-class'
}
]
});
//... |
Remove an unnecessary use of the ProverMachineState rather than the MachineState.
git-svn-id: 4739e81c2fe647bfb539b919360e2c658e6121ea@280 716a755e-b13f-cedc-210d-596dafc6fb9b | package apps.server.visualization;
import javax.swing.JPanel;
import util.game.Game;
import util.statemachine.MachineState;
import util.xhtml.GameStateRenderPanel;
public class RenderThread extends Thread {
private final Game theGame;
private final MachineState s;
private final VisualizationPanel pare... | package apps.server.visualization;
import javax.swing.JPanel;
import util.game.Game;
import util.statemachine.implementation.prover.ProverMachineState;
import util.xhtml.GameStateRenderPanel;
public class RenderThread extends Thread {
private final Game theGame;
private final ProverMachineState s;
pri... |
Update CORS: fix cross-source cookie | package com.awesometickets.config;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRespon... | package com.awesometickets.config;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRespon... |
Index only FoiRequests marked is_foi | from haystack import indexes
from celery_haystack.indexes import CelerySearchIndex
from .models import FoiRequest
class FoiRequestIndex(CelerySearchIndex, indexes.Indexable):
text = indexes.EdgeNgramField(document=True, use_template=True)
title = indexes.CharField(model_attr='title')
description = index... | from haystack import indexes
from celery_haystack.indexes import CelerySearchIndex
from .models import FoiRequest
class FoiRequestIndex(CelerySearchIndex, indexes.Indexable):
text = indexes.EdgeNgramField(document=True, use_template=True)
title = indexes.CharField(model_attr='title')
description = index... |
Add bed_type to cnes_establishment model | from sqlalchemy import Column, Integer, String, func
from app import db
class CnesBed(db.Model):
__tablename__ = 'cnes_bed'
year = Column(Integer, primary_key=True)
region = Column(String(1), primary_key=True)
mesoregion = Column(String(4), primary_key=True)
microregion = Colum... | from sqlalchemy import Column, Integer, String, func
from app import db
class CnesBed(db.Model):
__tablename__ = 'cnes_bed'
year = Column(Integer, primary_key=True)
region = Column(String(1), primary_key=True)
mesoregion = Column(String(4), primary_key=True)
microregion = Colum... |
Use preg_replace_callback instead of \e to avoid an E_DEPRECATED on php-5.5alpha | <?php
namespace mageekguy\atoum;
class configurator
{
protected $script = null;
protected $methods = array();
public function __construct(scripts\runner $script)
{
$this->script = $script;
foreach ($this->script->getHelp() as $help)
{
list($arguments, $values) = $help;
foreach ($arguments as $argum... | <?php
namespace mageekguy\atoum;
class configurator
{
protected $script = null;
protected $methods = array();
public function __construct(scripts\runner $script)
{
$this->script = $script;
foreach ($this->script->getHelp() as $help)
{
list($arguments, $values) = $help;
foreach ($arguments as $argum... |
Add mock as a test dependency if running as python2
Test dependencies only get used if running as python setup.py test, so
need to add test_suite | # -*- coding: utf-8 -*-
import sys
from setuptools import setup, find_packages
IS_PY3 = sys.version_info > (3,)
install_requires = [
'jinja2',
'lxml',
]
tests_require = [
]
extras_require = {
'test': tests_require,
}
description = "Library for building and paring Connexions' EPUBs."
if not ... | # -*- coding: utf-8 -*-
import sys
from setuptools import setup, find_packages
IS_PY3 = sys.version_info > (3,)
install_requires = [
'jinja2',
'lxml',
]
tests_require = [
]
extras_require = {
'test': tests_require,
}
description = "Library for building and paring Connexions' EPUBs."
if IS_P... |
Update test case for FileManager | import Vue from 'vue';
import FileManager from 'src/components/file-manager/FileManager';
describe('FileManager.vue', () => {
const Constructor = Vue.extend(FileManager);
const vm = new Constructor().$mount();
it('should render userInputs navbar component', () => {
expect(vm.$el.querySelector('.navbar'))
... | import Vue from 'vue';
import FileManager from 'src/components/file-manager/FileManager';
describe('FileManager.vue', () => {
const Constructor = Vue.extend(FileManager);
const vm = new Constructor().$mount();
it('should render userInputs navbar component', () => {
expect(vm.$el.querySelector('.navbar'))
... |
Increase list concurrency to 16
Summary: Too slow in IRN, causes nginx to timeout.
Reviewers: O1553 Project kraken: Add blocking reviewers, evelynl
Reviewed By: O1553 Project kraken: Add blocking reviewers, evelynl
Subscribers: jenkins
Differential Revision: https://code.uberinternal.com/D2311711 | package hdfsbackend
import "code.uber.internal/infra/kraken/lib/backend/hdfsbackend/webhdfs"
// Config defines configuration for all HDFS clients.
type Config struct {
NameNodes []string `yaml:"namenodes"`
UserName string `yaml:"username"`
RootDirectory string `yaml:"root_directory"`
// ListConcurre... | package hdfsbackend
import "code.uber.internal/infra/kraken/lib/backend/hdfsbackend/webhdfs"
// Config defines configuration for all HDFS clients.
type Config struct {
NameNodes []string `yaml:"namenodes"`
UserName string `yaml:"username"`
RootDirectory string `yaml:"root_directory"`
// ListConcurre... |
Fix Jaxb bug on XmlIdRef. | package com.mkl.eu.client.service.vo;
import javax.xml.bind.annotation.XmlID;
import java.io.Serializable;
/**
* Mother class of all VOs.
*
* @author MKL
*/
public abstract class EuObject implements Serializable {
/** Id of the object. */
private Long id;
/** @return the id. */
public Long getId(... | package com.mkl.eu.client.service.vo;
import javax.xml.bind.annotation.XmlID;
import java.io.Serializable;
/**
* Mother class of all VOs.
*
* @author MKL
*/
public abstract class EuObject implements Serializable {
/** Id of the object. */
private Long id;
/** @return the id. */
public Long getId(... |
APVS-0020: Change to minimum claim amount to allow claims of £0.00 or greater. | const config = require('../../../config')
/**
* This file defines all generic validation tests used in the application. This file can and should be used by the
* three higher level validators: FieldValidator, FieldSetValidator, and UrlPathValidator.
*/
const validator = require('validator')
exports.isNullOrUndefine... | const config = require('../../../config')
/**
* This file defines all generic validation tests used in the application. This file can and should be used by the
* three higher level validators: FieldValidator, FieldSetValidator, and UrlPathValidator.
*/
const validator = require('validator')
exports.isNullOrUndefine... |
Comment out testing for delete file as delete file failed in this branch | function deleteDoc(browser, docType) {
const devServer = browser.globals.devServerURL;
browser.url(`${devServer}/`);
browser.expect.element('#app').to.be.visible.before(5000);
const createButton = `#button-create-${docType}`;
browser
.click(createButton)
.pause(500);
browser.execute((data) => {
... | function deleteDoc(browser, docType) {
const devServer = browser.globals.devServerURL;
browser.url(`${devServer}/`);
browser.expect.element('#app').to.be.visible.before(5000);
const createButton = `#button-create-${docType}`;
browser
.click(createButton)
.pause(500);
browser.execute((data) => {
... |
Fix using wrong component in ColumnBackButtonSlim | import React from 'react';
import { FormattedMessage } from 'react-intl';
import PropTypes from 'prop-types';
import Icon from 'flavours/glitch/components/icon';
export default class ColumnBackButtonSlim extends React.PureComponent {
static contextTypes = {
router: PropTypes.object,
};
handleClick = (event... | import React from 'react';
import { FormattedMessage } from 'react-intl';
import PropTypes from 'prop-types';
import Icon from 'mastodon/components/icon';
export default class ColumnBackButtonSlim extends React.PureComponent {
static contextTypes = {
router: PropTypes.object,
};
handleClick = (event) => {
... |
Remove strict currency code checking | <?php
/**
* This file is part of the Money library
*
* Copyright (c) 2011-2013 Mathias Verraes
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Money;
class Currency
{
/** @var string */
private $name;
/** @... | <?php
/**
* This file is part of the Money library
*
* Copyright (c) 2011-2013 Mathias Verraes
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Money;
class Currency
{
/** @var string */
private $name;
/** @... |
Use Fontawesome 4 for default icon. [rev: matthew.gordon] | define([
'js-whatever/js/base-page',
'text!about-page/templates/about-page.html',
'datatables.net-bs'
], function(BasePage, template) {
return BasePage.extend({
template: _.template(template),
initialize: function(options) {
this.options = options;
this.options... | define([
'js-whatever/js/base-page',
'text!about-page/templates/about-page.html',
'datatables.net-bs'
], function(BasePage, template) {
return BasePage.extend({
template: _.template(template),
initialize: function(options) {
this.options = options;
this.options... |
Fix crash on empty DB. | from collections import deque, defaultdict
from random import choice
class SequenceGenerator:
def __init__(self, order):
self.order = order
self.table = defaultdict(list)
def addSample(self, sequence):
st = deque([None] * self.order, self.order)
len = 0
for v in sequence:
self.table[tup... | from collections import deque, defaultdict
from random import choice
class SequenceGenerator:
def __init__(self, order):
self.order = order
self.table = defaultdict(list)
def addSample(self, sequence):
st = deque([None] * self.order, self.order)
len = 0
for v in sequence:
self.table[tup... |
Update serialVersionUID for updated public API | /**
Copyright 2017 Carlos Macasaet
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 i... | /**
Copyright 2017 Carlos Macasaet
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 i... |
Fix error in file path of where images are loaded from in load_image() | # Defining a function to load images
def load_image(image_name, fade_enabled=False):
"""fade_enabled should be True if you want images to be able to fade"""
try:
#! Add stuff for loading images of the correct resolution
# depending on the player's resolution settings
if not fade_enabled:... | # Defining a function to load images
def load_image(image_name, fade_enabled=False):
"""fade_enabled should be True if you want images to be able to fade"""
try:
#! Add stuff for loading images of the correct resolution
# depending on the player's resolution settings
if not fade_enabled:... |
Remove go 1.8 build tag for compatibility structs and constants | package avatica
import (
"database/sql/driver"
"fmt"
)
type namedValue struct {
Name string
Ordinal int
Value driver.Value
}
func driverValueToNamedValue(values []driver.Value) []namedValue {
list := make([]namedValue, len(values))
for i, v := range values {
list[i] = namedValue{
Ordinal: i + 1,
... | // +build go1.8
package avatica
import (
"database/sql/driver"
"fmt"
)
type namedValue struct {
Name string
Ordinal int
Value driver.Value
}
func driverValueToNamedValue(values []driver.Value) []namedValue {
list := make([]namedValue, len(values))
for i, v := range values {
list[i] = namedValue{
O... |
Add a CompilationUnit getter on the model Unit
(to avoid testing for null each time) | package com.redhat.ceylon.eclipse.core.model;
import java.lang.ref.WeakReference;
import com.redhat.ceylon.compiler.typechecker.context.PhasedUnit;
import com.redhat.ceylon.compiler.typechecker.tree.Tree;
import com.redhat.ceylon.eclipse.core.typechecker.IdePhasedUnit;
public abstract class CeylonUnit extends IdeUni... | package com.redhat.ceylon.eclipse.core.model;
import java.lang.ref.WeakReference;
import com.redhat.ceylon.compiler.typechecker.context.PhasedUnit;
import com.redhat.ceylon.eclipse.core.typechecker.IdePhasedUnit;
public abstract class CeylonUnit extends IdeUnit {
public CeylonUnit() {
phasedUnitRef ... |
Remove setTimeout in favor of process.nextTick()
According to [process.nextTick() documentation](http://nodejs.org/api/process.html#process_process_nexttick_callback), using setTimeout is not recommended:
On the next loop around the event loop call this callback. This is not a simple alias to setTimeout(fn, 0),... | var util = require("util")
, EventEmitter = require("events").EventEmitter
module.exports = (function() {
var CustomEventEmitter = function(fct) {
this.fct = fct;
var self = this;
process.nextTick(function() {
if (self.fct) {
self.fct.call(self, self)
}
}.bind(this));
... | var util = require("util")
, EventEmitter = require("events").EventEmitter
module.exports = (function() {
var CustomEventEmitter = function(fct) {
this.fct = fct
}
util.inherits(CustomEventEmitter, EventEmitter)
CustomEventEmitter.prototype.run = function() {
var self = this
// delay th... |
Fix reference to oldAncestors in labelSelector | "use strict";
angular.module('arethusa.relation').directive('labelSelector', [
'relation',
'$timeout',
function(relation, $timeout) {
return {
restrict: 'A',
scope: {
obj: '=',
change: '&'
},
link: function(scope, element, attrs) {
scope.plugin = relation;
... | "use strict";
angular.module('arethusa.relation').directive('labelSelector', [
'relation',
'$timeout',
function(relation, $timeout) {
return {
restrict: 'A',
scope: {
obj: '=',
change: '&'
},
link: function(scope, element, attrs) {
scope.plugin = relation;
... |
Exit phantomJS after every screenshot to kill phantom process | var http = require('http');
var phantom=require('node-phantom-simple');
http.createServer(function (req, res) {
phantom.create(function(err,ph) {
return ph.createPage(function(err, page) {
return page.open(req.url.slice(1), function(err, status) {
//Wait for a bit for AJAX content to load on the pa... | var http = require('http');
var phantom=require('node-phantom-simple');
http.createServer(function (req, res) {
phantom.create(function(err,ph) {
return ph.createPage(function(err, page) {
return page.open(req.url.slice(1), function(err, status) {
//Wait for a bit for AJAX content to load on the pa... |
Bump version number in preparation for next release. | #!/usr/bin/env python
"""Django/PostgreSQL implementation of the Meteor DDP service."""
import os.path
from setuptools import setup, find_packages
setup(
name='django-ddp',
version='0.2.1',
description=__doc__,
long_description=open('README.rst').read(),
author='Tyson Clugg',
author_email='tyso... | #!/usr/bin/env python
"""Django/PostgreSQL implementation of the Meteor DDP service."""
import os.path
from setuptools import setup, find_packages
setup(
name='django-ddp',
version='0.2.0',
description=__doc__,
long_description=open('README.rst').read(),
author='Tyson Clugg',
author_email='tyso... |
Revert "use argument passed instead of this.app"
This reverts commit 6353e4b2acbe5be66f67de00c5bea473ce4d2a22. | /* jshint node: true */
module.exports = {
name: 'ember-cli-dotenv',
config: function(){
var path = require('path');
var fs = require('fs');
var dotenv = require('dotenv');
var app = this.app;
var project = this.project;
var loadedConfig;
var config = {};
var hasOwn = Object.prototyp... | /* jshint node: true */
module.exports = {
name: 'ember-cli-dotenv',
config: function(env, appConfig){
var path = require('path');
var fs = require('fs');
var dotenv = require('dotenv');
var app = this.app;
var project = this.project;
var loadedConfig;
var config = {};
var hasOwn = O... |
Support new gist ID format | package gogist
import (
"fmt"
"net/http"
"github.com/gorilla/mux"
)
const t = `
<html>
<head>
<meta name="go-import" content="%s git https://gist.github.com/%s.git" />
<script>window.location='https://github.com/ImJasonH/go-gist/';</script>
</head>
</html>
`
func init() {
r := mux.NewRouter()
h := ... | package gogist
import (
"fmt"
"net/http"
"github.com/gorilla/mux"
)
const t = `
<html>
<head>
<meta name="go-import" content="%s git https://gist.github.com/%s.git" />
<script>window.location='https://github.com/ImJasonH/go-gist/';</script>
</head>
</html>
`
func init() {
r := mux.NewRouter()
h := ... |
Replace short array syntax to compatible with PHP 5.3 | <?php
class BodyTest extends PHPUnit_Framework_TestCase
{
/**
* @var \HieuLe\BodyClasses\Body
*/
private $_obj;
public function setUp()
{
parent::setUp();
$this->_obj = new \HieuLe\BodyClasses\Body();
}
public function testAddClassesAsString()
{
$this->_... | <?php
class BodyTest extends PHPUnit_Framework_TestCase
{
/**
* @var \HieuLe\BodyClasses\Body
*/
private $_obj;
public function setUp()
{
parent::setUp();
$this->_obj = new \HieuLe\BodyClasses\Body();
}
public function testAddClassesAsString()
{
$this->_... |
Fix inner model id do not automatic set when set a inner model. | /**
* Created by dungvn3000 on 3/14/14.
* The model automatic update mapping field when set associations table.
*/
Ext.define('sunerp.model.BaseModel', {
extend: 'Ext.data.Model',
set: function (fieldName, newValue) {
var me = this;
me.callParent(arguments);
if (newValue != null && E... | /**
* Created by dungvn3000 on 3/14/14.
* The model automatic update mapping field when set associations table.
*/
Ext.define('sunerp.model.BaseModel', {
extend: 'Ext.data.Model',
set: function (fieldName, newValue) {
var me = this;
me.callParent(arguments);
if (newValue != null && E... |
Fix the one offset error | @extends('layouts.app')
@section('wrap')
<div class="container">
<div class="list-group">
<h3>文言文語譯</h3>
@for ($i = 1; $i <= min(10, count($links)); $i += 1)
<a href="{{ url('/e/link/' . $i) }}">{{ $links[$i] }}</a>
@endfor
</div>
<div cl... | @extends('layouts.app')
@section('wrap')
<div class="container">
<div class="list-group">
<h3>文言文語譯</h3>
@for ($i = 1; $i <= min(10, count($links)); $i += 1)
<a href="{{ url('/e/link/' . $i) }}">{{ $links[$i] }}</a>
@endfor
</div>
<div cl... |
Fix daylight savings time bug | """
Add a 'w3cdate' key to every entry -- this contains the date in ISO8601 format
WARNING: you must have PyXML installed as part of your python installation
in order for this plugin to work
Place this plugin early in your load_plugins list, so that the w3cdate will
be available to subsequent plugins
"""
__author__ ... | """
Add a 'w3cdate' key to every entry -- this contains the date in ISO8601 format
WARNING: you must have PyXML installed as part of your python installation
in order for this plugin to work
Place this plugin early in your load_plugins list, so that the w3cdate will
be available to subsequent plugins
"""
__author__ ... |
Use the repackaged versions of classes.
git-svn-id: ed609ce04ec9e3c0bc25e071e87814dd6d976548@299 c7a0535c-eda6-11de-83d8-6d5adf01d787 | /*
* Mutability Detector
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* Further licensing information for this project can be found in
* license/LICENSE.txt
*/
package org.mutabilitydetector.unittesting.assertionbenc... | /*
* Mutability Detector
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
* Further licensing information for this project can be found in
* license/LICENSE.txt
*/
package org.mutabilitydetector.unittesting.assertionbenc... |
Fix files that have no namespace, but with psr-0 . Eg Solar, Kohana, Zend_ etc | <?php
$class = $argv[1];
$file = $argv[2];
$rootpath = $argv[3];
$autoloader = $rootpath . '/vendor/autoload.php';
if (file_exists($autoloader)) {
$loader = require $autoloader;
require __DIR__ . '/FQCN.php';
$contents = file_get_contents($file);
$fqns = new Hkt\FQCN();
$useClasses = $fqns->getAll... | <?php
$class = $argv[1];
$file = $argv[2];
$rootpath = $argv[3];
$autoloader = $rootpath . '/vendor/autoload.php';
if (file_exists($autoloader)) {
$loader = require $autoloader;
require __DIR__ . '/FQCN.php';
$contents = file_get_contents($file);
$fqns = new Hkt\FQCN();
$useClasses = $fqns->getAll... |
Set path.py to a fixed version | ########
# Copyright (c) 2016 GigaSpaces Technologies Ltd. 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... | ########
# Copyright (c) 2016 GigaSpaces Technologies Ltd. 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... |
Replace confusing min/max selection logic | package io.generators.core;
import com.google.common.collect.Ordering;
import com.google.common.collect.Range;
import javax.annotation.Nonnull;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.Range.closed;
/**
* Generates random closed range of Comparable%lt... | package io.generators.core;
import com.google.common.collect.Range;
import javax.annotation.Nonnull;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.collect.Range.closed;
/**
* Generates random closed range of Comparable%lt;T%gt;
*
* @author Tomas Klubal
*/
publi... |
Add scroll position function calls | if (Meteor.isClient) {
Accounts.ui.config({
passwordSignupFields: 'USERNAME_ONLY'
});
Template.messages.helpers({
messages: function() {
return Messages.find({}, { sort: { time: 1}});
}
});
var scrollPosition = function() {
$('#messages').scrollTop($('#messages')[0].scrollHei... | if (Meteor.isClient) {
Accounts.ui.config({
passwordSignupFields: 'USERNAME_ONLY'
});
Template.messages.helpers({
messages: function() {
return Messages.find({}, { sort: { time: 1}});
}
});
var scrollPosition = function() {
$('#messages').scrollTop($('#messages')[0].scrollHei... |
Increase bullet speed for testing | // import Platform from 'objects/platform';
import { ASSETS } from 'constants';
import Bullet from 'objects/bullet';
export default class Player extends Phaser.Sprite {
constructor(game, x, y) {
const { world } = game;
super(game, x, y, ASSETS.PLAYER, 1);
game.physics.p2.enable(this, true);
this.b... | // import Platform from 'objects/platform';
import { ASSETS } from 'constants';
import Bullet from 'objects/bullet';
export default class Player extends Phaser.Sprite {
constructor(game, x, y) {
const { world } = game;
super(game, x, y, ASSETS.PLAYER, 1);
game.physics.p2.enable(this, true);
this.b... |
Disable clicking on thread underline when accepting selection | import React from 'react'
import { connect } from 'react-redux'
import { openCommentThreads, selectCommentThread } from 'redux/actions.js'
function mapStateToProps(state, { contentState, children }) {
let commentThreadId = getFirstThreadId(contentState, children[0])
return {
cardId: state.commentThreadsById[co... | import React from 'react'
import { connect } from 'react-redux'
import { openCommentThreads, selectCommentThread } from 'redux/actions.js'
function mapStateToProps(state, { contentState, children }) {
let commentThreadId = getFirstThreadId(contentState, children[0])
return {
cardId: state.commentThreadsById[co... |
Rewrite to replace IC_FLAG by FLAG_from_IC. | '''
>>> FLAG_from_IC[2]
array([[1, 1],
[3, 4]])
The flag vector of ICC is [1, 6, 9].
>>> numpy.dot(FLAG_from_IC[3], [0, 0, 1])
array([1, 6, 9])
>>> FLAG_from_IC[3]
array([[1, 1, 1],
[4, 5, 6],
[6, 8, 9]])
'''
# For Python2 compatibility
from __future__ import absolute_import
from __future__ i... | '''
>>> IC_FLAG[2]
array([[1, 3],
[1, 4]])
>>> IC_FLAG[3]
array([[1, 4, 6],
[1, 5, 8],
[1, 6, 9]])
'''
# For Python2 compatibility
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
__metaclass__... |
Correct namespace zone service trait | <?php
namespace Heystack\Ecommerce\Locale\Traits;
use Heystack\Ecommerce\Locale\Interfaces\ZoneServiceInterface;
/**
* Class HasZoneServiceTrait
* @package Heystack\Ecommerce\Locale\Traits
*/
trait HasZoneServiceTrait
{
/**
* @var \Heystack\Ecommerce\Locale\Interfaces\ZoneServiceInterface
*/
pro... | <?php
namespace Heystack\Ecommerce\Zone\Traits;
use Heystack\Ecommerce\Locale\Interfaces\ZoneServiceInterface;
/**
* Class HasZoneServiceTrait
* @package Heystack\Ecommerce\Zone\Traits
*/
trait HasZoneServiceTrait
{
/**
* @var \Heystack\Ecommerce\Locale\Interfaces\ZoneServiceInterface
*/
protect... |
Fix tests in Python 3.6 | from collections import defaultdict
import pytest
from funcy.funcmakers import *
def test_callable():
assert make_func(lambda x: x + 42)(0) == 42
def test_int():
assert make_func(0)('abc') == 'a'
assert make_func(2)([1,2,3]) == 3
assert make_func(1)({1: 'a'}) == 'a'
with pytest.raises(IndexErro... | from collections import defaultdict
import pytest
from funcy.funcmakers import *
def test_callable():
assert make_func(lambda x: x + 42)(0) == 42
def test_int():
assert make_func(0)('abc') == 'a'
assert make_func(2)([1,2,3]) == 3
assert make_func(1)({1: 'a'}) == 'a'
with pytest.raises(IndexErro... |
Update formatting for consistency and readability. | /**
* Visually Hidden component, mainly used for screen-reader text.
*
* Site Kit by Google, Copyright 2020 Google LLC
*
* 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
*
* https:/... | /**
* Visually Hidden component, mainly used for screen-reader text.
*
* Site Kit by Google, Copyright 2020 Google LLC
*
* 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
*
* https:/... |
Throw Ex in stream if monitor cancelled | package io.github.duckasteroid.progress.utils;
import io.github.duckasteroid.progress.ProgressMonitor;
import java.io.IOException;
import java.io.InputStream;
/**
* Wraps an input stream to report 1 unit of work for every byte {@link #read()}.
* Clients should set the {@link ProgressMonitor#setSize(long)} prior to ... | package io.github.duckasteroid.progress.utils;
import io.github.duckasteroid.progress.ProgressMonitor;
import java.io.IOException;
import java.io.InputStream;
/**
* Wraps an input stream to report 1 unit of work for every byte {@link #read()}.
* Clients should set the {@link ProgressMonitor#setSize(long)} prior to ... |
Fix typo... type to Type | <?php
namespace Core\GameSessionBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
class CreateGameSessionType extends AbstractType
{
/**
* @param FormBuilderInterface $builder
* @pa... | <?php
namespace Core\GameSessionBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
class CreateGameSessiontype extends AbstractType
{
/**
* @param FormBuilderInterface $builder
* @pa... |
Allow RPC client to accept string arguments. | #!/usr/bin/env node
var sys = require('sys');
var logger = require('../lib/logger');
var getConfig = require('./init').getConfig;
var cfg = getConfig();
if (cfg.jsonrpc.password == null) {
logger.error('No JSON RPC password specified in configuration.');
logger.notice('Note that you can use the --rpcpassword co... | #!/usr/bin/env node
var sys = require('sys');
var logger = require('../lib/logger');
var getConfig = require('./init').getConfig;
var cfg = getConfig();
if (cfg.jsonrpc.password == null) {
logger.error('No JSON RPC password specified in configuration.');
logger.notice('Note that you can use the --rpcpassword co... |
Handle *.iced sources in addition to *.coffee. | var fs = Npm.require('fs');
var path = Npm.require('path');
var iced = Npm.require('iced-coffee-script');
var handler = function (compileStep) {
var source = compileStep.read().toString('utf8');
var outputFile = compileStep.inputPath + ".js";
options = {
bare: true,
filename: compileStep.inputPath,
... | var fs = Npm.require('fs');
var path = Npm.require('path');
var iced = Npm.require('iced-coffee-script');
var handler = function (compileStep) {
var source = compileStep.read().toString('utf8');
var outputFile = compileStep.inputPath + ".js";
options = {
bare: true,
filename: compileStep.inputPath,
... |
Fix type casting: use interface instead of object itself. | <?PHP
/**
* A Phone value object.
*
*
* @author Adamo Crespi <hello@aerendir.me>
* @copyright Copyright (c) 2015, Adamo Crespi
* @license MIT License
*/
namespace SerendipityHQ\Component\ValueObjects\Money;
use SerendipityHQ\Component\ValueObjects\Common\ComplexValueObjectInterface;
/**
* Defi... | <?PHP
/**
* A Phone value object.
*
*
* @author Adamo Crespi <hello@aerendir.me>
* @copyright Copyright (c) 2015, Adamo Crespi
* @license MIT License
*/
namespace SerendipityHQ\Component\ValueObjects\Money;
use SerendipityHQ\Component\ValueObjects\Common\ComplexValueObjectInterface;
/**
* Defi... |
Use json module instead of django.utils.simplejson for Django 1.5 | # -*- coding: utf-8 -*-
from distutils.version import LooseVersion
from classytags.core import Tag, Options
import django
from django import template
from django.core.serializers.json import DjangoJSONEncoder
from django.utils.text import javascript_quote
DJANGO_1_4 = LooseVersion(django.get_version()) < LooseVersion... | # -*- coding: utf-8 -*-
from classytags.core import Tag, Options
from django import template
from django.core.serializers.json import DjangoJSONEncoder
from django.utils import simplejson
from django.utils.text import javascript_quote
register = template.Library()
@register.filter
def js(value):
return simplejson... |
Fix error where intlTelInput was not defined | 'use strict';
const path = require('path');
const fastbootTransform = require('fastboot-transform');
const Funnel = require('broccoli-funnel');
module.exports = {
name: 'ember-cli-intl-tel-input',
included: function(app) {
this._super.included.apply(this, arguments);
let config = app.options.intlTelInpu... | 'use strict';
const path = require('path');
const fastbootTransform = require('fastboot-transform');
const Funnel = require('broccoli-funnel');
module.exports = {
name: 'ember-cli-intl-tel-input',
included: function(app) {
this._super.included.apply(this, arguments);
let config = app.options.intlTelInpu... |
Fix the name in an error message | <?php
/*
Plugin Name: Opauth
Plugin URI: http://labculturadigital.org/
Description: Adds Opauth (opauth.org) support
Author: Laboratório de Cultura Digital - Flávio Zavan
Version: 0.01
Text Domain: wp-opauth
*/
define('CONF_FILE',
dirname(__FILE__) . DIRECTORY_SEPARATOR . 'opauth.conf.php');
define('OPAUTH_PATH',
... | <?php
/*
Plugin Name: Opauth
Plugin URI: http://labculturadigital.org/
Description: Adds Opauth (opauth.org) support
Author: Laboratório de Cultura Digital - Flávio Zavan
Version: 0.01
Text Domain: wp-opauth
*/
define('CONF_FILE',
dirname(__FILE__) . DIRECTORY_SEPARATOR . 'opauth.conf.php');
define('OPAUTH_PATH',
... |
Increase browser disconnect timeout in smoke tests | 'use strict';
let isCI = !!process.env.CI;
let smokeTests = !!process.env.SMOKE_TESTS;
let config = {
framework: 'qunit',
test_page: smokeTests ? 'tests/index.html?smoke_tests=true' : 'tests/index.html?hidepassed',
disable_watching: true,
browser_start_timeout: smokeTests ? 300000 : 30000,
browser_disconnec... | 'use strict';
let isCI = !!process.env.CI;
let smokeTests = !!process.env.SMOKE_TESTS;
let config = {
framework: 'qunit',
test_page: smokeTests ? 'tests/index.html?smoke_tests=true' : 'tests/index.html?hidepassed',
disable_watching: true,
browser_start_timeout: smokeTests ? 300000 : 30000,
browser_args: {
... |
Fix typo in error message | /**
* Module dependencies
*/
var _ = require('@sailshq/lodash');
/**
* Give Waterline UsageErrors from blueprints a toJSON function for nicer output.
*/
module.exports = function(err, req) {
err.toJSON = function (){
// Include the error code and the array of RTTC validation errors
// for easy program... | /**
* Module dependencies
*/
var _ = require('@sailshq/lodash');
/**
* Give Waterline UsageErrors from blueprints a toJSON function for nicer output.
*/
module.exports = function(err, req) {
err.toJSON = function (){
// Include the error code and the array of RTTC validation errors
// for easy program... |
Add delete old sessions command | from datetime import datetime
from django.core.management.base import NoArgsCommand
from django.contrib.sessions.models import Session
class Command(NoArgsCommand):
help = "Delete old sessions"
def handle_noargs(self, **options):
old_sessions = Session.objects.filter(expire_date__lt=datetime.now())... | from datetime import datetime
from django.core.management.base import BaseCommand
from django.contrib.sessions.models import Session
class Command(BaseCommand):
args = '<count count ...>'
help = "Delete old sessions"
def handle(self, *args, **options):
old_sessions = Session.objects.filter(expi... |
Use browserify plugin to collapse require ids | 'use strict';
var join = require( 'path' ).join;
var writeFile = require( 'fs' ).writeFileSync;
var mkdirp = require( 'mkdirp' ).sync;
var collapse = require( 'bundle-collapser/plugin' );
var uglify = require( 'uglify-js' );
var bundle = require( './../../lib' );
var names = [
'@stdlib/math/base/special/erf',
'@std... | 'use strict';
var join = require( 'path' ).join;
var writeFile = require( 'fs' ).writeFileSync;
var mkdirp = require( 'mkdirp' ).sync;
var uglify = require( 'uglify-js' );
var bundle = require( './../../lib' );
var names = [
'@stdlib/math/base/special/erf',
'@stdlib/math/base/special/gamma'
];
var bopts = {
'name... |
Deploy from asana-api-meta v0.4.5 (c7c1b64/master) by noonhub | <?php
namespace Asana\Resources\Gen;
class StoriesBase
{
public function __construct($client)
{
$this->client = $client;
}
public function findByTask($task, $params = array(), $options = array())
{
$path = sprintf("/tasks/%s/stories", $task);
return $this->client->getColle... | <?php
namespace Asana\Resources\Gen;
class StoriesBase
{
public function __construct($client)
{
$this->client = $client;
}
public function findById($story, $params = array(), $options = array())
{
$path = sprintf("/stories/%s", $story);
return $this->client->get($path, $pa... |
Set up a default port of 5000 so it won't fail if you forget to specify one in config.yaml | from http import server
from socketserver import TCPServer
import os
class Server:
def __init__(self, own_config, config, builder):
self.directory = config.folders['output']
self.port = own_config.get('port', 5000)
self.builder = builder
def serve(self):
os.chdir(self.director... | from http import server
from socketserver import TCPServer
import os
class Server:
def __init__(self, own_config, config, builder):
self.directory = config.folders['output']
self.port = own_config['port']
self.builder = builder
def serve(self):
os.chdir(self.directory)
... |
Allow debug and verbose modes to be set directly from config. | import argparse
import botconfig
from settings import wolfgame as var
# Todo: Allow game modes to be set via config
# Handle launch parameters
# Argument --debug means start in debug mode
# --verbose means to print a lot of stuff (when not in debug mode)
parser = argparse.ArgumentParser()
parser.add_argume... | import argparse
import botconfig
from settings import wolfgame as var
# Todo: Allow game modes to be set via config
# Carry over settings from botconfig into settings/wolfgame.py
for setting, value in botconfig.__dict__.items():
if not setting.isupper():
continue # Not a setting
if not setting in var... |
Add ability to launch arb url from push | console.log('Started', self);
self.addEventListener('install', function(event) {
self.skipWaiting();
console.log('Installed', event);
});
self.addEventListener('activate', function(event) {
console.log('Activated', event);
});
self.addEventListener('push', function(event) {
if (event.data) {
var json = even... | console.log('Started', self);
self.addEventListener('install', function(event) {
self.skipWaiting();
console.log('Installed', event);
});
self.addEventListener('activate', function(event) {
console.log('Activated', event);
});
self.addEventListener('push', function(event) {
if (event.data) {
var json = even... |
Add the ability to specify public api endpoints in Module's HTTP/Controllers/ApiController | <?php
namespace TypiCMS\Modules\Core\Http\Controllers;
use Illuminate\Routing\Controller;
abstract class BaseApiController extends Controller
{
/**
* Array of endpoints that do not require authorization.
*
*/
protected $publicEndpoints = [];
protected $repository;
public func... | <?php
namespace TypiCMS\Modules\Core\Http\Controllers;
use Illuminate\Routing\Controller;
abstract class BaseApiController extends Controller
{
protected $repository;
public function __construct($repository = null)
{
$this->middleware('api');
$this->repository = $repository;
}
/... |
Update homepage field, release version 0.2 | """
nubo
----
An easy way to deploy Linux VMs on different cloud providers.
"""
from setuptools import setup
setup(
name='nubo',
version='0.2',
url='http://pythonhosted.org/nubo',
license='BSD',
author='Emanuele Rocca',
author_email='ema@linux.it',
description='Virtual Machine deployments ... | """
nubo
----
An easy way to deploy Linux VMs on different cloud providers.
"""
from setuptools import setup
setup(
name='nubo',
version='0.1',
url='https://github.com/ema/nubo',
license='BSD',
author='Emanuele Rocca',
author_email='ema@linux.it',
description='Virtual Machine deployments o... |
Fix for appid detection in friendsthatplay | 'use strict';
var CurrentAppID,
GetCurrentAppID = function()
{
if( !CurrentAppID )
{
CurrentAppID = location.pathname.match( /\/(app|sub|friendsthatplay)\/([0-9]{1,7})/ );
if( CurrentAppID )
{
CurrentAppID = parseInt( CurrentAppID[ 2 ], 10 );
}
else
{
CurrentAppID = -1;
}
}
... | 'use strict';
var CurrentAppID,
GetCurrentAppID = function()
{
if( !CurrentAppID )
{
CurrentAppID = location.pathname.match( /\/(app|sub)\/([0-9]{1,7})/ );
if( CurrentAppID )
{
CurrentAppID = parseInt( CurrentAppID[ 2 ], 10 );
}
else
{
CurrentAppID = -1;
}
}
return Current... |
Fix HTML help generation for TMP_DIR so it has a more generic default value. | /*
* The MIT License
*
* Copyright (c) 2010 The Broad Institute
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use... | /*
* The MIT License
*
* Copyright (c) 2010 The Broad Institute
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use... |
Call connect() on the Users component only once, and cache the result. This seems to fix STRIPES-97 at last! | import React from 'react';
import Match from 'react-router/Match';
import Miss from 'react-router/Miss';
import Users from './Users';
class UsersRouting extends React.Component {
constructor(props){
super(props);
this.connectedUsers = props.connect(Users);
}
NoMatch() {
return <div>
<h2>Uh-oh!... | import React from 'react';
import Match from 'react-router/Match';
import Miss from 'react-router/Miss';
import Users from './Users';
class UsersRouting extends React.Component {
NoMatch() {
return <div>
<h2>Uh-oh!</h2>
<p>How did you get to <tt>{this.props.location.pathname}</tt>?</p>
</div>
}... |
Update script name and namespace | // ==UserScript==
// @name Google Services List
// @namespace wsmwason.google.services.list
// @description List all Google services on support page, and auto redirect to product url.
// @include https://support.google.com/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
//... | // ==UserScript==
// @name Google Service List
// @namespace wsmwason.google.service.list
// @description List all Google services on support page, and auto redirect to product url.
// @include https://support.google.com/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @... |
Update the PyPI version to 0.2.17 | # -*- coding: utf-8 -*-
import os
from setuptools import setup
def read(fname):
try:
return open(os.path.join(os.path.dirname(__file__), fname)).read()
except:
return ''
setup(
name='todoist-python',
version='0.2.17',
packages=['todoist', 'todoist.managers'],
author='Doist Team... | # -*- coding: utf-8 -*-
import os
from setuptools import setup
def read(fname):
try:
return open(os.path.join(os.path.dirname(__file__), fname)).read()
except:
return ''
setup(
name='todoist-python',
version='0.2.16',
packages=['todoist', 'todoist.managers'],
author='Doist Team... |
Remove pass_event (deprecated) and replace with next | import pyrox.filtering as filtering
class SimpleFilter(filtering.HttpFilter):
"""
This is an example of a simple filter that simply prints out the
user-agent value from the header
"""
@filtering.handles_request_head
def on_request_head(self, request_message):
user_agent_header = reque... | import pyrox.filtering as filtering
class SimpleFilter(filtering.HttpFilter):
"""
This is an example of a simple filter that simply prints out the
user-agent value from the header
"""
@filtering.handles_request_head
def on_request_head(self, request_message):
user_agent_header = reque... |
Improve robustness of link utility functions
Fixes #321, fixes #323 | var url = require('url');
var path = require('path');
// Is the link an external link
var isExternal = function(href) {
try {
return Boolean(url.parse(href).protocol);
} catch(err) { }
return false;
};
// Return true if the link is relative
var isRelative = function(href) {
try {
var ... | var url = require('url');
var path = require('path');
// Is the link an external link
var isExternal = function(href) {
return Boolean(url.parse(href).protocol);
};
// Return true if the link is relative
var isRelative = function(href) {
var parsed = url.parse(href);
return !parsed.protocol && parsed.pat... |
Add validation for configuring story.
Signed-off-by: crynobone <e1a543840a942eb68427510a8a483282a7bfeddf@gmail.com> | <?php
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\View;
use Orchestra\Support\Facades\Asset;
use Orchestra\Support\Facades\Widget;
Event::listen('orchestra.ready: admin', 'Orchestra\Story\Services\Event\DashboardHandler@onDashboardView');
Event::listen('orchestra.form: extension.orchestra/sto... | <?php
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\View;
use Orchestra\Support\Facades\Asset;
use Orchestra\Support\Facades\Widget;
Event::listen('orchestra.ready: admin', 'Orchestra\Story\Services\Event\DashboardHandler@onDashboardView');
Event::listen('orchestra.form: extension.orchestra/sto... |
Fix installation version info type | import contextlib
import itertools
import os
import pathlib
import re
import subprocess
import attr
@attr.s
class Installation:
path = attr.ib(convert=pathlib.Path)
@property
def python(self):
return self.path.joinpath('python.exe')
@property
def scripts_dir(self):
return self.... | import contextlib
import itertools
import os
import pathlib
import re
import subprocess
import attr
@attr.s
class Installation:
path = attr.ib(convert=pathlib.Path)
@property
def python(self):
return self.path.joinpath('python.exe')
@property
def scripts_dir(self):
return self.... |
Update requirements where it matters | # -*- coding: utf-8 -*-
from setuptools import setup, find_packages
with open('README.rst') as f:
readme = f.read()
with open('LICENSE') as f:
license = f.read()
# I wish there was a way to do this w/o having to put data files in
# package dir. Couldn't ever get data_files arg working correctly...
setup(
... | # -*- coding: utf-8 -*-
from setuptools import setup, find_packages
with open('README.rst') as f:
readme = f.read()
with open('LICENSE') as f:
license = f.read()
# I wish there was a way to do this w/o having to put data files in
# package dir. Couldn't ever get data_files arg working correctly...
setup(
... |
Replace accidental _ with space in JSDoc link. | /**
* This file specifies the database collection and field names.
*/
export const COLLECTION_TRIPS = 'trips';
export const TRIPS_TITLE = 'title';
export const TRIPS_DESCRIPTION = 'description';
export const TRIPS_DESTINATION = 'destination';
export const TRIPS_START_DATE = 'start_date';
export const TRIPS_END_DATE =... | /**
* This file specifies the database collection and field names.
*/
export const COLLECTION_TRIPS = 'trips';
export const TRIPS_TITLE = 'title';
export const TRIPS_DESCRIPTION = 'description';
export const TRIPS_DESTINATION = 'destination';
export const TRIPS_START_DATE = 'start_date';
export const TRIPS_END_DATE =... |
Add the type column for votes table | <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateVotesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('votes', function (Blueprint $table) {
$table... | <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateVotesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('votes', function (Blueprint $table) {
$table... |
Stop Requiring Dev Packages in Production
Moved dev required packages to dev if block to prevent errors when
deploying to production.
Closes #9 | const path = require('path')
const express = require('express')
const app = express()
app.disable('x-powered-by')
const dev = process.env.NODE_ENV === 'development'
if (dev) {
const webpack = require('webpack')
const config = require('../webpack.config')
const compiler = webpack(config)
const history = requi... | const path = require('path')
const express = require('express')
const webpack = require('webpack')
const config = require('../webpack.config')
const history = require('connect-history-api-fallback')
require('dotenv').config()
const app = express()
app.disable('x-powered-by')
const dev = process.env.NODE_ENV === 'dev... |
Update the documentation to reflect the changes in removing get param to the V1Meta constructor. | // **NOTE:** This assumes you have jQuery as a node module.
var jquery = require('jquery');
var v1sdk = require('./../dist/v1sdk');
var hostname = "www14.v1host.com";
var instance = "v1sdktesting";
var username = "admin";
var password = "admin";
var port = "443";
var protocol = "https";
var v1 = new v1sdk.V1Meta({
... | // **NOTE:** This assumes you have jQuery as a node module.
var jquery = require('jquery');
var v1sdk = require('./../dist/v1sdk');
var hostname = "www14.v1host.com";
var instance = "v1sdktesting";
var username = "admin";
var password = "admin";
var port = "443";
var protocol = "https";
var v1 = new v1sdk.V1Meta({
... |
feat: Add appData/plugins to plugin paths | var path = require('path');
var config = require('../config');
var paths = module.paths.map(formatPath);
var globalDir = formatPath(getGlobalDir());
var appDataDir = formatPath(process.env && process.env.APPDATA);
paths.unshift(formatPath(path.join(config.DATA_DIR, 'plugins')));
if (appDataDir && paths.indexOf(appDat... | var path = require('path');
var paths = module.paths.map(formatPath);
var globalDir = formatPath(getGlobalDir());
var appDataDir = formatPath(process.env && process.env.APPDATA);
if (appDataDir && paths.indexOf(appDataDir) == -1) {
paths.push(path.join(appDataDir, 'npm/node_modules'));
}
if (globalDir && paths.index... |
Enable tests for Safari 9 | var argv = require('yargs').argv;
module.exports = {
registerHooks: function(context) {
var saucelabsPlatforms = [
'macOS 10.12/iphone@10.3',
'macOS 10.12/ipad@10.3',
'Windows 10/microsoftedge@15',
'Windows 10/internet explorer@11',
'macOS 10.12/safari@11.0',
'macOS 9.3.2/ipho... | var argv = require('yargs').argv;
module.exports = {
registerHooks: function(context) {
var saucelabsPlatforms = [
'macOS 10.12/iphone@10.3',
'macOS 10.12/ipad@10.3',
'Windows 10/microsoftedge@15',
'Windows 10/internet explorer@11',
'macOS 10.12/safari@11.0'
];
var cronPlat... |
Add support for windows-only drawer property "win_buttonTheme"
Since the background of the drawer button can be changed independently
from the navigation header, so has the theme. This is an experimental
feature and will for now only be documented in the windows client
release notes.
Change-Id: I95ffc1b26d77f193b15a9... | tabris.load(function() {
if (device.platform === "windows") {
tabris.registerWidget("Drawer", {
_type: "tabris.Drawer",
_supportsChildren: true,
_create: function() {
tabris.ui._setCurrentDrawer(this);
this._super("_create", arguments);
this._setParent(tabris.ui);
... | tabris.load(function() {
if (device.platform === "windows") {
tabris.registerWidget("Drawer", {
_type: "tabris.Drawer",
_supportsChildren: true,
_create: function() {
tabris.ui._setCurrentDrawer(this);
this._super("_create", arguments);
this._setParent(tabris.ui);
... |
Add support for multiple role assertions
The `https://aws.amazon.com/SAML/Attributes/Role` attribute supports
single or multiple values. This fixes Awsaml to work when a
multiple-value attribute is passed.
Currently, the first role is always used. Support for selecting from
the roles may be added later.
GH-105 | const url = require('url');
const express = require('express');
const router = express.Router();
module.exports = (app, auth) => {
router.post('/', auth.authenticate('saml', {
failureFlash: true,
failureRedirect: app.get('configureUrl'),
}), (req, res) => {
roles = req.user['https://aws.amazon.com/SA... | const url = require('url');
const express = require('express');
const router = express.Router();
module.exports = (app, auth) => {
router.post('/', auth.authenticate('saml', {
failureFlash: true,
failureRedirect: app.get('configureUrl'),
}), (req, res) => {
const arns = req.user['https://aws.amazon.co... |
Test the type of return value | <?php
require '../simplexml2flatarray.class.php';
class SimpleXML2FlatArray_Test extends PHPUnit_Framework_TestCase
{
/**
* Test SimpleXML2FlatArray::get() output is correct array
*/
public function testGetArrayOutputIsCorrectArray()
{
$expected_array = array(
array(
... | <?php
require '../simplexml2flatarray.class.php';
class SimpleXML2FlatArray_Test extends PHPUnit_Framework_TestCase
{
/**
* Test SimpleXML2FlatArray::get() output is correct array
*/
public function testGetArrayOutputIsCorrectArray()
{
$expected_array = array(
array(
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.