text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Add cormapy test suite to e2e test suite | #!/usr/bin/env python
# coding: utf-8
"""Run the end to end tests of the project."""
__author__ = "Martha Brennich"
__license__ = "MIT"
__copyright__ = "2020"
__date__ = "11/07/2020"
import sys
import unittest
import e2etest_freesas, e2etest_guinier_apps, e2etest_bift, e2etest_cormap
def suite():
"""Creates su... | #!/usr/bin/env python
# coding: utf-8
"""Run the end to end tests of the project."""
__author__ = "Martha Brennich"
__license__ = "MIT"
__copyright__ = "2020"
__date__ = "11/07/2020"
import sys
import unittest
import e2etest_freesas, e2etest_guinier_apps, e2etest_bift
def suite():
"""Creates suite for e2e test... |
Remove import of old routes | // We only need to import the modules necessary for initial render
import CoreLayout from '../layouts/CoreLayout/CoreLayout'
import TogglRoute from './Toggl'
/* Note: Instead of using JSX, we recommend using react-router
PlainRoute objects to build route definitions. */
export const createRoutes = (store) => (... | // We only need to import the modules necessary for initial render
import CoreLayout from '../layouts/CoreLayout/CoreLayout'
import Home from './Home'
import CounterRoute from './Counter'
import TogglRoute from './Toggl'
/* Note: Instead of using JSX, we recommend using react-router
PlainRoute objects to build ro... |
TODO: ADD FUNCTIONS AND ARGUMENTS. YOU'LL PROBABLY NEED TO DEBUG | #!/ usr/bin/python
#Black Hat Python SSH with Paramiko pg 26
#TODO: ADD FUNCTIONS AND ARGUMENTS, AND DONT FORGET TO DEBUG.
import threading, paramiko, subprocess
def ssh_command(ip, user, passwd, command):
client = paramiko.SSHClient()
#client.load_host_keys('/home/justin/.ssh/known_hosts')
client.set_missing_ho... | #!/ usr/bin/python
#Black Hat Python
#SSH with Paramiko
#pg 26
import threading, paramiko, subprocess
def ssh_command(ip, user, passwd, command):
client = paramiko.SSHClient()
#client.load_host_keys('/home/justin/.ssh/known_hosts')
client.set_missing_host_key_policy(paramoko.AutoAddPolicy())
client.connect(ip, ... |
Add charset to HTML5 doc (and make more XHTML friendly)
git-svn-id: e52e7dec99011c9686d89c3d3c01e7ff0d333eee@2609 eee81c28-f429-11dd-99c0-75d572ba1ddd | <!DOCTYPE html>
<?php
/*
* fileopen.php
* To be used with ext-server_opensave.js for SVG-edit
*
* Licensed under the MIT License
*
* Copyright(c) 2010 Alexis Deveria
*
*/
// Very minimal PHP file, all we do is Base64 encode the uploaded file and
// return it to the editor
$file = $_FILES['svg_file']['tmp_n... | <!doctype html>
<?php
/*
* fileopen.php
* To be used with ext-server_opensave.js for SVG-edit
*
* Licensed under the MIT License
*
* Copyright(c) 2010 Alexis Deveria
*
*/
// Very minimal PHP file, all we do is Base64 encode the uploaded file and
// return it to the editor
$file = $_FILES['svg_file']['tmp_n... |
Test change for retina branch | package main.powercalc;
public class DataTuple {
private double lat;
private double lon;
private double data;
DataTuple() {
this.lat = 0.0;
this.lon = 0.0;
this.data = 0.0;
}
DataTuple(double lat, double lon, double data) {
this.lat = lat;
this.lon = lon;
this.data = data;
}
DataTuple(DataT... | package main.powercalc;
public class DataTuple {
private double lat;
private double lon;
private double data;
DataTuple() {
this.lat = 0.0;
this.lon = 0.0;
this.data = 0.0;
}
DataTuple(double lat, double lon, double data) {
this.lat = lat;
this.lon = lon;
this.data = data;
}
DataTuple(DataTup... |
Move comments to public javadocs | /*
* Copyright 2015, Yahoo Inc.
* Copyrights licensed under the Apache 2.0 License.
* See the accompanying LICENSE file for terms.
*/
package com.yahoo.squidb.processor.data;
import com.yahoo.aptutils.model.DeclaredTypeName;
/**
* Tuple class to hold logged error info, to be written by the
* {@link com.yahoo.sq... | /*
* Copyright 2015, Yahoo Inc.
* Copyrights licensed under the Apache 2.0 License.
* See the accompanying LICENSE file for terms.
*/
package com.yahoo.squidb.processor.data;
import com.yahoo.aptutils.model.DeclaredTypeName;
/**
* Tuple class to hold logged error info, to be written by the
* {@link com.yahoo.sq... |
Add a harder test example. | import numpy as np
import matplotlib.pyplot as pl
import pygp as pg
import pybo.models as pbm
import pybo.policies as pbp
def run_model(Model, sn, ell, sf, T):
model = Model(0.2)
gp = pg.BasicGP(sn, ell, sf)
policy = pbp.GPUCB(gp, model.bounds)
xmin = model.bounds[0][0]
xmax = model.bounds[0][1]... | import numpy as np
import matplotlib.pyplot as pl
import pygp as pg
import pybo.models as pbm
import pybo.policies as pbp
if __name__ == '__main__':
sn = 0.2
ell = 0.670104947766
sf = 1.25415619045
model = pbm.Sinusoidal(0.2)
gp = pg.BasicGP(sn, ell, sf)
policy = pbp.GPUCB(gp, model.bounds... |
Correct documented event names for VectorSourceEvent | /**
* @module ol/source/VectorEventType
*/
/**
* @enum {string}
*/
export default {
/**
* Triggered when a feature is added to the source.
* @event module:ol/source/Vector.VectorSourceEvent#addfeature
* @api
*/
ADDFEATURE: 'addfeature',
/**
* Triggered when a feature is updated.
* @event m... | /**
* @module ol/source/VectorEventType
*/
/**
* @enum {string}
*/
export default {
/**
* Triggered when a feature is added to the source.
* @event module:ol/source/Vector.VectorSourceEvent#addfeature
* @api
*/
ADDFEATURE: 'addfeature',
/**
* Triggered when a feature is updated.
* @event m... |
Add playlist folder and playlist index in title if there is one | import { getBaseDestination } from '../storage/storage';
const youtubedl = require('youtube-dl');
const path = require('path');
const fs = require('fs');
const { remote } = require('electron');
export var init = function () { };
export var downloadVideo = function (link, onInfo, onError, onEnd) {
let filePath;
... | import { getBaseDestination } from '../storage/storage';
const youtubedl = require('youtube-dl');
const path = require('path');
const fs = require('fs');
const { remote } = require('electron');
export var init = function () { };
export var downloadVideo = function (link, onInfo, onError, onEnd) {
let filePath;
... |
Use global form of 'use strict' in gruntfile template file | 'use strict';
const {join} = require('path');
const config = require('config').grunt;
module.exports = function(grunt) {
grunt.initConfig({
package: grunt.file.readJSON('package.json'),
ports: config.ports,
folders: config.folders,
files: config.files,
deployed: {
... | const {join} = require('path');
const config = require('config').grunt;
module.exports = function(grunt) {
'use strict';
grunt.initConfig({
package: grunt.file.readJSON('package.json'),
ports: config.ports,
folders: config.folders,
files: config.files,
deployed: {
... |
Exclude app dir from package | #!/usr/bin/env python
from __future__ import unicode_literals
from wagtail_mvc import __version__
from setuptools import setup, find_packages
setup(
name='wagtail_mvc',
version=__version__,
description='Allows better separation between '
'models and views in Wagtail CMS',
auth... | #!/usr/bin/env python
from __future__ import unicode_literals
from wagtail_mvc import __version__
from setuptools import setup, find_packages
setup(
name='wagtail_mvc',
version=__version__,
description='Allows better separation between '
'models and views in Wagtail CMS',
auth... |
Add lint to the default task | 'use strict';
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var runSequence = require('run-sequence');
var bs = require('browser-sync').create();
var del = require('del');
gulp.task('lint', function () {
return gulp.src('app/js/**/*.js')
.pipe($.eslint())
.pipe($.eslint.format())
.... | 'use strict';
var gulp = require('gulp');
var $ = require('gulp-load-plugins')();
var runSequence = require('run-sequence');
var bs = require('browser-sync').create();
var del = require('del');
gulp.task('lint', function () {
return gulp.src('app/js/**/*.js')
.pipe($.eslint())
.pipe($.eslint.format())
.... |
Move Flickr over to its newly-secured API domain | import foauth.providers
class Flickr(foauth.providers.OAuth1):
# General info about the provider
provider_url = 'http://www.flickr.com/'
docs_url = 'http://www.flickr.com/services/api/'
category = 'Pictures'
# URLs to interact with the API
request_token_url = 'http://www.flickr.com/services/o... | import foauth.providers
class Flickr(foauth.providers.OAuth1):
# General info about the provider
provider_url = 'http://www.flickr.com/'
docs_url = 'http://www.flickr.com/services/api/'
category = 'Pictures'
# URLs to interact with the API
request_token_url = 'http://www.flickr.com/services/o... |
Call back a simpler Error object if a package was not found on Bower | /**
* @module bowerPackageURL
* @author Matthew Hasbach
* @copyright Matthew Hasbach 2015
* @license MIT
*/
/**
* The bowerPackageURL callback
* @callback bowerPackageURLCallback
* @param {Object} err - An error object if an error occurred
* @param {string} url - The repository URL associated with the provide... | /**
* @module bowerPackageURL
* @author Matthew Hasbach
* @copyright Matthew Hasbach 2015
* @license MIT
*/
/**
* The bowerPackageURL callback
* @callback bowerPackageURLCallback
* @param {Object} err - An error object if an error occurred
* @param {string} url - The repository URL associated with the provide... |
Add format string to debug message. | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import logging
import os
from pelican.readers import BaseReader
logger = logging.getLogger(__name__)
class SlokaReader(BaseReader):
enabled = True
file_extensions = ['json']
extensions = None
def __init__(self, *args, ... | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import logging
import os
from pelican.readers import BaseReader
logger = logging.getLogger(__name__)
class SlokaReader(BaseReader):
enabled = True
file_extensions = ['json']
extensions = None
def __init__(self, *args, ... |
Set a connection timeout for DevTools methods
Close #194 | 'use strict';
const REQUEST_TIMEOUT = 10000;
// callback(err, data)
function externalRequest(transport, options, callback) {
const request = transport.get(options, function (response) {
let data = '';
response.on('data', function (chunk) {
data += chunk;
});
response.on... | 'use strict';
// callback(err, data)
function externalRequest(transport, options, callback) {
const request = transport.get(options, function (response) {
let data = '';
response.on('data', function (chunk) {
data += chunk;
});
response.on('end', function () {
... |
Call celery task directly from management command instead of calling the signal
AA-461 | """
Export course metadata for all courses
"""
from django.core.management.base import BaseCommand
from xmodule.modulestore.django import modulestore
from cms.djangoapps.export_course_metadata.signals import export_course_metadata
from cms.djangoapps.export_course_metadata.tasks import export_course_metadata_task
... | """
Export course metadata for all courses
"""
from django.core.management.base import BaseCommand
from xmodule.modulestore.django import modulestore
from cms.djangoapps.export_course_metadata.signals import export_course_metadata
class Command(BaseCommand):
"""
Export course metadata for all courses
"... |
Fix git locator behavior in worktree environment | <?php
declare(strict_types=1);
namespace GrumPHP\Locator;
use GrumPHP\Util\Filesystem;
class GitRepositoryDirLocator
{
/**
* @var Filesystem
*/
private $filesystem;
public function __construct(Filesystem $filesystem)
{
$this->filesystem = $filesystem;
}
/**
* Resolve... | <?php
declare(strict_types=1);
namespace GrumPHP\Locator;
use GrumPHP\Util\Filesystem;
class GitRepositoryDirLocator
{
/**
* @var Filesystem
*/
private $filesystem;
public function __construct(Filesystem $filesystem)
{
$this->filesystem = $filesystem;
}
/**
* Resolve... |
Change default format to ics instead of ical | from rest_framework import renderers
from icalendar import Calendar, Event
class ICalRenderer(renderers.BaseRenderer):
media_type = 'text/calendar'
format = 'ics'
def render(self, data, media_type=None, renderer_context=None):
cal = Calendar()
cal.add('prodid', 'talks.ox.ac.uk')
c... | from rest_framework import renderers
from icalendar import Calendar, Event
class ICalRenderer(renderers.BaseRenderer):
media_type = 'text/calendar'
format = 'ical'
def render(self, data, media_type=None, renderer_context=None):
cal = Calendar()
cal.add('prodid', 'talks.ox.ac.uk')
... |
Implement localization and fix existing localization to match changes | /* This file is part of MusicalRegions for Bukkit, licensed under the MIT License (MIT).
*
* Copyright (c) JCThePants (www.jcwhatever.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 Softw... | /* This file is part of MusicalRegions for Bukkit, licensed under the MIT License (MIT).
*
* Copyright (c) JCThePants (www.jcwhatever.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 Softw... |
Handle PY3 default data conversion vagaries in unit test | from django.core.urlresolvers import reverse_lazy, reverse
from django import forms
from .models import Author
from popupcrud.views import PopupCrudViewSet
# Create your views here.
class AuthorForm(forms.ModelForm):
sex = forms.ChoiceField(label="Sex", choices=(('M', 'Male'), ('F', 'Female')))
class Meta:
... | from django.core.urlresolvers import reverse_lazy, reverse
from django import forms
from .models import Author
from popupcrud.views import PopupCrudViewSet
# Create your views here.
class AuthorForm(forms.ModelForm):
sex = forms.ChoiceField(label="Sex", choices=(('M', 'Male'), ('F', 'Female')))
class Meta:
... |
Use const in place of var | import test from 'ava'
import gutil from 'gulp-util'
import gulpCssScss from './'
test('converts CSS to Scss', t => {
t.plan(2)
const cssScssStream = gulpCssScss();
const actual = ':root {\n --blue: blue;\n}\n\n.some-class {\n color: var(--blue);\n}\n\n';
const expected = '\n// Converted Variables\n\n$blue... | import test from 'ava'
import gutil from 'gulp-util'
import gulpCssScss from './'
test('converts CSS to Scss', t => {
t.plan(2)
var cssScssStream = gulpCssScss();
var actual = ':root {\n --blue: blue;\n}\n\n.some-class {\n color: var(--blue);\n}\n\n';
var expected = '\n// Converted Variables\n\n$blue: blue... |
Correct the --omit parameter for coverage.py
Despite what some things on the web suggest, you seem to need
to have a wildcard at the end of a path in the --omit list. | #!/bin/bash
find . -name '*.pyc' -delete
coverage erase
OMIT="$(python -c 'import sys; print sys.prefix')/*"
coverage run --omit=$OMIT ./manage.py test \
core \
feedback \
hansard \
helpers \
images \
info \
scorecards \
search ... | #!/bin/bash
find . -name '*.pyc' -delete
coverage erase
OMIT="$(python -c 'import sys; print sys.prefix')"
coverage run --omit=$OMIT ./manage.py test \
core \
feedback \
hansard \
helpers \
images \
info \
scorecards \
search ... |
Remove currently shown card when all results are filtered out. | function addRowListeners(tableIdentifier) {
$(tableIdentifier + ' tr').click(function() {
selectDetailCard(this);
});
}
function selectFirstCard(tableIdentifier) {
if ($(tableIdentifier + ' tr:visible').length) {
selectDetailCard($(tableIdentifier + ' tr:visible').first(), true);
} else {
var type ... | function addRowListeners(tableIdentifier) {
$(tableIdentifier + ' tr').click(function() {
selectDetailCard(this);
});
}
function selectFirstCard(tableIdentifier) {
if ($(tableIdentifier + ' tr:visible').length) {
selectDetailCard($(tableIdentifier + ' tr:visible').first(), true);
}
}
function sele... |
Update server site for osmlive reports | <?php
function startsWith($haystack, $needle)
{
$length = strlen($needle);
return (substr($haystack, 0, $length) === $needle);
}
$c = new Memcached();
$c->addServer("localhost", 11211);
foreach($c->getAllKeys() as $key) {
if(startsWith($key, "qreport_")) {
$time_start = microtime(true);
$query = subs... | <?php
function startsWith($haystack, $needle)
{
$length = strlen($needle);
return (substr($haystack, 0, $length) === $needle);
}
$c = new Memcached();
$c->addServer("localhost", 11211);
foreach($c->getAllKeys() as $key) {
if(startsWith($key, "qreport_")) {
$time_start = microtime(true);
$query = subs... |
Fix tests under Django >= 1.10.3
See "DNS rebinding vulnerability when DEBUG=True"
in Django 1.10.3 release notes:
https://docs.djangoproject.com/en/1.10/releases/1.10.3/ | from os.path import dirname, join
import sys
import django
import django.conf
def pytest_configure():
example_path = join(dirname(dirname(__file__)), 'example')
if example_path not in sys.path:
sys.path.insert(0, example_path)
settings = {
'ALLOWED_HOSTS': ['testserver'],
'DEBUG':... | from os.path import dirname, join
import sys
import django
import django.conf
def pytest_configure():
example_path = join(dirname(dirname(__file__)), 'example')
if example_path not in sys.path:
sys.path.insert(0, example_path)
settings = {
'DEBUG': True,
'MIDDLEWARE_CLASSES': [
... |
Fix element not having an image | const React = require("react");
const ReactDOM = require("react-dom");
const e = React.createElement;
class Component extends React.Component {
render() {
const { enabled, status } = this.props.offlineSupport;
return e("span", null, [
"Offline support:",
e("img", {
key: "image",
... | const React = require("react");
const ReactDOM = require("react-dom");
const e = React.createElement;
class Component extends React.Component {
render() {
const { enabled, status } = this.props.offlineSupport;
return e("span", null, [
"Offline support:",
e("img", {
className: "enabled",
... |
[Statie] Return missing layout to file params | <?php declare(strict_types=1);
namespace Symplify\Statie\Templating;
use Symplify\Statie\Configuration\Configuration;
use Symplify\Statie\Renderable\File\AbstractFile;
abstract class AbstractTemplatingFileDecorator
{
/**
* @var Configuration
*/
protected $configuration;
/**
* @required
... | <?php declare(strict_types=1);
namespace Symplify\Statie\Templating;
use Symplify\Statie\Configuration\Configuration;
use Symplify\Statie\Renderable\File\AbstractFile;
abstract class AbstractTemplatingFileDecorator
{
/**
* @var Configuration
*/
protected $configuration;
/**
* @required
... |
Convert md to rst readme specially for PyPi | from distutils.core import setup
with open('README.md') as readme:
with open('HISTORY.md') as history:
long_description = readme.read() + '\n\n' + history.read()
try:
import pypandoc
long_description = pypandoc.convert(long_description, 'rst', 'markdown')
except(IOError, ImportError):
long_de... | from distutils.core import setup
with open('README.md') as readme:
with open('HISTORY.md') as history:
long_description = readme.read() + '\n\n' + history.read()
try:
import pypandoc
long_description = pypandoc.convert(long_description, 'rst')
except(IOError, ImportError):
long_description = ... |
Put numpy namespace in scipy for backward compatibility... | """\
SciPy --- A scientific computing package for Python
===================================================
You can support the development of SciPy by purchasing documentation
at
http://www.trelgol.com
It is being distributed for a fee for a limited time to try and raise
money for development.
Documentation is ... | """\
SciPy --- A scientific computing package for Python
===================================================
You can support the development of SciPy by purchasing documentation
at
http://www.trelgol.com
It is being distributed for a fee for a limited time to try and raise
money for development.
Documentation is ... |
Tracks: Remove useless field descs, increase rows | # This file is part of Indico.
# Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN).
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (a... | # This file is part of Indico.
# Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN).
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (a... |
Add the validation of setter methods | <?php
/**
* 面向对象-属性设置器
*/
class Person
{
private $age;
/**
* Sets the value of age.
*
* @param mixed $age the age
*
* @return self
*/
public function setAge($age)
{
if ($age > 100) {
throw new Exception('You are too old!');
}
$this->a... | <?php
/**
* 面向对象-属性设置器
*/
class Person
{
private $age;
/**
* Sets the value of age.
*
* @param mixed $age the age
*
* @return self
*/
public function setAge($age)
{
$this->age = $age;
return $this;
}
/**
* Gets the value of age.
*
... |
Make Config GUIs easier to work with | package ljfa.tntutils.gui;
import java.util.ArrayList;
import java.util.List;
import ljfa.tntutils.Config;
import ljfa.tntutils.Reference;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.common.config.ConfigCategory;
import net.minecraftforge.common.config.ConfigElement;
import cpw.mods.fml.clien... | package ljfa.tntutils.gui;
import java.util.ArrayList;
import java.util.List;
import ljfa.tntutils.Config;
import ljfa.tntutils.Reference;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.common.config.ConfigCategory;
import net.minecraftforge.common.config.ConfigElement;
import cpw.mods.fml.clien... |
Break bucle cuando encuentra una coincidencia | <?php
namespace Aluc\Tools;
class Urls {
private static function get_url() {
$base_url = static::get_current_uri();
return $base_url;
// $routes = array();
// $routes = explode('/', $base_url);
}
private static function get_current_uri() {
// Copy & paste, no tocar!... | <?php
namespace Aluc\Tools;
class Urls {
private static function get_url() {
$base_url = static::get_current_uri();
return $base_url;
// $routes = array();
// $routes = explode('/', $base_url);
}
private static function get_current_uri() {
// Copy & paste, no tocar!... |
Add Bridge of flic framework.
It is a sort of plugin register. | "use strict";
var util = require("util"),
express = require("express"),
Bridge = require("flic").bridge,
routes = require("./routes");
var app = express(),
port = routes.config.port,
staticFiles = express.static,
apiUrl = routes.config.apiUrl;
process.on("uncaughtException", function (err) {... | "use strict";
var util = require("util"),
express = require("express"),
seneca = require("seneca"),
routes = require("./routes");
var app = express(),
port = routes.config.port,
staticFiles = express.static,
apiUrl = routes.config.apiUrl;
process.on("uncaughtException", function (err) {
... |
Test line numbers in lexer tests. |
from cStringIO import StringIO
from nose.tools import *
from parse import EeyoreLexer
def _lex( string ):
return list( EeyoreLexer.Lexer( StringIO( string ) ) )
def _assert_token( token, text, tp, line = None, col = None ):
assert_equal( token.getText(), text )
assert_equal( token.getType(), tp )
if... |
from cStringIO import StringIO
from nose.tools import *
from parse import EeyoreLexer
def _lex( string ):
return list( EeyoreLexer.Lexer( StringIO( string ) ) )
def _assert_token( token, ( text, tp ) ):
assert_equal( token.getText(), text )
assert_equal( token.getType(), tp )
def test_hello_world():
... |
Fix undefined name and scope variables | function calcWidth(name) {
return 250 + name.length * 6.305555555555555;
}
WebApp.connectHandlers.use("/package", function(request, response) {
if(request.url.split('/')[1] != ''){
var url = `https://atmospherejs.com/a/packages/findByNames\
?names=${request.url.split('/')[1]}`;
HTTP.get(url, {headers: {'Accept... | var f = "MMM Do YYYY";
function calcWidth(name) {
return 250 + name.length * 6.305555555555555;
}
WebApp.connectHandlers.use("/package", function(request, response) {
if(request.url.split('/')[1] != ''){
var url = `https://atmospherejs.com/a/packages/findByNames\
?names=${request.url.split('/')[1]}`;
HTTP.get... |
Convert number value to string | import React, {PropTypes} from 'react'
import FormBuilderPropTypes from '../FormBuilderPropTypes'
import DefaultTextField from 'component:@sanity/components/textfields/default'
export default class Num extends React.Component {
static displayName = 'Number';
static propTypes = {
field: FormBuilderPropTypes.fi... | import React, {PropTypes} from 'react'
import FormBuilderPropTypes from '../FormBuilderPropTypes'
import DefaultTextField from 'component:@sanity/components/textfields/default'
export default class Num extends React.Component {
static displayName = 'Number';
static propTypes = {
field: FormBuilderPropTypes.fi... |
Trivial: Make vertical white space after license header consistent
Vertical white space between license header and the actual code is not consistent
across files. It looks like majority of the files leaves a single blank line
after license header. So make it consistent except for those exceptional cases
where the actu... | # Copyright 2012 Intel Inc, OpenStack Foundation.
# 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
#
# ... | # Copyright 2012 Intel Inc, OpenStack Foundation.
# 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
#
# ... |
Support emulation of 'option' tag with MenuItem | /*
This file is a part of libertysoil.org website
Copyright (C) 2015 Loki Education (Social Enterprise)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, o... | /*
This file is a part of libertysoil.org website
Copyright (C) 2015 Loki Education (Social Enterprise)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, o... |
Add adapter option number sorting | package com.sometrik.framework;
import java.util.ArrayList;
import java.util.TreeMap;
import android.content.Context;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
public class FWPicker extends Spinner implements NativeMessageHandler {
ArrayAdapter<String> adapter;
ArrayList<I... | package com.sometrik.framework;
import android.content.Context;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
public class FWPicker extends Spinner implements NativeMessageHandler {
ArrayAdapter<String> adapter;
public FWPicker(Context context) {
super(context);
adapter ... |
Fix regex example, the model must not be a unicode string. | # -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import, unicode_literals
from parser_base import RegexParser
import model
class RegexSemantics(object):
def __init__(self):
super(RegexSemantics, self).__init__()
self._count = 0
def START(self, ast):
re... | # -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import, unicode_literals
from parser_base import RegexParser
import model
class RegexSemantics(object):
def __init__(self):
super(RegexSemantics, self).__init__()
self._count = 0
def START(self, ast):
re... |
Add access_token, expires_in to RedirectHandler valid keys | /**
* RedirectHandler will attempt to find
* these keys in the URL. If found,
* this is an indication to Torii that
* the Ember app has loaded inside a popup
* and should postMessage this data to window.opener
*/
var authorizationKeys = [
'code', // oauth2 authorization code flow
'access_token', // us... | /**
* RedirectHandler will attempt to find
* these keys in the URL. If found,
* this is an indication to Torii that
* the Ember app has loaded inside a popup
* and should postMessage this data to window.opener
*/
var authorizationKeys = [
'code'
];
import ParseQueryString from 'torii/lib/parse-query-string';
... |
Optimize loop by caching lowercase version of comparison. | var _ = require('underscore');
/**
* Represents an ActiveDirectory user account.
*
* @private
* @param {Object} [properties] The properties to assign to the newly created item.
* @returns {User}
*/
var User = function(properties) {
for (var property in (properties || {})) {
if (Array.prototype.hasOwnPrope... | var _ = require('underscore');
/**
* Represents an ActiveDirectory user account.
*
* @private
* @param {Object} [properties] The properties to assign to the newly created item.
* @returns {User}
*/
var User = function(properties) {
for (var property in (properties || {})) {
if (Array.prototype.hasOwnPrope... |
Set meta-name for sheet as "styled-jss" | import styled from './styled'
import type {
BaseStylesType,
ComponentStyleType,
StyledType,
StyledElementAttrsType,
StyledElementType,
TagNameOrStyledElementType
} from './types'
const getStyledArgs = (
tagNameOrStyledElement: TagNameOrStyledElementType
): StyledElementAttrsType => {
if (typeof tagNam... | import styled from './styled'
import type {
BaseStylesType,
ComponentStyleType,
StyledType,
StyledElementAttrsType,
StyledElementType,
TagNameOrStyledElementType
} from './types'
const getStyledArgs = (
tagNameOrStyledElement: TagNameOrStyledElementType
): StyledElementAttrsType => {
if (typeof tagNam... |
Update the React setState checks to avoid version-based syntax errors | module.exports = {
"extends": "justinlocsei/configurations/es6",
"ecmaFeatures": {
"jsx": true
},
"env": {
"browser": true
},
"plugins": [
"react"
],
"rules": {
"jsx-quotes": [2, "prefer-double"],
"react/jsx-boolean-value": [2, "always"],
"react/jsx-curly-spacing": [2, "never"],
... | module.exports = {
"extends": "justinlocsei/configurations/es6",
"ecmaFeatures": {
"jsx": true
},
"env": {
"browser": true
},
"plugins": [
"react"
],
"rules": {
"jsx-quotes": [2, "prefer-double"],
"react/jsx-boolean-value": [2, "always"],
"react/jsx-curly-spacing": [2, "never"],
... |
Revert "Fix the location path of OpenIPSL"
This reverts commit 5b3af4a6c1c77c651867ee2b5f5cef5100944ba6. | import sys
from CITests import CITests
# Libs in Application Examples
appExamples = {
#"KundurSMIB":"/ApplicationExamples/KundurSMIB/package.mo",
#"TwoAreas":"/ApplicationExamples/TwoAreas/package.mo",
#"SevenBus":"/ApplicationExamples/SevenBus/package.mo",
#"IEEE9":"/ApplicationExamples/IEEE9/package.mo",
#"IEEE14":"... | import sys
from CITests import CITests
# Libs in Application Examples
appExamples = {
#"KundurSMIB":"/ApplicationExamples/KundurSMIB/package.mo",
#"TwoAreas":"/ApplicationExamples/TwoAreas/package.mo",
#"SevenBus":"/ApplicationExamples/SevenBus/package.mo",
#"IEEE9":"/ApplicationExamples/IEEE9/package.mo",
#"IEEE14":"... |
Add a test for running tasks | import hashlib
from wsstat.main import WebsocketTestingClient, ConnectedWebsocketConnection
class Tests(object):
def setup(self):
self.client = WebsocketTestingClient('wss://testserver/', total_connections=3, max_connecting_sockets=3)
def test_coroutines(self):
print(self.client)
asse... | import hashlib
from wsstat.main import WebsocketTestingClient, ConnectedWebsocketConnection
class Tests(object):
def setup(self):
self.client = WebsocketTestingClient('wss://testserver/', total_connections=1, max_connecting_sockets=1)
def teardown(self):
pass
class TestConnectedWebsocketConn... |
Allow the external webpack bundles to be specified with the global file list. | // Default karma configuration
var _ = require('lodash');
var sharedConfig = require('./shared.config');
var webpackPreprocessorLibrary = 'webpack';
module.exports = function (karma, testFiles, globalFiles, externals) {
globalFiles = arrayify(globalFiles);
testFiles = arrayify(testFiles);
var options = sharedCo... | // Default karma configuration
var _ = require('lodash');
var sharedConfig = require('./shared.config');
var webpackPreprocessorLibrary = 'webpack';
module.exports = function (karma, globalFiles, testFiles) {
globalFiles = arrayify(globalFiles);
testFiles = arrayify(testFiles);
var options = sharedConfig(karma)... |
Create PHP wrapper for assertArrayHasKey | //Re-implement PHPUnit's TestCase
class PHPUnit_Framework_TestCase
{
//Setup a static constructor so that our Test Cases can inherit
static function __construct() {
}
//Override the PHP Twig Extension with the JavaScript implementation
public function setJavaScriptExtension($ext) {
$this->ext = $ext;
}
//Set... | //Re-implement PHPUnit's TestCase
class PHPUnit_Framework_TestCase
{
//Setup a static constructor so that our Test Cases can inherit
static function __construct() {
}
//Override the PHP Twig Extension with the JavaScript implementation
public function setJavaScriptExtension($ext) {
$this->ext = $ext;
}
//Set... |
Check jQuery version only if jQuery is available | import Alert from './alert'
import Button from './button'
import Carousel from './carousel'
import Collapse from './collapse'
import Dropdown from './dropdown'
import Modal from './modal'
import Popover from './popover'
import Scrollspy from './scrollspy'
import Tab from './tab'
import Toast from './toast'
import Toolt... | import $ from 'jquery'
import Alert from './alert'
import Button from './button'
import Carousel from './carousel'
import Collapse from './collapse'
import Dropdown from './dropdown'
import Modal from './modal'
import Popover from './popover'
import Scrollspy from './scrollspy'
import Tab from './tab'
import Toast from... |
Change num of planned tests. | const numberOfPlannedTests = 5
casper.test.begin('test-simple-image-resize', numberOfPlannedTests, (test) => {
casper.start(`http://${testhost}`, function () {
})
casper.then(function () {
const curr = this.getCurrentUrl()
const fixturePath = this.fetchText('#fixture_path')
this.fill('#entryF... | const numberOfPlannedTests = 6
casper.test.begin('test-simple-image-resize', numberOfPlannedTests, (test) => {
casper.start(`http://${testhost}`, function () {
})
casper.then(function () {
const curr = this.getCurrentUrl()
const fixturePath = this.fetchText('#fixture_path')
this.fill('#entryF... |
Add quotes to cron information page, for the example crontab file | <?php
$this->data['header'] = 'Cron information page';
$this->includeAtTemplateBase('includes/header.php');
?>
<div id="content">
<p>Cron is a way to run things regularly on unix systems.</p>
<p>Here is a suggestion for a crontab file:</p>
<pre style="font-size: x-small; color: #444; padding: 1em; border: 1px s... | <?php
$this->data['header'] = 'Cron information page';
$this->includeAtTemplateBase('includes/header.php');
?>
<div id="content">
<p>Cron is a way to run things regularly on unix systems.</p>
<p>Here is a suggestion for a crontab file:</p>
<pre style="font-size: x-small; color: #444; padding: 1em; border: 1px s... |
Add ADD_INSTALLED_APPS to 'enabled' file
Django looks for translation catalogs from directories in
INSTALLED_APPS. To display translations for designate-dashboard,
'designatedashboard' needs to be registered to INSTALLED_APPS.
(cherry picked from commit 1ed7893eb2ae10172a2f664fc05428c28c29099e)
Change-Id: Id5f0f0cb9c... | # Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# 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 applicabl... | # Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# 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 applicabl... |
Remove unecessary initialization of case insensitive instance variable,
already handled in parent class | <?php
namespace Stringizer\Transformers;
use Stringizer\Transformers\TransformerCaseInsensitive;
/**
* StringFirstOccurrence
*
* @link https://github.com/jasonlam604/Stringizer
* @copyright Copyright (c) 2016 Jason Lam
* @license https://github.com/jasonlam604/Stringizer/blob/master/LICENSE (MIT License)
*/
cla... | <?php
namespace Stringizer\Transformers;
use Stringizer\Transformers\TransformerCaseInsensitive;
/**
* StringFirstOccurrence
*
* @link https://github.com/jasonlam604/Stringizer
* @copyright Copyright (c) 2016 Jason Lam
* @license https://github.com/jasonlam604/Stringizer/blob/master/LICENSE (MIT License)
*/
cla... |
Fix a bug, forgot to import logging | from bitHopper.Website import app, flask
import btcnet_info
import bitHopper.Configuration.Workers
import logging
@app.route("/worker", methods=['POST', 'GET'])
def worker():
#Check if this is a form submission
handle_worker_post(flask.request.form)
#Get a list of currently configured workers
... | from bitHopper.Website import app, flask
import btcnet_info
import bitHopper.Configuration.Workers
@app.route("/worker", methods=['POST', 'GET'])
def worker():
#Check if this is a form submission
handle_worker_post(flask.request.form)
#Get a list of currently configured workers
pools_workers ... |
Bump version number for adding !antighost command | #!/usr/bin/env python3
from setuptools import setup
setup(
name='botbot',
version='0.2.5',
description='A meta-bot for Euphoria.',
author='Rishov Sarkar',
url='https://github.com/ArkaneMoose/BotBot',
license='MIT',
packages=['botbot'],
package_dir={'botbot': 'source'},
install_requ... | #!/usr/bin/env python3
from setuptools import setup
setup(
name='botbot',
version='0.2.4',
description='A meta-bot for Euphoria.',
author='Rishov Sarkar',
url='https://github.com/ArkaneMoose/BotBot',
license='MIT',
packages=['botbot'],
package_dir={'botbot': 'source'},
install_requ... |
Add support for array properties rendering | <?php
namespace Nayjest\Grids;
use Exception;
use RuntimeException;
class ObjectDataRow extends DataRow
{
/**
* @param string $fieldName
* @return mixed
* @throws Exception
*/
protected function extractCellValue($fieldName)
{
if (strpos($fieldName, '.') !== false) {
... | <?php
namespace Nayjest\Grids;
use Exception;
use RuntimeException;
class ObjectDataRow extends DataRow
{
/**
* @param string $fieldName
* @return mixed
* @throws Exception
*/
protected function extractCellValue($fieldName)
{
if (strpos($fieldName, '.') !== false) {
... |
[MIG] medical_prescription_us: Upgrade test namespace
* Change openerp namespace to odoo in test imports | # -*- coding: utf-8 -*-
# Copyright 2016 LasLabs Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.tests.common import TransactionCase
from odoo.exceptions import ValidationError
class TestMedicalPrescriptionOrderLine(TransactionCase):
def setUp(self):
super(TestMedical... | # -*- coding: utf-8 -*-
# Copyright 2016 LasLabs Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp.tests.common import TransactionCase
from openerp.exceptions import ValidationError
class TestMedicalPrescriptionOrderLine(TransactionCase):
def setUp(self):
super(TestM... |
Use fixed constant values for cursorMvmt | // package core contains the core data structures and functionality
// leveraged y the other other Goed packages.
package core
import "os"
const Version = "0.0.3"
const ApiVersion = "v1"
var Trace = true
// Ed is thew editor singleton
var Ed Editable
// Colors is the number of colors to use in the terminal
var Col... | // package core contains the core data structures and functionality
// leveraged y the other other Goed packages.
package core
import "os"
const Version = "0.0.3"
const ApiVersion = "v1"
var Trace = false
// Ed is thew editor singleton
var Ed Editable
// Colors is the number of colors to use in the terminal
var Co... |
Fix syntax error in query from request builder | 'use strict'
class API {
static createQueryFromRequest (request) {
delete request.rats
delete request.CMDRs
let limit = parseInt(request.limit) || 25
delete request.limit
let offset = (parseInt(request.page) - 1) * limit || parseInt(request.offset) || 0
delete request.offset
delete requ... | 'use strict'
class API {
static createQueryFromRequest (request) {
delete request.rats
delete delete request.CMDRs
let limit = parseInt(request.limit) || 25
delete request.limit
let offset = (parseInt(request.page) - 1) * limit || parseInt(request.offset) || 0
delete request.offset
dele... |
Add test_a1_to_coord() to assert that only valid board coordinates are in teh _a1_to_coord dictionary | import engine
VALID_COORDS = [(x, y) for x in xrange(97, 105) for y in xrange(49, 57)]
INVALID_COORDS = [
(0, 0), (-1, -1),
(96, 49), (96, 48),
(105, 49), (104, 48),
(96, 56), (97, 57),
(105, 56), (104, 57)
]
VALID_A1 = [chr(x) + chr(y) for x in xrange(97, 105) for y in xrange(49, 57)]
INVALID... | import engine
VALID_COORDS = [(x, y) for x in xrange(97, 105) for y in xrange(49, 57)]
INVALID_COORDS = [
(0, 0), (-1, -1),
(96, 49), (96, 48),
(105, 49), (104, 48),
(96, 56), (97, 57),
(105, 56), (104, 57)
]
VALID_A1 = [chr(x) + chr(y) for x in xrange(97, 105) for y in xrange(49, 57)]
INVALID... |
Enable inline info instead of hiding it after the blue button in the upper right corner | import { configure, addDecorator } from '@storybook/react';
import { setDefaults } from '@storybook/addon-info';
import { setOptions } from '@storybook/addon-options';
import backgroundColor from 'react-storybook-decorator-background';
// addon-info
setDefaults({
header: false,
inline: true,
source: true,
prop... | import { configure, addDecorator } from '@storybook/react';
import { setDefaults } from '@storybook/addon-info';
import { setOptions } from '@storybook/addon-options';
import backgroundColor from 'react-storybook-decorator-background';
// addon-info
setDefaults({
header: false,
inline: false,
source: true,
pro... |
[VarDumper] Allow dd() to be called without arguments | <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Symfony\Component\VarDumper\VarDumper;
if (!function_exists('dump')) {
/*... | <?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Symfony\Component\VarDumper\VarDumper;
if (!function_exists('dump')) {
/*... |
Remove the dependency on math package in ptable.Parity | // Copyright (c) 2015, Peter Mrekaj. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE.txt file.
package ptypes
// parityTable is a parity cache for all 16-bit non-negative integers.
var parityTable = initParityTable()
// initParityTable computes a... | // Copyright (c) 2015, Peter Mrekaj. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE.txt file.
package ptypes
import "math"
// parityTable is a parity cache for all 16-bit non-negative integers.
var parityTable = initParityTable()
// initParityT... |
Add localization key and sound | var AWS = require('aws-sdk');
// Hardcoding keys on production is bad for your general health
AWS.config.update({accessKeyId: 'YOURACCESSKEYHERE', secretAccessKey: 'YOURSECRET', region: 'YOURREGION'});
var sns = new AWS.SNS({apiVersion: '2010-03-31'});
var lambdapayload = JSON.stringify({
message: 'Hello World',
... | var AWS = require('aws-sdk');
// Hardcoding keys on production is bad for your general health
AWS.config.update({accessKeyId: 'YOURACCESSKEYHERE', secretAccessKey: 'YOURSECRET', region: 'YOURREGION'});
var sns = new AWS.SNS({apiVersion: '2010-03-31'});
var lambdapayload = JSON.stringify({
message: 'Hello World',
... |
Fix indentation of the Python grammar | define(function() {
return function(Prism) {
Prism.languages.python= {
'comment': {
pattern: /(^|[^\\])#.*?(\r?\n|$)/g,
lookbehind: true
},
'string' : /("|')(\\?.)*?\1/g,
'keyword' : /\b(as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if... | define(function() {
// Export
return function(Prism) {
Prism.languages.python= {
'comment': {
pattern: /(^|[^\\])#.*?(\r?\n|$)/g,
lookbehind: true
},
'string' : /("|')(\\?.)*?\1/g,
'keyword' : /\b(as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in... |
Enforce the limit to be reset in get query :
```
$query = \Admingenerator\PropelDemoBundle\Model\MovieQuery::create('q')
$paginator = new Pagerfanta(new PagerAdapter($query));
$paginator->setMaxPerPage(3);
$paginator->setCurrentPage($this->getPage(), false, true);
```
```
SELECT propel_movies.ID, propel... | <?php
/*
* This file is part of the Pagerfanta package.
*
* (c) Pablo Díez <pablodip@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Pagerfanta\Adapter;
/**
* PropelAdapter.
*
* @author William DURAND <wi... | <?php
/*
* This file is part of the Pagerfanta package.
*
* (c) Pablo Díez <pablodip@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Pagerfanta\Adapter;
/**
* PropelAdapter.
*
* @author William DURAND <wi... |
Fix tests with Octave 5. | """Example use of jupyter_kernel_test, with tests for IPython."""
import sys
import unittest
import jupyter_kernel_test as jkt
class OctaveKernelTests(jkt.KernelTests):
kernel_name = "octave"
language_name = "octave"
code_hello_world = "disp('hello, world')"
code_display_data = [
{'code': ... | """Example use of jupyter_kernel_test, with tests for IPython."""
import sys
import unittest
import jupyter_kernel_test as jkt
class OctaveKernelTests(jkt.KernelTests):
kernel_name = "octave"
language_name = "octave"
code_hello_world = "disp('hello, world')"
code_display_data = [
{'code': ... |
Remove fs from test dependencies. | 'use strict';
var expect = require('chai').expect,
uncss = require('../lib/uncss');
describe('Using globbing patterns', function () {
it('should find both index pages in the directory and return the used CSS for both of them', function (done) {
this.timeout(25000);
uncss(['tests/glob/**/*.h... | 'use strict';
var expect = require('chai').expect,
fs = require('fs'),
uncss = require('../lib/uncss');
describe('Using globbing patterns', function () {
it('should find both index pages in the directory and return the used CSS for both of them', function (done) {
this.timeout(25000);
... |
Append newline after 'COMMIT' in iptables policies.
Without newline, the iptables-restore command complains. | #!/usr/bin/python2.4
#
# Copyright 2011 Google Inc. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# unless required b... | #!/usr/bin/python2.4
#
# Copyright 2011 Google Inc. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# unless required b... |
Add socketio websocket status check | import AppDispatcher from '../dispatcher/AppDispatcher';
let runtimeAddress = localStorage.getItem('runtimeAddress') || '127.0.0.1';
let socket = io('http://' + runtimeAddress + ':5000/');
socket.on('connect', ()=>console.log('Connected to runtime.'));
socket.on('connect_error', (err)=>console.log(err));
/*
* Hack f... | import AppDispatcher from '../dispatcher/AppDispatcher';
let runtimeAddress = localStorage.getItem('runtimeAddress') || '127.0.0.1';
let socket = io('http://' + runtimeAddress + ':5000/');
socket.on('connect', ()=>console.log('Connected to runtime.'));
socket.on('connect_error', (err)=>console.log(err));
/*
* Hack f... |
Add a test to configure GA event tracking | // Function to load and initiate the Analytics tracker
function gaTracker(id){
$.getScript('//www.google-analytics.com/analytics.js'); // jQuery shortcut
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', id, 'auto');
ga('send', 'pageview');
}
// Function to track a v... | // Function to load and initiate the Analytics tracker
function gaTracker(id){
$.getScript('//www.google-analytics.com/analytics.js'); // jQuery shortcut
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', id, 'auto');
ga('send', 'pageview');
}
// Function to track a v... |
Make toMail method compatible with the base class | <?php
namespace App\Base\Auth;
use Illuminate\Auth\Notifications\ResetPassword as BaseResetPassword;
use Illuminate\Notifications\Messages\MailMessage;
class ResetPassword extends BaseResetPassword
{
/**
* Build the mail representation of the notification.
*
* @param mixed $notifiable
*
... | <?php
namespace App\Base\Auth;
use Illuminate\Auth\Notifications\ResetPassword as BaseResetPassword;
use Illuminate\Notifications\Messages\MailMessage;
class ResetPassword extends BaseResetPassword
{
/**
* Build the mail representation of the notification.
*
* @return \Illuminate\Notifications\Mes... |
Allow a default value to be specified when fetching a field value | # Copyright 2019 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | # Copyright 2019 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://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
Remove unused statement for setting fennecIds in service | <?php
namespace AppBundle\API\Details;
use AppBundle\Entity\FennecUser;
use AppBundle\Service\DBVersion;
use Symfony\Component\HttpFoundation\ParameterBag;
use AppBundle\Entity\Organism;
/**
* Web Service.
* Returns trait information to a list of organism ids
*/
class TraitsOfOrganisms
{
private $manager;
... | <?php
namespace AppBundle\API\Details;
use AppBundle\Entity\FennecUser;
use AppBundle\Service\DBVersion;
use Symfony\Component\HttpFoundation\ParameterBag;
use AppBundle\Entity\Organism;
/**
* Web Service.
* Returns trait information to a list of organism ids
*/
class TraitsOfOrganisms
{
private $manager;
... |
Test sets instead of lists | import os
import sys
import json
def main():
prefix = os.environ['PREFIX']
info_file = os.path.join(prefix, 'conda-meta',
'always_include_files_regex-0.1-0.json')
with open(info_file, 'r') as fh:
info = json.load(fh)
if sys.platform == 'darwin':
assert set... | import os
import sys
import json
def main():
prefix = os.environ['PREFIX']
info_file = os.path.join(prefix, 'conda-meta',
'always_include_files_regex-0.1-0.json')
with open(info_file, 'r') as fh:
info = json.load(fh)
if sys.platform == 'darwin':
assert sor... |
Add 'disabled' parameter to Activity renderer | <?php
namespace Honeybee\Ui\Renderer\Html\Honeybee\Ui\Activity;
use Honeybee\Ui\Renderer\ActivityRenderer;
class HtmlActivityRenderer extends ActivityRenderer
{
protected function getTemplateParameters()
{
$activity = $this->getPayload('subject');
$default_css = [
'activity',
... | <?php
namespace Honeybee\Ui\Renderer\Html\Honeybee\Ui\Activity;
use Honeybee\Ui\Renderer\ActivityRenderer;
class HtmlActivityRenderer extends ActivityRenderer
{
protected function getTemplateParameters()
{
$activity = $this->getPayload('subject');
$default_css = [
'activity',
... |
Use require for this special case | import gutil from 'gulp-util';
import makeWebpackConfig from './makeConfig';
import webpack from 'webpack';
export default function build(callback) {
const config = makeWebpackConfig(false);
webpack(config, (fatalError, stats) => {
const jsonStats = stats.toJson();
// We can save jsonStats to be analyzed ... | import gutil from 'gulp-util';
import makeWebpackConfig from './makeConfig';
import webpack from 'webpack';
export default function build(callback) {
const config = makeWebpackConfig(false);
webpack(config, (fatalError, stats) => {
const jsonStats = stats.toJson();
// We can save jsonStats to be analyzed ... |
Add count param to mostRecent() | <?php
namespace ATPCms\Model;
class Category extends \ATP\ActiveRecord
{
protected function createDefinition()
{
$this->hasData('Name', 'Url', 'IsViewable', 'ShowPages', 'ShowInHeader', 'Text')
->hasStaticBlocks()
->hasPages()
->isIdentifiedBy('Url')
->tableNamespace("cms")
->isOrdered... | <?php
namespace ATPCms\Model;
class Category extends \ATP\ActiveRecord
{
protected function createDefinition()
{
$this->hasData('Name', 'Url', 'IsViewable', 'ShowPages', 'ShowInHeader', 'Text')
->hasStaticBlocks()
->hasPages()
->isIdentifiedBy('Url')
->tableNamespace("cms")
->isOrdered... |
Add support for secure connection | package irc
import "net"
import "fmt"
import "bufio"
import "crypto/tls"
type Client struct {
socket net.Conn
Host string
Port int
Nickname string
Ident string
Realname string
Secure bool
Handler EventHandler
}
func (c *Client) Write(s string) error {
_, err := c.socket.Write([]byte(s + "\r\n... | package irc
import "net"
import "fmt"
import "bufio"
type Client struct {
socket net.Conn
Host string
Port int
Nickname string
Ident string
Realname string
Handler EventHandler
}
func (c *Client) Write(s string) error {
_, err := c.socket.Write([]byte(s + "\r\n"))
return err
}
func (c *Client... |
Add configure flags to for 32-bit build on 64-bit Mac OS X machine | 'use strict';
var bin = require('./');
var BinBuild = require('bin-build');
var logSymbols = require('log-symbols');
var path = require('path');
/**
* Install binary and check whether it works.
* If the test fails, try to build it.
*/
var args = [
'-copy', 'none',
'-optimize',
'-outfile', path.join(__dirname, ... | 'use strict';
var bin = require('./');
var BinBuild = require('bin-build');
var logSymbols = require('log-symbols');
var path = require('path');
/**
* Install binary and check whether it works.
* If the test fails, try to build it.
*/
var args = [
'-copy', 'none',
'-optimize',
'-outfile', path.join(__dirname, ... |
Watch OpenGL Shading Language files as well | 'use strict';
var utils = require('./_utils'),
eslint = require('./eslint'),
build = require('./build'),
chokidar = require('chokidar');
module.exports = function(options) {
options = utils.extend({
// chokidar events we are going to watch
// generally you should not touch them
watchEvents... | 'use strict';
var utils = require('./_utils'),
eslint = require('./eslint'),
build = require('./build'),
chokidar = require('chokidar');
module.exports = function(options) {
options = utils.extend({
// chokidar events we are going to watch
// generally you should not touch them
watchEvents... |
Delete emails before deleting users
--HG--
branch : production | #!/usr/bin/python
import sys
import os
prefix = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, prefix)
# Workaround current bug in docutils:
# http://permalink.gmane.org/gmane.text.docutils.devel/6324
import docutils.utils
import config
import store
CONFIG_FILE = os.environ.get("PYPI... | #!/usr/bin/python
import sys
import os
prefix = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, prefix)
# Workaround current bug in docutils:
# http://permalink.gmane.org/gmane.text.docutils.devel/6324
import docutils.utils
import config
import store
CONFIG_FILE = os.environ.get("PYPI... |
Normalize fn name for change objects | import {curry, values} from 'ladda-fp';
import {createCache} from './cache';
import {decorateCreate} from './operations/create';
import {decorateRead} from './operations/read';
import {decorateUpdate} from './operations/update';
import {decorateDelete} from './operations/delete';
import {decorateNoOperation} from './op... | import {curry, values} from 'ladda-fp';
import {createCache} from './cache';
import {decorateCreate} from './operations/create';
import {decorateRead} from './operations/read';
import {decorateUpdate} from './operations/update';
import {decorateDelete} from './operations/delete';
import {decorateNoOperation} from './op... |
Add error log for execCheck | /*
* Skybot, a multipurpose discord bot
* Copyright (C) 2017 - 2019 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either... | /*
* Skybot, a multipurpose discord bot
* Copyright (C) 2017 - 2019 Duncan "duncte123" Sterken & Ramid "ramidzkh" Khan
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either... |
Send proper 404 code: fix | <?php
/**
* SpinDash — A web development framework
* © 2007–2015 Ilya I. Averkov
*
* Contributors:
* Irfan Mahfudz Guntur <ayes@bsmsite.com>
* Evgeny Bulgakov <evgeny@webline-masters.ru>
*/
namespace SpinDash\Http;
final class Response
{
private $code = 200;
private $body = '';
public function setBody($data) {
... | <?php
/**
* SpinDash — A web development framework
* © 2007–2015 Ilya I. Averkov
*
* Contributors:
* Irfan Mahfudz Guntur <ayes@bsmsite.com>
* Evgeny Bulgakov <evgeny@webline-masters.ru>
*/
namespace SpinDash\Http;
final class Response
{
private $status_code = 200;
private $body = '';
public function setBody($da... |
Fix allowable domain otherwise filtered | from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.selector import Selector
from .. import items
class DatasetSpider(CrawlSpider):
name = 'dataset'
allowed_domains = ['data.gc.ca']
start_urls = ['http://data.gc.ca/data/en/datas... | from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.selector import Selector
from .. import items
class DatasetSpider(CrawlSpider):
name = 'dataset'
allowed_domains = ['data.gc.ca/data/en']
start_urls = ['http://data.gc.ca/data/... |
Update code to accomodate new blog index page | /*!
* Start Bootstrap - Agnecy Bootstrap Theme (http://startbootstrap.com)
* Code licensed under the Apache License v2.0.
* For details, see http://www.apache.org/licenses/LICENSE-2.0.
*/
// Highlight the top nav as scrolling occurs
$('body').scrollspy({
target: '.navbar-fixed-top'
})
// Closes the Responsive... | /*!
* Start Bootstrap - Agnecy Bootstrap Theme (http://startbootstrap.com)
* Code licensed under the Apache License v2.0.
* For details, see http://www.apache.org/licenses/LICENSE-2.0.
*/
// Highlight the top nav as scrolling occurs
$('body').scrollspy({
target: '.navbar-fixed-top'
})
// Closes the Responsive... |
Fix tests to use new key structure | from roglick.engine.ecs import Entity,EntityManager
from roglick.components import SkillComponent,SkillSubComponent
from roglick.systems import SkillSystem
from roglick.engine import event
from roglick.events import SkillCheckEvent
def test_skill_check():
wins = 0
iters = 1000
em = EntityManager()
em... | from roglick.engine.ecs import Entity,EntityManager
from roglick.components import SkillComponent,SkillSubComponent
from roglick.systems import SkillSystem
from roglick.engine import event
from roglick.events import SkillCheckEvent
def test_skill_check():
wins = 0
iters = 1000
em = EntityManager()
em... |
Add randomized option for example | require('coffee-script/register');
var path = require('path');
var Jasmine = require('jasmine');
var SpecReporter = require('../src/jasmine-spec-reporter.js');
var noop = function () {};
var jrunner = new Jasmine();
jrunner.configureDefaultReporter({print: noop});
jasmine.getEnv().addReporter(new SpecReporter({
disp... | require('coffee-script/register');
var path = require('path');
var Jasmine = require('jasmine');
var SpecReporter = require('../src/jasmine-spec-reporter.js');
var noop = function () {};
var jrunner = new Jasmine();
jrunner.configureDefaultReporter({print: noop});
jasmine.getEnv().addReporter(new SpecReporter({
disp... |
Add test for the transpose function. | #!/usr/bin/env python3
from libpals.util import (
xor_find_singlechar_key,
hamming_distance,
fixed_xor,
transpose
)
def test_xor_find_singlechar_key():
input = '1b37373331363f78151b7f2b783431333d78397828372d363c78373e783a393b3736'
ciphertext = bytes.fromhex(input)
result = xor_find_singlec... | #!/usr/bin/env python3
from libpals.util import (
xor_find_singlechar_key,
hamming_distance,
fixed_xor
)
def test_xor_find_singlechar_key():
input = '1b37373331363f78151b7f2b783431333d78397828372d363c78373e783a393b3736'
ciphertext = bytes.fromhex(input)
result = xor_find_singlechar_key(ciphert... |
Fix tests on Python2.7 xmlrpclib.Transport.parse_response calls 'getheader' on its response input | """Utils for Zinnia's tests"""
import StringIO
from xmlrpclib import Transport
from django.test.client import Client
class TestTransport(Transport):
"""Handles connections to XML-RPC server
through Django test client."""
def __init__(self, *args, **kwargs):
Transport.__init__(self, *args, **kwar... | """Utils for Zinnia's tests"""
import cStringIO
from xmlrpclib import Transport
from django.test.client import Client
class TestTransport(Transport):
"""Handles connections to XML-RPC server
through Django test client."""
def __init__(self, *args, **kwargs):
Transport.__init__(self, *args, **kwa... |
Use standard pattern for utility class | package com.getbase.android.autoprovider;
import com.google.common.collect.ImmutableBiMap;
import org.chalup.thneed.ModelGraph;
import org.chalup.thneed.ModelVisitor;
import org.chalup.thneed.models.DatabaseModel;
import org.chalup.thneed.models.PojoModel;
public final class Utils {
private Utils() {
}
public... | package com.getbase.android.autoprovider;
import com.google.common.collect.ImmutableBiMap;
import org.chalup.thneed.ModelGraph;
import org.chalup.thneed.ModelVisitor;
import org.chalup.thneed.models.DatabaseModel;
import org.chalup.thneed.models.PojoModel;
public class Utils {
public static <TModel extends Databas... |
Fix IE8 bug with email repeat | /* global $ */
'use strict'
/**
* Email repeat
*/
function EmailRepeat (element, config) {
var options = {}
$.extend(options, config)
// Private variables
var hintWrapper
var hint
/**
* Set everything up
*/
function create () {
// Bail out if we don't have the proper element to act upon
... | /* global $ */
'use strict'
/**
* Email repeat
*/
function EmailRepeat (element, config) {
var options = {}
$.extend(options, config)
// Private variables
var hintWrapper
var hint
/**
* Set everything up
*/
function create () {
// Bail out if we don't have the proper element to act upon
... |
Update develop version to 1.7-dev since 1.6 is in production | __version_info__ = (1, 7, 0, 'dev')
# Dot-connect all but the last. Last is dash-connected if not None.
__version__ = '.'.join([str(i) for i in __version_info__[:-1]])
if __version_info__[-1] is not None:
__version__ += ('-%s' % (__version_info__[-1],))
# context processor to add version to the template environ... | __version_info__ = (1, 6, 1, None)
# Dot-connect all but the last. Last is dash-connected if not None.
__version__ = '.'.join([str(i) for i in __version_info__[:-1]])
if __version_info__[-1] is not None:
__version__ += ('-%s' % (__version_info__[-1],))
# context processor to add version to the template environm... |
Add PHP's open and closing tags | <?php
function export_posts_as_csv() {
$args = array(
'posts_per_page' => -1,
'post_type' => 'pages',
'post_status' => array( 'publish', 'pending' ),
'orderby' => 'title',
'order' => 'ASC'
);
query_posts( $args );
header( 'Co... | function export_posts_as_csv() {
$args = array(
'posts_per_page' => -1,
'post_type' => 'pages',
'post_status' => array( 'publish', 'pending' ),
'orderby' => 'title',
'order' => 'ASC'
);
query_posts( $args );
header( 'Content-T... |
Fix sending a null game object in the base case | var models = require('../models');
var GameController = require("./GameController");
var playerQueue = [];
exports.startGame = function(req, res) {
var player1 = req.body.username;
var game = GameController.findGame(player1).then(function(game) {
// player has ongoing game
if (game != null) {
res.... | var models = require('../models');
var GameController = require("./GameController");
var playerQueue = [];
exports.startGame = function(req, res) {
var player1 = req.body.username;
var game = GameController.findGame(player1).then(function(game) {
// player has ongoing game
if (game != null) {
res.... |
Set this.music to empty object | /*
* mainmenu.js
* Handles main menu
*/
YINS.MainMenu = function(game) {
this.music = {};
};
YINS.MainMenu.prototype = {
create: function() {
/* Our assets are preloaded, so here we just kick things off
by playing some music */
this.music = YINS.game.add.audio('menuMusic');
this.music.loopFull(1);
... | /*
* mainmenu.js
* Handles main menu
*/
YINS.MainMenu = function(game) {
this.music;
};
YINS.MainMenu.prototype = {
create: function() {
/* Our assets are preloaded, so here we just kick things off
by playing some music */
this.music = YINS.game.add.audio('menuMusic');
this.music.loopFull(1);
th... |
Rename the login arguments to correspong ProcessWire api. | <?php
namespace ProcessWire\GraphQL\Field\Auth;
use Youshido\GraphQL\Field\AbstractField;
use Youshido\GraphQL\Config\Field\FieldConfig;
use Youshido\GraphQL\Type\Scalar\StringType;
use Youshido\GraphQL\Type\NonNullType;
use Youshido\GraphQL\Execution\ResolveInfo;
use ProcessWire\GraphQL\Type\Object\AuthResponseType;... | <?php
namespace ProcessWire\GraphQL\Field\Auth;
use Youshido\GraphQL\Field\AbstractField;
use Youshido\GraphQL\Config\Field\FieldConfig;
use Youshido\GraphQL\Type\Scalar\StringType;
use Youshido\GraphQL\Type\NonNullType;
use Youshido\GraphQL\Execution\ResolveInfo;
use ProcessWire\GraphQL\Type\Object\AuthResponseType;... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.