text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Add logging and increase timeout | from multiprocessing import Process
from time import sleep
from socket import socket
import traceback
import requests
from django.core.management import call_command
from django.core.management.commands.runserver import Command as RunserverCommand
default_port = RunserverCommand.default_port
def run_runserver_in_... | from multiprocessing import Process
from time import sleep
from socket import socket
import requests
from django.core.management import call_command
from django.core.management.commands.runserver import Command as RunserverCommand
default_port = RunserverCommand.default_port
def run_runserver_in_process(port=defa... |
Remove the allocation of a variable in make_course_path | details_source = './source/details/'
xml_source = './source/raw_xml/'
term_dest = './courses/terms/'
course_dest = './source/courses/'
info_path = './courses/info.json'
mappings_path = './related-data/generated/'
handmade_path = './related-data/handmade/'
def find_details_subdir(clbid):
str_clbid ... | details_source = './source/details/'
xml_source = './source/raw_xml/'
term_dest = './courses/terms/'
course_dest = './source/courses/'
info_path = './courses/info.json'
mappings_path = './related-data/generated/'
handmade_path = './related-data/handmade/'
def find_details_subdir(clbid):
str_clbid ... |
Add peek() and revise main() | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
class Stack(object):
"""Stack class."""
def __init__(self):
self.items = []
def is_empty(self):
return self.items == []
def peek(self):
return self.items[-1]
def ... | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
class Stack(object):
"""Stack class."""
def __init__(self):
self.items = []
def is_empty(self):
return self.items == []
def push(self, item):
self.items.append(item)
... |
Remove whatever was causing HHVM segfault | <?php
namespace Pinq\Tests\Integration\Collection;
class ApplyTest extends CollectionTest
{
/**
* @dataProvider Everything
*/
public function testThatExecutionIsNotDeferred(\Pinq\ICollection $Collection, array $Data)
{
if(count($Data) > 0) {
$this->AssertThatExecutionIsNotDef... | <?php
namespace Pinq\Tests\Integration\Collection;
class ApplyTest extends CollectionTest
{
/**
* @dataProvider Everything
*/
public function testThatExecutionIsNotDeferred(\Pinq\ICollection $Collection, array $Data)
{
if(count($Data) > 0) {
$this->AssertThatExecutionIsNotDef... |
Return float for interval instead of int. | import random
class BackoffTimer(object):
def __init__(self, ratio=1, max_interval=None, min_interval=None):
self.c = 0
self.ratio = ratio
self.max_interval = max_interval
self.min_interval = min_interval
def is_reset(self):
return self.c == 0
def reset(self):
... | from random import randint
class BackoffTimer(object):
def __init__(self, ratio=1, max_interval=None, min_interval=None):
self.c = 0
self.ratio = ratio
self.max_interval = max_interval
self.min_interval = min_interval
def is_reset(self):
return self.c == 0
def re... |
Add info about required updates in AttributeEntityType | class AttributeInputType:
"""The type that we expect to render the attribute's values as."""
DROPDOWN = "dropdown"
MULTISELECT = "multiselect"
FILE = "file"
REFERENCE = "reference"
CHOICES = [
(DROPDOWN, "Dropdown"),
(MULTISELECT, "Multi Select"),
(FILE, "File"),
... | class AttributeInputType:
"""The type that we expect to render the attribute's values as."""
DROPDOWN = "dropdown"
MULTISELECT = "multiselect"
FILE = "file"
REFERENCE = "reference"
CHOICES = [
(DROPDOWN, "Dropdown"),
(MULTISELECT, "Multi Select"),
(FILE, "File"),
... |
Add assertions for login test | <?php
namespace Tests\Feature;
use Tests\TestCase;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use App;
class LoginTest extends TestCase
{
use DatabaseMigrations;
public function testBasic... | <?php
namespace Tests\Feature;
use Tests\TestCase;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Illuminate\Foundation\Testing\DatabaseMigrations;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use App;
class LoginTest extends TestCase
{
use DatabaseMigrations;
public function testBasic... |
Debug and add test cases | // Method that performs basic string compression using the counts of repeated characters
function compressStr(str) {
var output = "", // will return this variable as final compressed string
currChar = "", // represents character we are searching for in string
currCount = ""; // counts number of times character is... | // Method that performs basic string compression using the counts of repeated characters
function compressStr(str) {
var output = "", // will return this variable as final compressed string
currChar = "", // represents character we are searching for in string
currCount = "", // counts number of times character is... |
Fix silly typo "recusrive" => "recursive" | // Requires
var Q = require('q');
var _ = require('underscore');
var qClass = require('qpatch').qClass;
// Etcd client
var Etcd = qClass(require('node-etcd'), ['watcher']);
// Since etcd create the dir keys automatically
// transform the tree of keys
// to contain only a flat array of leaves
function cleanDump(obj)... | // Requires
var Q = require('q');
var _ = require('underscore');
var qClass = require('qpatch').qClass;
// Etcd client
var Etcd = qClass(require('node-etcd'), ['watcher']);
// Since etcd create the dir keys automatically
// transform the tree of keys
// to contain only a flat array of leaves
function cleanDump(obj)... |
Remove log message already produced in superclass | // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.config.server.maintenance;
import com.yahoo.vespa.config.server.ApplicationRepository;
import com.yahoo.vespa.curator.Curator;
import com.yahoo.vespa.flags.FlagSource;
import java.time.Dura... | // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.config.server.maintenance;
import com.yahoo.vespa.config.server.ApplicationRepository;
import com.yahoo.vespa.curator.Curator;
import com.yahoo.vespa.flags.FlagSource;
import java.time.Dura... |
Replace typekit script with css | export default ({children, links, typekitKey, title, gaKey, appContent, styletronSheets, meta}) => {
return (
<html lang="en">
<head>
<title>{title}</title>
{meta ? meta.map(attrs => <meta {...attrs}/>) : ''}
{styletronSheets.map(sheet =>
<style className="styletron" media={sheet.media} dangerouslySetIn... | export default ({children, links, typekitKey, title, gaKey, appContent, styletronSheets, meta}) => {
return (
<html lang="en">
<head>
<title>{title}</title>
{meta ? meta.map(attrs => <meta {...attrs}/>) : ''}
{styletronSheets.map(sheet =>
<style className="styletron" media={sheet.media} dangerouslySetIn... |
Convert README.md file into .rst | #!/usr/bin/env python
import setuptools
import shutil
import sys
if not ((sys.version_info.major >= 3 and sys.version_info.minor >= 5)
or sys.version_info.major > 3):
exit("Sorry, Python's version must be later than 3.5.")
import shakyo
try:
import pypandoc
with open("README.rst", "w") as f:
f.write(... | #!/usr/bin/env python
import setuptools
import sys
if not ((sys.version_info.major >= 3 and sys.version_info.minor >= 5)
or sys.version_info.major > 3):
exit("Sorry, Python's version must be later than 3.5.")
import shakyo
setuptools.setup(
name=shakyo.__name__,
version=shakyo.__version__,
descri... |
Add a dumb catch to the data handlers handle call | import Registry from './Registry';
import {flow, isFunction, isString, omit} from 'lodash';
export default class DataHandler {
/**
* Register a new data handler using the registry.
*/
static set(path, handler) {
Registry.set('dataHandlers.' + path, handler);
}
/**
* Retrieves a data handler give... | import Registry from './Registry';
import {flow, isFunction, isString, omit} from 'lodash';
export default class DataHandler {
/**
* Register a new data handler using the registry.
*/
static set(path, handler) {
Registry.set('dataHandlers.' + path, handler);
}
/**
* Retrieves a data handler give... |
Set browserStack timeout in an attempt to fix failing CI builds | module.exports = function (config) {
config.set({
frameworks: ['mocha'],
files: [
'./node_modules/unexpected/unexpected.js',
'./node_modules/sinon/pkg/sinon.js',
'./lib/unexpected-sinon.js',
'./test/common/browser.js',
'./test/monkeyPatchSinonStackFrames.js',
'./test/unexp... | module.exports = function (config) {
config.set({
frameworks: ['mocha'],
files: [
'./node_modules/unexpected/unexpected.js',
'./node_modules/sinon/pkg/sinon.js',
'./lib/unexpected-sinon.js',
'./test/common/browser.js',
'./test/monkeyPatchSinonStackFrames.js',
'./test/unexp... |
Add RequestMiddleware if debug is on | <?php
namespace App\Bootstrap;
use App\CInterface\BootstrapInterface;
use App\Middleware\RequestLoggerMiddleware;
use App\Middleware\OAuthMiddleware;
use Phalcon\Config;
use Phalcon\Di\Injectable;
use Phalcon\DiInterface;
use PhalconRest\Api;
/**
* Class MiddlewareBootstrap
* @author Adeyemi Olaoye <yemi@cottacush... | <?php
namespace App\Bootstrap;
use App\CInterface\BootstrapInterface;
use App\Middleware\RequestLoggerMiddleware;
use App\Middleware\OAuthMiddleware;
use Phalcon\Config;
use Phalcon\Di\Injectable;
use Phalcon\DiInterface;
use PhalconRest\Api;
/**
* Class MiddlewareBootstrap
* @author Adeyemi Olaoye <yemi@cottacush... |
Add WorkDir field to System struct | package gen
type Config struct {
Source string `json:"source"`
Destination string `json:'destination"`
Safe bool `json:"safe"`
Excluede []string `json:"exclude"`
Include string `json""include"`
KeepFiles string `json:"keep_files"`
TimeZone string `json:"timezone"`
Encoding... | package gen
type Config struct {
Source string `json:"source"`
Destination string `json:'destination"`
Safe bool `json:"safe"`
Excluede []string `json:"exclude"`
Include string `json""include"`
KeepFiles string `json:"keep_files"`
TimeZone string `json:"timezone"`
Encoding... |
Use add_handler instead of set handlers as a list. | # -*- coding: utf-8 -*-
import unittest
from flask.ext.sqlalchemy import SQLAlchemy
import flask_featureflags as feature_flags
from flask_featureflags.contrib.sqlalchemy import SQLAlchemyFeatureFlags
from tests.fixtures import app, feature_setup
db = SQLAlchemy(app)
SQLAlchemyHandler = SQLAlchemyFeatureFlags(db)
... | # -*- coding: utf-8 -*-
import unittest
from flask.ext.sqlalchemy import SQLAlchemy
import flask_featureflags as feature_flags
from flask_featureflags.contrib.sqlalchemy import SQLAlchemyFeatureFlags
from tests.fixtures import app, feature_setup
db = SQLAlchemy(app)
SQLAlchemyHandler = SQLAlchemyFeatureFlags(db)
... |
Add skip to failing test | import React from 'react';
import ReactDOM from 'react-dom';
import { expect } from 'chai';
import MarkupFrame from '../src';
function mount( component ) {
const contentArea = window.document.querySelector( '#content' );
ReactDOM.render( component, contentArea );
}
describe( '<MarkupFrame />', function() {
it( 're... | import React from 'react';
import ReactDOM from 'react-dom';
import { expect } from 'chai';
import MarkupFrame from '../src';
function mount( component ) {
const contentArea = window.document.querySelector( '#content' );
ReactDOM.render( component, contentArea );
}
describe( '<MarkupFrame />', function() {
it( 're... |
Make search not case sensitive. | /**
* Search functionality for filtering tiles.
*
* Matt Weeks
*/
function stuff() {
removeEDR(document.getElementById('navbarInput-01').value, "tileLiproject");
}
function removeEDR(stringFind, tileClass) {
if (stringFind != "") {
var tiles = document.getElementsByClassName(tileClass);
for (i = 0; i < til... | /**
* Search functionality for filtering tiles.
*
* Matt Weeks
*/
function stuff() {
removeEDR(document.getElementById('navbarInput-01').value, "tileLiproject");
}
function removeEDR(stringFind, tileClass) {
if (stringFind != "") {
var tiles = document.getElementsByClassName(tileClass);
for (i = 0; i < til... |
Load site interface translation by default | <?php
namespace Concrete\Core\Localization\Translator\Adapter\Zend\Translation\Loader\Gettext;
use Concrete\Core\Localization\Translator\Translation\Loader\AbstractTranslationLoader;
use Concrete\Core\Localization\Translator\TranslatorAdapterInterface;
/**
* Translation loader that loads the site interface translat... | <?php
namespace Concrete\Core\Localization\Translator\Adapter\Zend\Translation\Loader\Gettext;
use Concrete\Core\Localization\Translator\Translation\Loader\AbstractTranslationLoader;
use Concrete\Core\Localization\Translator\TranslatorAdapterInterface;
/**
* Translation loader that loads the site interface translat... |
Fix for pathnames other than "/" | (function (window) {
window.__env = window.__env || {};
if (window.location.port) {
window.__env.hostUrl = window.location.protocol + '//' + window.location.hostname + ':' + window.location.port + window.location.pathname;
}
else {
window.__env.hostUrl = window.location.protocol + '//' +... | (function (window) {
window.__env = window.__env || {};
if (window.location.port) {
window.__env.hostUrl = window.location.protocol + '//' + window.location.hostname + ':' + window.location.port + '/';
}
else {
window.__env.hostUrl = window.location.protocol + '//' + window.location.host... |
Add an option to create just the module file | #!/usr/bin/env node
const program = require("commander");
const _ = require("lodash");
const utils = require("./utils");
var dest = "";
program
.usage("<module-name> [options]")
.arguments("<module-name>")
.action(function (moduleName) {
cmdModuleName = moduleName;
})
.option("-a, --ctrl-a... | #!/usr/bin/env node
const program = require("commander");
const _ = require("lodash");
const utils = require("./utils");
var dest = "";
program
.usage("<module-name> [options]")
.arguments("<module-name>")
.action(function (moduleName) {
cmdModuleName = moduleName;
})
.option("-a, --ctrl-a... |
Change tab size to 2 | import React, { Component } from 'react'
import CodeMirror from 'react-codemirror'
import 'codemirror/lib/codemirror.css'
import 'codemirror/theme/monokai.css'
require('codemirror/mode/jsx/jsx')
class LiveEditor extends Component {
constructor(props) {
super(props)
this.handleCodeChange = this.handleCodeCha... | import React, { Component } from 'react'
import CodeMirror from 'react-codemirror'
import 'codemirror/lib/codemirror.css'
import 'codemirror/theme/monokai.css'
require('codemirror/mode/jsx/jsx')
class LiveEditor extends Component {
constructor(props) {
super(props)
this.handleCodeChange = this.handleCodeCha... |
Add trailing comma to last item in Menu array | <?php
namespace Setup;
class Menus
{
/**
* Initialization
* This method should be run from functions.php
*/
public static function init()
{
add_action( 'init', array(__CLASS__, 'register') );
}
/**
* Registers menus within our theme
*/
public static function re... | <?php
namespace Setup;
class Menus
{
/**
* Initialization
* This method should be run from functions.php
*/
public static function init()
{
add_action( 'init', array(__CLASS__, 'register') );
}
/**
* Registers menus within our theme
*/
public static function re... |
Add a message when refusing due to a lack of query parameter | "use strict";
var restify = require('restify');
var async = require('async');
var Anyfetch = require('anyfetch');
module.exports.get = function get(req, res, next) {
if(!req.query.query) {
return next(new restify.ConflictError("Missing query parameter"));
}
async.waterfall([
function getDocuments(cb) {... | "use strict";
var restify = require('restify');
var async = require('async');
var Anyfetch = require('anyfetch');
module.exports.get = function get(req, res, next) {
if(!req.query.query) {
return next(new restify.ConflictError());
}
async.waterfall([
function getDocuments(cb) {
var anyfetchClient... |
Exit when backButton pressed in menu | package com.robitdroid;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
public class RobitDroid extends Activity {
private ImageView imageview;
/**
* Called when the activity is firs... | package com.robitdroid;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
public class RobitDroid extends Activity {
private ImageView imageview;
/**
* Called when the activity is firs... |
Add window.__PROMISE_INSTRUMENTATION__ flag to register RSVP.on callbacks | import Promise from "./rsvp/promise";
import EventTarget from "./rsvp/events";
import denodeify from "./rsvp/node";
import all from "./rsvp/all";
import race from "./rsvp/race";
import hash from "./rsvp/hash";
import rethrow from "./rsvp/rethrow";
import defer from "./rsvp/defer";
import { config, configure } from "./r... | import Promise from "./rsvp/promise";
import EventTarget from "./rsvp/events";
import denodeify from "./rsvp/node";
import all from "./rsvp/all";
import race from "./rsvp/race";
import hash from "./rsvp/hash";
import rethrow from "./rsvp/rethrow";
import defer from "./rsvp/defer";
import { config, configure } from "./r... |
Change of repo name. Update effected paths | import json
import matplotlib
import numpy as np
import pymc as pm
from matplotlib import pyplot as plt
def main():
tau = pm.rdiscrete_uniform(0, 80)
print tau
alpha = 1. / 20.
lambda_1, lambda_2 = pm.rexponential(alpha, 2)
print lambda_1, lambda_2
data = np.r_[pm.rpoisson(lambda_1, tau), pm... | import json
import matplotlib
import numpy as np
import pymc as pm
from matplotlib import pyplot as plt
def main():
matplotlibrc_path = '/home/noel/repo/playground/matplotlibrc.json'
matplotlib.rcParams.update(json.load(open(matplotlibrc_path)))
tau = pm.rdiscrete_uniform(0, 80)
print tau
alpha ... |
feat(role): Add isAdmin to user store if is admin | 'use strict'
var rootDir = __dirname.split('/')
rootDir.pop()
rootDir = rootDir.join('/')
var app =
{ rootDir: rootDir
}
var Role = require(__dirname + '/../routes/roles/model')(app)
var User = require(__dirname + '/../routes/users/model')(app)
module.exports = function *checkRole() {
var cb = function(resolve, reje... | 'use strict'
var rootDir = __dirname.split('/')
rootDir.pop()
rootDir = rootDir.join('/')
var app =
{ rootDir: rootDir
}
var Role = require(__dirname + '/../routes/roles/model')(app)
var User = require(__dirname + '/../routes/users/model')(app)
module.exports = function *checkRole() {
var cb = function(resolve, reje... |
Allow versions of requests between 1.0.0 and 2.0.0
Requests is semantically versioned, so minor version changes are expected to be compatible. | from setuptools import setup
from setuptools import find_packages
__author__ = 'Ryan McGrath <ryan@venodesigns.net>'
__version__ = '2.5.5'
setup(
# Basic package information.
name='twython',
version=__version__,
packages=find_packages(),
# Packaging options.
include_package_data=True,
# ... | from setuptools import setup
from setuptools import find_packages
__author__ = 'Ryan McGrath <ryan@venodesigns.net>'
__version__ = '2.5.5'
setup(
# Basic package information.
name='twython',
version=__version__,
packages=find_packages(),
# Packaging options.
include_package_data=True,
# ... |
DOC: Set default syntax highlighting language to 'none' | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Use sphinx-quickstart to create your own conf.py file!
# After that, you have to edit a few things. See below.
# Select nbsphinx and, if needed, add a math extension (mathjax or pngmath):
extensions = [
'nbsphinx',
'sphinx.ext.mathjax',
]
# Exclude build dire... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Use sphinx-quickstart to create your own conf.py file!
# After that, you have to edit a few things. See below.
# Select nbsphinx and, if needed, add a math extension (mathjax or pngmath):
extensions = [
'nbsphinx',
'sphinx.ext.mathjax',
]
# Exclude build dire... |
Add CORS handler for Location header | package feeds
import (
"net/http"
"github.com/gorilla/mux"
"github.com/rs/cors"
"google.golang.org/appengine"
)
func Run() {
dao := datastoreFeedsDao{}
router := mux.NewRouter()
corsHandler := cors.New(cors.Options{
AllowedHeaders:{"Location"},
})
router.Handle("/feeds", corsHandler(getFeedsHandler{dao})... | package feeds
import (
"net/http"
"github.com/gorilla/mux"
"github.com/rs/cors"
"google.golang.org/appengine"
)
func Run() {
dao := datastoreFeedsDao{}
router := mux.NewRouter()
router.Handle("/feeds", cors.Default().Handler(getFeedsHandler{dao})).
Methods(http.MethodGet)
getHandler := cors.Default().Han... |
Fix for renamed module util -> utils | #!/usr/bin/env python
import os.path as osp
import chainer
import fcn
def main():
dataset_dir = chainer.dataset.get_dataset_directory('apc2016')
path = osp.join(dataset_dir, 'APC2016rbo.tgz')
fcn.data.cached_download(
url='https://drive.google.com/uc?id=0B9P1L--7Wd2vSV9oLTd1U2I3TDg',
p... | #!/usr/bin/env python
import os.path as osp
import chainer
import fcn.data
import fcn.util
def main():
dataset_dir = chainer.dataset.get_dataset_directory('apc2016')
path = osp.join(dataset_dir, 'APC2016rbo.tgz')
fcn.data.cached_download(
url='https://drive.google.com/uc?id=0B9P1L--7Wd2vSV9oL... |
Remove a couple of console.log calls | var path = require("path");
var mvc = exports = module.exports;
/**
* Enable having multiple folders for views to support the
* module/mymodule/views structure
*/
mvc.EnableMultipeViewsFolders = function(app) {
// Monkey-patch express to accept multiple paths for looking up views.
// this path may change depe... | var path = require("path");
var mvc = exports = module.exports;
/**
* Enable having multiple folders for views to support the
* module/mymodule/views structure
*/
mvc.EnableMultipeViewsFolders = function(app) {
// Monkey-patch express to accept multiple paths for looking up views.
// this path may change depe... |
Add --include-ts to find error script | const { writeFileSync } = require('fs')
const alltests = require('./test-results')
const includeTs = process.argv.includes('--include-ts')
const results = [
...alltests.testResults[0].assertionResults,
...(includeTs ? alltests.testResults[1].assertionResults : [])
]
.filter(_ => _.failureMessages.length === 1)
... | const { writeFileSync } = require('fs')
const alltests = require('./test-results')
const results = alltests.testResults[0].assertionResults
.filter(_ => _.failureMessages.length === 1)
.map(_ => _.failureMessages[0])
.map(_ => _.split('[')[0])
.map(_ => (_.includes('SYNTAX ERROR') ? 'SYNTAX ERROR' : _))
.map... |
Simplify prove tests with read.Term_ | package golog
import "github.com/mndrix/golog/read"
import "testing"
func TestFacts (t *testing.T) {
rt := read.Term_
db := NewDatabase().
Asserta(rt(`father(michael).`)).
Asserta(rt(`father(marc).`))
t.Logf("%s\n", db.String())
// these should be provably true
if !IsTrue... | package golog
import . "github.com/mndrix/golog/term"
import "testing"
func TestFacts (t *testing.T) {
db := NewDatabase().
Asserta(NewTerm("father", NewTerm("michael"))).
Asserta(NewTerm("father", NewTerm("marc")))
t.Logf("%s\n", db.String())
// these should be provably true
... |
Disable wrapInEval for standalone builds. | /* jshint node: true */
var mergeTrees = require('broccoli-merge-trees');
var pickFiles = require('broccoli-static-compiler');
var compileES6 = require('broccoli-es6-concatenator');
var templateCompiler = require('broccoli-ember-hbs-template-compiler');
var registry = require('./registry');
var wrap = require('./wrap'... | /* jshint node: true */
var mergeTrees = require('broccoli-merge-trees');
var pickFiles = require('broccoli-static-compiler');
var compileES6 = require('broccoli-es6-concatenator');
var templateCompiler = require('broccoli-ember-hbs-template-compiler');
var registry = require('./registry');
var wrap = require('./wrap'... |
Add activation auth method, needed for lost password in tests | <?php
class Kwf_User_AuthPassword_FnF extends Kwf_Model_FnF
{
protected $_toStringField = 'email';
protected $_hasDeletedFlag = true;
protected function _init()
{
$this->_data = array(
array('id'=>1, 'email' => 'test@vivid.com', 'password' => md5('foo'.'123'), 'password_salt' => '12... | <?php
class Kwf_User_AuthPassword_FnF extends Kwf_Model_FnF
{
protected $_toStringField = 'email';
protected $_hasDeletedFlag = true;
protected function _init()
{
$this->_data = array(
array('id'=>1, 'email' => 'test@vivid.com', 'password' => md5('foo'.'123'), 'password_salt' => '12... |
Fix XSS issue in demo | $(function() {
// When we're using HTTPS, use WSS too.
var ws_scheme = window.location.protocol == "https:" ? "wss" : "ws";
var chatsock = new ReconnectingWebSocket(ws_scheme + '://' + window.location.host + "/chat" + window.location.pathname);
chatsock.onmessage = function(message) {
var d... | $(function() {
// When we're using HTTPS, use WSS too.
var ws_scheme = window.location.protocol == "https:" ? "wss" : "ws";
var chatsock = new ReconnectingWebSocket(ws_scheme + '://' + window.location.host + "/chat" + window.location.pathname);
chatsock.onmessage = function(message) {
var d... |
Use updateHead instead of createRef | var oauthAuth = new GitHub(logged ? { token: logged } : {}),
repo = oauthAuth.getRepo(OWNER_NAME, PROJECT_NAME),
auth = logged ? oauthAuth.getUser() : false;
// READ REPO
repo.getDetails(function(e,r){
// CHECK ADMIN
if (r.permissions && r.permissions.admin) {
// Show admin link
document.querySelector('a[href*... | var oauthAuth = new GitHub(logged ? { token: logged } : {}),
repo = oauthAuth.getRepo(OWNER_NAME, PROJECT_NAME),
auth = logged ? oauthAuth.getUser() : false;
// READ REPO
repo.getDetails(function(e,r){
// CHECK ADMIN
if (r.permissions && r.permissions.admin) {
// Show admin link
document.querySelector('a[href*... |
Remove the need to define a default validator | <?php
namespace Knplabs\MarkupValidatorBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
/**
* Dependency injection container compiler pass to... | <?php
namespace Knplabs\MarkupValidatorBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
/**
* Dependency injection container compiler pass to... |
Move over tweaks to munge-phdr script from chromium repo
Some cosmetic changes were made on the chromium side since we copied it.
Catch up to those, still preparing to remove the chromium copy ASAP.
BUG= none
TEST= trybots
R=bradchen@google.com
Review URL: http://codereview.chromium.org/8728008
git-svn-id: 721b910... | #!/usr/bin/env python
# Copyright (c) 2011 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""This takes three command-line arguments:
MUNGE-PHDR-PROGRAM file name of program built from
... | #!/usr/bin/python
# Copyright (c) 2011 The Native Client Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# This takes three command-line arguments:
# MUNGE-PHDR-PROGRAM file name of program built from
# ... |
Test: Add output returned by the fixer | 'use strict';
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
var rule = require('../../../lib/rules/no-const-outside-module-scope');
var RuleTester = require('eslint').RuleTester;
//---... | 'use strict';
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
var rule = require('../../../lib/rules/no-const-outside-module-scope');
var RuleTester = require('eslint').RuleTester;
//---... |
Create Model with instances and securityGroups | package jp.ac.nii.prl.mape.monitoring.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import o... | package jp.ac.nii.prl.mape.monitoring.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import o... |
Add python_requires to help pip | import os
from setuptools import setup
long_description = 'Please see our GitHub README'
if os.path.exists('README.txt'):
long_description = open('README.txt').read()
base_url = 'https://github.com/sendgrid/'
version = '3.1.0'
setup(
name='python_http_client',
version=version,
author='Elmer Thomas',... | import os
from setuptools import setup
long_description = 'Please see our GitHub README'
if os.path.exists('README.txt'):
long_description = open('README.txt').read()
base_url = 'https://github.com/sendgrid/'
version = '3.1.0'
setup(
name='python_http_client',
version=version,
author='Elmer Thomas',... |
Fix relative references to assets | #!/usr/bin/env node
var fs = require('fs')
var html2png = require('html2png');
var path = require('path');
var command = path.basename(process.argv.slice(1));
var args = process.argv.slice(2);
if (args.length == 0) {
console.log('Usage: ' + command + ' [text]');
process.exit();
}
fs.readFile(__dirname + '/tweet.... | #!/usr/bin/env node
var fs = require('fs')
var html2png = require('html2png');
var path = require('path');
var command = path.basename(process.argv.slice(1));
var args = process.argv.slice(2);
if (args.length == 0) {
console.log('Usage: ' + command + ' [text]');
process.exit();
}
fs.readFile('tweet.html', 'utf8'... |
Add support for Arch Linux mathjax package
Fixes #4. | # This file is part of python-markups module
# License: 3-clause BSD, see LICENSE file
# Copyright: (C) Dmitry Shachnev, 2012-2018
import os.path
# Some common constants and functions
(LANGUAGE_HOME_PAGE, MODULE_HOME_PAGE, SYNTAX_DOCUMENTATION) = range(3)
CONFIGURATION_DIR = (os.getenv('XDG_CONFIG_HOME') or os.getenv... | # This file is part of python-markups module
# License: 3-clause BSD, see LICENSE file
# Copyright: (C) Dmitry Shachnev, 2012-2018
import os.path
# Some common constants and functions
(LANGUAGE_HOME_PAGE, MODULE_HOME_PAGE, SYNTAX_DOCUMENTATION) = range(3)
CONFIGURATION_DIR = (os.getenv('XDG_CONFIG_HOME') or os.getenv... |
Test against a clause head and body | package golog
import "testing"
func TestAsserta(t *testing.T) {
db0 := NewDatabase()
db1 := db0.Asserta(NewTerm("alpha"))
db2 := db1.Asserta(NewTerm("beta"))
foo := NewTerm("foo", NewTerm("one"), NewTerm("two"))
body := NewTerm("alpha")
db3 := db2.Asserta(NewTerm(":-", foo, body))
t.Logf(... | package golog
import "testing"
func TestAsserta(t *testing.T) {
db0 := NewDatabase()
db1 := db0.Asserta(NewTerm("alpha"))
db2 := db1.Asserta(NewTerm("beta"))
db3 := db2.Asserta(NewTerm("gamma", NewTerm("greek to me")))
// do we have the right number of clauses?
if db0.ClauseCount() != 0 {
... |
Remove app argument from init. | var debug = require('debug')('initialize');
function Initializer() {
this._phases = [];
}
Initializer.prototype.init = function(cb) {
var self = this
, phases = this._phases
, idx = 0;
function next(err) {
if (err) { return cb(err); }
var phase = phases[idx++];
// all done
if (!p... | var debug = require('debug')('initialize');
function Initializer() {
this._phases = [];
}
Initializer.prototype.init = function(app, cb) {
var self = this
, phases = this._phases
, idx = 0;
function next(err) {
if (err) { return cb(err); }
var phase = phases[idx++];
// all done
i... |
Bump version 0.2.1 -> 0.2.2 |
from setuptools import setup
from setuptools import find_packages
install_requires = [
'zeep>=1.6',
]
tests_require = [
'pytest>3',
'mock',
]
setup(
name='pyAEATsii',
version='0.2.2',
description='A python wrapper for the AEAT SII webservices',
author="Calidae S.L.",
author_email="de... |
from setuptools import setup
from setuptools import find_packages
install_requires = [
'zeep>=1.6',
]
tests_require = [
'pytest>3',
'mock',
]
setup(
name='pyAEATsii',
version='0.2.1',
description='A python wrapper for the AEAT SII webservices',
author="Calidae S.L.",
author_email="de... |
Add indexes to service migration | <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Capsule\Manager as Capsule;
class Service extends Migration
{
public function up()
{
$capsule = new Capsule();
$capsule::schema()->create('service', function (Blueprint $table) ... | <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Capsule\Manager as Capsule;
class Service extends Migration
{
public function up()
{
$capsule = new Capsule();
$capsule::schema()->create('service', function (Blueprint $table) ... |
Change alias from F to E | package sack
import (
"fmt"
"github.com/codegangsta/cli"
)
func shellInit(c *cli.Context) {
sh := `
sack=$(which sack)
alias S="${sack} -s"
alias E="${sack} -e"
`
fmt.Println(sh)
}
func shellEval(c *cli.Context) {
sh := "eval \"$(sack init)\""
fmt.Println(sh)
}
/*
// TODO: Add bash and zsh a... | package sack
import (
"fmt"
"github.com/codegangsta/cli"
)
func shellInit(c *cli.Context) {
sh := `
sack=$(which sack)
alias S="${sack} -s"
alias F="${sack} -e"
`
fmt.Println(sh)
}
func shellEval(c *cli.Context) {
sh := "eval \"$(sack init)\""
fmt.Println(sh)
}
/*
// TODO: Add bash and zsh a... |
Fix missing implode() $glue parameter. | <?php
declare(strict_types=1);
/*
* This file is part of Badcow DNS Library.
*
* (c) Samuel Williams <sam@badcow.co>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Badcow\DNS\Parser;
class StringIterator extends \Arr... | <?php
declare(strict_types=1);
/*
* This file is part of Badcow DNS Library.
*
* (c) Samuel Williams <sam@badcow.co>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Badcow\DNS\Parser;
class StringIterator extends \Arr... |
Fix regeneratorRuntime missing in tests | module.exports = api => {
api.cache(true);
const presets = [
[
'@babel/preset-env',
process.env.NODE_ENV === 'test'
? {
useBuiltIns: 'usage', // for regeneratorRuntime
}
: {
modules: fa... | module.exports = api => {
api.cache(true);
const presets = [
[
'@babel/preset-env',
process.env.NODE_ENV === 'test'
? {}
: {
modules: false,
},
],
'@babel/preset-react',
'@babel/prese... |
Fix warning if children is null | import React from 'react';
import PropTypes from 'prop-types';
import cn from 'classnames';
import styles from './Base.module.css';
const renderLabel = label => {
if (typeof label === 'undefined') {
return null;
}
return <div className={styles.label}>{label}</div>;
};
const renderCount = count => {
if (t... | import React from 'react';
import PropTypes from 'prop-types';
import cn from 'classnames';
import styles from './Base.module.css';
const renderLabel = label => {
if (typeof label === 'undefined') {
return null;
}
return <div className={styles.label}>{label}</div>;
};
const renderCount = count => {
if (t... |
Fix public cacheBy for domain model. | <?php
namespace Websanova\EasyCache\Models;
class Domain extends BaseModel
{
protected $table = 'websanova_easycache_domains';
protected $cacheKey = 'domains';
public $cacheBy = 'slug';
public $timestamps = false;
public function slug()
{
return $this->select('*');
}
publi... | <?php
namespace Websanova\EasyCache\Models;
class Domain extends BaseModel
{
protected $table = 'websanova_easycache_domains';
protected $cacheKey = 'domains';
protected $cacheBy = 'slug';
public $timestamps = false;
public function slug()
{
return $this->select('*');
}
pu... |
Add a couple more tags. | 'use strict';
module.exports.generic = require('./generic');
module.exports.everything = module.exports.generic('everything','everything');
module.exports.outcome = module.exports.generic('outcome');
module.exports.outcome.success = module.exports.outcome('success');
module.exports.outcome.failure = module.exports.o... | 'use strict';
module.exports.generic = require('./generic');
module.exports.outcome = module.exports.generic('outcome');
module.exports.outcome.success = module.exports.outcome('success');
module.exports.outcome.failure = module.exports.outcome('failure');
module.exports.outcome.timeout = module.exports.outcome('time... |
Add comment about toggling devtools | const {Menu} = require('electron')
const menubar = require('menubar')
// Toggle with cmd + alt + i
require('electron-debug')({showDevTools: true})
const mb = menubar({
width: 220,
height: 206,
preloadWindow: true,
icon: `${__dirname}/img/icon-0-Template.png`
})
// Make menubar accessible to the renderer
glob... | const {Menu} = require('electron')
const menubar = require('menubar')
require('electron-debug')({showDevTools: true});
const mb = menubar({
width: 220,
height: 206,
preloadWindow: true,
icon: `${__dirname}/img/icon-0-Template.png`
})
// Make menubar accessible to the renderer
global.sharedObject = {mb}
mb.o... |
Add compress: false for proper results. | var gulp = require("gulp"),
util = require("gulp-util"),
minifyHtml = require("gulp-minify-html"),
less = require("gulp-less"),
minifyCss = require("gulp-minify-css"),
minifyJs = require("gulp-uglify");
gulp.task("html", function() {
util.log("Minifying...");
gulp.src("src/html/*.html"... | var gulp = require("gulp"),
util = require("gulp-util"),
minifyHtml = require("gulp-minify-html"),
less = require("gulp-less"),
minifyCss = require("gulp-minify-css"),
minifyJs = require("gulp-uglify");
gulp.task("html", function() {
util.log("Minifying...");
gulp.src("src/html/*.html"... |
Use /wm/device/all/json for all devices and /*** where *** is a filter by mac, vlan, ip, etc | /**
* Copyright 2012, Big Switch Networks, Inc.
* Originally created by David Erickson, Stanford University
*
* 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:/... | /**
* Copyright 2012, Big Switch Networks, Inc.
* Originally created by David Erickson, Stanford University
*
* 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:/... |
Fix reading values of username and password from the basic authwntication form
Wrong selectors were used. | 'use strict';
SwaggerUi.Views.BasicAuthButton = Backbone.View.extend({
initialize: function (opts) {
this.options = opts || {};
this.router = this.options.router;
},
render: function(){
var template = this.template();
$(this.el).html(template(this.model));
return this;
},
events: {
... | 'use strict';
SwaggerUi.Views.BasicAuthButton = Backbone.View.extend({
initialize: function (opts) {
this.options = opts || {};
this.router = this.options.router;
},
render: function(){
var template = this.template();
$(this.el).html(template(this.model));
return this;
},
events: {
... |
Use N4JDB.query to create a (:Meteo4j {name: 'hello world'}) node |
if (Meteor.isServer) {
// Check if there are any nodes with the Meteo4J label in the
// database, using a standard cypher query
var label = "Meteo4j"
var cypher = "MATCH (n:" + label + ") RETURN n"
var options = null
Meteor.N4JDB.query(cypher, options, matchCallback)
function matchCallback(error, nodeA... |
if (Meteor.isServer) {
// Check if there are any nodes at all in the database
var query = 'MATCH (n) RETURN n'
var options = null
Meteor.N4JDB.query(query, options, callback) // output is undefined
// The database sends its response to a callback
function callback(error, nodeArray) {
console.log(er... |
Clarify error if otp is wrong | #!/usr/bin/python
"""An example demonstrating the client-side usage
of the cretificate request API endpoint.
"""
import requests, sys, json
otp = sys.argv[1]
domain_req_url = 'https://spire.cloudfleet.io/api/v1/blimp/domain'
domain_txt_path = '/opt/cloudfleet/data/config/domain.txt'
print('retrieving domain for bli... | #!/usr/bin/python
"""An example demonstrating the client-side usage
of the cretificate request API endpoint.
"""
import requests, sys, json
otp = sys.argv[1]
domain_req_url = 'https://spire.cloudfleet.io/api/v1/blimp/domain'
domain_txt_path = '/opt/cloudfleet/data/config/domain.txt'
print('retrieving domain for bli... |
Load block styles via amp_post_template_head action | <?php
/**
* Load the reader mode template.
*
* @package AMP
*/
/**
* Queried post.
*
* @global WP_Post $post
*/
global $post;
// Populate the $post without calling the_post() to prevent entering The Loop. This ensures that templates which
// contain The Loop will still loop over the posts. Otherwise, if a tem... | <?php
/**
* Load the reader mode template.
*
* @package AMP
*/
/**
* Queried post.
*
* @global WP_Post $post
*/
global $post;
// Populate the $post without calling the_post() to prevent entering The Loop. This ensures that templates which
// contain The Loop will still loop over the posts. Otherwise, if a tem... |
Use gulp to generate one app.css, and separate 'fonts' task | 'use strict';
var gulp = require('gulp');
var sass = require('gulp-sass');
gulp.task('default', ['sass', 'fonts'], function () {
});
gulp.task('sass', function () {
return gulp.src('./styles/warriormachines_2016/theme/sass/app.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./st... | 'use strict';
var gulp = require('gulp');
var sass = require('gulp-sass');
gulp.task('default', ['sass'], function () {
//gulp.src('./node_modules/font-awesome/fonts/**/*.{eot,svg,ttf,woff,woff2}')
// .pipe(gulp.dest('./styles/warriormachines_2016/theme/gulp-generated/fonts'));
});
gulp.task('sass', funct... |
Add react production mode support in webpack | let webpack = require('webpack');
let path = require('path');
let BUILD_DIR = path.resolve(__dirname, 'client/dist');
let APP_DIR = path.resolve(__dirname, 'client/src');
// console.log("path.resolve()", path.resolve());
// console.log("path.resolve(__dirname)", path.resolve(__dirname));
// console.log("BUILD_DIR", B... | let webpack = require('webpack');
let path = require('path');
let BUILD_DIR = path.resolve(__dirname, 'client/dist');
let APP_DIR = path.resolve(__dirname, 'client/src');
// console.log("path.resolve()", path.resolve());
// console.log("path.resolve(__dirname)", path.resolve(__dirname));
// console.log("BUILD_DIR", B... |
Add more verbose error to reporte on Travis parserXML.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
from xml.etree.ElementTree import ParseError
import xml.etree.ElementTree as ET
import glob
import sys
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
def parse():
for infile in glob.glob('*.xml'):
tr... | #!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
from xml.etree.ElementTree import ParseError
import xml.etree.ElementTree as ET
import glob
import sys
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
def parse():
for infile in glob.glob('*.xml'):
tr... |
Fix for sticking virtual keys | /*
* Copyright 2012 Kulikov Dmitriy
* Copyright 2017 Nikita Shakarun
*
* 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 re... | /*
* Copyright 2012 Kulikov Dmitriy
* Copyright 2017 Nikita Shakarun
*
* 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 re... |
Use "\n" to fix waiting for prompt in feature tests on CI | import time, pexpect, re
import nose.tools as nt
import subprocess as spr
PROMPT = "root@\w+:[^\r]+"
ENTER = "\n"
def type(process, input_):
process.send(input_.encode())
process.expect(PROMPT)
# Remove the typed input from the returned standard out
return re.sub(re.escape(input_.strip()), '', proce... | import time, pexpect, re
import nose.tools as nt
import subprocess as spr
PROMPT = "root@\w+:[^\r]+"
UP_ARROW = "\x1b[A"
def type(process, input_):
process.send(input_.encode())
process.expect(PROMPT)
# Remove the typed input from the returned standard out
return re.sub(re.escape(input_.strip()), ''... |
Fix incorrect login url for sign in form on frontpage | <form name="loginform" action="<?php echo wp_login_url(home_url());?>" method="post">
<input type="hidden" name="redirect_to" value="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>" />
<input type="hidden" name="user-cookie" value="1" />
<p>
<input type="text" name="log" placeholder="E-postadress eller nick"
<?... | <form name="loginform" action="<?php bloginfo("wpurl");?>/wp-login.php" method="post">
<input type="hidden" name="redirect_to" value="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>" />
<input type="hidden" name="user-cookie" value="1" />
<p>
<input type="text" name="log" placeholder="E-postadress eller nick"
<... |
Fix for modules with null [[Prototype]] chain
A module created in the following ways:
module.exports = Object.create(null)
module.exports = { __proto__: null }
won't have hasOwnProperty() available on it.
So it’s safer to use Object.prototype.hasOwnProperty.call(myObj, prop)
instead of myObj.hasOwnProperty(prop) | 'use strict';
var isReactClassish = require('./isReactClassish'),
isReactElementish = require('./isReactElementish');
function makeExportsHot(m) {
if (isReactElementish(m.exports)) {
return false;
}
var freshExports = m.exports,
foundReactClasses = false;
if (isReactClassish(m.exports)) {
... | 'use strict';
var isReactClassish = require('./isReactClassish'),
isReactElementish = require('./isReactElementish');
function makeExportsHot(m) {
if (isReactElementish(m.exports)) {
return false;
}
var freshExports = m.exports,
foundReactClasses = false;
if (isReactClassish(m.exports)) {
... |
Set git author on Travis | import {exec} from 'node-promise-es6/child-process';
import fs from 'node-promise-es6/fs';
async function run() {
const {linkDependencies = {}} = await fs.readJson('package.json');
for (const dependencyName of Object.keys(linkDependencies)) {
const dependencyPath = linkDependencies[dependencyName];
const ... | import {exec} from 'node-promise-es6/child-process';
import fs from 'node-promise-es6/fs';
async function run() {
const {linkDependencies = {}} = await fs.readJson('package.json');
for (const dependencyName of Object.keys(linkDependencies)) {
const dependencyPath = linkDependencies[dependencyName];
const ... |
Improve mongo logging, so we only log unexpected disconnects.
This cleans things up a bit so normal shutdown doesn't spew mongo
disconnect errors. | 'use strict';
var logger = require('./logger'),
mongoose = require('mongoose');
// Log unexpected events.
var events = ['disconnecting', 'disconnected', 'close', 'reconnected', 'error'];
events.forEach(function(event) {
mongoose.connection.on(event, function(error) {
var logEvent = true;
if(event === '... | 'use strict';
var logger = require('./logger'),
mongoose = require('mongoose');
// Log unexpected events.
var events = ['disconnecting', 'disconnected', 'close', 'reconnected', 'error'];
events.forEach(function(event) {
mongoose.connection.on(event, function() {
logger.error('Mongo '+ event, arguments);
}... |
Add contribute.json to the nickname blacklist
Ref #1535 | // nicknameblacklist.js
//
// list of banished nicknames
//
// Copyright 2017, Ryan Riddle
//
// 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... | // nicknameblacklist.js
//
// list of banished nicknames
//
// Copyright 2017, Ryan Riddle
//
// 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... |
Add checking whether Error has the property 'captureStackTrace' | /**
* Copyright 2015 Jaime Pajuelo
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or a... | /**
* Copyright 2015 Jaime Pajuelo
*
* 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... |
Use sync storage instead of local storage | // if you checked "fancy-settings" in extensionizr.com, uncomment this lines
// var settings = new Store("settings", {
// "sample_setting": "This is how you use Store.js to remember values"
// });
function generateUUID() {
let id = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
let r ... | // if you checked "fancy-settings" in extensionizr.com, uncomment this lines
// var settings = new Store("settings", {
// "sample_setting": "This is how you use Store.js to remember values"
// });
function generateUUID() {
let id = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
let r ... |
Add statusActions arg to remote call sig | /**
RemoteCall
@description function that makes the remote call using the fetch polyfill,
running a series of provided lifecycle hooks
@exports @default {function} callRemoteResource
**/
/* eslint no-unused-vars:0 */
// TODO: should probably use a global fetch instance if we can
import fetch from 'isomorphic... | /**
RemoteCall
@description function that makes the remote call using the fetch polyfill,
running a series of provided lifecycle hooks
@exports @default {function} callRemoteResource
**/
/* eslint no-unused-vars:0 */
// TODO: should probably use a global fetch instance if we can
import fetch from 'isomorphic... |
Use non-reserved user table name | package com.maddogs.domain;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import java.util.List;
@Entity
@Table(name = "tuser")
public class User extends PersistableDomainObject{
private String name;
private String email;
private String password;
... | package com.maddogs.domain;
import javax.persistence.Entity;
import javax.persistence.OneToMany;
import java.util.List;
@Entity
public class User extends PersistableDomainObject{
private String name;
private String email;
private String password;
@OneToMany
private List<Tag> tags;
@OneToMan... |
Configure Enzyme for React 16. | import { configure, mount } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
configure({ adapter: new Adapter() });
/*
Setup and takedown
*/
function createMountNode ({ context, mountNodeId }) {
const internalmountNodeId = mountNodeId || 'mount-node';
context.dom = document.createElement('div');
co... | import { mount } from 'enzyme';
/*
Setup and takedown
*/
function createMountNode ({ context, mountNodeId }) {
const internalmountNodeId = mountNodeId || 'mount-node';
context.dom = document.createElement('div');
const mountNode = document.body.appendChild(context.dom);
mountNode.id = internalmountNodeId;
retu... |
Reduce print statement console clustering | #!/usr/bin/python3
"""Command line runtime for Tea."""
import runtime.lib
from runtime import lexer, parser, env
TEA_VERSION = "0.0.5-dev"
TEA_TITLE = "Tea @" + TEA_VERSION
CLI_SYMBOL = "#> "
CLI_SPACE = " " * 3
CLI_RESULT = "<- "
def interpret(expression, context):
"""Interpret an expression by tokenizing, par... | #!/usr/bin/python3
"""Command line runtime for Tea."""
import runtime.lib
from runtime import lexer, parser, env
TEA_VERSION = "0.0.5-dev"
TEA_TITLE = "Tea @" + TEA_VERSION
CLI_SYMBOL = "#> "
CLI_SPACE = " " * 3
CLI_RESULT = "<- "
def interpret(expression, context):
"""Interpret an expression by tokenizing, par... |
Fix the database session init to work with the flask debug server.
The debug webserver consists of two parts: the watcher that watches
the files for changes and the worker that is forked and will be restarted
after each modification. Sqlachemy uses a SingletonPool that will not
work with this if the database was initi... | from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.pool import StaticPool
session = None
def init_session(connection_string=None, drop=False):
if connection_string is None:
engine = create_engine('sqlite://',
echo... | from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
session = None
def init_session(connection_string=None, drop=False):
if connection_string is None:
connection_string = 'sqlite://'
from database.model import Base
global session
if drop:
t... |
Revert "populate the name in the event list"
This reverts commit 26cdf5c120aece5d7d1db2e21610bb46eaf35c30. | /**
* This file is licensed under the University of Illinois/NCSA Open Source License. See LICENSE.TXT for details.
*/
package edu.illinois.codingtracker.operations;
import java.util.Date;
import org.eclipse.core.runtime.AssertionFailedException;
import org.eclipse.ui.IEditorPart;
import edu.illinois.codingtracker... | /**
* This file is licensed under the University of Illinois/NCSA Open Source License. See LICENSE.TXT for details.
*/
package edu.illinois.codingtracker.operations;
import java.util.Date;
import org.eclipse.core.runtime.AssertionFailedException;
import org.eclipse.ui.IEditorPart;
import edu.illinois.codingtracker... |
fix: Allow spaces/special chars in application names
closes #534 | 'use strict';
const joi = require('joi');
const applicationSchema = joi
.object()
.options({ stripUnknown: false })
.keys({
appName: joi.string().required(),
sdkVersion: joi.string().optional(),
strategies: joi
.array()
.optional()
.items(joi.str... | 'use strict';
const joi = require('joi');
const { nameType } = require('./util');
const applicationSchema = joi
.object()
.options({ stripUnknown: false })
.keys({
appName: nameType,
sdkVersion: joi.string().optional(),
strategies: joi
.array()
.optional()
... |
Add support for dataset Object | /* global SVGElement */
import { setStyle } from './setstyle';
import { isFunction, getEl } from './util';
const xlinkns = 'http://www.w3.org/1999/xlink';
export const setAttr = (view, arg1, arg2) => {
const el = getEl(view);
let isSVG = el instanceof SVGElement;
if (arg2 !== undefined) {
if (arg1 === 'st... | /* global SVGElement */
import { setStyle } from './setstyle';
import { isFunction, getEl } from './util';
const xlinkns = 'http://www.w3.org/1999/xlink';
export const setAttr = (view, arg1, arg2) => {
const el = getEl(view);
let isSVG = el instanceof SVGElement;
if (arg2 !== undefined) {
if (arg1 === 'st... |
Refresh monitoring.nagios.log and fix pylint+pep8. | # -*- coding: UTF-8 -*-
# Copyright (C) Vincent BESANCON <besancon.vincent@gmail.com>
#
# 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... | #===============================================================================
# -*- coding: UTF-8 -*-
# Module : log
# Author : Vincent BESANCON aka 'v!nZ' <besancon.vincent@gmail.com>
# Description : Base to have some logging.
#------------------------------------------------------------------------... |
Fix bug in webhook server | 'use strict';
var http = require('http');
var spawn = require('child_process').spawn;
http.createServer(function(req, res) {
var json = '';
if (req.method !== 'POST') {
return;
}
if (req.headers['x-github-event'] !== 'push') {
return;
}
req.on('data', function(chunk) {
json += chunk;
});
... | 'use strict';
var http = require('http');
var spawn = require('child_process').spawn;
http.createServer(function(req, res) {
var json = '';
if (req.method !== 'POST') {
return;
}
if (req.headers['x-github-event'] !== 'push') {
return;
}
req.on('data', function(chunk) {
json += chunk;
});
... |
Fix bug involving datatype mixup | /*global $*/
const m = require('mithril');
const ItemsCount = module.exports = {};
ItemsCount.view = function (ctrl, args) {
const ITEMS_PER_PAGE = args.possibleItemsPerPage;
let currentItemsPerPage = parseInt(args.itemsPerPage());
let getItemsCountSelect = function () {
let selectConfig = {
config: ... | /*global $*/
const m = require('mithril');
const ItemsCount = module.exports = {};
ItemsCount.view = function (ctrl, args) {
const ITEMS_PER_PAGE = args.possibleItemsPerPage;
let getItemsCountSelect = function () {
let selectConfig = {
config: () => { $('select').material_select(); }, // for materializ... |
Add Note_count field to BasePost | package gotumblr
type BasePost struct {
Blog_name string
Id int64
Post_url string
PostType string `json:"type"`
Timestamp int64
Date string
Format string
Reblog_key string
Tags []string
Bookmarklet bool
Mobile bool
Source_url string
Source_title str... | package gotumblr
type BasePost struct {
Blog_name string
Id int64
Post_url string
PostType string `json:"type"`
Timestamp int64
Date string
Format string
Reblog_key string
Tags []string
Bookmarklet bool
Mobile bool
Source_url string
Source_title str... |
Include restricted fields in Elasticsearch mapping [WEB-2399] | <?php
namespace App\Models;
trait Transformable
{
public function transform(array $requestedFields = null)
{
$transformer = app('Resources')->getTransformerForModel(get_called_class());
// WEB-1953: Set $isRestricted to false here; index all fields
return (new $transformer(null, fals... | <?php
namespace App\Models;
trait Transformable
{
public function transform(array $requestedFields = null)
{
$transformer = app('Resources')->getTransformerForModel(get_called_class());
// WEB-1953: Set $isRestricted to false here; index all fields
return (new $transformer(null, fals... |
Fix a broken export test
Former-commit-id: 4b369edfcb5782a2461742547f5b6af3bab4f759 [formerly e37e964bf9d2819c0234303d31ed2839c317be04]
Former-commit-id: 5b8a20fa99eab2f33c8f293a505a2dbadad36eee |
# Copyright (c) 2010-2014, GEM Foundation.
#
# OpenQuake 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 version 3 of the License, or
# (at your option) any later version.
#
# OpenQuake is distr... |
# Copyright (c) 2010-2014, GEM Foundation.
#
# OpenQuake 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 version 3 of the License, or
# (at your option) any later version.
#
# OpenQuake is distr... |
Add link of an author to the credit section | <?php
if(!defined('MEDIAWIKI')) die;
$dir = __DIR__;
$ext = 'HideUnwanted';
$wgExtensionCredits['other'][] = array(
'path' => __FILE__,
'name' => $ext,
'version' => '0.1',
'author' => '[https://github.com/uta uta]',
'url' => 'https://github.com/uta/HideUnwa... | <?php
if(!defined('MEDIAWIKI')) die;
$dir = __DIR__;
$ext = 'HideUnwanted';
$wgExtensionCredits['other'][] = array(
'path' => __FILE__,
'name' => $ext,
'version' => '0.1',
'author' => 'uta',
'url' => 'https://github.com/uta/HideUnwanted',
'descriptionmsg'... |
Add suppression of tested code stdout in tests
Add `buffer = True` option to unittest main method call, which
suppresses any printing the code being tested has. This makes for
cleaner test suite output. | import unittest, boto, os
from bucketeer import commit
class BuckeeterTest(unittest.TestCase):
# Constants - TODO move to config file
global existing_bucket, test_dir, test_file
existing_bucket = 'bucket.exists'
test_dir = 'bucketeer_test_dir'
test_file = 'bucketeer_test_file'
def setUp(self):
connec... | import unittest, boto, os
from bucketeer import commit
class BuckeeterTest(unittest.TestCase):
# Constants - TODO move to config file
global existing_bucket, test_dir, test_file
existing_bucket = 'bucket.exists'
test_dir = 'bucketeer_test_dir'
test_file = 'bucketeer_test_file'
def setUp(self):
connec... |
Move the selector matcher to OnceExit | const { getRulesMatcher, getReset, createResetRule } = require("./lib");
function contains(array, item) {
return array.indexOf(item) !== -1;
}
module.exports = (opts = {}) => {
opts.rulesMatcher = opts.rulesMatcher || "bem";
opts.reset = opts.reset || "initial";
const rulesMatcher = getRulesMatcher(opts.rules... | const { getRulesMatcher, getReset, createResetRule } = require("./lib");
function contains(array, item) {
return array.indexOf(item) !== -1;
}
module.exports = (opts = {}) => {
opts.rulesMatcher = opts.rulesMatcher || "bem";
opts.reset = opts.reset || "initial";
const rulesMatcher = getRulesMatcher(opts.rules... |
tests: Test slicing a range that does not start at zero. | # test builtin range type
# print
print(range(4))
# bool
print(bool(range(0)))
print(bool(range(10)))
# len
print(len(range(0)))
print(len(range(4)))
print(len(range(1, 4)))
print(len(range(1, 4, 2)))
print(len(range(1, 4, -1)))
print(len(range(4, 1, -1)))
print(len(range(4, 1, -2)))
# subscr
print(range(4)[0])
pri... | # test builtin range type
# print
print(range(4))
# bool
print(bool(range(0)))
print(bool(range(10)))
# len
print(len(range(0)))
print(len(range(4)))
print(len(range(1, 4)))
print(len(range(1, 4, 2)))
print(len(range(1, 4, -1)))
print(len(range(4, 1, -1)))
print(len(range(4, 1, -2)))
# subscr
print(range(4)[0])
pri... |
Hide settigns login if oscar hasn't been tapped | // @flow
import * as React from 'react'
import {StyleSheet, ScrollView} from 'react-native'
import {TableView} from 'react-native-tableview-simple'
import {connect} from 'react-redux'
import {type ReduxState} from '../../flux'
import type {TopLevelViewPropsType} from '../types'
import CredentialsLoginSection from './... | // @flow
import * as React from 'react'
import {StyleSheet, ScrollView} from 'react-native'
import {TableView} from 'react-native-tableview-simple'
import type {TopLevelViewPropsType} from '../types'
import CredentialsLoginSection from './sections/login-credentials'
import OddsAndEndsSection from './sections/odds-and... |
Replace execfile() with exec() since it does not work with Python 3
Signed-off-by: Christophe Vu-Brugier <1930e27f67e1e10d51770b88cb06d386f1aa46ae@yahoo.fr> | #! /usr/bin/env python
'''
This file is part of targetcli.
Copyright (c) 2011-2013 by Datera, Inc
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
Unl... | #! /usr/bin/env python
'''
This file is part of targetcli.
Copyright (c) 2011-2013 by Datera, Inc
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
Unl... |
Fix count of array rank
15 was on my local computer. | <?php
namespace Chay22\RecSelMeter\Tests;
use Chay22\RecSelMeter\Config;
class ConfigTests extends \PHPUnit_Framework_TestCase
{
public $config;
/**
* Tests against old created + established store
*/
function __construct()
{
$this->config = new Config;
}
public function testNew()
{
$config = new Conf... | <?php
namespace Chay22\RecSelMeter\Tests;
use Chay22\RecSelMeter\Config;
class ConfigTests extends \PHPUnit_Framework_TestCase
{
public $config;
/**
* Tests against old created + established store
*/
function __construct()
{
$this->config = new Config;
}
public function testNew()
{
$config = new Conf... |
Use colons in routes instead of brackets | module.exports = function(string, data) {
return string.replace(/\:([^\:\/]*)/g, function(original, match) {
var result = data;
var parts = match.split('.');
var i = -1;
while(++i < parts.length - 1) {
if(typeof result[parts[i]] === 'object') {
resu... | module.exports = function(string, data) {
return string.replace(/{([^{}]*)}/g, function(original, match) {
var result = data;
var parts = match.split('.');
var i = -1;
while(++i < parts.length - 1) {
if(typeof result[parts[i]] === 'object') {
result... |
Fix for alert box error |
module.exports = new function() {
var webdriver = require("selenium-webdriver");
webdriver.WebDriver.prototype.waitJqueryReady = function() {
var self = this;
return self.flow_.execute(function() {
self.switchTo().alert().then(
function() {
return true;
},
functio... |
module.exports = new function() {
var webdriver = require("selenium-webdriver");
webdriver.WebDriver.prototype.waitJqueryReady = function() {
var self = this;
return self.flow_.execute(function() {
self.executeScript("return typeof jQuery != String(undefined) ? (!jQuery.active === jQuery.isReady) ... |
Add proxy fix as in lr this will run with reverse proxy | import os, logging
from flask import Flask
from flask.ext.basicauth import BasicAuth
from raven.contrib.flask import Sentry
from lrutils import dateformat
app = Flask(__name__)
app.config.from_object(os.environ.get('SETTINGS'))
from werkzeug.contrib.fixers import ProxyFix
app.wsgi_app = ProxyFix(app.wsgi_app)
app.j... | import os, logging
from flask import Flask
from flask.ext.basicauth import BasicAuth
from raven.contrib.flask import Sentry
from lrutils import dateformat
app = Flask(__name__)
app.config.from_object(os.environ.get('SETTINGS'))
app.jinja_env.filters['dateformat'] = dateformat
if app.config.get('BASIC_AUTH_USERNAME'... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.