commit stringlengths 40 40 | old_file stringlengths 4 150 | new_file stringlengths 4 150 | old_contents stringlengths 0 3.26k | new_contents stringlengths 1 4.43k | subject stringlengths 15 501 | message stringlengths 15 4.06k | lang stringclasses 4 values | license stringclasses 13 values | repos stringlengths 5 91.5k | diff stringlengths 0 4.35k |
|---|---|---|---|---|---|---|---|---|---|---|
9c448e669a966c307bc1218d58300c3a46bcec43 | src/js/model/refugee-constants.js | src/js/model/refugee-constants.js |
var moment = require('moment');
// NOTE: month indices are zero-based
module.exports.DATA_START_YEAR = 2012;
module.exports.DATA_START_MONTH = 0;
module.exports.DATA_START_MOMENT = moment([
module.exports.DATA_START_YEAR,
module.exports.DATA_START_MONTH]).startOf('month');
module.exports.DATA_END_YEAR = 2016;
module.exports.DATA_END_MONTH = 1;
module.exports.DATA_END_MOMENT = moment([
module.exports.DATA_END_YEAR,
module.exports.DATA_END_MONTH]).endOf('month');
module.exports.ASYLUM_APPLICANTS_DATA_UPDATED_MOMENT = moment([2016, 3, 18]);
module.exports.disableLabels = ['BIH', 'MKD', 'ALB', 'LUX', 'MNE', 'ARM', 'AZE', 'LBN'];
module.exports.fullRange = [module.exports.DATA_START_MOMENT.unix(), module.exports.DATA_END_MOMENT.unix()];
module.exports.labelShowBreakPoint = 992;
|
var moment = require('moment');
// NOTE: month indices are zero-based
module.exports.DATA_START_YEAR = 2012;
module.exports.DATA_START_MONTH = 0;
module.exports.DATA_START_MOMENT = moment([
module.exports.DATA_START_YEAR,
module.exports.DATA_START_MONTH]).startOf('month');
module.exports.DATA_END_YEAR = 2016;
module.exports.DATA_END_MONTH = 2;
module.exports.DATA_END_MOMENT = moment([
module.exports.DATA_END_YEAR,
module.exports.DATA_END_MONTH]).endOf('month');
module.exports.ASYLUM_APPLICANTS_DATA_UPDATED_MOMENT = moment([2016, 3, 18]);
module.exports.disableLabels = ['BIH', 'MKD', 'ALB', 'LUX', 'MNE', 'ARM', 'AZE', 'LBN'];
module.exports.fullRange = [module.exports.DATA_START_MOMENT.unix(), module.exports.DATA_END_MOMENT.unix()];
module.exports.labelShowBreakPoint = 992;
| Extend visualisation period to March | Extend visualisation period to March
| JavaScript | mit | lucified/lucify-asylum-countries,lucified/lucify-asylum-countries,lucified/lucify-asylum-countries,lucified/lucify-asylum-countries | ---
+++
@@ -10,7 +10,7 @@
module.exports.DATA_START_MONTH]).startOf('month');
module.exports.DATA_END_YEAR = 2016;
-module.exports.DATA_END_MONTH = 1;
+module.exports.DATA_END_MONTH = 2;
module.exports.DATA_END_MOMENT = moment([
module.exports.DATA_END_YEAR,
module.exports.DATA_END_MONTH]).endOf('month'); |
62ce6e6f8111497d5bee0cc3bd44c4a1902eb317 | src/lib/control/typeahead/normalizer/TypeaheadNormalizer.js | src/lib/control/typeahead/normalizer/TypeaheadNormalizer.js | /**
* @requires javelin-install
* @provides javelin-typeahead-normalizer
* @javelin
*/
/**
* @group control
*/
JX.install('TypeaheadNormalizer', {
statics : {
normalize : function(str) {
return ('' + str)
.toLowerCase()
.replace(/[^a-z0-9 ]/g, '')
.replace(/ +/g, ' ')
.replace(/^\s*|\s*$/g, '');
}
}
});
| /**
* @requires javelin-install
* @provides javelin-typeahead-normalizer
* @javelin
*/
/**
* @group control
*/
JX.install('TypeaheadNormalizer', {
statics : {
/**
* Normalizes a string by lowercasing it and stripping out extra spaces
* and punctuation.
*
* @param string
* @return string Normalized string.
*/
normalize : function(str) {
return ('' + str)
.toLocaleLowerCase()
.replace(/[\.,-\/#!$%\^&\*;:{}=\-_`~()]/g, '')
.replace(/ +/g, ' ')
.replace(/^\s*|\s*$/g, '');
}
}
});
| Use Punctuation Blacklist for Typeahead Normalizer | Use Punctuation Blacklist for Typeahead Normalizer
Summary:
This changes the Typeahead normalizer to use a punctuation blacklist instead of stripping all non-alphanumeric characters. As the normalizer stands now, any international characters (e.g. Japanese characters) are stripped.
Reviewers: epriestley, jg
Test Plan:
> JX.TypeaheadNormalizer.normalize('Get rid of the periods...')
"get rid of the periods"
> JX.TypeaheadNormalizer.normalize('ラジオ')
"ラジオ"
Differential Revision: 924
| JavaScript | bsd-3-clause | phacility/javelin,phacility/javelin,phacility/javelin,phacility/javelin,phacility/javelin | ---
+++
@@ -4,16 +4,22 @@
* @javelin
*/
-
/**
* @group control
*/
JX.install('TypeaheadNormalizer', {
statics : {
+ /**
+ * Normalizes a string by lowercasing it and stripping out extra spaces
+ * and punctuation.
+ *
+ * @param string
+ * @return string Normalized string.
+ */
normalize : function(str) {
return ('' + str)
- .toLowerCase()
- .replace(/[^a-z0-9 ]/g, '')
+ .toLocaleLowerCase()
+ .replace(/[\.,-\/#!$%\^&\*;:{}=\-_`~()]/g, '')
.replace(/ +/g, ' ')
.replace(/^\s*|\s*$/g, '');
} |
23e1f61e01d8f6d8fb3760bcd01bc50b17cdeaf7 | dashboard/app/scripts/collections/user-request-collection.js | dashboard/app/scripts/collections/user-request-collection.js | /*jshint -W106*/
/*global define*/
define(['underscore', 'backbone', 'models/user-request-model'], function(_, Backbone, UserRequestModel) {
'use strict';
var UserRequestCollection = Backbone.Collection.extend({
url: function() {
return '/api/v2/cluster/' + this.cluster + '/request';
},
model: UserRequestModel,
initialize: function(models, options) {
if (options && options.cluster) {
this.cluster = options.cluster;
}
}
});
return UserRequestCollection;
});
| /*jshint -W106*/
/*global define*/
define(['underscore', 'backbone', 'models/user-request-model'], function(_, Backbone, UserRequestModel) {
'use strict';
var UserRequestCollection = Backbone.Collection.extend({
url: function() {
return '/api/v2/cluster/' + this.cluster + '/request' + this.params;
},
parse: function(resp) {
return resp.results;
},
model: UserRequestModel,
params: '?page_size=32',
initialize: function(models, options) {
if (options && options.cluster) {
this.cluster = options.cluster;
}
},
// Only grab requests with state submitted
getSubmitted: function(options) {
this.params = '?state=submitted&page_size=32';
var self = this;
return this.fetch(options).always(function() {
self.params = '?page_size=32';
});
}
});
return UserRequestCollection;
});
| Set page_size and state on collection requests | Set page_size and state on collection requests
| JavaScript | mit | SUSE/calamari-clients,ceph/calamari-clients,ceph/calamari-clients,ceph/romana,SUSE/romana,GregMeno/test,SUSE/calamari-clients,SUSE/romana,ceph/romana,SUSE/calamari-clients,SUSE/romana,GregMeno/test,ceph/romana,ceph/calamari-clients,SUSE/calamari-clients,SUSE/romana,SUSE/calamari-clients,ceph/romana,ceph/romana,ceph/calamari-clients,GregMeno/test,ceph/calamari-clients,GregMeno/test,SUSE/romana,GregMeno/test | ---
+++
@@ -6,13 +6,25 @@
var UserRequestCollection = Backbone.Collection.extend({
url: function() {
- return '/api/v2/cluster/' + this.cluster + '/request';
+ return '/api/v2/cluster/' + this.cluster + '/request' + this.params;
+ },
+ parse: function(resp) {
+ return resp.results;
},
model: UserRequestModel,
+ params: '?page_size=32',
initialize: function(models, options) {
if (options && options.cluster) {
this.cluster = options.cluster;
}
+ },
+ // Only grab requests with state submitted
+ getSubmitted: function(options) {
+ this.params = '?state=submitted&page_size=32';
+ var self = this;
+ return this.fetch(options).always(function() {
+ self.params = '?page_size=32';
+ });
}
});
|
1a9d382e09906e5b6e05ded1b391f337e9a8f69d | app/controllers/dashboard/session-manager/session/entries/new.js | app/controllers/dashboard/session-manager/session/entries/new.js | import { inject as service } from '@ember/service';
import Controller from '@ember/controller';
import { task, timeout } from 'ember-concurrency';
export default Controller.extend({
flashMessages: service(),
searchGroup: task(function* (term){
yield timeout(600);
let kindOptions = {
'Chorus': 32,
'Quartet': 41,
};
let kindModel = this.get('model.session.kind');
let kindInt = kindOptions[kindModel];
let groups = yield this.get('store').query('group', {
'nomen__icontains': term,
'status': 10,
'page_size': 1000,
'kind': kindInt,
});
return groups
}),
searchPerson: task(function* (term){
yield timeout(600);
return this.get('store').query('person', {
'nomen__icontains': term,
'page_size': 1000
})
.then((data) => data);
}),
actions: {
saveEntry(entry){
entry.save()
.then(() => {
this.get('flashMessages').success('Saved');
this.transitionToRoute('dashboard.session-manager.session.entries.entry', entry);
});
},
cancelEntry(){
this.get('model').deleteRecord();
this.transitionToRoute('dashboard.session-manager.session.entries.index');
},
willTransition() {
this._super(...arguments);
const record = this.get('model');
record.rollbackAttributes();
},
},
});
| import { inject as service } from '@ember/service';
import Controller from '@ember/controller';
import { task, timeout } from 'ember-concurrency';
export default Controller.extend({
flashMessages: service(),
searchGroup: task(function* (term){
yield timeout(600);
let kindOptions = {
'Chorus': 32,
'Quartet': 41,
};
let kindModel = this.get('model.session.kind');
let kindInt = kindOptions[kindModel];
let groups = yield this.get('store').query('group', {
'nomen__icontains': term,
'status__gt': 0,
'page_size': 1000,
'kind': kindInt,
});
return groups
}),
searchPerson: task(function* (term){
yield timeout(600);
return this.get('store').query('person', {
'nomen__icontains': term,
'page_size': 1000
})
.then((data) => data);
}),
actions: {
saveEntry(entry){
entry.save()
.then(() => {
this.get('flashMessages').success('Saved');
this.transitionToRoute('dashboard.session-manager.session.entries.entry', entry);
});
},
cancelEntry(){
this.get('model').deleteRecord();
this.transitionToRoute('dashboard.session-manager.session.entries.index');
},
willTransition() {
this._super(...arguments);
const record = this.get('model');
record.rollbackAttributes();
},
},
});
| Include exempt groups in search | Include exempt groups in search
| JavaScript | bsd-2-clause | barberscore/barberscore-web,barberscore/barberscore-web,barberscore/barberscore-web | ---
+++
@@ -14,7 +14,7 @@
let kindInt = kindOptions[kindModel];
let groups = yield this.get('store').query('group', {
'nomen__icontains': term,
- 'status': 10,
+ 'status__gt': 0,
'page_size': 1000,
'kind': kindInt,
}); |
9067165f7c34b397f227f76c042bbac248b55b52 | app/models/experiment-schema.server.model.js | app/models/experiment-schema.server.model.js | 'use strict';
/**
* Module dependencies.
*/
var mongoose = require('mongoose'),
Schema = mongoose.Schema,
MediaSchema = require('./media.server.model').schema,
_ = require('lodash');
/**
* ExperimentSchema Schema
*/
var ExperimentSchemaSchema = new Schema({
trialCount: {
type: Number,
required: true
},
mediaPool: [{
type: Schema.Types.ObjectId,
ref: 'Media'
}]
});
// Validator that requires the value is an array and contains at least one entry
function requiredArrayValidator(value) {
return Object.prototype.toString.call(value) === '[object Array]' && value.length > 0;
}
// Use the above validator for `mediaPool`
ExperimentSchemaSchema.path('mediaPool').validate(requiredArrayValidator);
ExperimentSchemaSchema.methods.buildExperiment = function(callback) {
// Populate mediaPool
this.populate('mediaPool');
var selectedMedia = _.sample(this.mediaPool, this.trialCount);
if (typeof callback === 'function') {
return callback(null, {media: selectedMedia});
} else {
return {media: selectedMedia};
}
};
// Register schema for `ExperimentSchema` model
mongoose.model('ExperimentSchema', ExperimentSchemaSchema); | 'use strict';
/**
* Module dependencies.
*/
var mongoose = require('mongoose'),
Schema = mongoose.Schema,
MediaSchema = require('./media.server.model').schema,
_ = require('lodash');
/**
* ExperimentSchema Schema
*/
var ExperimentSchemaSchema = new Schema({
structure: {},
sensors: [String],
trialCount: {
type: Number,
required: true
},
mediaPool: [{
type: Schema.Types.ObjectId,
ref: 'Media'
}]
});
// Validator that requires the value is an array and contains at least one entry
function requiredArrayValidator(value) {
return Object.prototype.toString.call(value) === '[object Array]' && value.length > 0;
}
// Use the above validator for `mediaPool`
ExperimentSchemaSchema.path('mediaPool').validate(requiredArrayValidator);
ExperimentSchemaSchema.methods.buildExperiment = function(callback) {
// Populate mediaPool
this.populate('mediaPool');
var selectedMedia = _.sample(this.mediaPool, this.trialCount);
var schemaSubset = {
_id: this._id,
structure: this.structure,
sensors: this.sensors,
media: selectedMedia,
};
if (typeof callback === 'function') {
return callback(null, schemaSubset);
} else {
return schemaSubset;
}
};
// Register schema for `ExperimentSchema` model
mongoose.model('ExperimentSchema', ExperimentSchemaSchema); | Return structure and sensors with ExperimentSchema | Return structure and sensors with ExperimentSchema
| JavaScript | mit | brennon/eim,brennon/eim,brennon/eim,brennon/eim | ---
+++
@@ -12,6 +12,8 @@
* ExperimentSchema Schema
*/
var ExperimentSchemaSchema = new Schema({
+ structure: {},
+ sensors: [String],
trialCount: {
type: Number,
required: true
@@ -37,10 +39,17 @@
var selectedMedia = _.sample(this.mediaPool, this.trialCount);
+ var schemaSubset = {
+ _id: this._id,
+ structure: this.structure,
+ sensors: this.sensors,
+ media: selectedMedia,
+ };
+
if (typeof callback === 'function') {
- return callback(null, {media: selectedMedia});
+ return callback(null, schemaSubset);
} else {
- return {media: selectedMedia};
+ return schemaSubset;
}
};
|
23223ca4b00a8cab8c2afe164fa86d45e8bc5bcf | src/common/components/GroupItem.js | src/common/components/GroupItem.js | import { List } from 'material-ui/List';
import React from 'react';
import { Link } from 'react-router';
import MemberItem from './MemberItem';
export default class GroupItem extends React.Component {
static propTypes = {
id: React.PropTypes.string,
isAdmin: React.PropTypes.bool,
isMember: React.PropTypes.bool,
name: React.PropTypes.string,
members: React.PropTypes.array,
}
renderHeader() {
if (this.props.isAdmin) {
return <h2><Link to={`/group/${this.props.id}`}>{this.props.name}</Link></h2>;
}
return <h2>{this.props.name}</h2>;
}
render() {
const members = this.props.members.filter(member => member.user);
if (!members.length) {
return null;
}
return (
<List>
{this.renderHeader()}
{members.sort((a, b) => a.user.name > b.user.name).map(member => <MemberItem
key={member.id}
isMember={this.props.isMember}
{...member}
/>)}
</List>
);
}
}
| import { List } from 'material-ui/List';
import Subheader from 'material-ui/Subheader';
import React from 'react';
import { Link } from 'react-router';
import MemberItem from './MemberItem';
export default class GroupItem extends React.Component {
static propTypes = {
id: React.PropTypes.string,
isAdmin: React.PropTypes.bool,
isMember: React.PropTypes.bool,
name: React.PropTypes.string,
members: React.PropTypes.array,
}
renderHeader() {
if (this.props.isAdmin) {
return <Subheader style={{ textTransform: 'uppercase' }}><Link to={`/group/${this.props.id}`}>{this.props.name}</Link></Subheader>;
}
return <Subheader style={{ textTransform: 'uppercase' }}>{this.props.name}</Subheader>;
}
render() {
const members = this.props.members.filter(member => member.user);
if (!members.length) {
return null;
}
return (
<List>
{this.renderHeader()}
{members.sort((a, b) => a.user.name > b.user.name).map(member => <MemberItem
key={member.id}
isMember={this.props.isMember}
{...member}
/>)}
</List>
);
}
}
| Use subheaders in member list | Use subheaders in member list
| JavaScript | agpl-3.0 | strekmann/nidarholmjs,strekmann/nidarholmjs,strekmann/nidarholmjs,strekmann/nidarholmjs | ---
+++
@@ -1,4 +1,5 @@
import { List } from 'material-ui/List';
+import Subheader from 'material-ui/Subheader';
import React from 'react';
import { Link } from 'react-router';
@@ -15,9 +16,9 @@
renderHeader() {
if (this.props.isAdmin) {
- return <h2><Link to={`/group/${this.props.id}`}>{this.props.name}</Link></h2>;
+ return <Subheader style={{ textTransform: 'uppercase' }}><Link to={`/group/${this.props.id}`}>{this.props.name}</Link></Subheader>;
}
- return <h2>{this.props.name}</h2>;
+ return <Subheader style={{ textTransform: 'uppercase' }}>{this.props.name}</Subheader>;
}
render() { |
976953f7392ac8d42105fc43a98be05dbd29d37d | src/components/MainHeader/index.js | src/components/MainHeader/index.js | import MainHeader from './MainHeader'
import Logo from './Logo'
import LogoText from './LogoText'
import Navbar from './Navbar'
import NavbarMenu from './NavbarMenu'
import SidebarToggle from './SidebarToggle'
import ControlSidebarToggle from './ControlSidebarToggle'
import Messages from './Messages'
import MessageItem from './MessageItem'
import Notifications from './Notifications'
import NotificationItem from './NotificationItem'
import Tasks from './Tasks'
import TaskItem from './TaskItem'
import User from './User'
import UserHeader from './UserHeader'
import UserBody from './UserBody'
import UserBodyItem from './UserBodyItem'
import UserFooter from './UserFooter'
import UserFooterItem from './UserFooterItem'
export default {
MainHeader,
Logo,
LogoText,
Navbar,
NavbarMenu,
SidebarToggle,
ControlSidebarToggle,
Messages,
MessageItem,
Notifications,
NotificationItem,
Tasks,
TaskItem,
User,
UserHeader,
UserBody,
UserBodyItem,
UserFooter,
UserFooterItem
}
| import MainHeader from './MainHeader'
import Logo from './Logo'
import LogoText from './LogoText'
import Navbar from './Navbar'
import NavbarMenu from './NavbarMenu'
import SidebarToggle from './SidebarToggle'
import ControlSidebarToggle from './ControlSidebarToggle'
import Messages from './Messages'
import MessageItem from './MessageItem'
import Notifications from './Notifications'
import NotificationItem from './NotificationItem'
import Tasks from './Tasks'
import TaskItem from './TaskItem'
import User from './User'
import UserHeader from './UserHeader'
import UserBody from './UserBody'
import UserBodyItem from './UserBodyItem'
import UserFooter from './UserFooter'
import UserFooterItem from './UserFooterItem'
MainHeader.MainHeader = MainHeader
MainHeader.Logo = Logo
MainHeader.LogoText = LogoText
MainHeader.Navbar = Navbar
MainHeader.NavbarMenu = NavbarMenu
MainHeader.SidebarToggle = SidebarToggle
MainHeader.ControlSidebarToggle = ControlSidebarToggle
MainHeader.Messages = Messages
MainHeader.MessageItem = MessageItem
MainHeader.Notifications = Notifications
MainHeader.NotificationItem = NotificationItem
MainHeader.Tasks = Tasks
MainHeader.TaskItem = TaskItem
MainHeader.User = User
MainHeader.UserHeader = UserHeader
MainHeader.UserBody = UserBody
MainHeader.UserBodyItem = UserBodyItem
MainHeader.UserFooter = UserFooter
MainHeader.UserFooterItem = UserFooterItem
export default MainHeader
| Change way of exports MainHeader Components | Change way of exports MainHeader Components
For: https://github.com/falmar/react-adm-lte/issues/2
| JavaScript | mit | falmar/react-adm-lte | ---
+++
@@ -18,24 +18,24 @@
import UserFooter from './UserFooter'
import UserFooterItem from './UserFooterItem'
-export default {
- MainHeader,
- Logo,
- LogoText,
- Navbar,
- NavbarMenu,
- SidebarToggle,
- ControlSidebarToggle,
- Messages,
- MessageItem,
- Notifications,
- NotificationItem,
- Tasks,
- TaskItem,
- User,
- UserHeader,
- UserBody,
- UserBodyItem,
- UserFooter,
- UserFooterItem
-}
+MainHeader.MainHeader = MainHeader
+MainHeader.Logo = Logo
+MainHeader.LogoText = LogoText
+MainHeader.Navbar = Navbar
+MainHeader.NavbarMenu = NavbarMenu
+MainHeader.SidebarToggle = SidebarToggle
+MainHeader.ControlSidebarToggle = ControlSidebarToggle
+MainHeader.Messages = Messages
+MainHeader.MessageItem = MessageItem
+MainHeader.Notifications = Notifications
+MainHeader.NotificationItem = NotificationItem
+MainHeader.Tasks = Tasks
+MainHeader.TaskItem = TaskItem
+MainHeader.User = User
+MainHeader.UserHeader = UserHeader
+MainHeader.UserBody = UserBody
+MainHeader.UserBodyItem = UserBodyItem
+MainHeader.UserFooter = UserFooter
+MainHeader.UserFooterItem = UserFooterItem
+
+export default MainHeader |
79e420facbf85e450abe75e73ab50966d3a0d8fd | app/assets/javascripts/whitehall.js | app/assets/javascripts/whitehall.js | jQuery(document).ready(function($) {
$(".flash.notice, .flash.alert").flashNotice();
// This is useful for toggling CSS helpers
// whilst developing.. cmd+G
var cmdDown = false;
$('body').keydown(function(event) {
if (event.keyCode == '91') {
cmdDown = true;
}
if (cmdDown && event.keyCode == '71') {
event.preventDefault();
$(this).toggleClass('dev');
}
}).keyup(function(event) {
if (event.keyCode == '91') {
cmdDown = false;
}
});
$(".chzn-select").chosen();
$("#completed_fact_check_requests").markLinkedAnchor();
$('fieldset.sortable legend').each(function () {
$(this).append(' (drag up and down to re-order)');
})
});
| jQuery(document).ready(function($) {
$(".flash.notice, .flash.alert").flashNotice();
// This is useful for toggling CSS helpers
// whilst developing.. cmd+G
var cmdDown = false;
$('body').keydown(function(event) {
if (event.keyCode == '91') {
cmdDown = true;
}
if (cmdDown && event.keyCode == '71') {
event.preventDefault();
$(this).toggleClass('dev');
}
}).keyup(function(event) {
if (event.keyCode == '91') {
cmdDown = false;
}
});
$(".chzn-select").chosen({allow_single_deselect: true});
$("#completed_fact_check_requests").markLinkedAnchor();
$('fieldset.sortable legend').each(function () {
$(this).append(' (drag up and down to re-order)');
})
});
| Allow de-select on single selects with a blank option. | Allow de-select on single selects with a blank option.
| JavaScript | mit | ggoral/whitehall,YOTOV-LIMITED/whitehall,askl56/whitehall,YOTOV-LIMITED/whitehall,robinwhittleton/whitehall,alphagov/whitehall,alphagov/whitehall,askl56/whitehall,ggoral/whitehall,ggoral/whitehall,askl56/whitehall,hotvulcan/whitehall,robinwhittleton/whitehall,robinwhittleton/whitehall,alphagov/whitehall,alphagov/whitehall,hotvulcan/whitehall,YOTOV-LIMITED/whitehall,ggoral/whitehall,askl56/whitehall,YOTOV-LIMITED/whitehall,hotvulcan/whitehall,hotvulcan/whitehall,robinwhittleton/whitehall | ---
+++
@@ -18,7 +18,7 @@
}
});
- $(".chzn-select").chosen();
+ $(".chzn-select").chosen({allow_single_deselect: true});
$("#completed_fact_check_requests").markLinkedAnchor();
|
1de53839f2cd6677b4851328727c79268ebaa278 | app/feeds/new/add-operator/route.js | app/feeds/new/add-operator/route.js | import Ember from 'ember';
export default Ember.Route.extend({
createFeedFromGtfsService: Ember.inject.service('create-feed-from-gtfs'),
beforeModel: function(transition) {
var controller = this;
var feedModel = this.get('createFeedFromGtfsService').feedModel;
var url = feedModel.get('url');
var adapter = this.get('store').adapterFor('feeds');
var fetch_info_url = adapter.urlPrefix()+'/feeds/fetch_info';
var promise = adapter.ajax(fetch_info_url, 'post', {data:{url:url}});
promise.then(function(response) {
if (response.status == 'complete') {
feedModel.set('id', response.feed.onestop_id);
feedModel.set('operators_in_feed', response.feed.operators_in_feed);
response.operators.map(function(operator){feedModel.addOperator(operator)});
return feedModel;
} else if (response.status == 'processing') {
transition.abort();
return Ember.run.later(controller, function(){
transition.retry();
}, 1000);
}
}).catch(function(error) {
error.errors.forEach(function(error){
feedModel.get('errors').add('url', error.message);
});
});
return promise;
},
model: function() {
return this.get('createFeedFromGtfsService').feedModel;
},
actions: {
error: function(error, transition) {
return this.transitionTo('feeds.new');
}
}
});
| import Ember from 'ember';
export default Ember.Route.extend({
createFeedFromGtfsService: Ember.inject.service('create-feed-from-gtfs'),
beforeModel: function(transition) {
var controller = this;
var feedModel = this.get('createFeedFromGtfsService').feedModel;
var url = feedModel.get('url');
var adapter = this.get('store').adapterFor('feeds');
var fetch_info_url = adapter.urlPrefix()+'/feeds/fetch_info';
var promise = adapter.ajax(fetch_info_url, 'post', {data:{url:url}});
promise.then(function(response) {
if (response.status == 'complete') {
feedModel.set('id', response.feed.onestop_id);
feedModel.set('operators_in_feed', response.feed.operators_in_feed);
response.operators.map(function(operator){feedModel.addOperator(operator)});
return feedModel;
} else {
transition.abort();
return Ember.run.later(controller, function(){
transition.retry();
}, 1000);
}
}).catch(function(error) {
error.errors.forEach(function(error){
feedModel.get('errors').add('url', error.message);
});
});
return promise;
},
model: function() {
return this.get('createFeedFromGtfsService').feedModel;
},
actions: {
error: function(error, transition) {
return this.transitionTo('feeds.new');
}
}
});
| Allow additional response states (queued, downloading, processing) | Allow additional response states (queued, downloading, processing)
| JavaScript | mit | transitland/feed-registry,transitland/feed-registry | ---
+++
@@ -15,7 +15,7 @@
feedModel.set('operators_in_feed', response.feed.operators_in_feed);
response.operators.map(function(operator){feedModel.addOperator(operator)});
return feedModel;
- } else if (response.status == 'processing') {
+ } else {
transition.abort();
return Ember.run.later(controller, function(){
transition.retry();
@@ -23,7 +23,7 @@
}
}).catch(function(error) {
error.errors.forEach(function(error){
- feedModel.get('errors').add('url', error.message);
+ feedModel.get('errors').add('url', error.message);
});
});
return promise; |
f243ee0236cc8899c1286e853603777a3940c2c3 | blueprints/ember-cli-paint/index.js | blueprints/ember-cli-paint/index.js | 'use strict';
module.exports = {
normalizeEntityName: function() {},
afterInstall: function() {
return this.addPackagesToProject([
{ name: 'liquid-fire', target: '0.15.0' }
]).then(function() {
return this.addBowerPackagesToProject([
{ name: 'paint', target: '0.6.10' },
{ name: 'spinjs', target: '2.0.1' }
]).then(function() {
return this.insertIntoFile('.jshintrc', ' "Spinner": true,', { after: '"predef": {\n' } );
}.bind(this));
}.bind(this));
}
}
| 'use strict';
module.exports = {
normalizeEntityName: function() {},
afterInstall: function() {
return this.addPackagesToProject([
{ name: 'liquid-fire', target: '0.17.1' },
{ name: 'ember-rl-dropdown', target: 'git+https://git@github.com/alphasights/ember-rl-dropdown.git' },
{ name: 'ember-cli-tooltipster', target: '0.0.6' }
]).then(function() {
return this.addBowerPackagesToProject([
{ name: 'paint', target: '0.6.10' },
{ name: 'spinjs', target: '2.0.1' }
]).then(function() {
return this.insertIntoFile('.jshintrc', ' "Spinner": true,', { after: '"predef": {\n' } );
}.bind(this));
}.bind(this));
}
}
| Add rl-dropdown and tooltipster addons to afterInstall hook | Add rl-dropdown and tooltipster addons to afterInstall hook
| JavaScript | mit | alphasights/ember-cli-paint,alphasights/ember-cli-paint | ---
+++
@@ -5,7 +5,9 @@
afterInstall: function() {
return this.addPackagesToProject([
- { name: 'liquid-fire', target: '0.15.0' }
+ { name: 'liquid-fire', target: '0.17.1' },
+ { name: 'ember-rl-dropdown', target: 'git+https://git@github.com/alphasights/ember-rl-dropdown.git' },
+ { name: 'ember-cli-tooltipster', target: '0.0.6' }
]).then(function() {
return this.addBowerPackagesToProject([
{ name: 'paint', target: '0.6.10' }, |
88a1f0ad4fe017951e6ee12d2ffd06b9faa63852 | src/core/texture.js | src/core/texture.js | let gpu = null;
module.exports = class Texture {
/**
* @desc WebGl Texture implementation in JS
* @constructor Texture
* @param {Object} texture
* @param {Array} size
* @param {Array} dimensions
* @param {Object} webGl
*/
constructor(texture, size, dimensions, webGl) {
this.texture = texture;
this.size = size;
this.dimensions = dimensions;
this.webGl = webGl;
}
/**
* @name toArray
* @function
* @memberOf Texture#
*
* @desc Converts the Texture into a JavaScript Array.
*
* @param {Object} The `gpu` Object
*
*/
toArray(gpu) {
const copy = gpu.createKernel(function(x) {
return x[this.thread.z][this.thread.y][this.thread.x];
}).setDimensions(this.dimensions);
return copy(this);
}
/**
* @name delete
* @desc Deletes the Texture.
* @function
* @memberOf Texture#
*
*
*/
delete() {
return this.webGl.deleteTexture(this.texture);
}
}; | let gpu = null;
module.exports = class Texture {
/**
* @desc WebGl Texture implementation in JS
* @constructor Texture
* @param {Object} texture
* @param {Array} size
* @param {Array} dimensions
* @param {Object} webGl
*/
constructor(texture, size, dimensions, webGl) {
this.texture = texture;
this.size = size;
this.dimensions = dimensions;
this.webGl = webGl;
}
/**
* @name toArray
* @function
* @memberOf Texture#
*
* @desc Converts the Texture into a JavaScript Array.
*
* @param {Object} The `gpu` Object
*
*/
toArray(gpu) {
if(!gpu) throw new Error('You need to pass the GPU object for toArray to work.');
const copy = gpu.createKernel(function(x) {
return x[this.thread.z][this.thread.y][this.thread.x];
}).setDimensions(this.dimensions);
return copy(this);
}
/**
* @name delete
* @desc Deletes the Texture.
* @function
* @memberOf Texture#
*
*
*/
delete() {
return this.webGl.deleteTexture(this.texture);
}
}; | Throw error if GPU object not passed | Throw error if GPU object not passed
| JavaScript | mit | abhisheksoni27/gpu.js,gpujs/gpu.js,gpujs/gpu.js | ---
+++
@@ -28,6 +28,7 @@
*
*/
toArray(gpu) {
+ if(!gpu) throw new Error('You need to pass the GPU object for toArray to work.');
const copy = gpu.createKernel(function(x) {
return x[this.thread.z][this.thread.y][this.thread.x];
}).setDimensions(this.dimensions); |
1007897ded24181fe74d7ee6e11c101afbd68bca | redux/main.js | redux/main.js | import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
// import {createStore} from 'redux';
// ReactDOM.render(<App />, document.getElementById('app'));
const counter = (state = 0, action) => {
switch(action.type) {
case 'INCREMENT':
return state + 1;
case 'DECREMENT':
return state - 1;
default:
return state;
}
}
const createStore = (render) => {
let state;
let listeners = [];
const getState = () => state;
const = (action) => {
state = render(state, action);
listeners.forEach(listener => listener());
};
const subscribe = (listener) => {
listeners.push(listener);
return () => {
listeners = listeners.filter(l => l !== listener);
}
};
dispatch({});
return {getState, dispatch, subscribe};
}
const store = createStore(counter);
// This is the callback for store
// whenver there is an dispatcher event.
const render = () => {
document.body.innerText = store.getState();
if (store.getState() === 10) {
// Unsubscribe!!
subsciption();
}
};
var subsciption = store.subscribe(render);
render();
document.addEventListener('click', () => {
store.dispatch({type: 'INCREMENT'});
});
| import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
// import {createStore} from 'redux';
// ReactDOM.render(<App />, document.getElementById('app'));
const counter = (state = 0, action) => {
switch(action.type) {
case 'INCREMENT':
return state + 1;
case 'DECREMENT':
return state - 1;
default:
return state;
}
}
const createStore = (render) => {
let state;
let listeners = [];
const getState = () => state;
const dispatch = (action) => {
state = render(state, action);
listeners.forEach(listener => listener());
};
const subscribe = (listener) => {
listeners.push(listener);
return () => {
listeners = listeners.filter(l => l !== listener);
}
};
dispatch({});
return {getState, dispatch, subscribe};
}
const store = createStore(counter);
// This is the callback for store
// whenver there is an dispatcher event.
const render = () => {
document.body.innerText = store.getState();
if (store.getState() === 10) {
// Unsubscribe!!
subsciption();
}
};
var subsciption = store.subscribe(render);
render();
document.addEventListener('click', () => {
store.dispatch({type: 'INCREMENT'});
});
| Create our own createStore and fix typo | Redux: Create our own createStore and fix typo
| JavaScript | mit | gongmingqm10/EggHead,gongmingqm10/EggHead,gongmingqm10/EggHead,gongmingqm10/EggHead | ---
+++
@@ -22,7 +22,7 @@
const getState = () => state;
- const = (action) => {
+ const dispatch = (action) => {
state = render(state, action);
listeners.forEach(listener => listener());
}; |
553838d49c22388ce2d7bffcfe5647c7ffb8c702 | modes/fast.js | modes/fast.js | var VML = require('./vml');
var Canvas = require('./canvas');
//var Flash = require('./flash');
var hasCanvas = function(){
var canvas = document.createElement('canvas');
return canvas && !!canvas.getContext;
};
/*
var hasFlash = function(){
var flash = navigator.plugins && navigator.plugins['Shockwave Flash'];
try {
flash = flash ? flash.description :
new ActiveXObject('ShockwaveFlash.ShockwaveFlash')
.GetVariable('$version');
} catch (x){ }
return flash && flash.match(/\d+/) >= 9;
};
*/
var MODE = hasCanvas() ? Canvas : /*hasFlash() ? Flash :*/ VML;
exports.Surface = MODE.Surface;
exports.Path = MODE.Path;
exports.Shape = MODE.Shape;
exports.Group = MODE.Group;
exports.ClippingRectangle = MODE.ClippingRectangle;
exports.Text = MODE.Text;
require('./current').setCurrent(exports);
| var VML = require('./vml');
var Canvas = require('./canvas');
var Base = require('./canvas/base');
//var Flash = require('./flash');
/*
var hasFlash = function(){
var flash = navigator.plugins && navigator.plugins['Shockwave Flash'];
try {
flash = flash ? flash.description :
new ActiveXObject('ShockwaveFlash.ShockwaveFlash')
.GetVariable('$version');
} catch (x){ }
return flash && flash.match(/\d+/) >= 9;
};
*/
var MODE = Base._genericContext ? Canvas : /*hasFlash() ? Flash :*/ VML;
exports.Surface = MODE.Surface;
exports.Path = MODE.Path;
exports.Shape = MODE.Shape;
exports.Group = MODE.Group;
exports.ClippingRectangle = MODE.ClippingRectangle;
exports.Text = MODE.Text;
require('./current').setCurrent(exports);
| Use an existing check for canvas capabilities | Use an existing check for canvas capabilities
This results in better compatability with jsdom, allows usage in newer
Jest.
| JavaScript | mit | sebmarkbage/art,sebmarkbage/art | ---
+++
@@ -1,13 +1,7 @@
var VML = require('./vml');
var Canvas = require('./canvas');
+var Base = require('./canvas/base');
//var Flash = require('./flash');
-
-var hasCanvas = function(){
-
- var canvas = document.createElement('canvas');
- return canvas && !!canvas.getContext;
-
-};
/*
var hasFlash = function(){
@@ -23,7 +17,7 @@
};
*/
-var MODE = hasCanvas() ? Canvas : /*hasFlash() ? Flash :*/ VML;
+var MODE = Base._genericContext ? Canvas : /*hasFlash() ? Flash :*/ VML;
exports.Surface = MODE.Surface;
exports.Path = MODE.Path; |
b9b4fe4916b07ddffbdb05f781dc5ba3a32812a3 | test/karma.conf.js | test/karma.conf.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/js/**/*.js',
'test/unit/**/*.js'
],
autoWatch : true,
frameworks: ['jasmine'],
browsers : ['PhantomJS'],
hostname: process.env.IP,
port: process.env.PORT,
plugins : [
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-jasmine',
'karma-junit-reporter',
'karma-phantomjs-launcher'
],
junitReporter : {
outputFile: 'test_out/unit.xml',
suite: 'unit'
},
});
};
| 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/js/**/*.js',
'test/unit/**/*.js'
],
autoWatch : true,
frameworks: ['jasmine'],
browsers : ['PhantomJS'],
hostname: process.env.IP || 'localhost',
port: process.env.PORT || '9876',
plugins : [
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-jasmine',
'karma-junit-reporter',
'karma-phantomjs-launcher'
],
junitReporter : {
outputFile: 'test_out/unit.xml',
suite: 'unit'
},
});
};
| Set defaults for karma server | Set defaults for karma server
| JavaScript | mit | double16/switchmin-ng,double16/switchmin-ng | ---
+++
@@ -16,8 +16,8 @@
frameworks: ['jasmine'],
browsers : ['PhantomJS'],
- hostname: process.env.IP,
- port: process.env.PORT,
+ hostname: process.env.IP || 'localhost',
+ port: process.env.PORT || '9876',
plugins : [
'karma-chrome-launcher', |
b8acc48fd3764fad74b9a53a9eb5ab91522a4eb0 | packages/@angular/cli/blueprints/ng/files/__path__/app/app.component.ts | packages/@angular/cli/blueprints/ng/files/__path__/app/app.component.ts | import { Component } from '@angular/core';
@Component({
selector: '<%= prefix %>-root',<% if (inlineTemplate) { %>
template: `
<h1>
{{title}}
</h1><% if (routing) { %>
<router-outlet></router-outlet><% } %>
`,<% } else { %>
templateUrl: './app.component.html',<% } %><% if (inlineStyle) { %>
styles: []<% } else { %>
styleUrls: ['./app.component.<%= styleExt %>']<% } %>
})
export class AppComponent {
title = '<%= prefix %>';
}
| import { Component } from '@angular/core';
@Component({
selector: '<%= prefix %>-root',<% if (inlineTemplate) { %>
template: `
<h1>
Welcome to {{title}}!!
</h1><% if (routing) { %>
<router-outlet></router-outlet><% } %>
`,<% } else { %>
templateUrl: './app.component.html',<% } %><% if (inlineStyle) { %>
styles: []<% } else { %>
styleUrls: ['./app.component.<%= styleExt %>']<% } %>
})
export class AppComponent {
title = '<%= prefix %>';
}
| Make generated inline template conform to test case | fix(@angular/cli): Make generated inline template conform to test case
The generated app component spec checks for the string "Welcome to {{title}}!!", which is only output by the generated `app.component.htm`l file, not the generated inline template in `app.component.ts` when the `--inline-template` option is passed to the `ng new` command. This causes a test failure when generating a new app with `--inline-template`. | TypeScript | mit | geofffilippi/angular-cli,pedroapy/angular-cli,beeman/angular-cli,catull/angular-cli,garoyeri/angular-cli,catull/angular-cli,beeman/angular-cli,maxime1992/angular-cli,beeman/angular-cli,hansl/angular-cli,manekinekko/angular-cli,garoyeri/angular-cli,nwronski/angular-cli,DevIntent/angular-cli,angular/angular-cli,angular/angular-cli,DevIntent/angular-cli,ocombe/angular-cli,intellix/angular-cli,mham/angular-cli,pedroapy/angular-cli,filipesilva/angular-cli,catull/angular-cli,nickroberts/angular-cli,beeman/angular-cli,ocombe/angular-cli,Brocco/angular-cli,DevIntent/angular-cli,geofffilippi/angular-cli,intellix/angular-cli,RicardoVaranda/angular-cli,escorp/angular-cli,ocombe/angular-cli,geofffilippi/angular-cli,Brocco/angular-cli,nickroberts/angular-cli,intellix/angular-cli,RicardoVaranda/angular-cli,clydin/angular-cli,manekinekko/angular-cli,maxime1992/angular-cli,catull/angular-cli,escorp/angular-cli,dzonatan/angular-cli,mham/angular-cli,dzonatan/angular-cli,manekinekko/angular-cli,hansl/angular-cli,DevIntent/angular-cli,filipesilva/angular-cli,Brocco/angular-cli,filipesilva/angular-cli,filipesilva/angular-cli,DevIntent/angular-cli,ocombe/angular-cli,Brocco/angular-cli,nwronski/angular-cli,geofffilippi/angular-cli,vsavkin/angular-cli,nickroberts/angular-cli,dzonatan/angular-cli,Brocco/angular-cli,vsavkin/angular-cli,angular/angular-cli,angular/angular-cli,escorp/angular-cli,hansl/angular-cli,ocombe/angular-cli,RicardoVaranda/angular-cli,garoyeri/angular-cli,nwronski/angular-cli,pedroapy/angular-cli,maxime1992/angular-cli,vsavkin/angular-cli,clydin/angular-cli,mham/angular-cli,clydin/angular-cli,hansl/angular-cli,clydin/angular-cli | ---
+++
@@ -4,7 +4,7 @@
selector: '<%= prefix %>-root',<% if (inlineTemplate) { %>
template: `
<h1>
- {{title}}
+ Welcome to {{title}}!!
</h1><% if (routing) { %>
<router-outlet></router-outlet><% } %>
`,<% } else { %> |
bd0b09e0c24d7ec00f4181661c1644ebc5891d82 | src/app/router.animations.ts | src/app/router.animations.ts | /**
* Code is from https://medium.com/google-developer-experts/
* angular-supercharge-your-router-transitions-using-new-animation-features-v4-3-3eb341ede6c8
*/
import {
sequence,
trigger,
stagger,
animate,
style,
group,
query,
transition,
keyframes,
animateChild } from '@angular/animations';
export const routerTransition = trigger('routerTransition', [
transition('* => *', [
query(':enter, :leave', style({ position: 'fixed', width: '100%' }), {optional: true}),
query(':enter', style({ transform: 'translateX(100%)' }), {optional: true}),
sequence([
query(':leave', animateChild(), {optional: true}),
group([
query(':leave', [
style({ transform: 'translateX(0%)' }),
animate('500ms cubic-bezier(.75,-0.48,.26,1.52)',
style({ transform: 'translateX(-100%)' }))
], {optional: true}),
query(':enter', [
style({ transform: 'translateX(100%)' }),
animate('500ms cubic-bezier(.75,-0.48,.26,1.52)',
style({ transform: 'translateX(0%)' }))
], {optional: true}),
]),
query(':enter', animateChild(), {optional: true})
])
])
]);
| /**
* Code is from https://medium.com/google-developer-experts/
* angular-supercharge-your-router-transitions-using-new-animation-features-v4-3-3eb341ede6c8
*/
import {
sequence,
trigger,
stagger,
animate,
style,
group,
query,
transition,
keyframes,
animateChild } from '@angular/animations';
export const routerTransition = trigger('routerTransition', [
transition('* => *', [
query(':enter, :leave', style({ position: 'fixed', width: '100%' }), {optional: true}),
query(':enter', style({ opacity: 0 }), {optional: true}),
sequence([
query(':leave', animateChild(), {optional: true}),
group([
query(':leave', [
style({ opacity: 1 }),
animate('500ms cubic-bezier(.75,-0.48,.26,1.52)',
style({ opacity: 0 }))
], {optional: true}),
query(':enter', [
style({ opacity: 0 }),
animate('500ms cubic-bezier(.75,-0.48,.26,1.52)',
style({ opacity: 1 }))
], {optional: true}),
]),
query(':enter', animateChild(), {optional: true})
])
])
]);
| Change transition default animation from slide to fade | Change transition default animation from slide to fade
| TypeScript | mit | sebastienbarbier/sebastienbarbier.com,sebastienbarbier/sebastienbarbier.com,sebastienbarbier/sebastienbarbier.com,sebastienbarbier/sebastienbarbier.com | ---
+++
@@ -17,19 +17,19 @@
export const routerTransition = trigger('routerTransition', [
transition('* => *', [
query(':enter, :leave', style({ position: 'fixed', width: '100%' }), {optional: true}),
- query(':enter', style({ transform: 'translateX(100%)' }), {optional: true}),
+ query(':enter', style({ opacity: 0 }), {optional: true}),
sequence([
query(':leave', animateChild(), {optional: true}),
group([
query(':leave', [
- style({ transform: 'translateX(0%)' }),
+ style({ opacity: 1 }),
animate('500ms cubic-bezier(.75,-0.48,.26,1.52)',
- style({ transform: 'translateX(-100%)' }))
+ style({ opacity: 0 }))
], {optional: true}),
query(':enter', [
- style({ transform: 'translateX(100%)' }),
+ style({ opacity: 0 }),
animate('500ms cubic-bezier(.75,-0.48,.26,1.52)',
- style({ transform: 'translateX(0%)' }))
+ style({ opacity: 1 }))
], {optional: true}),
]),
query(':enter', animateChild(), {optional: true}) |
9fcd52394dd4478df3506c49587aedf646403fbd | static/js/common.ts | static/js/common.ts | /// <reference path="./typings/index.d.ts"/>
requirejs.config({
"baseUrl": "/js/",
"paths": {
"bootstrap": "https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.min",
"chartjs": "https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.6/Chart.min",
"es6-shim": "https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.35.1/es6-shim.min",
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min",
"jquery-bez": "https://cdn.jsdelivr.net/jquery.bez/1.0.11/jquery.bez.min",
"jquery-noisy": "https://cdnjs.cloudflare.com/ajax/libs/noisy/1.2/jquery.noisy.min",
"jquery-ui": "https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min",
"moment": "https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.14.1/moment.min"
},
"shim": {
"jquery": {
"exports": "$"
}
}
});
| /// <reference path="./typings/index.d.ts"/>
requirejs.config({
"baseUrl": "/js/",
"paths": {
"bootstrap": "https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.min",
"chartjs": "https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.1.6/Chart.min",
"es6-shim": "https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.35.1/es6-shim.min",
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min",
"jquery-bez": "https://cdn.jsdelivr.net/jquery.bez/1.0.11/jquery.bez.min",
"jquery-noisy": "https://cdnjs.cloudflare.com/ajax/libs/noisy/1.2/jquery.noisy.min",
"jquery-ui": "https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min",
"kute": "https://cdn.jsdelivr.net/kute.js/1.5.0/kute.min",
"kute-jquery": "https://cdn.jsdelivr.net/kute.js/1.5.0/kute-jquery.min",
"kute-svg": "https://cdn.jsdelivr.net/kute.js/1.5.0/kute-svg.min",
"moment": "https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.14.1/moment.min"
},
"shim": {
"jquery": {
"exports": "$"
}
}
});
| Add kute, kute-jquery, and kute-svg | Add kute, kute-jquery, and kute-svg
| TypeScript | mit | crossroads-education/eta-front,crossroads-education/eta-front | ---
+++
@@ -10,6 +10,9 @@
"jquery-bez": "https://cdn.jsdelivr.net/jquery.bez/1.0.11/jquery.bez.min",
"jquery-noisy": "https://cdnjs.cloudflare.com/ajax/libs/noisy/1.2/jquery.noisy.min",
"jquery-ui": "https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min",
+ "kute": "https://cdn.jsdelivr.net/kute.js/1.5.0/kute.min",
+ "kute-jquery": "https://cdn.jsdelivr.net/kute.js/1.5.0/kute-jquery.min",
+ "kute-svg": "https://cdn.jsdelivr.net/kute.js/1.5.0/kute-svg.min",
"moment": "https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.14.1/moment.min"
},
"shim": { |
a75469eeb366388ed114e796992686685e9d67e3 | src/app/header/header.component.ts | src/app/header/header.component.ts | import { Component, EventEmitter, Output, ViewEncapsulation } from '@angular/core';
@Component({
selector: 'app-header',
templateUrl: './header.component.html',
styleUrls: ['./header.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class HeaderComponent {
@Output() navToggled = new EventEmitter();
navOpen: boolean = false;
toggleNav() {
this.navOpen = !this.navOpen;
this.navToggled.emit(this.navOpen);
}
}
| import { Component, ViewEncapsulation, Output, EventEmitter } from '@angular/core';
@Component({
selector: 'app-header',
templateUrl: './header.component.html',
styleUrls: ['./header.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class HeaderComponent {
@Output() navToggled = new EventEmitter();
navOpen: boolean = false;
toggleNav() {
this.navOpen = !this.navOpen;
this.navToggled.emit(this.navOpen);
}
}
| Change order of imports in header class for better logical ordering. | Change order of imports in header class for better logical ordering.
| TypeScript | mit | auth0-blog/ng2-dinos,auth0-blog/ng2-dinos,kmaida/ng2-dinos,kmaida/ng2-dinos,kmaida/ng2-dinos,auth0-blog/ng2-dinos | ---
+++
@@ -1,4 +1,4 @@
-import { Component, EventEmitter, Output, ViewEncapsulation } from '@angular/core';
+import { Component, ViewEncapsulation, Output, EventEmitter } from '@angular/core';
@Component({
selector: 'app-header', |
3c0c8e9afbe0a8c3e4615a1540d3365ffb554ea5 | appsrc/reducers/system.ts | appsrc/reducers/system.ts |
import os from "../util/os";
import {app} from "../electron";
import {handleActions} from "redux-actions";
import {
IAction,
ILanguageSniffedPayload,
IFreeSpaceUpdatedPayload,
} from "../constants/action-types";
import {ISystemState} from "../types";
const initialState = {
appVersion: app.getVersion(),
osx: (os.platform() === "darwin"),
macos: (os.platform() === "darwin"),
windows: (os.platform() === "win32"),
linux: (os.platform() === "linux"),
sniffedLanguage: null,
homePath: app.getPath("home"),
userDataPath: app.getPath("userData"),
diskInfo: {
parts: [],
total: {
free: 0,
size: 0,
},
},
} as ISystemState;
export default handleActions<ISystemState, any>({
LANGUAGE_SNIFFED: (state: ISystemState, action: IAction<ILanguageSniffedPayload>) => {
const sniffedLanguage = action.payload;
return Object.assign({}, state, {sniffedLanguage});
},
FREE_SPACE_UPDATED: (state: ISystemState, action: IAction<IFreeSpaceUpdatedPayload>) => {
const {diskInfo} = action.payload;
return Object.assign({}, state, {diskInfo});
},
}, initialState);
|
import os from "../util/os";
import {app} from "../electron";
import {handleActions} from "redux-actions";
import {
IAction,
ILanguageSniffedPayload,
IFreeSpaceUpdatedPayload,
} from "../constants/action-types";
import {ISystemState} from "../types";
const initialState = {
appVersion: app.getVersion(),
osx: (os.platform() === "darwin"),
macos: (os.platform() === "darwin"),
windows: (os.platform() === "win32"),
linux: (os.platform() === "linux"),
sniffedLanguage: null,
homePath: app.getPath("home"),
userDataPath: app.getPath("userData"),
diskInfo: {
parts: [],
total: {
free: 0,
size: 0,
},
},
} as ISystemState;
export default handleActions<ISystemState, any>({
LANGUAGE_SNIFFED: (state: ISystemState, action: IAction<ILanguageSniffedPayload>) => {
const sniffedLanguage: string = action.payload.lang;
return Object.assign({}, state, {sniffedLanguage});
},
FREE_SPACE_UPDATED: (state: ISystemState, action: IAction<IFreeSpaceUpdatedPayload>) => {
const {diskInfo} = action.payload;
return Object.assign({}, state, {diskInfo});
},
}, initialState);
| Fix sniffed language reducer (need object rest spread real bad..) | :bug: Fix sniffed language reducer (need object rest spread real bad..)
| TypeScript | mit | itchio/itch,itchio/itchio-app,itchio/itch,leafo/itchio-app,itchio/itch,leafo/itchio-app,itchio/itch,itchio/itchio-app,itchio/itch,itchio/itchio-app,leafo/itchio-app,itchio/itch | ---
+++
@@ -31,7 +31,7 @@
export default handleActions<ISystemState, any>({
LANGUAGE_SNIFFED: (state: ISystemState, action: IAction<ILanguageSniffedPayload>) => {
- const sniffedLanguage = action.payload;
+ const sniffedLanguage: string = action.payload.lang;
return Object.assign({}, state, {sniffedLanguage});
},
|
95fc6bf1d3e0713db8cde9ea82028e87a4cc73a2 | src/dockerValidatorSettings.ts | src/dockerValidatorSettings.ts | import { ValidationSeverity } from './dockerValidator';
export interface ValidatorSettings {
deprecatedMaintainer?: ValidationSeverity;
directiveCasing?: ValidationSeverity;
instructionCasing?: ValidationSeverity;
} | /* --------------------------------------------------------------------------------------------
* Copyright (c) Remy Suen. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
* ------------------------------------------------------------------------------------------ */
import { ValidationSeverity } from './dockerValidator';
export interface ValidatorSettings {
deprecatedMaintainer?: ValidationSeverity;
directiveCasing?: ValidationSeverity;
instructionCasing?: ValidationSeverity;
} | Add a missing license header | Add a missing license header
Signed-off-by: Remy Suen <553f7e7fc51e9ff47ae89d5a0ebd06651241b998@gmail.com>
| TypeScript | mit | rcjsuen/dockerfile-language-server-nodejs,rcjsuen/dockerfile-language-server-nodejs | ---
+++
@@ -1,3 +1,7 @@
+/* --------------------------------------------------------------------------------------------
+ * Copyright (c) Remy Suen. All rights reserved.
+ * Licensed under the MIT License. See License.txt in the project root for license information.
+ * ------------------------------------------------------------------------------------------ */
import { ValidationSeverity } from './dockerValidator';
export interface ValidatorSettings { |
7290d82d052af5187c3d7accd423da74804e63ee | index.d.ts | index.d.ts | declare const _fetch: typeof fetch;
declare module 'fetch-retry' {
type RequestDelayFunction = ((
attempt: number,
error: Error | null,
response: Response | null
) => number);
type RequestRetryOnFunction = ((
attempt: number,
error: Error | null,
response: Response | null
) => boolean);
interface IRequestInitWithRetry extends RequestInit {
retries?: number;
retryDelay?: number | RequestDelayFunction;
retryOn?: number[] | RequestRetryOnFunction;
}
function fetchBuilder(fetch: typeof _fetch): ((input: RequestInfo, options?: IRequestInitWithRetry | undefined) => Promise<Response>);
export = fetchBuilder;
} | declare const _fetch: typeof fetch;
declare module 'fetch-retry' {
type RequestDelayFunction = ((
attempt: number,
error: Error | null,
response: Response | null
) => number);
type RequestRetryOnFunction = ((
attempt: number,
error: Error | null,
response: Response | null
) => boolean);
interface IRequestInitWithRetry extends RequestInit {
retries?: number;
retryDelay?: number | RequestDelayFunction;
retryOn?: number[] | RequestRetryOnFunction;
}
function fetchBuilder(fetch: typeof _fetch): ((input: RequestInfo, init?: IRequestInitWithRetry) => Promise<Response>);
export = fetchBuilder;
} | Fix type by removing unnecessary type | Fix type by removing unnecessary type
| TypeScript | mit | jonbern/fetch-retry,jonbern/fetch-retry | ---
+++
@@ -19,6 +19,6 @@
retryOn?: number[] | RequestRetryOnFunction;
}
- function fetchBuilder(fetch: typeof _fetch): ((input: RequestInfo, options?: IRequestInitWithRetry | undefined) => Promise<Response>);
+ function fetchBuilder(fetch: typeof _fetch): ((input: RequestInfo, init?: IRequestInitWithRetry) => Promise<Response>);
export = fetchBuilder;
} |
f72634441cde10626729ecbc6e93ebaa77c10af3 | src/api/index.ts | src/api/index.ts | import { Controller, Get } from 'routing-controllers';
@Controller()
export default class IndexController {
@Get('/health')
public health() {
return { status: 'OK' };
}
}
| import { Controller, Get } from 'routing-controllers';
@Controller()
export default class IndexController {
@Get('/health')
public health() {
return { status: 'OK' };
}
// Loader.io only
@Get('/loaderio-deb75e3581d893735fd6e5050757bdb2')
public loaderio() {
return true;
}
}
| Add Loader IO route verification | Add Loader IO route verification
| TypeScript | mit | rafaell-lycan/sabesp-mananciais-api,rafaell-lycan/sabesp-mananciais-api | ---
+++
@@ -6,4 +6,10 @@
public health() {
return { status: 'OK' };
}
+
+ // Loader.io only
+ @Get('/loaderio-deb75e3581d893735fd6e5050757bdb2')
+ public loaderio() {
+ return true;
+ }
} |
60d39ef5769e0b07de918dc958e38d557855c2b1 | src/app/cardsView/services/base-card.service.ts | src/app/cardsView/services/base-card.service.ts | /**
* Created by wiekonek on 13.12.16.
*/
import {Http, RequestOptions, URLSearchParams} from "@angular/http";
import {Observable} from "rxjs";
import {AppAuthenticationService} from "../../app-authentication.service";
import {PaginateResponse} from "./paginate-response";
import {Card} from "../../card/card";
export abstract class BaseCardService {
constructor(protected http: Http, protected pluginAuth: AppAuthenticationService) {}
protected _get<T>(path: string, params?: URLSearchParams): Observable<T> {
let req = new RequestOptions({search: this.pluginAuth.RequestOptionsWithPluginAuthentication.search});
if(params != null)
req.search.appendAll(params);
return this.http
.get(path, req)
.map(res => res.json());
}
protected _getPage<T extends Card>(path: string, page: number, size: number): Observable<PaginateResponse<T>> {
return this._get(path, this.paginationParams(page, size));
}
private paginationParams(page: number, size: number): URLSearchParams {
let params = new URLSearchParams();
params.append('page', page.toString());
params.append('size', size.toString());
return params;
}
}
| /**
* Created by wiekonek on 13.12.16.
*/
import {Http, RequestOptions, URLSearchParams} from "@angular/http";
import {Observable} from "rxjs";
import {AppAuthenticationService} from "../../app-authentication.service";
import {PaginateResponse} from "./paginate-response";
import {Card} from "../../card/card";
export abstract class BaseCardService {
constructor(protected http: Http, protected pluginAuth: AppAuthenticationService) {}
protected _get<T>(path: string, params?: URLSearchParams): Observable<T> {
let req = new RequestOptions({search: new URLSearchParams(
this.pluginAuth.RequestOptionsWithPluginAuthentication.search.rawParams)});
if(params != null)
req.search.appendAll(params);
return this.http
.get(path, req)
.map(res => res.json());
}
protected _getPage<T extends Card>(path: string, page: number, size: number): Observable<PaginateResponse<T>> {
return this._get(path, this.paginationParams(page, size));
}
private paginationParams(page: number, size: number): URLSearchParams {
let params = new URLSearchParams();
params.append('page', page.toString());
params.append('size', size.toString());
return params;
}
}
| Create new instance of UrlSearchParams in base _get method. | Create new instance of UrlSearchParams in base _get method.
| TypeScript | mit | JiraGoggles/jiragoggles-frontend,JiraGoggles/jiragoggles-frontend,JiraGoggles/jiragoggles-frontend,JiraGoggles/jiragoggles-frontend | ---
+++
@@ -12,7 +12,8 @@
constructor(protected http: Http, protected pluginAuth: AppAuthenticationService) {}
protected _get<T>(path: string, params?: URLSearchParams): Observable<T> {
- let req = new RequestOptions({search: this.pluginAuth.RequestOptionsWithPluginAuthentication.search});
+ let req = new RequestOptions({search: new URLSearchParams(
+ this.pluginAuth.RequestOptionsWithPluginAuthentication.search.rawParams)});
if(params != null)
req.search.appendAll(params);
return this.http |
f2eecc84dc64051ecf78ebc2395b4e652c1ece2e | src/configuration/registered-type-definition.ts | src/configuration/registered-type-definition.ts | import {remove, includedIn, flow, map, forEach, cond, identity, isNot, empty} from 'tsfun';
/**
* TypeDefinition, as used in TypeRegistry
*
* @author Daniel de Oliveira
*/
export interface RegisteredTypeDefinition {
color?: string,
parent: string,
extends?: string;
description: {[language: string]: string},
createdBy: string
fields: {[fieldName: string]: RegisteredFieldDefinition};
}
export type RegisteredTypeDefinitions = {[typeName: string]: RegisteredTypeDefinition };
export interface RegisteredFieldDefinition {
valuelistId?: string;
inputType?: string;
}
export function len<A>(as: Array<A>) {
return as.length;
}
export module RegisteredTypeDefinition {
export function assertIsValid(type: RegisteredTypeDefinition) {
if (!type.fields) throw ['type has not fields', type];
flow(
type.fields,
Object.values,
map(Object.keys),
map(remove(includedIn(['valuelistId', 'inputType']))),
forEach(
cond(isNot(empty),
(keys: string) => { throw ['type field with extra keys', keys]},
identity))); // TODO replace with nop
}
} | import {remove, includedIn, flow, map, forEach, cond, identity, isNot, empty} from 'tsfun';
/**
* TypeDefinition, as used in TypeRegistry
*
* @author Daniel de Oliveira
*/
export interface RegisteredTypeDefinition {
color?: string,
parent: string,
extends?: string;
description: {[language: string]: string},
createdBy: string
fields: {[fieldName: string]: RegisteredFieldDefinition};
}
export type RegisteredTypeDefinitions = {[typeName: string]: RegisteredTypeDefinition };
export interface RegisteredFieldDefinition {
valuelistId?: string;
inputType?: string;
positionValues?: string; // TODO review
}
export function len<A>(as: Array<A>) {
return as.length;
}
export module RegisteredTypeDefinition {
export function assertIsValid(type: RegisteredTypeDefinition) {
if (!type.fields) throw ['type has not fields', type];
flow(
type.fields,
Object.values,
map(Object.keys),
map(remove(includedIn(['valuelistId', 'inputType', 'positionValues']))),
forEach(
cond(isNot(empty),
(keys: string) => { throw ['type field with extra keys', keys]},
identity))); // TODO replace with nop
}
} | Add allowed field name positionValues | Add allowed field name positionValues
| TypeScript | apache-2.0 | dainst/idai-components-2,dainst/idai-components-2,dainst/idai-components-2 | ---
+++
@@ -22,6 +22,7 @@
valuelistId?: string;
inputType?: string;
+ positionValues?: string; // TODO review
}
@@ -41,7 +42,7 @@
type.fields,
Object.values,
map(Object.keys),
- map(remove(includedIn(['valuelistId', 'inputType']))),
+ map(remove(includedIn(['valuelistId', 'inputType', 'positionValues']))),
forEach(
cond(isNot(empty),
(keys: string) => { throw ['type field with extra keys', keys]}, |
0d4b857999f676ffea9f8de29b10d7a6ecb72a62 | packages/internal-test-helpers/lib/ember-dev/run-loop.ts | packages/internal-test-helpers/lib/ember-dev/run-loop.ts | // @ts-ignore
import { cancelTimers, end, getCurrentRunLoop, hasScheduledTimers } from '@ember/runloop';
export function setupRunLoopCheck(hooks: NestedHooks) {
hooks.afterEach(function() {
let { assert } = QUnit.config.current;
if (getCurrentRunLoop()) {
assert.ok(false, 'Should not be in a run loop at end of test');
while (getCurrentRunLoop()) {
end();
}
}
if (hasScheduledTimers()) {
assert.ok(false, 'Ember run should not have scheduled timers at end of test');
cancelTimers();
}
});
}
| // @ts-ignore
import { cancelTimers, end, getCurrentRunLoop, hasScheduledTimers } from '@ember/runloop';
export function setupRunLoopCheck(hooks: NestedHooks) {
hooks.afterEach(function(assert) {
if (getCurrentRunLoop() || hasScheduledTimers()) {
let done = assert.async();
// use a setTimeout to allow the current run loop to flush via autorun
setTimeout(() => {
// increment expected assertion count for the assertions just below
if (assert['test'].expected !== null) {
assert['test'].expected += 2;
}
// if it is _still_ not completed, we have a problem and the test should be fixed
assert.ok(
!hasScheduledTimers(),
'Ember run should not have scheduled timers at end of test'
);
assert.ok(!getCurrentRunLoop(), 'Should not be in a run loop at end of test');
// attempt to recover so the rest of the tests can run
while (getCurrentRunLoop()) {
end();
}
cancelTimers();
done();
}, 0);
}
});
}
| Allow runloop to settle via autorun in tests. | Allow runloop to settle via autorun in tests.
| TypeScript | mit | sly7-7/ember.js,GavinJoyce/ember.js,givanse/ember.js,kellyselden/ember.js,sandstrom/ember.js,emberjs/ember.js,miguelcobain/ember.js,sandstrom/ember.js,mixonic/ember.js,mfeckie/ember.js,sly7-7/ember.js,knownasilya/ember.js,givanse/ember.js,intercom/ember.js,cibernox/ember.js,intercom/ember.js,cibernox/ember.js,miguelcobain/ember.js,mixonic/ember.js,stefanpenner/ember.js,tildeio/ember.js,asakusuma/ember.js,GavinJoyce/ember.js,qaiken/ember.js,asakusuma/ember.js,sly7-7/ember.js,tildeio/ember.js,mixonic/ember.js,kellyselden/ember.js,mfeckie/ember.js,GavinJoyce/ember.js,elwayman02/ember.js,emberjs/ember.js,qaiken/ember.js,mfeckie/ember.js,knownasilya/ember.js,qaiken/ember.js,GavinJoyce/ember.js,stefanpenner/ember.js,givanse/ember.js,fpauser/ember.js,fpauser/ember.js,miguelcobain/ember.js,givanse/ember.js,knownasilya/ember.js,fpauser/ember.js,intercom/ember.js,stefanpenner/ember.js,sandstrom/ember.js,emberjs/ember.js,kellyselden/ember.js,cibernox/ember.js,tildeio/ember.js,asakusuma/ember.js,fpauser/ember.js,elwayman02/ember.js,kellyselden/ember.js,elwayman02/ember.js,mfeckie/ember.js,miguelcobain/ember.js,intercom/ember.js,asakusuma/ember.js,cibernox/ember.js,elwayman02/ember.js,qaiken/ember.js | ---
+++
@@ -2,19 +2,31 @@
import { cancelTimers, end, getCurrentRunLoop, hasScheduledTimers } from '@ember/runloop';
export function setupRunLoopCheck(hooks: NestedHooks) {
- hooks.afterEach(function() {
- let { assert } = QUnit.config.current;
+ hooks.afterEach(function(assert) {
+ if (getCurrentRunLoop() || hasScheduledTimers()) {
+ let done = assert.async();
+ // use a setTimeout to allow the current run loop to flush via autorun
+ setTimeout(() => {
+ // increment expected assertion count for the assertions just below
+ if (assert['test'].expected !== null) {
+ assert['test'].expected += 2;
+ }
- if (getCurrentRunLoop()) {
- assert.ok(false, 'Should not be in a run loop at end of test');
- while (getCurrentRunLoop()) {
- end();
- }
- }
+ // if it is _still_ not completed, we have a problem and the test should be fixed
+ assert.ok(
+ !hasScheduledTimers(),
+ 'Ember run should not have scheduled timers at end of test'
+ );
+ assert.ok(!getCurrentRunLoop(), 'Should not be in a run loop at end of test');
- if (hasScheduledTimers()) {
- assert.ok(false, 'Ember run should not have scheduled timers at end of test');
- cancelTimers();
+ // attempt to recover so the rest of the tests can run
+ while (getCurrentRunLoop()) {
+ end();
+ }
+ cancelTimers();
+
+ done();
+ }, 0);
}
});
} |
528b8a735468c25190ff74cb575d2db78091ce30 | app/upload/upload.component.ts | app/upload/upload.component.ts | import { Component } from 'angular2/core';
import { UploadFileSelect } from './upload-file-select.directive';
import { UploadService } from './upload.service';
import { MimeTypeService } from '../../util/mime-type.service';
import { HTTP_PROVIDERS } from 'angular2/http';
@Component({
template: '<input type="file" upload-file />',
providers: [HTTP_PROVIDERS, UploadService, MimeTypeService],
directives: [UploadFileSelect]
})
export class UploadComponent { }
| import {Component} from 'angular2/core';
import {UploadFileSelect} from './upload-file-select.directive';
import {UploadService} from './upload.service';
import {MimeTypeService} from '../../util/mime-type.service';
import {HTTP_PROVIDERS} from 'angular2/http';
import {FileUpload} from './file-upload.component';
@Component({
template: `
<input type="file" upload-file />
<file-upload *ngFor="#upload of uploadService.uploads" [upload]="upload">
</file-upload>
`,
providers: [HTTP_PROVIDERS, UploadService, MimeTypeService],
directives: [UploadFileSelect, FileUpload]
})
export class UploadComponent {
constructor(private uploadService:UploadService) {}
}
| Reformat imports, inject service, add fileUpload directive | Reformat imports, inject service, add fileUpload directive
| TypeScript | agpl-3.0 | PRX/publish.prx.org,PRX/publish.prx.org,PRX/publish.prx.org,PRX/publish.prx.org | ---
+++
@@ -1,13 +1,20 @@
-import { Component } from 'angular2/core';
-import { UploadFileSelect } from './upload-file-select.directive';
-import { UploadService } from './upload.service';
-import { MimeTypeService } from '../../util/mime-type.service';
-import { HTTP_PROVIDERS } from 'angular2/http';
+import {Component} from 'angular2/core';
+import {UploadFileSelect} from './upload-file-select.directive';
+import {UploadService} from './upload.service';
+import {MimeTypeService} from '../../util/mime-type.service';
+import {HTTP_PROVIDERS} from 'angular2/http';
+import {FileUpload} from './file-upload.component';
@Component({
- template: '<input type="file" upload-file />',
+ template: `
+ <input type="file" upload-file />
+ <file-upload *ngFor="#upload of uploadService.uploads" [upload]="upload">
+ </file-upload>
+ `,
providers: [HTTP_PROVIDERS, UploadService, MimeTypeService],
- directives: [UploadFileSelect]
+ directives: [UploadFileSelect, FileUpload]
})
-export class UploadComponent { }
+export class UploadComponent {
+ constructor(private uploadService:UploadService) {}
+} |
5b4981f2339665a01c37826b7aab80757422f0ed | lib/msal-angular/src/msal.redirect.component.ts | lib/msal-angular/src/msal.redirect.component.ts | /*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
/**
* This is a dedicated redirect component to be added to Angular apps to
* handle redirects when using @azure/msal-angular.
* Import this component to use redirects in your app.
*/
import { Component, OnInit } from "@angular/core";
import { MsalService } from "./msal.service";
@Component({
selector: "app-redirect",
template: ""
})
export class MsalRedirectComponent implements OnInit {
constructor(private authService: MsalService) { }
ngOnInit(): void {
this.authService.handleRedirectObservable().subscribe();
}
}
| /*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
/**
* This is a dedicated redirect component to be added to Angular apps to
* handle redirects when using @azure/msal-angular.
* Import this component to use redirects in your app.
*/
import { Component, OnInit } from "@angular/core";
import { MsalService } from "./msal.service";
@Component({
selector: "app-redirect",
template: ""
})
export class MsalRedirectComponent implements OnInit {
constructor(private authService: MsalService) { }
ngOnInit(): void {
this.authService.getLogger().verbose("MsalRedirectComponent activated");
this.authService.handleRedirectObservable().subscribe();
}
}
| Add log message to MsalRedirectComponent | Add log message to MsalRedirectComponent
| TypeScript | mit | AzureAD/microsoft-authentication-library-for-js,AzureAD/microsoft-authentication-library-for-js,AzureAD/microsoft-authentication-library-for-js,AzureAD/microsoft-authentication-library-for-js,AzureAD/microsoft-authentication-library-for-js,AzureAD/microsoft-authentication-library-for-js,AzureAD/microsoft-authentication-library-for-js,AzureAD/microsoft-authentication-library-for-js | ---
+++
@@ -21,6 +21,7 @@
constructor(private authService: MsalService) { }
ngOnInit(): void {
+ this.authService.getLogger().verbose("MsalRedirectComponent activated");
this.authService.handleRedirectObservable().subscribe();
}
|
d3f6b0e980acfbf6dc6d016a466e19c88cfdf33d | src/tasks/daily_verses.ts | src/tasks/daily_verses.ts | import { Client, TextChannel } from 'discord.js';
import * as cron from 'node-cron';
import * as moment from 'moment';
import 'moment-timezone';
import GuildPreference from '../models/guild_preference';
import { DailyVerseRouter } from '../routes/resources/daily_verse';
import Context from '../models/context';
import Language from '../models/language';
const dailyVerseRouter = DailyVerseRouter.getInstance();
export const startDailyVerse = (bot: Client): void => {
cron.schedule('* * * * *', () => {
const currentTime = moment().tz('UTC').format('HH:mm');
GuildPreference.find({ dailyVerseTime: currentTime }, (err, guilds) => {
if (err) {
return;
} else if (guilds.length > 0) {
for (const guildPref of guilds) {
try {
bot.guilds.fetch(guildPref.guild).then((guild) => {
const chan = guild.channels.resolve(guildPref.dailyVerseChannel);
const ctx = new Context('auto', bot, (chan as TextChannel), guild, null, null, null, guildPref, null);
Language.findOne({ objectName: guildPref.language }, (err, lang) => {
(chan as TextChannel).send(lang.getString('votd'));
dailyVerseRouter.sendDailyVerse(ctx, {
version: guildPref.version
});
});
});
} catch {
continue;
}
}
}
});
}).start();
}; | import { Client, TextChannel } from 'discord.js';
import * as cron from 'node-cron';
import * as moment from 'moment';
import 'moment-timezone';
import GuildPreference from '../models/guild_preference';
import { DailyVerseRouter } from '../routes/resources/daily_verse';
import Context from '../models/context';
import Language from '../models/language';
const dailyVerseRouter = DailyVerseRouter.getInstance();
export const startDailyVerse = (bot: Client): void => {
cron.schedule('* * * * *', () => {
const currentTime = moment().tz('UTC').format('HH:mm');
GuildPreference.find({ dailyVerseTime: currentTime }, (err, guilds) => {
if (err) {
return;
} else if (guilds.length > 0) {
for (const guildPref of guilds) {
try {
bot.guilds.fetch(guildPref.guild).then((guild) => {
const chan = guild.channels.resolve(guildPref.dailyVerseChannel);
const ctx = new Context('auto', bot, (chan as TextChannel), guild, null, null,
{ headings: true, verseNumbers: true, display: 'embed' }, guildPref, null);
Language.findOne({ objectName: guildPref.language }, (err, lang) => {
(chan as TextChannel).send(lang.getString('votd'));
dailyVerseRouter.sendDailyVerse(ctx, {
version: guildPref.version
});
});
});
} catch {
continue;
}
}
}
});
}).start();
}; | Fix a bug where preferences weren't accessible for automatic daily verses. | Fix a bug where preferences weren't accessible for automatic daily verses.
| TypeScript | mpl-2.0 | BibleBot/BibleBot,BibleBot/BibleBot,BibleBot/BibleBot | ---
+++
@@ -22,7 +22,8 @@
try {
bot.guilds.fetch(guildPref.guild).then((guild) => {
const chan = guild.channels.resolve(guildPref.dailyVerseChannel);
- const ctx = new Context('auto', bot, (chan as TextChannel), guild, null, null, null, guildPref, null);
+ const ctx = new Context('auto', bot, (chan as TextChannel), guild, null, null,
+ { headings: true, verseNumbers: true, display: 'embed' }, guildPref, null);
Language.findOne({ objectName: guildPref.language }, (err, lang) => {
(chan as TextChannel).send(lang.getString('votd')); |
d13cbba50f9c1f043e003a1988b0d4458b268a81 | components/model/model.ts | components/model/model.ts | import { ModelFactory } from './model-service';
export { Model } from './model-service';
export const ModelModule = angular.module( 'gj.Model', [] )
.factory( 'Model', ModelFactory )
.name
;
| import { ModelFactory } from './model-service';
export { Model } from './model-service';
export default angular.module( 'gj.Model', [] )
.factory( 'Model', ModelFactory )
.name
;
| Update Model to not export a const module. | Update Model to not export a const module.
| TypeScript | mit | gamejolt/frontend-lib,gamejolt/frontend-lib,gamejolt/frontend-lib,gamejolt/frontend-lib | ---
+++
@@ -1,7 +1,7 @@
import { ModelFactory } from './model-service';
export { Model } from './model-service';
-export const ModelModule = angular.module( 'gj.Model', [] )
+export default angular.module( 'gj.Model', [] )
.factory( 'Model', ModelFactory )
.name
; |
2ed692e8701bc3365096fe8afc89d43fbb65b3f7 | packages/web-client/app/routes/card-pay/base.ts | packages/web-client/app/routes/card-pay/base.ts | import Route from '@ember/routing/route';
import '../../css/card-pay/balances.css';
import * as short from 'short-uuid';
export default class CardPayTabBaseRoute extends Route {
queryParams = {
flow: {
refreshModel: true,
},
workflowPersistenceId: {
refreshModel: true,
},
};
model(params: any, transition: any) {
if (params.flow && !params.workflowPersistenceId) {
// TODO: remove me once all flows have persistence support
if (params.flow !== 'deposit' && params.flow !== 'issue-prepaid-card')
return;
transition.abort();
this.transitionTo(this.routeName, {
queryParams: {
flow: params.flow,
workflowPersistenceId: short.generate(),
},
});
}
}
}
| import Route from '@ember/routing/route';
import '../../css/card-pay/balances.css';
import * as short from 'short-uuid';
export default class CardPayTabBaseRoute extends Route {
queryParams = {
flow: {
refreshModel: true,
},
workflowPersistenceId: {
refreshModel: true,
},
};
model(params: any, transition: any) {
if (params.flow && !params.workflowPersistenceId) {
// TODO: remove me once all flows have persistence support
if (
params.flow !== 'deposit' &&
params.flow !== 'issue-prepaid-card' &&
params.flow !== 'create-merchant'
)
return;
transition.abort();
this.transitionTo(this.routeName, {
queryParams: {
flow: params.flow,
workflowPersistenceId: short.generate(),
},
});
}
}
}
| Update guard since create-merchant flow has persistence now | Update guard since create-merchant flow has persistence now
| TypeScript | mit | cardstack/cardstack,cardstack/cardstack,cardstack/cardstack,cardstack/cardstack,cardstack/cardstack,cardstack/cardstack | ---
+++
@@ -14,7 +14,11 @@
model(params: any, transition: any) {
if (params.flow && !params.workflowPersistenceId) {
// TODO: remove me once all flows have persistence support
- if (params.flow !== 'deposit' && params.flow !== 'issue-prepaid-card')
+ if (
+ params.flow !== 'deposit' &&
+ params.flow !== 'issue-prepaid-card' &&
+ params.flow !== 'create-merchant'
+ )
return;
transition.abort(); |
ed03f81c35a126d95690fac6c7bcde6f8b0a1bd2 | index.d.ts | index.d.ts | import * as tinymce from 'tinymce';
declare module 'tinymce' {
export interface Settings extends tinymce.Settings {
[key: string]: any,
}
export function init(settings: Settings): Promise<tinymce.Editor[]>;
export const shopifyConfig: Settings;
}
export * from 'tinymce';
| import * as tinymce from 'tinymce';
declare module 'tinymce' {
export interface ShopifySettings extends tinymce.Settings {
[key: string]: any,
}
export function init(settings: ShopifySettings): Promise<tinymce.Editor[]>;
export const shopifyConfig: ShopifySettings;
}
export * from 'tinymce';
| Fix the issue where Settings recursively references itself as a base type | Fix the issue where Settings recursively references itself as a base type
| TypeScript | lgpl-2.1 | Shopify/tinymce | ---
+++
@@ -1,13 +1,13 @@
import * as tinymce from 'tinymce';
declare module 'tinymce' {
- export interface Settings extends tinymce.Settings {
+ export interface ShopifySettings extends tinymce.Settings {
[key: string]: any,
}
- export function init(settings: Settings): Promise<tinymce.Editor[]>;
+ export function init(settings: ShopifySettings): Promise<tinymce.Editor[]>;
- export const shopifyConfig: Settings;
+ export const shopifyConfig: ShopifySettings;
}
export * from 'tinymce'; |
8d3c2715db74cae24bff16ff9a068b0af8d194f3 | packages/@orbit/integration-tests/test/support/jsonapi.ts | packages/@orbit/integration-tests/test/support/jsonapi.ts | import { Orbit } from '@orbit/core';
export function jsonapiResponse(
_options: any,
body?: any,
timeout?: number
): Promise<Response> {
let options: any;
let response: Response;
if (typeof _options === 'number') {
options = { status: _options };
} else {
options = _options || {};
}
options.statusText = options.statusText || statusText(options.status);
options.headers = options.headers || {};
if (body) {
options.headers['Content-Type'] =
options.headers['Content-Type'] || 'application/vnd.api+json';
response = new Orbit.globals.Response(JSON.stringify(body), options);
} else {
response = new Orbit.globals.Response(null, options);
}
// console.log('jsonapiResponse', body, options, response.headers.get('Content-Type'));
if (timeout) {
return new Promise((resolve: (response: Response) => void) => {
let timer = Orbit.globals.setTimeout(() => {
Orbit.globals.clearTimeout(timer);
resolve(response);
}, timeout);
});
} else {
return Promise.resolve(response);
}
}
function statusText(code: number): string {
switch (code) {
case 200:
return 'OK';
case 201:
return 'Created';
case 204:
return 'No Content';
case 422:
return 'Unprocessable Entity';
}
}
| import { Orbit } from '@orbit/core';
export function jsonapiResponse(
_options: unknown,
body?: unknown,
timeout?: number
): Promise<Response> {
let options: any;
let response: Response;
if (typeof _options === 'number') {
options = { status: _options };
} else {
options = _options || {};
}
options.statusText = options.statusText || statusText(options.status);
options.headers = options.headers || {};
if (body) {
options.headers['Content-Type'] =
options.headers['Content-Type'] || 'application/vnd.api+json';
response = new Orbit.globals.Response(JSON.stringify(body), options);
} else {
response = new Orbit.globals.Response(null, options);
}
// console.log('jsonapiResponse', body, options, response.headers.get('Content-Type'));
if (timeout) {
return new Promise((resolve: (response: Response) => void) => {
let timer = Orbit.globals.setTimeout(() => {
Orbit.globals.clearTimeout(timer);
resolve(response);
}, timeout);
});
} else {
return Promise.resolve(response);
}
}
function statusText(code: number): string | undefined {
switch (code) {
case 200:
return 'OK';
case 201:
return 'Created';
case 204:
return 'No Content';
case 422:
return 'Unprocessable Entity';
}
}
| Fix typing / linting issues in @orbit/integration-tests | Fix typing / linting issues in @orbit/integration-tests
| TypeScript | mit | orbitjs/orbit.js,orbitjs/orbit.js | ---
+++
@@ -1,8 +1,8 @@
import { Orbit } from '@orbit/core';
export function jsonapiResponse(
- _options: any,
- body?: any,
+ _options: unknown,
+ body?: unknown,
timeout?: number
): Promise<Response> {
let options: any;
@@ -38,7 +38,7 @@
}
}
-function statusText(code: number): string {
+function statusText(code: number): string | undefined {
switch (code) {
case 200:
return 'OK'; |
2f1f9f0513a3d7206d71f478a1671be31eb5099b | packages/@glimmer/manager/lib/internal/defaults.ts | packages/@glimmer/manager/lib/internal/defaults.ts | import { buildCapabilities } from '../util/capabilities';
import type { CapturedArguments as Arguments, HelperCapabilities } from '@glimmer/interfaces';
type FnArgs<Args extends Arguments = Arguments> =
| [...Args['positional'], Args['named']]
| [...Args['positional']];
type AnyFunction = (...args: any[]) => unknown;
interface State {
fn: AnyFunction;
args: Arguments;
}
export class FunctionHelperManager implements HelperManagerWithValue<State> {
capabilities = buildCapabilities({
hasValue: true,
hasDestroyable: false,
hasScheduledEffect: false,
}) as HelperCapabilities;
createHelper(fn: AnyFunction, args: Arguments) {
return { fn, args };
}
getValue({ fn, args }: State) {
if (Object.keys(args.named).length > 0) {
let argsForFn: FnArgs<Arguments> = [...args.positional, args.named];
return fn(...argsForFn);
}
return fn(...args.positional);
}
getDebugName(fn: AnyFunction) {
if (fn.name) {
return `(helper function ${fn.name})`;
}
return '(anonymous helper function)';
}
}
| import { buildCapabilities } from '../util/capabilities';
import type {
CapturedArguments as Arguments,
HelperCapabilities,
HelperManagerWithValue,
} from '@glimmer/interfaces';
type FnArgs<Args extends Arguments = Arguments> =
| [...Args['positional'], Args['named']]
| [...Args['positional']];
type AnyFunction = (...args: any[]) => unknown;
interface State {
fn: AnyFunction;
args: Arguments;
}
export class FunctionHelperManager implements HelperManagerWithValue<State> {
capabilities = buildCapabilities({
hasValue: true,
hasDestroyable: false,
hasScheduledEffect: false,
}) as HelperCapabilities;
createHelper(fn: AnyFunction, args: Arguments): State {
return { fn, args };
}
getValue({ fn, args }: State): unknown {
if (Object.keys(args.named).length > 0) {
let argsForFn: FnArgs<Arguments> = [...args.positional, args.named];
return fn(...argsForFn);
}
return fn(...args.positional);
}
getDebugName(fn: AnyFunction): string {
if (fn.name) {
return `(helper function ${fn.name})`;
}
return '(anonymous helper function)';
}
}
| Add explicit return types, planning for a lint to enforce this later | Add explicit return types, planning for a lint to enforce this later
| TypeScript | mit | glimmerjs/glimmer-vm,glimmerjs/glimmer-vm,tildeio/glimmer,tildeio/glimmer,glimmerjs/glimmer-vm,tildeio/glimmer | ---
+++
@@ -1,6 +1,10 @@
import { buildCapabilities } from '../util/capabilities';
-import type { CapturedArguments as Arguments, HelperCapabilities } from '@glimmer/interfaces';
+import type {
+ CapturedArguments as Arguments,
+ HelperCapabilities,
+ HelperManagerWithValue,
+} from '@glimmer/interfaces';
type FnArgs<Args extends Arguments = Arguments> =
| [...Args['positional'], Args['named']]
@@ -20,11 +24,11 @@
hasScheduledEffect: false,
}) as HelperCapabilities;
- createHelper(fn: AnyFunction, args: Arguments) {
+ createHelper(fn: AnyFunction, args: Arguments): State {
return { fn, args };
}
- getValue({ fn, args }: State) {
+ getValue({ fn, args }: State): unknown {
if (Object.keys(args.named).length > 0) {
let argsForFn: FnArgs<Arguments> = [...args.positional, args.named];
@@ -34,7 +38,7 @@
return fn(...args.positional);
}
- getDebugName(fn: AnyFunction) {
+ getDebugName(fn: AnyFunction): string {
if (fn.name) {
return `(helper function ${fn.name})`;
} |
365a9ecd1a15977ac66ecd9ca6c35529ba7cff5d | web/resources/js/tab-anchor.ts | web/resources/js/tab-anchor.ts | // Show appropriate pill based on #anchor in URL
import {Tab} from 'bootstrap';
function navigateToAnchorTab() {
const hash = window.location.hash;
if (hash) {
const element: Element | null = document.querySelector(`ul.nav a[href="${hash}"]`);
if (element === null) return;
new Tab(element).show();
}
}
function updateLocationHash(this: HTMLAnchorElement, ev: MouseEvent){
if (this.hash === null) {
console.warn('Selected tab does not have an id. Cannot update')
return null;
}
window.location.hash = this.hash;
}
document.addEventListener('DOMContentLoaded', () => {
navigateToAnchorTab();
for (const el of document.querySelectorAll<HTMLAnchorElement>('.nav-tabs a')) {
el.addEventListener('click', updateLocationHash, false)
}
});
| // Show appropriate pill based on #anchor in URL
import {Tab} from 'bootstrap';
function navigateToAnchorTab() {
const hash = window.location.hash;
if (hash) {
const element: Element | null = document.querySelector(`ul.nav a[href="${hash}"]`);
if (element === null) return;
new Tab(element).show();
}
}
function updateLocationHash(this: HTMLAnchorElement, ev: MouseEvent){
if (this.hash === null) {
console.warn('Selected tab does not have an id. Cannot update')
return null;
}
window.location.hash = this.hash;
}
document.addEventListener('DOMContentLoaded', () => {
navigateToAnchorTab();
for (const el of document.querySelectorAll<HTMLAnchorElement>('.nav-tabs a')) {
// `new Tab(element)` already implicitly happens due to the respective
// `data-` attributes being present
el.addEventListener('click', updateLocationHash, false)
}
});
| Add helpful comment to event listener | Add helpful comment to event listener
| TypeScript | apache-2.0 | agdsn/pycroft,agdsn/pycroft,agdsn/pycroft,agdsn/pycroft,agdsn/pycroft | ---
+++
@@ -24,6 +24,8 @@
navigateToAnchorTab();
for (const el of document.querySelectorAll<HTMLAnchorElement>('.nav-tabs a')) {
+ // `new Tab(element)` already implicitly happens due to the respective
+ // `data-` attributes being present
el.addEventListener('click', updateLocationHash, false)
}
}); |
1bc4fca216d199ab42855f6f4ef6991bad4dafdf | core/store/modules/checkout/types/CheckoutState.ts | core/store/modules/checkout/types/CheckoutState.ts | export default interface CategoryState {
order: any,
personalDetails: {
firstName: string,
lastName: string,
emailAddress: string,
password: string,
createAccount: boolean
},
shippingDetails: {
firstName: string,
lastName: string,
country: string,
streetAddress: string,
apartmentNumber: string,
city: string,
state: string,
zipCode: string,
phoneNumber: string,
shippingMethod: string
},
paymentDetails: {
firstName: string,
lastName: string,
company: string,
country: string,
streetAddress: string,
apartmentNumber: string,
city: string,
state: string,
zipCode: string,
phoneNumber: string,
taxId: string,
paymentMethod: string,
paymentMethodAdditional: any
},
isThankYouPage: boolean
} | export default interface CheckoutState {
order: any,
personalDetails: {
firstName: string,
lastName: string,
emailAddress: string,
password: string,
createAccount: boolean
},
shippingDetails: {
firstName: string,
lastName: string,
country: string,
streetAddress: string,
apartmentNumber: string,
city: string,
state: string,
zipCode: string,
phoneNumber: string,
shippingMethod: string
},
paymentDetails: {
firstName: string,
lastName: string,
company: string,
country: string,
streetAddress: string,
apartmentNumber: string,
city: string,
state: string,
zipCode: string,
phoneNumber: string,
taxId: string,
paymentMethod: string,
paymentMethodAdditional: any
},
isThankYouPage: boolean
} | Fix checkout export state name. | Fix checkout export state name.
| TypeScript | mit | pkarw/vue-storefront,pkarw/vue-storefront,DivanteLtd/vue-storefront,pkarw/vue-storefront,DivanteLtd/vue-storefront,DivanteLtd/vue-storefront,pkarw/vue-storefront,DivanteLtd/vue-storefront | ---
+++
@@ -1,4 +1,4 @@
-export default interface CategoryState {
+export default interface CheckoutState {
order: any,
personalDetails: {
firstName: string, |
e3f41705f5ed9aad93c9f0aec2d03af56c2a78da | app/src/app/locales/locales-list/locales-list.component.ts | app/src/app/locales/locales-list/locales-list.component.ts | import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { LocalesService } from './../services/locales.service';
@Component({
selector: 'locales-list',
templateUrl: './locales-list.component.html'
})
export class LocalesListComponent implements OnInit {
private locales = [];
private loading = false;
constructor(private localesService: LocalesService, private router: ActivatedRoute) { }
ngOnInit() {
this.router.params
.map(params => params['projectId'])
.switchMap(projectId => {
this.loading = true;
return this.localesService.fetchLocales(projectId);
})
.subscribe(locales => {
this.locales = locales; this.loading = false;
}, err => {
console.log(err); this.loading = false;
});
}
} | import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { LocalesService } from './../services/locales.service';
@Component({
selector: 'locales-list',
templateUrl: './locales-list.component.html'
})
export class LocalesListComponent implements OnInit {
private locales = [];
private loading = false;
constructor(private localesService: LocalesService, private router: ActivatedRoute) { }
ngOnInit() {
this.localesService.locales.subscribe(
locales => { this.locales = locales }
);
this.router.params
.map(params => params['projectId'])
.switchMap(projectId => {
this.loading = true;
return this.localesService.fetchLocales(projectId);
})
.subscribe(locales => {
this.loading = false;
}, err => {
console.log(err); this.loading = false;
});
}
} | Fix locales list not subscribed | Fix locales list not subscribed
| TypeScript | mit | anthonynsimon/parrot,anthonynsimon/parrot,anthonynsimon/parrot,anthonynsimon/parrot,todes1/parrot,todes1/parrot,todes1/parrot,todes1/parrot,todes1/parrot,todes1/parrot,anthonynsimon/parrot,anthonynsimon/parrot | ---
+++
@@ -14,6 +14,10 @@
constructor(private localesService: LocalesService, private router: ActivatedRoute) { }
ngOnInit() {
+ this.localesService.locales.subscribe(
+ locales => { this.locales = locales }
+ );
+
this.router.params
.map(params => params['projectId'])
.switchMap(projectId => {
@@ -21,7 +25,7 @@
return this.localesService.fetchLocales(projectId);
})
.subscribe(locales => {
- this.locales = locales; this.loading = false;
+ this.loading = false;
}, err => {
console.log(err); this.loading = false;
}); |
8a80de30174351df3ce8e6d0ce8657a2694eb0f1 | packages/common/exceptions/http.exception.ts | packages/common/exceptions/http.exception.ts | export class HttpException extends Error {
public readonly message: any;
/**
* Base Nest application exception, which is handled by the default Exceptions Handler.
* If you throw an exception from your HTTP route handlers, Nest will map them to the appropriate HTTP response and send to the client.
*
* When `response` is an object:
* - object will be stringified and returned to the user as a JSON response,
*
* When `response` is a string:
* - Nest will create a response with two properties:
* ```
* message: response,
* statusCode: X
* ```
*/
constructor(
private readonly response: string | object,
private readonly status: number,
) {
super();
this.message = response;
}
public getResponse(): string | object {
return this.response;
}
public getStatus(): number {
return this.status;
}
private getErrorString(target) {
if (typeof target === 'string') {
return target;
}
return JSON.stringify(target);
}
public toString(): string {
const message = this.getErrorString(this.message);
return `Error: ${message}`;
}
}
| export class HttpException extends Error {
public readonly message: any;
/**
* Base Nest application exception, which is handled by the default Exceptions Handler.
* If you throw an exception from your HTTP route handlers, Nest will map them to the appropriate HTTP response and send to the client.
*
* When `response` is an object:
* - object will be stringified and returned to the user as a JSON response,
*
* When `response` is a string:
* - Nest will create a response with two properties:
* ```
* message: response,
* statusCode: X
* ```
*/
constructor(
private readonly response: string | object,
private readonly status: number,
) {
super();
this.message = response;
}
public getResponse(): string | object {
return this.response;
}
public getStatus(): number {
return this.status;
}
private getErrorString(target: string | object) {
if (typeof target === 'string') {
return target;
}
return JSON.stringify(target);
}
public toString(): string {
const message = this.getErrorString(this.message);
return `Error: ${message}`;
}
}
| Add typing target for getErrorString | Add typing target for getErrorString | TypeScript | mit | kamilmysliwiec/nest,kamilmysliwiec/nest | ---
+++
@@ -31,7 +31,7 @@
return this.status;
}
- private getErrorString(target) {
+ private getErrorString(target: string | object) {
if (typeof target === 'string') {
return target;
} |
4e7f67c48475148fdb4ae20aefbe83f895739ee4 | src/actions/connectAccount.ts | src/actions/connectAccount.ts | import { CONNECT_ACCOUNT_REQUEST, CONNECT_ACCOUNT_SUCCESS } from '../constants';
import { AccountInfo } from '../types';
export interface ConnectAccountRequest {
type: CONNECT_ACCOUNT_REQUEST;
}
export interface ConnectAccountSuccess {
type: CONNECT_ACCOUNT_SUCCESS;
data: AccountInfo;
}
export type ConnectAccountAction =
| ConnectAccountRequest
| ConnectAccountSuccess;
export const connectAccountRequest = (): ConnectAccountRequest => ({
type: CONNECT_ACCOUNT_REQUEST
});
export const connectAccountSuccess = (
data: AccountInfo
): ConnectAccountSuccess => ({
type: CONNECT_ACCOUNT_SUCCESS,
data
});
| import {
CONNECT_ACCOUNT_REQUEST,
CONNECT_ACCOUNT_SUCCESS,
CONNECT_ACCOUNT_FAILURE
} from '../constants';
import { AccountInfo } from '../types';
export interface ConnectAccountRequest {
type: CONNECT_ACCOUNT_REQUEST;
}
export interface ConnectAccountFailure {
type: CONNECT_ACCOUNT_FAILURE;
}
export interface ConnectAccountSuccess {
type: CONNECT_ACCOUNT_SUCCESS;
data: AccountInfo;
}
export type ConnectAccountAction =
| ConnectAccountRequest
| ConnectAccountSuccess;
export const connectAccountRequest = (): ConnectAccountRequest => ({
type: CONNECT_ACCOUNT_REQUEST
});
export const connectAccountFailure = (): ConnectAccountFailure => ({
type: CONNECT_ACCOUNT_FAILURE
});
export const connectAccountSuccess = (
data: AccountInfo
): ConnectAccountSuccess => ({
type: CONNECT_ACCOUNT_SUCCESS,
data
});
| Add action creator for failed account connection. | Add action creator for failed account connection.
| TypeScript | mit | Anveio/mturk-engine,Anveio/mturk-engine,Anveio/mturk-engine | ---
+++
@@ -1,8 +1,16 @@
-import { CONNECT_ACCOUNT_REQUEST, CONNECT_ACCOUNT_SUCCESS } from '../constants';
+import {
+ CONNECT_ACCOUNT_REQUEST,
+ CONNECT_ACCOUNT_SUCCESS,
+ CONNECT_ACCOUNT_FAILURE
+} from '../constants';
import { AccountInfo } from '../types';
export interface ConnectAccountRequest {
type: CONNECT_ACCOUNT_REQUEST;
+}
+
+export interface ConnectAccountFailure {
+ type: CONNECT_ACCOUNT_FAILURE;
}
export interface ConnectAccountSuccess {
@@ -18,6 +26,10 @@
type: CONNECT_ACCOUNT_REQUEST
});
+export const connectAccountFailure = (): ConnectAccountFailure => ({
+ type: CONNECT_ACCOUNT_FAILURE
+});
+
export const connectAccountSuccess = (
data: AccountInfo
): ConnectAccountSuccess => ({ |
abc0354a20d9c351684ce330a74a3ae7e7ab6f33 | after_prepare/ionic-minify.ts | after_prepare/ionic-minify.ts | #!/usr/bin/env node
import * as path from 'path';
import {Minifier} from 'ionic-minify';
let config: IMConfig = require("../minify-conf.json");
let cmd: string = process.env.CORDOVA_CMDLINE;
let rootDir: string = process.argv[2];
let minify: boolean = config.alwaysRun || (cmd.indexOf("--release") > -1);
let platforms: string[] = process.env.CORDOVA_PLATFORMS.split(',');
let platformPath: string= path.join(rootDir, "platforms");
config.showErrStack = (config.showErrStack || false);
config.jsOptions.fromString = true;
let ionicMinify: Minifier = new Minifier(config, platforms, platformPath);
if (minify) {
console.log("Starting minifying your files...");
ionicMinify.run();
} | #!/usr/bin/env node
import * as path from 'path';
import {Minifier} from 'ionic-minify';
let config: IMConfig = require("../minify-conf.json");
let cmd: string = process.env.CORDOVA_CMDLINE;
let rootDir: string = process.argv[2];
let minify: boolean = config.alwaysRun || (cmd.indexOf("--minify") > -1);
let platforms: string[] = process.env.CORDOVA_PLATFORMS.split(',');
let platformPath: string= path.join(rootDir, "platforms");
config.showErrStack = (config.showErrStack || false);
config.jsOptions.fromString = true;
let ionicMinify: Minifier = new Minifier(config, platforms, platformPath);
if (minify) {
console.log("Starting minifying your files...");
ionicMinify.run();
} | Change trigger flag to --minify | Change trigger flag to --minify
- --release flag was breaking the android build in latest build tools
so it's now replaced by the --minify flag.
See #13 for more information.
Thanks to @aaronksaunders for spotting this.
| TypeScript | mit | Kurtz1993/ionic-minify,Kurtz1993/ionic-minify | ---
+++
@@ -6,7 +6,7 @@
let config: IMConfig = require("../minify-conf.json");
let cmd: string = process.env.CORDOVA_CMDLINE;
let rootDir: string = process.argv[2];
-let minify: boolean = config.alwaysRun || (cmd.indexOf("--release") > -1);
+let minify: boolean = config.alwaysRun || (cmd.indexOf("--minify") > -1);
let platforms: string[] = process.env.CORDOVA_PLATFORMS.split(',');
let platformPath: string= path.join(rootDir, "platforms");
|
a51d3b3fc99bb7e41a021979eb5e958bf0c8fcbd | src/dependument.ts | src/dependument.ts | /// <reference path="../typings/node/node.d.ts" />
import * as fs from 'fs';
export class Dependument {
private source: string;
private output: string;
constructor(options: any) {
if (!options) {
throw new Error("No options provided");
}
if (!options.source) {
throw new Error("No source path specified in options");
}
if (!options.output) {
throw new Error("No output path specified in options");
}
this.source = options.source;
this.output = options.output;
}
public process() {
this.readInfo(() => {
this.writeOutput();
});
}
private readInfo(success: () => any) {
fs.readFile(this.source, (err, data) => {
if (err) {
throw err;
}
success();
});
}
private writeOutput() {
fs.writeFile(this.output, 'dependument test writeOutput', (err) => {
if (err) throw err;
console.log(`Output written to ${this.output}`);
});
}
}
| /// <reference path="../typings/node/node.d.ts" />
import * as fs from 'fs';
export class Dependument {
private source: string;
private output: string;
constructor(options: any) {
if (!options) {
throw new Error("No options provided");
}
if (!options.source) {
throw new Error("No source path specified in options");
}
if (!options.output) {
throw new Error("No output path specified in options");
}
this.source = options.source;
this.output = options.output;
}
public process() {
this.readInfo((info: string) => {
this.writeOutput(info);
});
}
private readInfo(success: (info: string) => any) {
fs.readFile(this.source, (err, data: Buffer) => {
if (err) {
throw err;
}
success(data.toString());
});
}
private writeOutput(output: string) {
fs.writeFile(this.output, output, (err) => {
if (err) throw err;
console.log(`Output written to ${this.output}`);
});
}
}
| Write the data that we read from the file | Write the data that we read from the file
| TypeScript | unlicense | Jameskmonger/dependument,dependument/dependument,Jameskmonger/dependument,dependument/dependument | ---
+++
@@ -24,23 +24,23 @@
}
public process() {
- this.readInfo(() => {
- this.writeOutput();
+ this.readInfo((info: string) => {
+ this.writeOutput(info);
});
}
- private readInfo(success: () => any) {
- fs.readFile(this.source, (err, data) => {
+ private readInfo(success: (info: string) => any) {
+ fs.readFile(this.source, (err, data: Buffer) => {
if (err) {
throw err;
}
- success();
+ success(data.toString());
});
}
- private writeOutput() {
- fs.writeFile(this.output, 'dependument test writeOutput', (err) => {
+ private writeOutput(output: string) {
+ fs.writeFile(this.output, output, (err) => {
if (err) throw err;
console.log(`Output written to ${this.output}`);
}); |
847d01925cd01bd65fba99800cdd225ce0f76e12 | client/test/buildEncounter.ts | client/test/buildEncounter.ts | import { PromptQueue } from "../Commands/Prompts/PromptQueue";
import { Encounter } from "../Encounter/Encounter";
import { DefaultRules, IRules } from "../Rules/Rules";
import { StatBlockTextEnricher } from "../StatBlock/StatBlockTextEnricher";
export function buildStatBlockTextEnricher(rules: IRules) {
return new StatBlockTextEnricher(jest.fn(), jest.fn(), jest.fn(), null, rules);
}
export function buildEncounter() {
const rules = new DefaultRules();
const enricher = buildStatBlockTextEnricher(rules);
const encounter = new Encounter(new PromptQueue(), null, jest.fn().mockReturnValue(null), jest.fn(), rules, enricher);
return encounter;
} | import { PromptQueue } from "../Commands/Prompts/PromptQueue";
import { Encounter } from "../Encounter/Encounter";
import { SpellLibrary } from "../Library/SpellLibrary";
import { DefaultRules, IRules } from "../Rules/Rules";
import { StatBlockTextEnricher } from "../StatBlock/StatBlockTextEnricher";
export function buildStatBlockTextEnricher(rules: IRules) {
return new StatBlockTextEnricher(jest.fn(), jest.fn(), jest.fn(), new SpellLibrary(), rules);
}
export function buildEncounter() {
const rules = new DefaultRules();
const enricher = buildStatBlockTextEnricher(rules);
const encounter = new Encounter(new PromptQueue(), null, jest.fn().mockReturnValue(null), jest.fn(), rules, enricher);
return encounter;
} | Use an actual SpellLibrary in test StatBlockTextEnricher | Use an actual SpellLibrary in test StatBlockTextEnricher
| TypeScript | mit | cynicaloptimist/improved-initiative,cynicaloptimist/improved-initiative,cynicaloptimist/improved-initiative | ---
+++
@@ -1,10 +1,11 @@
import { PromptQueue } from "../Commands/Prompts/PromptQueue";
import { Encounter } from "../Encounter/Encounter";
+import { SpellLibrary } from "../Library/SpellLibrary";
import { DefaultRules, IRules } from "../Rules/Rules";
import { StatBlockTextEnricher } from "../StatBlock/StatBlockTextEnricher";
export function buildStatBlockTextEnricher(rules: IRules) {
- return new StatBlockTextEnricher(jest.fn(), jest.fn(), jest.fn(), null, rules);
+ return new StatBlockTextEnricher(jest.fn(), jest.fn(), jest.fn(), new SpellLibrary(), rules);
}
export function buildEncounter() { |
32fa0e0fc5eab2d496e06e6d68a0a96765de0446 | source/services/test/test.module.ts | source/services/test/test.module.ts | import './chaiMoment';
export * from './mockPromise';
export * from './angularFixture';
| import './chaiMoment';
import async from './async';
export { async };
export * from './mockPromise';
export * from './angularFixture';
| Make sure that async is exported as async | Make sure that async is exported as async
The async function is the default export of the async module, so we need to export it on the test module as a named export "async"
| TypeScript | mit | RenovoSolutions/TypeScript-Angular-Utilities,RenovoSolutions/TypeScript-Angular-Utilities,SamGraber/TypeScript-Angular-Utilities,SamGraber/TypeScript-Angular-Utilities | ---
+++
@@ -1,4 +1,6 @@
import './chaiMoment';
+import async from './async';
+export { async };
export * from './mockPromise';
export * from './angularFixture'; |
cc0389f69d0331eb92baca5133baea32eb96eb97 | components/HorizontalRule.tsx | components/HorizontalRule.tsx | import { Fragment } from "react"
const HorizontalRule = () => (
<Fragment>
<hr></hr>
<style jsx>{`
hr {
margin: 8px 0;
height: 1px;
border: 0;
background-image: linear-gradient(
to left,
rgba(84, 84, 88, 0.35),
rgba(84, 84, 88, 1),
rgba(84, 84, 88, 0.35)
);
}
@media (prefers-color-scheme: light) {
hr {
background-image: linear-gradient(
to left,
rgba(1, 1, 1, 0),
rgba(1, 1, 1, 0.75),
rgba(1, 1, 1, 0)
);
}
}
`}</style>
</Fragment>
)
export default HorizontalRule
| import { Fragment } from "react"
const HorizontalRule = () => (
<Fragment>
<hr></hr>
<style jsx>{`
hr {
margin: 8px 0;
height: 1px;
border: 0;
background-image: linear-gradient(
to left,
rgba(84, 84, 88, 0.35),
rgba(84, 84, 88, 1),
rgba(84, 84, 88, 0.35)
);
}
@media (min-resolution: 2dppx) {
hr {
height: 0.5px;
}
}
@media (min-resolution: 3dppx) {
hr {
height: calc(1/3)px;
}
}
@media (prefers-color-scheme: light) {
hr {
background-image: linear-gradient(
to left,
rgba(1, 1, 1, 0),
rgba(1, 1, 1, 0.75),
rgba(1, 1, 1, 0)
);
}
}
`}</style>
</Fragment>
)
export default HorizontalRule
| Update `HorizonalRule` to be hairline height | Update `HorizonalRule` to be hairline height
| TypeScript | mit | JosephDuffy/josephduffy.co.uk,JosephDuffy/josephduffy.co.uk,JosephDuffy/josephduffy.co.uk | ---
+++
@@ -16,6 +16,18 @@
);
}
+ @media (min-resolution: 2dppx) {
+ hr {
+ height: 0.5px;
+ }
+ }
+
+ @media (min-resolution: 3dppx) {
+ hr {
+ height: calc(1/3)px;
+ }
+ }
+
@media (prefers-color-scheme: light) {
hr {
background-image: linear-gradient( |
76306b854c1584ae348f0ff3d0c0de9c3d5d5d63 | src/System/es6-template-string.d.ts | src/System/es6-template-string.d.ts | declare module "es6-template-string"
{
/**
* Provides the functionality to process es6 template-strings.
*/
interface IES6Template
{
/**
* Renders an es6 template-string.
*
* @param template
* The template to render.
*
* @param context
* The variables to use.
*
* @returns
* The rendered text.
*/
render(template: string, context?: Record<string, unknown>): string;
/**
* Compiles a template.
*
* @param template
* The template to render.
*
* @returns
* The rendered text.
*/
compile(template: string): ICompiledRenderer;
/**
* Renders an es6 template-string.
*
* @param template
* The template to render.
*
* @param context
* The variables to use.
*
* @returns
* The rendered text.
*/
(template: string, context?: Record<string, unknown>): string;
}
/**
* Represents a compiled renderer.
*/
type ICompiledRenderer =
/**
* Renders the compiled template.
*
* @param context
* The variables to use.
*
* @returns
* The rendered text.
*/
(context: Record<string, unknown>) => string;
/**
* Provides the functionality to render es6 string-templates.
*/
const template: IES6Template;
export = template;
}
| declare module "es6-template-string"
{
/**
* Provides the functionality to process es6 template-strings.
*/
interface IES6Template
{
/**
* Renders an es6 template-string.
*
* @param template
* The template to render.
*
* @param context
* The variables to use.
*
* @returns
* The rendered text.
*/
render(template: string, context?: any): string;
/**
* Compiles a template.
*
* @param template
* The template to render.
*
* @returns
* The rendered text.
*/
compile(template: string): ICompiledRenderer;
/**
* Renders an es6 template-string.
*
* @param template
* The template to render.
*
* @param context
* The variables to use.
*
* @returns
* The rendered text.
*/
(template: string, context?: any): string;
}
/**
* Represents a compiled renderer.
*/
type ICompiledRenderer =
/**
* Renders the compiled template.
*
* @param context
* The variables to use.
*
* @returns
* The rendered text.
*/
(context: any) => string;
/**
* Provides the functionality to render es6 string-templates.
*/
const template: IES6Template;
export = template;
}
| Refactor the types of `es6-template-string` | Refactor the types of `es6-template-string`
| TypeScript | mit | manuth/MarkdownConverter,manuth/MarkdownConverter,manuth/MarkdownConverter | ---
+++
@@ -17,7 +17,7 @@
* @returns
* The rendered text.
*/
- render(template: string, context?: Record<string, unknown>): string;
+ render(template: string, context?: any): string;
/**
* Compiles a template.
@@ -42,7 +42,7 @@
* @returns
* The rendered text.
*/
- (template: string, context?: Record<string, unknown>): string;
+ (template: string, context?: any): string;
}
/**
@@ -58,7 +58,7 @@
* @returns
* The rendered text.
*/
- (context: Record<string, unknown>) => string;
+ (context: any) => string;
/**
* Provides the functionality to render es6 string-templates. |
d67452313913b0cf34d49c902e4c05237c3685fb | src/import-dotx/import-dotx.spec.ts | src/import-dotx/import-dotx.spec.ts | import { expect } from "chai";
import { ImportDotx } from "./import-dotx";
describe("ImportDotx", () => {
describe("#constructor", () => {
it("should create", () => {
const file = new ImportDotx();
expect(file).to.deep.equal({ currentRelationshipId: 1 });
});
});
// describe("#extract", () => {
// it("should create", async () => {
// const file = new ImportDotx();
// const filePath = "./demo/dotx/template.dotx";
// const templateDocument = await file.extract(data);
// await file.extract(data);
// expect(templateDocument).to.be.equal({ currentRelationshipId: 1 });
// });
// });
});
| import { expect } from "chai";
import { ImportDotx } from "./import-dotx";
describe("ImportDotx", () => {
describe("#constructor", () => {
it("should create", () => {
const file = new ImportDotx();
expect(file).to.deep.equal({});
});
});
// describe("#extract", () => {
// it("should create", async () => {
// const file = new ImportDotx();
// const filePath = "./demo/dotx/template.dotx";
// const templateDocument = await file.extract(data);
// await file.extract(data);
// expect(templateDocument).to.be.equal({ currentRelationshipId: 1 });
// });
// });
});
| Fix tests - No longer uses dummy variable | Fix tests - No longer uses dummy variable
| TypeScript | mit | dolanmiu/docx,dolanmiu/docx,dolanmiu/docx | ---
+++
@@ -7,7 +7,7 @@
it("should create", () => {
const file = new ImportDotx();
- expect(file).to.deep.equal({ currentRelationshipId: 1 });
+ expect(file).to.deep.equal({});
});
});
|
cd13a6da67a8fa2ee8605a4c718de812f8322292 | src/js/bootstrap.ts | src/js/bootstrap.ts | import 'materialize-css';
import 'angular2-materialize';
import { AnimationBuilder } from 'css-animator/builder';
AnimationBuilder.defaults.fixed = true;
| import * as Hammer from 'hammerjs';
(window as any).Hammer = Hammer;
import { AnimationBuilder } from 'css-animator/builder';
import 'materialize-css';
import 'angular2-materialize';
AnimationBuilder.defaults.fixed = true;
| Resolve missing hammerjs for materialize. | Resolve missing hammerjs for materialize.
| TypeScript | mit | fabianweb/hue,fabiandev/angular2-quiz-app,fabiandev/angular2-quiz-app,fabiandev/angular2-quiz-app,fabianweb/hue,fabianweb/hue | ---
+++
@@ -1,5 +1,8 @@
+import * as Hammer from 'hammerjs';
+(window as any).Hammer = Hammer;
+
+import { AnimationBuilder } from 'css-animator/builder';
import 'materialize-css';
import 'angular2-materialize';
-import { AnimationBuilder } from 'css-animator/builder';
AnimationBuilder.defaults.fixed = true; |
0283879bc6ab00875c620c3020d8a773854169af | src/api/timeEntries.ts | src/api/timeEntries.ts | import {
TimeEntriesPagenationParameters,
TimeEntry
} from '../models/timeEntries.models';
// Admin permissions required.
export class TimeEntriesAPI {
harvest;
baseUrl: string;
constructor(harvest) {
this.baseUrl = '/v2/time_entries';
this.harvest = harvest;
}
public get(id) {
return this.harvest.request('GET', `${this.baseUrl}/${id}`);
}
public list(query: TimeEntriesPagenationParameters = {}) {
return this.harvest.request('GET', this.baseUrl, query);
}
public create(data: TimeEntry) {
return this.harvest.request('POST', this.baseUrl, data);
}
public update(id, data) {
return this.harvest.request('PATCH', `${this.baseUrl}/${id}`, data);
}
public delete(id) {
return this.harvest.request('DELETE', `${this.baseUrl}/${id}`);
}
// Restarting a time entry is only possible if it isn’t currently running.
// Returns a 200 OK response code if the call succeeded.
public restart(id) {
return this.harvest.request('PATCH', `${this.baseUrl}/${id}/restart`);
}
// Stopping a time entry is only possible if it’s currently running.
// Returns a 200 OK response code if the call succeeded.
public stop(id) {
return this.harvest.request('PATCH', `${this.baseUrl}/${id}/stop`);
}
}
| import {
TimeEntriesPagenationParameters,
TimeEntry,
TimeEntryCreateFromDuration,
TimeEntryCreateFromStartAndEndTime
} from '../models/timeEntries.models';
// Admin permissions required.
export class TimeEntriesAPI {
harvest;
baseUrl: string;
constructor(harvest) {
this.baseUrl = '/v2/time_entries';
this.harvest = harvest;
}
public get(id) {
return this.harvest.request('GET', `${this.baseUrl}/${id}`);
}
public list(query: TimeEntriesPagenationParameters = {}) {
return this.harvest.request('GET', this.baseUrl, query);
}
public create(data: TimeEntryCreateFromDuration | TimeEntryCreateFromStartAndEndTime) {
return this.harvest.request('POST', this.baseUrl, data);
}
public update(id, data) {
return this.harvest.request('PATCH', `${this.baseUrl}/${id}`, data);
}
public delete(id) {
return this.harvest.request('DELETE', `${this.baseUrl}/${id}`);
}
// Restarting a time entry is only possible if it isn’t currently running.
// Returns a 200 OK response code if the call succeeded.
public restart(id) {
return this.harvest.request('PATCH', `${this.baseUrl}/${id}/restart`);
}
// Stopping a time entry is only possible if it’s currently running.
// Returns a 200 OK response code if the call succeeded.
public stop(id) {
return this.harvest.request('PATCH', `${this.baseUrl}/${id}/stop`);
}
}
| Use creation interfaces for parameter | Use creation interfaces for parameter
| TypeScript | mit | log0ymxm/node-harvest | ---
+++
@@ -1,6 +1,8 @@
import {
TimeEntriesPagenationParameters,
- TimeEntry
+ TimeEntry,
+ TimeEntryCreateFromDuration,
+ TimeEntryCreateFromStartAndEndTime
} from '../models/timeEntries.models';
// Admin permissions required.
@@ -21,7 +23,7 @@
return this.harvest.request('GET', this.baseUrl, query);
}
- public create(data: TimeEntry) {
+ public create(data: TimeEntryCreateFromDuration | TimeEntryCreateFromStartAndEndTime) {
return this.harvest.request('POST', this.baseUrl, data);
}
|
8f696734ee407ac375d377b8ee15c758c3079f7f | app/datastore/sample-objects.ts | app/datastore/sample-objects.ts | import {IdaiFieldDocument} from '../model/idai-field-document';
export var DOCS: IdaiFieldDocument[] = [
{
"id" : "o1", "resource" : { "id": "o1",
"identifier": "ob1",
"title": "Obi One Kenobi",
"cuts" : ["o2"],
"type": "object"
},
"synced": 0
},
{
"id" : "o2", "resource" : { "id" : "o2",
"identifier": "ob2",
"title": "Qui Gon Jinn",
"isCutBy" : ["o1"],
"type": "object"
},
"synced": 0
},
{
"id" : "o3", "resource" : { "id": "o3",
"identifier": "ob3", "title": "Luke Skywalker", "type": "object"
},
"synced": 0
},
{
"id" : "o4", "resource" : { "id": "o4",
"identifier": "ob4", "title": "Han Solo", "type": "object"
},
"synced": 0
},
{
"id" : "o5", "resource" : { "id": "o5",
"identifier": "ob5", "title": "Boba Fett", "type": "object"
},
"synced": 0
}
]; | import {IdaiFieldDocument} from '../model/idai-field-document';
export var DOCS: IdaiFieldDocument[] = [
{
"id" : "o1", "resource" : { "id": "o1",
"identifier": "ob1",
"title": "Obi One Kenobi",
"relations" : { "cuts" : ["o2"] },
"type": "object"
},
"synced": 0
},
{
"id" : "o2", "resource" : { "id" : "o2",
"identifier": "ob2",
"title": "Qui Gon Jinn",
"relations" : { "isCutBy" : ["o1"] },
"type": "object"
},
"synced": 0
},
{
"id" : "o3", "resource" : { "id": "o3",
"identifier": "ob3", "title": "Luke Skywalker", "type": "object",
"relations" : {}
},
"synced": 0
},
{
"id" : "o4", "resource" : { "id": "o4",
"identifier": "ob4", "title": "Han Solo", "type": "object",
"relations" : {}
},
"synced": 0
},
{
"id" : "o5", "resource" : { "id": "o5",
"identifier": "ob5", "title": "Boba Fett", "type": "object",
"relations" : {}
},
"synced": 0
}
]; | Adjust sample objects. Add 'relations' level. | Adjust sample objects. Add 'relations' level.
| TypeScript | apache-2.0 | codarchlab/idai-field-client,codarchlab/idai-field-client,codarchlab/idai-field-client,codarchlab/idai-field-client | ---
+++
@@ -5,7 +5,7 @@
"id" : "o1", "resource" : { "id": "o1",
"identifier": "ob1",
"title": "Obi One Kenobi",
- "cuts" : ["o2"],
+ "relations" : { "cuts" : ["o2"] },
"type": "object"
},
"synced": 0
@@ -14,26 +14,29 @@
"id" : "o2", "resource" : { "id" : "o2",
"identifier": "ob2",
"title": "Qui Gon Jinn",
- "isCutBy" : ["o1"],
+ "relations" : { "isCutBy" : ["o1"] },
"type": "object"
},
"synced": 0
},
{
"id" : "o3", "resource" : { "id": "o3",
- "identifier": "ob3", "title": "Luke Skywalker", "type": "object"
+ "identifier": "ob3", "title": "Luke Skywalker", "type": "object",
+ "relations" : {}
},
"synced": 0
},
{
"id" : "o4", "resource" : { "id": "o4",
- "identifier": "ob4", "title": "Han Solo", "type": "object"
+ "identifier": "ob4", "title": "Han Solo", "type": "object",
+ "relations" : {}
},
"synced": 0
},
{
"id" : "o5", "resource" : { "id": "o5",
- "identifier": "ob5", "title": "Boba Fett", "type": "object"
+ "identifier": "ob5", "title": "Boba Fett", "type": "object",
+ "relations" : {}
},
"synced": 0
} |
a245ea55496176e2c41100c6460f61271fb1537b | src/CLI.ts | src/CLI.ts | /*
Fractive: A hypertext authoring tool -- https://github.com/invicticide/fractive
Copyright (C) 2017 Josh Sutphin
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, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Compiler } from "./Compiler";
/**
* Invoke 'node lib/CLI.js <command> <args>' to execute command-line tools
*/
for(let i = 0; i < process.argv.length; i++)
{
switch(process.argv[i])
{
case "compile":
{
if(process.argv.length < i + 3)
{
Compiler.ShowUsage();
process.exit(1);
}
else
{
Compiler.Compile(
process.argv[i + 1],
process.argv[i + 2],
JSON.parse(process.argv[i + 3])
);
}
break;
}
}
}
| /*
Fractive: A hypertext authoring tool -- https://github.com/invicticide/fractive
Copyright (C) 2017 Josh Sutphin
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, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { Compiler } from "./Compiler";
/**
* Invoke 'node lib/CLI.js <command> <args>' to execute command-line tools
*/
for(let i = 0; i < process.argv.length; i++)
{
switch(process.argv[i])
{
case "compile":
{
if(process.argv.length < i + 3)
{
Compiler.ShowUsage();
process.exit(1);
}
else
{
let bundleJavascript : boolean = true;
if(process.argv[i + 3] === "false") { bundleJavascript = false; }
Compiler.Compile(
process.argv[i + 1],
process.argv[i + 2],
bundleJavascript
);
}
break;
}
}
}
| Make the bundleJavascript compiler flag optional (default: true) | Make the bundleJavascript compiler flag optional (default: true)
| TypeScript | agpl-3.0 | invicticide/fractive,invicticide/fractive,invicticide/fractive | ---
+++
@@ -35,10 +35,13 @@
}
else
{
+ let bundleJavascript : boolean = true;
+ if(process.argv[i + 3] === "false") { bundleJavascript = false; }
+
Compiler.Compile(
process.argv[i + 1],
process.argv[i + 2],
- JSON.parse(process.argv[i + 3])
+ bundleJavascript
);
}
break; |
d90fb8f346f3c2a290d0459a5240bc28ceb0144c | editor/rendering/camera.ts | editor/rendering/camera.ts |
export class Camera {
// Values, the actual matrix is the transposed of that one
private values: Array<number> = [
1, 0, 0,
0, 1, 0,
0, 0, 0
];
// Object space coordinates should map to pixels when
// the scale factor is 1.
// TODO: fix that (currently not the case)
private zoom_factor = 1.0;
// Top left corner of the camera in object space
pos: [number, number] = [0, 0];
// Camera dimensions in object space.
wos: number = 1; // width in object space
hos: number = 1; // height in object space
translate(x: number, y: number) {
this.values[7] += x;
this.values[8] += y;
}
zoom(value: number) {
let f = 1 / this.zoom_factor;
this.zoom_factor += value;
this.values[0] *= this.zoom_factor * f;
this.values[4] *= this.zoom_factor * f;
}
viewport(width: number, height: number) {
this.wos = width;
this.hos = height;
this.values[0] = 1 / width;
this.values[4] = 1 / height;
}
}
|
export class Camera {
// Values, the actual matrix is the transposed of that one
private values: Array<number> = [
2, 0, 0,
0, 2, 0,
0, 0, 0
];
// Object space coordinates should map to pixels when
// the scale factor is 1.
// TODO: fix that (currently not the case)
private zoom_factor = 2.0;
// Top left corner of the camera in object space
pos: [number, number] = [0, 0];
// Camera dimensions in object space.
wos: number = 1; // width in object space
hos: number = 1; // height in object space
translate(x: number, y: number) {
this.values[7] += x;
this.values[8] += y;
}
zoom(value: number) {
let f = 1 / this.zoom_factor;
this.zoom_factor += value;
this.values[0] *= this.zoom_factor * f;
this.values[4] *= this.zoom_factor * f;
}
viewport(width: number, height: number) {
this.wos = width;
this.hos = height;
this.values[0] = this.zoom_factor / width;
this.values[4] = this.zoom_factor / height;
}
}
| Fix a bug and set the default zoom to 2. | Fix a bug and set the default zoom to 2.
| TypeScript | mit | GreenPix/dilia,Nemikolh/dilia,GreenPix/dilia,Nemikolh/dilia,GreenPix/editor,GreenPix/editor,GreenPix/dilia,Nemikolh/dilia,GreenPix/editor,Nemikolh/dilia,GreenPix/dilia,GreenPix/editor | ---
+++
@@ -3,15 +3,15 @@
// Values, the actual matrix is the transposed of that one
private values: Array<number> = [
- 1, 0, 0,
- 0, 1, 0,
+ 2, 0, 0,
+ 0, 2, 0,
0, 0, 0
];
// Object space coordinates should map to pixels when
// the scale factor is 1.
// TODO: fix that (currently not the case)
- private zoom_factor = 1.0;
+ private zoom_factor = 2.0;
// Top left corner of the camera in object space
@@ -35,7 +35,7 @@
viewport(width: number, height: number) {
this.wos = width;
this.hos = height;
- this.values[0] = 1 / width;
- this.values[4] = 1 / height;
+ this.values[0] = this.zoom_factor / width;
+ this.values[4] = this.zoom_factor / height;
}
} |
42a2ca8381247bc6654822068a833ef73fcc79ca | src/interface/index.ts | src/interface/index.ts | export { default as Icon } from './Icon';
export { default as SpellLink } from './SpellLink';
export { default as SpellIcon } from './SpellIcon';
export { default as ItemLink } from './ItemLink';
export { default as ItemIcon } from './ItemIcon';
export { default as ResourceLink } from './ResourceLink';
export { default as ResourceIcon } from './ResourceIcon';
export { default as SpecIcon } from './SpecIcon';
export { default as Panel } from './Panel';
export { default as AlertDanger } from './AlertDanger';
export { default as AlertInfo } from './AlertInfo';
export { default as AlertWarning } from './AlertWarning';
export { default as ErrorBoundary } from './ErrorBoundary';
export { default as Tooltip, TooltipElement } from './Tooltip';
export { default as makeAnalyzerUrl } from './makeAnalyzerUrl';
export { Expandable, ControlledExpandable } from './Expandable';
| export { default as Icon } from './Icon';
export { default as ConduitLink } from './ConduitLink';
export { default as SpellLink } from './SpellLink';
export { default as SpellIcon } from './SpellIcon';
export { default as ItemLink } from './ItemLink';
export { default as ItemIcon } from './ItemIcon';
export { default as ResourceLink } from './ResourceLink';
export { default as ResourceIcon } from './ResourceIcon';
export { default as SpecIcon } from './SpecIcon';
export { default as Panel } from './Panel';
export { default as AlertDanger } from './AlertDanger';
export { default as AlertInfo } from './AlertInfo';
export { default as AlertWarning } from './AlertWarning';
export { default as ErrorBoundary } from './ErrorBoundary';
export { default as Tooltip, TooltipElement } from './Tooltip';
export { default as makeAnalyzerUrl } from './makeAnalyzerUrl';
export { Expandable, ControlledExpandable } from './Expandable';
| Add ConduitLink to interface export. | Add ConduitLink to interface export.
| TypeScript | agpl-3.0 | sMteX/WoWAnalyzer,WoWAnalyzer/WoWAnalyzer,sMteX/WoWAnalyzer,WoWAnalyzer/WoWAnalyzer,WoWAnalyzer/WoWAnalyzer,sMteX/WoWAnalyzer | ---
+++
@@ -1,4 +1,5 @@
export { default as Icon } from './Icon';
+export { default as ConduitLink } from './ConduitLink';
export { default as SpellLink } from './SpellLink';
export { default as SpellIcon } from './SpellIcon';
export { default as ItemLink } from './ItemLink'; |
df156adb1fd9f27fbe243a5a143cdead981adb8a | src/test/_config.ts | src/test/_config.ts | import { Config, LoadBalancingStrategy } from "../connection";
const ARANGO_URL = process.env.TEST_ARANGODB_URL || "http://localhost:8529";
const ARANGO_VERSION = Number(
process.env.ARANGO_VERSION || process.env.ARANGOJS_DEVEL_VERSION || 39999
);
const ARANGO_LOAD_BALANCING_STRATEGY = process.env
.TEST_ARANGO_LOAD_BALANCING_STRATEGY as LoadBalancingStrategy | undefined;
export const config: Config & {
arangoVersion: NonNullable<Config["arangoVersion"]>;
} = ARANGO_URL.includes(",")
? {
url: ARANGO_URL.split(",").filter((s) => Boolean(s)),
arangoVersion: ARANGO_VERSION,
precaptureStackTraces: true,
loadBalancingStrategy: ARANGO_LOAD_BALANCING_STRATEGY || "ROUND_ROBIN",
}
: {
url: ARANGO_URL,
arangoVersion: ARANGO_VERSION,
precaptureStackTraces: true,
};
| import { Config, LoadBalancingStrategy } from "../connection";
const ARANGO_URL = process.env.TEST_ARANGODB_URL || "http://localhost:8529";
const ARANGO_VERSION = Number(
process.env.ARANGO_VERSION || process.env.ARANGOJS_DEVEL_VERSION || 39999
);
const ARANGO_LOAD_BALANCING_STRATEGY = process.env
.TEST_ARANGO_LOAD_BALANCING_STRATEGY as LoadBalancingStrategy | undefined;
export const config: Config & {
arangoVersion: NonNullable<Config["arangoVersion"]>;
} = ARANGO_URL.includes(",")
? {
url: ARANGO_URL.split(",").filter((s) => Boolean(s)),
arangoVersion: ARANGO_VERSION,
loadBalancingStrategy: ARANGO_LOAD_BALANCING_STRATEGY || "ROUND_ROBIN",
}
: {
url: ARANGO_URL,
arangoVersion: ARANGO_VERSION,
};
| Disable precaptureStackTraces in tests for now | Disable precaptureStackTraces in tests for now
Thinking this might cause the timeouts we're seeing in some cursor tests. | TypeScript | apache-2.0 | arangodb/arangojs,arangodb/arangojs | ---
+++
@@ -13,11 +13,9 @@
? {
url: ARANGO_URL.split(",").filter((s) => Boolean(s)),
arangoVersion: ARANGO_VERSION,
- precaptureStackTraces: true,
loadBalancingStrategy: ARANGO_LOAD_BALANCING_STRATEGY || "ROUND_ROBIN",
}
: {
url: ARANGO_URL,
arangoVersion: ARANGO_VERSION,
- precaptureStackTraces: true,
}; |
b772907b2d527ea471dcaaab3a078ae81ad3ba3e | types/cors/cors-tests.ts | types/cors/cors-tests.ts |
import express = require('express');
import cors = require('cors');
const app = express();
app.use(cors());
app.use(cors({
maxAge: 100,
credentials: true,
optionsSuccessStatus: 200
}));
app.use(cors({
methods: 'GET,POST,PUT',
exposedHeaders: 'Content-Range,X-Content-Range',
allowedHeaders: 'Content-Type,Authorization'
}));
app.use(cors({
methods: ['GET', 'POST', 'PUT', 'DELETE'],
exposedHeaders: ['Content-Range', 'X-Content-Range'],
allowedHeaders: ['Content-Type', 'Authorization']
}));
app.use(cors({
origin: true
}));
app.use(cors({
origin: 'http://example.com'
}));
app.use(cors({
origin: /example\.com$/
}));
app.use(cors({
origin: ['http://example.com', 'http://fakeurl.com']
}));
app.use(cors({
origin: [/example\.com$/, /fakeurl\.com$/]
}));
app.use(cors({
origin: (requestOrigin, cb) => {
try {
const allow = requestOrigin.indexOf('.edu') !== -1;
cb(null, allow);
} catch (err) {
cb(err);
}
}
}));
|
import express = require('express');
import cors = require('cors');
const app = express();
app.use(cors());
app.use(cors({
maxAge: 100,
credentials: true,
optionsSuccessStatus: 200
}));
app.use(cors({
methods: 'GET,POST,PUT',
exposedHeaders: 'Content-Range,X-Content-Range',
allowedHeaders: 'Content-Type,Authorization'
}));
app.use(cors({
methods: ['GET', 'POST', 'PUT', 'DELETE'],
exposedHeaders: ['Content-Range', 'X-Content-Range'],
allowedHeaders: ['Content-Type', 'Authorization']
}));
app.use(cors({
origin: true
}));
app.use(cors({
origin: 'http://example.com'
}));
app.use(cors({
origin: /example\.com$/
}));
app.use(cors({
origin: [/example\.com$/, 'http://example.com']
}));
app.use(cors({
origin: ['http://example.com', 'http://fakeurl.com']
}));
app.use(cors({
origin: [/example\.com$/, /fakeurl\.com$/]
}));
app.use(cors({
origin: (requestOrigin, cb) => {
try {
const allow = requestOrigin.indexOf('.edu') !== -1;
cb(null, allow);
} catch (err) {
cb(err);
}
}
}));
| Add test for mixed type array | Add test for mixed type array
| TypeScript | mit | zuzusik/DefinitelyTyped,aciccarello/DefinitelyTyped,zuzusik/DefinitelyTyped,AgentME/DefinitelyTyped,georgemarshall/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,arusakov/DefinitelyTyped,borisyankov/DefinitelyTyped,aciccarello/DefinitelyTyped,dsebastien/DefinitelyTyped,benliddicott/DefinitelyTyped,rolandzwaga/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,zuzusik/DefinitelyTyped,chrootsu/DefinitelyTyped,aciccarello/DefinitelyTyped,georgemarshall/DefinitelyTyped,AgentME/DefinitelyTyped,dsebastien/DefinitelyTyped,chrootsu/DefinitelyTyped,alexdresko/DefinitelyTyped,rolandzwaga/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,one-pieces/DefinitelyTyped,borisyankov/DefinitelyTyped,markogresak/DefinitelyTyped,AgentME/DefinitelyTyped,georgemarshall/DefinitelyTyped,arusakov/DefinitelyTyped,arusakov/DefinitelyTyped,mcliment/DefinitelyTyped,georgemarshall/DefinitelyTyped,magny/DefinitelyTyped,magny/DefinitelyTyped,alexdresko/DefinitelyTyped,AgentME/DefinitelyTyped,laurentiustamate94/DefinitelyTyped | ---
+++
@@ -29,6 +29,9 @@
origin: /example\.com$/
}));
app.use(cors({
+ origin: [/example\.com$/, 'http://example.com']
+}));
+app.use(cors({
origin: ['http://example.com', 'http://fakeurl.com']
}));
app.use(cors({ |
f53890943f8c1497aab089f6b57079710e6236a2 | generators/techs/templates/src/app/footer.spec.tsx | generators/techs/templates/src/app/footer.spec.tsx | import React from 'react';
import {shallow} from 'enzyme';
import {Footer} from './footer';
describe('Footer', () => {
it('should be a footer', () => {
expect(shallow(<Footer/>).is('footer')).toBe(true);
});
});
| /* tslint:disable:no-unused-variable */
import React from 'react';
import {shallow} from 'enzyme';
import {Footer} from './footer';
describe('Footer', () => {
it('should be a footer', () => {
expect(shallow(<Footer/>).is('footer')).toBe(true);
});
});
| Add exceptioin for tslint rule no-unused-var | Add exceptioin for tslint rule no-unused-var
| TypeScript | mit | FountainJS/generator-fountain-react,FountainJS/generator-fountain-react,FountainJS/generator-fountain-react | ---
+++
@@ -1,3 +1,4 @@
+/* tslint:disable:no-unused-variable */
import React from 'react';
import {shallow} from 'enzyme';
|
883bc29a92d52646a0c10739bbeb9074610a6941 | index.ts | index.ts | // Copyright (C) 2016 Sergey Akopkokhyants
// This project is licensed under the terms of the MIT license.
// https://github.com/akserg/ng2-toasty
import { NgModule, ModuleWithProviders } from "@angular/core";
export * from './src/toasty.service';
export * from './src/toasty.component';
import { ToastyComponent } from './src/toasty.component';
import { ToastComponent } from './src/toast.component';
import { ToastyService, toastyServiceFactory } from './src/toasty.service';
export let providers = [{ provide: ToastyService, useFactory: toastyServiceFactory }];
@NgModule({
declarations: [ToastComponent, ToastyComponent],
exports : [ToastComponent, ToastyComponent],
providers: providers
})
export class ToastyModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: ToastyModule,
providers: providers
};
}
} | // Copyright (C) 2016 Sergey Akopkokhyants
// This project is licensed under the terms of the MIT license.
// https://github.com/akserg/ng2-toasty
import { NgModule, ModuleWithProviders } from "@angular/core";
import { CommonModule } from '@angular/common';
export * from './src/toasty.service';
export * from './src/toasty.component';
import { ToastyComponent } from './src/toasty.component';
import { ToastComponent } from './src/toast.component';
import { ToastyService, toastyServiceFactory } from './src/toasty.service';
export let providers = [{ provide: ToastyService, useFactory: toastyServiceFactory }];
@NgModule({
imports: [CommonModule],
declarations: [ToastComponent, ToastyComponent],
exports: [ ToastComponent, ToastyComponent],
providers: providers
})
export class ToastyModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: ToastyModule,
providers: providers
};
}
} | Fix for can't bind to ngClass in div | fix(): Fix for can't bind to ngClass in div
| TypeScript | mit | akserg/ng2-toasty,akserg/ng2-toasty | ---
+++
@@ -3,6 +3,7 @@
// https://github.com/akserg/ng2-toasty
import { NgModule, ModuleWithProviders } from "@angular/core";
+import { CommonModule } from '@angular/common';
export * from './src/toasty.service';
export * from './src/toasty.component';
@@ -14,12 +15,13 @@
export let providers = [{ provide: ToastyService, useFactory: toastyServiceFactory }];
@NgModule({
- declarations: [ToastComponent, ToastyComponent],
- exports : [ToastComponent, ToastyComponent],
- providers: providers
+ imports: [CommonModule],
+ declarations: [ToastComponent, ToastyComponent],
+ exports: [ ToastComponent, ToastyComponent],
+ providers: providers
})
export class ToastyModule {
- static forRoot(): ModuleWithProviders {
+ static forRoot(): ModuleWithProviders {
return {
ngModule: ToastyModule,
providers: providers |
ab9f052f5ed73833e2bca4ca18657345d76ee66d | src/app/components/list-paging/list-paging-demo.component.ts | src/app/components/list-paging/list-paging-demo.component.ts | import { Component } from '@angular/core';
import {
ListState,
ListStateDispatcher,
ListItemsLoadAction,
ListItemModel
} from '../../../core';
@Component({
selector: 'sky-list-paging-demo',
templateUrl: './list-paging-demo.component.html',
providers: [
ListState,
ListStateDispatcher
]
})
export class SkyListPagingDemoComponent {
constructor(
private dispatcher: ListStateDispatcher
) {
this.dispatcher.next(new ListItemsLoadAction([
new ListItemModel('1'),
new ListItemModel('2'),
new ListItemModel('3'),
new ListItemModel('4'),
new ListItemModel('5'),
new ListItemModel('6'),
new ListItemModel('7')
], true));
}
}
| import { Component } from '@angular/core';
import {
ListStateDispatcher,
ListItemsLoadAction,
ListItemModel
} from '../../../core';
@Component({
selector: 'sky-list-paging-demo',
templateUrl: './list-paging-demo.component.html',
providers: [
ListStateDispatcher
]
})
export class SkyListPagingDemoComponent {
constructor(
private dispatcher: ListStateDispatcher
) {
this.dispatcher.next(new ListItemsLoadAction([
new ListItemModel('1'),
new ListItemModel('2'),
new ListItemModel('3'),
new ListItemModel('4'),
new ListItemModel('5'),
new ListItemModel('6'),
new ListItemModel('7')
], true));
}
}
| Undo reverting to old version | Undo reverting to old version | TypeScript | mit | blackbaud/skyux2,blackbaud/skyux2,blackbaud-joshgerdes/skyux2,blackbaud-joshgerdes/skyux2,blackbaud/skyux2,blackbaud-joshgerdes/skyux2,blackbaud/skyux2,blackbaud-joshgerdes/skyux2 | ---
+++
@@ -1,7 +1,6 @@
import { Component } from '@angular/core';
import {
- ListState,
ListStateDispatcher,
ListItemsLoadAction,
ListItemModel
@@ -11,7 +10,6 @@
selector: 'sky-list-paging-demo',
templateUrl: './list-paging-demo.component.html',
providers: [
- ListState,
ListStateDispatcher
]
}) |
9223b02136f0ede6ebeacf0404a7c8c9a2851486 | tests/cases/conformance/classes/classExpressions/genericClassExpressionInFunction.ts | tests/cases/conformance/classes/classExpressions/genericClassExpressionInFunction.ts | class A<T> {
genericVar: T
}
function B<T>() {
// class expression can use T
return class extends A<T> { }
}
// extends can call B
class K extends B<number>() {
name: string;
}
var c = new K();
c.genericVar = 12;
| class A<T> {
genericVar: T
}
class B3 extends A<number> {
}
function B1<U>() {
// class expression can use T
return class extends A<U> { }
}
class B2<V> {
anon = class extends A<V> { }
}
// extends can call B
class K extends B1<number>() {
namae: string;
}
class C extends (new B2<number>().anon) {
name: string;
}
var c = new C();
var k = new K();
var b3 = new B3();
c.genericVar = 12;
k.genericVar = 12;
b3.genericVar = 12
| Improve test case and add working comparison | Improve test case and add working comparison
| TypeScript | apache-2.0 | Microsoft/TypeScript,chuckjaz/TypeScript,minestarks/TypeScript,evgrud/TypeScript,synaptek/TypeScript,basarat/TypeScript,SaschaNaz/TypeScript,blakeembrey/TypeScript,nojvek/TypeScript,microsoft/TypeScript,Eyas/TypeScript,blakeembrey/TypeScript,vilic/TypeScript,ionux/TypeScript,basarat/TypeScript,TukekeSoft/TypeScript,mmoskal/TypeScript,fabioparra/TypeScript,Eyas/TypeScript,donaldpipowitch/TypeScript,jeremyepling/TypeScript,samuelhorwitz/typescript,mihailik/TypeScript,kitsonk/TypeScript,fabioparra/TypeScript,donaldpipowitch/TypeScript,jwbay/TypeScript,fabioparra/TypeScript,SaschaNaz/TypeScript,thr0w/Thr0wScript,blakeembrey/TypeScript,erikmcc/TypeScript,DLehenbauer/TypeScript,evgrud/TypeScript,kpreisser/TypeScript,RyanCavanaugh/TypeScript,SaschaNaz/TypeScript,jwbay/TypeScript,ziacik/TypeScript,evgrud/TypeScript,kitsonk/TypeScript,minestarks/TypeScript,microsoft/TypeScript,nojvek/TypeScript,alexeagle/TypeScript,donaldpipowitch/TypeScript,kimamula/TypeScript,jwbay/TypeScript,nycdotnet/TypeScript,vilic/TypeScript,kimamula/TypeScript,AbubakerB/TypeScript,samuelhorwitz/typescript,nycdotnet/TypeScript,mihailik/TypeScript,ionux/TypeScript,AbubakerB/TypeScript,nycdotnet/TypeScript,nojvek/TypeScript,synaptek/TypeScript,mmoskal/TypeScript,plantain-00/TypeScript,basarat/TypeScript,mihailik/TypeScript,mihailik/TypeScript,plantain-00/TypeScript,erikmcc/TypeScript,blakeembrey/TypeScript,kpreisser/TypeScript,synaptek/TypeScript,kpreisser/TypeScript,erikmcc/TypeScript,erikmcc/TypeScript,donaldpipowitch/TypeScript,RyanCavanaugh/TypeScript,alexeagle/TypeScript,TukekeSoft/TypeScript,RyanCavanaugh/TypeScript,weswigham/TypeScript,ziacik/TypeScript,plantain-00/TypeScript,ionux/TypeScript,Microsoft/TypeScript,yortus/TypeScript,vilic/TypeScript,DLehenbauer/TypeScript,minestarks/TypeScript,yortus/TypeScript,samuelhorwitz/typescript,mmoskal/TypeScript,synaptek/TypeScript,TukekeSoft/TypeScript,weswigham/TypeScript,mmoskal/TypeScript,DLehenbauer/TypeScript,AbubakerB/TypeScript,weswigham/TypeScript,nojvek/TypeScript,jwbay/TypeScript,nycdotnet/TypeScript,thr0w/Thr0wScript,vilic/TypeScript,jeremyepling/TypeScript,SaschaNaz/TypeScript,kimamula/TypeScript,thr0w/Thr0wScript,fabioparra/TypeScript,AbubakerB/TypeScript,yortus/TypeScript,thr0w/Thr0wScript,Eyas/TypeScript,basarat/TypeScript,plantain-00/TypeScript,chuckjaz/TypeScript,ionux/TypeScript,DLehenbauer/TypeScript,evgrud/TypeScript,jeremyepling/TypeScript,ziacik/TypeScript,alexeagle/TypeScript,chuckjaz/TypeScript,Eyas/TypeScript,ziacik/TypeScript,kitsonk/TypeScript,microsoft/TypeScript,samuelhorwitz/typescript,chuckjaz/TypeScript,kimamula/TypeScript,yortus/TypeScript,Microsoft/TypeScript | ---
+++
@@ -1,13 +1,25 @@
class A<T> {
genericVar: T
}
-function B<T>() {
+class B3 extends A<number> {
+}
+function B1<U>() {
// class expression can use T
- return class extends A<T> { }
+ return class extends A<U> { }
+}
+class B2<V> {
+ anon = class extends A<V> { }
}
// extends can call B
-class K extends B<number>() {
+class K extends B1<number>() {
+ namae: string;
+}
+class C extends (new B2<number>().anon) {
name: string;
}
-var c = new K();
+var c = new C();
+var k = new K();
+var b3 = new B3();
c.genericVar = 12;
+k.genericVar = 12;
+b3.genericVar = 12 |
0c281242718d18ce5ea26a5ec972b7022854685a | src/app/models/workout.ts | src/app/models/workout.ts | import { Tag } from './tag';
import { Sport } from './sport';
import { Address } from './address';
import { Image } from './image';
export class Workout {
public id: number;
public startdate: Date;
public enddate: Date;
public duration: string;
public placeType: string;
public nbTicketAvailable: number;
public nbTicketBooked: number;
public soldOut: boolean;
public price: number;
public coach: number;
public sport: any;
public soloTraining: boolean;
public subsport: string;
public difficulty: string;
public notation: number;
public address: any;
public description: string;
public outfit: string;
public notice: string;
public tags: any[];
public addedExistingTags: Tag[];
public addedNewTags: Tag[];
public title: string;
public photo: any;
public favorite: boolean;
constructor(
) {
this.sport = new Sport();
this.address = new Address();
this.startdate = new Date();
this.enddate = new Date();
this.tags = new Array();
this.addedExistingTags = new Array();
this.addedNewTags = new Array();
this.photo = new Image();
}
}
| import { Tag } from './tag';
import { Sport } from './sport';
import { Address } from './address';
import { Image } from './image';
export class Workout {
public id: number;
public startdate: Date;
public enddate: Date;
public duration: string;
public placeType: string;
public nbTicketAvailable: number;
public nbTicketBooked: number;
public soldOut: boolean;
public price: number;
public coach: number;
public sport: any;
public soloTraining: boolean;
public subsport: string;
public difficulty: string;
public notation: number;
public address: any;
public description: string;
public outfit: string;
public notice: string;
public tags: any[];
public addedExistingTags: Tag[];
public addedNewTags: Tag[];
public title: string;
public photo: any;
public favorite: boolean;
public styleTop: string;
public styleHeight: string;
constructor(
) {
this.sport = new Sport();
this.address = new Address();
this.startdate = new Date();
this.enddate = new Date();
this.tags = new Array();
this.addedExistingTags = new Array();
this.addedNewTags = new Array();
this.photo = new Image();
}
}
| Add style attributes for planning display | Add style attributes for planning display
When display on planning workout are position : absolute,
planning template need to retrieve this position from the object
It also need to know the height of the element.
| TypeScript | mit | XavierGuichet/bemoove-front,XavierGuichet/bemoove-front,XavierGuichet/bemoove-front | ---
+++
@@ -29,6 +29,8 @@
public title: string;
public photo: any;
public favorite: boolean;
+ public styleTop: string;
+ public styleHeight: string;
constructor(
) { |
d019ddac68fe106dd1e3f6893c87039a5cb80351 | src/lib/Scenes/Home/__stories__/Home.story.tsx | src/lib/Scenes/Home/__stories__/Home.story.tsx | import { storiesOf } from "@storybook/react-native"
import WorksForYou from "lib/Containers/WorksForYou"
import { ForYouRenderer, WorksForYouRenderer } from "lib/relay/QueryRenderers"
import renderWithLoadProgress from "lib/utils/renderWithLoadProgress"
import React from "react"
import Home from "../"
import ForYou from "../Components/ForYou"
import Sales from "../Components/Sales"
import { SalesRenderer } from "../Components/Sales/Relay/SalesRenderer"
storiesOf("Home/Relay")
.add("Root", () => <Home tracking={trackingData => console.log(trackingData)} />)
.add("Artists", () => <WorksForYouRenderer render={renderWithLoadProgress(WorksForYou)} />)
.add("For You", () => <ForYouRenderer render={renderWithLoadProgress(ForYou)} />)
.add("Auctions", () => <SalesRenderer render={renderWithLoadProgress(Sales)} />)
| import { storiesOf } from "@storybook/react-native"
import WorksForYou from "lib/Containers/WorksForYou"
import { ForYouRenderer, WorksForYouRenderer } from "lib/relay/QueryRenderers"
import renderWithLoadProgress from "lib/utils/renderWithLoadProgress"
import React from "react"
import Home from "../"
import ForYou from "../Components/ForYou"
import Sales from "../Components/Sales"
import { SalesRenderer } from "../Components/Sales/Relay/SalesRenderer"
storiesOf("Home/Relay")
.add("Root", () => <Home initialTab={0} isVisible={true} tracking={trackingData => console.log(trackingData)} />)
.add("Artists", () => <WorksForYouRenderer render={renderWithLoadProgress(WorksForYou)} />)
.add("For You", () => <ForYouRenderer render={renderWithLoadProgress(ForYou)} />)
.add("Auctions", () => <SalesRenderer render={renderWithLoadProgress(Sales)} />)
| Fix inital props for Home component | [Storybooks] Fix inital props for Home component
| TypeScript | mit | artsy/eigen,artsy/emission,artsy/emission,artsy/emission,artsy/emission,artsy/eigen,artsy/emission,artsy/eigen,artsy/emission,artsy/emission,artsy/eigen,artsy/eigen,artsy/eigen,artsy/eigen | ---
+++
@@ -9,7 +9,7 @@
import { SalesRenderer } from "../Components/Sales/Relay/SalesRenderer"
storiesOf("Home/Relay")
- .add("Root", () => <Home tracking={trackingData => console.log(trackingData)} />)
+ .add("Root", () => <Home initialTab={0} isVisible={true} tracking={trackingData => console.log(trackingData)} />)
.add("Artists", () => <WorksForYouRenderer render={renderWithLoadProgress(WorksForYou)} />)
.add("For You", () => <ForYouRenderer render={renderWithLoadProgress(ForYou)} />)
.add("Auctions", () => <SalesRenderer render={renderWithLoadProgress(Sales)} />) |
51a837247c58ed460408f40fd385018c14fcd50a | packages/markdown/src/index.tsx | packages/markdown/src/index.tsx | import * as MathJax from "@nteract/mathjax";
import { Source } from "@nteract/presentational-components";
import React from "react";
import ReactMarkdown from "react-markdown";
import RemarkMathPlugin from "./remark-math";
const math = (props: { value: string }): React.ReactNode => (
<MathJax.Node>{props.value}</MathJax.Node>
);
const inlineMath = (props: { value: string }): React.ReactNode => (
<MathJax.Node inline>{props.value}</MathJax.Node>
);
const code = (props: { language: string; value: string }): React.ReactNode => (
<Source language={props.language}>{props.value}</Source>
);
const MarkdownRender = (props: ReactMarkdown.ReactMarkdownProps) => {
const newProps = {
// https://github.com/rexxars/react-markdown#options
...props,
escapeHtml: false,
plugins: [RemarkMathPlugin],
renderers: {
...props.renderers,
math,
inlineMath,
code
} as any
};
return <ReactMarkdown {...newProps} />;
};
export default MarkdownRender;
| import * as MathJax from "@nteract/mathjax";
import { Source } from "@nteract/presentational-components";
import React from "react";
import ReactMarkdown from "react-markdown";
import RemarkMathPlugin from "./remark-math";
const math = (props: { value: string }): React.ReactNode => (
<MathJax.Node>{props.value}</MathJax.Node>
);
const inlineMath = (props: { value: string }): React.ReactNode => (
<MathJax.Node inline>{props.value}</MathJax.Node>
);
const code = (props: { language: string; value: string }): React.ReactNode => (
<Source language={props.language}>{props.value}</Source>
);
const MarkdownRender = (props: ReactMarkdown.ReactMarkdownProps) => {
const newProps = {
// https://github.com/rexxars/react-markdown#options
...props,
escapeHtml: false,
plugins: [RemarkMathPlugin],
renderers: {
math,
inlineMath,
code,
...props.renderers
} as any
};
return <ReactMarkdown {...newProps} />;
};
export default MarkdownRender;
| Move spread operator so MarkdownRender.renderers can override preset. | Move spread operator so MarkdownRender.renderers can override preset.
| TypeScript | bsd-3-clause | nteract/nteract,nteract/nteract,nteract/composition,nteract/composition,nteract/nteract,nteract/composition,nteract/nteract,nteract/nteract | ---
+++
@@ -24,10 +24,10 @@
escapeHtml: false,
plugins: [RemarkMathPlugin],
renderers: {
- ...props.renderers,
math,
inlineMath,
- code
+ code,
+ ...props.renderers
} as any
};
|
dabd611f7f5adbcd2c51feae30fc20a096ab8d66 | extension.ts | extension.ts | import * as vscode from 'vscode';
import * as functionParser from './functionParser';
export function activate() {
console.log('Congratulations, your extension "addDocComments" is now active!');
vscode.commands.registerCommand('extension.addDocComments', () => {
var selection = vscode.window.getActiveTextEditor().getSelection();
var selectedText = vscode.window.getActiveTextEditor().getTextDocument().getTextInRange(selection);
var firstBraceIndex = selectedText.indexOf('(');
selectedText = selectedText.slice(firstBraceIndex);
selectedText = functionParser.stripComments(selectedText);
var returnText = functionParser.getReturns(selectedText);
var params: functionParser.paramDeclaration[] = functionParser.getParameters(selectedText);
if (params.length > 0) {
var textToInsert = functionParser.getParameterText(params, returnText);
vscode.window.getActiveTextEditor().edit((editBuilder: vscode.TextEditorEdit) => {
var startLine = selection.start.line - 1;
var pos = new vscode.Position(startLine, 0);
editBuilder.insert(pos, textToInsert);
});
vscode.window.getActiveTextEditor().setSelection(selection.start);
}
});
}
| import * as vscode from 'vscode';
import * as functionParser from './functionParser';
export function activate() {
console.log('Congratulations, your extension "addDocComments" is now active!');
vscode.commands.registerCommand('extension.addDocComments', () => {
var selection = vscode.window.getActiveTextEditor().getSelection();
var selectedText = vscode.window.getActiveTextEditor().getTextDocument().getTextInRange(selection);
var firstBraceIndex = selectedText.indexOf('(');
selectedText = selectedText.slice(firstBraceIndex);
selectedText = functionParser.stripComments(selectedText);
var returnText = functionParser.getReturns(selectedText);
var params: functionParser.paramDeclaration[] = functionParser.getParameters(selectedText);
if (params.length > 0) {
var textToInsert = functionParser.getParameterText(params, returnText);
vscode.window.getActiveTextEditor().edit((editBuilder: vscode.TextEditorEdit) => {
var startLine = selection.start.line - 1;
var pos = new vscode.Position(startLine, 0);
editBuilder.insert(pos, textToInsert);
}).then(()=>{
vscode.window.getActiveTextEditor().setSelection(selection.start);
});
}
});
}
| Set the selection after inserting text | Set the selection after inserting text
| TypeScript | mit | Microsoft/vscode-comment | ---
+++
@@ -6,6 +6,8 @@
console.log('Congratulations, your extension "addDocComments" is now active!');
+
+
vscode.commands.registerCommand('extension.addDocComments', () => {
@@ -26,8 +28,11 @@
var startLine = selection.start.line - 1;
var pos = new vscode.Position(startLine, 0);
editBuilder.insert(pos, textToInsert);
+ }).then(()=>{
+ vscode.window.getActiveTextEditor().setSelection(selection.start);
});
- vscode.window.getActiveTextEditor().setSelection(selection.start);
+
+
}
});
} |
228307f9f2288a3ff3aa9865f682f4fa5a1f95f8 | src/lib/middleware/__tests__/rateLimiting.jest.ts | src/lib/middleware/__tests__/rateLimiting.jest.ts | import { _rateLimiterMiddleware, BURST_LIMIT_MESSAGE } from "../rateLimiting"
describe("rate limiting", () => {
let rateLimiter
let burstLimiter
let next
let res
let status
let send
let middleware
beforeEach(() => {
burstLimiter = {
consume: jest.fn(),
}
rateLimiter = {
consume: jest.fn(),
}
next = jest.fn()
send = jest.fn()
status = jest.fn().mockReturnValue(send)
res = { status }
middleware = _rateLimiterMiddleware(burstLimiter, rateLimiter)
})
it("should respond with burst limit message if burst limit hit", async () => {
burstLimiter.consume.mockRejectedValue("")
await middleware("", res, next)
expect(send).toHaveBeenCalledWith(BURST_LIMIT_MESSAGE)
expect(status).toHaveBeenCalledWith(429)
expect(next).not.toBeCalled()
})
})
| import {
_rateLimiterMiddleware,
BURST_LIMIT_MESSAGE,
RATE_LIMIT_MESSAGE,
} from "../rateLimiting"
describe("rate limiting", () => {
let rateLimiter
let burstLimiter
let next
let res
let status
let send
let middleware
beforeEach(() => {
burstLimiter = {
consume: jest.fn(),
}
rateLimiter = {
consume: jest.fn(),
}
next = jest.fn()
send = jest.fn()
status = jest.fn().mockReturnValue({ send })
res = { status }
middleware = _rateLimiterMiddleware(burstLimiter, rateLimiter)
})
it("should respond with burst limit message if burst limit hit", async () => {
burstLimiter.consume.mockRejectedValue("")
await middleware("", res, next)
expect(burstLimiter.consume).toBeCalled()
expect(rateLimiter.consume).not.toBeCalled()
expect(send).toHaveBeenCalledWith(BURST_LIMIT_MESSAGE)
expect(status).toHaveBeenCalledWith(429)
expect(next).not.toBeCalled()
})
it("should respond with the rate limit message if rate limit hit", async () => {
burstLimiter.consume.mockResolvedValue("")
rateLimiter.consume.mockRejectedValue("")
await middleware("", res, next)
expect(burstLimiter.consume).toBeCalled()
expect(rateLimiter.consume).toBeCalled()
expect(send).toHaveBeenCalledWith(RATE_LIMIT_MESSAGE)
expect(status).toHaveBeenCalledWith(429)
expect(next).not.toBeCalled()
})
it("should call next if no limits are hit", async () => {
burstLimiter.consume.mockResolvedValue("")
rateLimiter.consume.mockResolvedValue("")
await middleware("", res, next)
expect(burstLimiter.consume).toBeCalled()
expect(rateLimiter.consume).toBeCalled()
expect(send).not.toBeCalled()
expect(next).toBeCalled()
})
})
| Add more rate limit tests | Add more rate limit tests
| TypeScript | mit | yuki24/force,anandaroop/force,mzikherman/force,mzikherman/force,oxaudo/force,eessex/force,oxaudo/force,joeyAghion/force,cavvia/force-1,eessex/force,eessex/force,joeyAghion/force,artsy/force-public,xtina-starr/force,izakp/force,eessex/force,erikdstock/force,artsy/force,oxaudo/force,damassi/force,anandaroop/force,cavvia/force-1,artsy/force-public,yuki24/force,anandaroop/force,xtina-starr/force,izakp/force,anandaroop/force,joeyAghion/force,erikdstock/force,izakp/force,erikdstock/force,artsy/force,yuki24/force,mzikherman/force,izakp/force,joeyAghion/force,mzikherman/force,artsy/force,oxaudo/force,xtina-starr/force,cavvia/force-1,yuki24/force,artsy/force,damassi/force,xtina-starr/force,cavvia/force-1,damassi/force,erikdstock/force,damassi/force | ---
+++
@@ -1,4 +1,8 @@
-import { _rateLimiterMiddleware, BURST_LIMIT_MESSAGE } from "../rateLimiting"
+import {
+ _rateLimiterMiddleware,
+ BURST_LIMIT_MESSAGE,
+ RATE_LIMIT_MESSAGE,
+} from "../rateLimiting"
describe("rate limiting", () => {
let rateLimiter
@@ -18,7 +22,7 @@
}
next = jest.fn()
send = jest.fn()
- status = jest.fn().mockReturnValue(send)
+ status = jest.fn().mockReturnValue({ send })
res = { status }
middleware = _rateLimiterMiddleware(burstLimiter, rateLimiter)
})
@@ -27,8 +31,33 @@
burstLimiter.consume.mockRejectedValue("")
await middleware("", res, next)
+ expect(burstLimiter.consume).toBeCalled()
+ expect(rateLimiter.consume).not.toBeCalled()
expect(send).toHaveBeenCalledWith(BURST_LIMIT_MESSAGE)
expect(status).toHaveBeenCalledWith(429)
expect(next).not.toBeCalled()
})
+
+ it("should respond with the rate limit message if rate limit hit", async () => {
+ burstLimiter.consume.mockResolvedValue("")
+ rateLimiter.consume.mockRejectedValue("")
+ await middleware("", res, next)
+
+ expect(burstLimiter.consume).toBeCalled()
+ expect(rateLimiter.consume).toBeCalled()
+ expect(send).toHaveBeenCalledWith(RATE_LIMIT_MESSAGE)
+ expect(status).toHaveBeenCalledWith(429)
+ expect(next).not.toBeCalled()
+ })
+
+ it("should call next if no limits are hit", async () => {
+ burstLimiter.consume.mockResolvedValue("")
+ rateLimiter.consume.mockResolvedValue("")
+ await middleware("", res, next)
+
+ expect(burstLimiter.consume).toBeCalled()
+ expect(rateLimiter.consume).toBeCalled()
+ expect(send).not.toBeCalled()
+ expect(next).toBeCalled()
+ })
}) |
7431bb83209e8b8cb337a246eb815d10ce377f14 | modules/core/common/net.ts | modules/core/common/net.ts | import url from 'url';
import { PLATFORM } from './utils';
export const serverPort = PLATFORM === 'server' && (process.env.PORT || __SERVER_PORT__);
export const isApiExternal = !!url.parse(__API_URL__).protocol;
const clientApiUrl =
!isApiExternal && PLATFORM !== 'server'
? `${window.location.protocol}//${window.location.hostname}${
__DEV__ ? ':8080' : window.location.port ? ':' + window.location.port : ''
}${__API_URL__}`
: __API_URL__;
const serverApiUrl = !isApiExternal ? `http://localhost:${serverPort}${__API_URL__}` : __API_URL__;
export const apiUrl = PLATFORM === 'server' ? serverApiUrl : clientApiUrl;
| import url from 'url';
import { PLATFORM } from './utils';
export const serverPort =
PLATFORM === 'server' && (process.env.PORT || (typeof __SERVER_PORT__ !== 'undefined' ? __SERVER_PORT__ : 8080));
export const isApiExternal = !!url.parse(__API_URL__).protocol;
const clientApiUrl =
!isApiExternal && PLATFORM !== 'server'
? `${window.location.protocol}//${window.location.hostname}${
__DEV__ ? ':8080' : window.location.port ? ':' + window.location.port : ''
}${__API_URL__}`
: __API_URL__;
const serverApiUrl = !isApiExternal ? `http://localhost:${serverPort}${__API_URL__}` : __API_URL__;
export const apiUrl = PLATFORM === 'server' ? serverApiUrl : clientApiUrl;
| Use 8080 as default __SERVER_PORT__ | Use 8080 as default __SERVER_PORT__
| TypeScript | mit | sysgears/apollo-universal-starter-kit,sysgears/apollo-fullstack-starter-kit,sysgears/apollo-universal-starter-kit,sysgears/apollo-universal-starter-kit,sysgears/apollo-universal-starter-kit | ---
+++
@@ -1,7 +1,8 @@
import url from 'url';
import { PLATFORM } from './utils';
-export const serverPort = PLATFORM === 'server' && (process.env.PORT || __SERVER_PORT__);
+export const serverPort =
+ PLATFORM === 'server' && (process.env.PORT || (typeof __SERVER_PORT__ !== 'undefined' ? __SERVER_PORT__ : 8080));
export const isApiExternal = !!url.parse(__API_URL__).protocol;
const clientApiUrl = |
15c8360e5356a6d1b4954176b3f0146c42b817e8 | src/Test/Ast/CodeBlock.ts | src/Test/Ast/CodeBlock.ts | /// <reference path="../../../typings/mocha/mocha.d.ts" />
/// <reference path="../../../typings/chai/chai.d.ts" />
import { expect } from 'chai'
import * as Up from '../../index'
import { SyntaxNode } from '../../SyntaxNodes/SyntaxNode'
import { DocumentNode } from '../../SyntaxNodes/DocumentNode'
import { PlainTextNode } from '../../SyntaxNodes/PlainTextNode'
import { CodeBlockNode } from '../../SyntaxNodes/CodeBlockNode'
function insideDocument(syntaxNodes: SyntaxNode[]): DocumentNode {
return new DocumentNode(syntaxNodes);
}
describe('Text surrounded (underlined and overlined) by streaks of backticks', function() {
it('produces a code block node containing the surrounded text', function() {
const text =
`
\`\`\`
let x = y
\`\`\``
expect(Up.ast(text)).to.be.eql(
insideDocument([
new CodeBlockNode([
new PlainTextNode('let x = y')
]),
]))
})
})
| /// <reference path="../../../typings/mocha/mocha.d.ts" />
/// <reference path="../../../typings/chai/chai.d.ts" />
import { expect } from 'chai'
import * as Up from '../../index'
import { SyntaxNode } from '../../SyntaxNodes/SyntaxNode'
import { DocumentNode } from '../../SyntaxNodes/DocumentNode'
import { PlainTextNode } from '../../SyntaxNodes/PlainTextNode'
import { CodeBlockNode } from '../../SyntaxNodes/CodeBlockNode'
function insideDocument(syntaxNodes: SyntaxNode[]): DocumentNode {
return new DocumentNode(syntaxNodes);
}
describe('Text surrounded (underlined and overlined) by streaks of backticks', function() {
it('produces a code block node containing the surrounded text', function() {
const text =
`
\`\`\`
const pie = 3.5
\`\`\``
expect(Up.ast(text)).to.be.eql(
insideDocument([
new CodeBlockNode([
new PlainTextNode('const pie = 3.5')
]),
]))
})
it('can have multiple lines', function() {
const text =
`
\`\`\`
// Escaping backticks in typescript...
// Such a pain!
\`\`\``
expect(Up.ast(text)).to.be.eql(
insideDocument([
new CodeBlockNode([
new PlainTextNode(
`// Escaping backticks in typescript...
// Such a pain!`
)
]),
]))
})
})
| Add passing code block test | Add passing code block test
| TypeScript | mit | start/up,start/up | ---
+++
@@ -19,12 +19,30 @@
const text =
`
\`\`\`
-let x = y
+const pie = 3.5
\`\`\``
expect(Up.ast(text)).to.be.eql(
insideDocument([
new CodeBlockNode([
- new PlainTextNode('let x = y')
+ new PlainTextNode('const pie = 3.5')
+ ]),
+ ]))
+ })
+
+ it('can have multiple lines', function() {
+ const text =
+ `
+\`\`\`
+// Escaping backticks in typescript...
+// Such a pain!
+\`\`\``
+ expect(Up.ast(text)).to.be.eql(
+ insideDocument([
+ new CodeBlockNode([
+ new PlainTextNode(
+`// Escaping backticks in typescript...
+// Such a pain!`
+ )
]),
]))
}) |
c82c81856bf5038c2f5b348545aa8059ac22e483 | src/browser/ui/dialog/dialog-title.directive.ts | src/browser/ui/dialog/dialog-title.directive.ts | import { Directive, Input, OnInit, Optional } from '@angular/core';
import { DialogRef } from './dialog-ref';
let uniqueId = 0;
@Directive({
selector: '[gdDialogTitle]',
host: {
'class': 'DialogTitle',
},
})
export class DialogTitleDirective implements OnInit {
@Input() id = `gd-dialog-title-${uniqueId++}`;
constructor(@Optional() private dialogRef: DialogRef<any>) {
}
ngOnInit(): void {
if (this.dialogRef && this.dialogRef.componentInstance) {
Promise.resolve().then(() => {
const container = this.dialogRef._containerInstance;
if (container && !container._ariaLabelledBy) {
container._ariaLabelledBy = this.id;
}
});
}
}
}
| import { Directive, Input, OnInit, Optional } from '@angular/core';
import { DialogRef } from './dialog-ref';
let uniqueId = 0;
@Directive({
selector: '[gdDialogTitle]',
host: {
'class': 'DialogTitle',
'[id]': 'id',
},
})
export class DialogTitleDirective implements OnInit {
@Input() id = `gd-dialog-title-${uniqueId++}`;
constructor(@Optional() private dialogRef: DialogRef<any>) {
}
ngOnInit(): void {
if (this.dialogRef && this.dialogRef.componentInstance) {
Promise.resolve().then(() => {
const container = this.dialogRef._containerInstance;
if (container && !container._ariaLabelledBy) {
container._ariaLabelledBy = this.id;
}
});
}
}
}
| Fix host attribute not assigned | Fix host attribute not assigned
| TypeScript | mit | seokju-na/geeks-diary,seokju-na/geeks-diary,seokju-na/geeks-diary | ---
+++
@@ -9,6 +9,7 @@
selector: '[gdDialogTitle]',
host: {
'class': 'DialogTitle',
+ '[id]': 'id',
},
})
export class DialogTitleDirective implements OnInit { |
0668458e989e622481e18a9ef3bf6fb313c1a8af | src/menu/bookmarks/components/TreeBar/index.tsx | src/menu/bookmarks/components/TreeBar/index.tsx | import React from 'react';
import Store from '../../store';
import Item from './Item';
import { Root, ForwardIcon } from './styles';
export default class TreeBar extends React.Component {
public render() {
return (
<Root>
<Item data={Store.data} home />
{Store.path.map((data: any, key: any) => (
<React.Fragment>
<ForwardIcon className="FORWARD-ICON" />
<Item data={data} key={key} />
</React.Fragment>
))}
</Root>
);
}
}
| import React from 'react';
import Store from '../../store';
import Item from './Item';
import { Root, ForwardIcon } from './styles';
export default class TreeBar extends React.Component {
public render() {
return (
<Root>
<Item data={Store.data} home />
{Store.path.map((data: any, key: any) => (
<React.Fragment key={key}>
<ForwardIcon className="FORWARD-ICON" />
<Item data={data} key={key} />
</React.Fragment>
))}
</Root>
);
}
}
| Fix unique key error in bookmarks | :bug: Fix unique key error in bookmarks
| TypeScript | apache-2.0 | Nersent/Wexond,Nersent/Wexond | ---
+++
@@ -10,7 +10,7 @@
<Root>
<Item data={Store.data} home />
{Store.path.map((data: any, key: any) => (
- <React.Fragment>
+ <React.Fragment key={key}>
<ForwardIcon className="FORWARD-ICON" />
<Item data={data} key={key} />
</React.Fragment> |
d49c7826387f9c442c36f14835f9bff2950b92bb | src/lib/Scenes/ArtistSeries/ArtistSeriesHeader.tsx | src/lib/Scenes/ArtistSeries/ArtistSeriesHeader.tsx | import { Flex } from "@artsy/palette"
import { ArtistSeriesHeader_artistSeries } from "__generated__/ArtistSeriesHeader_artistSeries.graphql"
import OpaqueImageView from "lib/Components/OpaqueImageView/OpaqueImageView"
import React from "react"
import { createFragmentContainer, graphql } from "react-relay"
interface ArtistSeriesHeaderProps {
artistSeries: ArtistSeriesHeader_artistSeries
}
export const ArtistSeriesHeader: React.SFC<ArtistSeriesHeaderProps> = ({ artistSeries }) => {
const url = artistSeries.image?.url!
return (
<Flex flexDirection="row" justifyContent="center">
<OpaqueImageView width={180} height={180} imageURL={url} />
</Flex>
)
}
export const ArtistSeriesHeaderFragmentContainer = createFragmentContainer(ArtistSeriesHeader, {
artistSeries: graphql`
fragment ArtistSeriesHeader_artistSeries on ArtistSeries {
image {
url
}
}
`,
})
| import { Flex } from "@artsy/palette"
import { ArtistSeriesHeader_artistSeries } from "__generated__/ArtistSeriesHeader_artistSeries.graphql"
import OpaqueImageView from "lib/Components/OpaqueImageView/OpaqueImageView"
import React from "react"
import { createFragmentContainer, graphql } from "react-relay"
interface ArtistSeriesHeaderProps {
artistSeries: ArtistSeriesHeader_artistSeries
}
export const ArtistSeriesHeader: React.SFC<ArtistSeriesHeaderProps> = ({ artistSeries }) => {
const url = artistSeries.image?.url!
return (
<Flex flexDirection="row" justifyContent="center">
<OpaqueImageView width={180} height={180} imageURL={url} style={{ borderRadius: 2 }} />
</Flex>
)
}
export const ArtistSeriesHeaderFragmentContainer = createFragmentContainer(ArtistSeriesHeader, {
artistSeries: graphql`
fragment ArtistSeriesHeader_artistSeries on ArtistSeries {
image {
url
}
}
`,
})
| Fix header image border radius | style: Fix header image border radius
| TypeScript | mit | artsy/eigen,artsy/eigen,artsy/eigen,artsy/eigen,artsy/eigen,artsy/eigen,artsy/eigen | ---
+++
@@ -12,7 +12,7 @@
return (
<Flex flexDirection="row" justifyContent="center">
- <OpaqueImageView width={180} height={180} imageURL={url} />
+ <OpaqueImageView width={180} height={180} imageURL={url} style={{ borderRadius: 2 }} />
</Flex>
)
} |
4d6e593c27e2bfb9d82b3a1f326f23c7f50403fd | src/app/app.component.ts | src/app/app.component.ts | import { Component, OnInit } from '@angular/core';
import { PLAYLIST_DATA } from './playlist';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
title = 'Stats Bar';
playlist_data = PLAYLIST_DATA;
items: { name: string, playlistId: string }[] = null;
constructor() { }
ngOnInit() {
}
onMenuClick(index: number): void {
this.items = this.playlist_data[index].items;
}
}
| import { Component, OnInit } from '@angular/core';
import { PLAYLIST_DATA } from './playlist';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
title = 'Stats Bar';
playlist_data = PLAYLIST_DATA;
items: { name: string, playlistId: string }[] = null;
constructor() { }
ngOnInit() {
if (this.playlist_data.length > 0) {
this.onMenuClick(0); // Select first one
}
}
onMenuClick(index: number): void {
this.items = this.playlist_data[index].items;
}
}
| Select first play list when loaded | Select first play list when loaded
| TypeScript | apache-2.0 | shioyang/StatsBar,shioyang/StatsBar,shioyang/StatsBar | ---
+++
@@ -14,6 +14,9 @@
constructor() { }
ngOnInit() {
+ if (this.playlist_data.length > 0) {
+ this.onMenuClick(0); // Select first one
+ }
}
onMenuClick(index: number): void { |
283907a20e5de2a156703aac37c80d2358d485e0 | lib/main.ts | lib/main.ts | import * as encryption from './encryption';
export const hashPassword = encryption.hashPassword;
export const comparePasswordWithHash = encryption.comparePasswordWithHash;
module.exports = encryption;
| import * as encryption from './encryption';
export const isValidDigestAlgorithm = encryption.isValidDigestAlgorithm;
export const hashPassword = encryption.hashPassword;
export const comparePasswordWithHash = encryption.comparePasswordWithHash;
module.exports = encryption;
| Add export for digest availability checking function | Add export for digest availability checking function
| TypeScript | mit | treylon/node-secure-password | ---
+++
@@ -1,5 +1,6 @@
import * as encryption from './encryption';
+export const isValidDigestAlgorithm = encryption.isValidDigestAlgorithm;
export const hashPassword = encryption.hashPassword;
export const comparePasswordWithHash = encryption.comparePasswordWithHash;
|
18408e773946923925bfbb719b37ea1875e8ac8a | data/loaders/PostsLoader.ts | data/loaders/PostsLoader.ts | import matter from "gray-matter"
import glob from "glob"
import path from "path"
import fs from "fs"
import BlogPost from "../../models/BlogPost"
import { EntryType } from "./Entry"
export class PostsLoader {
private cachedPosts?: BlogPost[]
async getPosts(forceRefresh: boolean = false): Promise<BlogPost[]> {
if (!forceRefresh && this.cachedPosts) {
return this.cachedPosts
}
console.debug("Loading posts")
let posts: BlogPost[] = []
const postPaths = glob.sync("data/posts/*.md")
for (const postPath of postPaths) {
console.debug(`Loading post at ${postPath}`)
const slug = path.basename(postPath, path.extname(postPath))
const content = fs.readFileSync(postPath)
const parsedContent = matter(content, {
excerpt: true,
excerpt_separator: "<!-- more -->",
})
const post = {
slug,
title: parsedContent.data.title,
content: parsedContent.content,
excerpt: parsedContent.excerpt,
date: new Date(parsedContent.data.date).toISOString(),
url: `/posts/${slug}`,
tags: parsedContent.data.tags,
type: EntryType.BlogPost,
}
posts.push(post)
}
this.cachedPosts = posts
console.debug("Loaded posts")
return posts
}
}
const loader = new PostsLoader()
export default loader
| import matter from "gray-matter"
import glob from "glob"
import path from "path"
import fs from "fs"
import BlogPost from "../../models/BlogPost"
import { EntryType } from "./Entry"
export class PostsLoader {
private cachedPosts?: BlogPost[]
async getPosts(forceRefresh: boolean = false): Promise<BlogPost[]> {
if (!forceRefresh && this.cachedPosts) {
return this.cachedPosts
}
console.debug("Loading posts")
let posts: BlogPost[] = []
const postPaths = glob.sync("data/posts/*.md")
for (const postPath of postPaths) {
console.debug(`Loading post at ${postPath}`)
const slug = path.basename(postPath, path.extname(postPath))
const fileBuffer = fs.readFileSync(postPath)
const excerptSeparator = "<!-- more -->"
const parsedContent = matter(fileBuffer, {
excerpt: true,
excerpt_separator: excerptSeparator,
})
const excerptRegex = /<!-- more -->/g
const markdownContent = parsedContent.content.replace(excerptRegex, "")
const post = {
slug,
title: parsedContent.data.title,
content: markdownContent,
excerpt: parsedContent.excerpt,
date: new Date(parsedContent.data.date).toISOString(),
url: `/posts/${slug}`,
tags: parsedContent.data.tags,
type: EntryType.BlogPost,
}
posts.push(post)
}
this.cachedPosts = posts
console.debug("Loaded posts")
return posts
}
}
const loader = new PostsLoader()
export default loader
| Remove except separator from blog post content | Remove except separator from blog post content
| TypeScript | mit | JosephDuffy/josephduffy.co.uk,JosephDuffy/josephduffy.co.uk,JosephDuffy/josephduffy.co.uk | ---
+++
@@ -21,15 +21,19 @@
for (const postPath of postPaths) {
console.debug(`Loading post at ${postPath}`)
const slug = path.basename(postPath, path.extname(postPath))
- const content = fs.readFileSync(postPath)
- const parsedContent = matter(content, {
+ const fileBuffer = fs.readFileSync(postPath)
+ const excerptSeparator = "<!-- more -->"
+ const parsedContent = matter(fileBuffer, {
excerpt: true,
- excerpt_separator: "<!-- more -->",
+ excerpt_separator: excerptSeparator,
})
+ const excerptRegex = /<!-- more -->/g
+ const markdownContent = parsedContent.content.replace(excerptRegex, "")
+
const post = {
slug,
title: parsedContent.data.title,
- content: parsedContent.content,
+ content: markdownContent,
excerpt: parsedContent.excerpt,
date: new Date(parsedContent.data.date).toISOString(),
url: `/posts/${slug}`, |
d33d1720d64c62bc1dd4d26d5646d0016a192290 | packages/react-day-picker/src/components/Day/Day.tsx | packages/react-day-picker/src/components/Day/Day.tsx | import { isSameDay } from 'date-fns';
import * as React from 'react';
import { DayProps } from '../../types';
import { getDayComponent } from './getDayComponent';
export function Day(props: DayProps): JSX.Element | null {
const el = React.useRef<HTMLTimeElement>(null);
const { day, dayPickerProps, currentMonth } = props;
const { locale, formatDay, focusedDay } = dayPickerProps;
const { rootProps, modifiers } = getDayComponent(
day,
currentMonth,
dayPickerProps
);
if (modifiers.hidden) {
return null;
}
React.useEffect(() => {
if (focusedDay && isSameDay(focusedDay, day)) {
el?.current?.focus();
}
}, [dayPickerProps.focusedDay]);
return (
<time {...rootProps} ref={el}>
{formatDay(day, { locale })}
</time>
);
}
| import { isSameDay } from 'date-fns';
import * as React from 'react';
import { DayProps } from '../../types';
import { getDayComponent } from './getDayComponent';
export function Day(props: DayProps): JSX.Element | null {
const el = React.useRef<HTMLTimeElement>(null);
const { day, dayPickerProps, currentMonth } = props;
const { locale, formatDay, focusedDay, showOutsideDays } = dayPickerProps;
const { rootProps, modifiers } = getDayComponent(
day,
currentMonth,
dayPickerProps
);
if (modifiers.outside && !showOutsideDays) {
return null;
}
React.useEffect(() => {
if (focusedDay && isSameDay(focusedDay, day)) {
el?.current?.focus();
}
}, [dayPickerProps.focusedDay]);
return (
<time {...rootProps} ref={el}>
{formatDay(day, { locale })}
</time>
);
}
| Use outside modifier to hide a day | Use outside modifier to hide a day
| TypeScript | mit | gpbl/react-day-picker,gpbl/react-day-picker,gpbl/react-day-picker | ---
+++
@@ -7,7 +7,7 @@
export function Day(props: DayProps): JSX.Element | null {
const el = React.useRef<HTMLTimeElement>(null);
const { day, dayPickerProps, currentMonth } = props;
- const { locale, formatDay, focusedDay } = dayPickerProps;
+ const { locale, formatDay, focusedDay, showOutsideDays } = dayPickerProps;
const { rootProps, modifiers } = getDayComponent(
day,
@@ -15,7 +15,7 @@
dayPickerProps
);
- if (modifiers.hidden) {
+ if (modifiers.outside && !showOutsideDays) {
return null;
}
React.useEffect(() => { |
dbd4552835ea1c81f5bed6cabeb80d9652fa42e3 | modules/html-lib/index.ts | modules/html-lib/index.ts | import {parseDocument} from 'htmlparser2'
import {innerText} from 'domutils'
export {innerText}
import type {Node, Document} from 'domhandler'
import cssSelect from 'css-select'
export {cssSelect}
export {encode, decode} from 'html-entities'
export function parseHtml(string: string): Document {
return parseDocument(string, {
normalizeWhitespace: false,
xmlMode: false,
decodeEntities: true,
})
}
export function innerTextWithSpaces(elem: Node | Node[]): string {
return innerText(elem).split(/\s+/u).join(' ').trim()
}
export function removeHtmlWithRegex(str: string): string {
return str.replace(/<[^>]*>/gu, ' ')
}
export function fastGetTrimmedText(str: string): string {
return removeHtmlWithRegex(str).replace(/\s+/gu, ' ').trim()
}
| import {parseDocument} from 'htmlparser2'
import {textContent} from 'domutils'
export {textContent}
import type {Node, Document} from 'domhandler'
import cssSelect from 'css-select'
export {cssSelect}
export {encode, decode} from 'html-entities'
export function parseHtml(string: string): Document {
return parseDocument(string, {
normalizeWhitespace: false,
xmlMode: false,
decodeEntities: true,
})
}
export function innerTextWithSpaces(elem: Node | Node[]): string {
return textContent(elem).split(/\s+/u).join(' ').trim()
}
export function removeHtmlWithRegex(str: string): string {
return str.replace(/<[^>]*>/gu, ' ')
}
export function fastGetTrimmedText(str: string): string {
return removeHtmlWithRegex(str).replace(/\s+/gu, ' ').trim()
}
| Fix inner-text parsing by switching to textContent from innerText | Fix inner-text parsing by switching to textContent from innerText
| TypeScript | agpl-3.0 | StoDevX/AAO-React-Native,StoDevX/AAO-React-Native,StoDevX/AAO-React-Native,StoDevX/AAO-React-Native,StoDevX/AAO-React-Native,StoDevX/AAO-React-Native,StoDevX/AAO-React-Native,StoDevX/AAO-React-Native,StoDevX/AAO-React-Native | ---
+++
@@ -1,7 +1,7 @@
import {parseDocument} from 'htmlparser2'
-import {innerText} from 'domutils'
-export {innerText}
+import {textContent} from 'domutils'
+export {textContent}
import type {Node, Document} from 'domhandler'
@@ -19,7 +19,7 @@
}
export function innerTextWithSpaces(elem: Node | Node[]): string {
- return innerText(elem).split(/\s+/u).join(' ').trim()
+ return textContent(elem).split(/\s+/u).join(' ').trim()
}
export function removeHtmlWithRegex(str: string): string { |
a2d4a292d4acd455c26fb8f153578970ed888453 | src/vs/workbench/parts/terminal/common/terminal.ts | src/vs/workbench/parts/terminal/common/terminal.ts | /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import {createDecorator, ServiceIdentifier} from 'vs/platform/instantiation/common/instantiation';
import platform = require('vs/base/common/platform');
export const TERMINAL_PANEL_ID = 'workbench.panel.terminal';
export const TERMINAL_SERVICE_ID = 'terminalService';
export const TERMINAL_DEFAULT_SHELL_LINUX = !platform.isWindows ? (process.env.SHELL || 'sh') : 'sh';
export const TERMINAL_DEFAULT_SHELL_OSX = !platform.isWindows ? (process.env.SHELL || 'sh') : 'sh';
export const TERMINAL_DEFAULT_SHELL_WINDOWS = platform.isWindows ? (process.env.COMSPEC || 'cmd.exe') : 'cmd.exe';
export var ITerminalService = createDecorator<ITerminalService>(TERMINAL_SERVICE_ID);
export interface ITerminalConfiguration {
integratedTerminal: {
shell: {
linux: string,
osx: string,
windows: string
},
fontFamily: string
};
}
export interface ITerminalService {
serviceId: ServiceIdentifier<any>;
toggle(): TPromise<any>;
}
| /*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import {TPromise} from 'vs/base/common/winjs.base';
import {createDecorator, ServiceIdentifier} from 'vs/platform/instantiation/common/instantiation';
import platform = require('vs/base/common/platform');
import processes = require('vs/base/node/processes');
export const TERMINAL_PANEL_ID = 'workbench.panel.terminal';
export const TERMINAL_SERVICE_ID = 'terminalService';
export const TERMINAL_DEFAULT_SHELL_LINUX = !platform.isWindows ? (process.env.SHELL || 'sh') : 'sh';
export const TERMINAL_DEFAULT_SHELL_OSX = !platform.isWindows ? (process.env.SHELL || 'sh') : 'sh';
export const TERMINAL_DEFAULT_SHELL_WINDOWS = processes.getWindowsShell();
export var ITerminalService = createDecorator<ITerminalService>(TERMINAL_SERVICE_ID);
export interface ITerminalConfiguration {
integratedTerminal: {
shell: {
linux: string,
osx: string,
windows: string
},
fontFamily: string
};
}
export interface ITerminalService {
serviceId: ServiceIdentifier<any>;
toggle(): TPromise<any>;
}
| Simplify default windows shell fetching | Simplify default windows shell fetching
| TypeScript | mit | microsoft/vscode,williamcspace/vscode,stringham/vscode,hoovercj/vscode,hungys/vscode,Zalastax/vscode,the-ress/vscode,Microsoft/vscode,stringham/vscode,Krzysztof-Cieslak/vscode,hashhar/vscode,hashhar/vscode,0xmohit/vscode,radshit/vscode,eklavyamirani/vscode,ups216/vscode,hungys/vscode,landonepps/vscode,hoovercj/vscode,rishii7/vscode,Krzysztof-Cieslak/vscode,veeramarni/vscode,zyml/vscode,eklavyamirani/vscode,stringham/vscode,zyml/vscode,KattMingMing/vscode,KattMingMing/vscode,landonepps/vscode,microsoft/vscode,eklavyamirani/vscode,hungys/vscode,0xmohit/vscode,williamcspace/vscode,radshit/vscode,eamodio/vscode,joaomoreno/vscode,0xmohit/vscode,zyml/vscode,cleidigh/vscode,Krzysztof-Cieslak/vscode,microlv/vscode,jchadwick/vscode,williamcspace/vscode,Krzysztof-Cieslak/vscode,hoovercj/vscode,hoovercj/vscode,0xmohit/vscode,mjbvz/vscode,jchadwick/vscode,ups216/vscode,KattMingMing/vscode,stringham/vscode,cleidigh/vscode,bsmr-x-script/vscode,jchadwick/vscode,the-ress/vscode,radshit/vscode,cleidigh/vscode,cleidigh/vscode,eklavyamirani/vscode,joaomoreno/vscode,charlespierce/vscode,0xmohit/vscode,stringham/vscode,charlespierce/vscode,Microsoft/vscode,matthewshirley/vscode,gagangupt16/vscode,veeramarni/vscode,rishii7/vscode,joaomoreno/vscode,hungys/vscode,rishii7/vscode,DustinCampbell/vscode,Microsoft/vscode,KattMingMing/vscode,Krzysztof-Cieslak/vscode,hoovercj/vscode,ups216/vscode,cleidigh/vscode,mjbvz/vscode,microlv/vscode,gagangupt16/vscode,Krzysztof-Cieslak/vscode,hungys/vscode,hungys/vscode,eamodio/vscode,DustinCampbell/vscode,Zalastax/vscode,mjbvz/vscode,DustinCampbell/vscode,stringham/vscode,joaomoreno/vscode,microlv/vscode,matthewshirley/vscode,microsoft/vscode,rishii7/vscode,the-ress/vscode,Krzysztof-Cieslak/vscode,ups216/vscode,cleidigh/vscode,zyml/vscode,joaomoreno/vscode,Krzysztof-Cieslak/vscode,matthewshirley/vscode,charlespierce/vscode,eamodio/vscode,joaomoreno/vscode,landonepps/vscode,joaomoreno/vscode,bsmr-x-script/vscode,ups216/vscode,eamodio/vscode,williamcspace/vscode,eamodio/vscode,charlespierce/vscode,joaomoreno/vscode,rkeithhill/VSCode,Microsoft/vscode,Zalastax/vscode,ups216/vscode,matthewshirley/vscode,microsoft/vscode,charlespierce/vscode,jchadwick/vscode,zyml/vscode,DustinCampbell/vscode,joaomoreno/vscode,eamodio/vscode,microsoft/vscode,landonepps/vscode,charlespierce/vscode,microsoft/vscode,microsoft/vscode,the-ress/vscode,rishii7/vscode,0xmohit/vscode,mjbvz/vscode,bsmr-x-script/vscode,gagangupt16/vscode,ups216/vscode,KattMingMing/vscode,gagangupt16/vscode,0xmohit/vscode,hashhar/vscode,Krzysztof-Cieslak/vscode,jchadwick/vscode,Zalastax/vscode,the-ress/vscode,the-ress/vscode,ups216/vscode,charlespierce/vscode,mjbvz/vscode,charlespierce/vscode,stringham/vscode,landonepps/vscode,microlv/vscode,matthewshirley/vscode,microsoft/vscode,veeramarni/vscode,williamcspace/vscode,hungys/vscode,0xmohit/vscode,stringham/vscode,zyml/vscode,veeramarni/vscode,matthewshirley/vscode,jchadwick/vscode,hoovercj/vscode,microlv/vscode,williamcspace/vscode,hoovercj/vscode,bsmr-x-script/vscode,microlv/vscode,the-ress/vscode,microsoft/vscode,eamodio/vscode,hashhar/vscode,eamodio/vscode,ups216/vscode,the-ress/vscode,hashhar/vscode,0xmohit/vscode,landonepps/vscode,Microsoft/vscode,mjbvz/vscode,hungys/vscode,hashhar/vscode,veeramarni/vscode,bsmr-x-script/vscode,charlespierce/vscode,Krzysztof-Cieslak/vscode,radshit/vscode,hashhar/vscode,matthewshirley/vscode,microsoft/vscode,matthewshirley/vscode,gagangupt16/vscode,eklavyamirani/vscode,hungys/vscode,the-ress/vscode,rishii7/vscode,Zalastax/vscode,matthewshirley/vscode,DustinCampbell/vscode,Krzysztof-Cieslak/vscode,Microsoft/vscode,williamcspace/vscode,stringham/vscode,stringham/vscode,DustinCampbell/vscode,landonepps/vscode,Zalastax/vscode,stringham/vscode,microsoft/vscode,jchadwick/vscode,hungys/vscode,veeramarni/vscode,charlespierce/vscode,bsmr-x-script/vscode,stringham/vscode,rishii7/vscode,ups216/vscode,0xmohit/vscode,radshit/vscode,joaomoreno/vscode,cleidigh/vscode,matthewshirley/vscode,jchadwick/vscode,KattMingMing/vscode,bsmr-x-script/vscode,mjbvz/vscode,eklavyamirani/vscode,charlespierce/vscode,0xmohit/vscode,microlv/vscode,williamcspace/vscode,joaomoreno/vscode,KattMingMing/vscode,Krzysztof-Cieslak/vscode,eklavyamirani/vscode,DustinCampbell/vscode,0xmohit/vscode,DustinCampbell/vscode,landonepps/vscode,the-ress/vscode,veeramarni/vscode,hoovercj/vscode,mjbvz/vscode,bsmr-x-script/vscode,cleidigh/vscode,stringham/vscode,williamcspace/vscode,hashhar/vscode,ups216/vscode,gagangupt16/vscode,mjbvz/vscode,Microsoft/vscode,matthewshirley/vscode,veeramarni/vscode,radshit/vscode,matthewshirley/vscode,hashhar/vscode,williamcspace/vscode,charlespierce/vscode,eamodio/vscode,gagangupt16/vscode,hoovercj/vscode,Krzysztof-Cieslak/vscode,jchadwick/vscode,radshit/vscode,zyml/vscode,joaomoreno/vscode,radshit/vscode,hoovercj/vscode,Zalastax/vscode,rishii7/vscode,stringham/vscode,Microsoft/vscode,eklavyamirani/vscode,microsoft/vscode,eamodio/vscode,joaomoreno/vscode,KattMingMing/vscode,charlespierce/vscode,microsoft/vscode,mjbvz/vscode,zyml/vscode,Zalastax/vscode,hoovercj/vscode,DustinCampbell/vscode,landonepps/vscode,rishii7/vscode,Microsoft/vscode,the-ress/vscode,veeramarni/vscode,radshit/vscode,landonepps/vscode,0xmohit/vscode,radshit/vscode,veeramarni/vscode,zyml/vscode,microsoft/vscode,veeramarni/vscode,eklavyamirani/vscode,the-ress/vscode,mjbvz/vscode,gagangupt16/vscode,rishii7/vscode,gagangupt16/vscode,ups216/vscode,microlv/vscode,Microsoft/vscode,mjbvz/vscode,gagangupt16/vscode,bsmr-x-script/vscode,Krzysztof-Cieslak/vscode,microlv/vscode,radshit/vscode,rishii7/vscode,bsmr-x-script/vscode,landonepps/vscode,0xmohit/vscode,Microsoft/vscode,cra0zy/VSCode,zyml/vscode,microsoft/vscode,the-ress/vscode,eklavyamirani/vscode,microsoft/vscode,jchadwick/vscode,gagangupt16/vscode,williamcspace/vscode,KattMingMing/vscode,KattMingMing/vscode,zyml/vscode,DustinCampbell/vscode,jchadwick/vscode,veeramarni/vscode,williamcspace/vscode,gagangupt16/vscode,hungys/vscode,hoovercj/vscode,gagangupt16/vscode,hashhar/vscode,charlespierce/vscode,Zalastax/vscode,mjbvz/vscode,veeramarni/vscode,landonepps/vscode,microsoft/vscode,matthewshirley/vscode,cleidigh/vscode,Krzysztof-Cieslak/vscode,ups216/vscode,eamodio/vscode,eamodio/vscode,ups216/vscode,zyml/vscode,DustinCampbell/vscode,zyml/vscode,veeramarni/vscode,bsmr-x-script/vscode,KattMingMing/vscode,eamodio/vscode,jchadwick/vscode,microlv/vscode,radshit/vscode,joaomoreno/vscode,Microsoft/vscode,jchadwick/vscode,ups216/vscode,eamodio/vscode,KattMingMing/vscode,Microsoft/vscode,veeramarni/vscode,radshit/vscode,williamcspace/vscode,rishii7/vscode,Krzysztof-Cieslak/vscode,KattMingMing/vscode,jchadwick/vscode,landonepps/vscode,hashhar/vscode,cleidigh/vscode,matthewshirley/vscode,charlespierce/vscode,hungys/vscode,hashhar/vscode,DustinCampbell/vscode,eklavyamirani/vscode,eklavyamirani/vscode,bsmr-x-script/vscode,jchadwick/vscode,hashhar/vscode,joaomoreno/vscode,hashhar/vscode,hungys/vscode,veeramarni/vscode,radshit/vscode,cleidigh/vscode,hungys/vscode,DustinCampbell/vscode,landonepps/vscode,jchadwick/vscode,eklavyamirani/vscode,microlv/vscode,microlv/vscode,eklavyamirani/vscode,williamcspace/vscode,Zalastax/vscode,the-ress/vscode,zyml/vscode,microlv/vscode,bsmr-x-script/vscode,matthewshirley/vscode,williamcspace/vscode,zyml/vscode,charlespierce/vscode,hashhar/vscode,williamcspace/vscode,hoovercj/vscode,zyml/vscode,mjbvz/vscode,hungys/vscode,hashhar/vscode,cleidigh/vscode,KattMingMing/vscode,cleidigh/vscode,veeramarni/vscode,Zalastax/vscode,jchadwick/vscode,rishii7/vscode,radshit/vscode,eklavyamirani/vscode,ups216/vscode,williamcspace/vscode,DustinCampbell/vscode,eamodio/vscode,the-ress/vscode,eklavyamirani/vscode,DustinCampbell/vscode,hoovercj/vscode,Microsoft/vscode,bsmr-x-script/vscode,microlv/vscode,stringham/vscode,landonepps/vscode,rishii7/vscode,radshit/vscode,KattMingMing/vscode,gagangupt16/vscode,0xmohit/vscode,mjbvz/vscode,microlv/vscode,DustinCampbell/vscode,rishii7/vscode,matthewshirley/vscode,zyml/vscode,rishii7/vscode,Zalastax/vscode,0xmohit/vscode,mjbvz/vscode,DustinCampbell/vscode,hashhar/vscode,hungys/vscode,microlv/vscode,KattMingMing/vscode,Krzysztof-Cieslak/vscode,bsmr-x-script/vscode,radshit/vscode,Microsoft/vscode,hoovercj/vscode,KattMingMing/vscode,Zalastax/vscode,eamodio/vscode,0xmohit/vscode,joaomoreno/vscode,hoovercj/vscode,stringham/vscode,stringham/vscode,cleidigh/vscode,Zalastax/vscode,joaomoreno/vscode,Zalastax/vscode,landonepps/vscode,Zalastax/vscode,gagangupt16/vscode,mjbvz/vscode,matthewshirley/vscode,Zalastax/vscode,cleidigh/vscode,charlespierce/vscode,gagangupt16/vscode,landonepps/vscode,cleidigh/vscode,the-ress/vscode,Microsoft/vscode,hungys/vscode,eklavyamirani/vscode,cleidigh/vscode,Microsoft/vscode,bsmr-x-script/vscode,ups216/vscode,microlv/vscode,eamodio/vscode,hoovercj/vscode,gagangupt16/vscode,rishii7/vscode | ---
+++
@@ -7,6 +7,7 @@
import {TPromise} from 'vs/base/common/winjs.base';
import {createDecorator, ServiceIdentifier} from 'vs/platform/instantiation/common/instantiation';
import platform = require('vs/base/common/platform');
+import processes = require('vs/base/node/processes');
export const TERMINAL_PANEL_ID = 'workbench.panel.terminal';
@@ -14,7 +15,7 @@
export const TERMINAL_DEFAULT_SHELL_LINUX = !platform.isWindows ? (process.env.SHELL || 'sh') : 'sh';
export const TERMINAL_DEFAULT_SHELL_OSX = !platform.isWindows ? (process.env.SHELL || 'sh') : 'sh';
-export const TERMINAL_DEFAULT_SHELL_WINDOWS = platform.isWindows ? (process.env.COMSPEC || 'cmd.exe') : 'cmd.exe';
+export const TERMINAL_DEFAULT_SHELL_WINDOWS = processes.getWindowsShell();
export var ITerminalService = createDecorator<ITerminalService>(TERMINAL_SERVICE_ID);
|
58c37d761a62100016a92786ae8620006143cf3d | cypress/integration/mentions.ts | cypress/integration/mentions.ts | const DELAY = 500;
context("Mentions", () => {
beforeEach(() => {
cy.visit("http://localhost:4000");
});
it("'@ + Enter' should select the first suggestion", () => {
cy.get(".mde-text")
.type("{selectall}{backspace}")
.type("@")
.wait(DELAY)
.type("{enter}")
.should("have.value", "@andre ");
});
it("'@ + Arrow down + Enter' should select the first suggestion", () => {
cy.get(".mde-text")
.type("{selectall}{backspace}")
.type("@")
.wait(DELAY)
.type("{downArrow}")
.type("{enter}")
.should("have.value", "@angela ");
});
it("'@ + 4x Arrow down + Enter' should cycle and select the first suggestion", () => {
cy.get(".mde-text")
.type("{selectall}{backspace}")
.type("@")
.wait(DELAY)
.type("{downArrow}{downArrow}{downArrow}{downArrow}")
.type("{enter}")
.should("have.value", "@andre ");
});
});
| const DELAY = 500;
context("Suggestions", () => {
beforeEach(() => {
cy.visit("http://localhost:4000");
});
it("'@' should display the suggestions box", () => {
cy.get(".mde-suggestions").should("not.exist");
cy.get(".mde-text")
.type("{selectall}{backspace}")
.type("@");
cy.get(".mde-suggestions").should("exist");
});
it("'@ + Enter' should select the first suggestion", () => {
cy.get(".mde-text")
.type("{selectall}{backspace}")
.type("@")
.wait(DELAY)
.type("{enter}")
.should("have.value", "@andre ");
});
it("'@ + Arrow down + Enter' should select the first suggestion", () => {
cy.get(".mde-text")
.type("{selectall}{backspace}")
.type("@")
.wait(DELAY)
.type("{downArrow}")
.type("{enter}")
.should("have.value", "@angela ");
});
it("'@ + 4x Arrow down + Enter' should cycle and select the first suggestion", () => {
cy.get(".mde-text")
.type("{selectall}{backspace}")
.type("@")
.wait(DELAY)
.type("{downArrow}{downArrow}{downArrow}{downArrow}")
.type("{enter}")
.should("have.value", "@andre ");
});
});
| Add a test for suggestions | Add a test for suggestions
| TypeScript | mit | andrerpena/react-mde,andrerpena/react-mde,andrerpena/react-mde | ---
+++
@@ -1,8 +1,15 @@
const DELAY = 500;
-context("Mentions", () => {
+context("Suggestions", () => {
beforeEach(() => {
cy.visit("http://localhost:4000");
+ });
+ it("'@' should display the suggestions box", () => {
+ cy.get(".mde-suggestions").should("not.exist");
+ cy.get(".mde-text")
+ .type("{selectall}{backspace}")
+ .type("@");
+ cy.get(".mde-suggestions").should("exist");
});
it("'@ + Enter' should select the first suggestion", () => {
cy.get(".mde-text") |
c01435e9df80be04636b3e114e823bfa7a85be4f | types/clean-webpack-plugin/clean-webpack-plugin-tests.ts | types/clean-webpack-plugin/clean-webpack-plugin-tests.ts | import * as CleanWebpackPlugin from 'clean-webpack-plugin';
const paths = [
'path',
'glob/**/*.js',
];
new CleanWebpackPlugin(paths);
new CleanWebpackPlugin(paths, 'root-directory');
new CleanWebpackPlugin(paths, {});
new CleanWebpackPlugin(paths, {
root: 'root-directory',
verbose: true,
dry: true,
watch: true,
exclude: ['a, b'],
});
| import CleanWebpackPlugin = require('clean-webpack-plugin');
const paths = [
'path',
'glob/**/*.js',
];
new CleanWebpackPlugin(paths);
new CleanWebpackPlugin(paths, 'root-directory');
new CleanWebpackPlugin(paths, {});
new CleanWebpackPlugin(paths, {
root: 'root-directory',
verbose: true,
dry: true,
watch: true,
exclude: ['a, b'],
});
| Use `import = require` syntax. | Use `import = require` syntax. | TypeScript | mit | AgentME/DefinitelyTyped,borisyankov/DefinitelyTyped,one-pieces/DefinitelyTyped,georgemarshall/DefinitelyTyped,aciccarello/DefinitelyTyped,magny/DefinitelyTyped,chrootsu/DefinitelyTyped,aciccarello/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,alexdresko/DefinitelyTyped,borisyankov/DefinitelyTyped,magny/DefinitelyTyped,georgemarshall/DefinitelyTyped,dsebastien/DefinitelyTyped,rolandzwaga/DefinitelyTyped,markogresak/DefinitelyTyped,arusakov/DefinitelyTyped,mcliment/DefinitelyTyped,zuzusik/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,zuzusik/DefinitelyTyped,benliddicott/DefinitelyTyped,laurentiustamate94/DefinitelyTyped,AgentME/DefinitelyTyped,arusakov/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,rolandzwaga/DefinitelyTyped,AgentME/DefinitelyTyped,zuzusik/DefinitelyTyped,georgemarshall/DefinitelyTyped,alexdresko/DefinitelyTyped,AgentME/DefinitelyTyped,georgemarshall/DefinitelyTyped,chrootsu/DefinitelyTyped,dsebastien/DefinitelyTyped,aciccarello/DefinitelyTyped,arusakov/DefinitelyTyped | ---
+++
@@ -1,4 +1,4 @@
-import * as CleanWebpackPlugin from 'clean-webpack-plugin';
+import CleanWebpackPlugin = require('clean-webpack-plugin');
const paths = [
'path', |
54266c094adea7a3ea4449e1e223fa74ac5fabed | ui/test/kapacitor/components/KapacitorRulesTable.test.tsx | ui/test/kapacitor/components/KapacitorRulesTable.test.tsx | import React from 'react'
import {shallow} from 'enzyme'
import {isUUIDv4} from 'src/utils/stringValidators'
import KapacitorRulesTable from 'src/kapacitor/components/KapacitorRulesTable'
import {source, kapacitorRules} from 'test/resources'
const setup = () => {
const props = {
source,
rules: kapacitorRules,
onDelete: () => {},
onChangeRuleStatus: () => {},
}
const wrapper = shallow(<KapacitorRulesTable {...props} />)
return {
wrapper,
props,
}
}
describe('Kapacitor.Components.KapacitorRulesTable', () => {
describe('rendering', () => {
it('renders KapacitorRulesTable', () => {
const {wrapper} = setup()
expect(wrapper.exists()).toBe(true)
})
it('renders each row with key that is a UUIDv4', () => {
const {wrapper} = setup()
wrapper
.find('tbody')
.children()
.forEach(child => expect(isUUIDv4(child.key())).toEqual(true))
})
})
})
| import React from 'react'
import {shallow} from 'enzyme'
import KapacitorRulesTable from 'src/kapacitor/components/KapacitorRulesTable'
import {source, kapacitorRules} from 'test/resources'
const setup = () => {
const props = {
source,
rules: kapacitorRules,
onDelete: () => {},
onChangeRuleStatus: () => {}
}
const wrapper = shallow(<KapacitorRulesTable {...props} />)
return {
wrapper,
props
}
}
describe('Kapacitor.Components.KapacitorRulesTable', () => {
describe('rendering', () => {
it('renders KapacitorRulesTable', () => {
const {wrapper} = setup()
expect(wrapper.exists()).toBe(true)
})
})
})
| Revert "Test KapacitorRulesTable tr keys to be UUIDv4" | Revert "Test KapacitorRulesTable tr keys to be UUIDv4"
This reverts commit bd6674859cb23500fd24d4cfbdf5503aeef0c831.
| TypeScript | mit | influxdata/influxdb,influxdb/influxdb,mark-rushakoff/influxdb,mark-rushakoff/influxdb,nooproblem/influxdb,influxdb/influxdb,mark-rushakoff/influxdb,influxdb/influxdb,li-ang/influxdb,mark-rushakoff/influxdb,nooproblem/influxdb,li-ang/influxdb,influxdb/influxdb,mark-rushakoff/influxdb,influxdb/influxdb,influxdata/influxdb,nooproblem/influxdb,nooproblem/influxdb,mark-rushakoff/influxdb,nooproblem/influxdb,influxdb/influxdb | ---
+++
@@ -1,7 +1,5 @@
import React from 'react'
import {shallow} from 'enzyme'
-
-import {isUUIDv4} from 'src/utils/stringValidators'
import KapacitorRulesTable from 'src/kapacitor/components/KapacitorRulesTable'
@@ -12,14 +10,14 @@
source,
rules: kapacitorRules,
onDelete: () => {},
- onChangeRuleStatus: () => {},
+ onChangeRuleStatus: () => {}
}
const wrapper = shallow(<KapacitorRulesTable {...props} />)
return {
wrapper,
- props,
+ props
}
}
@@ -29,13 +27,5 @@
const {wrapper} = setup()
expect(wrapper.exists()).toBe(true)
})
-
- it('renders each row with key that is a UUIDv4', () => {
- const {wrapper} = setup()
- wrapper
- .find('tbody')
- .children()
- .forEach(child => expect(isUUIDv4(child.key())).toEqual(true))
- })
})
}) |
c39138e6a7bc51261600eee2c578011247f6c282 | website/app/main.ts | website/app/main.ts | import {bootstrap} from '@angular/platform-browser-dynamic';
import {AppComponent} from './app.component';
bootstrap(AppComponent);
| import {bootstrap} from '@angular/platform-browser-dynamic';
import {AppComponent} from './app.component';
import {enableProdMode} from '@angular/core';
// enable production mode and thus disable debugging information
enableProdMode();
bootstrap(AppComponent);
| Enable Angular 2 prod mode on website to increase performance. | Enable Angular 2 prod mode on website to increase performance.
| TypeScript | mit | DTU-R3/ArloBot,chrisl8/ArloBot,chrisl8/ArloBot,DTU-R3/ArloBot,DTU-R3/ArloBot,remarvel/ArloBot,remarvel/ArloBot,remarvel/ArloBot,chrisl8/ArloBot,remarvel/ArloBot,chrisl8/ArloBot,DTU-R3/ArloBot,chrisl8/ArloBot,chrisl8/ArloBot,remarvel/ArloBot,DTU-R3/ArloBot,DTU-R3/ArloBot,remarvel/ArloBot | ---
+++
@@ -1,4 +1,8 @@
import {bootstrap} from '@angular/platform-browser-dynamic';
import {AppComponent} from './app.component';
+import {enableProdMode} from '@angular/core';
+
+// enable production mode and thus disable debugging information
+enableProdMode();
bootstrap(AppComponent); |
11738f0da96ca7dd7ebff1c39bc1778f3f0e3e92 | src/keys.ts | src/keys.ts |
import { ECPair, address as baddress } from 'bitcoinjs-lib'
import { randomBytes } from './encryption/cryptoRandom'
import { createSha2Hash } from './encryption/sha2Hash'
import { createHashRipemd160 } from './encryption/hashRipemd160'
/**
*
* @param numberOfBytes
*
* @ignore
*/
export function getEntropy(arg: number): Buffer {
if (!arg) {
arg = 32
}
return randomBytes(arg)
}
/**
* @ignore
*/
export function makeECPrivateKey() {
const keyPair = ECPair.makeRandom({ rng: getEntropy })
return keyPair.privateKey.toString('hex')
}
/**
* @ignore
*/
export async function publicKeyToAddress(publicKey: string | Buffer) {
const publicKeyBuffer = Buffer.isBuffer(publicKey) ? publicKey : Buffer.from(publicKey, 'hex')
const sha2Hash = await createSha2Hash()
const publicKeyHash160 = await createHashRipemd160().digest(
await sha2Hash.digest(publicKeyBuffer)
)
const address = baddress.toBase58Check(publicKeyHash160, 0x00)
return address
}
/**
* @ignore
*/
export function getPublicKeyFromPrivate(privateKey: string | Buffer) {
const privateKeyBuffer = Buffer.isBuffer(privateKey) ? privateKey : Buffer.from(privateKey, 'hex')
const keyPair = ECPair.fromPrivateKey(privateKeyBuffer)
return keyPair.publicKey.toString('hex')
}
|
import { ECPair, address as baddress, networks } from 'bitcoinjs-lib'
import { randomBytes } from './encryption/cryptoRandom'
import { createSha2Hash } from './encryption/sha2Hash'
import { createHashRipemd160 } from './encryption/hashRipemd160'
/**
*
* @param numberOfBytes
*
* @ignore
*/
export function getEntropy(arg: number): Buffer {
if (!arg) {
arg = 32
}
return randomBytes(arg)
}
/**
* @ignore
*/
export function makeECPrivateKey() {
const keyPair = ECPair.makeRandom({ rng: getEntropy })
return keyPair.privateKey.toString('hex')
}
/**
* @ignore
*/
export async function publicKeyToAddress(publicKey: string | Buffer) {
const publicKeyBuffer = Buffer.isBuffer(publicKey) ? publicKey : Buffer.from(publicKey, 'hex')
const sha2Hash = await createSha2Hash()
const publicKeyHash160 = await createHashRipemd160().digest(
await sha2Hash.digest(publicKeyBuffer)
)
const address = baddress.toBase58Check(publicKeyHash160, networks.bitcoin.pubKeyHash)
return address
}
/**
* @ignore
*/
export function getPublicKeyFromPrivate(privateKey: string | Buffer) {
const privateKeyBuffer = Buffer.isBuffer(privateKey) ? privateKey : Buffer.from(privateKey, 'hex')
const keyPair = ECPair.fromPrivateKey(privateKeyBuffer)
return keyPair.publicKey.toString('hex')
}
| Use proper const for base58Check address encoding | Use proper const for base58Check address encoding
| TypeScript | mit | blockstack/opendig,blockstack/blockstack-cli,blockstack/blockstack-cli | ---
+++
@@ -1,5 +1,5 @@
-import { ECPair, address as baddress } from 'bitcoinjs-lib'
+import { ECPair, address as baddress, networks } from 'bitcoinjs-lib'
import { randomBytes } from './encryption/cryptoRandom'
import { createSha2Hash } from './encryption/sha2Hash'
import { createHashRipemd160 } from './encryption/hashRipemd160'
@@ -34,7 +34,7 @@
const publicKeyHash160 = await createHashRipemd160().digest(
await sha2Hash.digest(publicKeyBuffer)
)
- const address = baddress.toBase58Check(publicKeyHash160, 0x00)
+ const address = baddress.toBase58Check(publicKeyHash160, networks.bitcoin.pubKeyHash)
return address
}
|
3bb15c9278d672c4181c1cc36db1e67c0265da35 | packages/components/containers/features/FeaturesContext.ts | packages/components/containers/features/FeaturesContext.ts | import { createContext } from 'react';
export type FeatureType = 'boolean' | 'integer' | 'float' | 'string' | 'enumeration' | 'mixed';
export interface Feature<V = any> {
Code: string;
Type: FeatureType;
DefaultValue: V;
Value: V;
Minimum: number;
Maximum: number;
Global: boolean;
Writable: boolean;
ExpirationTime: number;
UpdateTime: number;
}
export enum FeatureCode {
EarlyAccess = 'EarlyAccess',
WelcomeImportModalShown = 'WelcomeImportModalShown',
BlackFridayPromoShown = 'BlackFridayPromoShown',
BundlePromoShown = 'BundlePromoShown',
UsedMailMobileApp = 'UsedMailMobileApp',
UsedContactsImport = 'UsedContactsImport',
CanUserSendFeedback = 'CanUserSendFeedback',
CalendarExport = 'CalendarExport',
EnabledEncryptedSearch = 'EnabledEncryptedSearch',
}
export interface FeaturesContextValue {
features: { [code: string]: Feature | undefined };
loading: { [code: string]: boolean | undefined };
get: <V = any>(code: FeatureCode) => Promise<Feature<V>>;
put: <V = any>(code: FeatureCode, value: V) => Promise<Feature<V>>;
}
export default createContext<FeaturesContextValue>({} as FeaturesContextValue);
| import { createContext } from 'react';
export type FeatureType = 'boolean' | 'integer' | 'float' | 'string' | 'enumeration' | 'mixed';
export interface Feature<V = any> {
Code: string;
Type: FeatureType;
DefaultValue: V;
Value: V;
Minimum: number;
Maximum: number;
Global: boolean;
Writable: boolean;
ExpirationTime: number;
UpdateTime: number;
}
export enum FeatureCode {
EarlyAccess = 'EarlyAccess',
WelcomeImportModalShown = 'WelcomeImportModalShown',
BlackFridayPromoShown = 'BlackFridayPromoShown',
BundlePromoShown = 'BundlePromoShown',
UsedMailMobileApp = 'UsedMailMobileApp',
UsedContactsImport = 'UsedContactsImport',
CanUserSendFeedback = 'CanUserSendFeedback',
EnabledEncryptedSearch = 'EnabledEncryptedSearch',
EnabledProtonProtonInvites = 'EnabledProtonProtonInvites',
}
export interface FeaturesContextValue {
features: { [code: string]: Feature | undefined };
loading: { [code: string]: boolean | undefined };
get: <V = any>(code: FeatureCode) => Promise<Feature<V>>;
put: <V = any>(code: FeatureCode, value: V) => Promise<Feature<V>>;
}
export default createContext<FeaturesContextValue>({} as FeaturesContextValue);
| Add BE feature flag for Proton to Proton invites | Add BE feature flag for Proton to Proton invites
| TypeScript | mit | ProtonMail/WebClient,ProtonMail/WebClient,ProtonMail/WebClient | ---
+++
@@ -23,8 +23,8 @@
UsedMailMobileApp = 'UsedMailMobileApp',
UsedContactsImport = 'UsedContactsImport',
CanUserSendFeedback = 'CanUserSendFeedback',
- CalendarExport = 'CalendarExport',
EnabledEncryptedSearch = 'EnabledEncryptedSearch',
+ EnabledProtonProtonInvites = 'EnabledProtonProtonInvites',
}
export interface FeaturesContextValue { |
b6ea06b8381802f611ebca36cbf435a7e81d6b0b | src/core/screenreader/translations/translate.ts | src/core/screenreader/translations/translate.ts | import { add } from '../../../_modules/i18n';
import nl from './nl';
import fa from './fa';
import de from './de';
import ru from './ru';
import pt_br from './pt_br';
export default function() {
add(nl, 'nl');
add(fa, 'fa');
add(de, 'de');
add(pt_br, 'pt_br');
}
| import { add } from '../../../_modules/i18n';
import nl from './nl';
import fa from './fa';
import de from './de';
import ru from './ru';
import pt_br from './pt_br';
export default function() {
add(nl, 'nl');
add(fa, 'fa');
add(de, 'de');
add(ru, 'ru');
add(pt_br, 'pt_br');
}
| Fix some mistake on PR. | Fix some mistake on PR. | TypeScript | mit | BeSite/jQuery.mmenu,BeSite/jQuery.mmenu | ---
+++
@@ -10,5 +10,6 @@
add(nl, 'nl');
add(fa, 'fa');
add(de, 'de');
+ add(ru, 'ru');
add(pt_br, 'pt_br');
} |
2c5fb70dd4a73051f3117ad6f6f0a2b3b72e238e | spec/TsSyntaxTest.ts | spec/TsSyntaxTest.ts | /**
This file purely exists to make sure the expected syntax passes typescript type-checking
*/
import TminusLib = require("../src/lib");
function noop() {
var control = TminusLib.countdown({
endTime: new Date().getTime() + (1000 * 60 * 60),
target: <NodeListOf<HTMLElement>>document.querySelectorAll('#countdown')
});
control.stopCountdown(); //Stop the countdown!
} | /**
This file purely exists to make sure the expected syntax passes typescript type-checking
*/
import TminusLib = require("../src/lib");
function noop() {
var control = TminusLib.countdown({
endTime: new Date().getTime() + (1000 * 60 * 60),
target: <NodeListOf<HTMLElement>>document.querySelectorAll('#countdown'),
finishedClass: "finished",
loadingClass: "loading",
finishedCallback: () => {
console.log("finished");
},
loadingCallback: () => {
console.log("loaded");
},
displayAttribute: "tminus-unit",
hidableAttribute: "tminus-hide-if-zero",
zeroPadOverrides: {
"D": false
}
});
control.stop(); //Stop the countdown!
control.start();
control.currentPeriod();
control.lastUpdate();
} | Update test to correspond with the outer syntax | Update test to correspond with the outer syntax
| TypeScript | mit | ChronusEU/lib-tminus.js,ChronusEU/lib-tminus.js,ChronusEU/lib-tminus.js | ---
+++
@@ -7,7 +7,23 @@
function noop() {
var control = TminusLib.countdown({
endTime: new Date().getTime() + (1000 * 60 * 60),
- target: <NodeListOf<HTMLElement>>document.querySelectorAll('#countdown')
+ target: <NodeListOf<HTMLElement>>document.querySelectorAll('#countdown'),
+ finishedClass: "finished",
+ loadingClass: "loading",
+ finishedCallback: () => {
+ console.log("finished");
+ },
+ loadingCallback: () => {
+ console.log("loaded");
+ },
+ displayAttribute: "tminus-unit",
+ hidableAttribute: "tminus-hide-if-zero",
+ zeroPadOverrides: {
+ "D": false
+ }
});
- control.stopCountdown(); //Stop the countdown!
+ control.stop(); //Stop the countdown!
+ control.start();
+ control.currentPeriod();
+ control.lastUpdate();
} |
c5fe83cb119f84ccd3ba6155e4544fc7a207fdd1 | examples/browser/main.ts | examples/browser/main.ts | import * as Gtk from '../../out/Gtk'
import * as WebKit from '../../out/WebKit'
Gtk.init(null)
let wnd = new Gtk.Window({ title: 'Browser Test', default_width: 400, default_height: 300 })
let box = new Gtk.Box({ })
let scroll = new Gtk.ScrolledWindow({ })
let webview = new WebKit.WebView({ })
webview.load_uri("http://www.google.com")
scroll.add(webview)
box.pack_start(scroll, true, true, 0)
wnd.add(box)
wnd.show_all()
wnd.connect("delete-event", (obj, event) => {
Gtk.main_quit()
return true
})
Gtk.main()
| import * as Gtk from '../../out/Gtk';
import { FontDescription } from '../../out/Pango';
import * as WebKit from '../../out/WebKit';
function makeBackButton(label: string) {
let but = new Gtk.Button({ label: label })
but.get_child().modify_font(FontDescription.from_string('sans bold 16'))
return but
}
Gtk.init(null)
let wnd = new Gtk.Window({ title: 'Browser Test', default_width: 400, default_height: 300 })
let box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
let hbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0)
hbox.pack_start(makeBackButton('⇦'), false, false, 5)
hbox.pack_start(makeBackButton('⇨'), false, false, 5)
hbox.pack_start(makeBackButton('↻'), false, false, 5)
hbox.pack_start(new Gtk.Entry({ text: 'http://fds', halign: Gtk.Align.FILL }), true, true, 5)
let scroll = new Gtk.ScrolledWindow({ })
let webview = new WebKit.WebView({ })
webview.load_uri("http://www.google.com")
scroll.add(webview)
box.pack_start(hbox, false, true, 0)
box.pack_start(scroll, true, true, 0)
wnd.add(box)
wnd.show_all()
wnd.connect("delete-event", (obj, event) => {
Gtk.main_quit()
return true
})
Gtk.main()
| Improve web browser example a little. | Improve web browser example a little.
| TypeScript | apache-2.0 | sammydre/ts-for-gjs,sammydre/ts-for-gjs | ---
+++
@@ -1,15 +1,30 @@
-import * as Gtk from '../../out/Gtk'
-import * as WebKit from '../../out/WebKit'
+import * as Gtk from '../../out/Gtk';
+import { FontDescription } from '../../out/Pango';
+import * as WebKit from '../../out/WebKit';
+
+function makeBackButton(label: string) {
+ let but = new Gtk.Button({ label: label })
+ but.get_child().modify_font(FontDescription.from_string('sans bold 16'))
+ return but
+}
Gtk.init(null)
let wnd = new Gtk.Window({ title: 'Browser Test', default_width: 400, default_height: 300 })
-let box = new Gtk.Box({ })
+let box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0)
+
+let hbox = Gtk.Box.new(Gtk.Orientation.HORIZONTAL, 0)
+hbox.pack_start(makeBackButton('⇦'), false, false, 5)
+hbox.pack_start(makeBackButton('⇨'), false, false, 5)
+hbox.pack_start(makeBackButton('↻'), false, false, 5)
+hbox.pack_start(new Gtk.Entry({ text: 'http://fds', halign: Gtk.Align.FILL }), true, true, 5)
+
let scroll = new Gtk.ScrolledWindow({ })
let webview = new WebKit.WebView({ })
webview.load_uri("http://www.google.com")
scroll.add(webview)
+box.pack_start(hbox, false, true, 0)
box.pack_start(scroll, true, true, 0)
wnd.add(box)
wnd.show_all() |
3353e7005e5de3913dc960e1cbeefac48f5da0cc | client/components/Modal/PageCreateModal.stories.tsx | client/components/Modal/PageCreateModal.stories.tsx | import React from 'react'
import PageCreateModal from './PageCreateModal'
import Crowi from '../../util/Crowi'
import i18n from '../../i18n'
i18n()
const crowi = new Crowi({ user: {}, csrfToken: '' }, window)
export default { title: 'Modal/PageCreateModal' }
export const Default = () => <PageCreateModal crowi={crowi} />
| import React from 'react'
import PageCreateModal from './PageCreateModal'
import Crowi from '../../util/Crowi'
import i18n from '../../i18n'
i18n()
const crowi = new Crowi({ user: { name: 'storybook' }, csrfToken: '' }, window)
export default { title: 'Modal/PageCreateModal' }
export const Default = () => <PageCreateModal crowi={crowi} />
| Add user name to PageCreateModal story | Add user name to PageCreateModal story
| TypeScript | mit | crowi/crowi,crowi/crowi,crowi/crowi | ---
+++
@@ -5,7 +5,7 @@
i18n()
-const crowi = new Crowi({ user: {}, csrfToken: '' }, window)
+const crowi = new Crowi({ user: { name: 'storybook' }, csrfToken: '' }, window)
export default { title: 'Modal/PageCreateModal' }
|
c607a6a498eaee150560093625d8148113168a39 | src/lib/processors/throttler.ts | src/lib/processors/throttler.ts | import Processor from './processor';
export default class Throttler extends Processor {
private eventsPerPeriod: number;
private eventsInProgress: number = 0;
private periodInMS: number;
private queue: any[] = [];
constructor(options) {
super(options);
this.eventsPerPeriod = this.input[0];
this.periodInMS = this.input[1] || 1000;
this.on('processed', () => this.processQueue());
}
processQueue() {
if (this.queue.length > 0) {
var event = this.queue.shift();
this.addEvent();
this.inject(() => event);
}
}
async wait(ms: number) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async addEvent() {
this.eventsInProgress = this.eventsInProgress + 1;
await this.wait(this.periodInMS);
this.eventsInProgress = this.eventsInProgress - 1;
this.emit('processed');
}
async process(event) {
if (this.eventsInProgress < this.eventsPerPeriod) {
this.addEvent();
return event;
} else {
this.queue.push(event);
}
}
}
| import Processor from './processor';
export default class Throttler extends Processor {
private eventsPerPeriod: number;
private eventsInProgress: number = 0;
private periodInMS: number;
private queue: any[] = [];
constructor(options) {
super(options);
this.eventsPerPeriod = this.input[0];
this.periodInMS = this.input[1] || 1000;
this.on('processed', () => this.processQueue());
}
processQueue() {
if (this.queue.length > 0) {
const event = this.queue.shift();
this.addEvent();
this.inject(() => event);
}
}
async wait(ms: number) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async addEvent() {
this.eventsInProgress = this.eventsInProgress + 1;
await this.wait(this.periodInMS);
this.eventsInProgress = this.eventsInProgress - 1;
this.emit('processed');
}
async process(event) {
if (this.eventsInProgress < this.eventsPerPeriod) {
this.addEvent();
return event;
} else {
this.queue.push(event);
}
}
}
| Use const insead of var | Use const insead of var
| TypeScript | isc | Workable/aggregator-eip | ---
+++
@@ -15,7 +15,7 @@
processQueue() {
if (this.queue.length > 0) {
- var event = this.queue.shift();
+ const event = this.queue.shift();
this.addEvent();
this.inject(() => event);
} |
3cf03ced32ba24df96fa646969e8f628f57bbe2b | src/core/vg-media/i-playable.ts | src/core/vg-media/i-playable.ts | import {Observable} from "rxjs/Observable";
export interface IPlayable {
id:string;
elem:any;
time:any;
buffer:any;
track?:any;
canPlay:boolean;
canPlayThrough:boolean;
isMetadataLoaded:boolean;
isWaiting:boolean;
isCompleted:boolean;
isLive:boolean;
state:string;
subscriptions:IMediaSubscriptions;
duration:number;
currentTime:number;
play:Function;
pause:Function;
dispatchEvent?:Function;
}
export interface IMediaSubscriptions {
abort: Observable<any>;
bufferDetected: Observable<any>;
canPlay: Observable<any>;
canPlayThrough: Observable<any>;
durationChange: Observable<any>;
emptied: Observable<any>;
encrypted: Observable<any>;
ended: Observable<any>;
error: Observable<any>;
loadedData: Observable<any>;
loadedMetadata: Observable<any>;
loadStart: Observable<any>;
pause: Observable<any>;
play: Observable<any>;
playing: Observable<any>;
progress: Observable<any>;
rateChange: Observable<any>;
seeked: Observable<any>;
seeking: Observable<any>;
stalled: Observable<any>;
suspend: Observable<any>;
timeUpdate: Observable<any>;
volumeChange: Observable<any>;
waiting: Observable<any>;
// to observe the ads
startAds: Observable<any>;
endAds: Observable<any>;
}
| import {Observable} from "rxjs/Observable";
export interface IPlayable {
id:string;
elem:any;
time:any;
buffer:any;
track?:any; // its optional, need in add custom cue (addTextTrack)
canPlay:boolean;
canPlayThrough:boolean;
isMetadataLoaded:boolean;
isWaiting:boolean;
isCompleted:boolean;
isLive:boolean;
state:string;
subscriptions:IMediaSubscriptions;
duration:number;
currentTime:number;
play:Function;
pause:Function;
dispatchEvent?:Function;
}
export interface IMediaSubscriptions {
abort: Observable<any>;
bufferDetected: Observable<any>;
canPlay: Observable<any>;
canPlayThrough: Observable<any>;
durationChange: Observable<any>;
emptied: Observable<any>;
encrypted: Observable<any>;
ended: Observable<any>;
error: Observable<any>;
loadedData: Observable<any>;
loadedMetadata: Observable<any>;
loadStart: Observable<any>;
pause: Observable<any>;
play: Observable<any>;
playing: Observable<any>;
progress: Observable<any>;
rateChange: Observable<any>;
seeked: Observable<any>;
seeking: Observable<any>;
stalled: Observable<any>;
suspend: Observable<any>;
timeUpdate: Observable<any>;
volumeChange: Observable<any>;
waiting: Observable<any>;
// to observe the ads
startAds: Observable<any>;
endAds: Observable<any>;
}
| Add create track and cues dynamically | Add create track and cues dynamically
| TypeScript | mit | videogular/videogular2,videogular/videogular2,amitkumarmahajan/videogular2,amitkumarmahajan/videogular2,amitkumarmahajan/videogular2,kwarismian/videogular2,videogular/videogular2,kwarismian/videogular2,kwarismian/videogular2 | ---
+++
@@ -5,7 +5,7 @@
elem:any;
time:any;
buffer:any;
- track?:any;
+ track?:any; // its optional, need in add custom cue (addTextTrack)
canPlay:boolean;
canPlayThrough:boolean;
isMetadataLoaded:boolean; |
d84b2df520991b1681736b4786c601eb38d97a0a | src/nerdbank-gitversioning.npm/ts/index.ts | src/nerdbank-gitversioning.npm/ts/index.ts | 'use strict';
import http = require('http');
import * as q from 'q';
import * as request from 'request';
import * as fs from 'fs';
async function existsAsync(path: string) {
return new Promise<boolean>(resolve => fs.exists(path, resolve));
};
export async function downloadNuGetExe(): Promise<string> {
const nugetExePath = 'nuget.exe';
if (!(await existsAsync(nugetExePath))) {
console.log('Downloading nuget.exe...');
var result = await new Promise<request.Request>(
(resolve, reject) => {
var req = request('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe');
req.pipe(fs.createWriteStream(nugetExePath))
.on('finish', () => resolve(req));
});
}
return nugetExePath;
};
function getPackageVersion(): string {
return "hi23";
}
downloadNuGetExe();
| 'use strict';
import http = require('http');
import * as q from 'q';
import * as request from 'request';
import * as fs from 'fs';
import {exec} from 'child_process';
function existsAsync(path: string) {
return new Promise<boolean>(resolve => fs.exists(path, resolve));
};
function execAsync(command: string) {
return new Promise<any>(
(resolve, reject) => exec(command, (error, stdout, stderr) => {
if (error) {
reject(error);
} else {
resolve({ stdout: stdout, stderr: stderr });
}
}));
};
async function downloadNuGetExe(): Promise<string> {
const nugetExePath = 'nuget.exe';
if (!(await existsAsync(nugetExePath))) {
console.log('Downloading nuget.exe...');
var result = await new Promise<request.Request>(
(resolve, reject) => {
var req = request('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe');
req.pipe(fs.createWriteStream(nugetExePath))
.on('finish', () => resolve(req));
});
}
return nugetExePath;
};
async function installNuGetPackage(packageId: string) {
var nugetExePath = await downloadNuGetExe();
console.log(`Installing ${packageId}...`);
var result = await execAsync(`${nugetExePath} install ${packageId} -OutputDirectory .`);
console.log(result.stdout);
};
export async function getPackageVersion(): Promise<string> {
return "hi23";
}
installNuGetPackage('Nerdbank.GitVersioning');
| Install NB.GV in node script | Install NB.GV in node script
| TypeScript | mit | AArnott/Nerdbank.GitVersioning,AArnott/Nerdbank.GitVersioning,AArnott/Nerdbank.GitVersioning | ---
+++
@@ -4,12 +4,24 @@
import * as q from 'q';
import * as request from 'request';
import * as fs from 'fs';
+import {exec} from 'child_process';
-async function existsAsync(path: string) {
+function existsAsync(path: string) {
return new Promise<boolean>(resolve => fs.exists(path, resolve));
};
-export async function downloadNuGetExe(): Promise<string> {
+function execAsync(command: string) {
+ return new Promise<any>(
+ (resolve, reject) => exec(command, (error, stdout, stderr) => {
+ if (error) {
+ reject(error);
+ } else {
+ resolve({ stdout: stdout, stderr: stderr });
+ }
+ }));
+};
+
+async function downloadNuGetExe(): Promise<string> {
const nugetExePath = 'nuget.exe';
if (!(await existsAsync(nugetExePath))) {
@@ -25,8 +37,15 @@
return nugetExePath;
};
-function getPackageVersion(): string {
+async function installNuGetPackage(packageId: string) {
+ var nugetExePath = await downloadNuGetExe();
+ console.log(`Installing ${packageId}...`);
+ var result = await execAsync(`${nugetExePath} install ${packageId} -OutputDirectory .`);
+ console.log(result.stdout);
+};
+
+export async function getPackageVersion(): Promise<string> {
return "hi23";
}
-downloadNuGetExe();
+installNuGetPackage('Nerdbank.GitVersioning'); |
e6244de6e32a5fd8119fe304f519ca076fb34d81 | types/leaflet.locatecontrol/leaflet.locatecontrol-tests.ts | types/leaflet.locatecontrol/leaflet.locatecontrol-tests.ts | var map: L.Map;
// Defaults
L.control.locate().addTo(map);
// Simple
var lc = L.control.locate({
position: 'topright',
strings: {
title: "Show me where I am, yo!"
}
}).addTo(map);
// Locate Options
map.addControl(L.control.locate({
locateOptions: {
maxZoom: 10,
enableHighAccuracy: true
}})); | var map = L.map('map', {
center: [51.505, -0.09],
zoom: 13
});
// Defaults
L.control.locate().addTo(map);
// Simple
var lc = L.control.locate({
position: 'topright',
strings: {
title: "Show me where I am, yo!"
}
}).addTo(map);
// Locate Options
map.addControl(L.control.locate({
locateOptions: {
maxZoom: 10,
enableHighAccuracy: true
}})); | Update tests because of linting | Update tests because of linting
| TypeScript | mit | ashwinr/DefinitelyTyped,markogresak/DefinitelyTyped,zuzusik/DefinitelyTyped,zuzusik/DefinitelyTyped,georgemarshall/DefinitelyTyped,YousefED/DefinitelyTyped,isman-usoh/DefinitelyTyped,arusakov/DefinitelyTyped,laurentiustamate94/DefinitelyTyped,chrootsu/DefinitelyTyped,johan-gorter/DefinitelyTyped,mcliment/DefinitelyTyped,ashwinr/DefinitelyTyped,arusakov/DefinitelyTyped,jimthedev/DefinitelyTyped,QuatroCode/DefinitelyTyped,rolandzwaga/DefinitelyTyped,nycdotnet/DefinitelyTyped,alexdresko/DefinitelyTyped,smrq/DefinitelyTyped,jimthedev/DefinitelyTyped,YousefED/DefinitelyTyped,benliddicott/DefinitelyTyped,nycdotnet/DefinitelyTyped,borisyankov/DefinitelyTyped,isman-usoh/DefinitelyTyped,dsebastien/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,one-pieces/DefinitelyTyped,AgentME/DefinitelyTyped,AgentME/DefinitelyTyped,zuzusik/DefinitelyTyped,QuatroCode/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,amir-arad/DefinitelyTyped,georgemarshall/DefinitelyTyped,benishouga/DefinitelyTyped,dsebastien/DefinitelyTyped,minodisk/DefinitelyTyped,aciccarello/DefinitelyTyped,magny/DefinitelyTyped,borisyankov/DefinitelyTyped,mcrawshaw/DefinitelyTyped,AgentME/DefinitelyTyped,AgentME/DefinitelyTyped,johan-gorter/DefinitelyTyped,rolandzwaga/DefinitelyTyped,aciccarello/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,minodisk/DefinitelyTyped,georgemarshall/DefinitelyTyped,arusakov/DefinitelyTyped,alexdresko/DefinitelyTyped,abbasmhd/DefinitelyTyped,aciccarello/DefinitelyTyped,chrootsu/DefinitelyTyped,abbasmhd/DefinitelyTyped,benishouga/DefinitelyTyped,mcrawshaw/DefinitelyTyped,benishouga/DefinitelyTyped,magny/DefinitelyTyped,jimthedev/DefinitelyTyped,smrq/DefinitelyTyped,georgemarshall/DefinitelyTyped | ---
+++
@@ -1,4 +1,7 @@
-var map: L.Map;
+var map = L.map('map', {
+ center: [51.505, -0.09],
+ zoom: 13
+});
// Defaults
L.control.locate().addTo(map); |
5764e028b4e56421868a896554f5f1bfaca0fc6c | website/examples/start.tsx | website/examples/start.tsx | import React from 'react';
import { format } from 'date-fns';
import { DayPicker } from 'react-day-picker';
import 'react-day-picker/dist/style.css';
export default function Example() {
const [selected, setSelected] = React.useState<Date>();
let footer = 'Please pick a day.';
if (selected) {
footer = `You picked ${format(selected, 'PP')}.`;
}
return (
<DayPicker
mode="single"
selected={selected}
onSelect={setSelected}
footer={footer}
/>
);
}
| import React from 'react';
import { format } from 'date-fns';
import { DayPicker } from 'react-day-picker';
export default function Example() {
const [selected, setSelected] = React.useState<Date>();
let footer = 'Please pick a day.';
if (selected) {
footer = `You picked ${format(selected, 'PP')}.`;
}
return (
<DayPicker
mode="single"
selected={selected}
onSelect={setSelected}
footer={footer}
/>
);
}
| Revert "docs: include css in example" | Revert "docs: include css in example"
This reverts commit 7f1d7aea4591cf4528fc8a5ec9cdc252d81555d4.
| TypeScript | mit | gpbl/react-day-picker,gpbl/react-day-picker,gpbl/react-day-picker | ---
+++
@@ -2,7 +2,6 @@
import { format } from 'date-fns';
import { DayPicker } from 'react-day-picker';
-import 'react-day-picker/dist/style.css';
export default function Example() {
const [selected, setSelected] = React.useState<Date>(); |
331f08f6403a59810cb3e20e106d33e8dd0a4984 | packages/core/src/webpack/image-assets-extensions.ts | packages/core/src/webpack/image-assets-extensions.ts | /**
* Extensions of all assets that can be served via url
*/
export const imageAssetsExtensions = [
'bmp',
'gif',
'ico',
'jpeg',
'jpg',
'png',
'svg',
'tif',
'tiff',
];
| /**
* Extensions of all assets that can be served via url
*/
export const imageAssetsExtensions = [
'bmp',
'gif',
'ico',
'jpeg',
'jpg',
'png',
'svg',
'tif',
'tiff',
'webp',
'avif',
];
| Add webp and avif as image format | Add webp and avif as image format
| TypeScript | mit | Atyantik/react-pwa,Atyantik/react-pwa | ---
+++
@@ -11,4 +11,6 @@
'svg',
'tif',
'tiff',
+ 'webp',
+ 'avif',
]; |
4a77f74116bccfc07bb649457fe454761f219f91 | src/index.ts | src/index.ts | import { fixture as f } from './fixture'
export default f
export * from './interfaces'
import fs = require('fs')
import path = require('path')
const cache = {}
export function fixture(dir) {
const absDir = path.resolve(dir)
cache[absDir] = {}
const files = fs.readdirSync(absDir)
files.forEach(file => {
const stat = fs.statSync(path.join(absDir, file))
const id = stat.isDirectory() ? 'd' : 'f'
const node = cache[absDir][id] || (cache[absDir][id] = [])
node.push(file)
})
return {
eachFile(cb) {
cache[absDir].f.forEach(filename => {
cb({
filename,
name: filename.slice(0, filename.lastIndexOf('.')),
path: path.resolve(absDir, filename)
})
})
},
eachDirectory(cb) {
cache[absDir].d.forEach(name => {
cb({
name,
path: path.join(absDir, name)
})
})
}
}
}
| import { fixture as f } from './fixture'
export default f
export * from './interfaces'
import { readdirSync, statSync } from 'fs'
import { join, resolve } from 'path'
const cache = {}
export function fixture(dir) {
const absDir = resolve(dir)
cache[absDir] = {}
const files = readdirSync(absDir)
files.forEach(file => {
const stat = statSync(join(absDir, file))
const id = stat.isDirectory() ? 'd' : 'f'
const node = cache[absDir][id] || (cache[absDir][id] = [])
node.push(file)
})
return {
eachFile(cb) {
cache[absDir].f.forEach(filename => {
cb({
filename,
name: filename.slice(0, filename.lastIndexOf('.')),
path: resolve(absDir, filename)
})
})
},
eachDirectory(cb) {
cache[absDir].d.forEach(name => {
cb({
name,
path: join(absDir, name)
})
})
}
}
}
| Use named export interop to build es2015 | Use named export interop to build es2015
| TypeScript | mit | unional/ava-fixture,unional/ava-fixture | ---
+++
@@ -3,17 +3,17 @@
export default f
export * from './interfaces'
-import fs = require('fs')
-import path = require('path')
+import { readdirSync, statSync } from 'fs'
+import { join, resolve } from 'path'
const cache = {}
export function fixture(dir) {
- const absDir = path.resolve(dir)
+ const absDir = resolve(dir)
cache[absDir] = {}
- const files = fs.readdirSync(absDir)
+ const files = readdirSync(absDir)
files.forEach(file => {
- const stat = fs.statSync(path.join(absDir, file))
+ const stat = statSync(join(absDir, file))
const id = stat.isDirectory() ? 'd' : 'f'
const node = cache[absDir][id] || (cache[absDir][id] = [])
node.push(file)
@@ -24,7 +24,7 @@
cb({
filename,
name: filename.slice(0, filename.lastIndexOf('.')),
- path: path.resolve(absDir, filename)
+ path: resolve(absDir, filename)
})
})
},
@@ -32,7 +32,7 @@
cache[absDir].d.forEach(name => {
cb({
name,
- path: path.join(absDir, name)
+ path: join(absDir, name)
})
})
} |
a96bdc08c16222f1b4850e459360478c2db949ea | src/main/ts/talks.ts | src/main/ts/talks.ts | class TalksCtrl{
constructor() {
const favoriteButtons = document.getElementsByClassName('mxt-img--favorite');
Array.from(favoriteButtons).forEach((favoriteButton: HTMLElement) => favoriteButton.onclick= this.favoriteToggle);
}
favoriteToggle(event) {
const img = event.srcElement;
const email = <HTMLInputElement> document.getElementById('email');
fetch(`/api/favorites/${email.value}/talks/${img.id.substr(9,img.id.length)}/toggle`, {method: 'post'})
.then(response => response.json())
.then((json: any) => {
const imgPath = json.selected ? 'mxt-favorite.svg' : 'mxt-favorite-non.svg';
img.src = `/images/svg/favorites/${imgPath}`;
});
}
}
window.addEventListener("load", () => new TalksCtrl()); | class TalksCtrl{
constructor() {
const favoriteButtons = document.getElementsByClassName('mxt-img--favorite');
Array.from(favoriteButtons).forEach((favoriteButton: HTMLElement) => favoriteButton.onclick= this.favoriteToggle);
}
favoriteToggle(event) {
const img = event.srcElement;
const email = <HTMLInputElement> document.getElementById('email');
event.stopPropagation();
fetch(`/api/favorites/${email.value}/talks/${img.id.substr(9,img.id.length)}/toggle`, {method: 'post'})
.then(response => response.json())
.then((json: any) => {
const imgPath = json.selected ? 'mxt-favorite.svg' : 'mxt-favorite-non.svg';
img.src = `/images/svg/favorites/${imgPath}`;
});
}
}
window.addEventListener("load", () => new TalksCtrl()); | Fix bug on propagation event on talk page | Fix bug on propagation event on talk page
| TypeScript | apache-2.0 | mixitconf/mixit,mix-it/mixit,mix-it/mixit,mixitconf/mixit,mix-it/mixit,mixitconf/mixit,mix-it/mixit,mixitconf/mixit,mix-it/mixit | ---
+++
@@ -1,12 +1,13 @@
class TalksCtrl{
constructor() {
const favoriteButtons = document.getElementsByClassName('mxt-img--favorite');
- Array.from(favoriteButtons).forEach((favoriteButton: HTMLElement) => favoriteButton.onclick= this.favoriteToggle);
+ Array.from(favoriteButtons).forEach((favoriteButton: HTMLElement) => favoriteButton.onclick= this.favoriteToggle);
}
favoriteToggle(event) {
const img = event.srcElement;
const email = <HTMLInputElement> document.getElementById('email');
+ event.stopPropagation();
fetch(`/api/favorites/${email.value}/talks/${img.id.substr(9,img.id.length)}/toggle`, {method: 'post'})
.then(response => response.json()) |
58014ce1b4fa0793ca38a11f235c7adccb05fa25 | src/extension/providers/source_code_action_provider.ts | src/extension/providers/source_code_action_provider.ts | import { CancellationToken, CodeAction, CodeActionContext, CodeActionKind, CodeActionProvider, CodeActionProviderMetadata, Range, TextDocument } from "vscode";
import { isAnalyzableAndInWorkspace } from "../utils";
const SourceSortMembers = CodeActionKind.Source.append("sortMembers");
export class SourceCodeActionProvider implements CodeActionProvider {
public readonly metadata: CodeActionProviderMetadata = {
providedCodeActionKinds: [CodeActionKind.SourceOrganizeImports, SourceSortMembers],
};
public provideCodeActions(document: TextDocument, range: Range, context: CodeActionContext, token: CancellationToken): CodeAction[] | undefined {
if (!isAnalyzableAndInWorkspace(document))
return undefined;
// If we were only asked for specific action types and that doesn't include
// source (which is all we supply), bail out.
if (context && context.only && !context.only.contains(CodeActionKind.Source))
return undefined;
return [{
command: {
arguments: [document],
command: "_dart.organizeImports",
title: "Organize Imports",
},
kind: CodeActionKind.SourceOrganizeImports,
title: "Organize Imports",
}, {
command: {
arguments: [document],
command: "dart.sortMembers",
title: "Sort Members",
},
kind: SourceSortMembers,
title: "Sort Members",
}];
}
}
| import { CancellationToken, CodeAction, CodeActionContext, CodeActionKind, CodeActionProvider, CodeActionProviderMetadata, Range, TextDocument } from "vscode";
import { isAnalyzableAndInWorkspace } from "../utils";
const SourceSortMembers = CodeActionKind.Source.append("sortMembers");
export class SourceCodeActionProvider implements CodeActionProvider {
public readonly metadata: CodeActionProviderMetadata = {
providedCodeActionKinds: [CodeActionKind.Source, CodeActionKind.SourceOrganizeImports, SourceSortMembers],
};
public provideCodeActions(document: TextDocument, range: Range, context: CodeActionContext, token: CancellationToken): CodeAction[] | undefined {
if (!isAnalyzableAndInWorkspace(document))
return undefined;
const actions = [];
if (!context
|| !context.only
|| context.only.contains(CodeActionKind.Source)
|| context.only.contains(CodeActionKind.SourceOrganizeImports)) {
actions.push({
command: {
arguments: [document],
command: "_dart.organizeImports",
title: "Organize Imports",
},
kind: CodeActionKind.SourceOrganizeImports,
title: "Organize Imports",
});
}
if (!context
|| !context.only
|| context.only.contains(CodeActionKind.Source)
|| context.only.contains(SourceSortMembers)) {
actions.push({
command: {
arguments: [document],
command: "dart.sortMembers",
title: "Sort Members",
},
kind: SourceSortMembers,
title: "Sort Members",
});
}
return actions;
}
}
| Fix advertising of source actions based on context.only | Fix advertising of source actions based on context.only
| TypeScript | mit | Dart-Code/Dart-Code,Dart-Code/Dart-Code,Dart-Code/Dart-Code,Dart-Code/Dart-Code,Dart-Code/Dart-Code | ---
+++
@@ -5,32 +5,45 @@
export class SourceCodeActionProvider implements CodeActionProvider {
public readonly metadata: CodeActionProviderMetadata = {
- providedCodeActionKinds: [CodeActionKind.SourceOrganizeImports, SourceSortMembers],
+ providedCodeActionKinds: [CodeActionKind.Source, CodeActionKind.SourceOrganizeImports, SourceSortMembers],
};
public provideCodeActions(document: TextDocument, range: Range, context: CodeActionContext, token: CancellationToken): CodeAction[] | undefined {
if (!isAnalyzableAndInWorkspace(document))
return undefined;
- // If we were only asked for specific action types and that doesn't include
- // source (which is all we supply), bail out.
- if (context && context.only && !context.only.contains(CodeActionKind.Source))
- return undefined;
- return [{
- command: {
- arguments: [document],
- command: "_dart.organizeImports",
+
+ const actions = [];
+
+ if (!context
+ || !context.only
+ || context.only.contains(CodeActionKind.Source)
+ || context.only.contains(CodeActionKind.SourceOrganizeImports)) {
+ actions.push({
+ command: {
+ arguments: [document],
+ command: "_dart.organizeImports",
+ title: "Organize Imports",
+ },
+ kind: CodeActionKind.SourceOrganizeImports,
title: "Organize Imports",
- },
- kind: CodeActionKind.SourceOrganizeImports,
- title: "Organize Imports",
- }, {
- command: {
- arguments: [document],
- command: "dart.sortMembers",
+ });
+ }
+
+ if (!context
+ || !context.only
+ || context.only.contains(CodeActionKind.Source)
+ || context.only.contains(SourceSortMembers)) {
+ actions.push({
+ command: {
+ arguments: [document],
+ command: "dart.sortMembers",
+ title: "Sort Members",
+ },
+ kind: SourceSortMembers,
title: "Sort Members",
- },
- kind: SourceSortMembers,
- title: "Sort Members",
- }];
+ });
+ }
+
+ return actions;
}
} |
0174bdd22a1a5ffba34f6f76b69323198cd0cee9 | src/app/store/map-layers/map-layers.reducer.spec.ts | src/app/store/map-layers/map-layers.reducer.spec.ts | /* tslint:disable:no-unused-variable */
/*!
* Map Layers Reducer Test
*
* Copyright(c) Exequiel Ceasar Navarrete <esnavarrete1@up.edu.ph>
* Licensed under MIT
*/
import { async, inject } from '@angular/core/testing';
import { MapLayersReducer } from './map-layers.reducer';
describe('NgRx Store Reducer: Map Layers', () => {
it('should create an instance', () => {
expect(MapLayersReducer).toBeTruthy();
});
});
| /* tslint:disable:no-unused-variable */
/*!
* Map Layers Reducer Test
*
* Copyright(c) Exequiel Ceasar Navarrete <esnavarrete1@up.edu.ph>
* Licensed under MIT
*/
import { async, inject } from '@angular/core/testing';
import { MapLayersReducer, LayerState } from './map-layers.reducer';
import { assign } from 'lodash';
describe('NgRx Store Reducer: Map Layers', () => {
const initialState: LayerState = {
ids: ['layer-1'],
layers: {
'layer-1': {
id: 'layer-1',
url: 'http://google.com.ph/',
type: 'dummy-layer',
layerOptions: {}
}
},
};
const blankState: LayerState = {
ids: [],
layers: {}
};
it('should create an instance', () => {
expect(MapLayersReducer).toBeTruthy();
});
it('should return the current state when invalid action is supplied', () => {
const actualState = MapLayersReducer(initialState, {
type: 'INVALID_ACTION',
payload: {
id: 'layer-2',
url: 'http://google.com.ph/',
type: 'dummy-layer',
layerOptions: {}
}
});
expect(actualState).toBe(initialState);
});
it('should add the new layer', () => {
const payload = {
id: 'layer-2',
url: 'http://google.com.ph/',
type: 'dummy-layer',
layerOptions: {}
};
const actualState = MapLayersReducer(initialState, {
type: 'ADD_LAYER',
payload
});
// check if layer-2 is in the array of ids
expect(actualState.ids).toContain('layer-2');
// check if layer-2 data is in the collection layer data
expect(actualState.layers).toEqual(jasmine.objectContaining({
'layer-2': payload
}));
});
it('should clear all layers', () => {
const payload = {
id: 'layer-2',
url: 'http://google.com.ph/',
type: 'dummy-layer',
layerOptions: {}
};
// add new layer
let currentState = MapLayersReducer(blankState, {
type: 'ADD_LAYER',
payload
});
// remove all layers from the store
currentState = MapLayersReducer(currentState, {
type: 'REMOVE_ALL_LAYERS'
});
// check if ids length is 0
expect(currentState.ids.length).toBe(0);
// check if layers collection is empty
expect(Object.keys(currentState.layers).length).toBe(0);
});
});
| Implement unit test for map layers reducer | Implement unit test for map layers reducer
| TypeScript | mit | ecsnavarretemit/sarai-ng2,ecsnavarretemit/sarai-ng2,ecsnavarretemit/sarai-interactive-maps,ecsnavarretemit/sarai-ng2,ecsnavarretemit/sarai-interactive-maps,ecsnavarretemit/sarai-interactive-maps | ---
+++
@@ -8,14 +8,94 @@
*/
import { async, inject } from '@angular/core/testing';
-import { MapLayersReducer } from './map-layers.reducer';
+import { MapLayersReducer, LayerState } from './map-layers.reducer';
+import { assign } from 'lodash';
describe('NgRx Store Reducer: Map Layers', () => {
+
+ const initialState: LayerState = {
+ ids: ['layer-1'],
+ layers: {
+ 'layer-1': {
+ id: 'layer-1',
+ url: 'http://google.com.ph/',
+ type: 'dummy-layer',
+ layerOptions: {}
+ }
+ },
+ };
+
+ const blankState: LayerState = {
+ ids: [],
+ layers: {}
+ };
it('should create an instance', () => {
expect(MapLayersReducer).toBeTruthy();
});
+ it('should return the current state when invalid action is supplied', () => {
+ const actualState = MapLayersReducer(initialState, {
+ type: 'INVALID_ACTION',
+ payload: {
+ id: 'layer-2',
+ url: 'http://google.com.ph/',
+ type: 'dummy-layer',
+ layerOptions: {}
+ }
+ });
+
+ expect(actualState).toBe(initialState);
+ });
+
+ it('should add the new layer', () => {
+ const payload = {
+ id: 'layer-2',
+ url: 'http://google.com.ph/',
+ type: 'dummy-layer',
+ layerOptions: {}
+ };
+
+ const actualState = MapLayersReducer(initialState, {
+ type: 'ADD_LAYER',
+ payload
+ });
+
+ // check if layer-2 is in the array of ids
+ expect(actualState.ids).toContain('layer-2');
+
+ // check if layer-2 data is in the collection layer data
+ expect(actualState.layers).toEqual(jasmine.objectContaining({
+ 'layer-2': payload
+ }));
+ });
+
+ it('should clear all layers', () => {
+ const payload = {
+ id: 'layer-2',
+ url: 'http://google.com.ph/',
+ type: 'dummy-layer',
+ layerOptions: {}
+ };
+
+ // add new layer
+ let currentState = MapLayersReducer(blankState, {
+ type: 'ADD_LAYER',
+ payload
+ });
+
+ // remove all layers from the store
+ currentState = MapLayersReducer(currentState, {
+ type: 'REMOVE_ALL_LAYERS'
+ });
+
+ // check if ids length is 0
+ expect(currentState.ids.length).toBe(0);
+
+ // check if layers collection is empty
+ expect(Object.keys(currentState.layers).length).toBe(0);
+ });
+
});
|
205ffb91715751a757ea08f2b46d616d74bd3446 | yamcs-web/packages/app/src/app/system/template/SystemPage.ts | yamcs-web/packages/app/src/app/system/template/SystemPage.ts | import { ChangeDetectionStrategy, Component } from '@angular/core';
import { Instance } from '@yamcs/client';
import { AuthService } from '../../core/services/AuthService';
import { YamcsService } from '../../core/services/YamcsService';
import { User } from '../../shared/User';
@Component({
templateUrl: './SystemPage.html',
styleUrls: ['./SystemPage.css'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class SystemPage {
instance: Instance;
user: User;
constructor(yamcs: YamcsService, authService: AuthService) {
this.instance = yamcs.getInstance();
this.user = authService.getUser()!;
}
showServicesItem() {
return this.user.hasSystemPrivilege('ControlServices');
}
showTablesItem() {
return this.user.hasSystemPrivilege('ReadTables');
}
showStreamsItem() {
return this.user.isSuperuser() || this.user.getSystemPrivileges().length > 0;
}
}
| import { ChangeDetectionStrategy, Component } from '@angular/core';
import { Instance } from '@yamcs/client';
import { AuthService } from '../../core/services/AuthService';
import { YamcsService } from '../../core/services/YamcsService';
import { User } from '../../shared/User';
@Component({
templateUrl: './SystemPage.html',
styleUrls: ['./SystemPage.css'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class SystemPage {
instance: Instance;
user: User;
constructor(yamcs: YamcsService, authService: AuthService) {
this.instance = yamcs.getInstance();
this.user = authService.getUser()!;
}
showServicesItem() {
return this.user.hasSystemPrivilege('ControlServices');
}
showTablesItem() {
return this.user.hasSystemPrivilege('ReadTables');
}
showStreamsItem() {
const objectPrivileges = this.user.getObjectPrivileges();
for (const priv of objectPrivileges) {
if (priv.type === 'Stream') {
return true;
}
}
return this.user.isSuperuser();
}
}
| Improve hiding of Streams page if insufficient privileges | Improve hiding of Streams page if insufficient privileges
| TypeScript | agpl-3.0 | fqqb/yamcs,yamcs/yamcs,m-sc/yamcs,fqqb/yamcs,yamcs/yamcs,fqqb/yamcs,m-sc/yamcs,yamcs/yamcs,yamcs/yamcs,m-sc/yamcs,m-sc/yamcs,fqqb/yamcs,fqqb/yamcs,fqqb/yamcs,m-sc/yamcs,m-sc/yamcs,yamcs/yamcs,yamcs/yamcs | ---
+++
@@ -28,6 +28,12 @@
}
showStreamsItem() {
- return this.user.isSuperuser() || this.user.getSystemPrivileges().length > 0;
+ const objectPrivileges = this.user.getObjectPrivileges();
+ for (const priv of objectPrivileges) {
+ if (priv.type === 'Stream') {
+ return true;
+ }
+ }
+ return this.user.isSuperuser();
}
} |
94b4f2ec874903ac3906df1cedf8de865640ac6b | packages/turf-length/index.ts | packages/turf-length/index.ts | import distance from '@turf/distance';
import { segmentReduce } from '@turf/meta';
import { Feature, FeatureCollection, LineString, MultiLineString, GeometryCollection, Units } from '@turf/helpers';
/**
* Takes a {@link GeoJSON} and measures its length in the specified units, {@link (Multi)Point}'s distance are ignored.
*
* @name length
* @param {Feature<LineString|MultiLineString>} geojson GeoJSON to measure
* @param {Object} [options={}] Optional parameters
* @param {string} [options.units=kilometers] can be degrees, radians, miles, or kilometers
* @returns {number} length of GeoJSON
* @example
* var line = turf.lineString([[115, -32], [131, -22], [143, -25], [150, -34]]);
* var length = turf.length(line, {units: 'miles'});
*
* //addToMap
* var addToMap = [line];
* line.properties.distance = length;
*/
export default function length(geojson: Feature<any> | FeatureCollection<any> | GeometryCollection, options: {
units?: Units
} = {}): number {
// Calculate distance from 2-vertex line segements
return segmentReduce(geojson, function (previousValue, segment) {
var coords = segment.geometry.coordinates;
return previousValue + distance(coords[0], coords[1], options);
}, 0);
}
| import distance from '@turf/distance';
import { segmentReduce } from '@turf/meta';
import { Feature, FeatureCollection, LineString, MultiLineString, GeometryCollection, Units } from '@turf/helpers';
/**
* Takes a {@link GeoJSON} and measures its length in the specified units, {@link (Multi)Point}'s distance are ignored.
*
* @name length
* @param {Feature<LineString|MultiLineString>} geojson GeoJSON to measure
* @param {Object} [options={}] Optional parameters
* @param {string} [options.units=kilometers] can be degrees, radians, miles, or kilometers
* @returns {number} length of GeoJSON
* @example
* var line = turf.lineString([[115, -32], [131, -22], [143, -25], [150, -34]]);
* var length = turf.length(line, {units: 'miles'});
*
* //addToMap
* var addToMap = [line];
* line.properties.distance = length;
*/
export default function length(geojson: Feature<any> | FeatureCollection<any> | GeometryCollection, options: {
units?: Units
} = {}): number {
// Calculate distance from 2-vertex line segments
return segmentReduce(geojson, (previousValue, segment) => {
const coords = segment!.geometry.coordinates;
return previousValue! + distance(coords[0], coords[1], options);
}, 0);
}
| Refactor length-function for TypeScript strict mode and some other minor enhancements. | Refactor length-function for TypeScript strict mode and some other minor enhancements.
| TypeScript | mit | dpmcmlxxvi/turf,tilemapjp/turf,dpmcmlxxvi/turf,dpmcmlxxvi/turf,tilemapjp/turf,Turfjs/turf,tilemapjp/turf,Turfjs/turf,Turfjs/turf | ---
+++
@@ -21,9 +21,9 @@
export default function length(geojson: Feature<any> | FeatureCollection<any> | GeometryCollection, options: {
units?: Units
} = {}): number {
- // Calculate distance from 2-vertex line segements
- return segmentReduce(geojson, function (previousValue, segment) {
- var coords = segment.geometry.coordinates;
- return previousValue + distance(coords[0], coords[1], options);
+ // Calculate distance from 2-vertex line segments
+ return segmentReduce(geojson, (previousValue, segment) => {
+ const coords = segment!.geometry.coordinates;
+ return previousValue! + distance(coords[0], coords[1], options);
}, 0);
} |
4880f50d11566b6d58e820e39b0708f291d6d33f | src/SyntaxNodes/LineBlockNode.ts | src/SyntaxNodes/LineBlockNode.ts | import { InlineSyntaxNode } from './InlineSyntaxNode'
import { OutlineSyntaxNode } from './OutlineSyntaxNode'
export class LineBlockNode implements OutlineSyntaxNode {
constructor(public lines: LineBlockNode.Line[]) { }
OUTLINE_SYNTAX_NODE(): void { }
}
export module LineBlockNode {
export class Line {
constructor(public children: InlineSyntaxNode[]) { }
protected LINE_BLOCK_LINE(): void { }
}
} | import { InlineSyntaxNode } from './InlineSyntaxNode'
import { OutlineSyntaxNode } from './OutlineSyntaxNode'
import { InlineSyntaxNodeContainer } from './InlineSyntaxNodeContainer'
export class LineBlockNode implements OutlineSyntaxNode {
constructor(public lines: LineBlockNode.Line[]) { }
OUTLINE_SYNTAX_NODE(): void { }
}
export module LineBlockNode {
export class Line implements InlineSyntaxNodeContainer {
constructor(public children: InlineSyntaxNode[]) { }
protected LINE_BLOCK_LINE(): void { }
}
} | Make line explicitly impl. inline container | Make line explicitly impl. inline container
| TypeScript | mit | start/up,start/up | ---
+++
@@ -1,5 +1,6 @@
import { InlineSyntaxNode } from './InlineSyntaxNode'
import { OutlineSyntaxNode } from './OutlineSyntaxNode'
+import { InlineSyntaxNodeContainer } from './InlineSyntaxNodeContainer'
export class LineBlockNode implements OutlineSyntaxNode {
@@ -10,7 +11,7 @@
export module LineBlockNode {
- export class Line {
+ export class Line implements InlineSyntaxNodeContainer {
constructor(public children: InlineSyntaxNode[]) { }
protected LINE_BLOCK_LINE(): void { } |
03aeef911ff3b195c65c64e0ebf6bf493f8c45f8 | ravenjs/ravenjs-tests.ts | ravenjs/ravenjs-tests.ts | /// <reference path="ravenjs.d.ts" />
var options: RavenOptions = {
logger: 'my-logger',
ignoreUrls: [
/graph\.facebook\.com/i
],
ignoreErrors: [
'fb_xd_fragment'
],
includePaths: [
/https?:\/\/(www\.)?getsentry\.com/,
/https?:\/\/d3nslu0hdya83q\.cloudfront\.net/
]
};
Raven.config('https://public@getsentry.com/1', options).install();
var throwsError = () => {
throw new Error('broken');
};
try {
throwsError();
} catch(e) {
Raven.captureException(e);
Raven.captureException(e, {tags: { key: "value" }});
}
Raven.context(throwsError);
Raven.context({tags: { key: "value" }}, throwsError);
setTimeout(Raven.wrap(throwsError), 1000);
Raven.wrap({logger: "my.module"}, throwsError)();
Raven.setUser({
email: 'matt@example.com',
id: '123'
});
Raven.captureMessage('Broken!');
Raven.captureMessage('Broken!', {tags: { key: "value" }});
| /// <reference path="ravenjs.d.ts" />
var options: RavenOptions = {
logger: 'my-logger',
ignoreUrls: [
/graph\.facebook\.com/i
],
ignoreErrors: [
'fb_xd_fragment'
],
includePaths: [
/https?:\/\/(www\.)?getsentry\.com/,
/https?:\/\/d3nslu0hdya83q\.cloudfront\.net/
]
};
Raven.config('https://public@getsentry.com/1', options).install();
var throwsError = () => {
throw new Error('broken');
};
try {
throwsError();
} catch(e) {
Raven.captureException(e);
Raven.captureException(e, {tags: { key: "value" }});
}
Raven.context(throwsError);
Raven.context({tags: { key: "value" }}, throwsError);
setTimeout(Raven.wrap(throwsError), 1000);
Raven.wrap({logger: "my.module"}, throwsError)();
Raven.setUserContext({
email: 'matt@example.com',
id: '123'
});
Raven.captureMessage('Broken!');
Raven.captureMessage('Broken!', {tags: { key: "value" }});
| Update ravenjs tests to reflect new API | test: Update ravenjs tests to reflect new API | TypeScript | mit | shlomiassaf/DefinitelyTyped,daptiv/DefinitelyTyped,zuzusik/DefinitelyTyped,Litee/DefinitelyTyped,stephenjelfs/DefinitelyTyped,EnableSoftware/DefinitelyTyped,nycdotnet/DefinitelyTyped,wilfrem/DefinitelyTyped,nobuoka/DefinitelyTyped,abbasmhd/DefinitelyTyped,rolandzwaga/DefinitelyTyped,HPFOD/DefinitelyTyped,Litee/DefinitelyTyped,one-pieces/DefinitelyTyped,greglo/DefinitelyTyped,psnider/DefinitelyTyped,newclear/DefinitelyTyped,MugeSo/DefinitelyTyped,psnider/DefinitelyTyped,borisyankov/DefinitelyTyped,QuatroCode/DefinitelyTyped,subash-a/DefinitelyTyped,stephenjelfs/DefinitelyTyped,Ptival/DefinitelyTyped,mcrawshaw/DefinitelyTyped,AgentME/DefinitelyTyped,slavomirvojacek/adbrain-typescript-definitions,jimthedev/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,xStrom/DefinitelyTyped,amanmahajan7/DefinitelyTyped,Zzzen/DefinitelyTyped,abner/DefinitelyTyped,smrq/DefinitelyTyped,raijinsetsu/DefinitelyTyped,Dashlane/DefinitelyTyped,slavomirvojacek/adbrain-typescript-definitions,alvarorahul/DefinitelyTyped,paulmorphy/DefinitelyTyped,nfriend/DefinitelyTyped,nobuoka/DefinitelyTyped,mcliment/DefinitelyTyped,progre/DefinitelyTyped,benishouga/DefinitelyTyped,flyfishMT/DefinitelyTyped,micurs/DefinitelyTyped,damianog/DefinitelyTyped,amir-arad/DefinitelyTyped,gcastre/DefinitelyTyped,martinduparc/DefinitelyTyped,zuzusik/DefinitelyTyped,sledorze/DefinitelyTyped,tan9/DefinitelyTyped,flyfishMT/DefinitelyTyped,rcchen/DefinitelyTyped,martinduparc/DefinitelyTyped,Softpagehomeware/DefinitelyTyped,abbasmhd/DefinitelyTyped,rolandzwaga/DefinitelyTyped,markogresak/DefinitelyTyped,arma-gast/DefinitelyTyped,ryan10132/DefinitelyTyped,YousefED/DefinitelyTyped,yuit/DefinitelyTyped,frogcjn/DefinitelyTyped,trystanclarke/DefinitelyTyped,reppners/DefinitelyTyped,amanmahajan7/DefinitelyTyped,YousefED/DefinitelyTyped,sclausen/DefinitelyTyped,xStrom/DefinitelyTyped,dsebastien/DefinitelyTyped,musicist288/DefinitelyTyped,georgemarshall/DefinitelyTyped,mhegazy/DefinitelyTyped,martinduparc/DefinitelyTyped,schmuli/DefinitelyTyped,newclear/DefinitelyTyped,DzmitryDulko/DefinitelyTyped,yuit/DefinitelyTyped,nitintutlani/DefinitelyTyped,reppners/DefinitelyTyped,nakakura/DefinitelyTyped,danfma/DefinitelyTyped,mattblang/DefinitelyTyped,AgentME/DefinitelyTyped,alextkachman/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,greglo/DefinitelyTyped,eugenpodaru/DefinitelyTyped,trystanclarke/DefinitelyTyped,nakakura/DefinitelyTyped,Softpagehomeware/DefinitelyTyped,mareek/DefinitelyTyped,donnut/DefinitelyTyped,laurentiustamate94/DefinitelyTyped,ryan-codingintrigue/DefinitelyTyped,MugeSo/DefinitelyTyped,slavomirvojacek/DefinitelyTyped,Dashlane/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,DzmitryDulko/DefinitelyTyped,mareek/DefinitelyTyped,minodisk/DefinitelyTyped,vagarenko/DefinitelyTyped,mhegazy/DefinitelyTyped,philippstucki/DefinitelyTyped,alextkachman/DefinitelyTyped,gandjustas/DefinitelyTyped,aciccarello/DefinitelyTyped,pocesar/DefinitelyTyped,chrismbarr/DefinitelyTyped,sledorze/DefinitelyTyped,nitintutlani/DefinitelyTyped,johan-gorter/DefinitelyTyped,psnider/DefinitelyTyped,alvarorahul/DefinitelyTyped,shlomiassaf/DefinitelyTyped,subash-a/DefinitelyTyped,AgentME/DefinitelyTyped,scriby/DefinitelyTyped,frogcjn/DefinitelyTyped,arusakov/DefinitelyTyped,gcastre/DefinitelyTyped,Penryn/DefinitelyTyped,stacktracejs/DefinitelyTyped,georgemarshall/DefinitelyTyped,Pro/DefinitelyTyped,benishouga/DefinitelyTyped,jraymakers/DefinitelyTyped,jraymakers/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,OpenMaths/DefinitelyTyped,progre/DefinitelyTyped,Pro/DefinitelyTyped,nainslie/DefinitelyTyped,emanuelhp/DefinitelyTyped,mcrawshaw/DefinitelyTyped,syuilo/DefinitelyTyped,pocesar/DefinitelyTyped,hellopao/DefinitelyTyped,ashwinr/DefinitelyTyped,philippstucki/DefinitelyTyped,georgemarshall/DefinitelyTyped,damianog/DefinitelyTyped,magny/DefinitelyTyped,QuatroCode/DefinitelyTyped,chrootsu/DefinitelyTyped,GiedriusGrabauskas/DefinitelyTyped,schmuli/DefinitelyTyped,magny/DefinitelyTyped,scriby/DefinitelyTyped,florentpoujol/DefinitelyTyped,alexdresko/DefinitelyTyped,EnableSoftware/DefinitelyTyped,Penryn/DefinitelyTyped,smrq/DefinitelyTyped,gandjustas/DefinitelyTyped,arma-gast/DefinitelyTyped,isman-usoh/DefinitelyTyped,CodeZombieCH/DefinitelyTyped,ashwinr/DefinitelyTyped,georgemarshall/DefinitelyTyped,hellopao/DefinitelyTyped,pwelter34/DefinitelyTyped,pwelter34/DefinitelyTyped,arusakov/DefinitelyTyped,aciccarello/DefinitelyTyped,chrismbarr/DefinitelyTyped,OpenMaths/DefinitelyTyped,johan-gorter/DefinitelyTyped,abner/DefinitelyTyped,raijinsetsu/DefinitelyTyped,Ptival/DefinitelyTyped,slavomirvojacek/DefinitelyTyped,alexdresko/DefinitelyTyped,paulmorphy/DefinitelyTyped,minodisk/DefinitelyTyped,jimthedev/DefinitelyTyped,chrootsu/DefinitelyTyped,dsebastien/DefinitelyTyped,jimthedev/DefinitelyTyped,isman-usoh/DefinitelyTyped,stacktracejs/DefinitelyTyped,rcchen/DefinitelyTyped,UzEE/DefinitelyTyped,mattblang/DefinitelyTyped,aciccarello/DefinitelyTyped,schmuli/DefinitelyTyped,behzad888/DefinitelyTyped,hellopao/DefinitelyTyped,zuzusik/DefinitelyTyped,UzEE/DefinitelyTyped,nycdotnet/DefinitelyTyped,axelcostaspena/DefinitelyTyped,benishouga/DefinitelyTyped,pocesar/DefinitelyTyped,sclausen/DefinitelyTyped,florentpoujol/DefinitelyTyped,borisyankov/DefinitelyTyped,emanuelhp/DefinitelyTyped,syuilo/DefinitelyTyped,behzad888/DefinitelyTyped,nainslie/DefinitelyTyped,vagarenko/DefinitelyTyped,AgentME/DefinitelyTyped,HPFOD/DefinitelyTyped,danfma/DefinitelyTyped,use-strict/DefinitelyTyped,donnut/DefinitelyTyped,Zzzen/DefinitelyTyped,tan9/DefinitelyTyped,chbrown/DefinitelyTyped,wilfrem/DefinitelyTyped,CodeZombieCH/DefinitelyTyped,benliddicott/DefinitelyTyped,use-strict/DefinitelyTyped,arusakov/DefinitelyTyped | ---
+++
@@ -33,7 +33,7 @@
setTimeout(Raven.wrap(throwsError), 1000);
Raven.wrap({logger: "my.module"}, throwsError)();
-Raven.setUser({
+Raven.setUserContext({
email: 'matt@example.com',
id: '123'
}); |
c67fb558bd62123ca6add635884e349469e0a999 | src/Test/Ast/OrderedListStart.ts | src/Test/Ast/OrderedListStart.ts |
import { expect } from 'chai'
import * as Up from '../../index'
import { OrderedListNode } from '../../SyntaxNodes/OrderedListNode'
function listStart(text: string): number {
const list = <OrderedListNode>Up.toAst(text).children[0]
return list.start()
}
describe('An ordered list that does not start with a numeral bullet', () => {
it('does not have an explicit starting ordinal', () => {
const text =
`
#. Hello, world!
# Goodbye, world!
#) Goodbye, world!`
expect(listStart(text)).to.be.eql(null)
})
it('does not have an explicit starting ordinal even if the second list item has a numeral bullet', () => {
const text =
`
#. Hello, world!
5 Goodbye, world!
#) Goodbye, world!`
expect(listStart(text)).to.be.eql(null)
})
})
describe('An ordered list that starts with a numeral bullet', () => {
it('has an explicit starting ordinal equal to the numeral value', () => {
const text =
`
10) Hello, world!
#. Goodbye, world!
#) Goodbye, world!`
expect(listStart(text)).to.be.eql(10)
})
})
|
import { expect } from 'chai'
import * as Up from '../../index'
import { OrderedListNode } from '../../SyntaxNodes/OrderedListNode'
function listStart(text: string): number {
const list = <OrderedListNode>Up.toAst(text).children[0]
return list.start()
}
describe('An ordered list that does not start with a numeral bullet', () => {
it('does not have an explicit starting ordinal', () => {
const text =
`
#. Hello, world!
# Goodbye, world!
#) Goodbye, world!`
expect(listStart(text)).to.be.eql(null)
})
it('does not have an explicit starting ordinal even if the second list item has a numeral bullet', () => {
const text =
`
#. Hello, world!
5) Goodbye, world!
#) Goodbye, world!`
expect(listStart(text)).to.be.eql(null)
})
})
describe('An ordered list that starts with a numeral bullet', () => {
it('has an explicit starting ordinal equal to the numeral value', () => {
const text =
`
10) Hello, world!
#. Goodbye, world!
#) Goodbye, world!`
expect(listStart(text)).to.be.eql(10)
})
})
| Fix ordered list start ordinal test | Fix ordered list start ordinal test
| TypeScript | mit | start/up,start/up | ---
+++
@@ -23,7 +23,7 @@
const text =
`
#. Hello, world!
-5 Goodbye, world!
+5) Goodbye, world!
#) Goodbye, world!`
expect(listStart(text)).to.be.eql(null)
}) |
44f89cd16229f0e8c8818f79a8c102f826ee6f5d | src/components/clickerButton/clickerButton.spec.ts | src/components/clickerButton/clickerButton.spec.ts | import { ComponentFixture, async } from '@angular/core/testing';
import { TestUtils } from '../../test-utils';
import { ClickerButton } from './clickerButton';
import { ClickerMock } from '../../models/clicker.mock';
let fixture: ComponentFixture<ClickerButton> = null;
let instance: any = null;
describe('ClickerButton', () => {
beforeEach(async(() => TestUtils.beforeEachCompiler([ClickerButton]).then(compiled => {
fixture = compiled.fixture;
instance = compiled.instance;
instance.clicker = new ClickerMock();
fixture.detectChanges();
})));
afterEach(() => {
fixture.destroy();
});
it('initialises', () => {
expect(instance).not.toBeNull();
});
it('displays the clicker name and count', () => {
fixture.detectChanges();
expect(fixture.nativeElement.querySelectorAll('.button-inner')[0].innerHTML).toEqual('TEST CLICKER (10)');
});
it('does a click', () => {
fixture.detectChanges();
spyOn(instance['clickerService'], 'doClick');
TestUtils.eventFire(fixture.nativeElement.querySelectorAll('button')[0], 'click');
expect(instance['clickerService'].doClick).toHaveBeenCalled();
});
});
| import { ComponentFixture, async } from '@angular/core/testing';
import { TestUtils } from '../../test-utils';
import { ClickerButton } from './clickerButton';
import { ClickerMock } from '../../models/clicker.mock';
let fixture: ComponentFixture<ClickerButton> = null;
let instance: any = null;
describe('ClickerButton', () => {
beforeEach(async(() => TestUtils.beforeEachCompiler([ClickerButton]).then(compiled => {
fixture = compiled.fixture;
instance = compiled.instance;
instance.clicker = new ClickerMock();
fixture.detectChanges();
})));
afterEach(() => {
fixture.destroy();
});
it('initialises', () => {
expect(instance).not.toBeNull();
});
it('displays the clicker name and count', () => {
fixture.detectChanges();
expect(fixture.nativeElement.querySelectorAll('.button-inner')[0].innerHTML).toEqual('TEST CLICKER (10)');
});
it('does a click', async(() => {
spyOn(instance['clickerService'], 'doClick');
let button: any = fixture.debugElement.nativeElement.querySelector('button');
button.click();
fixture.whenStable().then(() => {
expect(instance['clickerService'].doClick).toHaveBeenCalled();
});
}));
});
| Revert "reverting to old style, using async didn't achieve anything" | Revert "reverting to old style, using async didn't achieve anything"
This reverts commit 094bc82f0ba5cdbc590372190bf6ddd1746fa9f6.
| TypeScript | mit | lathonez/clicker,lathonez/clicker,orthodoc/jointdb,lathonez/clicker,orthodoc/jointdb,orthodoc/jointdb | ---
+++
@@ -28,10 +28,13 @@
expect(fixture.nativeElement.querySelectorAll('.button-inner')[0].innerHTML).toEqual('TEST CLICKER (10)');
});
- it('does a click', () => {
- fixture.detectChanges();
+ it('does a click', async(() => {
spyOn(instance['clickerService'], 'doClick');
- TestUtils.eventFire(fixture.nativeElement.querySelectorAll('button')[0], 'click');
- expect(instance['clickerService'].doClick).toHaveBeenCalled();
- });
+ let button: any = fixture.debugElement.nativeElement.querySelector('button');
+ button.click();
+
+ fixture.whenStable().then(() => {
+ expect(instance['clickerService'].doClick).toHaveBeenCalled();
+ });
+ }));
}); |
f9cce11d86789416c0760e04f071e56b1ba65b25 | app/src/component/CreateItem.tsx | app/src/component/CreateItem.tsx | import * as React from "react";
import Plus = require("react-icons/lib/md/add");
import "./style/CreateItem.css";
interface IProps {
createItem: () => void;
}
interface IState {
creatingItem: boolean;
}
export default class extends React.Component<IProps, IState> {
public state: IState = { creatingItem: false };
public render() {
const { children, createItem } = this.props;
if (this.state.creatingItem) {
return (
<div className="CreateItem-form-container">
<form
className="CreateItem-form"
onSubmit={(event) => {
createItem();
this.setState({ creatingItem: false });
event.preventDefault();
}}
onReset={(event) => {
this.setState({ creatingItem: false });
event.preventDefault();
}}
>
{children}
</form>
</div>
);
}
return (
<div className="CreateItem-plus-button-container">
<button
className="CreateItem-plus-button"
onClick={() => this.setState({ creatingItem: true })}
>
<Plus />
</button>
</div>
);
}
}
| import * as React from "react";
import Plus = require("react-icons/lib/md/add");
import "./style/CreateItem.css";
interface IProps {
createItem: () => void;
}
interface IState {
creatingItem: boolean;
}
export default class extends React.Component<IProps, IState> {
public state: IState = { creatingItem: false };
public render() {
const { children, createItem } = this.props;
if (this.state.creatingItem) {
return (
<div
className="CreateItem-form-container"
onClick={() => this.setState({ creatingItem: false })}
>
<form
className="CreateItem-form"
onClick={(event) => event.stopPropagation()}
onSubmit={(event) => {
createItem();
this.setState({ creatingItem: false });
event.preventDefault();
}}
onReset={(event) => {
this.setState({ creatingItem: false });
event.preventDefault();
}}
>
{children}
</form>
</div>
);
}
return (
<div className="CreateItem-plus-button-container">
<button
className="CreateItem-plus-button"
onClick={() => this.setState({ creatingItem: true })}
>
<Plus />
</button>
</div>
);
}
}
| Stop creating item on blur | Stop creating item on blur
| TypeScript | mit | raviqqe/code2d,raviqqe/code2d,raviqqe/code2d,raviqqe/code2d | ---
+++
@@ -19,9 +19,13 @@
if (this.state.creatingItem) {
return (
- <div className="CreateItem-form-container">
+ <div
+ className="CreateItem-form-container"
+ onClick={() => this.setState({ creatingItem: false })}
+ >
<form
className="CreateItem-form"
+ onClick={(event) => event.stopPropagation()}
onSubmit={(event) => {
createItem();
this.setState({ creatingItem: false }); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.