commit
stringlengths 40
40
| subject
stringlengths 1
3.25k
| old_file
stringlengths 4
311
| new_file
stringlengths 4
311
| old_contents
stringlengths 0
26.3k
| lang
stringclasses 3
values | proba
float64 0
1
| diff
stringlengths 0
7.82k
|
---|---|---|---|---|---|---|---|
394a06a01491cbaffb65eca8b53eb5ecd373902f
|
use `translate3d` on browsers other than IE
|
src/js/mixin/internal/slideshow-animations.js
|
src/js/mixin/internal/slideshow-animations.js
|
import {css} from 'uikit-util';
export default {
slide: {
show(dir) {
return [
{transform: translate(dir * -100)},
{transform: translate()}
];
},
percent(current) {
return translated(current);
},
translate(percent, dir) {
return [
{transform: translate(dir * -100 * percent)},
{transform: translate(dir * 100 * (1 - percent))}
];
}
}
};
export function translated(el) {
return Math.abs(css(el, 'transform').split(',')[4] / el.offsetWidth) || 0;
}
export function translate(value = 0, unit = '%') {
return `translateX(${value}${value ? unit : ''})`; // currently not translate3d to support IE, translate3d within translate3d does not work while transitioning
}
export function scale3d(value) {
return `scale3d(${value}, ${value}, 1)`;
}
|
JavaScript
| 0 |
@@ -4,16 +4,22 @@
ort %7Bcss
+, isIE
%7D from '
@@ -698,55 +698,106 @@
-return %60translateX($%7Bvalue%7D$%7Bvalue ? unit : ''%7D
+value += value ? unit : '';%0A return isIE ? %60translateX($%7Bvalue%7D)%60 : %60translate3d($%7Bvalue%7D, 0, 0
)%60;
@@ -829,18 +829,10 @@
e3d
-to support
+in
IE,
|
2febd299ca7a656cd9d1dd9b313abe7d462426a2
|
Add TODO
|
windows/lib/WinPlatform.js
|
windows/lib/WinPlatform.js
|
// Copyright © 2014 Intel Corporation. All rights reserved.
// Use of this source code is governed by an Apache v2
// license that can be found in the LICENSE-APACHE-V2 file.
var Path = require("path");
var ShellJS = require("shelljs");
var WixSDK = require("./WixSDK");
/**
* Interface for project implementations.
* @constructor
* @param {Function} PlatformBase Base class constructor {@link PlatformBase}
* @param {PlatformData} platformData Init data passed to the platform
* @protected
*/
function WinPlatform(PlatformBase, baseData) {
// Create base instance.
var instance = new PlatformBase(baseData);
// Override manually, because Object.extend() is not yet available on node.
var names = Object.getOwnPropertyNames(WinPlatform.prototype);
for (var i = 0; i < names.length; i++) {
var key = names[i];
if (key != "constructor") {
instance[key] = WinPlatform.prototype[key];
}
}
return instance;
}
/**
* Custom command line arguments.
* @static
*/
WinPlatform.getArgs = function() {
return {
create: { // Extra options for command "create"
crosswalk: "\t\t\tPath to crosswalk zip"
}/*,
update: { // Extra options for command "update"
baz: "Another option added by the backend"
}*/
};
};
/**
* Implements {@link PlatformBase.create}
*/
WinPlatform.prototype.create =
function(packageId, args, callback) {
// Namespace util
var util = this.application.util;
var output = this.output;
var crosswalkPath = args.crosswalk;
if (!crosswalkPath) {
callback("Use --windows-crosswalk=<path> to pass crosswalk zip");
return;
} else if (!ShellJS.test("-f", crosswalkPath)) {
callback("Crosswalk zip could not be found: " + crosswalkPath);
return;
}
var zip = new util.CrosswalkZip(crosswalkPath);
zip.extractEntryTo(zip.root, this.platformPath);
if (!ShellJS.test("-d", this.platformPath)) {
callback("Failed to extract crosswalk zip");
return;
}
output.info("Successfully imported " + crosswalkPath);
// Null means success, error string means failure.
callback(null);
};
/**
* Implements {@link PlatformBase.update}
*/
WinPlatform.prototype.update =
function(versionSpec, args, callback) {
// TODO implement updating of project to new Crosswalk version.
// This function is not supported yet.
this.output.log("WinPlatform: TODO Updating project\n");
// Null means success, error string means failure.
callback(null);
};
WinPlatform.prototype.refresh =
function(callback) {
// TODO implement updating of project to new Crosswalk version.
// Maybe this function will be not needed, and removed in the future.
this.output.log("WinPlatform: TODO Refreshing project\n");
// Null means success, error string means failure.
callback(null);
};
/**
* Implements {@link PlatformBase.build}
*/
WinPlatform.prototype.build =
function(configId, args, callback) {
var manifest = this.application.manifest;
// WiX wants 4 component version numbers, so append as many ".0" as needed.
// Manifest versions are restricted to 4 parts max.
var nComponents = manifest.appVersion.split(".").length;
var versionPadding = new Array(4 - nComponents + 1).join(".0");
var sdk = new WixSDK(this.output);
sdk.generateMSI(this.appPath, this.platformPath, {
app_name: manifest.name,
upgrade_id: manifest.windowsUpdateId,
manufacturer: manifest.windowsVendor,
version: manifest.appVersion + versionPadding,
is_64_bit: true,
icon: Path.join(this.appPath, "crosswalk.ico"),
product: manifest.packageId
//extensions: 'tests/extension/echo_extension'
});
// Null means success, error string means failure.
callback(null);
};
module.exports = WinPlatform;
|
JavaScript
| 0 |
@@ -3578,22 +3578,57 @@
est.
-windowsVendor,
+packageId, // TODO use first 2 parts of packageId
%0A
|
72c7f1c9c3bd14e3b5e3c81c9b586ba1cdade85e
|
Refactor streaming into two methods.
|
Controller/middleware/documents/stream.js
|
Controller/middleware/documents/stream.js
|
// __Dependencies__
var es = require('event-stream');
var JSONStream = require('JSONStream');
// __Module Definition__
var decorator = module.exports = function () {
this.documents(function (request, response, next) {
var pipes = [];
request.baucis.pipe = function (destination) {
if (destination !== undefined) return pipes.push(destination);
pipes.unshift(request.baucis.query.stream());
pipes.push(response);
var stream = es.pipeline.apply(es, pipes);
stream.on('error', next);
};
next();
});
};
|
JavaScript
| 0 |
@@ -97,92 +97,131 @@
/ __
-Module Definition__%0Avar decorator = module.exports = function () %7B%0A this.doc
+Private Module Members__%0A// Genereate a function that will add pipes to an array. Then, when called%0A// with no arg
uments
-(
+,%0A
func
@@ -229,38 +229,43 @@
ion
-(request, response, next
+pipeInterface (source, finalize
) %7B%0A
-
va
@@ -284,31 +284,14 @@
;%0A
- request.baucis.pipe =
+return
fun
@@ -312,18 +312,16 @@
tion) %7B%0A
-
if (
@@ -379,26 +379,24 @@
ation);%0A
-
pipes.unshif
@@ -401,42 +401,19 @@
ift(
-request.baucis.query.stream
+source
());%0A
-
@@ -427,21 +427,19 @@
ush(
-respons
+finaliz
e);%0A
-
@@ -485,18 +485,16 @@
s);%0A
-
stream.o
@@ -513,19 +513,406 @@
ext);%0A
- %7D
+%7D;%0A%7D%0A%0A// __Module Definition__%0Avar decorator = module.exports = function () %7B%0A // Middleware to create functions for adding pipes for query and response streams.%0A this.documents(function (request, response, next) %7B%0A request.baucis.outgoing = pipeInterface(request.baucis.query.stream.bind(request.baucis.query), response);%0A request.baucis.incoming = pipeInterface(request, response)
;%0A ne
|
1c231dd301c48c579250097f219dff382b98ad32
|
Fix websocket reconnect bug.
|
web/plates/js/status.js
|
web/plates/js/status.js
|
angular.module('appControllers').controller('StatusCtrl', StatusCtrl); // get the main module contollers set
StatusCtrl.$inject = ['$rootScope', '$scope', '$state', '$http', '$interval']; // Inject my dependencies
// create our controller function with all necessary logic
function StatusCtrl($rootScope, $scope, $state, $http, $interval) {
$scope.$parent.helppage = 'plates/status-help.html';
function connect($scope) {
if (($scope === undefined) || ($scope === null))
return; // we are getting called once after clicking away from the status page
if (($scope.socket === undefined) || ($scope.socket === null)) {
socket = new WebSocket(URL_STATUS_WS);
$scope.socket = socket; // store socket in scope for enter/exit usage
}
$scope.ConnectState = "Disconnected";
socket.onopen = function (msg) {
// $scope.ConnectStyle = "label-success";
$scope.ConnectState = "Connected";
};
socket.onclose = function (msg) {
// $scope.ConnectStyle = "label-danger";
$scope.ConnectState = "Disconnected";
$scope.$apply();
setTimeout(connect, 1000);
};
socket.onerror = function (msg) {
// $scope.ConnectStyle = "label-danger";
$scope.ConnectState = "Error";
$scope.$apply();
};
socket.onmessage = function (msg) {
console.log('Received status update.')
var status = JSON.parse(msg.data)
// Update Status
$scope.Version = status.Version;
$scope.Devices = status.Devices;
$scope.Connected_Users = status.Connected_Users;
$scope.UAT_messages_last_minute = status.UAT_messages_last_minute;
// $scope.UAT_products_last_minute = JSON.stringify(status.UAT_products_last_minute);
$scope.UAT_messages_max = status.UAT_messages_max;
$scope.ES_messages_last_minute = status.ES_messages_last_minute;
$scope.ES_messages_max = status.ES_messages_max;
$scope.GPS_satellites_locked = status.GPS_satellites_locked;
$scope.GPS_solution = status.GPS_solution;
$scope.RY835AI_connected = status.RY835AI_connected;
var uptime = status.Uptime;
if (uptime != undefined) {
var up_s = parseInt((uptime / 1000) % 60),
up_m = parseInt((uptime / (1000 * 60)) % 60),
up_h = parseInt((uptime / (1000 * 60 * 60)) % 24);
$scope.Uptime = String(((up_h < 10) ? "0" + up_h : up_h) + "h" + ((up_m < 10) ? "0" + up_m : up_m) + "m" + ((up_s < 10) ? "0" + up_s : up_s) + "s");
} else {
// $('#Uptime').text('unavailable');
}
var boardtemp = status.CPUTemp;
if (boardtemp != undefined) {
/* boardtemp is celcius to tenths */
$scope.CPUTemp = String(boardtemp.toFixed(1) + 'C / ' + ((boardtemp * 9 / 5) + 32.0).toFixed(1) + 'F');
} else {
// $('#CPUTemp').text('unavailable');
}
$scope.$apply(); // trigger any needed refreshing of data
};
}
function setHardwareVisibility() {
$scope.visible_uat = true;
$scope.visible_es = true;
$scope.visible_gps = true;
$scope.visible_ahrs = true;
// Simple GET request example (note: responce is asynchronous)
$http.get(URL_SETTINGS_GET).
then(function (response) {
settings = angular.fromJson(response.data);
$scope.visible_uat = settings.UAT_Enabled;
$scope.visible_es = settings.ES_Enabled;
$scope.visible_gps = settings.GPS_Enabled;
$scope.visible_ahrs = settings.AHRS_Enabled;
}, function (response) {
// nop
});
};
function getTowers() {
// Simple GET request example (note: responce is asynchronous)
$http.get(URL_TOWERS_GET).
then(function (response) {
var towers = angular.fromJson(response.data);
var cnt = 0;
for (var key in towers) {
if (towers[key].Messages_last_minute > 0) {
cnt++;
}
}
$scope.UAT_Towers = cnt;
// $scope.$apply();
}, function (response) {
$scope.raw_data = "error getting tower data";
});
};
// periodically get the tower list
var updateTowers = $interval(function () {
// refresh tower count once each 5 seconds (aka polling)
getTowers();
}, (5 * 1000), 0, false);
$state.get('home').onEnter = function () {
// everything gets handled correctly by the controller
};
$state.get('home').onExit = function () {
if (($scope.socket !== undefined) && ($scope.socket !== null)) {
$scope.socket.close();
$scope.socket = null;
}
$interval.cancel(updateTowers);
};
// Status Controller tasks
setHardwareVisibility();
connect($scope); // connect - opens a socket and listens for messages
};
|
JavaScript
| 0 |
@@ -1053,26 +1053,73 @@
%0A%09%09%09
-setTimeout(connect
+delete $scope.socket;%0A%09%09%09setTimeout(function() %7Bconnect($scope);%7D
, 10
|
4133f70902c0c88f511ef8f09b665b2ea4b8dc3a
|
Revert "[Glitch] Do not re-position scroll when loading more (inserting items from below)"
|
app/javascript/flavours/glitch/components/scrollable_list.js
|
app/javascript/flavours/glitch/components/scrollable_list.js
|
import React, { PureComponent } from 'react';
import { ScrollContainer } from 'react-router-scroll-4';
import PropTypes from 'prop-types';
import IntersectionObserverArticleContainer from 'flavours/glitch/containers/intersection_observer_article_container';
import LoadMore from './load_more';
import IntersectionObserverWrapper from 'flavours/glitch/util/intersection_observer_wrapper';
import { throttle } from 'lodash';
import { List as ImmutableList } from 'immutable';
import classNames from 'classnames';
import { attachFullscreenListener, detachFullscreenListener, isFullscreen } from 'flavours/glitch/util/fullscreen';
export default class ScrollableList extends PureComponent {
static contextTypes = {
router: PropTypes.object,
};
static propTypes = {
scrollKey: PropTypes.string.isRequired,
onScrollToBottom: PropTypes.func,
onScrollToTop: PropTypes.func,
onScroll: PropTypes.func,
trackScroll: PropTypes.bool,
shouldUpdateScroll: PropTypes.func,
isLoading: PropTypes.bool,
hasMore: PropTypes.bool,
prepend: PropTypes.node,
emptyMessage: PropTypes.node,
children: PropTypes.node,
};
static defaultProps = {
trackScroll: true,
};
state = {
fullscreen: null,
mouseOver: false,
};
intersectionObserverWrapper = new IntersectionObserverWrapper();
handleScroll = throttle(() => {
if (this.node) {
const { scrollTop, scrollHeight, clientHeight } = this.node;
const offset = scrollHeight - scrollTop - clientHeight;
if (400 > offset && this.props.onScrollToBottom && !this.props.isLoading) {
this.props.onScrollToBottom();
} else if (scrollTop < 100 && this.props.onScrollToTop) {
this.props.onScrollToTop();
} else if (this.props.onScroll) {
this.props.onScroll();
}
}
}, 150, {
trailing: true,
});
componentDidMount () {
this.attachScrollListener();
this.attachIntersectionObserver();
attachFullscreenListener(this.onFullScreenChange);
// Handle initial scroll posiiton
this.handleScroll();
}
getScrollPosition = () => {
if (this.node && this.node.scrollTop > 0) {
return {height: this.node.scrollHeight, top: this.node.scrollTop};
} else {
return null;
}
}
updateScrollBottom = (snapshot) => {
const newScrollTop = this.node.scrollHeight - snapshot;
if (this.node.scrollTop !== newScrollTop) {
this.node.scrollTop = newScrollTop;
}
}
getSnapshotBeforeUpdate (prevProps, prevState) {
const someItemInserted = React.Children.count(prevProps.children) > 0 &&
React.Children.count(prevProps.children) < React.Children.count(this.props.children) &&
this.getFirstChildKey(prevProps) !== this.getFirstChildKey(this.props);
if (someItemInserted && this.node.scrollTop > 0 || (this.state.mouseOver && !prevProps.isLoading)) {
return this.node.scrollHeight - this.node.scrollTop;
} else {
return null;
}
}
componentDidUpdate (prevProps, prevState, snapshot) {
// Reset the scroll position when a new child comes in in order not to
// jerk the scrollbar around if you're already scrolled down the page.
if (snapshot !== null) this.updateScrollBottom(snapshot);
}
componentWillUnmount () {
this.detachScrollListener();
this.detachIntersectionObserver();
detachFullscreenListener(this.onFullScreenChange);
}
onFullScreenChange = () => {
this.setState({ fullscreen: isFullscreen() });
}
attachIntersectionObserver () {
this.intersectionObserverWrapper.connect({
root: this.node,
rootMargin: '300% 0px',
});
}
detachIntersectionObserver () {
this.intersectionObserverWrapper.disconnect();
}
attachScrollListener () {
this.node.addEventListener('scroll', this.handleScroll);
}
detachScrollListener () {
this.node.removeEventListener('scroll', this.handleScroll);
}
getFirstChildKey (props) {
const { children } = props;
let firstChild = children;
if (children instanceof ImmutableList) {
firstChild = children.get(0);
} else if (Array.isArray(children)) {
firstChild = children[0];
}
return firstChild && firstChild.key;
}
setRef = (c) => {
this.node = c;
}
handleLoadMore = (e) => {
e.preventDefault();
this.props.onScrollToBottom();
}
handleMouseEnter = () => {
this.setState({ mouseOver: true });
}
handleMouseLeave = () => {
this.setState({ mouseOver: false });
}
render () {
const { children, scrollKey, trackScroll, shouldUpdateScroll, isLoading, hasMore, prepend, emptyMessage } = this.props;
const { fullscreen } = this.state;
const childrenCount = React.Children.count(children);
const loadMore = (hasMore && childrenCount > 0) ? <LoadMore visible={!isLoading} onClick={this.handleLoadMore} /> : null;
let scrollableArea = null;
if (isLoading || childrenCount > 0 || !emptyMessage) {
scrollableArea = (
<div className={classNames('scrollable', { fullscreen })} ref={this.setRef} onMouseEnter={this.handleMouseEnter} onMouseLeave={this.handleMouseLeave}>
<div role='feed' className='item-list'>
{prepend}
{React.Children.map(this.props.children, (child, index) => (
<IntersectionObserverArticleContainer
key={child.key}
id={child.key}
index={index}
listLength={childrenCount}
intersectionObserverWrapper={this.intersectionObserverWrapper}
saveHeightKey={trackScroll ? `${this.context.router.route.location.key}:${scrollKey}` : null}
>
{React.cloneElement(child, {getScrollPosition: this.getScrollPosition, updateScrollBottom: this.updateScrollBottom})}
</IntersectionObserverArticleContainer>
))}
{loadMore}
</div>
</div>
);
} else {
scrollableArea = (
<div className='empty-column-indicator' ref={this.setRef}>
{emptyMessage}
</div>
);
}
if (trackScroll) {
return (
<ScrollContainer scrollKey={scrollKey} shouldUpdateScroll={shouldUpdateScroll}>
{scrollableArea}
</ScrollContainer>
);
} else {
return scrollableArea;
}
}
}
|
JavaScript
| 0 |
@@ -2832,17 +2832,16 @@
%3E 0 %7C%7C
-(
this.sta
@@ -2856,33 +2856,8 @@
Over
- && !prevProps.isLoading)
) %7B%0A
|
8b057d51e08c03fd2fea632ccf5c0bddd60b67af
|
Use RefreshablePureListView instead of PureListView
|
EduChainApp/js/tabs/tasks/TaskListView.js
|
EduChainApp/js/tabs/tasks/TaskListView.js
|
/**
* TODO add partial FB src
*
* @flow
*/
'use strict';
import React from 'react';
import {
Text,
View,
Navigator,
StyleSheet
} from 'react-native';
import {connect} from 'react-redux';
import Header from '../../common/Header';
import GlobalStyles from '../../common/GlobalStyles';
import TaskListRow from './TaskListRow';
import PureListView from '../../lib/facebook/PureListView';
import type {Task} from '../../reducers/tasks';
import {loadTasks} from '../../actions/tasks';
type Rows = Array<TaskListRow>;
type RowsAndSections = {
[sectionID: string]: Object;
};
type TaskData = Rows | RowsAndSections;
type Props = {
tasks: Array<Task>,
navigator: Navigator
}
type State = {
dataSource: TaskData,
loaded: boolean
}
export default class TaskListView extends React.Component {
props: Props;
state: State;
constructor(props: Props) {
super(props);
(this: any).renderEmptyList = this.renderEmptyList.bind(this);
(this: any).renderRow = this.renderRow.bind(this);
(this: any).renderSeparator = this.renderSeparator.bind(this);
(this: any).renderSectionHeader = this.renderSectionHeader.bind(this);
(this: any).renderWithSections = this.renderWithSections.bind(this);
}
// TODO GH #6; add searchBar header
render() {
return (
<View style={styles.container}>
<Header
title="Tasks"
rightItem={{
title: "Add Task",
layout: "title",
icon: "ios-add",
onPress: () => this.props.navigator.push({id: "addTask"})
}}
/>
<PureListView
data={(this: any).renderWithSections(this.props.tasks)}
renderEmptyList={this.renderEmptyList}
renderRow={this.renderRow}
renderSectionHeader={this.renderSectionHeader}
renderSeparator={this.renderSeparator}
automaticallyAdjustContentInsets={false}
enableEmptySections={true}
/>
</View>
);
}
renderEmptyList() {
return (
<View style={styles.emptyListContainer}>
<Text style={styles.text}>
Looks like there aren't any tasks...
</Text>
</View>
);
}
renderRow(rowData: Object) {
return (
<TaskListRow
row={rowData}
onPress={() => this.props.navigator.push({id: "task", task: rowData})}
/>
);
}
renderWithSections(tasks: Array<Task>) {
let dataBlob = {};
tasks.map((task: Task) => {
let section = task.status;
// add section key to `dataBlob` if not present yet
if (!dataBlob[section]) dataBlob[section] = [];
// add this task to said section
dataBlob[section].push(task);
});
return dataBlob;
}
renderSectionHeader(data: Object, sectionId: string) {
return (
<View style={styles.sectionHeader}>
<Text style={styles.sectionHeaderText}>{sectionId}</Text>
</View>
);
}
renderSeparator(sectionId: string, rowId: string) {
return (
<View key={sectionId+rowId} style={GlobalStyles.separator} />
);
}
} // END CLASS
const styles = StyleSheet.create({
container: {
flex: 1,
},
emptyListContainer: {
flex: 1,
alignItems: 'center'
},
sectionHeader: {
backgroundColor: 'gray'
},
sectionHeaderText: {
fontSize: 16,
color: 'white',
paddingLeft: 10
},
});
|
JavaScript
| 0 |
@@ -294,24 +294,66 @@
balStyles';%0A
+import Loader from '../../common/Loader';%0A
import TaskL
@@ -388,16 +388,27 @@
%0Aimport
+Refreshable
PureList
@@ -428,21 +428,26 @@
/../
-lib/facebook/
+common/Refreshable
Pure
@@ -726,16 +726,46 @@
%3CTask%3E,%0A
+ onRefresh: () =%3E Promise,%0A
navi
@@ -1837,16 +1837,27 @@
%3C
+Refreshable
PureList
@@ -2169,16 +2169,69 @@
arator%7D%0A
+ onRefresh=%7Bthis.props.onRefresh%7D%0A
@@ -2395,149 +2395,134 @@
-renderEmptyList() %7B%0A return (%0A %3CView style=%7Bstyles.emptyListContainer%7D%3E%0A %3CText style=%7Bstyles.text%7D%3E%0A
+// TODO Implement the loading fragment properly instead of abusing %60renderEmptyList%60%0A renderEmptyList() %7B%0A return (%0A
@@ -2533,87 +2533,33 @@
+%3C
Lo
-oks like there aren't any tasks...%0A %3C/Text%3E%0A %3C/View
+ader title=%7B%22Tasks%22%7D /
%3E%0A
|
c3ef978bc2588985592654e8f9cad7527233ba28
|
Update whole task at task update.
|
app/controllers/task.js
|
app/controllers/task.js
|
import Ember from "ember";
export default Ember.Controller.extend({
session: Ember.inject.service(),
storage: Ember.inject.service(),
reload_status: null,
mathObserver: function() {
MathJax.Hub.Queue(["Typeset", MathJax.Hub]);
}.observes("model.details.body"),
points_text: Ember.computed("model.max_score", function(){
var points = this.get("model.max_score");
if (points === 1) { return "bod"; }
else if ((points === 2) || (points === 3) || (points === 4)) { return "body"; }
else { return "bodů"; }
}),
// Reload task when deployed in another browser window.
taskToReload: function() {
var task_id = this.get("storage.taskToReload");
if (task_id === this.get("model.id")) { this.send("updateTask"); }
}.observes("storage.reloadTask"),
actions: {
updateTask: function() {
var self = this;
this.set("reload_status", "Aktualizuji...");
this.get("model.details").then(function(details) {
details.reload();
self.set("reload_status", "Aktualizováno<br>"+(new Date()).toLocaleFormat('%H:%M:%S'));
});
},
hideUpdate: function() {
this.set("reload_status", null);
},
},
init: function() {
this.set("storage.reloadTask", false);
}
});
|
JavaScript
| 0 |
@@ -870,24 +870,82 @@
actions: %7B%0D%0A
+ // Aktualizovat ulohu, detaily a vsechny moduly.%0D%0A
upda
@@ -958,32 +958,32 @@
: function() %7B%0D%0A
-
var
@@ -1050,24 +1050,26 @@
zuji...%22);%0D%0A
+%0D%0A
@@ -1079,25 +1079,85 @@
s.get(%22model
-.
+%22).reload().then(function(task) %7B%0D%0A task.get(%22
details%22).th
@@ -1196,16 +1196,20 @@
+
details.
@@ -1216,19 +1216,201 @@
reload()
-;%0D%0A
+.then(function(details) %7B%0D%0A details.get(%22modules%22).forEach(function(module) %7B%0D%0A module.reload();%0D%0A %7D);%0D%0A
@@ -1514,30 +1514,76 @@
-%7D);%0D%0A
+ %7D);%0D%0A%0D%0A %7D);%0D%0A %7D)%0D%0A
%7D,%0D%0A%0D
|
4724a30df74118e1b3f783c229fe4dd2222c93e7
|
Version bump
|
package.js
|
package.js
|
Package.describe({
name: 'babrahams:temple',
version: '0.0.2',
// Brief, one-line summary of the package.
summary: 'Developer tool that provides visual information about templates',
// URL to the Git repository containing the source code for this package.
git: 'https://github.com/JackAdams/temple.git',
// By default, Meteor will default to using README.md for documentation.
// To avoid submitting documentation, set this field to null.
documentation: 'README.md',
debugOnly: true
});
Package.onUse(function(api) {
api.versionsFrom('1.0');
api.use('templating', 'client');
api.use('reactive-dict', 'client');
api.use('aldeed:[email protected]','client');
api.use('gwendall:[email protected]', 'client');
api.use('mizzao:[email protected]','client');
api.use('msavin:[email protected]', 'client', {weak: true}),
api.addFiles('temple.css','client');
api.addFiles('temple.html', 'client');
api.addFiles('temple.js','client');
});
Package.onTest(function(api) {
api.use('tinytest');
api.use('babrahams:temple');
api.addFiles('temple-tests.js');
});
|
JavaScript
| 0.000001 |
@@ -56,17 +56,17 @@
n: '0.0.
-2
+3
',%0A //
|
98b625f1cbe378451fd5f42313d435ab48e45f27
|
Maintain “shape” of AttrMorph
|
packages/morph-attr/lib/main.js
|
packages/morph-attr/lib/main.js
|
import { sanitizeAttributeValue } from "./morph-attr/sanitize-attribute-value";
import { isAttrRemovalValue, normalizeProperty } from "./dom-helper/prop";
import { svgNamespace } from "./dom-helper/build-html-dom";
import { getAttrNamespace } from "./htmlbars-util";
function getProperty() {
return this.domHelper.getPropertyStrict(this.element, this.attrName);
}
function updateProperty(value) {
if (this._renderedInitially === true || !isAttrRemovalValue(value)) {
// do not render if initial value is undefined or null
this.domHelper.setPropertyStrict(this.element, this.attrName, value);
}
this._renderedInitially = true;
}
function getAttribute() {
return this.domHelper.getAttribute(this.element, this.attrName);
}
function updateAttribute(value) {
if (isAttrRemovalValue(value)) {
this.domHelper.removeAttribute(this.element, this.attrName);
} else {
this.domHelper.setAttribute(this.element, this.attrName, value);
}
}
function getAttributeNS() {
return this.domHelper.getAttributeNS(this.element, this.namespace, this.attrName);
}
function updateAttributeNS(value) {
if (isAttrRemovalValue(value)) {
this.domHelper.removeAttribute(this.element, this.attrName);
} else {
this.domHelper.setAttributeNS(this.element, this.namespace, this.attrName, value);
}
}
var UNSET = { unset: true };
var guid = 1;
function AttrMorph(element, attrName, domHelper, namespace) {
this.element = element;
this.domHelper = domHelper;
this.namespace = namespace !== undefined ? namespace : getAttrNamespace(attrName);
this.state = {};
this.isDirty = false;
this.escaped = true;
this.lastValue = UNSET;
this.linkedParams = null;
this.linkedResult = null;
this.guid = "attr" + guid++;
this.rendered = false;
this._renderedInitially = false;
var normalizedAttrName = normalizeProperty(this.element, attrName);
if (this.namespace) {
this._update = updateAttributeNS;
this._get = getAttributeNS;
this.attrName = attrName;
} else {
if (element.namespaceURI === svgNamespace || attrName === 'style' || !normalizedAttrName) {
this.attrName = attrName;
this._update = updateAttribute;
this._get = getAttribute;
} else {
this.attrName = normalizedAttrName;
this._update = updateProperty;
this._get = getProperty;
}
}
}
AttrMorph.prototype.setContent = function (value) {
if (this.lastValue === value) { return; }
this.lastValue = value;
if (this.escaped) {
var sanitized = sanitizeAttributeValue(this.domHelper, this.element, this.attrName, value);
this._update(sanitized, this.namespace);
} else {
this._update(value, this.namespace);
}
};
AttrMorph.prototype.getContent = function () {
var value = this.lastValue = this._get();
return value;
};
// renderAndCleanup calls `clear` on all items in the morph map
// just before calling `destroy` on the morph.
//
// As a future refactor this could be changed to set the property
// back to its original/default value.
AttrMorph.prototype.clear = function() { };
AttrMorph.prototype.destroy = function() {
this.element = null;
this.domHelper = null;
};
export default AttrMorph;
export { sanitizeAttributeValue };
|
JavaScript
| 0 |
@@ -1602,24 +1602,55 @@
ty = false;%0A
+ this.isSubtreeDirty = false;%0A
this.escap
@@ -1686,16 +1686,95 @@
UNSET;%0A
+ this.lastResult = null;%0A this.lastYielded = null;%0A this.childNodes = null;%0A
this.l
@@ -1852,16 +1852,41 @@
guid++;%0A
+ this.ownerNode = null;%0A
this.r
@@ -2243,40 +2243,8 @@
) %7B%0A
- this.attrName = attrName;%0A
@@ -2313,21 +2313,8 @@
te;%0A
- %7D else %7B%0A
@@ -2335,27 +2335,30 @@
e =
-normalizedAttrName;
+attrName;%0A %7D else %7B
%0A
@@ -2418,24 +2418,66 @@
etProperty;%0A
+ this.attrName = normalizedAttrName;%0A
%7D%0A %7D%0A%7D%0A
|
e77d94a78b674ce6d4bce8d84bd24156e913d47a
|
Fix time
|
l2-frontend/src/store/modules/departments.js
|
l2-frontend/src/store/modules/departments.js
|
import departments_directory from '../../api/departments-directory'
import * as types from '../mutation-types'
import _ from 'lodash'
const state = {
all: [],
old_all: [],
can_edit: false,
types: []
}
const getters = {
allDepartments: state => state.all,
oldDepartments: state => state.old_all,
}
const actions = {
async getAllDepartments({commit}) {
const departments = await departments_directory.getDepartments()
commit(types.UPDATE_DEPARTMENTS, {departments})
commit(types.UPDATE_OLD_DEPARTMENTS, {departments})
},
updateDepartments: _.debounce(({commit, getters}) => {
let diff = []
let departments = getters.allDepartments
for (let row of departments) {
for (let in_row of getters.oldDepartments) {
if (in_row.pk === row.pk) {
if (in_row.title !== row.title) {
diff.push(row)
}
break
}
}
}
if (diff.length === 0)
return
console.log(diff)
commit(types.UPDATE_OLD_DEPARTMENTS, {departments})
}, 400)
}
const mutations = {
[types.UPDATE_DEPARTMENTS](state, {departments}) {
state.all = departments
},
[types.UPDATE_OLD_DEPARTMENTS](state, {departments}) {
state.old_all = JSON.parse(JSON.stringify(departments))
},
}
export default {
state,
getters,
actions,
mutations,
}
|
JavaScript
| 0.999405 |
@@ -1035,10 +1035,10 @@
%7D,
-40
+65
0)%0A%7D
|
f9ee72c012a812c40f621dd8ab6c9af9a59a26b6
|
Remove unused function
|
packages/idyll-document/src/utils/index.js
|
packages/idyll-document/src/utils/index.js
|
const values = require('object.values');
const entries = require('object.entries');
const getNodesByName = (name, tree) => {
const predicate = typeof name === 'string' ? (s) => s === name : name;
const byName = (acc, val) => {
if (typeof val === 'string') return acc;
const [ name, attrs, children ] = val;
if (predicate(name)) acc.push(val)
if (children.length > 0) children.reduce(byName, acc)
return acc;
}
return tree.reduce(
byName,
[]
)
}
export const evalExpression = (acc, expr) => {
const e = `
(() => {
${
Object.keys(acc)
.filter(key => expr.includes(key))
.map(key => {
if (key === 'refs') {
// delete each ref's domNode property
// because it can't be serialized
values(acc[key]).forEach(v => {
delete v.domNode;
})
// add `refs` const object graph to function scope
return `var ${key} = JSON.parse('${JSON.stringify(acc[key])}')`;
}
return `var ${key} = ${JSON.stringify(acc[key])};`;
})
.join('\n')
}
return ${expr};
})()
`;
try {
return eval(e);
} catch (err) {}
}
export const getVars = (arr, context = {}) => {
const pluck = (acc, val) => {
const [ , attrs, ] = val
const [nameArr, valueArr] = attrs;
const [, [, nameValue]] = nameArr
const [, [valueType, valueValue]] = valueArr;
switch(valueType) {
case 'value':
acc[nameValue] = valueValue;
break;
case 'variable':
if (context.hasOwnProperty(valueValue)) {
acc[nameValue] = context[valueValue];
} else {
acc[nameValue] = evalExpression(context, expr);
}
break;
case 'expression':
const expr = valueValue;
acc[nameValue] = {
value: evalExpression(context, expr),
update: (newState, oldState) => {
return evalExpression(Object.assign({}, oldState, newState), expr)
}
}
}
return acc;
}
return arr.reduce(
pluck,
{}
)
}
export const getData = (arr, datasets = {}) => {
const pluck = (acc, val) => {
const [ , attrs, ] = val
const [nameArr, ] = attrs;
const [, [, nameValue]] = nameArr
acc[nameValue] = datasets[nameValue];
return acc;
}
return arr.reduce(
pluck,
{}
)
}
export const splitAST = (ast) => {
const state = {
vars: [],
derived: [],
data: [],
elements: [],
}
ast.forEach(node => {
const [ name ] = node;
if (name === 'var') {
state.vars.push(node);
} else if (state[name]) {
state[name].push(node);
} else {
state.elements.push(node);
}
})
return state;
}
export const hooks = [
'onEnterView',
'onEnterViewFully',
'onExitView',
'onExitViewFully',
'onScroll',
];
export const translate = (arr) => {
const attrConvert = (list) => {
return list.reduce(
(acc, [name, [type, val]]) => {
if (type === 'variable') {
acc.__vars__ = acc.__vars__ = {};
acc.__vars__[name] = val;
}
// each node keeps a list of props that are expressions
if (type === 'expression') {
acc.__expr__ = acc.__expr__ || {};
acc.__expr__[name] = val;
}
// flag nodes that define a hook function
if (hooks.includes(name)) acc.hasHook = true;
acc[name] = val
return acc
},
{}
)
}
const tNode = (node) => {
if (typeof node === 'string') return node;
if (node.length === 3) {
const [ name, attrs, children ] = node
return {
component: name,
...attrConvert(attrs),
children: children.map(tNode),
}
}
}
return splitAST(arr).elements.map(tNode)
}
export const mapTree = (tree, mapFn, filterFn = () => true) => {
const walkFn = (acc, node) => {
if (typeof node !== 'string') {
if (node.children) {
// translated schema
node.children = node.children.reduce(walkFn, []);
} else {
// compiler AST
node[2] = node[2].reduce(walkFn, []);
}
}
if (filterFn(node)) acc.push(mapFn(node));
return acc;
};
return tree.reduce(
walkFn,
[]
);
};
export const findWrapTargets = (schema, state) => {
const targets = [];
const stateKeys = Object.keys(state);
// always return node so we can walk the whole tree
// but collect and ultimately return just the nodes
// we are interested in wrapping
mapTree(schema, (node) => {
if (typeof node === 'string') return node;
if (node.hasHook) {
targets.push(node);
return node;
}
// wrap all custom components
const startsWith = node.component.charAt(0);
if (startsWith === startsWith.toUpperCase()) {
targets.push(node);
return node;
}
// pull off the props we don't need to check
const { component, children, __vars__, __expr__, ...props } = node;
const expressions = Object.keys(__expr__ || {});
const variables = Object.keys(__vars__ || {});
// iterate over the node's prop values
entries(props).forEach(([key, val]) => {
// avoid checking more props if we know it's a match
if (targets.includes(node)) return;
// Include nodes that reference a variable or expression.
if (variables.includes(key) || expressions.includes(key)) {
targets.push(node);
}
});
return node;
})
return targets;
}
|
JavaScript
| 0.000004 |
@@ -82,414 +82,8 @@
);%0A%0A
-const getNodesByName = (name, tree) =%3E %7B%0A const predicate = typeof name === 'string' ? (s) =%3E s === name : name;%0A%0A const byName = (acc, val) =%3E %7B%0A if (typeof val === 'string') return acc;%0A%0A const %5B name, attrs, children %5D = val;%0A%0A if (predicate(name)) acc.push(val)%0A%0A if (children.length %3E 0) children.reduce(byName, acc)%0A%0A return acc;%0A %7D%0A%0A return tree.reduce(%0A byName,%0A %5B%5D%0A )%0A%7D%0A%0A
expo
|
ed0aafb48d13c34859fc7b0212af7c9bba6a08b1
|
add key to MostAnnotatingUsers ListItem
|
src/front_page.js
|
src/front_page.js
|
import React from 'react'
import Route from 'react-route'
import { Card, CardTitle, CardText } from 'react-md/lib/Cards'
import { List, ListItem } from 'react-md/lib/Lists'
import { CircularProgress } from 'react-md/lib/Progress'
import FontIcon from 'react-md/lib/FontIcons'
import PaperAvatar from './paper_avatar'
import iso8601ToDate from './iso8601_to_date'
export default class Main extends React.Component {
render() {
let cardStyle = {
flex: "1 1 35em",
overflowX: 'hidden'
}
return (
<div className="md-card-list front-page" style={{
display: 'flex',
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'flex-start',
flexWrap: 'wrap'
}}>
<Card style={cardStyle}>
<CardTitle title="Neueste Anfragen und Vorlagen"/>
<CardText>
<RecentPapers/>
</CardText>
</Card>
<Card style={cardStyle}>
<CardTitle title="Gut annotierte Vorgänge"/>
<CardText>
<MostAnnotatedPapers/>
</CardText>
</Card>
<Card style={cardStyle}>
<CardTitle title="Zuletzt annotierte Dokumente"/>
<CardText>
<RecentAnnotatedFiles/>
</CardText>
</Card>
<Card style={cardStyle}>
<CardTitle title="Highscore"/>
<CardText>
<MostAnnotatingUsers/>
</CardText>
</Card>
</div>
)
}
}
class RecentPapers extends React.Component {
componentDidMount() {
fetch("/api/papers/recent")
.then(res => res.json())
.then(results => {
this.setState({
papers: results
})
})
}
render() {
if (this.state && this.state.papers) {
return (
<List>
{this.state.papers.map(paper => <PaperItem key={paper.id} {...paper}/> )}
</List>
)
} else {
return (
<div style={{ margin: "2em auto" }}>
<CircularProgress/>
</div>
)
}
}
}
class MostAnnotatedPapers extends React.Component {
componentDidMount() {
fetch("/api/papers/most/annotations")
.then(res => res.json())
.then(results => {
this.setState({
papers: results
})
})
}
render() {
if (this.state && this.state.papers) {
return (
<List>
{this.state.papers.map(paper => <PaperItem key={paper.id} {...paper}/> )}
</List>
)
} else {
return (
<div style={{ margin: "2em auto" }}>
<CircularProgress/>
</div>
)
}
}
}
class RecentAnnotatedFiles extends React.Component {
componentDidMount() {
fetch("/api/files/recent/annotations")
.then(res => res.json())
.then(results => {
this.setState({
files: results
})
})
}
render() {
if (this.state && this.state.files) {
return (
<List>
{this.state.files.map(file => <FileItem key={file.id} {...file}/> )}
</List>
)
} else {
return (
<div style={{ margin: "2em auto" }}>
<CircularProgress/>
</div>
)
}
}
}
class MostAnnotatingUsers extends React.Component {
componentDidMount() {
fetch("/api/users/top/annotations")
.then(res => res.json())
.then(results => {
this.setState({
users: results
})
})
}
render() {
let userIcon = user => {
let { annotationsCreated } = user
if (annotationsCreated < 5) {
return 'pool'
} else if (annotationsCreated < 25) {
return 'directions_walk'
} else if (annotationsCreated < 1000) {
return 'directions_run'
} else {
return 'directions_bike'
}
}
if (this.state && this.state.users) {
return (
<List>
{this.state.users.map(user => (
<ListItem disabled={true}
leftIcon={<FontIcon>{userIcon(user)}</FontIcon>}
primaryText={user.name}
secondaryText={`${user.annotationsCreated} Annotationen erstellt`}
/>
))}
</List>
)
} else {
return (
<div style={{ margin: "2em auto" }}>
<CircularProgress/>
</div>
)
}
}
}
class PaperItem extends React.Component {
render() {
let paper = this.props
let primary = paper.name
let secondary = iso8601ToDate(paper.publishedDate)
if (paper.paperType) {
secondary += `, ${paper.paperType}`
}
return (
<ListItem
leftIcon={<PaperAvatar paper={paper} style={{ color: 'white' }}/>}
primaryText={primary}
secondaryText={secondary}
onClick={() => Route.go(`/paper/${encodeURIComponent(paper.id)}`)}
/>
)
}
}
class FileItem extends React.Component {
render() {
let file = this.props
return (
<ListItem
primaryText={file.name}
leftIcon={<FontIcon>description</FontIcon>}
onClick={ev => Route.go(`/file/${encodeURIComponent(this.props.id)}`)}
/>
)
}
}
|
JavaScript
| 0 |
@@ -3966,16 +3966,32 @@
ListItem
+ key=%7Buser.name%7D
disable
|
b9c59bfff148c5fa8313c9b63bca2bafc0aa35ae
|
remove trailing space
|
package.js
|
package.js
|
/* eslint strict: 0, no-shadow: 0, no-unused-vars: 0, no-console: 0 */
'use strict';
const os = require('os');
const webpack = require('webpack');
const cfg = require('./webpack.config.production.js');
const packager = require('electron-packager');
const del = require('del');
const exec = require('child_process').exec;
const argv = require('minimist')(process.argv.slice(2));
const pkg = require('./package.json');
const devDeps = Object.keys(pkg.devDependencies);
const appName = argv.name || argv.n || pkg.productName;
const shouldUseAsar = argv.asar || argv.a || false;
const shouldBuildAll = argv.all || false;
const DEFAULT_OPTS = {
dir: './',
name: appName,
asar: shouldUseAsar,
ignore: [
'/test($|/)',
'/tools($|/)',
'/release($|/)'
].concat(devDeps.map(name => `/node_modules/${name}($|/)`))
};
const icon = argv.icon || argv.i || 'app/app';
if (icon) {
DEFAULT_OPTS.icon = icon;
}
const version = argv.version || argv.v;
if (version) {
DEFAULT_OPTS.version = version;
startPack();
} else {
// use the same version as the currently-installed electron-prebuilt
exec('npm list electron-prebuilt', (err, stdout) => {
if (err) {
DEFAULT_OPTS.version = '0.36.2';
} else {
DEFAULT_OPTS.version = stdout.split('electron-prebuilt@')[1].replace(/\s/g, '');
}
startPack();
});
}
function startPack() {
console.log('start pack...');
webpack(cfg, (err, stats) => {
if (err) return console.error(err);
del('release')
.then(paths => {
if (shouldBuildAll) {
// build for all platforms
const archs = ['ia32', 'x64'];
const platforms = ['linux', 'win32', 'darwin'];
platforms.forEach(plat => {
archs.forEach(arch => {
pack(plat, arch, log(plat, arch));
});
});
} else {
// build for current platform only
pack(os.platform(), os.arch(), log(os.platform(), os.arch()));
}
})
.catch(err => {
console.error(err);
});
});
}
function pack(plat, arch, cb) {
// there is no darwin ia32 electron
if (plat === 'darwin' && arch === 'ia32') return;
const iconObj = {
icon: DEFAULT_OPTS.icon + (() => {
let extension = '.png';
if (plat === 'darwin') {
extension = '.icns';
} else if (plat === 'win32') {
extension = '.ico';
}
return extension;
})()
};
const opts = Object.assign({}, DEFAULT_OPTS, iconObj, {
platform: plat,
arch,
prune: true,
out: `release/${plat}-${arch}`
});
packager(opts, cb);
}
function log(plat, arch) {
return (err, filepath) => {
if (err) return console.error(err);
console.log(`${plat}-${arch} finished!`);
};
}
|
JavaScript
| 0.002332 |
@@ -2405,18 +2405,16 @@
()%0A %7D;%0A
-
%0A const
|
e3afa9e0c484bb606634c08a26503ddd86e8586a
|
Set output directory.
|
src/MailTrace.Site/webpack.config.js
|
src/MailTrace.Site/webpack.config.js
|
"use strict";
require('regenerator-runtime/runtime');
/**
* To learn more about how to use Easy Webpack
* Take a look at the README here: https://github.com/easy-webpack/core
**/
const easyWebpack = require('@easy-webpack/core');
const generateConfig = easyWebpack.default;
const get = easyWebpack.get;
const path = require('path');
const ENV = process.env.NODE_ENV && process.env.NODE_ENV.toLowerCase() || 'development';
let config;
// basic configuration:
const title = 'Aurelia Navigation Skeleton';
const baseUrl = '/';
const rootDir = path.resolve();
const srcDir = path.resolve('src');
const outDir = path.resolve('dist');
const coreBundles = {
bootstrap: [
'aurelia-polyfills',
'aurelia-pal',
'aurelia-pal-browser',
'regenerator-runtime',
'bluebird'
],
// these will be included in the 'aurelia' bundle (except for the above bootstrap packages)
aurelia: [
'aurelia-bootstrapper-webpack',
'aurelia-binding',
'aurelia-dependency-injection',
'aurelia-event-aggregator',
'aurelia-framework',
'aurelia-history',
'aurelia-history-browser',
'aurelia-loader',
'aurelia-loader-webpack',
'aurelia-logging',
'aurelia-logging-console',
'aurelia-metadata',
'aurelia-pal',
'aurelia-pal-browser',
'aurelia-path',
'aurelia-polyfills',
'aurelia-route-recognizer',
'aurelia-router',
'aurelia-task-queue',
'aurelia-templating',
'aurelia-templating-binding',
'aurelia-templating-router',
'aurelia-templating-resources'
]
}
const baseConfig = {
entry: {
'app': ['./src/main'],
'aurelia-bootstrap': ['./index'].concat(coreBundles.bootstrap),
'aurelia': coreBundles.aurelia.filter(pkg => coreBundles.bootstrap.indexOf(pkg) === -1)
},
output: {
path: outDir,
},
devServer: {
proxy: {
'/api': {
target: 'http://localhost:35293/',
secure: false
}
}
}
}
// advanced configuration:
switch (ENV) {
case 'production':
config = generateConfig(
baseConfig,
require('@easy-webpack/config-env-production')
({ compress: true }),
require('@easy-webpack/config-aurelia')
({ root: rootDir, src: srcDir, title: title, baseUrl: baseUrl }),
require('@easy-webpack/config-babel')(),
require('@easy-webpack/config-html')(),
require('@easy-webpack/config-css')
({ filename: 'styles.css', allChunks: false, sourceMap: false }),
require('@easy-webpack/config-fonts-and-images')(),
require('@easy-webpack/config-global-bluebird')(),
require('@easy-webpack/config-global-jquery')(),
require('@easy-webpack/config-global-regenerator')(),
require('@easy-webpack/config-generate-index-html')
({ minify: true }),
require('@easy-webpack/config-uglify')
({ debug: false })
);
break;
default:
case 'development':
process.env.NODE_ENV = 'development';
config = generateConfig(
baseConfig,
require('@easy-webpack/config-env-development')(),
require('@easy-webpack/config-aurelia')
({ root: rootDir, src: srcDir, title: title, baseUrl: baseUrl }),
require('@easy-webpack/config-babel')(),
require('@easy-webpack/config-html')(),
require('@easy-webpack/config-css')
({ filename: 'styles.css', allChunks: false, sourceMap: false }),
require('@easy-webpack/config-fonts-and-images')(),
require('@easy-webpack/config-global-bluebird')(),
require('@easy-webpack/config-global-jquery')(),
require('@easy-webpack/config-global-regenerator')(),
require('@easy-webpack/config-generate-index-html')
({ minify: false })
);
break;
}
config = generateConfig(
config,
require('@easy-webpack/config-common-chunks-simple')
({ appChunkName: 'app', firstChunk: 'aurelia-bootstrap' })
);
module.exports = config;
|
JavaScript
| 0 |
@@ -475,35 +475,17 @@
= '
-Aurelia Navigation Skeleton
+MailTrace
';%0Ac
@@ -605,12 +605,11 @@
ve('
-dist
+bin
');%0A
|
ecc7e3094fd20af5792c2a0a1fef596d9ac30f17
|
Fix global anchor color
|
html-template.js
|
html-template.js
|
module.exports = function htmlTemplate({ title, repoName }) {
return `
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta
name="viewport"
content="width=device-width
initial-scale=1
user-scalable=no"
/>
<title>${ title }</title>
<link
href="https://fonts.googleapis.com/css?family=Lobster+Two:400,700"
rel="stylesheet"
type="text/css"
>
<link
href="https://fonts.googleapis.com/css?family=Open+Sans+Condensed:300,700"
rel="stylesheet"
type="text/css"
>
<link
rel="stylesheet"
type="text/css"
href="https://cdn.jsdelivr.net/prism/1.3.0/themes/prism-tomorrow.css"
>
</head>
<body>
<div id="root"></div>
<script
src="https://cdn.jsdelivr.net/prism/1.3.0/prism.js"
type="text/javascript"
>
</script>
<script
src="https://cdn.jsdelivr.net/prism/1.3.0/components/prism-jsx.min.js"
type="text/javascript"
>
</script>
<script src="/${ repoName ? repoName : 'dist' }/bundle.js"></script>
</body>
</html>
`;
};
|
JavaScript
| 0.000006 |
@@ -266,16 +266,73 @@
/title%3E%0A
+ %3Cstyle%3E%0A a %7B%0A color: 'white';%0A %7D%0A %3C/style%3E%0A
%3Clink%0A
|
703be49b953fd02606309da7adbf30b78d4a6cc3
|
fix indexof bug
|
packages/idyll-document/src/utils/index.js
|
packages/idyll-document/src/utils/index.js
|
const values = require('object.values');
const entries = require('object.entries');
const falafel = require('falafel');
export const evalExpression = (acc, expr, key, context) => {
let e;
if (key && (key.match(/^on[A-Z].*/) || key.match(/^handle[A-Z].*/))) {
let setState = setState;
e = `
(() => {
var _idyllStateProxy = new Proxy({}, {
get: (_, prop) => {
return context[prop];
},
set: (_, prop, value) => {
var newState = {};
newState[prop] = value;
context.update(newState);
}
})
${falafel(expr, (node) => {
if (node.type === 'Identifier') {
if (acc.indexOf(node.name) > -1) {
node.update('_idyllStateProxy.' + node.source());
}
}
})};
})()
`;
return (function() {
eval(e);
}).bind(Object.assign({}, acc, context || {}));
} else {
e = `
((context) => {
var _idyllStateProxy = new Proxy({}, {
get: (_, prop) => {
return context[prop];
},
set: (_, prop, value) => {
var newState = {};
newState[prop] = value;
context.update(newState);
}
})
return ${falafel(expr, (node) => {
if (node.type === 'Identifier') {
if (acc.indexOf(node.name) > -1) {
node.update('_idyllStateProxy.' + node.source());
}
}
})};
})(this)
`;
}
try {
return (function(evalString){
try {
return eval('(' + evalString + ')');
} catch(err) {}
}).call(Object.assign({}, acc, context || {}), e);
} catch (err) {}
}
export const getVars = (arr, context = {}, evalContext) => {
const pluck = (acc, val) => {
const [ variableType, attrs = [], ] = val;
const [nameArr, valueArr] = attrs;
if (!nameArr || !valueArr) return acc;
const [, [, nameValue]] = nameArr
const [, [valueType, valueValue]] = valueArr;
switch(valueType) {
case 'value':
acc[nameValue] = valueValue;
break;
case 'variable':
if (context.hasOwnProperty(valueValue)) {
acc[nameValue] = context[valueValue];
} else {
acc[nameValue] = evalExpression(context, expr);
}
break;
case 'expression':
const expr = valueValue;
if (variableType === 'var') {
acc[nameValue] = evalExpression(context, expr);
} else {
acc[nameValue] = {
value: evalExpression(context, expr),
update: (newState, oldState) => {
return evalExpression(Object.assign({}, oldState, newState), expr)
}
}
}
}
return acc;
}
return arr.reduce(
pluck,
{}
)
}
export const filterIdyllProps = (props, filterInjected) => {
const {
__vars__,
__expr__,
hasHook,
isHTMLNode,
refName,
onEnterViewFully,
onEnterView,
onExitViewFully,
onExitView,
...rest
} = props;
if (filterInjected) {
const { idyll, hasError, updateProps, ...ret} = rest;
return ret;
}
return rest;
}
export const getData = (arr, datasets = {}) => {
const pluck = (acc, val) => {
const [ , attrs, ] = val
const [nameArr, ] = attrs;
const [, [, nameValue]] = nameArr
acc[nameValue] = datasets[nameValue];
return acc;
}
return arr.reduce(
pluck,
{}
)
}
export const splitAST = (ast) => {
const state = {
vars: [],
derived: [],
data: [],
elements: [],
}
const handleNode = (storeElements) => {
return (node) => {
const [ name, props, children ] = node;
if (name === 'var') {
state.vars.push(node);
} else if (state[name]) {
state[name].push(node);
} else if (storeElements) {
state.elements.push(node);
}
if (!children || typeof children === 'string') {
return;
}
children.forEach(handleNode(false));
}
}
ast.forEach(handleNode(true));
return state;
}
export const hooks = [
'onEnterView',
'onEnterViewFully',
'onExitView',
'onExitViewFully'
];
export const scrollMonitorEvents = {
'onEnterView': 'enterViewport',
'onEnterViewFully': 'fullyEnterViewport',
'onExitView': 'partiallyExitViewport',
'onExitViewFully': 'exitViewport'
}
export const translate = (arr) => {
const attrConvert = (list) => {
return list.reduce(
(acc, [name, [type, val]]) => {
if (type === 'variable') {
acc.__vars__ = acc.__vars__ || {};
acc.__vars__[name] = val;
}
// each node keeps a list of props that are expressions
if (type === 'expression') {
acc.__expr__ = acc.__expr__ || {};
acc.__expr__[name] = val;
}
// flag nodes that define a hook function
if (hooks.includes(name)) {
acc.hasHook = true;
};
acc[name] = val;
return acc;
},
{}
)
}
const tNode = (node) => {
if (typeof node === 'string') return node;
if (node.length === 3) {
const [ name, attrs, children ] = node;
return {
component: name,
...attrConvert(attrs),
children: children.map(tNode),
}
}
}
return splitAST(arr).elements.map(tNode)
}
export const mapTree = (tree, mapFn, filterFn = () => true) => {
const walkFn = (acc, node) => {
if (typeof node !== 'string') {
if (node.children) {
// translated schema
node.children = node.children.reduce(walkFn, []);
} else {
// compiler AST
node[2] = node[2].reduce(walkFn, []);
}
}
if (filterFn(node)) acc.push(mapFn(node));
return acc;
};
return tree.reduce(
walkFn,
[]
);
};
export const filterASTForDocument = (ast) => {
return mapTree(ast, n => n, ([name]) => name !== 'meta')
};
export const findWrapTargets = (schema, state) => {
const targets = [];
const stateKeys = Object.keys(state);
// always return node so we can walk the whole tree
// but collect and ultimately return just the nodes
// we are interested in wrapping
mapTree(schema, (node) => {
if (typeof node === 'string') return node;
if (node.hasHook) {
targets.push(node);
return node;
}
// wrap all custom components
const startsWith = node.component.charAt(0);
if (startsWith === startsWith.toUpperCase()) {
targets.push(node);
return node;
}
// pull off the props we don't need to check
const { component, children, __vars__, __expr__, ...props } = node;
const expressions = Object.keys(__expr__ || {});
const variables = Object.keys(__vars__ || {});
// iterate over the node's prop values
entries(props).forEach(([key, val]) => {
// avoid checking more props if we know it's a match
if (targets.includes(node)) return;
// Include nodes that reference a variable or expression.
if (variables.includes(key) || expressions.includes(key)) {
targets.push(node);
}
});
return node;
})
return targets;
}
|
JavaScript
| 0 |
@@ -714,36 +714,49 @@
if
+(Object.keys
(acc
+)
.indexOf(node.na
@@ -1423,20 +1423,33 @@
if
+(Object.keys
(acc
+)
.indexOf
|
f4159a70c5b9d42fac535e50098133c72065b994
|
make returns easier to read
|
dom/src/select.js
|
dom/src/select.js
|
import {makeEventsSelector} from './events'
import {isolateSource, isolateSink} from './isolate'
function makeIsStrictlyInRootScope(namespace) {
const classIsForeign = (c) => {
const matched = c.match(/cycle-scope-(\S+)/)
return matched && namespace.indexOf(`.${c}`) === -1
}
const classIsDomestic = (c) => {
const matched = c.match(/cycle-scope-(\S+)/)
return matched && namespace.indexOf(`.${c}`) !== -1
}
return function isStrictlyInRootScope(leaf) {
const some = Array.prototype.some
const split = String.prototype.split
for (let el = leaf; el; el = el.parentElement) {
const classList = el.classList || split.call(el.className, ` `)
if (some.call(classList, classIsDomestic)) {
return true
}
if (some.call(classList, classIsForeign)) {
return false
}
}
return true
}
}
const isValidString = param => typeof param === `string` && param.length > 0
const contains = (str, match) => str.indexOf(match) > -1
const isNotTagName = param =>
isValidString(param) && contains(param, `.`) ||
contains(param, `#`) || contains(param, `:`)
function sortNamespace(a, b) {
if (isNotTagName(a) && isNotTagName(b)) {
return 0
}
return isNotTagName(a) ? 1 : -1
}
function removeDuplicates(arr) {
const newArray = []
arr.forEach((element) => {
if (newArray.indexOf(element) === -1) {
newArray.push(element)
}
})
return newArray
}
const getScope = namespace =>
namespace.filter(c => c.indexOf(`.cycle-scope`) > -1)
function makeFindElements(namespace) {
return function findElements(rootElement) {
if (namespace.join(``) === ``) {
return rootElement
}
const slice = Array.prototype.slice
const scope = getScope(namespace)
// Uses global selector && is isolated
if (namespace.indexOf(`*`) > -1 && scope.length > 0) {
// grab top-level boundary of scope
const topNode = rootElement.querySelector(scope.join(` `))
// grab all children
const childNodes = topNode.getElementsByTagName(`*`)
return removeDuplicates([topNode].concat(slice.call(childNodes)))
.filter(makeIsStrictlyInRootScope(namespace))
}
return removeDuplicates(
slice.call(rootElement.querySelectorAll(namespace.join(` `)))
.concat(slice.call(rootElement.querySelectorAll(namespace.join(``))))
).filter(makeIsStrictlyInRootScope(namespace))
}
}
function makeElementSelector(rootElement$) {
return function elementSelector(selector) {
if (typeof selector !== `string`) {
throw new Error(`DOM driver's select() expects the argument to be a ` +
`string as a CSS selector`)
}
const namespace = this.namespace
const trimmedSelector = selector.trim()
const childNamespace = trimmedSelector === `:root` ?
namespace :
namespace.concat(trimmedSelector).sort(sortNamespace)
return {
observable: rootElement$.map(makeFindElements(childNamespace)),
namespace: childNamespace,
select: makeElementSelector(rootElement$),
events: makeEventsSelector(rootElement$, childNamespace),
isolateSource,
isolateSink,
}
}
}
export {makeElementSelector, makeIsStrictlyInRootScope}
|
JavaScript
| 0.000002 |
@@ -2231,18 +2231,16 @@
(%0A
-
slice.ca
@@ -2234,32 +2234,41 @@
slice.call(
+%0A
rootElement.quer
@@ -2300,26 +2300,24 @@
in(%60 %60))
-)
%0A
-
+)
.concat(
@@ -2327,16 +2327,25 @@
ce.call(
+%0A
rootElem
@@ -2384,21 +2384,26 @@
oin(%60%60))
+%0A
))%0A
-
).fi
|
90e7985e85939b15c39fa2b53b0e85b52e9c7150
|
allow object.assign in tests
|
santa-test.js
|
santa-test.js
|
'use strict';
// santa test package
module.exports = {
"extends": ["./santa.js"],
"rules": {
"santa/module-definition": 0,
"santa/no-module-state": 0,
"santa/enforce-package-access": 0,
"jasmine/no-spec-dupes": 0,
"jasmine/no-suite-dupes": 0,
"jasmine/missing-expect": 0,
"jasmine/no-suite-callback-args": 2,
"jasmine/no-focused-tests": 2,
"jasmine/valid-expect": 2,
"jasmine/no-disabled-tests": 0,
"santa/no-jasmine-outside-describe": 2,
"react/display-name": 0,
"react/jsx-boolean-value": 0,
"react/jsx-no-undef": 0,
"react/jsx-sort-props": 0,
"react/jsx-sort-prop-types": 0,
"react/jsx-uses-react": 0,
"react/jsx-uses-vars": 0,
"react/no-did-mount-set-state": 0,
"react/no-did-update-set-state": 0,
"react/no-multi-comp": 0,
"react/no-unknown-property": 0,
"react/prop-types": 0,
"react/react-in-jsx-scope": 0,
"react/self-closing-comp": 0,
"react/wrap-multilines": 0,
"react/sort-comp": 0,
"react/forbid-prop-types": 0,
"react/jsx-closing-bracket-location": 0,
"react/jsx-curly-spacing": 0,
"react/jsx-handler-names": 0,
"react/jsx-indent-props": 0,
"react/jsx-indent": 0,
"react/jsx-key": 0,
"react/jsx-max-props-per-line": 0,
"react/jsx-no-bind": 0,
"react/jsx-no-duplicate-props": 0,
"react/jsx-no-literals": 0,
"react/jsx-pascal-case": 0,
"react/no-danger": 0,
"react/no-deprecated": 0,
"react/no-direct-mutation-state": 0,
"react/no-is-mounted": 0,
"react/no-set-state": 0,
"react/no-string-refs": 0,
"react/prefer-es6-class": 0,
"react/require-extension": 0
},
"plugins": [
"jasmine"
],
"env": {
"jasmine": true
}
};
|
JavaScript
| 0.000005 |
@@ -88,17 +88,142 @@
%22
-rules%22: %7B
+plugins%22: %5B%0A %22jasmine%22%0A %5D,%0A %22env%22: %7B%0A %22jasmine%22: true%0A %7D,%0A %22rules%22: %7B%0A %22no-restricted-properties%22: 0,
%0A
@@ -1974,94 +1974,8 @@
: 0%0A
- %7D,%0A %22plugins%22: %5B%0A %22jasmine%22%0A %5D,%0A %22env%22: %7B%0A %22jasmine%22: true%0A
|
d8ba7ab51f730b85107ebab3a057e4282d4cd3e6
|
Check id in attributes before remove
|
src/code_manager/model/HtmlGenerator.js
|
src/code_manager/model/HtmlGenerator.js
|
import Backbone from 'backbone';
export default Backbone.Model.extend({
build(model, opts = {}) {
const models = model.components();
const htmlOpts = {};
const { em } = opts;
// Remove unnecessary IDs
if (opts.cleanId && em) {
const rules = em.get('CssComposer').getAll();
const idRules = rules
.toJSON()
.map(rule => {
const sels = rule.selectors;
const sel = sels && sels.length === 1 && sels.models[0];
return sel && sel.isId() && sel.get('name');
})
.filter(i => i);
htmlOpts.attributes = (mod, attrs) => {
const { id } = attrs;
if (
id &&
id[0] === 'i' && // all autogenerated IDs start with 'i'
!mod.get('script') && // if the component has script, we have to leave the ID
idRules.indexOf(id) < 0 // we shouldn't have any rule with this ID
) {
delete attrs.id;
}
return attrs;
};
}
if (opts.exportWrapper) {
return model.toHTML({
...htmlOpts,
...(opts.wrapperIsBody && { tag: 'body' })
});
}
return this.buildModels(models, htmlOpts);
},
buildModels(models, opts = {}) {
let code = '';
models.forEach(mod => (code += mod.toHTML(opts)));
return code;
}
});
|
JavaScript
| 0 |
@@ -819,24 +819,104 @@
eave the ID%0A
+ !mod.get('attributes').id && // id is not intentionally in attributes%0A
id
|
6b2efd584c4bd39db0ca0c2bd64cf05e80af3177
|
update controller addFolderByCsv
|
src/main/controllers/folder/addFolderByCsv.js
|
src/main/controllers/folder/addFolderByCsv.js
|
import {dialog} from 'electron';
import {isEmpty, first} from 'lodash';
import csv from 'fast-csv';
import fs from 'fs';
export default async function addFolderByCsv({models}) {
const {Folder} = models;
const options = {
properties: ['openFile'],
filters: [
{name: 'Csv Files', extensions: ['csv']}
]
};
dialog.showOpenDialog(options, (paths) => {
if (isEmpty(paths)) {
return;
}
const csvFilePath = first(paths);
const stream = fs.createReadStream(csvFilePath);
const csvStream = csv()
.on('data', (data) => {
console.log(data);
})
.on('end', () => {
console.log("done");
});
stream.pipe(csvStream);
console.log('csvFilePath', csvFilePath);
});
}
|
JavaScript
| 0 |
@@ -118,66 +118,240 @@
s';%0A
-%0Aexport default async function addFolderByCsv(%7Bmodels%7D) %7B%0A
+import %7Bbasename%7D from 'path';%0A%0Aimport csvProcessor from './../../helpers/csvProcessor';%0A%0Aexport default async function addFolderByCsv(args) %7B%0A%0A const %7Bmodels, webContents%7D = args;%0A const send = webContents.send.bind(webContents);
%0A c
@@ -536,18 +536,68 @@
ns,
+handleDialogOpen);%0A%0A async function handleDialogOpen
(paths)
- =%3E
%7B%0A%0A
@@ -643,16 +643,51 @@
%0A %7D%0A%0A
+ send('start-processing-csv');%0A%0A
cons
@@ -716,16 +716,60 @@
paths);%0A
+ const filename = basename(csvFilePath);%0A
cons
@@ -810,24 +810,127 @@
FilePath);%0A%0A
+ let completedLines = 0;%0A let hasColumnRow = false;%0A let folder = null;%0A let fields = %5B%5D;%0A%0A
const cs
@@ -962,16 +962,22 @@
('data',
+ async
(data)
@@ -985,34 +985,462 @@
%3E %7B%0A
- console.log(data);
+%0A if (isEmpty(folder) && csvProcessor.isColumnRow(data)) %7B%0A const columnData = csvProcessor.getColumnData(data);%0A folder = await Folder.create(%7B%0A name: filename,%0A data: columnData%0A %7D);%0A fields = csvProcessor.getFields(data);%0A %7D%0A else if (folder) %7B%0A %7D%0A%0A if (0 === (++completedLines %25 20000)) %7B%0A send('csv-processing-status', %7BcompletedLines%7D);%0A %7D
%0A
@@ -1473,41 +1473,119 @@
%3E %7B%0A
+%0A
-console.log(%22done%22
+if (! hasColumnRow) %7B%0A send('csv-processing-error', %7Bmessage: 'No column row detected'%7D
);%0A
%7D);%0A
@@ -1584,91 +1584,161 @@
+
-%7D);%0A%0A stream.pipe(csvStream);%0A%0A console.log('csvFilePath', csvFilePath
+ return;%0A %7D%0A%0A send('csv-processing-status', %7BcompletedLines%7D);%0A send('csv-processing-end');%0A %7D);%0A%0A stream.pipe(csvStream
);%0A %7D
-);
%0A%7D%0A
|
eabab0aa778a880a1615f680dbc9d2b5799f8a41
|
Fix deprecation warning and increase connection retries
|
domains/domain.js
|
domains/domain.js
|
var logger = require("winston")
, _ = require('underscore')
, util = require('util')
, EventEmitter = require('events').EventEmitter
, Mongoose = require('mongoose').Mongoose
, Filestore = require('./filestore')
var Domain = module.exports = function(url) {
this.url = url;
this.mongoose = new Mongoose();
this.filestore = new Filestore(this.mongoose);
this.middleware = new Middleware(this);
}
util.inherits(Domain, EventEmitter);
Domain.prototype.connect = function() {
var self = this;
var connect = function() {
self.mongoose.connect(self.url, {server: { auto_reconnect: false }});
}
connect();
var db = this.mongoose.connection;
self.connected = false;
db.on('connecting', function() {
logger.info('Connecting to MongoDB...');
});
db.on('error', function() {
self.connected = false;
logger.error('Error in MongoDb connection');
});
db.on('connected', function() {
self.connected = true;
logger.info('MongoDB connected!');
});
db.on('open', function() {
self.connected = true;
logger.info('MongoDB connection opened!');
});
db.on('reconnected', function () {
self.connected = true;
logger.info('MongoDB reconnected!');
});
db.on('disconnected', function() {
self.connected = false;
logger.warn('MongoDB disconnected, will reconnect in 5 seconds!');
setTimeout(connect, 5000);
});
}
Domain.prototype.model = function() {
return this.mongoose.model.apply(this.mongoose, arguments);
}
/**
*
* Factory of utility middlewares for Express.
*
* @param {Domain} db domain instance that will be bound to the middleware closures.
* @constructor
* @private
*/
var Middleware = function(db) {
this.db = db;
};
/**
* Middleware that returns a 503 error if
* the database is not available when making the request.
*/
Middleware.prototype.ready = function(options) {
var self = this;
options = options || {};
var view = options.view;
var json = options.json || { error: "Service Unavailable" };
var status = options.status || 503;
return function(req, res, next) {
if (self.db.connected) {
next();
} else {
res.format(_.extend({
html: function() {
if (view) {
res.status(status);
res.render(view, {
path: req.path
});
} else {
res.send(status);
}
},
json: function() {
res.json(503, json);
}
}, options.format));
}
}
}
Middleware.prototype.findById = function(model, param, nfe) {
var db = this.db;
return function (req, res, next) {
var id = db.mongoose.Types.ObjectId(req.params[param]);
db.model(model).findOne({_id: id}, function(err, document) {
if (err) {
return next(err);
} else if (!document && nfe) {
return next(nfe);
} else {
req.params[param] = document;
return next();
}
});
}
};
|
JavaScript
| 0.000001 |
@@ -604,41 +604,83 @@
l, %7B
-server: %7B auto_reconnect: false %7D
+%0A useMongoClient: true,%0A reconnectTries: 100%0A
%7D);%0A
|
90fa781bc8706afcddf2d41feab59901529831b8
|
patch release - Bump to version 0.9.11
|
package.js
|
package.js
|
Package.describe({
summary: "Accounts Templates styled for Twitter Bootstrap.",
version: "0.9.10",
name: "splendido:accounts-templates-bootstrap",
git: "https://github.com/splendido/accounts-templates-bootstrap.git",
});
Package.on_use(function(api, where) {
api.versionsFrom("[email protected]");
api.use([
"less",
"templating",
], "client");
api.use([
"splendido:accounts-templates-core",
], ["client", "server"]);
api.imply([
"splendido:[email protected]",
], ["client", "server"]);
api.add_files([
"lib/at_error.html",
"lib/at_error.js",
"lib/at_form.html",
"lib/at_form.js",
"lib/at_input.html",
"lib/at_input.js",
"lib/at_oauth.html",
"lib/at_oauth.js",
"lib/at_pwd_form.html",
"lib/at_pwd_form.js",
"lib/at_pwd_form_btn.html",
"lib/at_pwd_form_btn.js",
"lib/at_pwd_link.html",
"lib/at_pwd_link.js",
"lib/at_result.html",
"lib/at_result.js",
"lib/at_sep.html",
"lib/at_sep.js",
"lib/at_signin_link.html",
"lib/at_signin_link.js",
"lib/at_signup_link.html",
"lib/at_signup_link.js",
"lib/at_social.html",
"lib/at_social.js",
"lib/at_terms_link.html",
"lib/at_terms_link.js",
"lib/at_title.html",
"lib/at_title.js",
"lib/full_page_at_form.html",
"lib/at_bootstrap.less"
], ["client"]);
});
Package.on_test(function(api) {
api.use([
"splendido:accounts-templates-bootstrap",
"splendido:[email protected]",
]);
api.use([
"accounts-password",
"tinytest",
"test-helpers"
], ["client", "server"]);
api.add_files([
"tests/tests.js"
], ["client", "server"]);
});
|
JavaScript
| 0 |
@@ -92,25 +92,25 @@
sion: %220.9.1
-0
+1
%22,%0A name:
@@ -527,33 +527,33 @@
[email protected]
-0
+1
%22,%0A %5D, %5B%22clie
@@ -1671,17 +1671,17 @@
[email protected]
-0
+1
%22,%0A %5D
|
82d648c0e7d5b6c2dd5d8c32b5537c2e66795542
|
Fix page wrapping (#1195)
|
packages/layout/src/page/getContentArea.js
|
packages/layout/src/page/getContentArea.js
|
import getPadding from '../node/getPadding';
const getContentArea = page => {
const { paddingTop } = getPadding(page);
const height = page.style?.height;
return height - paddingTop;
};
export default getContentArea;
|
JavaScript
| 0 |
@@ -89,19 +89,22 @@
padding
-Top
+Bottom
%7D = get
@@ -184,11 +184,14 @@
ding
-Top
+Bottom
;%0A%7D;
|
f7ac1aca8c485dc5a97ce32c38cf6a989f03dfa8
|
Increment version number for the addition of latest client side js
|
package.js
|
package.js
|
Package.describe({
name: 'saucecode:rollbar',
version: '0.0.6',
summary: 'Rollbar error reporting integrations for Meteor',
documentation: 'README.md'
});
Package.onUse(function(api) {
api.versionsFrom('[email protected]');
Npm.depends({
'rollbar': '0.5.4'
});
api.use('check', 'server');
api.addFiles('lib/server/rollbar-server.js', 'server');
api.addFiles('lib/client/rollbar-client.js', 'client');
api.addFiles('lib/private/client-head.html', 'server', { isAsset: true });
api.export([
'throwError',
'handleError'
], 'client');
api.export([
'rollbar',
'throwError',
'handleError'
], 'server');
});
|
JavaScript
| 0 |
@@ -61,9 +61,9 @@
0.0.
-6
+7
',%0A
|
a7aaa2cc22f47dac5fe5b1dba3dc6c0040fe6ead
|
determine running status using papermill metadata
|
packages/notebook-preview/src/code-cell.js
|
packages/notebook-preview/src/code-cell.js
|
// @flow
import React from "react";
import { List as ImmutableList, Map as ImmutableMap } from "immutable";
import { Display } from "@nteract/display-area";
import Inputs from "./inputs";
import Editor from "./editor";
import LatexRenderer from "./latex";
type Props = {
cell: ImmutableMap<string, any>,
displayOrder: Array<string>,
id: string,
language: string,
theme: string,
tip: boolean,
transforms: Object,
running: boolean,
models: ImmutableMap<string, any>,
sourceHidden: boolean
};
type PapermillMetadata = {
status?: "pending" | "running" | "completed"
// TODO: Acknowledge / use other papermill metadata
};
const PapermillView = (props: PapermillMetadata) => {
if (!props.status) {
return null;
}
if (props.status === "running") {
return (
<div
style={{
width: "100%",
backgroundColor: "#e8f2ff",
paddingLeft: "10px",
paddingTop: "1em",
paddingBottom: "1em",
paddingRight: "0",
marginRight: "0",
boxSizing: "border-box"
}}
>
Executing with Papermill...
</div>
);
}
return null;
};
class CodeCell extends React.PureComponent<Props> {
static defaultProps = {
running: false,
tabSize: 4,
models: new ImmutableMap()
};
isOutputHidden(): any {
return this.props.cell.getIn(["metadata", "outputHidden"]);
}
isInputHidden(): any {
return (
this.props.sourceHidden ||
this.props.cell.getIn(["metadata", "inputHidden"]) ||
this.props.cell.getIn(["metadata", "hide_input"])
);
}
isOutputExpanded() {
return this.props.cell.getIn(["metadata", "outputExpanded"], true);
}
render(): ?React$Element<any> {
return (
<div className={this.props && this.props.running ? "cell-running" : ""}>
<PapermillView
{...this.props.cell
.getIn(["metadata", "papermill"], ImmutableMap())
.toJS()}
/>
{!this.isInputHidden() ? (
<div className="input-container">
<Inputs
executionCount={this.props.cell.get("execution_count")}
running={this.props.running}
/>
<Editor
completion
id={this.props.id}
input={this.props.cell.get("source")}
language={this.props.language}
theme={this.props.theme}
tip={this.props.tip}
cellFocused={false}
onChange={() => {}}
onFocusChange={() => {}}
channels={{}}
cursorBlinkRate={0}
executionState={"not connected"}
editorFocused={false}
focusAbove={() => {}}
focusBelow={() => {}}
/>
</div>
) : null}
<LatexRenderer>
<div className="outputs">
<Display
className="outputs-display"
outputs={this.props.cell.get("outputs").toJS()}
displayOrder={this.props.displayOrder}
transforms={this.props.transforms}
theme={this.props.theme}
tip={this.props.tip}
expanded={this.isOutputExpanded()}
isHidden={this.isOutputHidden()}
models={this.props.models.toJS()}
/>
</div>
</LatexRenderer>
</div>
);
}
}
export default CodeCell;
|
JavaScript
| 0.00003 |
@@ -1740,24 +1740,152 @@
%3Cany%3E %7B%0A
+const running =%0A this.props.running %7C%7C%0A this.props.cell.getIn(%5B%22metadata%22, %22papermill%22, %22status%22%5D) === %22running%22;%0A
return (%0A
@@ -1907,33 +1907,8 @@
me=%7B
-this.props && this.props.
runn
@@ -2274,27 +2274,16 @@
unning=%7B
-this.props.
running%7D
|
2b82fb65f5cd07cc2fa4ee4e6dcf8845c3820eec
|
Apply FacetEnabled of index fields for the search API
|
lib/api/2011-02-01/search.js
|
lib/api/2011-02-01/search.js
|
// -*- indent-tabs-mode: nil; js2-basic-offset: 2 -*-
var Domain = require('../../database').Domain;
var nroonga = require('../../wrapped-nroonga');
var BooleanQueryTranslator = require('../../bq-translator').BooleanQueryTranslator;
function formatFacets(data) {
var drilldownRecords = data.slice(1);
return drilldownRecords.map(function(drilldownRecord, index) {
return formatFacet(drilldownRecord);
});
}
function formatFacet(drilldownRecord) {
var columnList = drilldownRecord[1];
var columnNames = columnList.map(function(column) {
return column[0];
});
var constraintEntries = drilldownRecord.slice(2);
var constraints = constraintEntries.map(function(record) {
var object = {};
columnNames.forEach(function(columnName, index) {
object[columnName] = record[index];
});
return {value: object._key, count: object._nsubrecs};
});
return {constraints: constraints};
}
function formatSelectResults(data) {
var columnList = data[0][1];
var columnNames = columnList.map(function(column) {
return column[0];
});
var records = data[0].slice(2);
var results = records.map(function(record) {
var object = {};
var id;
columnNames.forEach(function(columnName, index) {
// bind internal "_key" column to the "id"
if (columnName == '_key') {
id = record[index];
return;
}
// don't expose any internal column
if (columnName[0] == '_') return;
if (Array.isArray(record[index])) {
// vector column
object[columnName] = record[index];
} else {
// scalar column
object[columnName] = [record[index]];
}
});
return {
id: id,
data: object
};
});
return results;
}
function select(context, options, callback) {
context.command('select', options, function(error, data) {
if (error) {
callback(error);
} else {
var numFoundRecords = data[0][0][0];
callback(
null,
formatSelectResults(data),
numFoundRecords,
formatFacets(data)
);
}
});
}
function createErrorBody(options) {
return {
error: 'info',
rid: options.rid,
'time-ms': options.elapsedTime || 0,
'cpu-time-ms': 0, // TODO
messages: [
{
severity: 'fatal',
code: '',
message: options.message || ''
}
]
};
}
function translateQueryToBooleanQuery(query) {
return "'" + query.replace(/(['\\])/g, '\\$1') + "'";
}
exports.createHandler = function(context) {
return function(request, response) {
var dummyRid = '000000000000000000000000000000000000000000000000000000000000000';
var startedAt = new Date();
var domain = new Domain(request, context);
var query = request.query.q || '';
var booleanQuery = request.query.bq || '';
var filters = [];
var matchExpr = '';
var facetParameter = request.query.facet;
var defaultFields;
var defaultField = domain.defaultSearchField;
if (defaultField)
defaultFields = [defaultField];
else
defaultFields = domain.searchableIndexFields.filter(function(field) {
return field.type == 'text';
});
var defaultFieldNames = defaultFields.map(function(field) {
return field.name;
});
if (query) {
var queryAsBooleanQuery = translateQueryToBooleanQuery(query);
var translator = new BooleanQueryTranslator(queryAsBooleanQuery);
translator.domain = domain;
translator.defaultFieldNames = defaultFieldNames;
try {
filters.push(translator.translate());
} catch (error) {
var body = createErrorBody({
rid: dummyRid,
message: 'Invalid q value: ' + (error.message || error)
});
return response.send(body, 400);
}
matchExpr = '(label ' + queryAsBooleanQuery + ')';
}
if (booleanQuery) {
var translator = new BooleanQueryTranslator(booleanQuery);
translator.domain = domain;
translator.defaultFieldNames = defaultFieldNames;
try {
filters.push(translator.translate());
} catch (error) {
var body = createErrorBody({
rid: dummyRid,
message: 'Invalid bq value: ' + (error.message || error)
});
return response.send(body, 400);
}
if (matchExpr.length > 0) {
matchExpr = '(and ' + matchExpr + ' ' + booleanQuery + ')';
} else {
matchExpr = booleanQuery;
}
}
filters = filters.map(function(filter) {
return '(' + filter + ')';
});
var size = parseInt(request.query.size || '10', 10);
var start = parseInt(request.query.start || '0', 10);
var filter = filters.join(' && ');
var outputColumns = domain.resultReturnableIndexFields
.map(function(field) {
return field.columnName;
});
outputColumns.unshift('_key');
var options = {
table: domain.tableName,
filter: filter,
limit: size,
offset: start,
output_columns: outputColumns.join(', ')
};
if (domain.hasSynonymsTableSync()) {
options.query_expansion = domain.synonymsTableName + '.synonyms';
}
if (filter) {
options.filter = filter;
}
if (facetParameter) {
options.drilldown = facetParameter;
options.drilldown_sortby = '-_nsubrecs';
// TODO support sorting parameter
// TODO support facet-FIELD-top-n parameter
}
select(context, options,
function(error, data, numFoundRecords, facets) {
var finishedAt = new Date();
var elapsedTime = finishedAt - startedAt;
var info = {
rid: dummyRid,
'time-ms': elapsedTime,
'cpu-time-ms': 0 // TODO
};
if (error) {
var body = createErrorBody({
rid: dummyRid,
message: error.message,
elapsedTime: elapsedTime
});
return response.send(body, 400); // TODO
}
var result = {
rank: '-text_relevance', // FIXME
'match-expr': matchExpr,
hits: {
found: numFoundRecords,
start: start,
hit: data
},
info: info
};
if (facetParameter) {
var facetNames = facetParameter.split(',');
var facetsObject = {};
facets.map(function(facet, index) {
var facetName = facetNames[index];
facetsObject[facetName] = facet;
});
result.facets = facetsObject;
}
response.json(result);
}
);
};
};
|
JavaScript
| 0 |
@@ -5347,24 +5347,634 @@
arameter) %7B%0A
+ var facetReturnableFields = domain.facetReturnableIndexFields%0A .map(function(field) %7B%0A return field.name;%0A %7D);%0A facetParameter = facetParameter.split(',')%0A .map(function(field) %7B%0A return field.replace(/%5E%5Cs+%7C%5Cs+$/g, '');%0A %7D)%0A .filter(function(field) %7B%0A return facetReturnableFields.indexOf(field) %3E -1;%0A %7D);%0A .join(',');%0A
option
|
2eff81056045aa4179e9bdbd919f12570a5494c1
|
fix adding multiple modules at once
|
Dnn9FastAddModule/template.js
|
Dnn9FastAddModule/template.js
|
/*globals jQuery, window, Sys */
(function ($, Sys) {
$(document).ready(function () {
if ($('.dnnModuleManager').length){
initAddModule(document);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function (sender, args) {
var elemId = args.get_response().get_webRequest().get_userContext();
initAddModule($("#" + elemId));
});
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(function (sender, args) {
args.get_request().set_userContext(args.get_postBackElement().id);
});
}
});
function initAddModule(elem) {
var sf = $.ServicesFramework();
$.ajax({
type: "GET",
url: sf.getServiceRoot('InternalServices') + "ControlBar/GetPortalDesktopModules",
contentType: "application/json; charset=utf-8",
dataType: "json",
data: 'category=&loadingStartIndex=0&loadingPageSize=10&searchTerm=&excludeCategories=&sortBookmarks=true&topModule=Html',
beforeSend: sf.setModuleHeaders
}).done(function (data) {
$('.dnnModuleManager', elem).each(function (index) {
var pane = $(this).data('name');
var $container = $("<div class='addOpenContent-container'></div>");
data.forEach(function (m) {
if (m.Bookmarked || m == data[0]) {
$container.append("<div class='icon-wrap'>" +
"<a class='addOpenContent'" +
"href='#' title='"+ m.ModuleName + "' data-moduleid='" + m.ModuleID + "' data-pane='" + pane + "'>"+
"<img src='"+ m.ModuleImage + "' alt='" + m.ModuleName + "'>"+
"</a>"+
"</div>" );
}
});
$(this).append($container);
$(this).hover(function () {
$($container).show();
},function () {
$($container).hide();
});
});
initClick(sf);
}).fail(function (xhr, result, status) {
console.error("Uh-oh, something broke: " + status);
});
}
function initClick(sf) {
$('.addOpenContent').each(function (index) {
var pane = $(this).data('pane');
var moduleid = $(this).data('moduleid');
$(this).click(function () {
$.ajax({
type: "POST",
url: sf.getServiceRoot('InternalServices') + "ControlBar/AddModule",
contentType: "application/json; charset=utf-8",
dataType: "json",
data: JSON.stringify({
Visibility: '0',
Position: '-1',
Module: moduleid,
Page: '',
Pane: pane,
AddExistingModule: '',
CopyModule: '',
Sort: ''
}),
beforeSend: sf.setModuleHeaders
}).done(function (data) {
//location.reload(true);
dnn.ContentEditorManager.getModuleDialog().refreshPane(pane);
}).fail(function (xhr, result, status) {
console.error("Uh-oh, something broke: " + status);
});
return false;
});
});
}
}(jQuery, window.Sys));
|
JavaScript
| 0 |
@@ -2237,16 +2237,22 @@
$(this).
+off().
click(fu
|
5a37eb47ddb2247fdb11872a172823d18b47f160
|
fix a11y upload report (#2790)
|
.circleci/upload-preview.js
|
.circleci/upload-preview.js
|
const fs = require('fs');
const path = require('path');
const { Octokit } = require('@octokit/rest');
const octokit = new Octokit({ auth: process.env.GH_PR_TOKEN });
const surge = require('surge');
const publishFn = surge().publish();
const owner = process.env.CIRCLE_PROJECT_USERNAME; // patternfly
const repo = process.env.CIRCLE_PROJECT_REPONAME; // patternfly-next
const prnum = process.env.CIRCLE_PR_NUMBER;
const prbranch = process.env.CIRCLE_BRANCH;
const uploadFolder = process.argv[2];
if (!uploadFolder) {
console.log('Usage: upload-preview uploadFolder');
process.exit(1);
}
const uploadFolderName = path.basename(uploadFolder);
let uploadURL = `${repo}${prnum ? `-pr-${prnum || prbranch}` : ''}`.replace(/[\/|\.]/g, '-');
switch(uploadFolderName) {
case 'coverage':
fs.copyFileSync(
path.join(uploadFolder, 'report.html'),
path.join(uploadFolder, 'index.html')
);
uploadURL += '.surge.sh';
break;
case 'public':
if (!prnum && prbranch === 'master') {
uploadURL = 'pf4.patternfly.org';
fs.writeFileSync(path.join(__dirname, '../public/CNAME'), uploadURL);
}
else {
uploadURL += '.surge.sh';
}
break;
default:
uploadURL += `-${uploadFolderName}`;
uploadURL += '.surge.sh';
break;
}
publishFn({
project: uploadFolder,
p: uploadFolder,
domain: uploadURL,
d: uploadURL,
e: 'https://surge.surge.sh',
endpoint: 'https://surge.surge.sh'
});
function tryAddComment(comment, commentBody) {
if (!commentBody.includes(comment)) {
return comment;
}
return '';
}
if (prnum) {
octokit.issues.listComments({
owner,
repo,
issue_number: prnum
})
.then(res => res.data)
.then(comments => {
let commentBody = '';
const existingComment = comments.find(comment => comment.user.login === 'patternfly-build');
if (existingComment) {
commentBody += existingComment.body.trim();
commentBody += '\n\n';
}
if (uploadFolderName === 'public') {
commentBody += tryAddComment(`Preview: https://${uploadURL}`, commentBody);
}
else if (uploadFolderName === 'coverage') {
commentBody += tryAddComment(`A11y report: https://${uploadURL}`, commentBody);
}
if (existingComment) {
octokit.issues.updateComment({
owner,
repo,
comment_id: existingComment.id,
body: commentBody
}).then(() => console.log('Updated comment!'));
} else {
octokit.issues.createComment({
owner,
repo,
issue_number: prnum,
body: commentBody
}).then(() => console.log('Created comment!'));
}
});
}
|
JavaScript
| 0 |
@@ -909,32 +909,41 @@
uploadURL += '
+-coverage
.surge.sh';%0A
|
6583154f8421cdb245dc56bbf44e569ab81d6229
|
Use proptypes package so we can get rid of a react warning.
|
packages/react-atlas/src/codegen.config.js
|
packages/react-atlas/src/codegen.config.js
|
let dot = require("dot");
let fs = require("fs");
let eol = require("os").EOL;
/* Below are the templates used by react-atlas to generate files for themeing.
* The templating library used by react-atlas is dot.js. More info about dot.js
* can be found here: http://olado.github.io/doT/index.html . Dot.js was chosen
* because it has no dependencies, is MIT licensed and works.
*
* Dot.js templates are just strings of text. To print out a variable with dot.js
* Use double curly brackets, followed by the variable name. You will need to put =it.
* on the begining of the variable you pass dot.js. Then make sure to close the double
* curly brackets. Here's an example using a variable called component:
*
* {{=it.component.name}}
*
* Here's a full example:
*
* let dot = require("dot");
*
* let component = { 'name': 'input'};
* let template = "{{=it.component.name}}";
*
* let tempFn = dot.template(template);
* let resultText = tempFn({ component: component });
*
* The variable resultText will contain the rendered component, so
* you will have to use fs.writeFileSync() or something similar to
* actually write the template to disk or somewhere else.
*
* The example above only evaluates a single variable, to render an array
* you will have to change a few things. First use ~it. instead of =it. like
* before. The ~ means evaluate an array, use {{~}} to tell dot.js to stop repeating
* over. Here's an example of the template:
*
* "{{~it.components :value:index}}" +
* eol +
* "export {{=value.name}} from './{{=value.name}}';" +
* eol +
* "{{~}}";
*
*/
/* The warning message appended to the top of every machine generated file.
* This warning informs developers not to make changes to machine generated files
* and to instead change the code generator. */
const warningMessage =
"/* WARNING, THIS FILE WAS MACHINE GENERATED. DO NOT MODIFY THIS FILE DIRECTLY " +
eol +
"BECAUSE YOUR CHANGES WILL BE OVERWRITTEN WHEN THIS FILE IS GENERATED AGAIN. " +
eol +
"IF YOU WAN'T TO MODIFY THIS FILE YOU SHOULD BE MODIFYING THE GENERATOR IT'S SELF " +
eol +
"AND REGENERATE THIS FILE. */" +
eol;
/* The template used for generating production react-atlas components. */
let template = warningMessage;
template +=
"import CSSModules from 'react-css-modules';" +
eol +
"import { {{=it.component.name}}Core } from 'react-atlas-core';" +
eol +
"import { {{=it.component.name}}Style } from '{{=it.component.theme}}';" +
eol +
"export const {{=it.component.name}} = CSSModules({{=it.component.name}}Core, {{=it.component.name}}Style, {allowMultiple: true, errorWhenNotFound: true});";
/* The template used to generate the development react-atlas components. The
* development component is actually a wrapper around the "real" component
* so that react-styleguidist can recognize the component and generate a docsite. */
let devTemplate = warningMessage;
devTemplate +=
"import CSSModules from 'react-css-modules';" +
eol +
"import React, { PropTypes } from 'react';" +
eol +
"import { {{=it.component.name}}Core } from 'react-atlas-core';" +
eol +
"import { {{=it.component.name}}Style } from '{{=it.component.theme}}';" +
eol +
"const {{=it.component.name}}Comp = CSSModules({{=it.component.name}}Core, {{=it.component.name}}Style, {allowMultiple: true, errorWhenNotFound: true});" +
eol +
"export default class {{=it.component.name}} extends React.Component {" +
eol +
"constructor(props){" +
eol +
"super(props)" +
eol +
"}" +
eol +
"render() {" +
eol +
"return (" +
eol +
"<{{=it.component.name}}Comp {...this.props}></{{=it.component.name}}Comp>" +
eol +
")" +
eol +
"}" +
eol +
"}" +
eol +
"{{=it.component.name}}.propTypes = {" +
eol +
"{{~it.component.propTypes :value:index}}" +
eol +
"/** {{=value.description}} */" +
eol +
"{{=value.type}}," +
eol +
"{{~}}" +
eol +
"};";
let indexTemplate = warningMessage;
indexTemplate +=
"{{~it.components :value:index}}" +
eol +
"export {{{=value.name}}} from './{{=value.name}}';" +
eol +
"{{~}}" +
eol;
let compIndexTemplate = warningMessage;
compIndexTemplate +=
"export {{=it.component.name}} from './{{=it.component.name}}.js';";
/* Dot template settings. Keep defaults except turn off stripping newlines feature
* of dot.js. */
dot.templateSettings = {
evaluate: /\{\{([\s\S]+?)\}\}/g,
interpolate: /\{\{=([\s\S]+?)\}\}/g,
encode: /\{\{!([\s\S]+?)\}\}/g,
use: /\{\{#([\s\S]+?)\}\}/g,
define: /\{\{##\s*([\w\.$]+)\s*(\:|=)([\s\S]+?)#\}\}/g,
conditional: /\{\{\?(\?)?\s*([\s\S]*?)\s*\}\}/g,
iterate: /\{\{~\s*(?:\}\}|([\s\S]+?)\s*\:\s*([\w$]+)\s*(?:\:\s*([\w$]+))?\s*\}\})/g,
varname: "it",
strip: false,
append: true,
selfcontained: false
};
/* TODO: Replace hardcoded array with a dynamic solution. */
let components = [
"avatar",
"button",
"checkbox",
"dropdown",
"form",
"input",
"radio",
"radioGroup",
"switch",
"table",
"tooltip"
];
module.exports = {
warningMessage: warningMessage,
template: template,
components: components,
indexTemplate: indexTemplate,
compIndexTemplate: compIndexTemplate,
devTemplate: devTemplate
};
|
JavaScript
| 0 |
@@ -3083,19 +3083,54 @@
rt React
-, %7B
+ from 'react';%22 +%0D%0A eol + %0D%0A %22import
PropTyp
@@ -3131,30 +3131,33 @@
ropTypes
- %7D
from '
-react
+prop-types
';%22 +%0D%0A
|
cf06ae8c3828a5a9f0ac8ffd178053432e1a68ef
|
Add computationTime
|
circlefit.js
|
circlefit.js
|
/*
The MIT License (MIT)
Copyright (c) 2015 Michael MIGLIORE
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
var CIRCLEFIT = (function () {
var my = {},
points = [];
function linearSolve2x2(matrix, vector) {
var det = matrix[0]*matrix[3] - matrix[1]*matrix[2];
if (det < 1e-8) return false; //no solution
var y = (matrix[0]*vector[1] - matrix[2]*vector[0])/det;
var x = (vector[0] - matrix[1]*y)/matrix[0];
return [x,y];
}
my.addPoint = function (x, y) {
points.push({x: x, y: y});
}
my.resetPoints = function () {
points = [];
}
my.compute = function () {
var result = {
points: points,
projections: [],
distances: [],
success: false,
center: {x:0, y:0},
radius: 0,
residue: 0
};
//means
var m = points.reduce(function(p, c) {
return {x: p.x + c.x/points.length,
y: p.y + c.y/points.length};
},{x:0, y:0});
//centered points
var u = points.map(function(e){
return {x: e.x - m.x,
y: e.y - m.y};
});
//solve linear equation
var Sxx = u.reduce(function(p,c) {
return p + c.x*c.x;
},0);
var Sxy = u.reduce(function(p,c) {
return p + c.x*c.y;
},0);
var Syy = u.reduce(function(p,c) {
return p + c.y*c.y;
},0);
var v1 = u.reduce(function(p,c) {
return p + 0.5*(c.x*c.x*c.x + c.x*c.y*c.y);
},0);
var v2 = u.reduce(function(p,c) {
return p + 0.5*(c.y*c.y*c.y + c.x*c.x*c.y);
},0);
var sol = linearSolve2x2([Sxx, Sxy, Sxy, Syy], [v1, v2]);
if (sol === false) {
//not enough points or points are colinears
return result;
}
result.success = true;
//compute radius from circle equation
var radius2 = sol[0]*sol[0] + sol[1]*sol[1] + (Sxx+Syy)/points.length;
result.radius = Math.sqrt(radius2);
result.center.x = sol[0] + m.x;
result.center.y = sol[1] + m.y;
points.forEach(function(p) {
var v = {x: p.x - result.center.x, y: p.y - result.center.y};
var len2 = v.x*v.x + v.y*v.y;
result.residue += radius2 - len2;
var len = Math.sqrt(len2);
result.distances.push(len - result.radius);
result.projections.push({
x: result.center.x + v.x*result.radius/len,
y: result.center.y + v.y*result.radius/len
});
});
return result;
}
return my;
}());
|
JavaScript
| 0.003219 |
@@ -1751,16 +1751,58 @@
sidue: 0
+,%0A computationTime: performance.now()
%0A %7D;%0A
@@ -3384,24 +3384,98 @@
%0A %7D);%0A%0A
+ result.computationTime = performance.now() - result.computationTime;%0A%0A
return r
|
fc2207a38a31e8c239c8ce624e5a289c702fb8a9
|
use visible option instead
|
lib/atom-ternjs-reference.js
|
lib/atom-ternjs-reference.js
|
'use babel';
const ReferenceView = require('./atom-ternjs-reference-view');
import manager from './atom-ternjs-manager';
import emitter from './atom-ternjs-events';
import fs from 'fs';
import {uniq} from 'underscore-plus';
import path from 'path';
import {TextBuffer} from 'atom';
import {
disposeAll,
openFileAndGoTo,
focusEditor
} from './atom-ternjs-helper';
import navigation from './services/navigation';
class Reference {
constructor() {
this.disposables = [];
this.references = [];
this.referenceView = null;
this.referencePanel = null;
this.hideHandler = this.hide.bind(this);
this.findReferenceListener = this.findReference.bind(this);
}
init() {
this.referenceView = new ReferenceView();
this.referenceView.initialize(this);
this.referencePanel = atom.workspace.addBottomPanel({
item: this.referenceView,
priority: 0
});
this.referencePanel.hide();
atom.views.getView(this.referencePanel).classList.add('atom-ternjs-reference-panel', 'panel-bottom');
emitter.on('reference-hide', this.hideHandler);
this.registerCommands();
}
registerCommands() {
this.disposables.push(atom.commands.add('atom-text-editor', 'atom-ternjs:references', this.findReferenceListener));
}
goToReference(idx) {
const ref = this.references.refs[idx];
if (navigation.set(ref)) {
openFileAndGoTo(ref.start, ref.file);
}
}
findReference() {
const editor = atom.workspace.getActiveTextEditor();
const cursor = editor.getLastCursor();
if (
!manager.client ||
!editor ||
!cursor
) {
return;
}
const position = cursor.getBufferPosition();
manager.client.update(editor).then((data) => {
manager.client.refs(atom.project.relativizePath(editor.getURI())[1], {line: position.row, ch: position.column}).then((data) => {
if (!data) {
atom.notifications.addInfo('No references found.', { dismissable: false });
return;
}
this.references = data;
for (let reference of data.refs) {
reference.file = reference.file.replace(/^.\//, '');
reference.file = path.resolve(atom.project.relativizePath(manager.server.projectDir)[0], reference.file);
}
data.refs = uniq(data.refs, (item) => {
return JSON.stringify(item);
});
data = this.gatherMeta(data);
this.referenceView.buildItems(data);
this.referencePanel.show();
});
});
}
gatherMeta(data) {
for (let item of data.refs) {
const content = fs.readFileSync(item.file, 'utf8');
const buffer = new TextBuffer({ text: content });
item.position = buffer.positionForCharacterIndex(item.start);
item.lineText = buffer.lineForRow(item.position.row);
buffer.destroy();
}
return data;
}
hide() {
if (
!this.referencePanel ||
!this.referencePanel.visible
) {
return;
}
this.referencePanel.hide();
focusEditor();
}
show() {
this.referencePanel.show();
}
destroy() {
emitter.off('reference-hide', this.hideHandler);
disposeAll(this.disposables);
this.disposables = [];
this.references = [];
this.referenceView && this.referenceView.destroy();
this.referenceView = null;
this.referencePanel && this.referencePanel.destroy();
this.referencePanel = null;
}
}
export default new Reference();
|
JavaScript
| 0 |
@@ -895,47 +895,36 @@
y: 0
+,
%0A
-%7D);%0A%0A this.referencePanel.hide(
+ visible: false%0A %7D
);%0A%0A
|
7b513b5f9a44d867a4377931f052601c69b04e4e
|
add check for split before executing
|
src/WebComponents/build/boot-lite.js
|
src/WebComponents/build/boot-lite.js
|
/**
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
window.WebComponents = window.WebComponents || {};
// process flags
(function(scope){
// import
var flags = scope.flags || {};
var file = 'webcomponents-lite.js';
var script = document.querySelector('script[src*="' + file + '"]');
// Flags. Convert url arguments to flags
if (!flags.noOpts) {
// from url
location.search.slice(1).split('&').forEach(function(option) {
var parts = option.split('=');
var match;
if (parts[0] && (match = parts[0].match(/wc-(.+)/))) {
flags[match[1]] = parts[1] || true;
}
});
// from script
if (script) {
for (var i=0, a; (a=script.attributes[i]); i++) {
if (a.name !== 'src') {
flags[a.name] = a.value || true;
}
}
}
// log flags
if (flags.log) {
var parts = flags.log.split(',');
flags.log = {};
parts.forEach(function(f) {
flags.log[f] = true;
});
} else {
flags.log = {};
}
}
// Determine default settings.
// If any of these flags match 'native', then force native ShadowDOM; any
// other truthy value, or failure to detect native
// ShadowDOM, results in polyfill
flags.shadow = (flags.shadow || flags.shadowdom || flags.polyfill);
if (flags.shadow === 'native') {
flags.shadow = false;
} else {
flags.shadow = flags.shadow || !HTMLElement.prototype.createShadowRoot;
}
// forward flags
if (flags.register) {
window.CustomElements = window.CustomElements || {flags: {}};
window.CustomElements.flags.register = flags.register;
}
// export
scope.flags = flags;
})(window.WebComponents);
|
JavaScript
| 0 |
@@ -1308,16 +1308,35 @@
lags.log
+ && flags.log.split
) %7B%0A
|
1872893889f78909abcff39e50c6766999e2d348
|
add comments
|
app/lib/assert.js
|
app/lib/assert.js
|
import { assert } from 'chai';
// Add custom assertion methods
Object.assign(assert, {
state(expected, actual) {
assert(actual.is(expected), `unexpected state`);
},
isIntegerGt0(val) {
assert(typeof val === 'number' && val > 0 && val % 1 === 0, "must be integer greater than zero");
},
isNonEmptyString(str) {
assert(typeof str === 'string' && str.length > 0, "must be non-empty string");
}
});
export default assert;
|
JavaScript
| 0 |
@@ -90,90 +90,98 @@
%0A%09%0A%09
-state(expected, actual) %7B%0A%09%09assert(actual.is(expected), %60unexpected state%60);%0A%09%7D,%0A%09
+/**%0A%09 * Assert that something is an integer greater than zero.%0A%09 * @param %7BMixed%7D val%0A%09 */
%0A%09is
@@ -303,16 +303,98 @@
);%0A%09%7D,%0A%0A
+%09/**%0A%09 * Assert that something is a non-empty string.%0A%09 * @param %7BMixed%7D val%0A%09 */%0A
%09isNonEm
|
cc33ea612f5b15ad24543ff820dc9c34c0482f36
|
Revert "updated functional sort"
|
app/usedCarsStuff.js
|
app/usedCarsStuff.js
|
'use strict';
//defining module
var usedCarsStuff = angular.module('usedCarsStuff',[]);
//defining controllers
usedCarsStuff.controller('UsedCarsController', function UsedCarsController($scope){
var carsList = $scope.cars = [
{
make: 'Toyota',
model: 'Corolla',
year: "2009",
mileage: "90123"
},
{
make: 'Honda',
model: 'Civic',
year: "2010",
mileage: "85213"
},
{
make: 'Honda',
model: 'Civic',
year: "2011",
mileage: "85213"
},
{
make: 'Honda',
model: 'Civic',
year: "2012",
mileage: "85213"
},
{
make: 'Honda',
model: 'Civic',
year: "2013",
mileage: "85213"
}
];
var lowerMileage = $scope.lowerMileage;
$scope.compareCarMileage = function(lowMiles,highMiles){
$scope.sortedCarsList = [];
for (var x = 0; x < carsList.length; x++)
{
console.log(x);
if (carsList[x].mileage>lowMiles && carsList[x].mileage<highMiles)
{
$scope.sortedCarsList.push(carsList[x]);
}
}
};
});
|
JavaScript
| 0 |
@@ -665,24 +665,72 @@
Mileage;%0A%09%0A%09
+var sortedCarsList = $scope.sortedCarsList = %5B%5D;
%0A%09%0A%09%0A%09$scope
@@ -790,37 +790,8 @@
%09%0A%09%0A
-%09$scope.sortedCarsList = %5B%5D;%0A
%09for
@@ -836,29 +836,8 @@
%0A%09%7B%0A
-%09%09console.log(x);%0A%09%09%0A
%09%09if
@@ -908,23 +908,16 @@
%0A%09%09%7B%0A%09%09%09
-$scope.
sortedCa
@@ -946,12 +946,8 @@
%5D);%0A
-%09%09%09%0A
%09%09%7D%0A
@@ -951,16 +951,53 @@
%09%7D%0A%09%7D%0A%09%0A
+%09console.log($scope.sortedCarsList);%0A
%09%0A%09%7D;%0A%09%0A
|
0ca611319080c5b60d897a9f29e992bcef323693
|
Add todo for sort order constants
|
packages/table/src/SortOrder.js
|
packages/table/src/SortOrder.js
|
/**
* Sort order for the Table
*/
const SortOrder = {
/**
* Sort data in ascending order
*/
ASC: "asc",
/**
* Sort data in descending order
*/
DESC: "desc"
};
export default SortOrder;
|
JavaScript
| 0.000001 |
@@ -25,16 +25,95 @@
e Table%0A
+ * @todo Rename to %60sortOrder%60. The object is neither a component nor a class.%0A
*/%0Acons
|
9cd02ce09cbe59d5140f06877f215cae721a3bce
|
Make the reduce a bit clearer
|
src/js/options.js
|
src/js/options.js
|
let Utils = require("./lib/utils.js");
function saveOptions() {
chrome.storage.local.set({
closeTab: document.querySelector("#close_tab").checked,
pinTab: document.querySelector("#pin_tab").checked,
autoRefresh: document.querySelector("#autorefresh_tab").checked,
newTab: document.querySelector("#newtab_tab").checked,
showDomain: document.querySelector("#show_domain_tab").checked,
});
}
function restoreOptions() {
chrome.storage.local.get(["closeTab", "pinTab", "autoRefresh", "newtab", "showDomain"], res => {
let closetab = res.closeTab;
let pintab = res.pinTab;
let autorefresh = res.autoRefresh;
let newtab = res.newTab;
let showdomain = res.showDomain;
document.querySelector("#close_tab").checked = closetab || false;
document.querySelector("#pin_tab").checked = pintab || false;
document.querySelector("#autorefresh_tab").checked = autorefresh || false;
document.querySelector("#newtab_tab").checked = newtab || false;
document.querySelector("#show_domain_tab").checked = showdomain || false;
});
}
document.addEventListener("DOMContentLoaded", restoreOptions);
document.querySelector("form").addEventListener("submit", saveOptions);
// tab backup and restore
document.getElementById("backup_tabs").onclick = function() {
chrome.tabs.query({}, function(tabs) {
download(JSON.stringify(tabs, null, " "));
});
};
document.getElementById("restore_tabs").onclick = function() {
let fileinput = document.getElementById("restore_tabs_file");
fileinput.addEventListener("change", function () {
let filelist = this.files;
var reader = new FileReader();
reader.onload = (function() { return function(e) {
let restoredata = e.target.result.replace(/^[^,]*,/g, "");
try{
let data = window.atob(restoredata);
let json = JSON.parse(data);
if (json) {
let wins = Utils.groupByWindow(json);
for (let [win, tabs] of wins) {
let links = getLinksFromTabs(tabs);
console.log(links);
// chrome.windows.create({ url: links });
}
}
} catch(e){
console.log(e);
}
}; })();
reader.readAsDataURL(filelist[0]);
}, false);
fileinput.click();
};
// returns an array of tabs for a set of tabs
// input [tabs]
// returns [urls]
function getLinksFromTabs(tabs) {
return tabs.reduce((memo, cur) => { memo = memo || []; memo.push(cur.url); return memo; }, []);
}
function download(data) {
var blob = new Blob([data], {type: "text/json"});
var url = window.URL.createObjectURL(blob);
chrome.downloads.download({url:url, filename:"tabsbackup.json", conflictAction:"uniquify"}, function(downloadId) {
// console.log(downloadId);
});
}
|
JavaScript
| 0.000113 |
@@ -2414,16 +2414,20 @@
ur) =%3E %7B
+%0A
memo =
@@ -2437,16 +2437,20 @@
o %7C%7C %5B%5D;
+%0A
memo.pu
@@ -2461,16 +2461,20 @@
ur.url);
+%0A
return
@@ -2478,16 +2478,18 @@
rn memo;
+%0A
%7D, %5B%5D);
|
af314bd108f03fadd055c956fbddf1b00d258ae0
|
add helper function for adding new Aura component
|
node_webkit/auraext/nestedview.js
|
node_webkit/auraext/nestedview.js
|
/* backbone nested view extension
inspired from
http://blog.shinetech.com/2012/10/10/efficient-stateful-views-with-backbone-js-part-1/
*/
define(['jquery','underscore','backbone'],function($,_,Backbone){
var nestedView=Backbone.View.extend({
$yase: function(){ //promise interface
return this.sandbox.$yase.apply(this,arguments)
},
_children:[],
init:function() { //maybe removed if aura provide a hook..
this.$el.data('hview',this);
},
closeChildren:function() {
for (var i in this._children) {
var C=this._children[i];
if (C.destroy) C.close(); else (C.remove());
}
},
addChildren:function(classname) {
//automatic add all child view, call this after html()
classname=classname||'data-aura-widget'
var children=this.$("div."+classname);
this.closechildren();
for (var i=0;i<children.length;i++) {
var hview=children[i].data(hview);
this.addchild(hview);
}
},
_addChild:function(child) {
//TODO check if pure dom object
if (child instanceof $) {
var hview=child.data('hview');
if (!hview) { //handle <div><div data-aura-widget></div></div>
hview=child.find("[data-aura-widget]").data('hview');
}
this.addChild(hview);
} else {
child._parent=this;
if (_(this._children).indexOf(child) === -1) {
this._children.push(child);
}
}
return child;
},
addChild: function(child) {
if (!child)return;
if (!this._children.length) {
//work around for first child is not initialized immediately
setTimeout(this._addChild.bind(this,child),100);
} else {
this._addChild(child);
}
},
// Deregisters a subview that has been manually closed by this view
removeChild: function(child) {
this._children = _(this._children).without(child);
},
close:function() {
if (this.ondestroy) this.ondestroy();
if (this._parent) this._parent.removeChild(this);
this.remove();
},
receive:{},
//send command to all children
send:function() {
for (var i in this._children) {
var C=this._children[i];
if (typeof C.receive=='function'){
C.receive(arguments);
} else { // events-like comand map
var func=C.receive[arguments[0]];
var remain=Array.prototype.slice.apply(arguments,[1]);
if (func) func.apply(C,remain);
//else console.warn('cannot send '+arguments[0]);
}
}
return this;
},
sendAll:function() { //send to all descendant
for (var i in this._children) {
var C=this._children[i];
if (typeof C.receive=='function'){
C.receive(arguments);
} else { // events-like comand map
var func=C.receive[arguments[0]];
var remain=Array.prototype.slice.apply(arguments,[1]);
if (func) func.apply(C,remain);
//else console.warn('cannot send '+arguments[0]);
}
C.send.apply(C,arguments);
}
return this;
}
});
return nestedView;
});
|
JavaScript
| 0 |
@@ -131,17 +131,97 @@
part-1/%0A
+http://bardevblog.wordpress.com/2012/12/13/re-learning-backbone-js-nested-views/
%0A
-
*/%0Adefin
@@ -1126,24 +1126,536 @@
%09%7D%0A %7D,%0A
+ newAuraComponent:function(componentName,opts)%7B%0A if (!componentName) return;%0A var attributes='%22';%0A for (var i in opts) %7B%0A attributes+=' '+i+'=%22'+opts%5Bi%5D+'%22';%0A %7D%0A var $child=$('%3Cdiv%3E%3Cdiv data-aura-widget=%22'+componentName+%0A attributes+'%3E%3C/div%3E%3C/div%3E');%0A this.$(%22#children%22).append($child);%0A if (this.sandbox) this.sandbox.start($child); //for Aura%0A this.addChild($child);%0A %7D, %0A
_addCh
@@ -2526,17 +2526,17 @@
,child),
-1
+2
00);
|
56cd4571e501657292ca598df6ba156ddbd7c7d4
|
add more js components to public plugin api (via #960)
|
allure-generator/src/main/javascript/pluginApi.js
|
allure-generator/src/main/javascript/pluginApi.js
|
import pluginsRegistry from './utils/pluginsRegistry';
import TreeLayout from './layouts/tree/TreeLayout';
import AppLayout from './layouts/application/AppLayout';
import WidgetStatusView from './components/widget-status/WidgetStatusView';
import {getSettingsForPlugin} from './utils/settingsFactory';
import settings from './utils/settings';
window.allure = {
api: pluginsRegistry,
getPluginSettings(name, defaults) {
return getSettingsForPlugin(name, defaults);
},
settings: settings,
components: {
AppLayout: AppLayout,
TreeLayout: TreeLayout,
WidgetStatusView: WidgetStatusView
}
};
|
JavaScript
| 0 |
@@ -233,16 +233,155 @@
sView';%0A
+import TrendChartView from './components/graph-trend-chart/TrendChartView';%0Aimport TrendCollection from './data/trend/TrendCollection.js';%0A
import %7B
@@ -766,16 +766,123 @@
atusView
+,%0A TrendChartView: TrendChartView%0A %7D,%0A collections: %7B%0A TrendCollection: TrendCollection
%0A %7D%0A%7D
|
a7665559d3546895f71e07c5d5bddbb71a3ccee5
|
Remove Rollup options that are unnecessary now that `@web/test-runner-mocha` is no longer bundled.
|
packages/tests/rollup.config.js
|
packages/tests/rollup.config.js
|
import commonjs from '@rollup/plugin-commonjs';
import {nodeResolve} from '@rollup/plugin-node-resolve';
export default [
{
input: 'chai.js',
output: {
file: 'chai-bundle.js',
format: 'es',
},
plugins: [
commonjs(),
nodeResolve({
preferBuiltins: false,
}),
],
},
{
input: 'core-js_url.js',
output: {
file: 'core-js_url-bundle.js',
format: 'es',
},
plugins: [
commonjs(),
nodeResolve({
preferBuiltins: false,
}),
],
makeAbsoluteExternalsRelative: false,
external: ['/__web-dev-server__web-socket.js'],
},
];
|
JavaScript
| 0 |
@@ -535,102 +535,8 @@
%5D,%0A
- makeAbsoluteExternalsRelative: false,%0A external: %5B'/__web-dev-server__web-socket.js'%5D,%0A
%7D,
|
f15519ce40bf66324ec2b04f2ee2ff5d1eb190a5
|
Attach version to aws-sdk
|
package.js
|
package.js
|
Package.describe({
summary: "S3 signed uploads for meteorjs.",
version: "0.0.1",
git: "https://github.com/jimmiebtlr/s3-signed-upload.git"
});
Package.on_use(function(api){
api.use(['mrt:aws-sdk'], 'server');
api.use(['aldeed:simple-schema']);
api.export(['uploadFile'],'client');
api.export(['S3SignedUploadTmp'],'server');
api.add_files([
'client.js'
], 'client');
api.add_files([
'server.js'
], 'server');
});
|
JavaScript
| 0 |
@@ -200,12 +200,16 @@
-sdk
-'%5D,
[email protected]',
'ser
@@ -240,17 +240,17 @@
d:simple
--
+.
schema'%5D
|
6c72e4e74fe9860ec670314cbb83169387161b33
|
remove the heroImage condition (required)
|
models/Post.js
|
models/Post.js
|
const get = require('lodash').get
const config = require('../config')
const gcsConfig = get(config, [ 'options', 'gcs config' ], {})
var keystone = require('arch-keystone');
var transform = require('model-transform');
var moment = require('moment');
var Types = keystone.Field.Types;
var Post = new keystone.List('Post', {
autokey: { path: 'slug', from: 'name', unique: true, fixed: true },
track: true,
defaultSort: '-publishedDate',
});
Post.add({
name: { label: '網址名稱(英文)', type: String, required: true, unique: true },
title: { label: '標題', type: String, require: true, default: 'untitled' },
subtitle: { label: '副標', type: String, require: false },
state: { label: '狀態', type: Types.Select, options: 'draft, published, scheduled, archived, invisible', default: 'draft', index: true },
publishedDate: { label: '發佈日期', type: Types.Datetime, index: true, utc: true, default: Date.now, dependsOn: { '$or': { state: [ 'published', 'scheduled' ] } }},
sections: { label: '分區', type: Types.Relationship, ref: 'Section', many: true },
categories: { label: '分類', type: Types.Relationship, ref: 'PostCategory', many: true },
writers: { label: '作者', type: Types.Relationship, ref: 'Contact', many: true },
photographers: { label: '攝影', type: Types.Relationship, ref: 'Contact', many: true },
camera_man: { label: '影音', type: Types.Relationship, ref: 'Contact', many: true },
designers: { label: '設計', type: Types.Relationship, ref: 'Contact', many: true },
engineers: { label: '工程', type: Types.Relationship, ref: 'Contact', many: true },
vocals: { label: '主播', type: Types.Relationship, ref: 'Contact', many: true },
extend_byline: { label: '作者(其他)', type: String, require: false },
heroVideo: { label: 'Leading Video', type: Types.Relationship, ref: 'Video' },
heroImage: { label: '首圖', type: Types.ImageRelationship, ref: 'Image', required: true },
heroCaption: { label: '首圖圖說', type: String, require: false },
heroImageSize: { label: '首圖尺寸', type: Types.Select, options: 'extend, normal, small', default: 'normal', dependsOn: { heroImage: {'$regex': '.+/i'}}},
style: { label: '文章樣式', type: Types.Select, options: 'article, wide, projects, photography, script, campaign, readr', default: 'article', index: true },
brief: { label: '前言', type: Types.Html, wysiwyg: true, height: 150 },
content: { label: '內文', type: Types.Html, wysiwyg: true, height: 400 },
topics: { label: '專題', type: Types.Relationship, ref: 'Topic' },
topics_ref: { type: Types.Relationship, ref: 'Topic', hidden: true },
tags: { label: '標籤', type: Types.Relationship, ref: 'Tag', many: true },
albums: { label: '專輯', type: Types.Relationship, ref: 'Album', many: true },
titleColor: { label: '標題模式', type: Types.Select, options: 'light, dark', default: 'light' },
audio: { label: '語音素材', type: Types.Relationship, ref: 'Audio' },
relateds: { label: '相關文章', type: Types.Relationship, ref: 'Post', many: true },
og_title: { label: 'FB分享標題', type: String, require: false},
og_description: { label: 'FB分享說明', type: String, require: false},
og_image: { label: 'FB分享縮圖', type: Types.ImageRelationship, ref: 'Image' },
mobileImage: { label: '手機首圖', type: Types.ImageRelationship, ref: 'Image' },
isFeatured: { label: '置頂', type: Boolean, index: true },
isAdvertised: { label: '廣告文案', type: Boolean, index: true },
hiddenAdvertised: { label: 'google廣告違規', type: Boolean, default: false },
isCampaign: { label: '活動', type: Boolean, index: true },
isAdult: { label: '18禁', type: Boolean, index: true },
lockJS: { label: '鎖定右鍵', type: Boolean, index: true },
isAudioSiteOnly: { label: '僅用於語音網站', type: Boolean, index: true },
device: { label: '裝置', type: Types.Select, options: 'all, web, app', default: 'all', index: true },
adTrace: { label: '追蹤代碼', type: Types.Textarea },
createTime: { type: Types.Datetime, default: Date.now, utc: true },
});
Post.relationship({ ref: 'Post', refPath: 'relateds' });
Post.schema.virtual('content.full').get(() => {
return this.content.extended || this.content.brief;
});
transform.toJSON(Post);
Post.defaultColumns = 'title, name, state|20%, author|20%, categories|20%, publishedDate|20%';
Post.schema.pre('remove', function(next) {
Post.model.findOneAndUpdate({ '_id': this._id}, { 'state': 'archived'}, function (err, doc) {
if (err) {
console.log(err);
} else {
ttsGenerator.delFileFromBucket(gcsConfig, this._id)
.then(() => {
console.log('Del post aud successfully.');
next();
})
.catch(err => {
console.error('Del post aud in fail.');
console.error(err);
next();
})
}
})
});
Post.schema.pre('save', function(next) {
if ((this.state == 'scheduled' && (moment(this.publishedDate) < moment())) || (this.state == 'published' && (moment(this.publishedDate) > moment().add(10, 'm')))) {
var err = new Error("You can not schedule a data before now.");
next(err);
}
this.updatedBy = this._req_user.name
if ((this.state == 'published' || this.state == 'scheduled') && ( this._req_user.role == 'author' || this._req_user.role == 'contributor')) {
var err = new Error("You don't have the permission");
next(err);
}
// check the heroImage
if (this.heroImage == '' && this.heroVideo == '') {
var err = new Error("You have to assign the heroImage");
next(err);
}
// Topics part
if (this.topics) {
this.topics_ref = this.topics;
}
next();
});
const ttsGenerator = require('../lib/ttsGenerator');
Post.schema.post('save', doc => {
const postId = get(doc, '_id', Date.now().toString());
console.log(JSON.stringify(doc));
console.log(`Post ${postId} saved!`);
})
Post.editorController = true;
Post.editorControllerTtl = 600000;
Post.notifyBeforeLeave = true;
Post.preview = 'https://www.mirrormedia.mg/story';
Post.previewId = 'slug'
Post.register();
|
JavaScript
| 0.000001 |
@@ -1862,32 +1862,16 @@
'Image'
-, required: true
%7D,%0A he
|
9300e5ea099ae9c2fe7d41b0c9ef809280ed7922
|
Fix double invocation by merging signal/scale event streams. (#1672)
|
packages/vega-parser/src/parsers/update.js
|
packages/vega-parser/src/parsers/update.js
|
import parseExpression from './expression';
import parseStream from './stream';
import {Scope, View} from '../util';
import {selector} from 'vega-event-selector';
import {array, error, extend, isString, stringValue} from 'vega-util';
var preamble = 'var datum=event.item&&event.item.datum;';
export default function(spec, scope, target) {
var events = spec.events,
update = spec.update,
encode = spec.encode,
sources = [],
value = '', entry;
if (!events) {
error('Signal update missing events specification.');
}
// interpret as an event selector string
if (isString(events)) {
events = selector(events, scope.isSubscope() ? Scope : View);
}
// separate event streams from signal updates
events = array(events).filter(function(stream) {
if (stream.signal || stream.scale) {
sources.push(stream);
return 0;
} else {
return 1;
}
});
// merge event streams, include as source
if (events.length) {
sources.push(events.length > 1 ? {merge: events} : events[0]);
}
if (encode != null) {
if (update) error('Signal encode and update are mutually exclusive.');
update = 'encode(item(),' + stringValue(encode) + ')';
}
// resolve update value
value = isString(update) ? parseExpression(update, scope, preamble)
: update.expr != null ? parseExpression(update.expr, scope, preamble)
: update.value != null ? update.value
: update.signal != null ? {
$expr: '_.value',
$params: {value: scope.signalRef(update.signal)}
}
: error('Invalid signal update specification.');
entry = {
target: target,
update: value
};
if (spec.force) {
entry.options = {force: true};
}
sources.forEach(function(source) {
scope.addUpdate(extend(streamSource(source, scope), entry));
});
}
function streamSource(stream, scope) {
return {
source: stream.signal ? scope.signalRef(stream.signal)
: stream.scale ? scope.scaleRef(stream.scale)
: parseStream(stream, scope)
};
}
|
JavaScript
| 0 |
@@ -448,25 +448,32 @@
-value = '', entry
+entry = %7Btarget: target%7D
;%0A%0A
@@ -767,16 +767,21 @@
nts)
+%0A
.filter(
func
@@ -780,41 +780,14 @@
ter(
-function(stream) %7B%0A if (stream
+s =%3E s
.sig
@@ -798,29 +798,18 @@
%7C%7C s
-tream
.scale
-) %7B%0A
+ ? (
sour
@@ -822,72 +822,130 @@
sh(s
-tream);%0A return 0;%0A %7D else %7B%0A return 1;%0A %7D%0A %7D);
+), 0) : 1);%0A%0A // merge internal operator listeners%0A if (sources.length %3E 1) %7B%0A sources = %5BmergeSources(sources)%5D;%0A %7D
%0A%0A
@@ -1272,20 +1272,27 @@
value%0A
-valu
+entry.updat
e = isSt
@@ -1646,64 +1646,8 @@
);%0A%0A
- entry = %7B%0A target: target,%0A update: value%0A %7D;%0A%0A
if
@@ -1974,24 +1974,24 @@
ream.scale)%0A
-
:
@@ -2020,12 +2020,166 @@
ope)%0A %7D;%0A%7D%0A
+%0Afunction mergeSources(sources) %7B%0A return %7B%0A signal: '%5B'%0A + sources.map(s =%3E s.scale ? 'scale(%22' + s.scale + '%22)' : s.signal)%0A + '%5D'%0A %7D;%0A%7D%0A
|
32de855b5a8533b710ed7ed666f22c979dca0c6b
|
update to latest space:event-sourcing version
|
package.js
|
package.js
|
Package.describe({
name: 'space:accounts',
version: '0.1.0',
summary: 'Accounts module for Space applications',
git: 'https://github.com/meteor-space/accounts.git',
documentation: 'README.md'
});
Package.onUse(function(api) {
api.versionsFrom('1.0');
api.use([
'coffeescript',
'mongo',
'accounts-password',
'check',
'space:[email protected]',
]);
api.addFiles([
'source/server/module.coffee',
'source/server/commands.coffee',
'source/server/events.coffee',
// USERS
'source/server/users/user.coffee',
'source/server/users/users-router.coffee'
], 'server');
});
Package.onTest(function(api) {
api.use([
'coffeescript',
'mongo',
'accounts-password',
'space:accounts',
'practicalmeteor:[email protected]',
'space:[email protected]'
]);
api.addFiles([
'tests/test-app.coffee',
'tests/meteor-users-dao.unit.coffee'
], 'server');
});
|
JavaScript
| 0 |
@@ -374,11 +374,11 @@
g@1.
-2.3
+3.0
',%0A
|
f90b5b30e48d470591e871164b0fa218c0ee37ef
|
Update webpack, use terser plugin
|
webpack.config.babel.js
|
webpack.config.babel.js
|
import path from 'path'
import AssetsPlugin from 'assets-webpack-plugin'
import CopyPlugin from 'copy-webpack-plugin'
import MiniCssExtractPlugin from 'mini-css-extract-plugin'
import OptimizeCssAssetsPlugin from 'optimize-css-assets-webpack-plugin'
import UglifyJsPlugin from 'uglifyjs-webpack-plugin'
const APP_FILE_NAME = 'app'
const VENDORS_FILE_NAME = 'lib'
const PATH_SRC = './app'
const PATH_DIST = './static'
const NODE_MODULES_NAME = 'node_modules'
function getPath(filePath) {
return path.resolve(__dirname, filePath)
}
module.exports = (env, options) => {
const isDevelopment = (options.mode === 'development')
const filename = isDevelopment ? '[name]' : '[name]-[contenthash:4]'
const exclude = new RegExp(NODE_MODULES_NAME)
return {
entry: {
[APP_FILE_NAME]: getPath(`${PATH_SRC}/scripts/index.js`),
},
output: {
filename: `${filename}.js`,
path: getPath(PATH_DIST),
},
resolve: {
modules: [NODE_MODULES_NAME],
},
module: {
rules: [
{
test: /\.js$/,
exclude,
enforce: 'pre',
loader: 'eslint-loader',
},
{
test: /\.js$/,
exclude,
use: {
loader: 'babel-loader',
},
},
{
test: /\.scss$/,
exclude,
use: [
{
loader: MiniCssExtractPlugin.loader,
},
{
loader: 'css-loader',
},
{
loader: 'postcss-loader',
},
{
loader: 'sass-loader',
options: {
indentedSyntax: false,
sourceMap: isDevelopment,
},
},
],
},
],
},
optimization: {
minimizer: [
new UglifyJsPlugin({
cache: true,
parallel: true,
sourceMap: isDevelopment,
}),
new OptimizeCssAssetsPlugin(),
],
splitChunks: {
cacheGroups: {
commons: {
test: new RegExp(NODE_MODULES_NAME),
chunks: 'all',
name: VENDORS_FILE_NAME,
},
},
},
},
devtool: isDevelopment ? 'cheap-module-source-map' : undefined,
plugins: [
new AssetsPlugin(),
new CopyPlugin([{
flatten: true,
from: getPath(`${PATH_SRC}/images/*`),
to: getPath(PATH_DIST),
}]),
new MiniCssExtractPlugin({
filename: `${filename}.css`,
}),
],
}
}
|
JavaScript
| 0 |
@@ -251,24 +251,22 @@
%0Aimport
-UglifyJs
+Terser
Plugin f
@@ -274,16 +274,14 @@
om '
-uglifyjs
+terser
-web
@@ -1650,29 +1650,112 @@
-indentedSyntax: false
+sassOptions: %7B%0A outputStyle: isDevelopment ? 'nested' : 'compressed',%0A %7D
,%0A
@@ -1921,73 +1921,22 @@
new
-UglifyJsPlugin(%7B%0A cache: true,%0A parallel: true,
+TerserPlugin(%7B
%0A
@@ -2380,11 +2380,33 @@
gin(
+%7B%0A patterns:
%5B%7B%0A
+
@@ -2424,16 +2424,18 @@
: true,%0A
+
@@ -2481,16 +2481,18 @@
+
to: getP
@@ -2511,16 +2511,18 @@
T),%0A
+
%7D%5D
),%0A
@@ -2517,16 +2517,25 @@
%7D%5D
+,%0A %7D
),%0A
|
a224a01ebb95b7500154696bcdd7b67e81a30d41
|
Use pool.query in Spot model
|
models/Spot.js
|
models/Spot.js
|
const utils = require('../utils');
const attributes = ['id', 'open', 'challengedCount'];
module.exports = class Spot {
constructor(id, open, challengedCount) {
this._id = id;
this._open = open;
this._challengedCount = challengedCount;
}
static get attributes() {
return attributes;
}
static get idName() {
return 'id';
}
static get tableName() {
return 'spots';
}
// true is open, false is closed
static setOpenClose(spotId, open) {
return new Promise((resolve, reject) => {
const client = utils.db.createClient();
const queryString = 'UPDATE spots SET open = $1 WHERE id = $2';
client.connect();
client.on('error', (err) => reject(err));
const query = client.query(queryString, [open, spotId]);
query.on('end', () => {
client.end();
resolve();
});
query.on('error', (err) => {
client.end();
reject(err);
});
});
}
get id() {
return this._id;
}
get challengedCount() {
return this._challengedCount;
}
get open() {
return this._open;
}
};
|
JavaScript
| 0 |
@@ -1,19 +1,20 @@
const
-utils
+%7B db %7D
= requi
@@ -540,230 +540,77 @@
nst
-client = utils.db.createClient();%0A const queryString = 'UPDATE spots SET open = $1 WHERE id = $2';%0A%0A client.connect();%0A client.on('error', (err) =%3E reject(err));%0A%0A const query = client.query(queryString
+sql = 'UPDATE spots SET open = $1 WHERE id = $2';%0A%0A db.query(sql
, %5Bo
@@ -626,178 +626,49 @@
Id%5D)
-;%0A
%0A
-query.on('end', () =%3E %7B%0A client.end();%0A
+.then(
resolve
-();
+)
%0A
-%7D);%0A%0A query.on('error', (err) =%3E %7B%0A client.end();%0A reject(err);%0A %7D
+.catch(reject
);%0A
|
5652b8d7c6749c3ab00703e6a2654b6ab53578da
|
Fix linting error.
|
assets/js/components/settings/SettingsActiveModule/Header.js
|
assets/js/components/settings/SettingsActiveModule/Header.js
|
/**
* Header component for SettingsActiveModule.
*
* Site Kit by Google, Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* External dependencies
*/
import PropTypes from 'prop-types';
import classnames from 'classnames';
import { useHistory, useParams } from 'react-router-dom';
/**
* WordPress dependencies
*/
import { Fragment, useCallback } from '@wordpress/element';
import { __, sprintf } from '@wordpress/i18n';
/**
* Internal dependencies
*/
import Data from 'googlesitekit-data';
import { CORE_MODULES } from '../../../googlesitekit/modules/datastore/constants';
import { EXPERIMENTAL_MODULES } from '../../dashboard-sharing/DashboardSharingSettings/constants';
import { Grid, Row, Cell } from '../../../material-components';
import Button from '../../Button';
import ModuleIcon from '../../ModuleIcon';
import Badge from '../../Badge';
import { trackEvent } from '../../../util';
import useViewContext from '../../../hooks/useViewContext';
const { useSelect } = Data;
export default function Header( { slug } ) {
const viewContext = useViewContext();
const history = useHistory();
const { moduleSlug } = useParams();
const isOpen = moduleSlug === slug;
const storeName = useSelect( ( select ) =>
select( CORE_MODULES ).getModuleStoreName( slug )
);
const adminReauthURL = useSelect( ( select ) =>
select( storeName )?.getAdminReauthURL?.()
);
const module = useSelect( ( select ) =>
select( CORE_MODULES ).getModule( slug )
);
const isGA4Connected = useSelect( ( select ) =>
select( CORE_MODULES ).isModuleConnected( 'analytics-4' )
);
const onHeaderClick = useCallback( () => {
history.push( `/connected-services${ isOpen ? '' : `/${ slug }` }` );
if ( isOpen ) {
return trackEvent(
`${ viewContext }_module-list`,
'close_module_settings',
slug
);
}
return trackEvent(
`${ viewContext }_module-list`,
'view_module_settings',
slug
);
}, [ history, isOpen, slug, viewContext ] );
const onActionClick = useCallback( ( event ) => event.stopPropagation(), [] );
if ( ! module ) {
return null;
}
const { name, connected } = module;
return (
<div
className={ classnames( 'googlesitekit-settings-module__header', {
'googlesitekit-settings-module__header--open': isOpen,
} ) }
id={ `googlesitekit-settings-module__header--${ slug }` }
type="button"
role="tab"
aria-selected={ isOpen }
aria-expanded={ isOpen }
aria-controls={ `googlesitekit-settings-module__content--${ slug }` }
to={ `/connected-services${ isOpen ? '' : `/${ slug }` }` }
onClick={ onHeaderClick }
onKeyDown={ onHeaderClick }
tabIndex="-1"
>
<Grid>
<Row>
<Cell
lgSize={ 6 }
mdSize={ 4 }
smSize={ 4 }
className="googlesitekit-settings-module__heading"
>
<ModuleIcon
slug={ slug }
size={ 24 }
className="googlesitekit-settings-module__heading-icon"
/>
<h3 className="googlesitekit-heading-4 googlesitekit-settings-module__title">
{ name }
</h3>
<div className="googlesitekit-settings-module__heading-badges">
{ EXPERIMENTAL_MODULES.includes( slug ) && (
<Badge
label={ __(
'Experimental',
'google-site-kit'
) }
hasLeftSpacing={ true }
/>
) }
{ 'thank-with-google' === slug && (
<Badge
label={ __( 'US Only', 'google-site-kit' ) }
hasLeftSpacing={ true }
/>
) }
</div>
</Cell>
<Cell
lgSize={ 6 }
mdSize={ 4 }
smSize={ 4 }
alignMiddle
mdAlignRight
>
{ connected &&
( slug !== 'analytics' || isGA4Connected ) && (
<p className="googlesitekit-settings-module__status">
{ __( 'Connected', 'google-site-kit' ) }
<span className="googlesitekit-settings-module__status-icon googlesitekit-settings-module__status-icon--connected" />
</p>
) }
{ connected &&
slug === 'analytics' &&
! isGA4Connected && (
<Fragment>
<Button
href={ adminReauthURL }
onClick={ onActionClick }
>
{ __(
'Connect Google Analytics 4',
'google-site-kit'
) }
</Button>
<span className="googlesitekit-settings-module__status-icon googlesitekit-settings-module__status-icon--not-connected" />
</Fragment>
) }
{ ! connected && (
<Fragment>
<Button
href={ adminReauthURL }
onClick={ onActionClick }
>
{ sprintf(
/* translators: %s: module name. */
__(
'Complete setup for %s',
'google-site-kit'
),
name
) }
</Button>
<span className="googlesitekit-settings-module__status-icon googlesitekit-settings-module__status-icon--not-connected" />
</Fragment>
) }
</Cell>
</Row>
</Grid>
</div>
);
}
Header.propTypes = {
slug: PropTypes.string.isRequired,
};
|
JavaScript
| 0.000001 |
@@ -2540,17 +2540,19 @@
allback(
-
+%0A%09%09
( event
@@ -2584,12 +2584,15 @@
n(),
- %5B%5D
+%0A%09%09%5B%5D%0A%09
);%0A%0A
|
fdf0f20282c27138f59c1d75a604f207ebe9f8a5
|
fix role migration of super users
|
db/migrate/2017-12-18T02-04-08-create-role.js
|
db/migrate/2017-12-18T02-04-08-create-role.js
|
define(function(require, exports, module) {
module.exports = mig =>{
mig.createTable({
name: 'Role',
fields: {
org_id: {type: "id"},
user_id: {type: "id"},
role: {type: "text"}
},
indexes: [{columns: ['user_id', 'org_id'], unique: true}]
});
mig.reversible({
add(db) {
db.query(`select * from "User"`).forEach(user => {
if (user.role === 'g') {
if (user._id !== 'guest')
db.query(`delete from "User" where _id = $1`, [user._id]);
} else {
db.query(
`insert into "Role" (_id, org_id, user_id, role) values ($1, $2, $1, $3)`, [
user._id, user.org_id, user.role
]
);
}
});
db.query('alter table "User" drop column org_id, drop column role');
},
revert(db) {throw new Error('revert not implemented')}
});
};
});
|
JavaScript
| 0 |
@@ -690,24 +690,51 @@
user._id,
+ user.role === 's' ? null :
user.org_id
|
384f408f53a4921672045ad7e9016b12068e43c0
|
Fix eslint error
|
app/assets/javascripts/actions/tickets_actions.js
|
app/assets/javascripts/actions/tickets_actions.js
|
import {
CREATE_REPLY,
DELETE_TICKET,
FETCH_TICKETS,
FILTER_TICKETS,
MESSAGE_KIND_REPLY,
RECEIVE_TICKETS,
SELECT_TICKET,
SET_MESSAGES_TO_READ,
SORT_TICKETS,
TICKET_STATUS_OPEN,
UPDATE_TICKET
} from '../constants/tickets';
import { STATUSES } from '../components/tickets/util';
import { API_FAIL } from '../constants/api';
import { ADD_NOTIFICATION } from '../constants';
import fetch from 'cross-fetch';
import moment from 'moment';
const getCsrf = () => document.querySelector("meta[name='csrf-token']").getAttribute('content');
export const notifyOfMessage = body => async (dispatch) => {
try {
const response = await fetch('/tickets/notify_owner', {
body: JSON.stringify(body),
credentials: 'include',
headers: {
'Content-Type': 'application/json',
'X-CSRF-Token': getCsrf()
},
method: 'POST'
});
if (!response.ok) {
const json = await response.json();
dispatch({ type: API_FAIL, data: { statusText: json.message } });
} else {
dispatch({
type: ADD_NOTIFICATION,
notification: {
message: 'Email was sent to the owner.',
type: 'success',
closable: true
}
});
}
} catch (error) {
const message = 'Email could not be sent.';
dispatch({ type: API_FAIL, data: { statusText: message } });
}
};
const sendReplyEmail = async (notificationBody, dispatch) => {
try {
const response = await fetch('/tickets/reply', {
body: JSON.stringify(notificationBody),
credentials: 'include',
headers: {
'Content-Type': 'application/json',
'X-CSRF-Token': getCsrf()
},
method: 'POST'
});
if (!response.ok) throw new Error();
} catch (error) {
const message = 'Message was created but email could not be sent.';
dispatch({ type: API_FAIL, data: { statusText: message } });
}
};
const createReplyRecord = (body, status) => {
return fetch('/td/tickets/replies', {
body: JSON.stringify({ ...body, read: true, status }),
credentials: 'include',
headers: {
'Content-Type': 'application/json',
'X-CSRF-Token': getCsrf()
},
method: 'POST'
})
.then(response => response.json());
};
export const createReply = (body, status, bcc_to_salesforce) => async (dispatch) => {
let notificationBody;
// Create the new reply record
try {
const message = await createReplyRecord(body, status);
notificationBody = {
sender_id: body.sender_id,
message_id: message.id,
bcc_to_salesforce
};
} catch (error) {
const message = 'Creation of message failed. Please try again.';
dispatch({ type: API_FAIL, data: { statusText: message } });
}
// Send the reply by email
if (body.kind === MESSAGE_KIND_REPLY) {
await sendReplyEmail(notificationBody, dispatch);
}
dispatch({ type: CREATE_REPLY });
};
export const readAllMessages = ticket => async (dispatch) => {
const unreadMessages = ticket.messages.some(message => !message.read);
if (!unreadMessages) return false;
const response = await fetch('/td/read_all_messages', {
body: JSON.stringify({ ticket_id: ticket.id }),
credentials: 'include',
headers: {
'Content-Type': 'application/json',
'X-CSRF-Token': getCsrf()
},
method: 'PUT'
});
const json = await response.json();
dispatch({ type: SET_MESSAGES_TO_READ, data: json });
};
const fetchSomeTickets = async (dispatch, page, batchSize = 100) => {
const offset = batchSize * page;
const response = await fetch(`/td/tickets?limit=${batchSize}&offset=${offset}`);
return response.json().then(({ tickets }) => {
dispatch({ type: RECEIVE_TICKETS, data: tickets });
});
};
// Fetch as many tickets as possible
export const fetchTickets = () => async (dispatch) => {
dispatch({ type: FETCH_TICKETS });
const batches = Array.from({ length: 10 }, (_el, index) => index);
// Ensures that each promise will run sequentially
return batches.reduce(async (previousPromise, batch) => {
await previousPromise;
return fetchSomeTickets(dispatch, batch);
}, Promise.resolve());
};
export const selectTicket = ticket => ({ type: SELECT_TICKET, ticket });
export const fetchTicket = id => async (dispatch) => {
const response = await fetch(`/td/tickets/${id}`);
const data = await response.json();
dispatch(selectTicket(data.ticket));
};
export const sortTickets = key => ({ type: SORT_TICKETS, key });
const updateTicket = async (id, ticket, dispatch) => {
const response = await fetch(`/td/tickets/${id}`, {
body: JSON.stringify(ticket),
credentials: 'include',
headers: {
'Content-Type': 'application/json',
'X-CSRF-Token': getCsrf()
},
method: 'PATCH'
});
const json = await response.json();
dispatch({ type: UPDATE_TICKET, id, data: json });
};
export const updateTicketStatus = (id, status) => (dispatch) => {
updateTicket(id, { status }, dispatch);
};
export const updateTicketOwner = (id, owner_id) => (dispatch) => {
updateTicket(id, { owner_id }, dispatch);
};
export const deleteTicket = id => async (dispatch) => {
await fetch(`/td/tickets/${id}`, {
credentials: 'include',
headers: {
'Content-Type': 'application/json',
'X-CSRF-Token': getCsrf()
},
method: 'DELETE'
});
dispatch({ type: DELETE_TICKET, id });
};
export const setTicketOwnersFilter = filters => ({ type: FILTER_TICKETS, filters: { owners: filters } });
export const setTicketStatusesFilter = filters => ({ type: FILTER_TICKETS, filters: { statuses: filters } });
export const setInitialTicketFilters = () => (dispatch, getState) => {
// Open tickets only
dispatch(setTicketStatusesFilter([{ value: TICKET_STATUS_OPEN, label: STATUSES[TICKET_STATUS_OPEN] }]));
// Owned by current user, or no one
const state = getState();
const currentUserId = state.currentUserFromHtml.id;
const [label, value] = state.admins.find(([_username, id]) => id === currentUserId);
const currentUserOption = { label, value };
const unassignedOption = { label: 'unassigned', value: null };
dispatch(setTicketOwnersFilter([currentUserOption, unassignedOption]));
};
|
JavaScript
| 0.000088 |
@@ -423,37 +423,8 @@
ch';
-%0Aimport moment from 'moment';
%0A%0Aco
|
4b97d9a4a9bde9c34dce7098fc85c2a3bfe6b041
|
Fix empty payload
|
server/api/accounts/create-token.js
|
server/api/accounts/create-token.js
|
'use strict';
const Account = require('../../models/account');
const createError = require('http-errors');
const bcrypt = require('bcrypt-as-promised');
const jwt = require('jsonwebtoken-as-promised');
function createToken (req, res, next) {
Account.findOne({ email: req.body.email })
.then(ensureAccount)
.then(compareHashes)
.then(generateToken)
.then(sendResponse)
.catch(onError)
;
function ensureAccount (account) {
if (!account) {
throw new createError.Forbidden();
}
return account;
}
function compareHashes (account) {
return bcrypt.compare(req.body.password, account.passwordHash);
}
function generateToken (account) {
const payload = {
id: account.id,
email: account.email,
profile: account.profile,
};
return jwt.sign(payload, req.app.locals.configuration.jwt.secret, req.app.locals.configuration.jwt.options);
}
function sendResponse (token) {
const jwt = {
access_token: token,
token_type: 'bearer'
};
res.status(201).json(jwt);
}
function onError (err) {
if (err && err.name === 'MismatchError') {
return next(new createError.Forbidden(err));
}
next(err);
}
}
module.exports = createToken;
|
JavaScript
| 0.999484 |
@@ -392,23 +392,20 @@
.catch(
-onError
+next
)%0A ;%0A%0A
@@ -636,16 +636,111 @@
ordHash)
+%0A .then(() =%3E account)%0A .catch(err =%3E %7B throw new createError.Forbidden(err); %7D)%0A
;%0A %7D%0A%0A
@@ -849,41 +849,8 @@
mail
-,%0A profile: account.profile,
%0A
@@ -1082,24 +1082,24 @@
er'%0A %7D;%0A%0A
+
res.stat
@@ -1124,160 +1124,8 @@
%0A %7D
-%0A%0A function onError (err) %7B%0A if (err && err.name === 'MismatchError') %7B%0A return next(new createError.Forbidden(err));%0A %7D%0A%0A next(err);%0A %7D
%0A%7D%0A%0A
|
324bb67fac3fc8e45586c20f2ff1a721319a973a
|
Add gameroom name to room
|
app/views/room.js
|
app/views/room.js
|
const h = require('virtual-dom/h');
module.exports = function (data) {
const {gameID, game} = data;
return h('div', {className: 'room'}, [
h('audio', {src: game.ended ? '/game-win.mp3' : '/8bit-love-machine.mp3', autoplay: true, loop: true}),
h('audio', {src: '/score-point.mp3', id: 'pointsound'}),
game.playing || game.ended ? null : h('div', {id: 'banner'}, [
h('a', {href: '/new-player/' + gameID}, 'Wanna play along?')
]),
game.playing || game.ended ? null : h('form', {id: 'setup', method: 'post', action: `/${gameID}`}, [
h('input', {type: 'number', name: 'max-score', min: '1', value: game.maxScore}),
h('button', {type: 'submit', disabled: Object.keys(game.players).length < 2}, 'Start')
]),
game.playing || game.ended ? h('div', {id: 'score-goal'}, `First to: ${game.maxScore}`) : null,
h('div', {id: 'players'}, [
h('ul', Object.keys(game.players).map(playerID => {
const player = game.players[playerID];
return h('li', {
style: {
backgroundColor: `rgb(${player.color[1]}, ${player.color[0]}, ${player.color[2]})`
},
className: game.ended ? game.winner === playerID ? 'won' : 'lost' : ''
}, [
game.playing || game.ended ?
h('p', player.name) :
h('input', {
style: `width: ${player.name.length}em;`,
type: 'text',
name: 'playerName',
value: player.name,
attributes: {
'data-id': playerID
}
}),
h('img', {src: player.type === 'nodemcu' ? '/nodemcu.png' : '/phone.png'}),
game.playing || game.ended ? h('span', String(player.score)) : null,
game.playing || game.ended ? null : h('button', {
className: 'leave',
attributes: {
'data-id': playerID
}
}, 'Kick player')
])
}))
]),
game.playing || game.ended ? null : ('ul', {id: 'idle-mcus'}, data.waitingNodeMCUs.map(nodeMCUID => {
return h('li', {
attributes: {
'data-id': nodeMCUID
}
}
), h('form', {action: `/join-mcu/`, method: 'POST'}, [
h('input', {type: 'hidden', value: nodeMCUID, name: 'mcuID'}),
h('input', {type: 'hidden', value: gameID, name: 'gameID'}),
h('button', {type: 'submit'}, `Add GameBox ${nodeMCUID} to game`)
])
}))
]);
};
|
JavaScript
| 0 |
@@ -441,32 +441,92 @@
long?')%0A %5D),%0A
+ game.playing %7C%7C game.ended ? null : h('h2', game.name),%0A
game.playing
|
438da8ec88d426de01f87ef36c09f2782de429ee
|
fix 'path reservation error'
|
package.js
|
package.js
|
Package.describe({
"name": "ergasti:pages",
"summary": "State of the art, out of the box Meteor pagination",
"version": "1.8.6",
"git": "https://github.com/mnzaki/meteor-pages"
});
Package.onUse(function(api){
api.versionsFrom("[email protected]")
api.use([
"meteor-platform",
"check",
"tracker",
"underscore",
"coffeescript",
"mongo",
"ejson"
]);
api.use("iron:[email protected]", ["client", "server"], { weak: true });
api.use([
"templating",
"spacebars",
"blaze",
"session"
], "client");
api.addFiles([
"lib/pages.coffee"
]);
api.addFiles([
"client/templates.html",
"client/controllers.coffee",
"client/main.css",
], "client");
api.addAssets([
"public/loader.gif"
], "client");
api.addAssets([
"public/loader.gif"
], ["client"]);
});
Package.onTest(function(api){
api.use([
"meteor-platform",
"coffeescript",
"alethes:pages"
]);
api.addFiles([
"tests/test_templates.html",
"tests/tests.coffee"
]);
});
|
JavaScript
| 0.000002 |
@@ -793,75 +793,8 @@
);%0A%0A
- api.addAssets(%5B%0A %22public/loader.gif%22%0A %5D, %22client%22);%0A%0A
|
fd1cf970b2b37e9bc3a600bb5bd43dc8856d4ba7
|
Update RivCrimeReport.js
|
Examples/js/RivCrimeReport.js
|
Examples/js/RivCrimeReport.js
|
(function() {
// Create the connector object
var myConnector = tableau.makeConnector();
// Define the schema
myConnector.getSchema = function(schemaCallback) {
var cols = [{
id: "npc",
alias: "title",
dataType: tableau.dataTypeEnum.string
}];
var tableSchema = {
id: "earthquakeFeed",
alias: "Earthquakes with magnitude greater than 4.5 in the last seven days",
columns: cols
};
schemaCallback([tableSchema]);
};
// Download the data
myConnector.getData = function(table, doneCallback) {
$.getJSON("https://riversideca.gov/transparency/data/dataset/json/27/Crime_Reports", function(resp) {
var feat = resp.features,
tableData = [];
// Iterate over the JSON object
for (var i = 0, len = feat.length; i < len; i++) {
tableData.push({
"npc": feat[i].properties.npc,
});
}
table.appendRows(tableData);
doneCallback();
});
};
tableau.registerConnector(myConnector);
// Create event listeners for when the user submits the form
$(document).ready(function() {
$("#submitButton").click(function() {
tableau.connectionName = "USGS Earthquake Feed"; // This will be the data source name in Tableau
tableau.submit(); // This sends the connector object to Tableau
});
});
})();
|
JavaScript
| 0 |
@@ -728,22 +728,8 @@
n/27
-/Crime_Reports
%22, f
|
aca2979a8dd7d890a46bdb4d03ec8b7d50b5b8ff
|
remove unique ioid
|
models/User.js
|
models/User.js
|
var mongoose = require('mongoose'),
bcrypt = require('bcrypt'),
SALT_WORK_FACTOR = 10,
UserSchema = mongoose.Schema({
name: {
type: String,
default: ''
},
ioid: {
type: String,
unique: true
},
status: {
type: String,
default: ''
},
surname: {
type: String,
default: ''
},
pass: {
type: String
},
mail: {
type: String,
required: true,
index: {
unique: true
}
},
rating: Number,
social: {
fb: {},
vk: {},
ok: {},
tw: {},
im: {},
},
tokens: {
fb: String,
vk: String,
ok: String,
tw: String,
im: String,
},
friends: {
type: Array,
default: []
},
waiting: {
type: Array,
default: []
},
favs: {
type: Array,
default: []
},
marks: {
type: Array,
default: []
},
subscribers: {
type: Array,
default: []
},
sports: {
type: Array,
default: []
},
hobbies: {
type: Array,
default: []
},
workplaces: {
type: Array,
default: []
},
achievements: {
type: Array,
default: []
},
universities: {
type: Array,
default: []
},
birthDate: Date,
creDate: {
type: Date,
default: new Date()
},
lastOnline: {
type: Date,
default: new Date()
},
online: Boolean,
phone: {
type: String,
default: ''
},
avatar: {
type: String,
default: ''
},
likes: {
free: {
type: Number,
default: 3
},
paid: {
type: Number,
default: 3
},
},
sex: {
type: String,
default: ''
},
typage: {
type: String,
default: ''
},
hairs: {
type: String,
default: ''
},
weight: Number,
height: Number,
chest: Number, // грудь
waist: Number, // талия
huckle: Number, // бёдра
location_city: {},
location_country: {},
settings: {
comments_enabled: {
type: Boolean,
default: false
},
use_large_fonts: {
type: Boolean,
default: false
},
posting_enabled: {
type: Boolean,
default: false
},
show_notifications: {
type: Boolean,
default: false
},
show_notifications_text: {
type: Boolean,
default: false
},
notify_private: {
type: Boolean,
default: false
},
notify_topic_comments: {
type: Boolean,
default: false
},
notify_photo_comments: {
type: Boolean,
default: false
},
notify_video_comments: {
type: Boolean,
default: false
},
notify_competitions: {
type: Boolean,
default: false
},
notify_contests: {
type: Boolean,
default: false
},
notify_birthdays: {
type: Boolean,
default: false
},
}
});
UserSchema.pre('save', function(next) {
var user = this;
// only hash the password if it has been modified (or is new)
if (!user.isModified('pass')) return next();
// generate a salt
bcrypt.genSalt(SALT_WORK_FACTOR, (err, salt) => {
if (err) return next(err);
// hash the password using our new salt
bcrypt.hash(user.pass, salt, (err, hash) => {
if (err) return next(err);
// override the cleartext password with the hashed one
user.pass = hash;
next();
});
});
});
UserSchema.methods.comparePassword = function(candidatePassword, cb) {
bcrypt.compare(candidatePassword, this.pass, (err, isMatch) => {
if (err) return cb(err);
cb(null, isMatch);
});
};
module.exports = mongoose.model('Users', UserSchema);
|
JavaScript
| 0.000094 |
@@ -190,25 +190,8 @@
ring
-,%0A%09%09%09unique: true
%0A%09%09%7D
|
b056b406023286df74370668036e30361bcef1db
|
Refactor review schema, establish relations
|
server/api/reviews/reviews.model.js
|
server/api/reviews/reviews.model.js
|
// reviews schema/model
const Sequelize = require('sequelize');
const dbConnection = require('../../config/db.config.js');
const POI = require('../poi/poi.model.js');
const User = require('../users/users.model.js');
const Review = dbConnection.define('review', {
review_type: {
type: Sequelize.STRING
},
review_content: {
type: Sequelize.STRING,
defaultValue: 'No review provided.'
},
rating: {
type: Sequelize.INTEGER,
defaultValue: 5
}
});
Review.belongsTo(User);
Review.belongsTo(POI);
User.hasMany(Review);
POI.hasMany(Review);
// will only create table once; use {force: true} to override table
Review.sync().then(function () {
console.log('Review table successfuly created.');
});
module.exports = Review;
|
JavaScript
| 0 |
@@ -346,22 +346,20 @@
quelize.
-STRING
+TEXT
,%0A de
|
3afa54954acde0a603b7a78573aeb39673fd4b22
|
Exclude choo devtools in Node
|
lib/app/index.js
|
lib/app/index.js
|
const choo = require('choo')
const createStore = require('./store')
const { setLocale } = require('../locale')
if (typeof window !== 'undefined') {
require('smoothscroll-polyfill').polyfill()
}
const DEFAULT_LANGUAGE = 'sv'
/**
* Create the application instance
*/
const app = choo()
/**
* Take a list of routes/view pairs (`[<path>, <view>]`) and wrap each
* respective view with a function that also sets the `document.title` on render
* derrived from `view.title(state)`
* @type {Array}
*/
const routes = [
['/', require('../views/home')],
['/cooperatives', require('../views/home')],
['/auth', require('../views/sign-in')],
['/auth/sign-up', require('../views/sign-up')],
['/user', require('../views/user')],
['/how-it-works', require('../views/faq')],
['/how-it-works/:anchor', require('../views/faq')],
['/about-the-project', require('../views/about')],
['/about-the-project/:anchor', require('../views/about')],
['/cooperatives/:cooperative', require('../views/cooperative')],
['/cooperatives/:cooperative/edit', require('../views/edit-cooperative')],
['/cooperatives/:cooperative/add-action', require('../views/add-action')],
['/actions', require('../views/actions')],
['/actions/:action', require('../views/action')],
['/actions/:action/edit', require('../views/edit-action')],
['/error', require('../views/error')],
['/*', require('../views/error')]
]
/**
* Localize all the routes with a lang prefix
*/
routes.map(localize('sv')).forEach(([route, view]) => app.route(route, view))
routes.map(localize('en')).forEach(([route, view]) => app.route(route, view))
/**
* Hook up devtools
*/
if (process.env.NODE_ENV === 'development') {
app.use(require('choo-devtools')())
}
/**
* Set up application store
*/
app.use(createStore())
/**
* Start application when running in browser
*/
try {
module.exports = app.mount('body')
} catch (err) {
if (process.env.NODE_ENV === 'development') {
// eslint-disable-next-line no-console
console.error(err)
}
if (typeof window !== 'undefined') {
document.documentElement.classList.remove('has-js')
}
}
/**
* Create an iterator that handles localization before rendering view
* @param {String} lang Language code
* @return {Function} Iterator that localizes routes
*/
function localize (lang) {
return function ([route, view]) {
const localized = lang === DEFAULT_LANGUAGE ? route : ('/' + lang + route)
return [localized.replace(/\/$/, ''), (state, emit) => {
try {
setLocale(state.user.profile.language)
} catch (err) {
setLocale(lang)
}
return view(state, emit)
}]
}
}
|
JavaScript
| 0.000002 |
@@ -1684,24 +1684,57 @@
development'
+ && typeof window !== 'undefined'
) %7B%0A app.us
|
54a62caa13b0a9b4ee48c575cb2333ecf26e8116
|
Use Backbone's events in views.
|
apps/admin/client.js
|
apps/admin/client.js
|
//
// The client-side code for the commits page.
//
// [Browserify](https://github.com/substack/node-browserify) lets us write this
// code as a common.js module, which means requiring dependecies instead of
// relying on globals. This module exports the Backbone view and an init
// function that gets used in /assets/commits.js. Doing this allows us to
// easily unit test these components, and makes the code more modular and
// composable in general.
//
var Backbone = require('backbone')
, sd = require('sharify').data
, pinyin = require('pinyin')
, Artwork = require('../../models/artwork.js');
Backbone.$ = $;
module.exports.AdminView = AdminView = Backbone.View.extend({
initialize: function() {
$('#artwork-create-form').on('submit', this.submitForm);
},
submitForm: function(e) {
e.preventDefault();
var data = $(e.currentTarget).serializeObject()
, artwork = new Artwork(data);
artwork.url = sd.API_URL + "/artworks";
artwork.save(null, {
success: function(model, response, options) {
if (response._status === "ERR") {
for (var field in response._issues) {
$('#artwork-create-error').append(
'<div>' + field + " " + response._issues[field] + '</div>'
);
}
} else {
}
},
error: function(model, response, options) {
}
});
}
});
module.exports.init = function() {
new AdminView({
el: $('body')
});
};
|
JavaScript
| 0 |
@@ -688,40 +688,30 @@
%0A%0A
-initialize: function() %7B%0A $('
+events: %7B%0A 'submit
#art
@@ -731,43 +731,55 @@
orm'
-).on(
+:
'submit
-', this.submitForm);%0A
+Form'%0A %7D,%0A%0A initialize: function() %7B
%7D,%0A%0A
@@ -917,13 +917,37 @@
ork(
+this.transformFormData(
data)
+)
;%0A%0A
@@ -1320,17 +1320,16 @@
else %7B%0A
-%0A
@@ -1408,16 +1408,409 @@
%7D);%0A %7D
+,%0A%0A transformFormData: function(data) %7B%0A var map = %7B%0A width : function(v) %7B return parseFloat(v); %7D,%0A height : function(v) %7B return parseFloat(v); %7D,%0A category : function(v) %7B return %5Bv%5D; %7D,%0A date : function(v) %7B return new Date(v).toUTCString(); %7D%0A %7D%0A%0A for (var k in data) %7B%0A if (k in map) data%5Bk%5D = map%5Bk%5D(data%5Bk%5D);%0A %7D%0A return data;%0A %7D%0A
%0A%7D);%0A%0Amo
|
7b1eb12b424ef6286d546f59ecc41f6ce14a66b7
|
Fix cache URLs
|
webpack.config.babel.js
|
webpack.config.babel.js
|
const { resolve } = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ProgressBarPlugin = require('progress-bar-webpack-plugin');
const { getIfUtils, removeEmpty } = require('webpack-config-utils');
const webpack = require('webpack');
const nodeExternals = require('webpack-node-externals');
const InlineManifestWebpackPlugin = require('inline-manifest-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const OfflinePlugin = require('offline-plugin');
module.exports = (env) => {
const { ifProd, ifNotProd, ifProduction } = getIfUtils(env);
const config = {
context: resolve('src'),
entry: {
app: ['babel-polyfill', 'whatwg-fetch', './app.js'],
},
output: {
path: resolve('dist'),
filename: ifProd('bundle.[name].[chunkhash].js', 'bundle.[name].js'),
pathinfo: ifNotProd(),
},
devtool: ifProd('source-map', 'eval'),
performance: {
hints: ifProd('warning', false),
},
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
babelrc: ifProd(false, true),
presets: [
['es2015'],
],
plugins: ['transform-runtime'],
},
},
{ test: /\.(png|woff|woff2|eot|ttf|svg)$/, loader: 'url-loader?limit=100000' },
{
test: /\.css$/,
include: resolve('src/css'),
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ifProd('css-loader!postcss-loader', 'css-loader?sourceMap!postcss-loader'),
}),
},
],
},
plugins: removeEmpty([
new ProgressBarPlugin(),
ifProd(new OfflinePlugin({
externals: ['img/*'],
})),
new webpack.DefinePlugin({
'process.env': {
BROWSER: JSON.stringify(true),
NODE_ENV: ifProd('"production"', '"development"'),
},
}),
new ExtractTextPlugin(ifProd('styles.[name].[chunkhash].css', 'styles.[name].css')),
ifProd(new InlineManifestWebpackPlugin()),
ifProd(new webpack.optimize.CommonsChunkPlugin({
names: ['manifest'],
})),
new HtmlWebpackPlugin({
template: './index.html',
}),
new CopyWebpackPlugin([
{ from: './img', to: 'img' },
]),
]),
externals: ifProduction([nodeExternals()]),
node: {
fs: 'empty',
},
};
if (env.debug) {
console.log(config);
}
return config;
};
|
JavaScript
| 0.000267 |
@@ -1874,9 +1874,97 @@
img/
-*
+coffee.svg', 'img/git.svg', 'img/latte.svg', 'img/mug.svg', 'img/smile.svg', 'favicon.ico
'%5D,%0A
|
badb86305a683f76bdeeae10c6076b8db8f4eac2
|
include slugs in the github json
|
db/github.js
|
db/github.js
|
// mongo nodeknockout json2.js github.js | tail +5 | python -mjson.tool
var teams = db.Team.find().map(function(t) {
return {
name: t.name,
members: t.members.map(function(m) {
var p = db.Person.findOne({ _id: m._id }, {
github: true, email: true, name: true
});
delete p._id;
return p;
})
};
});
print(JSON.stringify(teams));
|
JavaScript
| 0 |
@@ -140,16 +140,34 @@
t.name,%0A
+ slug: t.slug,%0A
memb
|
20ba17b79e69e6f4d1b8d26ef9a684f5af73d733
|
Simplify ReadOnlyArrayProxy implementation.
|
addon/system/read-only-array-proxy.js
|
addon/system/read-only-array-proxy.js
|
const { ArrayProxy } = Ember;
export default ArrayProxy.extend({
addObject() {
throw new Error('not supported');
},
clear() {
throw new Error('not supported');
},
insertAt() {
throw new Error('not supported');
},
popObject() {
throw new Error('not supported');
},
pushObject() {
throw new Error('not supported');
},
pushObjects() {
throw new Error('not supported');
},
removeAt() {
throw new Error('not supported');
},
removeObject() {
throw new Error('not supported');
},
replace() {
throw new Error('not supported');
},
reverseObjects() {
throw new Error('not supported');
},
setObjects() {
throw new Error('not supported');
},
shiftObject() {
throw new Error('not supported');
},
unshiftObject() {
throw new Error('not supported');
},
unshiftObjects() {
throw new Error('not supported');
}
});
|
JavaScript
| 0 |
@@ -28,450 +28,324 @@
r;%0A%0A
-export default ArrayProxy.extend(%7B%0A addObject() %7B%0A throw new Error('not supported');%0A %7D,%0A%0A clear() %7B%0A throw new Error('not supported');%0A %7D,%0A%0A insertAt() %7B%0A throw new Error('not supported');%0A %7D,%0A%0A popObject() %7B%0A throw new Error('not supported');%0A %7D,%0A%0A pushObject() %7B%0A throw new Error('not supported');%0A %7D,%0A%0A pushObjects() %7B%0A throw new Error('not supported');%0A %7D,%0A%0A removeAt() %7B%0A throw new Error('not s
+function notSupported() %7B%0A throw new Error('Method not supported on read-only ArrayProxy.');%0A%7D%0A%0Aexport default ArrayProxy.extend(%7B%0A addObject: notSupported,%0A clear: notSupported,%0A insertAt: notSupported,%0A popObject: notSupported,%0A pushObject: notSupported,%0A pushObjects: notSupported,%0A removeAt: notS
upported
');%0A
@@ -336,33 +336,25 @@
notSupported
-');%0A %7D,%0A
+,
%0A removeObj
@@ -360,105 +360,47 @@
ject
-() %7B%0A throw new Error('not supported');%0A %7D,%0A%0A replace() %7B%0A throw new Error('not s
+: notSupported,%0A replace: notS
upported
');%0A
@@ -395,25 +395,17 @@
upported
-');%0A %7D,%0A
+,
%0A rever
@@ -417,108 +417,50 @@
ects
-() %7B%0A throw new Error('not supported');%0A %7D,%0A%0A setObjects() %7B%0A throw new Error('not s
+: notSupported,%0A setObjects: notS
upported
');%0A
@@ -455,25 +455,17 @@
upported
-');%0A %7D,%0A
+,
%0A shift
@@ -474,47 +474,22 @@
ject
-() %7B%0A throw new Error('not s
+: notS
upported
');%0A
@@ -480,33 +480,25 @@
notSupported
-');%0A %7D,%0A
+,
%0A unshiftOb
@@ -505,47 +505,22 @@
ject
-() %7B%0A throw new Error('not s
+: notS
upported
');%0A
@@ -519,17 +519,9 @@
rted
-');%0A %7D,%0A
+,
%0A u
@@ -537,47 +537,22 @@
ects
-() %7B%0A throw new Error('not s
+: notS
upported
');%0A
@@ -551,15 +551,8 @@
rted
-');%0A %7D
%0A%7D);
|
e49caf8eab7dbfeffe628667ad8f7a9f5ea21488
|
Make deps an explicit dependency
|
package.js
|
package.js
|
Package.describe({
summary: 'Display the connection status with the server'
})
Package.on_use(function(api, where) {
api.use([
'meteor',
'underscore',
'templating'
], 'client')
api.use(['tap-i18n'], ['client', 'server'])
api.add_files('package-tap.i18n', ['client', 'server'])
api.add_files([
'lib/status.html',
'lib/retry_time.js',
'lib/status.js',
'i18n/en.i18n.json',
'i18n/es.i18n.json'
], 'client')
})
Package.on_test(function(api) {
api.use([
'status',
'tinytest',
'test-helpers'
], 'client')
api.add_files('test/status_tests.js', 'client')
})
|
JavaScript
| 0.007597 |
@@ -139,16 +139,28 @@
eteor',%0A
+ 'deps',%0A
'und
|
9d6bcdf3c7caeb5b8b818598071eeaada729940e
|
Rename handlers
|
lib/attribute.js
|
lib/attribute.js
|
// attribute - filter attributes
module.exports = function (key, attributes) {
var value = attributes
, handler = handlers[key]
return handler ? handler(key, attributes) : [key, value]
}
var handlers = {
'link':fromLink
, 'image':fromImage
}
function fromLink (key, attributes) {
var rel = attributes.rel
, value = null
if (rel === 'payment') {
key = rel
}
if (rel === 'enclosure') {
key = rel
value = attributes
delete value.rel
} else {
value = attributes.href
}
return [key, value]
}
function fromImage (key, attributes) {
return [key, attributes.href]
}
|
JavaScript
| 0.000003 |
@@ -218,21 +218,17 @@
'link':
-fromL
+l
ink%0A, 'i
@@ -233,21 +233,17 @@
'image':
-fromI
+i
mage%0A%7D%0A%0A
@@ -255,13 +255,9 @@
ion
-fromL
+l
ink
@@ -538,13 +538,9 @@
ion
-fromI
+i
mage
|
5c2cb1e2af274c9cd5899e43ef62921aa79206c2
|
fix validation plugin
|
webpack.config.babel.js
|
webpack.config.babel.js
|
import path from 'path';
const config = {
devtool: 'source-map',
entry: [
'materialize-loader!./materialize.config.js',
'babel-polyfill',
'./src/client/index.js',
],
output: {
path: path.join(__dirname, 'public'),
publicPath: '/',
filename: 'bundle.js',
},
module: {
loaders: [{
test: /\.js$/,
include: path.join(__dirname, 'src'),
loader: 'babel-loader',
query: {
presets: ['latest', 'stage-2'],
},
}, {
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'url',
query: {
limit: 1000,
mimetype: 'application/font-woff',
},
}, {
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'file',
}],
},
devServer: {
proxy: {
'*': {
target: 'http://localhost:4000',
secure: false,
},
},
stats: {
colors: true,
hash: false,
version: false,
assets: false,
chunks: false,
},
},
};
export default config;
|
JavaScript
| 0.00001 |
@@ -732,16 +732,167 @@
'file',%0A
+ %7D, %7B%0A test: require.resolve('jquery-validation'),%0A loader: 'imports-loader',%0A query: 'define=%3Efalse,require=%3Efunction()%7Breturn $%7D',%0A
%7D%5D,%0A
|
c8d6f19c51b12e1cfb0c96bf51c514e15c5f9fda
|
change publicPath
|
cfg/defaults.js
|
cfg/defaults.js
|
/**
* Function that returns default values.
* Used because Object.assign does a shallow instead of a deep copy.
* Using [].push will add to the base array, so a require will alter
* the base array output.
*/
'use strict';
const path = require('path');
const srcPath = path.join(__dirname, '/../src');
const dfltPort = 4000;
/**
* Get the default modules object for webpack
* @return {Object}
*/
function getDefaultModules() {
return {
preLoaders: [
{
test: /\.(js|jsx)$/,
include: srcPath,
loader: 'eslint-loader'
}
],
loaders: [
{
test:/\.json$/,
loader:'json-loader'
},
{
test: /\.css$/,
loader: 'style-loader!css-loader!autoprefixer-loader?{browers:["last 2 version"]}'
},
{
test: /\.sass/,
loader: 'style-loader!css-loader!sass-loader?outputStyle=expanded&indentedSyntax'
},
{
test: /\.scss/,
loader: 'style-loader!css-loader!autoprefixer-loader?{browers:["last 2 version"]}!sass-loader?outputStyle=expanded'
},
{
test: /\.less/,
loader: 'style-loader!css-loader!less-loader'
},
{
test: /\.styl/,
loader: 'style-loader!css-loader!stylus-loader'
},
{
test: /\.(png|jpg|gif|woff|woff2|eot|ttf|svg)$/,
loader: 'url-loader?limit=8192'
}
// ,
// {
// test: /\.(mp4|ogg|svg)$/,
// loader: 'file-loader'
// }
]
};
}
module.exports = {
srcPath: srcPath,
publicPath: '/assets/',
port: dfltPort,
getDefaultModules: getDefaultModules
};
|
JavaScript
| 0.000001 |
@@ -1557,17 +1557,16 @@
cPath: '
-/
assets/'
|
5aba435576c869453c6eafac5a18c4ee4dcee36c
|
Update navigation
|
src/components/navigation/navigation.js
|
src/components/navigation/navigation.js
|
import $ from '../../utils/dom';
import Utils from '../../utils/utils';
const Navigation = {
update() {
// Update Navigation Buttons
const swiper = this;
const params = swiper.params.navigation;
if (swiper.params.loop) return;
const { $nextEl, $prevEl } = swiper.navigation;
if ($prevEl && $prevEl.length > 0) {
if (swiper.isBeginning) {
$prevEl.addClass(params.disabledClass);
// if (s.params.a11y && s.a11y) s.a11y.disable(s.prevButton);
} else {
$prevEl.removeClass(params.disabledClass);
// if (s.params.a11y && s.a11y) s.a11y.enable(s.prevButton);
}
}
if ($nextEl && $nextEl.length > 0) {
if (swiper.isEnd) {
$nextEl.addClass(params.disabledClass);
// if (s.params.a11y && s.a11y) s.a11y.disable(s.nextButton);
} else {
$nextEl.removeClass(params.disabledClass);
// if (s.params.a11y && s.a11y) s.a11y.enable(s.nextButton);
}
}
},
init() {
const swiper = this;
const params = swiper.params.navigation;
if (!(params.nextEl || params.prevEl)) return;
let $nextEl;
let $prevEl;
if (params.nextEl) {
$nextEl = $(params.nextEl);
if (
swiper.params.uniqueNavElements &&
typeof params.nextEl === 'string' &&
$nextEl.length > 1 &&
swiper.$el.find(params.nextEl).length === 1
) {
$nextEl = swiper.$el.find(params.nextEl);
}
}
if (params.prevEl) {
$prevEl = $(params.prevEl);
if (
swiper.params.uniqueNavElements &&
typeof params.prevEl === 'string' &&
$prevEl.length > 1 &&
swiper.$el.find(params.prevEl).length === 1
) {
$prevEl = swiper.$el.find(params.prevEl);
}
}
if (!($nextEl || $prevEl) || ($nextEl.length === 0 && $prevEl.length === 0)) return;
if ($nextEl && $nextEl.length > 0) {
$nextEl.on('click', (e) => {
e.preventDefault();
if (swiper.isEnd && !swiper.params.loop) return;
swiper.slideNext();
});
// if (s.params.a11y && s.a11y) s.nextButton[actionDom]('keydown', s.a11y.onEnterKey);
}
if ($prevEl && $prevEl.length > 0) {
$prevEl.on('click', (e) => {
e.preventDefault();
if (swiper.isBeginning && !swiper.params.loop) return;
swiper.slidePrev();
});
// if (s.params.a11y && s.a11y) s.prevButton[actionDom]('keydown', s.a11y.onEnterKey);
}
Utils.extend(swiper.navigation, {
$nextEl,
nextEl: $nextEl[0],
$prevEl,
prevEl: $prevEl[0],
});
},
destroy() {
const swiper = this;
const { $nextEl, $prevEl } = swiper.navigation;
if ($nextEl && $nextEl.length) {
$nextEl.off('click');
$nextEl.removeClass(swiper.params.navigation.disabledClass);
}
if ($prevEl && $prevEl.length) {
$prevEl.off('click');
$prevEl.removeClass(swiper.params.navigation.disabledClass);
}
},
};
export default {
name: 'navgiation',
params: {
navigation: {
nextEl: null,
prevEl: null,
hideOnClick: false,
disabledClass: 'swiper-button-disabled',
hiddenClass: 'swiper-button-hidden',
},
},
create() {
const swiper = this;
Utils.extend(swiper, {
navigation: {
init: Navigation.init.bind(swiper),
update: Navigation.update.bind(swiper),
destroy: Navigation.destroy.bind(swiper),
},
});
},
on: {
init() {
const swiper = this;
swiper.navigation.init();
swiper.navigation.update();
},
destroy() {
const swiper = this;
swiper.navigation.destroy();
},
click(e) {
const swiper = this;
const { $nextEl, $prevEl } = swiper.navigation;
if (!($nextEl || $prevEl) || ($nextEl.length === 0 && $prevEl.length === 0)) return;
if (
swiper.params.navigation.hideOnClick &&
!$(e.target).is($prevEl) &&
!$(e.target).is($nextEl)
) {
if ($nextEl) $nextEl.toggleClass(swiper.params.navigation.hiddenClass);
if ($prevEl) $prevEl.toggleClass(swiper.params.navigation.hiddenClass);
}
},
},
};
|
JavaScript
| 0 |
@@ -3574,24 +3574,192 @@
e();%0A %7D,%0A
+ toEdge() %7B%0A const swiper = this;%0A swiper.navigation.update();%0A %7D,%0A fromEdge() %7B%0A const swiper = this;%0A swiper.navigation.update();%0A %7D,%0A
destroy(
|
6ca87d25b9987eb81d04d893571001d4476ebbb8
|
Update firefox-user.js
|
apps/firefox-user.js
|
apps/firefox-user.js
|
// Mozilla User Preferences
//dennyhalim.com
//http://kb.mozillazine.org/User.js_file
//http://kb.mozillazine.org/Locking_preferences
//https://support.mozilla.org/en-US/kb/customizing-firefox-using-autoconfig
//https://developer.mozilla.org/en-US/docs/Mozilla/Preferences/A_brief_guide_to_Mozilla_preferences
//https://ffprofile.com/
//https://github.com/pyllyukko/user.js#installation
//lockPref("autoadmin.global_config_url","https://github.com/dennyhalim/cfg/raw/master/apps/firefox-user.js");
pref("app.update.channel", "esr");
user_pref("beacon.enabled", false);
user_pref("browser.cache.disk.enable", false); //very usefull if you have < 4GB RAM
user_pref("browser.cache.compression_level", 1);
user_pref("browser.cache.memory.enable", false); //very usefull if you have < 4GB RAM
user_pref("browser.helperApps.deleteTempFileOnExit", true);
user_pref("browser.newtabpage.activity-stream.feeds.section.highlights", false);
user_pref("browser.sessionhistory.max_entries", 10);
//user_pref("browser.shell.checkDefaultBrowser", false);
user_pref("browser.urlbar.placeholderName", "DuckDuckGo");
user_pref("device.sensors.enabled", false);
//user_pref("dom.maxHardwareConcurrency", 1); //faster on slow devices
user_pref("dom.battery.enabled", false);
user_pref("dom.event.clipboardevents.enabled", false);
user_pref("dom.indexedDB.enabled", false);
user_pref("dom.webaudio.enabled", false);
user_pref("experiments.activeExperiment", false);
user_pref("experiments.enabled", false);
user_pref("experiments.manifest.uri", "");
user_pref("experiments.supported", false);
user_pref("dom.event.highrestimestamp.enabled", false);
user_pref("dom.telephony.enabled", false);
user_pref("dom.netinfo.enabled", false);
user_pref("dom.webnotifications.enabled", false);
user_pref("dom.webnotifications.serviceworker.enabled", false);
user_pref("dom.serviceWorkers.enabled", false);
user_pref("dom.vibrator.enabled", false);
user_pref("dom.enable_resource_timing", false);
user_pref("geo.enabled", false);
user_pref("geo.provider.ms-windows-location", false);
user_pref("geo.provider.use_corelocation", false);
user_pref("geo.provider.use_gpsd", false);
user_pref("javascript.options.mem.max", 128000);
user_pref("javascript.options.mem.high_water_mark", 32);
user_pref("media.autoplay.default", 1);
user_pref("media.autoplay.enabled", false);
user_pref("media.video_stats.enabled", false);
user_pref("network.cookie.lifetime.days", 1);
user_pref("network.cookie.cookieBehavior", 1);
user_pref("network.cookie.lifetimePolicy", 2);
user_pref("network.cookie.thirdparty.sessionOnly", true);
//user_pref("network.proxy.type", 0);
user_pref("network.prefetch-next", false);
user_pref("network.trr.mode", 2); // change to 3 to enforce dns over https
//other network.trr.uri to try:
// https://dns9.quad9.net/dns-query
// https://doh.cleanbrowsing.org/doh/adult-filter/
// https://mozilla.cloudflare-dns.com/dns-query
// https://cloudflare-dns.com/dns-query
user_pref("network.trr.uri", "https://doh.cleanbrowsing.org/doh/adult-filter/"); //https://cleanbrowsing.org/dnsoverhttps
user_pref("browser.newtab.preload", false);
user_pref("browser.newtabpage.activity-stream.section.highlights.includePocket", false);
user_pref("browser.newtabpage.enhanced", false);
//user_pref("privacy.firstparty.isolate", true);
user_pref("privacy.clearOnShutdown.cache", true);
//user_pref("privacy.clearOnShutdown.cookies", true);
//user_pref("privacy.clearOnShutdown.downloads", true);
//user_pref("privacy.clearOnShutdown.formdata", true);
//user_pref("privacy.clearOnShutdown.history", true);
user_pref("privacy.clearOnShutdown.offlineApps", true);
//user_pref("privacy.clearOnShutdown.sessions", true);
//user_pref("privacy.clearOnShutdown.openWindows", true);
user_pref("privacy.cpd.cache", true);
user_pref("privacy.resistFingerprinting", true);
user_pref("privacy.sanitize.pending", "[{\"id\":\"shutdown\",\"itemsToClear\":[\"cache\",\"offlineApps\"],\"options\":{}}]");
//user_pref("privacy.sanitize.pending", "[{\"id\":\"shutdown\",\"itemsToClear\":[\"cache\",\"cookies\",\"offlineApps\",\"formdata\",\"sessions\",\"siteSettings\"],\"options\":{}}]");
user_pref("privacy.sanitize.sanitizeOnShutdown", true);
user_pref("privacy.donottrackheader.enabled", true);
user_pref("privacy.trackingprotection.enabled", true);
user_pref("privacy.trackingprotection.pbmode.enabled", true);
user_pref("toolkit.telemetry.unified", false);
user_pref("toolkit.telemetry.enabled", false);
user_pref("toolkit.telemetry.archive.enabled", false);
user_pref("webgl.disabled, true);
|
JavaScript
| 0.000003 |
@@ -975,16 +975,68 @@
%22, 10);%0A
+user_pref(%22browser.sessionstore.interval%22, 600000);%0A
//user_p
|
2f994d36d43eb7aa018e1ef963d4f0167a7c42a2
|
Use the writable fields list for the Edit component
|
src/Edit.js
|
src/Edit.js
|
import React, {Component} from 'react';
import {Edit as BaseEdit, SimpleForm, DisabledInput} from 'admin-on-rest';
import inputFactory from './inputFactory';
export default class Edit extends Component {
render() {
const factory = this.props.options.inputFactory ? this.props.options.inputFactory : inputFactory;
return <BaseEdit {...this.props}>
<SimpleForm>
<DisabledInput source="id"/>
{this.props.options.resource.readableFields.map(field => factory(field, this.props.options.resource, 'edit', this.props.options.api))}
</SimpleForm>
</BaseEdit>
}
}
|
JavaScript
| 0 |
@@ -447,12 +447,12 @@
rce.
-read
+writ
able
|
d24e7cff71521fab50145dc535845a7b515cef26
|
Add Type and Status constants to Project Model
|
models/project.js
|
models/project.js
|
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var ProjectSchema = new Schema(
{
name : String,
picture : {type : String, default : null},
type : {type : Number, default : 0},
description : {type : String, default : ''},
created : {type : Date, default : Date.now},
lastEdited : {type : Date, default : Date.now},
status : {type : Number, default : 0},
author : {type: mongoose.Schema.Types.ObjectId, ref: 'User'}
});
module.exports = mongoose.model('Project', ProjectSchema);
|
JavaScript
| 0 |
@@ -535,8 +535,299 @@
chema);%0A
+%0Amodule.exports.Type = %7B%7D;%0Amodule.exports.Type.Project = 0;%0Amodule.exports.Type.Event = 1;%0Amodule.exports.Type.Team = 2;%0A%0Amodule.exports.Status = %7B%7D;%0Amodule.exports.Status.Preparation = 0;%0Amodule.exports.Status.Vote = 1;%0Amodule.exports.Status.Working = 2;%0Amodule.exports.Status.Archived = 3;
|
7994a68385425cd4fbb5483c35f1d039ded2ba76
|
fix git metadata
|
package.js
|
package.js
|
Package.describe({
name: 'osxi:annyang',
version: '2.0.0',
summary: 'Easy microphone speech recognition using JavaScript.',
git: '[email protected]:osxi/meteor-annyang.git',
documentation: 'README.md'
});
Package.onUse(function(api) {
api.versionsFrom('1.2.1');
api.use('ecmascript');
api.addFiles('annyang.js');
api.addFiles('annyang.min.js', 'client');
});
Package.onTest(function(api) {
api.use('ecmascript');
api.use('tinytest');
api.use('osxi:annyang');
api.addFiles('annyang-tests.js');
});
|
JavaScript
| 0.001167 |
@@ -135,12 +135,16 @@
t: '
-git@
+https://
gith
@@ -149,17 +149,17 @@
thub.com
-:
+/
osxi/met
|
691453f9db59a11e8ebb923718affd1f5583d977
|
Remove menu from Windows
|
electron/index.js
|
electron/index.js
|
/* global require, process */
(function () {
'use strict';
var electron = require('electron');
var path = require('path');
var url = require('url');
// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
var win;
function createWindow () {
var template = [{
label: "Application",
submenu: [
{ label: "About Application", selector: "orderFrontStandardAboutPanel:" },
{ type: "separator" },
{ label: "Quit", accelerator: "Command+Q", click: function() { app.quit(); }}
]}, {
label: "Edit",
submenu: [
{ label: "Undo", accelerator: "CmdOrCtrl+Z", selector: "undo:" },
{ label: "Redo", accelerator: "Shift+CmdOrCtrl+Z", selector: "redo:" },
{ type: "separator" },
{ label: "Cut", accelerator: "CmdOrCtrl+X", selector: "cut:" },
{ label: "Copy", accelerator: "CmdOrCtrl+C", selector: "copy:" },
{ label: "Paste", accelerator: "CmdOrCtrl+V", selector: "paste:" },
{ label: "Select All", accelerator: "CmdOrCtrl+A", selector: "selectAll:" }
]}
];
var Menu = electron.Menu;
Menu.setApplicationMenu(Menu.buildFromTemplate(template));
// Create the browser window.
var BrowserWindow = electron.BrowserWindow;
win = new BrowserWindow({
width: 800,
height: 600
});
// and load the index.html of the app.
win.loadURL(url.format({
pathname: path.join(__dirname, 'app/index.html'),
protocol: 'file:',
slashes: true
}));
// Open the DevTools.
// win.webContents.openDevTools();
// Emitted when the window is closed.
win.on('closed', function () {
// Dereference the window object, usually you would store windows
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
win = null;
});
}
var app = electron.app;
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow);
// Quit when all windows are closed.
app.on('window-all-closed', function () {
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', function () {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (win === null) {
createWindow();
}
});
})();
|
JavaScript
| 0.000002 |
@@ -1109,16 +1109,79 @@
%7D%0A%09%09%5D;%0A%0A
+%09%09// No menu on Windows%0A%09%09if (process.platform !== 'win32') %7B%0A%09
%09%09var Me
@@ -1200,16 +1200,17 @@
n.Menu;%0A
+%09
%09%09Menu.s
@@ -1261,16 +1261,20 @@
plate));
+%0A%09%09%7D
%0A%0A%09%09// C
|
48b5463ae1f1b8c02b2beda80ef0fd4597555771
|
Remove redundand preLoader
|
webpack/webpack.base.js
|
webpack/webpack.base.js
|
var path = require('path');
var rootPath = '../';
module.exports = {
entry: {
app: [path.resolve(__dirname, '../src/main.js')]
},
output: {
path: path.resolve(__dirname, '../build'),
publicPath: '/',
filename: '[name].[hash].js',
sourceMapFilename: '[name].[hash].js.map',
chunkFilename: '[id].chunk.js',
},
resolve: {
extensions: ['', '.js', '.html'],
fallback: [path.join(__dirname, '../node_modules')],
alias: {
'src': path.resolve(__dirname, '../src'),
'assets': path.resolve(__dirname, '../src/assets'),
'components': path.resolve(__dirname, '../src/components')
}
},
module: {
preLoaders: [
{
test: /\.vue$/,
loader: 'eslint',
include: rootPath,
exclude: /node_modules/
},
{
test: /\.js$/,
loader: 'eslint',
include: rootPath,
exclude: /node_modules/
}
],
loaders: [
{
test: /\.html$/,
loader: 'vue-html'
},
{
test: /\.js$/,
loader: 'babel',
exclude: /node_modules/
},
{
test: /\.(png|jpg|jpeg|gif)$/,
loader: 'url?prefix=img/&limit=5000'
},
{
test: /\.scss$/,
loader: 'style!css!sass?sourceMap'
},
{
test: /\.(ttf|eot|svg)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'file'
},
{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'url?prefix=font/&limit=5000&mimetype=application/font-woff'
}
]
},
eslint: {
formatter: require('eslint-friendly-formatter')
},
babel: {
presets: ['es2015'],
plugins: ['transform-runtime']
}
}
|
JavaScript
| 0 |
@@ -683,134 +683,8 @@
%7B%0A
- test: /%5C.vue$/,%0A loader: 'eslint',%0A include: rootPath,%0A exclude: /node_modules/%0A %7D,%0A %7B%0A
|
9a4625bb8254183b4e65cc028eccef5ff12e8ec0
|
Convert NUMERIC field's output to float
|
src/mmw/js/src/modeling/gwlfe/entry/models.js
|
src/mmw/js/src/modeling/gwlfe/entry/models.js
|
"use strict";
var _ = require('lodash'),
Backbone = require('../../../../shim/backbone'),
GwlfeModificationModel = require('../../models').GwlfeModificationModel;
var ENTRY_FIELD_TYPES = {
NUMERIC: 'NUMERIC',
YESNO: 'YESNO',
};
var EntryFieldModel = Backbone.Model.extend({
defaults: {
label: '',
name: '',
type: ENTRY_FIELD_TYPES.NUMERIC,
minValue: null,
maxValue: null,
autoValue: null,
userValue: null,
},
initialize: function(attrs, dataModel) {
this.toOutput = attrs.calculator.toOutput;
this.set('autoValue',
attrs.calculator.getAutoValue(attrs.name, dataModel));
},
toOutput: function() {
throw "Calculator not provided.";
}
});
var EntryFieldCollection = Backbone.Collection.extend({
model: EntryFieldModel,
});
var EntrySectionModel = Backbone.Model.extend({
defaults: {
title: '',
fields: null, // EntryFieldCollection
}
});
var EntrySectionCollection = Backbone.Collection.extend({
model: EntrySectionModel,
});
var EntryTabModel = Backbone.Model.extend({
defaults: {
displayName: '',
name: '',
sections: null, // EntrySectionCollection
},
getOutput: function() {
var output = {},
userInput = {};
this.get('sections').forEach(function(section) {
section.get('fields').forEach(function(field) {
var name = field.get('name'),
userValue = field.get('userValue');
if (userValue !== null &&
userValue !== undefined &&
userValue !== '') {
output[name] = field.toOutput(userValue);
userInput[name] = userValue;
}
});
});
return new GwlfeModificationModel({
modKey: 'entry_' + this.get('name'),
output: output,
userInput: userInput,
});
}
});
var EntryTabCollection = Backbone.Collection.extend({
model: EntryTabModel,
});
var WindowModel = Backbone.Model.extend({
defaults: {
feedbackRequired: true,
dataModel: null, // Cleaned MapShed GIS Data
title: '',
},
});
var EntryWindowModel = WindowModel.extend({
defaults: _.defaults({
tabs: null, // EntryTabCollection
}, WindowModel.prototype.defaults),
});
var LandCoverWindowModel = WindowModel.extend({
defaults: _.defaults({
autoTotal: 0,
userTotal: 0,
fields: null, // FieldCollection
}, WindowModel.prototype.defaults),
initialize: function(attrs) {
var totalArea = _.sum(attrs.dataModel['Area']);
this.set({
autoTotal: totalArea,
userTotal: totalArea,
});
},
getOutput: function() {
var output = {},
userInput = {};
this.get('fields').forEach(function(field) {
var name = field.get('name'),
userValue = field.get('userValue');
if (userValue !== null &&
userValue !== undefined &&
userValue !== '') {
output[name] = field.toOutput(parseFloat(userValue));
userInput[name] = userValue;
}
});
return new GwlfeModificationModel({
modKey: 'entry_landcover',
output: output,
userInput: userInput,
});
}
});
/**
* Returns a FieldCollection for a section
* @param tabName Name of the tab
* @param dataModel Project's gis_data, cleaned
* @param modifications Scenario's current modification collection
* @param fields Object with {name, label, calculator} for each field, with
* minValue and maxValue optionally specified
* @returns A FieldCollection with specified fields
*/
function makeFieldCollection(tabName, dataModel, modifications, fields) {
var mods = modifications.findWhere({ modKey: 'entry_' + tabName }),
userInput = mods ? mods.get('userInput') : {};
return new EntryFieldCollection(fields.map(function(fieldInfo) {
var field = new EntryFieldModel(fieldInfo, dataModel);
if (userInput.hasOwnProperty(fieldInfo.name)) {
field.set('userValue', userInput[fieldInfo.name]);
}
return field;
}));
}
module.exports = {
ENTRY_FIELD_TYPES: ENTRY_FIELD_TYPES,
EntryFieldModel: EntryFieldModel,
EntryFieldCollection: EntryFieldCollection,
EntrySectionModel: EntrySectionModel,
EntrySectionCollection: EntrySectionCollection,
EntryTabCollection: EntryTabCollection,
EntryTabModel: EntryTabModel,
EntryWindowModel: EntryWindowModel,
LandCoverWindowModel: LandCoverWindowModel,
makeFieldCollection: makeFieldCollection,
};
|
JavaScript
| 0.999993 |
@@ -1675,32 +1675,188 @@
Value !== '') %7B%0A
+ if (field.get('type') === ENTRY_FIELD_TYPES.NUMERIC) %7B%0A userValue = parseFloat(userValue);%0A %7D%0A
|
06f05ef59eb7f04135a45b44a45c8a79c5155c64
|
Fix case-bug not occuring on Windows.
|
src/remark/api.js
|
src/remark/api.js
|
var EventEmitter = require('events').EventEmitter
, highlighter = require('./highlighter')
, converter = require('./converter')
, Parser = require('./Parser')
, Slideshow = require('./models/slideshow')
, SlideshowView = require('./views/slideshowView')
, DefaultController = require('./controllers/defaultController')
, Dom = require('./dom')
;
module.exports = Api;
function Api (dom) {
this.dom = dom || new Dom();
}
// Expose highlighter to allow enumerating available styles and
// including external language grammars
Api.prototype.highlighter = highlighter;
Api.prototype.convert = function (markdown) {
var parser = new Parser()
, content = parser.parse(markdown || '')[0].content
;
return converter.convertMarkdown(content, true);
};
// Creates slideshow initialized from options
Api.prototype.create = function (options) {
var events
, slideshow
, slideshowView
, controller
;
options = applyDefaults(this.dom, options);
events = new EventEmitter();
events.setMaxListeners(0);
slideshow = new Slideshow(events, options);
slideshowView = new SlideshowView(events, this.dom, options.container, slideshow);
controller = options.controller || new DefaultController(events, this.dom, slideshowView, options.navigation);
return slideshow;
};
function applyDefaults (dom, options) {
var sourceElement;
options = options || {};
if (options.hasOwnProperty('sourceUrl')) {
var req = new dom.XMLHttpRequest();
req.open('GET', options.sourceUrl, false);
req.send();
options.source = req.responseText.replace(/\r\n/g, '\n');
}
else if (!options.hasOwnProperty('source')) {
sourceElement = dom.getElementById('source');
if (sourceElement) {
options.source = unescape(sourceElement.innerHTML);
sourceElement.style.display = 'none';
}
}
if (!(options.container instanceof window.HTMLElement)) {
options.container = dom.getBodyElement();
}
return options;
}
function unescape (source) {
source = source.replace(/&[l|g]t;/g,
function (match) {
return match === '<' ? '<' : '>';
});
source = source.replace(/&/g, '&');
source = source.replace(/"/g, '"');
return source;
}
|
JavaScript
| 0 |
@@ -149,17 +149,17 @@
uire('./
-P
+p
arser')%0A
|
5d8daa86a9b1a34ba912b699475701fbc38f2338
|
fix 2-3 pointers calculation error
|
fantasy_scores.js
|
fantasy_scores.js
|
//DOM change listener, taken from https://stackoverflow.com/questions/3219758/detect-changes-in-the-dom
var observeDOM = (function(){
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver,
eventListenerSupported = window.addEventListener;
return function(obj, callback){
if( MutationObserver ){
// define a new observer
var obs = new MutationObserver(function(mutations, observer){
if( mutations[0].addedNodes.length || mutations[0].removedNodes.length )
callback();
});
// have the observer observe foo for changes in children
obs.observe( obj, { childList:true, subtree:true });
}
else if( eventListenerSupported ){
obj.addEventListener('DOMNodeInserted', callback, false);
obj.addEventListener('DOMNodeRemoved', callback, false);
}
}
})();
var changeFlag = false
// On change inside box scores, recalculate Fantasy Points
observeDOM( document.getElementById('nbaGIboxscore') , updateFantasyScores);
updateFantasyScores()
function updateFantasyScores(){
if (changeFlag){
//it was our own DOM update, so no infinite loops, please=)
changeFlag = false
return
}
changeFlag = true
//find two team's stat tables
var tables = document.querySelectorAll("#nbaGITeamStats")
if (tables.length == 2){
//let's get a score of match
var home = +document.getElementsByClassName("teamHome")[0].innerHTML
var away = +document.getElementsByClassName("teamAway")[0].innerHTML
for (var i = 0; i < 2; ++i){
//calculate win-loss modifier
//first table for away, second for home team
var winLossMod
if (i == 0){
winLossMod = away > home ? 3 : -2
}else{
winLossMod = home > away ? 2 : -3
}
//get rows
var table = tables.item(i)
var rows = table.getElementsByTagName("tr")
if (rows.length > 2){
//insert column header
var td = document.createElement("td")
td.innerHTML = "ФО"
rows[2].appendChild(td)
//for every player's stats row
for (var j = 3; j < rows.length-2; ++j){
var row = rows[j]
var columns = row.children
if (columns.length < 10){
//something wrong - columns is not set properly
continue
}
//fantasy points, rules from http://www.sports.ru/fantasy/basketball/tournament/rules/150.html
var FO = winLossMod
var splitCol = function(col, splitChar){
return columns[col].innerHTML.split(splitChar).map(function(elm){
return +elm
})
}
//time points
var stat = splitCol(2, ":")
if (stat[0] > 0 || stat[1] > 0){
FO += 1
if (stat[0] >= 10){
FO += 1
}
}
//two-pointers
stat = splitCol(3, "-")
FO += (stat[0] - stat[1])
//three-pointers
stat = splitCol(4, "-")
FO += (stat[0] - stat[1])
//free-throws
stat = splitCol(5, "-")
FO += (stat[0] - stat[1])
//rebounds
FO += +columns[9].innerHTML
//assists
FO += +columns[10].innerHTML
//fouls
FO -= +columns[11].innerHTML
//steals
FO += +columns[12].innerHTML
//turnovers
FO -= 2*(+columns[13].innerHTML)
//blockshots
FO += +columns[14].innerHTML
//scored points
FO += +columns[16].innerHTML
//insert a column with fantasy points
if (FO == FO){//not NaN
var td = document.createElement("td")
td.innerHTML = FO
row.appendChild(td)
}
}
}
}
}
}
|
JavaScript
| 0.00004 |
@@ -2925,105 +2925,68 @@
ters
-%0A stat = splitCol(3, %22-%22)%0A FO += (stat%5B0%5D - stat%5B1%5D)%0A //three-pointers
+ + three-pointers. No need to use of separate 3-point column
%0A
@@ -3008,17 +3008,17 @@
plitCol(
-4
+3
, %22-%22)%0A
|
59514e57f6ceea5bf8153a139d577ec19e08e0b6
|
msg generator: default data is empty object
|
lib/core/GameMsgGenerator.js
|
lib/core/GameMsgGenerator.js
|
/**
* # GameMsgGenerator
*
* Copyright(c) 2015 Stefano Balietti
* MIT Licensed
*
* `nodeGame` component rensponsible creating messages
*
* Static factory of objects of type `GameMsg`.
*
* @see GameMsg
* @see node.target
* @see node.action
*/
(function(exports, parent) {
"use strict";
// ## Global scope
exports.GameMsgGenerator = GameMsgGenerator;
var GameMsg = parent.GameMsg,
GameStage = parent.GameStage,
constants = parent.constants;
/**
* ## GameMsgGenerator constructor
*
* Creates an instance of GameMSgGenerator
*
*/
function GameMsgGenerator(node) {
this.node = node;
}
// ## GameMsgGenerator methods
/**
* ### GameMsgGenerator.create
*
* Primitive for creating a new GameMsg object
*
* Decorates an input object with all the missing properties
* of a full GameMsg object.
*
* By default GAMECOMMAND, REDIRECT, PCONNET, PDISCONNECT, PRECONNECT
* have priority 1, all the other targets have priority 0.
*
* @param {object} msg Optional. The init object
*
* @return {GameMsg} The full GameMsg object
*
* @see GameMsg
*/
GameMsgGenerator.prototype.create = function(msg) {
var gameStage, priority, node;
node = this.node;
if (msg.stage) {
gameStage = msg.stage;
}
else {
gameStage = node.game ?
node.game.getCurrentGameStage() : new GameStage('0.0.0');
}
if ('undefined' !== typeof msg.priority) {
priority = msg.priority;
}
else if (msg.target === constants.target.GAMECOMMAND ||
msg.target === constants.target.REDIRECT ||
msg.target === constants.target.PCONNECT ||
msg.target === constants.target.PDISCONNECT ||
msg.target === constants.target.PRECONNECT ||
msg.target === constants.target.SERVERCOMMAND ||
msg.target === constants.target.SETUP) {
priority = 1;
}
else {
priority = 0;
}
return new GameMsg({
session: 'undefined' !== typeof msg.session ?
msg.session : node.socket.session,
stage: gameStage,
action: msg.action || constants.action.SAY,
target: msg.target || constants.target.DATA,
from: node.player ? node.player.id : constants.UNDEFINED_PLAYER,
to: 'undefined' !== typeof msg.to ? msg.to : 'SERVER',
text: 'undefined' !== typeof msg.text ? "" + msg.text : null,
data: 'undefined' !== typeof msg.data ? msg.data : null,
priority: priority,
reliable: msg.reliable || 1
});
};
// ## Closure
})(
'undefined' != typeof node ? node : module.exports,
'undefined' != typeof node ? node : module.parent.exports
);
|
JavaScript
| 0.99835 |
@@ -2712,20 +2712,18 @@
.data :
-null
+%7B%7D
,%0A
|
3769970f9539ade7f97b64d2c797cdd694b237aa
|
Add fontPicker module
|
app/assets/javascripts/miq_angular_application.js
|
app/assets/javascripts/miq_angular_application.js
|
ManageIQ.angular.app = angular.module('ManageIQ', [
'ui.select',
'ui.bootstrap',
'ui.codemirror',
'patternfly',
'patternfly.charts',
'frapontillo.bootstrap-switch',
'angular.validators',
'miq.api',
'miq.card',
'miq.compat',
'miq.util',
'kubernetesUI',
'miqStaticAssets.dialogEditor',
'miqStaticAssets.dialogUser',
]);
miqHttpInject(ManageIQ.angular.app);
ManageIQ.angular.rxSubject = new Rx.Subject();
ManageIQ.constants = {
reportData: 'report_data',
};
function miqHttpInject(angular_app) {
angular_app.config(['$httpProvider', function($httpProvider) {
$httpProvider.defaults.headers.common['X-Angular-Request'] = true;
$httpProvider.defaults.headers.common['X-CSRF-Token'] = function() {
return $('meta[name=csrf-token]').attr('content');
};
$httpProvider.interceptors.push(['$q', function($q) {
return {
responseError: function(err) {
sendDataWithRx({
serverError: err,
source: '$http',
});
console.error('$http: Server returned a non-200 response:', err.status, err.statusText, err);
return $q.reject(err);
},
};
}]);
}]);
return angular_app;
}
function miq_bootstrap(selector, app) {
app = app || 'ManageIQ';
return angular.bootstrap($(selector), [app], { strictDi: true });
}
function miqCallAngular(data) {
ManageIQ.angular.scope.$apply(function() {
ManageIQ.angular.scope[data.name].apply(ManageIQ.angular.scope, data.args);
});
}
function sendDataWithRx(data) {
ManageIQ.angular.rxSubject.onNext(data);
}
|
JavaScript
| 0 |
@@ -269,16 +269,45 @@
tesUI',%0A
+ 'ManageIQ.fonticonPicker',%0A
'miqSt
|
1964c26403d5d5d089b1ef49b0962f5a1fc6199d
|
Update acquiredtasteCrafting.js
|
src/modules/crafting/acquiredtasteCrafting.js
|
src/modules/crafting/acquiredtasteCrafting.js
|
export const acquiredtaste = [
{
"item": "Sweet Dumpling Box",
"createdBy": "Acquired Taste",
"orders": [
{
"duration": "6h",
"cost": 150000,
"output": 6,
"ingredients": [
{"name": "Common Wheat", "quantity": 4},
{"name": "Advanced Wheat", "quantity": 5},
{"name": "Rare Material", "quantity": 3},
{"name": "Soulstone", "quantity": 30},
{"name": "Moonstone", "quantity": 7},
{"name": "Sacred Orb", "quantity": 30},
{"name": "Elysian Orb", "quantity": 7}
]
},
{
"duration": "12h",
"cost": 300000,
"output": 15,
"ingredients": [
{"name": "Common Wheat", "quantity": 8},
{"name": "Advanced Wheat", "quantity": 10},
{"name": "Rare Material", "quantity": 5},
{"name": "Soulstone", "quantity": 55},
{"name": "Moonstone", "quantity": 15},
{"name": "Sacred Orb", "quantity": 55},
{"name": "Elysian Orb", "quantity": 15}
]
},
{
"duration": "1d",
"cost": 600000,
"output": 35,
"ingredients": [
{"name": "Common Wheat", "quantity": 15},
{"name": "Advanced Wheat", "quantity": 20},
{"name": "Rare Material", "quantity": 10},
{"name": "Soulstone", "quantity": 110},
{"name": "Moonstone", "quantity": 30},
{"name": "Sacred Orb", "quantity": 110},
{"name": "Elysian Orb", "quantity": 30}
]
}
]
},
{
"item": "Spicy Dumpling Box",
"createdBy": "Acquired Taste",
"orders": [
{
"duration": "6h",
"cost": 150000,
"output": 2,
"ingredients": [
{"name": "Common Wheat", "quantity": 4},
{"name": "Advanced Wheat", "quantity": 5},
{"name": "Rare Material", "quantity": 3},
{"name": "Soulstone", "quantity": 30},
{"name": "Moonstone", "quantity": 7},
{"name": "Sacred Orb", "quantity": 30},
{"name": "Elysian Orb", "quantity": 7}
]
},
{
"duration": "12h",
"cost": 300000,
"output": 3,
"ingredients": [
{"name": "Common Wheat", "quantity": 8},
{"name": "Advanced Wheat", "quantity": 10},
{"name": "Rare Material", "quantity": 5},
{"name": "Soulstone", "quantity": 55},
{"name": "Moonstone", "quantity": 15},
{"name": "Sacred Orb", "quantity": 55},
{"name": "Elysian Orb", "quantity": 15}
]
},
{
"duration": "1d",
"cost": 600000,
"output": 5,
"ingredients": [
{"name": "Common Wheat", "quantity": 15},
{"name": "Advanced Wheat", "quantity": 20},
{"name": "Rare Material", "quantity": 10},
{"name": "Soulstone", "quantity": 110},
{"name": "Moonstone", "quantity": 30},
{"name": "Sacred Orb", "quantity": 110},
{"name": "Elysian Orb", "quantity": 30}
]
}
]
},
{
"item": "Dragon Soup Box",
"createdBy": "Acquired Taste",
"orders": [
{
"duration": "1d",
"cost": 300000,
"output": 6,
"ingredients": [
{"name": "Common Wheat", "quantity": 15},
{"name": "Advanced Wheat", "quantity": 20},
{"name": "Rare Material", "quantity": 10},
{"name": "Soulstone", "quantity": 70},
{"name": "Moonstone", "quantity": 15},
{"name": "Sacred Orb", "quantity": 70},
{"name": "Elysian Orb", "quantity": 15}
]
},
{
"duration": "3d",
"cost": 300000,
"output": 12,
"ingredients": [
{"name": "Common Wheat", "quantity": 45},
{"name": "Advanced Wheat", "quantity": 55},
{"name": "Rare Material", "quantity": 30},
{"name": "Soulstone", "quantity": 120},
{"name": "Moonstone", "quantity": 25},
{"name": "Sacred Orb", "quantity": 120},
{"name": "Elysian Orb", "quantity": 25}
]
},
{
"duration": "5d",
"cost": 600000,
"output": 25,
"ingredients": [
{"name": "Common Wheat", "quantity": 70},
{"name": "Advanced Wheat", "quantity": 95},
{"name": "Rare Material", "quantity": 50},
{"name": "Soulstone", "quantity": 250},
{"name": "Moonstone", "quantity": 50},
{"name": "Sacred Orb", "quantity": 250},
{"name": "Elysian Orb", "quantity": 50}
]
}
]
}
];
|
JavaScript
| 0 |
@@ -51,13 +51,12 @@
%22: %22
-Sweet
+Mild
Dum
@@ -53,35 +53,42 @@
%22Mild Dumpling
-Box
+Food Chest
%22,%0A %22crea
@@ -1992,19 +1992,26 @@
umpling
-Box
+Food Chest
%22,%0A
@@ -3922,11 +3922,18 @@
oup
-Box
+Food Chest
%22,%0A
@@ -5823,6 +5823,7 @@
%7D%0A%0A
-
%5D;
+%0A
|
e452330b726328f22c2f86fedcd9ce098957d2d9
|
bump version
|
package.js
|
package.js
|
Package.describe({
name: 'mike:mocha',
summary: "Run mocha tests in the browser",
version: "0.4.4",
debugOnly: true,
git: "https://github.com/mad-eye/meteor-mocha-web"
});
Npm.depends({
mocha: "1.17.1",
chai: "1.9.0",
mkdirp: "0.5.0"
});
//TODO break this out into a separate package and depend weakly
//Require npm assertion library if it doesn't exist..
//Npm.depends({chai: "1.9.0"});
Package.on_use(function (api, where) {
api.use(['velocity:[email protected]'], "server");
api.use(['velocity:[email protected]'], "client");
api.use(['[email protected]'], "client");
api.use(['velocity:[email protected]'], ["client", "server"]);
api.add_files(["reporter.js", "server.js"], "server");
api.add_files(["client.html", "mocha.js", "reporter.js", "client.js", "chai.js"], "client");
api.add_files(["sample-tests/client.js","sample-tests/server.js"], "server", {isAsset: true});
api.export("MochaWeb", ["client", "server"]);
api.export("MeteorCollectionTestReporter", ["client", "server"]);
});
|
JavaScript
| 0 |
@@ -95,17 +95,17 @@
n: %220.4.
-4
+5
%22,%0A deb
|
9233735dd547e19ac710cbc3280392144442252f
|
Fix comment
|
sked.js
|
sked.js
|
/**
* JS supplement to the Sked PHP calendar library.
*
* @see https://github.com/CampusUnion/Sked
*/
(function($) {
$(document).ready(function(){
// Pluralize intervals (days, weeks, etc.) based on frequency
$('.sked-form select[name="frequency"], .sked-form select[name="lead_time_num"]').change(function(){
var bPlural = $(this).val() !== '1';
var fnPluralString = function(){
var strText = $(this).text();
if (bPlural && strText !== '-' && !strText.match('s$'))
$(this).text(strText + 's');
else if (!bPlural && strText.match('s$'))
$(this).text(strText.slice(0, -1));
};
$(this).siblings('select').children('option').each(fnPluralString);
}).change();
// Only show weekdays for weekly & monthly intervals
$('.sked-form select[name="interval"]').change(function(){
var bHide = ($(this).val() === '1' || $(this).val() === '');
$('[name="weekdays[]"]').prop('disabled', bHide)
.parents('.sked-input-wrapper')[bHide ? 'hide' : 'show']();
}).change();
// Toggle recurring-event fields based on
$('.sked-form input[name="repeats"]').change(function(){
if ($(this).is(':checked'))
$('.sked-input-recurring').show();
else
$('.sked-input-recurring').hide();
}).change();
});
})(jQuery);
// Tell dependency loaders we're here.
window.skedJsLoaded = true;
|
JavaScript
| 0 |
@@ -1230,16 +1230,35 @@
based on
+ %22repeats%22 checkbox
%0A
|
2395b99ee8350faa4da126fa28fc1ea1683db5d5
|
Rename timestamp to data and show data instead of this.raw (which doesn't do anything)
|
eg/accelerometer.js
|
eg/accelerometer.js
|
var five = require("../lib/johnny-five.js"),
board, accel;
board = new five.Board();
board.on("ready", function() {
// Create a new `Accelerometer` hardware instance.
//
// five.Accelerometer([ x, y[, z] ]);
//
// five.Accelerometer({
// pins: [ x, y[, z] ]
// freq: ms
// });
//
accel = new five.Accelerometer({
pins: [ "A3", "A4", "A5" ],
freq: 100,
threshold: 0.2
});
// Accelerometer Event API
// "acceleration"
//
// Fires once every N ms, equal to value of freg
// Defaults to 500ms
//
accel.on("acceleration", function( err, data ) {
console.log( "acceleration", data.smooth );
});
// "axischange"
//
// Fires only when X, Y or Z has changed
//
accel.on("axischange", function( err, timestamp ) {
console.log( "axischange", this.raw );
});
});
// @markdown
//
// - [Triple Axis Accelerometer, MMA7361](https://www.sparkfun.com/products/9652)
// - [Triple-Axis Accelerometer, ADXL326](http://www.adafruit.com/products/1018)
//
// @markdown
|
JavaScript
| 0.000001 |
@@ -767,17 +767,12 @@
rr,
-timestamp
+data
) %7B
@@ -808,16 +808,19 @@
e%22,
-this.raw
+data.smooth
);%0A
|
87da8d786274bd2aa9f7fb0ae42790002b3e3d3b
|
Update tpoll.js
|
chat-plugins/tpoll.js
|
chat-plugins/tpoll.js
|
exports.commands = {
tierpoll: 'tpoll',
tpoll: function (target, room, user) {
return this.parse('/poll new Tournament Tier?, Anything Goes, Challenge Cup 1v1, Monotype, OU, Random Battle, Random Monotype Battle, VGC, UU, RU, NU, PU, LC, Ubers, OMM, 8's, Gen One Random, Capture and Evolve, Hackmons');
}
}
|
JavaScript
| 0 |
@@ -279,10 +279,13 @@
MM,
-8'
+Eight
s, G
|
aa9e92f5f589856fad0af662cbeeab1c4bb200d8
|
patch release - Bump to version 1.9.1
|
package.js
|
package.js
|
Package.describe({
summary: 'Accounts Templates styled for Twitter Bootstrap.',
version: '1.9.0',
name: 'useraccounts:bootstrap',
git: 'https://github.com/meteor-useraccounts/bootstrap.git',
});
Package.on_use(function(api, where) {
api.versionsFrom('[email protected]');
api.use([
'less',
'templating',
], 'client');
api.use([
'useraccounts:core',
], ['client', 'server']);
api.imply([
'useraccounts:[email protected]',
], ['client', 'server']);
api.add_files([
'lib/at_error.html',
'lib/at_error.js',
'lib/at_form.html',
'lib/at_form.js',
'lib/at_input.html',
'lib/at_input.js',
'lib/at_nav_button.html',
'lib/at_nav_button.js',
'lib/at_oauth.html',
'lib/at_oauth.js',
'lib/at_pwd_form.html',
'lib/at_pwd_form.js',
'lib/at_pwd_form_btn.html',
'lib/at_pwd_form_btn.js',
'lib/at_pwd_link.html',
'lib/at_pwd_link.js',
'lib/at_reCaptcha.html',
'lib/at_reCaptcha.js',
'lib/at_result.html',
'lib/at_result.js',
'lib/at_sep.html',
'lib/at_sep.js',
'lib/at_signin_link.html',
'lib/at_signin_link.js',
'lib/at_signup_link.html',
'lib/at_signup_link.js',
'lib/at_social.html',
'lib/at_social.js',
'lib/at_terms_link.html',
'lib/at_terms_link.js',
'lib/at_resend_verification_email_link.html',
'lib/at_resend_verification_email_link.js',
'lib/at_title.html',
'lib/at_title.js',
'lib/full_page_at_form.html',
'lib/at_bootstrap.less'
], ['client']);
});
Package.on_test(function(api) {
api.use([
'useraccounts:bootstrap',
'useraccounts:[email protected]',
]);
api.use([
'accounts-password',
'tinytest',
'test-helpers'
], ['client', 'server']);
api.add_files([
'tests/tests.js'
], ['client', 'server']);
});
|
JavaScript
| 0 |
@@ -87,25 +87,25 @@
rsion: '1.9.
-0
+1
',%0A name: '
@@ -432,25 +432,25 @@
ts:[email protected].
-0
+1
',%0A %5D, %5B'cl
@@ -1615,17 +1615,17 @@
[email protected].
-0
+1
',%0A %5D);
|
5e6eb735f836ccd38d32fe62b042be2be00bd8e1
|
fix Beats playback not recognized and album artwork not displayed
|
src/controllers/BeatsMusicController.js
|
src/controllers/BeatsMusicController.js
|
controller = new BasicController({
supports: {
playpause: true,
next: true,
previous: true,
thumbsUp: true,
thumbsDown: true
},
playStateSelector: '#play_pause_icon',
playStateClass: '.icon-bicons_pause',
playPauseSelector: '#play_pause_icon',
nextSelector: '#t-next',
previousSelector: '#t-prev',
titleSelector: '.track',
artistSelector: '.artist',
artworkImageSelector: '#t-art',
thumbsUpSelector: "#t-love",
thumbsDownSelector: "#t-hate",
isThumbsUpSelector: "#t-love.active",
isThumbsDownSelector: "#t-hate.active",
});
console.log("Got the Beats controller");
|
JavaScript
| 0 |
@@ -205,17 +205,16 @@
Class: '
-.
icon-bic
@@ -225,16 +225,16 @@
pause',%0A
+
playPa
@@ -563,16 +563,45 @@
ve%22,%0A%7D);
+%0A%0A// verify controller loaded
%0Aconsole
@@ -633,8 +633,457 @@
oller%22);
+%0A%0A// grab url from background-image and upgrade to medium size%0Acontroller.override('getAlbumArt', function() %7B%0A var art = document.getElementById(%22t-art%22);%0A var artURL = getComputedStyle(art).getPropertyValue('background-image').slice(4,-1);%0A var artMed = artURL.replace('small', 'medium');%0A return artMed;%0A%7D);%0A%0A// listen for click to recheck for play state%0Adocument.body.addEventListener(%22click%22, function() %7B%0A setTimeout(sendState, 1000);%0A%7D);
|
d689a503e2f97fbeeaaac1bf4cc74e60747d6b9b
|
fix config.bundle
|
nimoy.js
|
nimoy.js
|
// NIMOY
// deps
var http = require('http')
var https = require('https')
var gzip = require('zlib').createGzip
var wsserver = require('ws').Server
var wsstream = require('websocket-stream')
var argv = require('optimist').argv
var through = require('through')
var fs = require('fs')
// handle config
var config = JSON.parse(fs.readFileSync('./config.json'))
if (!config) { config = {port:8000,host:localhost,encrypt:false,dirStatic:'./_static/',dirWilds:'./_wilds/'} }
if (argv) { // allow commandline args to override config
for (arg in argv) {
if (config[arg]) config[arg] = argv[arg]
}
}
function makeBricoMap (wilds, fin) {
var asyncMap = require('slide').asyncMap
var MAP = {}
function readPkg (modDir, next) {
var pkg = JSON.parse(fs.readFileSync(wilds+modDir+'/package.json'))
if (pkg.brico) {
MAP[pkg.name] = pkg
next()
} else next()
}
fs.readdir(wilds, function moduleList (e, modules) {
if (!e) asyncMap(modules, readPkg, fin)
})
}
function startFileServer (opts, boot) {
// how to handle subdomains?
var server
var static = opts.dir_static
var indexHtml = '<html><head></head><body><script src="/'+ config.bundle +'"></script></body></html>'
if (config.bundle) {
config.bundle = fs.readFileSync
}
if (config.dirStatic[config.dirStatic.length-1] !== '/') config.dirStatic += '/'
if (config.dirWilds[config.dirWilds.length-1] !== '/') config.dirWilds += '/'
if (config.encrypt === true) {
var certs = {key: fs.readFileSync(config.certs.key),cert: fs.readFileSync(config.certs.cert)}
server = https.createServer(certs, HandleReqs)
} else {
server = http.createServer(HandleReqs)
}
function HandleReqs (req, res) {
req.url.substr(1,1) // remove backslash
if (req.url === '') {
res.setHeader('Content-Type', 'text/html')
res.end(indexHtml)
} else if (req.url !== '') {
var file = fs.createReadStream(config.dirStatic + req.url)
file.on('error', function(e) {
console.error(e)
res.statusCode = 404
res.end('error 404')
})
res.setHeader('Content-Encoding', 'gzip')
file.pipe(gzip()).pipe(res)
}
}
server.listen(opts.port, opts.host, boot)
}
function wsServer (opts) {
var socs = []
var ws = new wsserver({port:wsport})
ws.on('connection', function (soc) {
var wss = wsstream(soc)
var headers = soc.upgradeReq.headers
if (headers.origin === 'https;//app.basilranch.com') {
if (headers['sec-websocket-key']) var key = headers['sec-websocket-key']
if (!headers['sec-websocket-key']) var key = headers['sec-websocket-key1'].replace(' ','_')
wss.ident = key //!this is probly not secure?
socs.push(wss)
wss.on('close', function () {
for(var i = 0;i<socs.length;i++) {
if (socs[i].ident == key) socs.splice(i,1); break;
}
})
}
})
}
function constructBrico () {
// assemble brico
}
function boot () {
}
startFileServer(config, boot)
|
JavaScript
| 0.000004 |
@@ -1067,17 +1067,16 @@
omains?%0A
-%0A
var se
@@ -1238,21 +1238,47 @@
bundle)
-%7B%0A
+var bundleFile = config.bundle;
config.
@@ -1301,20 +1301,51 @@
FileSync
-%0A %7D
+(config.dirStatic + config.bundle);
%0A%0A if (
|
78a393e190cabe92d597bcd795d0720b38e05bc4
|
Update constant varriables to using const
|
app/controllers/twitter_auth0_sign_in_callback.js
|
app/controllers/twitter_auth0_sign_in_callback.js
|
const config = require('config')
const request = require('request')
const logger = require('../../lib/logger.js')()
const { Authentication } = require('../../lib/auth0')
var AccessTokenHandler = function (req, res) {
return function (err, response, body) {
if (err) {
console.error('Error obtaining access token from Twitter:')
console.log(err)
res.redirect('/error/no-twitter-access-token')
return
}
if (body.error && body.error === 'access_denied') {
res.redirect('/error/no-twitter-access-token')
return
}
let auth0 = Authentication()
function handleUserInfo (err, user) {
if (err) {
console.error('Error obtaining access token from Twitter:')
console.log(err)
// TODO: Redirect to error page indicating invalid access token
res.redirect('/error/no-twitter-access-token')
return
}
var apiRequestBody = {
auth0_twitter: {
screenName: user[`${config.auth0.screen_name_custom_claim}`],
auth0_id: user.sub,
profile_image_url: user.picture
}
}
// Must be an absolute URI
let endpoint = config.restapi.protocol + config.app_host_port + config.restapi.baseuri + '/v1/users'
request.post({ url: endpoint, json: apiRequestBody }, function (err, response, body) {
if (err) {
logger.error('Error from API when signing in: ' + err)
res.redirect('/error/authentication-api-problem')
return
}
console.log(body)
// Redirect user
res.cookie('user_id', body.id)
res.cookie('login_token', body.loginToken)
res.redirect('/')
})
}
auth0.getProfile(body.access_token, handleUserInfo)
}
}
exports.get = function (req, res) {
if (req.query.error === 'access_denied') {
res.redirect('/error/twitter-access-denied')
}
let code = req.query.code
// TODO: Update twitter callback uri from oauth
let redirectUri = config.restapi.protocol + config.app_host_port + config.twitter.oauth_callback_uri
let options = {
method: 'POST',
url: config.auth0.token_api_url,
headers: { 'content-type': 'application/json' },
body: {
grant_type: 'authorization_code',
client_id: config.auth0.client_id,
client_secret: config.auth0.client_secret,
code: code,
redirect_uri: redirectUri
},
json: true
}
console.log(options)
request(options, AccessTokenHandler(req, res))
}
|
JavaScript
| 0 |
@@ -164,19 +164,21 @@
uth0')%0A%0A
-var
+const
AccessT
@@ -565,18 +565,20 @@
%7D%0A%0A
-le
+cons
t auth0
@@ -908,11 +908,13 @@
-var
+const
api
@@ -1155,18 +1155,20 @@
I%0A
-le
+cons
t endpoi
@@ -1526,34 +1526,8 @@
%7D%0A
- console.log(body)%0A
@@ -1878,18 +1878,20 @@
%0A %7D%0A%0A
-le
+cons
t code =
@@ -1958,18 +1958,20 @@
oauth%0A
-le
+cons
t redire
@@ -2063,18 +2063,20 @@
k_uri%0A
-le
+cons
t option
@@ -2409,35 +2409,12 @@
rue%0A
+
%7D%0A
- console.log(options)%0A
re
|
a2cd1a78553449c0e3e6cc1bfa0cadd23e6963e3
|
Add silent option to config.option / config.options
|
public/src/js/config.js
|
public/src/js/config.js
|
/*
* debugger.io: An interactive web scripting sandbox
*
* config.js: simple configuration manager
*/
define(['promise!config_p'], function(config) {
delete window._debugger_io;
if (!config.prod) { window.config = config; }
return config;
});
define('config_p', ['jquery', 'underscore'],
function($, _) {
'use strict';
var config = {};
var hostname = window.location.hostname;
// default options
var options = {
github: 'https://github.com/gavinhungry/debugger.io',
root: _.sprintf('//%s/', hostname), // debugger.io
frame: _.sprintf('//frame.%s/', hostname), // frame.debugger.io
username: window._debugger_io.username,
csrf: window._debugger_io.csrf
};
/**
* Create a new config option
*
* Values may always be functions, but any value originally declared as a
* boolean must either be a boolean or a function that returns a boolean
*
* @param {String} option - option name
* @param {Mixed} value - initial value
*/
config.option = function(option, value) {
if (config.hasOwnProperty(option)) { return; }
var isBool = _.isBoolean(value);
Object.defineProperty(config, option, {
get: function() {
var val = options[option];
var isFn = _.isFunction(val);
return isFn ? (isBool ? !!val() : val()) : val;
},
set: function(val) {
var isFn = _.isFunction(val);
options[option] = (isBool && !isFn) ? !!val : val;
// proxy config updates to event bus
$(document).trigger('_debugger_io-config', {
option: option,
value: config[option]
});
}
});
config[option] = value;
};
/**
* Create multiple new config options
*
* @param {Object} opts - key/value pairs
*/
config.options = function(opts) {
_.each(opts, function(value, option) { config.option(option, value); });
};
config.options(options);
// get additional client-side config options from the server
var d = $.Deferred();
$.get('/config').done(function(data) {
config.options(data);
d.resolve(config);
}).fail(function() {
d.resolve(config);
});
return d.promise();
});
|
JavaScript
| 0.000005 |
@@ -979,16 +979,91 @@
l value%0A
+ * @param %7BBoolean%7D %5Bsilent%5D - if true, do not proxy update to event bus%0A
*/%0A
@@ -1100,16 +1100,24 @@
n, value
+, silent
) %7B%0A
@@ -1543,16 +1543,27 @@
//
+ optionally
proxy c
@@ -1589,16 +1589,41 @@
ent bus%0A
+ if (!silent) %7B%0A
@@ -1673,24 +1673,26 @@
%7B%0A
+
option: opti
@@ -1695,16 +1695,18 @@
option,%0A
+
@@ -1737,20 +1737,32 @@
+
%7D);%0A
+ %7D%0A
%7D%0A
@@ -1899,16 +1899,91 @@
e pairs%0A
+ * @param %7BBoolean%7D %5Bsilent%5D - if true, do not proxy update to event bus%0A
*/%0A
@@ -2012,16 +2012,24 @@
ion(opts
+, silent
) %7B%0A
@@ -2066,16 +2066,22 @@
ption) %7B
+%0A
config.
@@ -2100,18 +2100,30 @@
n, value
-);
+, silent);%0A
%7D);%0A %7D
@@ -2149,16 +2149,22 @@
(options
+, true
);%0A%0A //
|
9953f4623e3dc50ab14ea48d148a484b0eb35366
|
Set loading state false just before leave page - in Safari the back/forward cache will restore the login page state including javascript state, leaving the loading state true and the spinner spinning.
|
src/plugin/modules/components/signinButton.js
|
src/plugin/modules/components/signinButton.js
|
define([
'knockout-plus',
'kb_common/html',
'kb_common_ts/Auth2Error'
], function (
ko,
html,
Auth2Error
) {
'use strict';
var t = html.tag,
div = t('div'),
span = t('span'),
img = t('img');
function viewModel(params) {
// import params into this VM.
var provider = params.provider;
var runtime = params.runtime;
var nextRequest = params.nextRequest;
var assetsPath = params.assetsPath;
var origin = params.origin;
var imageBase = assetsPath + '/providers/' + provider.id.toLowerCase() + '/signin-button/';
var state = ko.observable('normal');
var doMouseOver = function () {
state('hover');
};
var doMouseOut = function () {
state('normal');
};
var imageSource = ko.pureComputed(function () {
switch (state()) {
case 'normal':
return imageBase + 'normal.png';
case 'hover':
return imageBase + 'pressed.png';
case 'disabled':
return imageBase + 'disabled.png';
default:
return imageBase + 'normal.png';
}
});
// ['normal', 'disabled', 'focus', 'pressed'].forEach(function (state) {
// provider.imageSource[state] = imageBase + state + '.png';
// });
var disabled = ko.observable(false);
var loading = ko.observable(false);
function doSignin(data) {
// set last provider...
data.loading(true);
// providers.forEach(function (provider) {
// provider.state('disabled');
// provider.disabled(true);
// });
// loginStart(runtime, data.id, {
// nextrequest: nextRequest,
// origin: 'login'
// });
runtime.service('session').getClient().loginCancel()
.catch(Auth2Error.AuthError, function (err) {
// ignore this specific error...
if (err.code !== '10010') {
throw err;
}
})
.catch(function (err) {
// TODO: show error.
console.error('Skipping error', err);
})
.finally(function () {
// don 't care whether it succeeded or failed.
return runtime.service('session').loginStart({
// TODO: this should be either the redirect url passed in
// or the dashboard.
// We just let the login page do this. When the login page is
// entered with a valid token, redirect to the nextrequest,
// and if that is empty, the dashboard.
state: {
nextrequest: nextRequest,
origin: origin
},
provider: provider.id
});
});
}
return {
runtime: runtime,
provider: provider,
doSignin: doSignin,
imageSource: imageSource,
state: state,
doMouseOver: doMouseOver,
doMouseOut: doMouseOut,
disabled: disabled,
loading: loading,
assetsPath: assetsPath
};
}
function template() {
return div({
style: {
textAlign: 'center',
margin: '4px',
padding: '4px',
position: 'relative'
}
}, [
img({
style: {
height: '44px',
cursor: 'pointer'
},
class: 'signin-button',
dataBind: {
click: 'doSignin',
event: {
mouseover: 'doMouseOver',
mouseout: 'doMouseOut'
},
attr: {
src: 'imageSource'
}
}
}),
div({
style: {
position: 'absolute',
top: '0',
left: '0',
width: '100%',
height: '100%',
textAlign: 'center',
paddingTop: '4px',
pointerEvents: 'none'
},
dataBind: {
visible: 'loading'
}
}, span({
class: 'fa fa-spinner fa-pulse fa-3x',
style: {
color: '#FFF'
}
}))
]);
}
function component() {
return {
viewModel: viewModel,
template: template()
};
}
ko.components.register('signin-button', component());
});
|
JavaScript
| 0 |
@@ -2392,15 +2392,12 @@
.
-finally
+then
(fun
@@ -2495,23 +2495,16 @@
-return
runtime.
@@ -3117,32 +3117,126 @@
%7D);%0A
+ %7D)%0A .finally(function () %7B%0A loading(false);%0A
|
3a1b139d15de588c064d0baf6d572b8e979ec811
|
update setNativeProps()
|
elements/Polygon.js
|
elements/Polygon.js
|
import React, { Component } from "react";
import PropTypes from "prop-types";
import Path from "./Path";
import { pathProps } from "../lib/props";
import extractPolyPoints from "../lib/extract/extractPolyPoints";
export default class extends Component {
static displayName = "Polygon";
static propTypes = {
...pathProps,
points: PropTypes.oneOfType([PropTypes.string, PropTypes.array])
.isRequired
};
static defaultProps = {
points: ""
};
setNativeProps = (...args) => {
//noinspection JSUnresolvedFunction
this.root.getNativeElement().setNativeProps(...args);
};
render() {
let points = this.props.points;
if (Array.isArray(points)) {
points = points.join(",");
}
return (
<Path
ref={ele => {
this.root = ele;
}}
{...this.props}
d={`M${extractPolyPoints(points)}z`}
/>
);
}
}
|
JavaScript
| 0 |
@@ -583,36 +583,250 @@
-this.root.getNativeElement()
+var points = %5B...args%5D%5B0%5D.points;%0A if (points) %7B%0A if (Array.isArray(points)) %7B%0A points = points.join(%22,%22);%0A %7D%0A %5B...args%5D%5B0%5D.d = %60M$%7BextractPolyPoints(points)%7D%60%0A %7D%0A this.root
.set
|
75e4a43f5992b73c94af60f75a1a75f734533f9c
|
replace const with let
|
modules/Record.js
|
modules/Record.js
|
const guard = Symbol('EmptyRecord');
const values = Symbol('CustomValues');
const defaults = Symbol('DefaultValues');
const empty = () => void 0;
export default class Record {
constructor(custom = {}) {
if (custom === guard) return this;
if (!this.constructor.hasOwnProperty(defaults)) {
const emptyRecord = new this.constructor(guard);
Object.defineProperty(this.constructor, defaults, {
enumerable: false,
get: () => emptyRecord,
});
}
const base = this.constructor[defaults];
for (const key in base) {
if (!base.hasOwnProperty(key)) continue;
const getter = key in custom ? () => custom[key] : () => base[key];
Object.defineProperty(this, key, {
enumerable: true,
get: getter,
set: empty,
});
}
Object.defineProperty(this, values, {
enumerable: false,
get: () => custom,
});
}
copy(patch) {
const custom = Object.assign({}, this[values], patch);
const prototype = Object.getPrototypeOf(this);
return new prototype.constructor(custom);
}
equals(record) {
const a = this[values];
const b = record[values];
for (const key in this.constructor[defaults]) {
if (a[key] !== b[key]) return false;
}
return true;
}
toJSON() {
const result = {};
for (const key in this.constructor[defaults]) {
result[key] = this[key];
}
return result;
}
}
|
JavaScript
| 0.001193 |
@@ -1,12 +1,10 @@
-cons
+le
t guard
@@ -28,20 +28,18 @@
cord');%0A
-cons
+le
t values
@@ -65,20 +65,18 @@
lues');%0A
-cons
+le
t defaul
@@ -105,20 +105,18 @@
lues');%0A
-cons
+le
t empty
@@ -291,20 +291,18 @@
%7B%0A
-cons
+le
t emptyR
@@ -476,20 +476,18 @@
%7D%0A%0A
-cons
+le
t base =
@@ -517,36 +517,34 @@
lts%5D;%0A%0A for (
-cons
+le
t key in base) %7B
@@ -598,20 +598,18 @@
%0A%0A
-cons
+le
t getter
@@ -915,20 +915,18 @@
) %7B%0A
-cons
+le
t custom
@@ -972,20 +972,18 @@
h);%0A
-cons
+le
t protot
@@ -1091,20 +1091,18 @@
) %7B%0A
-cons
+le
t a = th
@@ -1117,20 +1117,18 @@
s%5D;%0A
-cons
+le
t b = re
@@ -1143,36 +1143,34 @@
ues%5D;%0A%0A for (
-cons
+le
t key in this.co
@@ -1281,20 +1281,18 @@
) %7B%0A
-cons
+le
t result
@@ -1308,20 +1308,18 @@
for (
-cons
+le
t key in
|
1a04f497191e02e6561c778ea07322b23a38a525
|
patch release - Bump to version 1.14.2
|
package.js
|
package.js
|
Package.describe({
summary: 'Accounts Templates MDL.',
version: '1.14.1',
name: 'useraccounts:mdl',
git: 'https://github.com/meteor-useraccounts/mdl.git',
});
Package.on_use(function(api, where) {
api.versionsFrom('[email protected]');
api.use([
'templating',
'underscore',
], 'client');
api.use([
'useraccounts:core',
], ['client', 'server']);
// Requires all routing packages loads before this asking for weak dependencies.
api.use('useraccounts:[email protected]', ['client', 'server'], {weak: true});
api.use('useraccounts:[email protected]', ['client', 'server'], {weak: true});
api.imply([
'useraccounts:[email protected]',
], ['client', 'server']);
api.add_files([
'lib/at_error.html',
'lib/at_error.js',
'lib/at_form.html',
'lib/at_form.js',
'lib/at_input.html',
'lib/at_input.js',
'lib/at_message.html',
'lib/at_message.js',
'lib/at_nav_button.html',
'lib/at_nav_button.js',
'lib/at_oauth.html',
'lib/at_oauth.js',
'lib/at_pwd_form.html',
'lib/at_pwd_form.js',
'lib/at_pwd_form_btn.html',
'lib/at_pwd_form_btn.js',
'lib/at_pwd_link.html',
'lib/at_pwd_link.js',
'lib/at_reCaptcha.html',
'lib/at_reCaptcha.js',
'lib/at_resend_verification_email_link.html',
'lib/at_resend_verification_email_link.js',
'lib/at_result.html',
'lib/at_result.js',
'lib/at_sep.html',
'lib/at_sep.js',
'lib/at_signin_link.html',
'lib/at_signin_link.js',
'lib/at_signup_link.html',
'lib/at_signup_link.js',
'lib/at_social.html',
'lib/at_social.js',
'lib/at_terms_link.html',
'lib/at_terms_link.js',
'lib/at_title.html',
'lib/at_title.js',
'lib/full_page_at_form.html',
'lib/at_mdl.css'
], ['client']);
});
Package.on_test(function(api) {
api.use([
'useraccounts:mdl',
'useraccounts:[email protected]'
]);
api.use([
'accounts-password',
'tinytest',
'test-helpers'
], ['client', 'server']);
api.add_files([
'tests/tests.js'
], ['client', 'server']);
});
|
JavaScript
| 0 |
@@ -63,25 +63,25 @@
sion: '1.14.
-1
+2
',%0A name: '
@@ -482,33 +482,33 @@
[email protected].
-1
+2
', %5B'client', 's
@@ -573,17 +573,17 @@
[email protected].
-1
+2
', %5B'cli
@@ -657,17 +657,17 @@
[email protected].
-1
+2
',%0A %5D,
@@ -1876,17 +1876,17 @@
[email protected].
-1
+2
'%0A %5D);%0A
|
593e604efe9f8a6fa3e98ca44aed348afb44f952
|
bump minor instead
|
package.js
|
package.js
|
Package.describe({
name: "aldeed:simple-schema",
summary: "A simple schema validation object with reactivity. Used by collection2 and autoform.",
version: "1.0.4",
git: "https://github.com/aldeed/meteor-simple-schema.git"
});
Npm.depends({
"string": "1.6.0"
});
Package.on_use(function(api) {
if (api.versionsFrom) {
api.use('[email protected]');
api.use('[email protected]');
api.use('[email protected]');
api.use('[email protected]');
} else {
api.use(['deps', 'underscore', 'check', 'random']);
}
api.add_files('string.js', 'client');
api.add_files([
'mongo-object.js',
'simple-schema-utility.js',
'simple-schema.js',
'simple-schema-validation.js',
'simple-schema-validation-new.js',
'simple-schema-context.js'
]);
api.export(['SimpleSchema', 'MongoObject'], ['client', 'server']);
});
Package.on_test(function(api) {
if (api.versionsFrom) {
api.use("aldeed:simple-schema");
api.use('[email protected]');
api.use('[email protected]');
} else {
api.use(["simple-schema", "tinytest", "test-helpers"]);
}
api.add_files(["simple-schema-tests.js", "mongo-object-tests.js"], ['client', 'server']);
});
|
JavaScript
| 0 |
@@ -161,11 +161,11 @@
%221.
-0.4
+1.0
%22,%0A
|
10ba49329c25a92e3738d08bebae59e7bd06dd0e
|
remove log
|
server/api.js
|
server/api.js
|
'use strict';
const express = require('express');
const app = express.Router();
const messagesApi = require('./messages.js');
const pushApi = require('./push.js');
const bp = require('body-parser');
function errorResponse(res, e, status) {
res.status(status || 500);
res.json({
error: e.message
});
}
app.use(bp.json());
app.get('/poke', function (req,res) {
if (!req.body.username) {
return errorResponse(res, Error('No username param'), 403);
}
pushApi(req.query.username)
.then(() => {
res.json({success: true})
})
.catch(e => errorResponse(res, e));
});
app.post('/send-message', function (req,res) {
if (!req.body.username) {
return errorResponse(res, Error('No username param'), 403);
}
if (!req.body.message) {
return errorResponse(res, Error('No message param'), 403);
}
let user;
if (req.user && req.user.username) {
user = req.user.username;
}
messagesApi.pushMessage(req.body.username, user, {
to: req.body.username,
type: req.body.type || 'message',
message: req.body.message,
from: user,
timestamp: Date.now()
})
.then(m => {
pushApi(req.body.username);
res.json({
success: true,
noOfMessages: m
});
})
.catch(e => {
console.log(e);
errorResponse(res, e)
});
});
app.all('/get-messages', function (req,res) {
if (!req.user || !req.user.username) {
return errorResponse(res, Error('No username param'), 403);
}
messagesApi
.readIncomingMessages(req.user.username, req.query.start, req.query.amount)
.then(m => {
res.json(m.map(str => {
try {
return JSON.parse(str);
} catch (e) {
return false;
}
}));
})
.then(m => m.filter(l => typeof l === 'object'))
.catch(e => errorResponse(res, e));
});
app.all('/get-sent-messages', function (req,res) {
if (!req.user || !req.user.username) {
return errorResponse(res, Error('No username param'), 403);
}
messagesApi
.readOutgoingMessages(req.user.username, req.query.start, req.query.amount)
.then(m => {
res.json(m.map(str => {
try {
return JSON.parse(str);
} catch (e) {
return false;
}
}));
})
.then(m => m.filter(l => typeof l === 'object'))
.catch(e => errorResponse(res, e));
});
module.exports = app;
|
JavaScript
| 0.000001 |
@@ -1200,26 +1200,8 @@
%3E %7B%0A
-%09%09console.log(e);%0A
%09%09er
|
ba4db6f9a3784557b20d995d7d4198a03d13233b
|
Move capture method cb into page.render cb
|
lib/capturejs.js
|
lib/capturejs.js
|
/*jslint browser: true, node: true, sloppy: true, maxerr: 50, indent: 4 */
// vim: set fenc=utf-8 ts=4 sts=4 sw=4 :
'use strict';
var phantom = require('phantom');
module.exports.capture = function (option, callback) {
callback = callback || function () {};
var args = [],
phantomHandler;
// Handler for Phantom.js
phantomHandler = function (ph) {
ph.createPage(function (page) {
var timer,
matches;
// viewportSize option
if (option.viewportsize) {
matches = option.viewportsize.match(/^(\d+)x(\d+)$/);
if (matches !== null) {
page.set('viewportSize', {width: matches[1], height: matches[2]});
}
}
// UserAgent option
if (option['user-agent']) {
page.set('settings.userAgent', option['user-agent']);
}
// HTTP Timeout option
if (option.timeout) {
timer = setTimeout(function () {
var err = 'Error: ' + option.uri + ' is timeout';
ph.exit();
process.nextTick(function () {
callback(err);
});
}, +option.timeout);
}
// Open web page
page.open(option.uri, function (status) {
if (status === 'fail') {
var err = 'Error: ' + option.uri + 'failed';
ph.exit();
process.nextTick(function () {
callback(err);
});
}
if (typeof timer !== 'undefined') {
clearTimeout(timer);
}
// Injecting external script code
if (option['javascript-file']) {
page.injectJs(option['javascript-file']);
}
/**
* pass parameters into the webpage function.
*
* http://code.google.com/p/phantomjs/issues/detail?id=132
* from comment #43.
*/
page.evaluate((function () {
var func = function (selector) {
document.body.bgColor = 'white';
if (typeof selector === 'undefined') {
return null;
}
var elem = document.querySelector(selector);
return (elem !== null) ? elem.getBoundingClientRect() : null;
};
return 'function() { return (' + func.toString() + ').apply(this, ' + JSON.stringify([option.selector]) + ');}';
}()), function (rect) {
if (rect !== null) {
page.set('clipRect', rect);
}
page.render(option.output);
ph.exit();
process.nextTick(callback);
});
});
});
};
// Setup arguments for Phantom.js
['cookies-file'].forEach(function (key) {
if (option[key]) {
args.push(['--', key, '=', option['cookies-file']].join(''));
}
});
args.push(phantomHandler);
// Execute Phantom.js
phantom.create.apply(phantom, args);
};
|
JavaScript
| 0.000006 |
@@ -2973,19 +2973,36 @@
n.output
-);%0A
+, function () %7B%0A
@@ -3036,32 +3036,36 @@
+
process.nextTick
@@ -3076,16 +3076,40 @@
lback);%0A
+ %7D);%0A
|
afc2c915bac8d6d49f0294a5850a079a209f822e
|
Add TODO item.
|
lib/challenge.js
|
lib/challenge.js
|
var merge = require('utils-merge');
var DuoAuthAPIError = require('../lib/errors/duoauthapierror');
exports = module.exports = function(client) {
return function challenge(authenticator, options, cb) {
if (typeof options == 'function') {
cb = options;
options = undefined;
}
options = options || {};
var type = options.type || 'oob';
//var type = options.type || 'otp';
/*
var opts = {
async: true,
username: 'johndoe',
factor: 'push',
//factor: 'passcode',
//factor: 'sms',
//factor: 'phone', // causes call with "press any key to authenticate" message, needs async txnid for status
device: 'XXXXXX'
}
*/
// TO CHECK A OTP CODE
/*
var opts = {
username: 'johndoe',
factor: 'passcode',
passcode: '1955600'
}
*/
var params = {};
merge(params, authenticator._user);
params.device = authenticator._id;
switch (type) {
case 'oob': {
params.async = '1';
switch (options.transport) {
case undefined:
params.factor = 'auto';
}
}
break;
case 'otp': {
// TODO:
return cb();
}
break;
}
client.jsonApiCall('POST', '/auth/v2/auth', params, function(data) {
if (data.stat !== 'OK') {
return cb(new DuoAuthAPIError(data.message, data.code, data.message_detail));
}
return cb(null, { type: 'oob' }, { transactionID: data.response.txid });
});
};
};
exports['@implements'] = [
'http://schemas.authnomicon.org/js/login/mfa/challenge',
'http://schemas.authnomicon.org/js/login/mfa/opt/duo/challenge'
];
exports['@singleton'] = true;
exports['@require'] = [
'http://schemas.authnomicon.org/js/login/mfa/opt/duo/Client'
];
|
JavaScript
| 0 |
@@ -1303,24 +1303,60 @@
break;%0A
+ %0A // TODO: default error%0A
%7D%0A %0A
|
d1684120d2cd69cf685539ee6ec5e9a370e2fe46
|
bump to 0.1.1
|
package.js
|
package.js
|
Package.describe({
name: "ground:util",
version: "0.1.0",
summary: "Adds utillity functions for ground db to use",
git: "https://github.com/GroundMeteor/util.git"
});
Package.on_use(function (api) {
api.export('_groundUtil');
api.export('Ground');
api.versionsFrom('1.0');
api.use('meteor-platform', ['client', 'server']);
api.use([
'meteor',
'underscore',
'random',
'minimongo',
'ejson',
'ground:[email protected]'
], ['client', 'server']);
api.use(['tracker'], 'client');
api.add_files('util.client.js', 'client');
api.add_files('util.server.js', 'server');
});
Package.on_test(function (api) {
api.use('ground:util', ['client', 'server']);
api.use('test-helpers', 'client');
api.use(['tinytest', 'underscore', 'ejson']);
api.add_files('util.tests.js', 'client');
});
|
JavaScript
| 0.000075 |
@@ -51,17 +51,17 @@
n: %220.1.
-0
+1
%22,%0A sum
@@ -428,16 +428,36 @@
ejson',%0A
+ 'reactive-var',%0A
'gro
|
6faeb37c28730293d10c4e6ca6622a7d085d52f1
|
fix bug in router. In page hash links were incorrectly routed.
|
router/router.js
|
router/router.js
|
define([
'dojo/_base/lang',
'dojo/on',
'dojo/when',
'dojo/string',
'dojo/i18n!../nls/router',
'./exception/RouteNotFound',
'dojo/domReady!'
],
function (
lang,
on,
when,
string,
messages,
RouteNotFound
){
return {
// if the base url is undefined, it will be set to the
// url when the router is started
//baseUrl: undefined,
// routes: array
//
routes: [],
// di: havok/di/Di
// This must be an instance of the Di. This is where
// the configured controller instances will be pulled from.
//di: undefined,
//the currently active route
//active: undefined,
startup: function(){
if ( ! this.baseUrl){
var base = window.location.href.split('/');
base.pop();
this.baseUrl = base.join('/');
}
on(window, 'popstate', lang.hitch(this, function(e){
if (e.state){
this.go(e.state.route, true);
}
}));
// Catch click events on anchor tags
on(document.body, 'click', lang.hitch(this, function(e){
if (e.target.nodeType == 1 && e.target.nodeName == 'A'){
if (!e.target.attributes['href']){
return;
}
var route = e.target.attributes['href'].nodeValue;
if (route && this.go(route)){
e.preventDefault();
}
}
}));
// Go to inital route
this.go(window.location.href);
},
resolve: function(route){
// strip off the base url first
if (route.indexOf(this.baseUrl) == 0){
route = route.substring(this.baseUrl.length + 1);
}
// check for absolute url - these are not routed
if (route.indexOf('http://') == 0){
return ({ignore: true});
}
//strip off any hash, in page navigation is not the business of the router
route = route.split('#')[0];
var pieces = route.split('/'),
config,
method,
args = [],
i;
//Check routes in reverse order - first registerd means last checked
for (i = this.routes.length - 1; i >= 0; i--){
if (!this.routes[i].regex.test){
this.routes[i].regex = new RegExp(this.routes[i].regex);
}
if (this.routes[i].regex.test(pieces[0])){
config = this.routes[i];
break;
}
}
if (!config){
throw new RouteNotFound(string.substitute(
messages.noConfig,
{controller: pieces[0]}
));
}
if (config.ignore){
return ({ignore: true});
}
//identify the correct method
if (pieces[1]){
if (config.methods[pieces[1]]){
method = config.methods[pieces[1]];
} else {
throw new RouteNotFound(string.substitute(
messages.methodNotConfigured,
{method: pieces[1], controller: config.controller}
));
}
} else if (config.defaultMethod) {
method = config.defaultMethod;
} else {
throw new RouteNotFound(string.substitute(
messages.noDefaultMethod,
{controller: config.controller}
));
}
if (typeof(method) == 'string'){
method = {enter: method};
if (config.defaultMethod.hasOwnProperty('exit')){
method.exit = config.defaultMethod.exit;
}
} else if (typeof(method) != 'object') {
// method is an integer. history.go should be used, rather than calling a controller.
return {route: method};
}
for (i = 2; i < pieces.length; i++){
args.push(pieces[i]);
}
return lang.mixin({route: route, controller: config.controller, args: args}, method);
},
go: function(route, surpressPushState){
// route may be a string, which will be routed, or a number which move to a relative point in history
if (typeof(route) != 'string'){
history.go(route);
return true;
}
if (this.active && route == this.active.route){
//Don't do anything if the route hasn't changed
return true;
}
var routeMatch = this.resolve(route);
if (routeMatch.ignore){
return false;
}
if (typeof(routeMatch.route) != 'string'){
history.go(routeMatch.route);
return true;
}
//load the correct controller
when(this.di.get(routeMatch.controller), lang.hitch(this, function(controller){
if (! controller[routeMatch.enter]){
throw new RouteNotFound(string.substitute(
messages.noMethod,
{method: routeMatch.enter, controller: routeMatch.controller}
));
}
if (routeMatch.exit && ! controller[routeMatch.exit]){
throw new RouteNotFound(string.substitute(
messages.noMethod,
{method: routeMatch.exit, controller: routeMatch.controller}
));
}
//Route resolved correctly - pushState and call the controller
if ( ! surpressPushState){
history.pushState({route: routeMatch.route}, '', this.baseUrl + '/' + routeMatch.route);
}
if (this.active && this.active.exit){
this.active.controller[this.active.exit]();
}
routeMatch.controller = controller;
this.active = routeMatch;
controller[routeMatch.enter].apply(routeMatch.controller, routeMatch.args);
}));
return true;
}
}
});
|
JavaScript
| 0 |
@@ -2087,32 +2087,203 @@
%0A %7D%0A%0A
+ // check for in page hash navigation - these are not routed%0A if (route.indexOf('#') == 0) %7B%0A return (%7Bignore: true%7D);%0A %7D%0A%0A
//st
|
7c78492b4b10848e95cbd1d97007f19af352e6b9
|
upgrade to latest space:messaging release
|
package.js
|
package.js
|
Package.describe({
summary: 'CQRS and Event Sourcing Infrastructure for Meteor.',
name: 'space:cqrs',
version: '3.0.0',
git: 'https://github.com/CodeAdventure/space-cqrs.git',
});
Package.onUse(function(api) {
api.versionsFrom("[email protected]");
api.use([
'coffeescript',
'ejson',
'space:[email protected]',
'space:[email protected]'
]);
api.addFiles(['source/server.coffee'], 'server');
// ========= SHARED =========
api.addFiles(['source/client.coffee']);
api.addFiles(['source/domain/value_object.coffee']);
// ========= server =========
api.addFiles([
'source/configuration.coffee',
// INFRASTRUCTURE
'source/infrastructure/aggregate_repository.coffee',
'source/infrastructure/process_manager_repository.coffee',
'source/infrastructure/commit_collection.coffee',
'source/infrastructure/commit_store.coffee',
'source/infrastructure/commit_publisher.coffee',
// DOMAIN
'source/domain/aggregate.coffee',
'source/domain/process_manager.coffee',
], 'server');
});
Package.onTest(function(api) {
api.use([
'coffeescript',
'check',
'ejson',
'space:cqrs',
'practicalmeteor:[email protected]',
'space:[email protected]'
]);
api.addFiles([
// DOMAIN
'tests/domain/aggregate.unit.coffee',
'tests/domain/process_manager.unit.coffee',
// INFRASTRUCTURE
'tests/infrastructure/commit_collection.unit.coffee',
'tests/infrastructure/commit_store.unit.coffee',
'tests/infrastructure/commit_publisher.unit.coffee',
// MODULE
'tests/server_module.integration.coffee',
], 'server');
});
|
JavaScript
| 0 |
@@ -340,17 +340,17 @@
aging@0.
-2
+3
.0'%0A %5D)
|
ebb61ecf26bab91f5d75a9a941235ca162035b5e
|
Consolidate dependencies.
|
server/app.js
|
server/app.js
|
// mochad client
var net = require('net');
var client;
function setupConnection() {
client = net.connect({port: 1099}, function() {
console.log('Connection successful');
});
client.on('error', function(e) {
console.log('Connection error: ' + e.code);
console.log('Retrying in 1 second...');
setTimeout(setupConnection, 1000);
});
}
setupConnection();
// Web server
var express = require('express');
var app = express();
app.get('/', function(req, res) {
res.send({hello: 'world'});
});
app.listen(3000);
|
JavaScript
| 0 |
@@ -1,20 +1,19 @@
//
-mochad client
+Dependencies
%0Avar
@@ -33,17 +33,69 @@
e('net')
-;
+,%0A express = require('express');%0A%0A// mochad client
%0Avar cli
@@ -465,42 +465,8 @@
ver%0A
-var express = require('express');%0A
var
|
4b77fc1a0320029df0f884893bd86181e41f1cfb
|
Add shortcut functions to common template functionality
|
server/app.js
|
server/app.js
|
var _ = require('underscore'),
express = require('express'),
path = require('path'),
multer = require('multer'),
settings = require('./settings'),
app = require('libby')(express, settings);
var User = require('./models/index').User;
app.passport = require('./lib/passport')(app);
app.ensureAuthenticated = require('./lib/middleware').ensureAuthenticated;
app.configure(function(){
// set jade as template engine
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'jade');
// initialize passport
app.use(app.passport.initialize());
app.use(app.passport.session());
// has to go after passport.session()
app.use(function (req, res, next) {
if (req.user) {
res.locals.user = req.user;
// TODO: User redis for caching
User.find().select('username name').exec(function (err, all_users) {
if (err) { next(err); }
var indexed_users = _.indexBy(all_users, '_id');
var groups_of_users = _.reduce(req.user.groups, function (memo, group) {
if (group) {
return _.union(memo, _.map(group.members, function (member) {
return member._id;
}));
} else {
return memo;
}
}, []);
// now an array of arrays: use union for now
req.user.friends = _.map(_.compact(groups_of_users), function (user_id) {
return indexed_users[user_id];
});
next();
});
} else {
next();
}
});
app.use(multer());
// middleware changing req or res should come before this
app.use(app.router);
app.use(express.static(path.join(__dirname, '..' ,'public')));
// 500 status
app.use(function(err, req, res, next){
console.error(err.message, err.stack);
res.status(500);
res.format({
html: function(){
res.render('500', {
error: err.message,
status: err.status || 500
});
},
json: function(){
res.json(500, {
error: err.message,
status: err.status || 500
});
}
});
});
// 404 status
app.use(function(req, res, next){
res.status(404);
res.format({
html: function(){
res.render('404', {
status: 404,
error: 'file not found',
url: req.url
});
},
json: function(){
res.json(404, {
status: '404',
error: 'file not found',
url: req.url
});
}
});
});
});
// routes
var core_routes = require('./routes/index');
app.get('/', core_routes.index);
app.get('/login', core_routes.login);
app.post('/login',
app.passport.authenticate('local', {
successRedirect: '/',
failureRedirect: '/login',
failureFlash: true
}));
app.get('/auth/google', app.passport.authenticate('google', { scope: [
'https://www.googleapis.com/auth/userinfo.profile',
'https://www.googleapis.com/auth/userinfo.email'
]}), function(req, res){});
app.get('/auth/google/callback', app.passport.authenticate('google', { failureRedirect: '/login' }), core_routes.google_callback);
app.get('/logout', core_routes.logout);
app.post('/register', core_routes.register);
var forum_routes = require('./routes/forum');
app.get('/forum', forum_routes.all);
app.get('/forum/:id', forum_routes.get_post);
app.get('/forum/:id/replies', forum_routes.get_replies);
app.post('/forum', forum_routes.create_post);
app.post('/forum/:postid/replies', forum_routes.create_reply);
app.delete('/forum/:postid/replies/:replyid', forum_routes.delete_reply);
app.post('/forum/:postid/replies/:replyid/comments', forum_routes.create_comment);
app.delete('/forum/:postid/replies/:replyid/comments/:commentid', forum_routes.delete_comment);
var organization_routes = require('./routes/organization');
app.get('/members', organization_routes.memberlist);
app.get('/organization/fill_dummy', organization_routes.fill_dummy);
app.get('/members/new', organization_routes.add_user);
app.post('/members/new', organization_routes.create_user);
app.post('/members', organization_routes.add_group);
app.delete('/members/:groupid', organization_routes.remove_group);
app.get('/users', organization_routes.users);
app.get('/users/:username', organization_routes.user);
app.post('/users/:username/groups', organization_routes.user_add_group);
app.delete('/users/:username/groups/:groupid', organization_routes.user_remove_group);
app.get('/groups', organization_routes.groups);
app.get('/groups/:id', organization_routes.group);
var file_routes = require('./routes/files');
app.get('/files', file_routes.all);
app.get('/files/new', file_routes.index);
app.post('/files/upload', file_routes.upload);
app.put('/files/:id', file_routes.update);
app.get('/foundation', function(req, res){
res.render('foundation');
});
module.exports = app;
|
JavaScript
| 0 |
@@ -152,41 +152,119 @@
-settings = require('./settings
+moment = require('moment'),%0A settings = require('./settings'),%0A util = require('./lib/util
'),%0A
@@ -701,24 +701,24 @@
tialize());%0A
-
app.use(
@@ -739,24 +739,576 @@
ession());%0A%0A
+ // utils%0A app.use(function (req, res, next) %7B%0A res.locals.hoid = util.h2b64;%0A res.locals.moment = moment;%0A res.locals.isodate = function (str) %7B%0A return moment(str).format();%0A %7D;%0A res.locals.shortdate = function (str) %7B%0A return moment(str).format('l');%0A %7D;%0A res.locals.longdate = function (str) %7B%0A return moment(str).format('LLL');%0A %7D;%0A res.locals.ago = function (str) %7B%0A return moment(str).fromNow();%0A %7D;%0A next();%0A %7D);%0A%0A
// has t
|
e74c96968f54ef9e85c3e2e2673cd32934564a92
|
Upgrade collection-extensions version dependency
|
package.js
|
package.js
|
Package.describe({
name: 'dburles:mongo-collection-instances',
summary: "Access your Mongo instances",
version: "0.3.3",
git: "https://github.com/dburles/mongo-collection-instances.git"
});
Package.onUse(function(api) {
api.versionsFrom('1.0');
api.use([
'mongo',
'underscore',
'lai:[email protected]']);
api.addFiles('mongo-instances.js');
});
Package.onTest(function(api) {
api.use([
'tinytest',
'accounts-base',
'dburles:mongo-collection-instances']);
api.addFiles('mongo-instances-tests.js');
});
|
JavaScript
| 0 |
@@ -327,17 +327,17 @@
[email protected].
-3
+4
'%5D);%0A a
|
420e138d452ec78f6eaada9a6eb72a56282a5179
|
Update posts.js
|
scripts/posts.js
|
scripts/posts.js
|
// posts
module.posts = {
post1 : {
user_id : 'user1',
prompt_id : 'prompt1',
private : false,
type : 'response',
value : 'Prayer Goals: 1.) I would like God to transform my relationship with my parents. 2.) I would like God to enter in to some of my friendships and help me know how to better love my friends and share my faith with them.'
},
post2 : {
user_id : 'user2',
prompt_id : 'prompt1',
private : false,
type : 'response',
value : 'Dear God I pray that you will help transform my attitude. I need help forgiving people who have wronged me and not holding onto grudges. Amen.'
},
post3 : {
user_id : 'user3',
prompt_id : 'prompt1',
private : true,
type : 'response',
value : 'My prayer goals for the next few weeks are: 1. That God would help me to create new habits for prayer and Bible reading. I would like to transform into being more committed and consistent but have always been unsuccessful setting this goal in the past. I need God to help me transform my habits in this way. 2. That God would help me be more diligent in my schoolwork. I know that he wants me to do my best in the things he has given me to do, and I am not giving my best efforts in some areas. I feel convicted about this. 3. That God would help me to remember him as I am living my life throughout the week. It is really easy for me to just forget about him, but I want to be able to see how he is always with me and guiding me in small and large things.'
},
post4 : {
user_id : 'user1',
prompt_id : 'prompt1',
private : false,
type : 'reflection',
value : 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ipsa dolore explicabo quis, maxime vitae. Obcaecati, assumenda nam fugiat, adipisci quo odio, animi nisi aspernatur nulla excepturi vero at cumque voluptates?'
},
post5 : {
user_id : 'user2',
prompt_id : 'prompt1',
private : false,
type : 'reflection',
value : 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ipsa dolore explicabo quis, maxime vitae. Obcaecati, assumenda nam fugiat, adipisci quo odio, animi nisi aspernatur nulla excepturi vero at cumque voluptates?'
},
post6 : {
user_id : 'user3',
prompt_id : 'prompt1',
private : false,
type : 'reflection',
value : 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ipsa dolore explicabo quis, maxime vitae. Obcaecati, assumenda nam fugiat, adipisci quo odio, animi nisi aspernatur nulla excepturi vero at cumque voluptates?'
}
};
|
JavaScript
| 0.000001 |
@@ -1642,914 +1642,1056 @@
: '
-Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ipsa dolore explicabo quis, maxime vitae. Obcaecati, assumenda nam fugiat, adipisci quo odio, animi nisi aspernatur nulla excepturi vero at cumque voluptates?'%0A %7D,%0A%0A post5 : %7B%0A user_id : 'user2',%0A prompt_id : 'prompt1',%0A private : false,%0A type : 'reflection',%0A value : 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ipsa dolore explicabo quis, maxime vitae. Obcaecati, assumenda nam fugiat, adipisci quo odio, animi nisi aspernatur nulla excepturi vero at cumque voluptates?'%0A %7D,%0A%0A post6 : %7B%0A user_id : 'user3',%0A prompt_id : 'prompt1',%0A private : false,%0A type : 'reflection',%0A value : 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ipsa dolore explicabo quis, maxime vitae. Obcaecati, assumenda nam fugiat, adipisci quo odio, animi nisi aspernatur nulla excepturi vero at cumque voluptates?
+1. Trees in wintertime die and then come back to life each spring. 2. Friendships that are broken can be mended. 3. People who are at war with one another can come to understanding and find peace.'%0A %7D,%0A%0A post5 : %7B%0A user_id : 'user2',%0A prompt_id : 'prompt1',%0A private : false,%0A type : 'reflection',%0A value : '1. God transforms hearts to love him 2. God transforms situations that seem hopeless into situations where good comes out of them. 3. Sick people can be healed. '%0A %7D,%0A%0A post6 : %7B%0A user_id : 'user3',%0A prompt_id : 'prompt1',%0A private : false,%0A type : 'reflection',%0A value : '1. I have seen God transform people who have no desire to know him become people whose lives are wholly surrendered to him. 2. I have seen examples of people born into poverty and difficulty become people who overcome the odds and make a real difference in the world. 3. I have seen God make angry people into gentle people. 4. I have seen God transform me from spiritually dry and unbelieving into spiritually thirsty and seeking.
'%0A
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.