text stringlengths 16 4.96k | positive stringlengths 321 2.24k | negative stringlengths 310 2.21k |
|---|---|---|
Add a bug link field | from django.db import models
# Create your models here.
class Project(models.Model):
name = models.CharField(max_length=200)
language = models.CharField(max_length=200)
icon_url = models.URLField(max_length=200)
class Bug(models.Model):
project = models.ForeignKey(Project)
title = models.CharField... | from django.db import models
# Create your models here.
class Project(models.Model):
name = models.CharField(max_length=200)
language = models.CharField(max_length=200)
icon_url = models.URLField(max_length=200)
class Bug(models.Model):
project = models.ForeignKey(Project)
title = models.CharField... |
Add totalCount on contact.
Remove excess new line. | <?php
namespace Yajra\Datatables\Contracts;
interface DataTableEngineContract
{
/**
* Get results
*
* @return mixed
*/
public function results();
/**
* Count results
*
* @return integer
*/
public function count();
/**
* Count total items.
*
... | <?php
namespace Yajra\Datatables\Contracts;
interface DataTableEngineContract
{
/**
* Get results
*
* @return mixed
*/
public function results();
/**
* Count results
*
* @return integer
*/
public function count();
/**
* Set auto filter off and run you... |
Remove performance link from features nav
The features nav is supposed to navigate your between pages in the app.
It’s very unexpected to have it open an external link.
Performance isn’t strictly a part of Support, but it’s worked having it
there for long enough that it’s probably not a bother. | def features_nav():
return [
{
"name": "Features",
"link": "main.features",
},
{
"name": "Roadmap",
"link": "main.roadmap",
},
{
"name": "Security",
"link": "main.security",
},
{
... | def features_nav():
return [
{
"name": "Features",
"link": "main.features",
},
{
"name": "Roadmap",
"link": "main.roadmap",
},
{
"name": "Security",
"link": "main.security",
},
{
... |
Fix bug with email attachments | <?php
namespace Ice\MailerBundle\PreCompiler;
use Ice\MailerBundle\Attachment\Attachment;
use Ice\MailerBundle\Attachment\AttachmentException;
use Ice\MailerBundle\Attachment\AttachmentFactory;
use Ice\MailerBundle\Attachment\AttachmentKeyCDN;
use Ice\MailerBundle\Event\PreCompileEvent;
use Doctrine\Common\Collection... | <?php
namespace Ice\MailerBundle\PreCompiler;
use Ice\MailerBundle\Attachment\Attachment;
use Ice\MailerBundle\Attachment\AttachmentException;
use Ice\MailerBundle\Attachment\AttachmentFactory;
use Ice\MailerBundle\Attachment\AttachmentKeyCDN;
use Ice\MailerBundle\Event\PreCompileEvent;
use Doctrine\Common\Collection... |
Fix after build script for other platforms | const { resolve, extname } = require('path')
const { copyFileSync, readdirSync } = require('fs')
const NATIVE_ADDON_RELEASE_PATH = resolve(__dirname, '..', 'bindings', 'build', 'Release')
const BUNDLE_PATH = resolve(__dirname, '..', 'dist', 'bundled')
const actions = {
win32: windows
}
function windows () {
cons... | const { resolve, extname } = require('path')
const { copyFileSync, readdirSync } = require('fs')
const NATIVE_ADDON_RELEASE_PATH = resolve(__dirname, '..', 'bindings', 'build', 'Release')
const BUNDLE_PATH = resolve(__dirname, '..', 'dist', 'bundled')
const actions = {
win32: windows
}
function windows () {
cons... |
Add hapi extension to redirect route.
New behavior looks at query string for keyword 'hapi_method'. The value will override the current route-method.
This is currently used to map http-POST requests to PUT-defined routes.
Ideally, a form-value would be used to do the same thing, but there does not appear to be a way to... | import Hapi from 'hapi'
import Path from 'path'
import controllers from './controllers/index'
import _ from './extensions'
import Lazy from 'lazy.js'
spawnServer('App', 3000, controllers, {
engines: {
hbs: require('handlebars')
},
path: Path.join(__dirname, './views'),
layoutPath: Path.join(__... | import Hapi from 'hapi'
import Path from 'path'
import controllers from './controllers/index'
import _ from './extensions'
import Lazy from 'lazy.js'
spawnServer('App', 3000, controllers, {
engines: {
hbs: require('handlebars')
},
path: Path.join(__dirname, './views'),
layoutPath: Path.join(__... |
Use an iterator to get pages | from itertools import count
from demands import HTTPServiceClient
from yoconfig import get_config
class CloudFlareService(HTTPServiceClient):
def __init__(self, **kwargs):
config = get_config('cloudflare')
headers = {
'Content-Type': 'application/json',
'X-Auth-Key': confi... | from itertools import count
from demands import HTTPServiceClient
from yoconfig import get_config
class CloudFlareService(HTTPServiceClient):
def __init__(self, **kwargs):
config = get_config('cloudflare')
headers = {
'Content-Type': 'application/json',
'X-Auth-Key': confi... |
CLEAN simplify example: no need to force Ansi.ON | /*
Copyright 2017 Remko Popma
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wri... | /*
Copyright 2017 Remko Popma
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wri... |
Add G Suite verification tag | // @flow
import React from 'react'
import Helmet from 'react-helmet'
import PropTypes from 'prop-types'
import Background from '../Background'
import Navbar from '../Navbar'
import { Container } from '../Grid'
import './normalize.css'
import './fonts.css'
import './skeleton.css'
import styles from './styles.module.cs... | // @flow
import React from 'react'
import Helmet from 'react-helmet'
import PropTypes from 'prop-types'
import Background from '../Background'
import Navbar from '../Navbar'
import { Container, Row, Column } from '../Grid'
import './normalize.css'
import './fonts.css'
import './skeleton.css'
import styles from './sty... |
Update index @ fix livereload port server :+1: | <!DOCTYPE html>
<html ng-app="applications" ng-controller="AppController">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<link rel="stylesheet" href="{!! asset('css/vendor.css') !!}">
<link rel="stylesheet" href="{!! asset('css/app.css')... | <!DOCTYPE html>
<html ng-app="applications" ng-controller="AppController">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<link rel="stylesheet" href="{!! asset('css/vendor.css') !!}">
<link rel="stylesheet" href="{!! asset('css/app.css')... |
Use http agent for kubecross version retrieval
This agent allows retries and should be more future proof.
Signed-off-by: Sascha Grunert <70ab469ddb2ac3e35f32ed7c2fd1cca514b2e879@redhat.com> | /*
Copyright 2021 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... | /*
Copyright 2021 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
Remove selector method because it's not needed. | export default {
/* jshint expr: true */
create (opts) {
var elem = document.createElement(opts.extends || opts.id);
opts.extends && elem.setAttribute('is', opts.id);
return elem;
},
filterDefinitions (elem, defs) {
var attrs = elem.attributes;
var definitions = [];
var isAttr = attrs.is... | export default {
/* jshint expr: true */
create (opts) {
var elem = document.createElement(opts.extends || opts.id);
opts.extends && elem.setAttribute('is', opts.id);
return elem;
},
filterDefinitions (elem, defs) {
var attrs = elem.attributes;
var definitions = [];
var isAttr = attrs.is... |
Fix name (copy paste fail...) | import json
from ppp_nlp_classical import Triple, TriplesBucket, computeTree, simplify, buildBucket, DependenciesTree, tripleProduce1, tripleProduce2, tripleProduce3, buildTree
from ppp_datamodel import Triple, Resource, Missing
import data
from unittest import TestCase
class StandardTripleTests(TestCase):
def ... | import json
from ppp_nlp_classical import Triple, TriplesBucket, computeTree, simplify, buildBucket, DependenciesTree, tripleProduce1, tripleProduce2, tripleProduce3, buildTree
from ppp_datamodel import Triple, Resource, Missing
import data
from unittest import TestCase
class StandardTripleTests(TestCase):
def ... |
Ch03: Add options to Startup model fields. [skip ci]
Field options allow us to easily customize behavior of a field.
Global Field Options:
https://docs.djangoproject.com/en/1.8/ref/models/fields/#db-index
https://docs.djangoproject.com/en/1.8/ref/models/fields/#help-text
https://docs.djangoproject.com/en... | from django.db import models
# Model Field Reference
# https://docs.djangoproject.com/en/1.8/ref/models/fields/
class Tag(models.Model):
name = models.CharField(
max_length=31, unique=True)
slug = models.SlugField(
max_length=31,
unique=True,
help_text='A label for URL config... | from django.db import models
# Model Field Reference
# https://docs.djangoproject.com/en/1.8/ref/models/fields/
class Tag(models.Model):
name = models.CharField(
max_length=31, unique=True)
slug = models.SlugField(
max_length=31,
unique=True,
help_text='A label for URL config... |
Read query prarms for lat, long and date. | var express = require('express');
var xml = require('xml');
var app = express();
var suncalc = require('suncalc');
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/sunrisedb');
var db = mongoose.connection;
db.on('error', console.error.bind(console, 'connection error...'));
db.once('open', fun... | var express = require('express');
var xml = require('xml');
var app = express();
var suncalc = require('suncalc');
var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/sunrisedb');
var db = mongoose.connection;
db.on('error', console.error.bind(console, 'connection error...'));
db.once('open', fun... |
Remove unnecessary call to collapse the accordion
bootstrap does that for us | // Javascript specific to guide admin
$(function() {
var sortable_opts = {
axis: "y",
handle: "a.accordion-toggle",
stop: function(event, ui) {
$('.part').each(function (i, elem) {
$(elem).find('input.order').val(i + 1);
ui.item.find("a.accordion-toggle").addClass("highlight");
... | // Javascript specific to guide admin
$(function() {
// collapse the parts using the bootstrap accordion
$(".collapse").collapse();
var sortable_opts = {
axis: "y",
handle: "a.accordion-toggle",
stop: function(event, ui) {
$('.part').each(function (i, elem) {
$(elem).find('input.order')... |
Move check to constructor for faster failure | package org.ambraproject.rhino.view.asset;
import com.google.common.collect.ImmutableList;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonSerializationContext;
import org.ambraproject.models.ArticleAsset;
import org.ambraproject.rhino.identity.AssetIdentity;
import or... | package org.ambraproject.rhino.view.asset;
import com.google.common.collect.ImmutableList;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonSerializationContext;
import org.ambraproject.models.ArticleAsset;
import org.ambraproject.rhino.identity.AssetIdentity;
import or... |
Fix finder does not exist directory | <?php
return [
/*
|--------------------------------------------------------------------------
| Autoload Files.
|--------------------------------------------------------------------------
|
| You may add files which you want pine annotations to autoload. Annotations
| in these files will b... | <?php
return [
/*
|--------------------------------------------------------------------------
| Autoload Files.
|--------------------------------------------------------------------------
|
| You may add files which you want pine annotations to autoload. Annotations
| in these files will b... |
Exclude cordova files from karma | module.exports = function(config){
config.set({
basePath : './',
files : [
'app/bower_components/angular/angular.js',
'app/bower_components/angular-route/angular-route.js',
'app/bower_components/angular-mocks/angular-mocks.js',
'app/components/version/*.js',
'app/view*/**/*.js'... | module.exports = function(config){
config.set({
basePath : './',
files : [
'app/bower_components/angular/angular.js',
'app/bower_components/angular-route/angular-route.js',
'app/bower_components/angular-mocks/angular-mocks.js',
'app/components/**/*.js',
'app/view*/**/*.js'
... |
Fix error, made command assume extras are params for now | #!/usr/bin/env python
import json
import os
import sys
def raw_aliases():
'''
Reads in the aliases file as a Python object
'''
with open(os.environ['AKA_ALIASES'], 'r') as f:
return json.loads(f.read())
def make_lookup(alias_object, current_path=[], current_command=[], result={}):
'''
... | #!/usr/bin/env python
import json
import os
import sys
def raw_aliases():
'''
Reads in the aliases file as a Python object
'''
with open(os.environ['AKA_ALIASES'], 'r') as f:
return json.loads(f.read())
def make_lookup(alias_object, current_path=[], current_command=[], result={}):
'''
... |
Use receiver decorator instead of `signal.connect`
I've contributed to this decorator upstream! It should be used. :-) | from autoslug.fields import AutoSlugField
from django.contrib.auth.models import User
from django.db import models
from django.db.models.signals import post_save
from django.dispatch.dispatcher import receiver
class Company(models.Model):
""" Organization. """
slug = AutoSlugField(populate_from='name', unique... | from autoslug.fields import AutoSlugField
from django.contrib.auth.models import User
from django.db import models
from django.db.models.signals import post_save
class Company(models.Model):
""" Organization. """
slug = AutoSlugField(populate_from='name', unique=True)
name = models.CharField(max_length=10... |
FIX problem after reorganizing test. | # -*- coding: UTF-8 -*-
"""
https://github.com/behave/behave/issues/619
When trying to do something like::
foo = getattr(context, '_foo', 'bar')
Behave fails with::
File "[...]/behave/runner.py", line 208, in __getattr__
return self.__dict__[attr]
KeyError: '_foo'
I think this is because the __ge... | # -*- coding: UTF-8 -*-
"""
https://github.com/behave/behave/issues/619
When trying to do something like::
foo = getattr(context, '_foo', 'bar')
Behave fails with::
File "[...]/behave/runner.py", line 208, in __getattr__
return self.__dict__[attr]
KeyError: '_foo'
I think this is because the __ge... |
Make 'example pipelines' link the same blue link | import React from 'react';
import PipelineIcon from '../icons/Pipeline';
class Welcome extends React.Component {
static propTypes = {
organization: React.PropTypes.string.isRequired
}
render() {
return (
<div className="center p4">
<PipelineIcon />
<h1 className="h3 m0 mt2 mb4">Cr... | import React from 'react';
import PipelineIcon from '../icons/Pipeline';
class Welcome extends React.Component {
static propTypes = {
organization: React.PropTypes.string.isRequired
}
render() {
return (
<div className="center p4">
<PipelineIcon />
<h1 className="h3 m0 mt2 mb4">Cr... |
Make starship remember its coordinates | var hammer = require ('hammerjs')
, canvas = document.getElementById('canvas')
, ctx = canvas.getContext('2d')
, img = new Image() // Create new img element
, i = 0
, star = new Starship(0, 100)
, EventEmitter = require('events').EventEmitter
, gameLoop = require('./gameloop')
, currentTime = 0
, de... | var hammer = require ('hammerjs')
, canvas = document.getElementById('canvas')
, ctx = canvas.getContext('2d')
, img = new Image() // Create new img element
, i = 0
, starship = function() {}
, star = new starship()
, EventEmitter = require('events').EventEmitter
, gameLoop = require('./gameloop')
,... |
Add javadoc description to resolve @doubt comment
git-svn-id: 1a1fa68050bcaed5349a5b70a2a7ea3fbc73e3e8@949492 13f79535-47bb-0310-9956-ffa450edef68 | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may ... |
Add user models on Published class models | #!/usr/bin/env python
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
from datetime import datetime
class PublishedMnager(models.Manager):
def all_published(self):
return super(PublisherMnager, self).get_query_set().filter(... | #!/usr/bin/env python
from django.db import models
from django.utils.translation import ugettext_lazy as _
from datetime import datetime
class PublishedMnager(models.Manager):
def all_published(self):
return super(PublisherMnager, self).get_query_set().filter(
date_available__lte=datetim... |
Clean up the error imports
The new errors that had been added for _intersphinx.py had left
the sphobjinv.error import line split. No need, when it all fits on
one line. | r"""``sphobjinv`` *package definition module*.
``sphobjinv`` is a toolkit for manipulation and inspection of
Sphinx |objects.inv| files.
**Author**
Brian Skinn (bskinn@alum.mit.edu)
**File Created**
17 May 2016
**Copyright**
\(c) Brian Skinn 2016-2022
**Source Repository**
https://github.com/bskinn... | r"""``sphobjinv`` *package definition module*.
``sphobjinv`` is a toolkit for manipulation and inspection of
Sphinx |objects.inv| files.
**Author**
Brian Skinn (bskinn@alum.mit.edu)
**File Created**
17 May 2016
**Copyright**
\(c) Brian Skinn 2016-2022
**Source Repository**
https://github.com/bskinn... |
Update to new codegangsta/cli api | package main
import (
"fmt"
"os"
"github.com/Bowbaq/scala-imports"
"github.com/codegangsta/cli"
"github.com/spf13/viper"
)
var (
Version string
config scalaimports.Config
)
func init() {
viper.SetConfigName(".fix-imports")
viper.AddConfigPath(".")
viper.AddConfigPath("$HOME")
if err := viper.ReadInConfi... | package main
import (
"fmt"
"os"
"github.com/Bowbaq/scala-imports"
"github.com/codegangsta/cli"
"github.com/spf13/viper"
)
var (
Version string
config scalaimports.Config
)
func init() {
viper.SetConfigName(".fix-imports")
viper.AddConfigPath(".")
viper.AddConfigPath("$HOME")
if err := viper.ReadInConfi... |
Define valor padrão como desabilitado no plugin ProfileCompletion | <?php
namespace ProfileCompletion;
use MapasCulturais\App;
class Module extends \MapasCulturais\Module
{
public function __construct(array $config = [])
{
$app = App::i();
$config += ['enable' => false];
parent::__construct($config);
}
function _init()
{
/** @va... | <?php
namespace ProfileCompletion;
use MapasCulturais\App;
class Module extends \MapasCulturais\Module
{
public function __construct(array $config = [])
{
$app = App::i();
$config += [];
parent::__construct($config);
}
function _init()
{
/** @var MapasCulturais\... |
Fix possible crash with <4.0 devices when opening More.
OTRS:
https://ticket.wikimedia.org/otrs/index.pl?Action=AgentTicketZoom&TicketID=7601473
Change-Id: I673e26d0288c71940f551ad9cdb72db262dbe406 | package org.wikipedia.settings;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.view.MenuItem;
public class PreferenceActivityWithBack extends PreferenceActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanc... | package org.wikipedia.settings;
import android.os.Build;
import android.os.Bundle;
import android.preference.PreferenceActivity;
import android.view.MenuItem;
public class PreferenceActivityWithBack extends PreferenceActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanc... |
Set mode and theme custom dimensions instead of sending event | 'use strict';
var localforage = require('localforage');
var $body = $('body');
['theme', 'mode'].forEach(function (property) {
localforage.getItem(property, function (value) {
if (!value) {
value = 'default';
localforage.setItem(property, value);
} else {
// For non-first time users, we wa... | 'use strict';
var localforage = require('localforage');
var $body = $('body');
['theme', 'mode'].forEach(function (property) {
localforage.getItem(property, function (value) {
if (!value) {
value = 'default';
localforage.setItem(property, value);
} else {
// For non-first time users, we wa... |
Add source to author build index query | from __future__ import absolute_import, division, unicode_literals
from flask import session
from sqlalchemy.orm import joinedload
from changes.api.base import APIView
from changes.models import Author, Build
class AuthorBuildIndexAPIView(APIView):
def _get_author(self, author_id):
if author_id == 'me':... | from __future__ import absolute_import, division, unicode_literals
from flask import session
from sqlalchemy.orm import joinedload
from changes.api.base import APIView
from changes.models import Author, Build
class AuthorBuildIndexAPIView(APIView):
def _get_author(self, author_id):
if author_id == 'me':... |
Update pet insurance nav links | const submenuItems = [
{
header: 'Advice',
subHeader: 'What Does Pet Insurance Cover?',
link: '/pet-insurance/learn/pet-insurance-101/',
imageSrc: 'https://res-4.cloudinary.com/policygenius/image/upload/v1/general/pet-guide-opt',
},
{
header: 'Advice',
subHeader: 'Pet Insurance FAQ',
l... | const submenuItems = [
{
header: 'Advice',
subHeader: 'What Does Pet Insurance Cover?',
link: '/pet-insurance/guide/',
imageSrc: 'https://res-4.cloudinary.com/policygenius/image/upload/v1/general/pet-guide-opt',
},
{
header: 'Advice',
subHeader: 'Pet Insurance FAQ',
link: '/pet-insuran... |
Update license and add networkx dependency | #!/usr/bin/env python
'''Setuptools params'''
from setuptools import setup, find_packages
from os.path import join
scripts = [join('bin', filename) for filename in
['mn', 'mnclean']]
modname = distname = 'mininet'
setup(
name=distname,
version='0.0.0',
description='Process-based OpenFlow emu... | #!/usr/bin/env python
'''Setuptools params'''
from setuptools import setup, find_packages
from os.path import join
scripts = [join('bin', filename) for filename in
['mn', 'mnclean']]
modname = distname = 'mininet'
setup(
name=distname,
version='0.0.0',
description='Process-based OpenFlow emu... |
Check for null & undefined | const _ = require("lodash");
module.exports = function omitDeepLodash(input, props) {
function omitDeepOnOwnProps(obj) {
if (!_.isArray(obj) && !_.isObject(obj)) {
return obj;
}
if (_.isArray(obj)) {
return omitDeepLodash(obj, props);
}
const o = {};
_.forOwn(obj, (value, key) =... | const _ = require("lodash");
module.exports = function omitDeepLodash(input, props) {
function omitDeepOnOwnProps(obj) {
if (!_.isArray(obj) && !_.isObject(obj)) {
return obj;
}
if (_.isArray(obj)) {
return omitDeepLodash(obj, props);
}
const o = {};
_.forOwn(obj, (value, key) =... |
Add type attribute set to button | document.getElementById("ayuda").setAttribute("aria-current", "page");
var aside = document.getElementById("complementario");
var form = document.createElement("FORM");
var p = document.createElement("P");
var label = document.createElement("LABEL");
label.setAttribute("for", "repo");
t = document.createTextNode("cue... | document.getElementById("ayuda").setAttribute("aria-current", "page");
var aside = document.getElementById("complementario");
var form = document.createElement("FORM");
var p = document.createElement("P");
var label = document.createElement("LABEL");
label.setAttribute("for", "repo");
t = document.createTextNode("cue... |
Add print statement for request URL | package com.johnstarich.ee461l;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* Handles all requests sent to the root ("/") of this server.
* Created by johnst... | package com.johnstarich.ee461l;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* Handles all requests sent to the root ("/") of this server.
* Created by johnst... |
Add properties to column DTO | /*
* CODENVY CONFIDENTIAL
* __________________
*
* [2013] - [2014] Codenvy, S.A.
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Codenvy S.A. and its suppliers,
* if any. The intellectual and technical concepts contained
* herein are proprietary to Coden... | /*
* CODENVY CONFIDENTIAL
* __________________
*
* [2013] - [2014] Codenvy, S.A.
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Codenvy S.A. and its suppliers,
* if any. The intellectual and technical concepts contained
* herein are proprietary to Coden... |
Make sortProperties an optional config attribute | import Em from 'ember';
import Row from 'llama-table/controllers/row';
import { makeArray } from 'llama-table/computed';
var computed = Em.computed;
var map = computed.map;
var sort = computed.sort;
var reads = computed.reads;
var SortedRowsMixin = Em.Mixin.create({
_rowsSource: makeArray('rows'),
_rowsSortOrder: m... | import Em from 'ember';
import Row from 'llama-table/controllers/row';
import { makeArray } from 'llama-table/computed';
var computed = Em.computed;
var map = computed.map;
var sort = computed.sort;
var reads = computed.reads;
var SortedRowsMixin = Em.Mixin.create({
_rowsSource: makeArray('rows'),
_rowsSortOrder: m... |
Use project-routes module to get route for projects. | var mount = require('koa-mount');
var router = require('koa-router')();
var koa = require('koa');
var Bus = require('busmq');
var app = koa();
require('koa-qs')(app);
var ropts = {
db: 'materialscommons',
port: 30815
};
var r = require('rethinkdbdash')(ropts);
var projectsModel = require('./model/db/projects')(... | var mount = require('koa-mount');
var router = require('koa-router')();
var koa = require('koa');
var Bus = require('busmq');
var app = koa();
require('koa-qs')(app);
var ropts = {
db: 'materialscommons',
port: 30815
};
var r = require('rethinkdbdash')(ropts);
var projectsModel = require('./model/db/projects')(... |
Fix computation of ticks for yAxis on responsive | export default chart => {
if (chart.responsive) {
const {
width,
height
} = chart
// preserve original values
chart._originWidth = width
chart._originHeight = height
// setup height calculation
const heightRatio = height / width
const xTicksRatio = chart.xTicks / width
... | export default chart => {
if (chart.responsive) {
const {
width,
height
} = chart
// preserve original values
chart._originWidth = width
chart._originHeight = height
// setup height calculation
const heightRatio = height / width
const xTicksRatio = chart.xTicks / width
... |
Update w/ Readme & scripts | import os
from setuptools import setup, find_packages
import glob
src_dir = os.path.dirname(__file__)
def read(filename):
full_path = os.path.join(src_dir, filename)
with open(full_path) as fd:
return fd.read()
if __name__ == '__main__':
setup(
name='stacker',
version='0.1.0',
... | import os
from setuptools import setup, find_packages
# import glob
src_dir = os.path.dirname(__file__)
def read(filename):
full_path = os.path.join(src_dir, filename)
with open(full_path) as fd:
return fd.read()
if __name__ == '__main__':
setup(
name='stacker',
version='0.1.0',... |
Test query is actually created. | <?php
namespace Gt\Database\Query;
class QueryFactoryTest extends \PHPUnit_Framework_TestCase {
/**
* @dataProvider \Gt\Database\Test\Helper::queryPathExistsProvider
*/
public function testFindQueryFilePathExists(
string $queryName, string $directoryOfQueries) {
$queryFactory = new QueryFactory($directoryOfQueries... | <?php
namespace Gt\Database\Query;
class QueryFactoryTest extends \PHPUnit_Framework_TestCase {
/**
* @dataProvider \Gt\Database\Test\Helper::queryPathExistsProvider
*/
public function testFindQueryFilePathExists(
string $queryName, string $directoryOfQueries) {
$queryFactory = new QueryFactory($directoryOfQueries... |
Fix gap left in status bar on OS X after quit | // This file is ES5; it's loaded before Babel.
require('babel/register')({
extensions: ['.desktop.js', '.es6', '.es', '.jsx', '.js']
})
const menubar = require('menubar')
const ipc = require('ipc')
const Window = require('./window')
const mb = menubar({
index: `file://${__dirname}/../renderer/launcher.html`,
wi... | // This file is ES5; it's loaded before Babel.
require('babel/register')({
extensions: ['.desktop.js', '.es6', '.es', '.jsx', '.js']
})
const menubar = require('menubar')
const ipc = require('ipc')
const Window = require('./window')
const mb = menubar({
index: `file://${__dirname}/../renderer/launcher.html`,
wi... |
Fix Order filter to work with sorting by keys again | <?php
namespace allejo\stakx\Twig;
use allejo\stakx\Object\ContentItem;
class OrderFilter
{
public function __invoke ($array, $key, $order = "ASC")
{
usort($array, function ($a, $b) use ($key, $order) {
$a = ($a instanceof ContentItem) ? $a->getFrontMatter() : $a;
$b = ($b ins... | <?php
namespace allejo\stakx\Twig;
use allejo\stakx\Object\ContentItem;
class OrderFilter
{
public function __invoke ($array, $key, $order = "ASC")
{
usort($array, function ($a, $b) use ($key, $order) {
$a = !($a instanceof ContentItem) ?: $a->getFrontMatter();
$b = !($b insta... |
:art: Move BottomTab's child element creation logic from attachedCallback to prepare | 'use strict';
class BottomTab extends HTMLElement{
prepare(name){
this.name = name
this.attached = false
this.active = false
this.classList.add('linter-tab')
this.countSpan = document.createElement('span')
this.countSpan.classList.add('count')
this.countSpan.textContent = '0'
this.inn... | 'use strict';
class BottomTab extends HTMLElement{
prepare(name){
this.name = name
this.attached = false
this.active = false
return this
}
attachedCallback() {
this.attached = true
this.classList.add('linter-tab')
this.countSpan = document.createElement('span')
this.countSpan.cla... |
Switch to primarily using the GUI instead of CLI | /*
* The MIT License
*
* Copyright 2016 veeti "walther" haapsamo.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to u... | /*
* The MIT License
*
* Copyright 2016 veeti "walther" haapsamo.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to u... |
Handle scientific notation in response | #!/usr/bin/env python
import json
import re
from urllib import urlopen
api = 'http://www.google.com/ig/calculator?hl=en&q={}{}=?{}'
def convert(value, src_units, dst_units):
url = api.format(value, src_units, dst_units)
# read and preprocess the response
resp = urlopen(url).read()
resp = resp.repl... | #!/usr/bin/env python
import json
import re
from urllib import urlopen
api = 'http://www.google.com/ig/calculator?hl=en&q={}{}=?{}'
def convert(value, src_units, dst_units):
url = api.format(value, src_units, dst_units)
data = urlopen(url).read().decode('utf-8', 'ignore')
# Convert to valid JSON: {foo:... |
Clarify behavior documented in tests. | package cli
import (
"fmt"
"github.com/jwaldrip/odin/cli/values"
)
// Flag returns the Value interface to the value of the named flag,
// panics if none exists.
func (cmd *CLI) Flag(name string) values.Value {
flag := cmd.getFlag(name)
value := cmd.flagValues[flag]
return value
}
// Flags returns the flags as ... | package cli
import (
"fmt"
"github.com/jwaldrip/odin/cli/values"
)
// Flag returns the Value interface to the value of the named flag,
// returning nil if none exists.
func (cmd *CLI) Flag(name string) values.Value {
flag := cmd.getFlag(name)
value := cmd.flagValues[flag]
return value
}
// Flags returns the fl... |
Update tests to cover every Roman WFI filter | import pytest
import sncosmo
@pytest.mark.might_download
def test_hst_bands():
""" check that the HST and JWST bands are accessible """
for bandname in ['f606w', 'uvf606w', 'f125w', 'f127m',
'f115w']: # jwst nircam
sncosmo.get_bandpass(bandname)
@pytest.mark.might_download
de... | import pytest
import sncosmo
@pytest.mark.might_download
def test_hst_bands():
""" check that the HST and JWST bands are accessible """
for bandname in ['f606w', 'uvf606w', 'f125w', 'f127m',
'f115w']: # jwst nircam
sncosmo.get_bandpass(bandname)
@pytest.mark.might_download
de... |
Add quoted string expression example | // Disallows the use of bare strings in a template
//
// passes:
// <div>{{evaluatesToAString}}</div>
// <div>{{'A string'}}</div>
//
// breaks:
// <div>A bare string</div>
var calculateLocationDisplay = require('../helpers/calculate-location-display');
module.exports = function(addonContext) {
var config = addonCo... | // Disallows the use of bare strings in a template
//
// passes:
// <div>{{evaluatesToAString}}</div>
//
// breaks:
// <div>A bare string</div>
var calculateLocationDisplay = require('../helpers/calculate-location-display');
module.exports = function(addonContext) {
var config = addonContext.loadConfig()['bare-stri... |
Change null check to throw NPE. | package uk.ac.ebi.quickgo.annotation.download.converter.helpers;
import uk.ac.ebi.quickgo.annotation.model.Annotation;
import java.util.List;
import java.util.Objects;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* A home for the logic to format ConnectedXRefs into Strings.
*
* @aut... | package uk.ac.ebi.quickgo.annotation.download.converter.helpers;
import uk.ac.ebi.quickgo.annotation.model.Annotation;
import java.util.List;
import java.util.stream.Collectors;
/**
* A home for the logic to format ConnectedXRefs into Strings.
*
* @author Tony Wardell
* Date: 09/04/2018
* Time: 13:06
* Created... |
Fix Error: `cannot use `attributeBindings` on a tag-less component`
Modify touch-action mixin to smartly add `attributeBindings` to prevent
assertion error from being thrown in ember beta/canary.
Error is thrown when using 2.8.0-beta.3+cf714821 and 2.9.0-master+3f4ba8d4 | import Ember from 'ember';
const {
computed,
Mixin,
String: { htmlSafe }
} = Ember;
export default Mixin.create({
init() {
this._super(...arguments);
if (this.tagName) {
this.attributeBindings = ['touchActionStyle:style'];
this.applyStyle = true;
} else {
this.applyStyle = false;... | import Ember from 'ember';
const {
computed,
Mixin,
String: { htmlSafe }
} = Ember;
export default Mixin.create({
attributeBindings: ['touchActionStyle:style'],
touchActionStyle: computed(function() {
// we apply if click is present
let applyStyle = this.click;
if (!applyStyle) {
// we ap... |
Use normal function for normal test | import test from 'ava';
import removeTrailingSeparator from '..';
test('strip trailing separator:', t => {
t.is(removeTrailingSeparator('foo/'), 'foo');
t.is(removeTrailingSeparator('foo\\'), 'foo');
});
test('don\'t strip when it\'s the only char in the string', t => {
t.is(removeTrailingSeparator('/'), '/');
t.... | import test from 'ava';
import removeTrailingSeparator from '..';
test('strip trailing separator:', t => {
t.is(removeTrailingSeparator('foo/'), 'foo');
t.is(removeTrailingSeparator('foo\\'), 'foo');
});
test('don\'t strip when it\'s the only char in the string', async t => {
t.is(removeTrailingSeparator('/'), '/'... |
Increase timeout for agent update to 5 minutes. | #!/usr/bin/env python
__metaclass__ = type
from jujupy import (
check_wordpress,
Environment,
format_listing,
until_timeout,
)
from collections import defaultdict
import sys
def agent_update(environment, version):
env = Environment(environment)
for ignored in until_timeout(300):
versi... | #!/usr/bin/env python
__metaclass__ = type
from jujupy import (
check_wordpress,
Environment,
format_listing,
until_timeout,
)
from collections import defaultdict
import sys
def agent_update(environment, version):
env = Environment(environment)
for ignored in until_timeout(30):
versio... |
Fix broken test (not the intermittent one, this was just a dumb thing) | from django.test import TestCase
from django.conf import settings
from django.utils.html import escape
from django.template import Context, Template
from bongo.apps.bongo.tests import factories
def render_template(string, context=None):
context = Context(context) if context else None
return Template(string).r... | from django.test import TestCase
from django.conf import settings
from django.template import Context, Template
from bongo.apps.bongo.tests import factories
def render_template(string, context=None):
context = Context(context) if context else None
return Template(string).render(context)
class TemplateTagsTe... |
Fix: Allow database name to be configured
We broke the honoring of the database name
settings when we 'refactored' server.js a
couple commits ago. | // server.js
//
// The main entry point for Circle Blvd. Handles
// command-line arguments and the highest level
// config for the app.
//
//
// Process command-line arguments
var isDebugging = false;
for (var index in process.argv) {
if (process.argv[index] === '--debug') {
isDebugging = tr... | // server.js
//
// The main entry point for Circle Blvd. Handles
// command-line arguments and the highest level
// config for the app.
//
//
var app = require('./app.js');
// Process command-line arguments
var isDebugging = false;
for (var index in process.argv) {
if (process.argv[index] === '--deb... |
Add a missing SDK suppression for migration test on platform backend.
Test: Presubmit
Change-Id: I743e5f77a088e7f260d6cc18541b7d9a204dc1f5 | /*
* Copyright 2021 The Android Open Source Project
*
* 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 applica... | /*
* Copyright 2021 The Android Open Source Project
*
* 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 applica... |
Move event managers imports to setup in auditor | from auditor.manager import default_manager
from event_manager.event_service import EventService
class AuditorService(EventService):
"""An service that just passes the event to author services."""
event_manager = default_manager
def __init__(self):
self.tracker = None
self.activitylogs =... | import activitylogs
import tracker
from auditor.manager import default_manager
from event_manager.event_service import EventService
class AuditorService(EventService):
"""An service that just passes the event to author services."""
event_manager = default_manager
def get_event(self, event_type, instanc... |
Fix index out of bounds exception by first checking to make sure the configuration option parsed correctly.
r5374 | package org.openqa.selenium.server;
public class BrowserConfigurationOptions {
private String profile = "";
public BrowserConfigurationOptions(String browserConfiguration) {
//"name:value;name:value"
String[] optionsPairList = browserConfiguration.split(";");
for (int i = 0; i < o... | package org.openqa.selenium.server;
public class BrowserConfigurationOptions {
private String profile = "";
public BrowserConfigurationOptions(String browserConfiguration) {
//"name:value;name:value"
String[] optionsPairList = browserConfiguration.split(";");
for (int i = 0; i < o... |
Change ropsten port to 8546 to avoid confusion | var HDWalletProvider = require("truffle-hdwallet-provider");
// 12-word mnemonic
var mnemonic = "onyx aloof polio bronco spearfish clustered refined earflap darkroom slashing casualty curled";
module.exports = {
networks: {
ropsten: {
network_id: 3, // Official ropsten network id
... | var HDWalletProvider = require("truffle-hdwallet-provider");
// 12-word mnemonic
var mnemonic = "onyx aloof polio bronco spearfish clustered refined earflap darkroom slashing casualty curled";
module.exports = {
networks: {
ropsten: {
network_id: 3, // Official ropsten network id
... |
Add constant for unicode byte order mark | package com.alexrnl.commons.io;
import java.io.BufferedReader;
import java.io.EOFException;
import java.io.IOException;
import java.util.Objects;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Utility methods for IO stuff.<br />
* @author Alex
*/
public final class IOUtils {
/** Logger */
... | package com.alexrnl.commons.io;
import java.io.BufferedReader;
import java.io.EOFException;
import java.io.IOException;
import java.util.Objects;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Utility methods for IO stuff.<br />
* @author Alex
*/
public final class IOUtils {
/** Logger */
... |
tests: Cover one more branch in unit tests | const Client = require('../lib/client');
const options = {
baseUrl: 'some value',
username: 'some value',
password: 'some value'
};
describe('Client', () => {
it('should be constructor and factory function', () => {
expect(Client).toBeFunction();
expect(new Client(options)).toBeObject();
expect(Cl... | const Client = require('../lib/client');
const options = {
baseUrl: 'some value',
username: 'some value',
password: 'some value'
};
describe('Client', () => {
it('should be constructor and factory function', () => {
expect(Client).toBeFunction();
expect(new Client(options)).toBeObject();
expect(Cl... |
Revert "Revert "Add Total Volunteer members.""
This reverts commit cf41f093a19059a4d849c2ab16a96c826fe5474b. | <?php
// Get user type
$userType = 'volunteer';
// Query retrieving user ID, first name, last name of volunteers
$result = db_query('SELECT f.field_first_name_value, l.field_last_name_value, u.name FROM {role} r, {users_roles} ur, {field_data_field_first_name} f, {field_data_field_last_name} l, {users} u WHERE u.uid =... | <?php
// Get user type
$userType = 'volunteer';
// Query retrieving user ID, first name, last name of volunteers
$result = db_query('SELECT f.field_first_name_value, l.field_last_name_value, u.name FROM {role} r, {users_roles} ur, {field_data_field_first_name} f, {field_data_field_last_name} l, {users} u WHERE u.uid =... |
Add additional fields to permission type | import graphene
from django.contrib.auth.models import Permission as DjangoPermission
from graphene_django import DjangoObjectType
from . import models
class ClientUser(DjangoObjectType):
name = graphene.String()
has_cms_access = graphene.Boolean()
user_id = graphene.Int()
permissions = graphene.List(... | import graphene
from django.contrib.auth.models import Permission as DjangoPermission
from graphene_django import DjangoObjectType
from . import models
class ClientUser(DjangoObjectType):
name = graphene.String()
has_cms_access = graphene.Boolean()
user_id = graphene.Int()
permissions = graphene.List(... |
Use the actual DynamicTest type
? was only used with the previous solution,
with the new solution, code can refer to the type
without any problem | package io.quarkus.it.main;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.util.Arrays;
import java.util.List;
import javax.inject.Inject;
import org.junit.jupiter.api.DynamicTest;
import org.junit.jupiter.api.Test;
import org.j... | package io.quarkus.it.main;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.util.Arrays;
import java.util.List;
import javax.inject.Inject;
import org.junit.jupiter.api.DynamicTest;
import org.junit.jupiter.api.Test;
import org.j... |
Check the file extension before requiring a test.
My vim swap files kept getting caught in the test runner so I made the
change to only load up .js files. | var fs = require('fs'),
path = require('path'),
fileModule = require('file'),
testDir = '/tests',
testFileName = 'integration_test.js';
process.env.INTEGRATION = true;
describe('endpoint', function() {
it('should load the server and set everything up properly',function(done){
this.timeout(1000); //Server sh... | var fs = require('fs'),
fileModule = require('file'),
testDir = '/tests',
testFileName = 'integration_test.js';
process.env.INTEGRATION = true;
describe('endpoint', function() {
it('should load the server and set everything up properly',function(done){
this.timeout(1000); //Server should not take more than 1 s... |
Add background color for loading photos | import { withStyles } from '@material-ui/core/styles'
import { Link } from 'client/routes'
const styles = theme => ({
photo: {
backgroundColor: theme.palette.primary.light,
position: 'absolute',
textAlign: 'center',
whiteSpace: 'nowrap',
},
})
const PhotoGridItem = ({ albumSlug, item, classes }) =... | import { withStyles } from '@material-ui/core/styles'
import { Link } from 'client/routes'
const styles = theme => ({
photo: {
position: 'absolute',
textAlign: 'center',
color: theme.palette.text.secondary,
whiteSpace: 'nowrap',
},
})
const PhotoGridItem = ({ albumSlug, item, classes }) => {
con... |
Add comment for object types | #!/usr/bin/env python
import sys
print("argv: %d" % len(sys.argv))
# Object related test
# type and id are unique
# ref: https://docs.python.org/2/reference/datamodel.html
# mutable object: value can be changed
# immutable object: value can NOT be changed after created
# This means readonly
# ex: ... | #!/usr/bin/env python
import sys
print("argv: %d" % len(sys.argv))
# Object related test
print(type(sys.argv))
print(id(sys.argv))
print(type(sys.argv) is list)
if len(sys.argv) != 2:
print("%s filename" % sys.argv[0])
raise SystemExit(1)
file = open(sys.argv[1], "w")
line = []
while True:
line = sys.s... |
Fix broken merge from Master. | package uk.ac.ebi.quickgo.index.annotation;
/**
* A class for creating stubbed annotations, representing rows of data read from
* annotation source files.
*
* Created 22/04/16
* @author Edd
*/
class AnnotationMocker {
static Annotation createValidAnnotation() {
Annotation annotation = new Annotation(... | package uk.ac.ebi.quickgo.index.annotation;
/**
* A class for creating stubbed annotations, representing rows of data read from
* annotation source files.
*
* Created 22/04/16
* @author Edd
*/
class AnnotationMocker {
static Annotation createValidAnnotation() {
Annotation annotation = new Annotation(... |
Add some more clarification in the docs | package datamanclient
import (
"context"
"time"
"github.com/jacksontj/dataman/src/query"
)
// TODO: support per-query config?
// TODO support switching config in-flight? If so then we'll need to store a
// pointer to it in the context -- which would require implementing one ourself
type Client struct {
Transport... | package datamanclient
import (
"context"
"time"
"github.com/jacksontj/dataman/src/query"
)
// TODO: support per-query config?
// TODO support switching config in-flight? If so then we'll need to store a
// pointer to it in the context -- which would require implementing one ourself
type Client struct {
Transport... |
Remove author and description meta tags | <!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo('charset'); ?>">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#464646">
<?php wp_head(); ?>
<link rel="stylesheet" href... | <!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo('charset'); ?>">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#464646">
<meta name="author" content="">
<meta name="desc... |
Fix polygon particle rounding errors
Fixes #418 | package de.gurkenlabs.litiengine.graphics.emitters.particles;
import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.awt.geom.Path2D;
import java.awt.geom.Point2D;
public class PolygonParticle extends ShapeParticle {
private int sides;
public PolygonParticle(float width, float height, int sides... | package de.gurkenlabs.litiengine.graphics.emitters.particles;
import java.awt.Polygon;
import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.awt.geom.Point2D;
public class PolygonParticle extends ShapeParticle {
private int sides;
public PolygonParticle(float width, float height, int sides) {
... |
Fix mismatch in development WebTestCase method signature | <?php
// Settings to make all errors more obvious during testing
error_reporting(-1);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
date_default_timezone_set('UTC');
use There4\Slim\Test\WebTestCase;
define('PROJECT_ROOT', realpath(__DIR__ . '/..'));
require_once PROJECT_ROOT . '/vendor/autoloa... | <?php
// Settings to make all errors more obvious during testing
error_reporting(-1);
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
date_default_timezone_set('UTC');
use There4\Slim\Test\WebTestCase;
define('PROJECT_ROOT', realpath(__DIR__ . '/..'));
require_once PROJECT_ROOT . '/vendor/autoloa... |
Set version to 0.2.1. Ready for PyPI. | import os
try:
from setuptools import setup, Extension
except ImportError:
# Use distutils.core as a fallback.
# We won't be able to build the Wheel file on Windows.
from distutils.core import setup, Extension
extensions = []
if os.name == 'nt':
ext = Extension(
'asyncio._overlapped', ['ove... | import os
try:
from setuptools import setup, Extension
except ImportError:
# Use distutils.core as a fallback.
# We won't be able to build the Wheel file on Windows.
from distutils.core import setup, Extension
extensions = []
if os.name == 'nt':
ext = Extension(
'asyncio._overlapped', ['ove... |
Handle shell args in python scripts | #!/usr/bin/env python
import sys
import json
import struct
import subprocess
import shlex
# Read a message from stdin and decode it.
def getMessage():
rawLength = sys.stdin.read(4)
if len(rawLength) == 0:
sys.exit(0)
messageLength = struct.unpack('@I', rawLength)[0]
message = sys.stdin.read(m... | #!/usr/bin/env python
# and add mpv.json to ~/.mozilla/native-messaging-hosts
import sys
import json
import struct
import subprocess
# Read a message from stdin and decode it.
def getMessage():
rawLength = sys.stdin.read(4)
if len(rawLength) == 0:
sys.exit(0)
messageLength = struct.unpack('@I... |
Update testes (Chamber of Deputies changed real world data) | import os
from datetime import date
from unittest import main, TestCase
import numpy as np
from serenata_toolbox.chamber_of_deputies.official_missions_dataset import OfficialMissionsDataset
class TestOfficialMissionsDataset(TestCase):
def setUp(self):
self.subject = OfficialMissionsDataset()
def te... | import os
from datetime import date
from unittest import main, TestCase
import numpy as np
from serenata_toolbox.chamber_of_deputies.official_missions_dataset import OfficialMissionsDataset
class TestOfficialMissionsDataset(TestCase):
def setUp(self):
self.subject = OfficialMissionsDataset()
def te... |
CC-5781: Upgrade script for new storage quota implementation | <?php
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../../install_minimal/../airtime_mvc/application'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
get_include_path(),
realpath(... | <?php
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../../../install_minimal/../airtime_mvc/application'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
get_include_path(),
realpath(... |
Fix target channel of !welcome | 'use strict';
const
Command = require('../Command'),
MentionsMiddleware = require('../../middleware/MentionsMiddleware'),
RestrictChannelsMiddleware = require('../../middleware/RestrictChannelsMiddleware');
class CommandWelcome extends Command {
constructor(module, commandConfig) {
super(modul... | 'use strict';
const
Command = require('../Command'),
MentionsMiddleware = require('../../middleware/MentionsMiddleware'),
RestrictChannelsMiddleware = require('../../middleware/RestrictChannelsMiddleware');
class CommandWelcome extends Command {
constructor(module, commandConfig) {
super(modul... |
US2086: Clear RSA key area when showing/hiding. Improve indentation. | $(document).ready(function() {
$("#addKeyBtn").unbind("click");
$("#addKeyBtn").click(function() {
$("#rsaKeyField").toggle(250);
$("#rsaKeyField").find(':input').val('');
$("#key_arrow").toggleClass("icon-chevron-left, icon-chevron-down");
});
if (is_sandbox) {
var buttonEnableForCustom = fun... | $(document).ready(function() {
$("#addKeyBtn").unbind("click");
$("#addKeyBtn").click(function() {
$("#rsaKeyField").toggle(250);
$("#rsaKeyField").val(""); // this doesn't work, want to clear the text whenever shown/hidden
$("#key_arrow").toggleClass("icon-chevron-left, icon-chevron-down");
});
if... |
Add product name to model. | define(['jquery', 'underscore', 'backbone'], function($, _, Backbone) {
var Models = {};
Models.Want = Backbone.Model.extend({
defaults: {
id: '',
name: '',
price: '',
location: '',
buyers: [],
owner: '',
imageUrl: '',
dateStart: '',
dateExpire: ''
},
initialize: function() {
},
... | define(['jquery', 'underscore', 'backbone'], function($, _, Backbone) {
var Models = {};
Models.Want = Backbone.Model.extend({
defaults: {
id: '',
name: '',
price: '',
location: '',
buyers: [],
owner: '',
imageUrl: '',
dateStart: '',
dateExpire: ''
},
initialize: function() {
},
... |
Check match with identity operator against a boolean | <?php
namespace PHPSpec2\Matcher;
abstract class BasicMatcher implements MatcherInterface
{
final public function positiveMatch($name, $subject, array $arguments)
{
if (false === $this->matches($subject, $arguments)) {
throw $this->getFailureException($name, $subject, $arguments);
... | <?php
namespace PHPSpec2\Matcher;
abstract class BasicMatcher implements MatcherInterface
{
final public function positiveMatch($name, $subject, array $arguments)
{
if (!$this->matches($subject, $arguments)) {
throw $this->getFailureException($name, $subject, $arguments);
}
... |
Fix issue of not working for multipe tabs
Rename for clarity:
scriptInjected -> injected
attachedTabs -> activeTabs
Change injected type for proper work with multiple tabs.
Injected property is still a boolean.
Change activeTabs[tabId] toggling to boolean for clarity. | // Global variables only exist for the life of the page, so they get reset
// each time the page is unloaded.
const activeTabs = {};
const injected = {};
// Called when the user clicks on the browser action.
chrome.browserAction.onClicked.addListener((tab) => {
const tabId = tab.id;
if (!injected[tabId]) {
chr... | // Global variables only exist for the life of the page, so they get reset
// each time the page is unloaded.
const attachedTabs = {};
let scriptInjected = false;
// Called when the user clicks on the browser action.
chrome.browserAction.onClicked.addListener((tab) => {
const tabId = tab.id;
if (!scriptInjected) {... |
Support any later versions of SQLAlchemy | import collections
import numbers
import os
from sqlalchemy import __version__
from sqlalchemy_imageattach.version import VERSION, VERSION_INFO
def test_version_info():
assert isinstance(VERSION_INFO, collections.Sequence)
assert len(VERSION_INFO) == 3
assert isinstance(VERSION_INFO[0], numbers.Integral)... | import collections
import numbers
import os
from sqlalchemy import __version__
from sqlalchemy_imageattach.version import VERSION, VERSION_INFO
def test_version_info():
assert isinstance(VERSION_INFO, collections.Sequence)
assert len(VERSION_INFO) == 3
assert isinstance(VERSION_INFO[0], numbers.Integral)... |
Fix yet another 3k issue (stderr not flushing automatically).
Signed-off-by: Thomas Hori <7133b3a0da8e60bd3295f2c8559ef184054a68ed@liddicott.com> | from repugeng.StaticClass import StaticClass
import sys
class Compat3k(StaticClass):
@classmethod
def str_to_bytes(cls, s):
"""Convert a string of either width to a byte string."""
try:
try:
return bytes(s)
except NameError:
ret... | from repugeng.StaticClass import StaticClass
import sys
class Compat3k(StaticClass):
@classmethod
def str_to_bytes(cls, s):
"""Convert a string of either width to a byte string."""
try:
try:
return bytes(s)
except NameError:
ret... |
Fix version endpoint returning a Content-Type of application/xml instead of application/json when client specifies Accept-Content-Type: application/xml
RB=596810
G=pinot-dev-reviewers
R=kgopalak,jfim,ssubrama,dpatel,mshrivas
A=mshrivas | package com.linkedin.pinot.controller.api.restlet.resources;
import com.linkedin.pinot.common.Utils;
import com.linkedin.pinot.controller.api.swagger.HttpVerb;
import com.linkedin.pinot.controller.api.swagger.Paths;
import com.linkedin.pinot.controller.api.swagger.Summary;
import com.linkedin.pinot.controller.api.swag... | package com.linkedin.pinot.controller.api.restlet.resources;
import com.linkedin.pinot.common.Utils;
import com.linkedin.pinot.controller.api.swagger.HttpVerb;
import com.linkedin.pinot.controller.api.swagger.Paths;
import com.linkedin.pinot.controller.api.swagger.Summary;
import com.linkedin.pinot.controller.api.swag... |
Revert "remove line to apply for new team"
This reverts commit e9cc064a440db8457387a8ce527453679446b327. | package sg.ncl.service.registration.controllers;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import sg.ncl.service.registration.RegistrationService;
import sg.ncl.service.registration.dtos.RegistrationData;
import sg.ncl.servi... | package sg.ncl.service.registration.controllers;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import sg.ncl.service.registration.RegistrationService;
import sg.ncl.service.registration.dtos.RegistrationInfo;
import javax.injec... |
Add prettier-ignore to generated files
Summary:
When prettier is run on the generated files, it removes the parenthesis resulting in flow failing.
Adding the prettier-ignore comment skip formatting of this line.
Fixes #2426
Closes https://github.com/facebook/relay/pull/2427
Reviewed By: devknoll
Differential Revis... | /**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @format
*/
'use strict';
import type {FormatModule} from './writeRelayGeneratedFile';
const formatGeneratedModule: FormatM... | /**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @format
*/
'use strict';
import type {FormatModule} from './writeRelayGeneratedFile';
const formatGeneratedModule: FormatM... |
Add Changelog podcast to default tracks... for a while | import skin from "../skins/base-2.91-png.wsz";
import llamaAudio from "../mp3/llama-2.91.mp3";
/* global SENTRY_DSN */
const { hash } = window.location;
let config = {};
if (hash) {
try {
config = JSON.parse(decodeURIComponent(hash).slice(1));
} catch (e) {
console.error("Failed to decode config from hash... | import skin from "../skins/base-2.91-png.wsz";
import llamaAudio from "../mp3/llama-2.91.mp3";
/* global SENTRY_DSN */
const { hash } = window.location;
let config = {};
if (hash) {
try {
config = JSON.parse(decodeURIComponent(hash).slice(1));
} catch (e) {
console.error("Failed to decode config from hash... |
Load all stylesheets for public preview
fixes #88
Signed-off-by: Robin Appelman <474ee9ee179b0ecf0bc27408079a0b15eda4c99d@icewind.nl> | <?php
$eventDispatcher = \OC::$server->getEventDispatcher();
$eventDispatcher->addListener(
'OCA\Files::loadAdditionalScripts',
function () {
$policy = new \OC\Security\CSP\ContentSecurityPolicy();
$policy->setAllowedImageDomains(['*']);
$frameDomains = $policy->getAllowedFrameDomains();
$frameDomains[] = 'ww... | <?php
$eventDispatcher = \OC::$server->getEventDispatcher();
$eventDispatcher->addListener(
'OCA\Files::loadAdditionalScripts',
function () {
$policy = new \OC\Security\CSP\ContentSecurityPolicy();
$policy->setAllowedImageDomains(['*']);
$frameDomains = $policy->getAllowedFrameDomains();
$frameDomains[] = 'ww... |
Fix Promise rejection for save() | // @flow
import mongoose from 'mongoose'
import Message from './model/message'
export const homePage = () => null
export const helloPage = () =>
new Promise((resolve, reject) => {
const helloMessage = new Message({
key: 'hello-msg',
content: 'Server-side preloaded message from the DB',
})
... | // @flow
import mongoose from 'mongoose'
import Message from './model/message'
export const homePage = () => null
export const helloPage = () =>
new Promise((resolve, reject) => {
const helloMessage = new Message({
key: 'hello',
content: 'Server-side preloaded message from the DB',
})
mon... |
Replace variable class name field by function get class name field | <?php namespace ThibaudDauce\EloquentVariableModelConstructor;
trait VariableModelConstructorTrait {
/**
* Get class name field.
*
* @return string
*/
protected function getClassnameField()
{
return 'class_name';
}
/**
* Create a new model instance that is existing.
*
* @override I... | <?php namespace ThibaudDauce\EloquentVariableModelConstructor;
trait VariableModelConstructorTrait {
/**
* Database field indicated class name.
*
* @var string
*/
protected $class_name_field = 'class_name';
/**
* Create a new model instance that is existing.
*
* @override Illuminate\Databa... |
Break a line exceeding 80 chars into two | // Copyright (C) 2017 Damon Revoe. All rights reserved.
// Use of this source code is governed by the MIT
// license, which can be found in the LICENSE file.
package main
import (
"testing"
)
func runTemplateFunctionTest(t *testing.T,
funcName, arg, expected string) {
result := funcMap[funcName].(func(string) st... | // Copyright (C) 2017 Damon Revoe. All rights reserved.
// Use of this source code is governed by the MIT
// license, which can be found in the LICENSE file.
package main
import (
"testing"
)
func runTemplateFunctionTest(t *testing.T,
funcName, arg, expected string) {
result := funcMap[funcName].(func(string) st... |
Hide the „IsValid“ property in JSON | package data
// Definition stores information about a system, used for importing data.
type Definition struct {
Title string
Type string
Env string
Location string
User string
Password string
URL string
Notes string
Tags []string
}
// YamlData stores information about all systems,... | package data
// Definition stores information about a system, used for importing data.
type Definition struct {
Title string
Type string
Env string
Location string
User string
Password string
URL string
Notes string
Tags []string
}
// YamlData stores information about all systems,... |
Set focus after click to next element
The clearSelection function in clipboard.js blurs the button which hands focus back to the top of body so this plops it back | function Copy ($module) {
this.$module = $module
}
Copy.prototype.init = function () {
var $module = this.$module
if (!$module) {
return
}
var $button = document.createElement('button')
$button.className = 'app-copy-button js-copy-button'
$button.setAttribute('aria-live', 'assertive')
$button.textCo... | function Copy ($module) {
this.$module = $module
}
Copy.prototype.init = function () {
var $module = this.$module
if (!$module) {
return
}
var $button = document.createElement('button')
$button.className = 'app-copy-button js-copy-button'
$button.setAttribute('aria-live', 'assertive')
$button.textCo... |
Clear the layout delay timer when unplugging the cards list view. | module.exports = Zeppelin.CollectionView.extend({
tagName: 'ol',
className: 'cards-list list-unstyled clearfix',
subscriptions: {
'cardsList:layout': 'triggerLayout'
},
addMethod: 'prepend',
layoutTimer: null,
itemView: function(model) {
return require('account/views/' + model.get('type'));
... | module.exports = Zeppelin.CollectionView.extend({
tagName: 'ol',
className: 'cards-list list-unstyled clearfix',
subscriptions: {
'cardsList:layout': 'triggerLayout'
},
addMethod: 'prepend',
itemView: function(model) {
return require('account/views/' + model.get('type'));
},
collection: fun... |
Change unuique keys to MySQL varchar | from app import app
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.script import Manager, prompt_bool
from datetime import datetime
db = SQLAlchemy(app)
manager = Manager(usage="Manage the database")
@manager.command
def create():
"Create the database"
db.create_all()
@manager.command
def drop()... | from app import app
from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.script import Manager, prompt_bool
from datetime import datetime
db = SQLAlchemy(app)
manager = Manager(usage="Manage the database")
@manager.command
def create():
"Create the database"
db.create_all()
@manager.command
def drop()... |
Use !! to convert variables to booleans | var helper = require('../helper')
var Response = function(id, content, error, internal) {
this.id = parseFloat(id)
this.content = content
this.error = !!error
this.internal = !!internal
}
Response.prototype = {
toString: function() {
return (this.error ? '?' : '=') + (!isNaN(this.id) ? thi... | var helper = require('../helper')
var Response = function(id, content, error, internal) {
this.id = parseFloat(id)
this.content = content
this.error = error ? true : false
this.internal = internal ? true : false
}
Response.prototype = {
toString: function() {
return (this.error ? '?' : '='... |
Revert "Display the tag/facet of the selected term in the input"
This reverts commit f85613a9af711a4aeb27b3bbe6efe8592e8318ce. | /*
javascript in this file controls the html page demonstrating the autosubject functionality
*/
/**************************************************************************************/
/* Set up and initialization */
/*****************************************************************************... | /*
javascript in this file controls the html page demonstrating the autosubject functionality
*/
/**************************************************************************************/
/* Set up and initialization */
/*****************************************************************************... |
Fix missing templates in source packages
Signed-off-by: Kevin Conway <3473c1f185ca03eadc40ad288d84425b54fd7d57@gmail.com> | """Setuptools configuration for rpmvenv."""
from setuptools import setup
from setuptools import find_packages
with open('README.rst', 'r') as readmefile:
README = readmefile.read()
setup(
name='rpmvenv',
version='0.1.2',
url='https://github.com/kevinconway/rpmvenv',
description='RPM packager fo... | """Setuptools configuration for rpmvenv."""
from setuptools import setup
from setuptools import find_packages
with open('README.rst', 'r') as readmefile:
README = readmefile.read()
setup(
name='rpmvenv',
version='0.1.1',
url='https://github.com/kevinconway/rpmvenv',
description='RPM packager fo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.