code stringlengths 2 1.05M |
|---|
export const ic_videogame_asset = {"viewBox":"0 0 24 24","children":[{"name":"path","attribs":{"d":"M0 0v24h24V0H0zm23 16c0 1.1-.9 2-2 2H3c-1.1 0-2-.9-2-2V8c0-1.1.9-2 2-2h18c1.1 0 2 .9 2 2v8z","fill":"none"},"children":[]},{"name":"path","attribs":{"d":"M21 6H3c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm-10 7H8v3H6v-3H3v-2h3V8h2v3h3v2zm4.5 2c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm4-3c-.83 0-1.5-.67-1.5-1.5S18.67 9 19.5 9s1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"},"children":[]}]}; |
import React, { Component } from "react"
import PropTypes from "prop-types"
import { connect } from "react-redux"
import { List, ListItem } from "material-ui/List"
import { Card, CardHeader, CardText } from "material-ui/Card"
import FontIcon from "material-ui/FontIcon"
import { CONSUL_FETCH_REGIONS, CONSUL_SET_REGION } from "../sagas/event"
class SelectConsulRegion extends Component {
constructor(props) {
super(props)
this._onClick = this.handleChangeRegion.bind(this)
}
componentDidMount() {
this.props.dispatch({ type: CONSUL_FETCH_REGIONS })
}
handleChangeRegion(region) {
this.props.dispatch({
type: CONSUL_SET_REGION,
payload: region
})
}
render() {
return (
<Card>
<CardHeader title="Please select a consul datacenter" />
<CardText>
<List>
{Object.keys(this.props.consulRegions).map(region => {
const regionName = this.props.consulRegions[region]
return (
<ListItem
leftIcon={<FontIcon className="material-icons">public</FontIcon>}
primaryText={regionName}
onTouchTap={() => this._onClick(regionName)}
/>
)
})}
</List>
</CardText>
</Card>
)
}
}
function mapStateToProps({ consulRegions }) {
return { consulRegions }
}
SelectConsulRegion.defaultProps = {
consulRegions: []
}
SelectConsulRegion.propTypes = {
consulRegions: PropTypes.array.isRequired,
dispatch: PropTypes.func.isRequired
}
export default connect(mapStateToProps)(SelectConsulRegion)
|
String.isStopWord = function(word)
{
var regex = new RegExp("\\b"+word+"\\b","i");
if(stopWords.search(regex) < 0)
{
return false;
}else
{
return true;
}
}
String.prototype.removeStopWords = function()
{
words = new Array();
this.replace(/\b[\w]+\b/g,
function($0)
{
if(!String.isStopWord($0))
{
words[words.length] = $0.trim();
}
}
);
return words.join(" ");
}
var stopWords = "a,able,about,above,abst,accordance,according,accordingly,across,act,actually,added,adj,\
affected,affecting,affects,after,afterwards,again,against,ah,all,almost,alone,along,already,also,although,\
always,am,among,amongst,an,and,announce,another,any,anybody,anyhow,anymore,anyone,anything,anyway,anyways,\
anywhere,apparently,approximately,are,aren,arent,arise,around,as,aside,ask,asking,at,auth,available,away,awfully,\
b,back,be,became,because,become,becomes,becoming,been,before,beforehand,begin,beginning,beginnings,begins,behind,\
being,believe,below,beside,besides,between,beyond,biol,both,brief,briefly,but,by,c,ca,came,can,cannot,can't,cause,causes,\
certain,certainly,co,com,come,comes,contain,containing,contains,could,couldnt,d,date,did,didn't,different,do,does,doesn't,\
doing,done,don't,down,downwards,due,during,e,each,ed,edu,effect,eg,eight,eighty,either,else,elsewhere,end,ending,enough,\
especially,et,et-al,etc,even,ever,every,everybody,everyone,everything,everywhere,ex,except,f,far,few,ff,fifth,first,five,fix,\
followed,following,follows,for,former,formerly,forth,found,four,from,further,furthermore,g,gave,get,gets,getting,give,given,gives,\
giving,go,goes,gone,got,gotten,h,had,happens,hardly,has,hasn't,have,haven't,having,he,hed,hence,her,here,hereafter,hereby,herein,\
heres,hereupon,hers,herself,hes,hi,hid,him,himself,his,hither,home,how,howbeit,however,hundred,i,id,ie,if,i'll,im,immediate,\
immediately,importance,important,in,inc,indeed,index,information,instead,into,invention,inward,is,isn't,it,itd,it'll,its,itself,\
i've,j,just,k,keep,keeps,kept,kg,km,know,known,knows,l,largely,last,lately,later,latter,latterly,least,less,lest,let,lets,like,\
liked,likely,line,little,'ll,look,looking,looks,ltd,m,made,mainly,make,makes,many,may,maybe,me,mean,means,meantime,meanwhile,\
merely,mg,might,million,miss,ml,more,moreover,most,mostly,mr,mrs,much,mug,must,my,myself,n,na,name,namely,nay,nd,near,nearly,\
necessarily,necessary,need,needs,neither,never,nevertheless,new,next,nine,ninety,no,nobody,non,none,nonetheless,noone,nor,\
normally,nos,not,noted,nothing,now,nowhere,o,obtain,obtained,obviously,of,off,often,oh,ok,okay,old,omitted,on,once,one,ones,\
only,onto,or,ord,other,others,otherwise,ought,our,ours,ourselves,out,outside,over,overall,owing,own,p,page,pages,part,\
particular,particularly,past,per,perhaps,placed,please,plus,poorly,possible,possibly,potentially,pp,predominantly,present,\
previously,primarily,probably,promptly,proud,provides,put,q,que,quickly,quite,qv,r,ran,rather,rd,re,readily,really,recent,\
recently,ref,refs,regarding,regardless,regards,related,relatively,research,respectively,resulted,resulting,results,right,run,s,\
said,same,saw,say,saying,says,sec,section,see,seeing,seem,seemed,seeming,seems,seen,self,selves,sent,seven,several,shall,she,shed,\
she'll,shes,should,shouldn't,show,showed,shown,showns,shows,significant,significantly,similar,similarly,since,six,slightly,so,\
some,somebody,somehow,someone,somethan,something,sometime,sometimes,somewhat,somewhere,soon,sorry,specifically,specified,specify,\
specifying,still,stop,strongly,sub,substantially,successfully,such,sufficiently,suggest,sup,sure,t,take,taken,taking,tell,tends,\
th,than,thank,thanks,thanx,that,that'll,thats,that've,the,their,theirs,them,themselves,then,thence,there,thereafter,thereby,\
thered,therefore,therein,there'll,thereof,therere,theres,thereto,thereupon,there've,these,they,theyd,they'll,theyre,they've,\
think,this,those,thou,though,thoughh,thousand,throug,through,throughout,thru,thus,til,tip,to,together,too,took,toward,towards,\
tried,tries,truly,try,trying,ts,twice,two,u,un,under,unfortunately,unless,unlike,unlikely,until,unto,up,upon,ups,us,use,used,\
useful,usefully,usefulness,uses,using,usually,v,value,various,'ve,very,via,viz,vol,vols,vs,w,want,wants,was,wasn't,way,we,wed,\
welcome,we'll,went,were,weren't,we've,what,whatever,what'll,whats,when,whence,whenever,where,whereafter,whereas,whereby,wherein,\
wheres,whereupon,wherever,whether,which,while,whim,whither,who,whod,whoever,whole,who'll,whom,whomever,whos,whose,why,widely,\
willing,wish,with,within,without,won't,words,world,would,wouldn't,www,x,y,yes,yet,you,youd,you'll,your,youre,yours,yourself,\
yourselves,you've,z,zero"; |
var express = require('express');
var router = express.Router();
var cloudman = require('cloudman-api');
var cred = require('../cred.js');
cloudman.init(cred);
router.get('/instances', function(req, res, next) {
var providers = cred.map(c => c.keyName);
cloudman.status(providers).then(function(data){
res.json(data);
});
});
router.get('/instances/dispositions', function(req, res, next) {
cloudman.validDispositions().then(function(data){
res.json(data);
});
});
router.get('/providers', function(req, res, next) {
res.json(cloudman.validAccounts());
});
//todo: refactor onError
router.post('/instances', function(req, res, next) {
var params = req.body;
if (params.method === 'start') {
cloudman.start(params.data).then(function(r){
res.json(r);
}).catch(function (err) {
next(err);
});
}
else if (params.method === 'stop') {
cloudman.stop(params.data).then(function(r){
res.json(r);
}).catch(function (err) {
next(err);
});
}
else if (params.method === 'terminate') {
cloudman.terminate(params.data).then(function(r){
res.json(r);
}).catch(function (err) {
next(err);
});
}
else if (params.method === 'create') {
if(!params.newInstance) {
next(new Error({message: 'No properties passed'}));
return;
}
cloudman.create(params.newInstance).then(function(r){
res.json(r);
}).catch(function (err) {
next(err);
});
}
else {
next(new Error({message: 'method __ not implemented'.replace('__', data.method)}));
}
});
module.exports = router;
|
// __namespace( "Libraries.SyntaxHighlighter.Core.Midnight" );
|
export default (str) => {
return str.replace(/(?:^\w|[A-Z]|\b\w)/g, function(letter, index) {
return index == 0 ? letter.toLowerCase() : letter.toUpperCase();
}).replace(/\s+/g, '');
}
|
import {catchError} from 'jasmine-es6';
import {parallel} from 'esnext-async';
import PromiseQueue from 'esnext-async/lib/promise_queue';
describe('PromiseQueue', () => {
it('can publish and consume a single value', async () => {
const queue = new PromiseQueue();
queue.publish(1);
expect(await queue.consume()).toBe(1);
});
it('can publish and consume multiple values', async () => {
const queue = new PromiseQueue();
queue.publish(1);
queue.publish(2);
expect(await queue.consume()).toBe(1);
expect(await queue.consume()).toBe(2);
});
it('can block when the queue is empty', async () => {
const queue = new PromiseQueue();
await parallel(
async () => expect(await queue.consume()).toBe(1),
async () => expect(await queue.consume()).toBe(2),
() => {
queue.publish(1);
queue.publish(2);
}
);
});
it('can propagate errors', async () => {
const queue = new PromiseQueue();
queue.throw(new Error('This is an error'));
expect(await catchError(queue.consume())).toBe('This is an error');
});
});
|
angular.module('MainCtrl', [])
.controller('MainController', ['$scope', '$cookieStore', '$window', '$state', '$location', '$http', '$rootScope', '$modal', '$modalStack', 'appAlert', 'flash', 'AuthenticationService', 'socket',
function($scope, $cookieStore, $window, $state, $location, $http, $rootScope, $modal, $modalStack, appAlert, flash, AuthenticationService, socket) {
$scope.$on('$viewContentLoaded', function () {
/*Dùng cho nút ghi nhớ mật khẩu*/
$('a.your-remember').click(function(event) {
event.preventDefault();
if (!$(this).hasClass('clicked')) {
$(this).addClass('clicked');
$('input#remember').val(1);
}
else {
$(this).removeClass('clicked');
$('input#remember').val(0);
}
});
/*Thiết lập thời gian tương đối*/
moment.locale('vi', {});
$('.show-form').resizable({
handles: 'n',
animateDuration: 'fast',
minHeight: 350,
maxHeight: 555
});
});
$scope.fbLike = 'https://www.facebook.com/toiyeulaptrinhfanpage';
/*Lấy đường dẫn hiện tại để tiến hành hightlight menu.*/
$scope.getClass = function (path) {
if ($location.path().substr(0, $location.path().length) == path) {
if (path == '/' && $location.path() == '/') {
return 'current-menu-item';
}
else {
if (path == '/') {
return '';
}
else {
return 'current-menu-item';
}
}
}
else {
return '';
}
};
/*Lấy thông tin đăng nhập nếu đăng nhập bằng mạng xã hội*/
$http.get('/loggedin').success(function(data) {
if (data !== '0' && data.status == 1) {
$cookieStore.put('currentUser', data);
$rootScope.currentUser = $cookieStore.get('currentUser');
AuthenticationService.isLogged = true;
$window.sessionStorage.token = data.token;
}
else {
$rootScope.currentUser = null;
}
});
$scope.showForm = function(type) {
$http.get('/loggedin').success(function(data) {
if (data !== '0') {
$('.show-form.' + type).show();
$('.show-form .createForm').show();
}
else {
flash.error = 'Bạn cần đăng nhập để thực hiện hành động này !';
$state.go('login');
}
});
};
$scope.chat = function (user) {
$http.get('/loggedin').success(function(data) {
if (data === '0') {
flash.error = 'Bạn cần đăng nhập để thực hiện hành động này !';
}
else {
/*begin modal*/
var modalInstance = $modal.open({
templateUrl : '/views/modal/chat.html',
controller : 'modal.chat',
backdrop : 'static',
resolve : {
userData: function () {
return user;
}
}
});
modalInstance.result.then(function (dataFromOkModal) {
console.log(dataFromOkModal);
}, function (dataFromDissmissModal) {
console.log(dataFromDissmissModal);
});
/*end modal*/
}
});
};
socket.on('new message', function(data) {
if (!$modalStack.getTop()) {
$http.get('/loggedin').success(function(user) {
if (user !== '0') {
var modalInstance = $modal.open({
templateUrl : '/views/modal/chat.html',
controller : 'modal.chat',
backdrop : 'static',
resolve : {
userData: function () {
return data;
}
}
});
modalInstance.result.then(function (dataFromOkModal) {
console.log(dataFromOkModal);
}, function (dataFromDissmissModal) {
console.log(dataFromDissmissModal);
});
}
});
}
});
socket.emit('reconnect');
socket.on('new connection', function() {
$http.get('/loggedin').success(function(user) {
if (user !== '0') {
socket.emit('add user',{username: user.displayName, _id: user._id, avatar: user.avatar});
}
});
});
socket.on('logout', function(data) {
$rootScope.listOnline = data;
console.log($rootScope.listOnline);
});
socket.on('usernames', function(data) {
$rootScope.listOnline = data;
console.log($rootScope.listOnline);
});
socket.on('new question', function() {
$http.get('/api/question')
.success(function(data) {
$rootScope.listQuestion = data;
$http.get('api/questiontag/getall').success(function(data) {
$rootScope.listTag = data;
})
.error(function() {
console.log('error');
});
/*Phân trang*/
$http.get('api/question/count').success(function(data) {
$rootScope.totalItems = data;
});
$rootScope.currentPage = 1;
$rootScope.maxSize = 5;
$rootScope.entryLimit = 10;
/*Hết xử lý phân trang*/
})
.error(function() {
console.log('Error');
});
});
}])
.controller('ReportController',['$scope', '$http', function($scope, $http) {
$scope.currentPage = 1;
$scope.maxSize = 5;
$scope.entryLimit = 10;
$http.get('api/report/getAll')
.success(function(list) {
$scope.listReport = list;
console.log(list);
})
.error(function() {
console.log('error');
});
}]);
|
import React, { Component } from 'react'
import { withApollo } from '@apollo/client/react/hoc'
import isLoggedInQuery from 'v2/hocs/WithLoginStatus/queries/isLoggedIn'
const withLoginStatus = WrappedComponent => {
class WithLoginStatus extends Component {
render() {
const { client, ...rest } = this.props
let cache
try {
cache = client.readQuery({
query: isLoggedInQuery,
})
} catch {
return false
}
if (!cache) {
return false
}
const { loginStatus } = cache
const isLoggedIn = loginStatus && loginStatus.isLoggedIn
return <WrappedComponent isLoggedIn={isLoggedIn} {...rest} />
}
}
return withApollo(WithLoginStatus)
}
export default withLoginStatus
|
import * as React from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import { makeStyles } from '@material-ui/core/styles';
const styles = (theme) => ({
root: {
...theme.typography.body1,
color: theme.palette.text.primary,
wordBreak: 'break-word',
'& .anchor-link': {
marginTop: -96, // Offset for the anchor.
position: 'absolute',
},
'& pre': {
margin: theme.spacing(3, 'auto'),
padding: theme.spacing(2),
backgroundColor: '#272c34',
direction: 'ltr',
borderRadius: theme.shape.borderRadius,
overflow: 'auto',
WebkitOverflowScrolling: 'touch', // iOS momentum scrolling.
maxWidth: 'calc(100vw - 32px)',
[theme.breakpoints.up('md')]: {
maxWidth: 'calc(100vw - 32px - 16px)',
},
},
// inline code
'& code': {
direction: 'ltr',
lineHeight: 1.4,
display: 'inline-block',
fontFamily: 'Consolas, "Liberation Mono", Menlo, Courier, monospace',
WebkitFontSmoothing: 'subpixel-antialiased',
padding: '0 3px',
color: theme.palette.text.primary,
backgroundColor:
theme.palette.mode === 'light' ? 'rgba(255, 229, 100, 0.2)' : 'rgba(255, 229, 100, 0.2)',
fontSize: '.85em',
borderRadius: 2,
},
'& code[class*="language-"]': {
backgroundColor: '#272c34',
color: '#fff',
// Avoid layout jump after hydration (style injected by prism)
lineHeight: 1.5,
},
// code blocks
'& pre code': {
fontSize: '.9em',
},
'& .token.operator': {
background: 'transparent',
},
'& h1': {
...theme.typography.h3,
fontSize: 40,
margin: '16px 0',
},
'& .description': {
...theme.typography.h5,
margin: '0 0 40px',
},
'& h2': {
...theme.typography.h4,
fontSize: 30,
margin: '40px 0 16px',
},
'& h3': {
...theme.typography.h5,
margin: '40px 0 16px',
},
'& h4': {
...theme.typography.h6,
margin: '32px 0 16px',
},
'& h5': {
...theme.typography.subtitle2,
margin: '32px 0 16px',
},
'& p, & ul, & ol': {
marginTop: 0,
marginBottom: 16,
},
'& ul': {
paddingLeft: 30,
},
'& h1, & h2, & h3, & h4': {
'& code': {
fontSize: 'inherit',
lineHeight: 'inherit',
// Remove scroll on small screens.
wordBreak: 'break-all',
},
'& .anchor-link-style': {
// To prevent the link to get the focus.
display: 'none',
},
'& a:not(.anchor-link-style):hover': {
color: 'currentColor',
borderBottom: '1px solid currentColor',
textDecoration: 'none',
},
'&:hover .anchor-link-style': {
display: 'inline-block',
padding: '0 8px',
color: theme.palette.text.secondary,
'&:hover': {
color: theme.palette.text.primary,
},
'& svg': {
width: '0.7em',
height: '0.7em',
fill: 'currentColor',
},
},
},
'& table': {
// Trade display table for scroll overflow
display: 'block',
wordBreak: 'normal',
width: '100%',
overflowX: 'auto',
WebkitOverflowScrolling: 'touch', // iOS momentum scrolling.
borderCollapse: 'collapse',
marginBottom: '16px',
borderSpacing: 0,
overflow: 'hidden',
'& .prop-name': {
fontFamily: 'Consolas, "Liberation Mono", Menlo, monospace',
},
'& .required': {
color: theme.palette.mode === 'light' ? '#006500' : '#a5ffa5',
},
'& .prop-type': {
fontFamily: 'Consolas, "Liberation Mono", Menlo, monospace',
color: theme.palette.mode === 'light' ? '#932981' : '#ffb6ec',
},
'& .prop-default': {
fontFamily: 'Consolas, "Liberation Mono", Menlo, monospace',
borderBottom: `1px dotted ${theme.palette.divider}`,
},
},
'& td': {
...theme.typography.body2,
borderBottom: `1px solid ${theme.palette.divider}`,
padding: 16,
color: theme.palette.text.primary,
},
'& td code': {
lineHeight: 1.6,
},
'& th': {
lineHeight: theme.typography.pxToRem(24),
fontWeight: theme.typography.fontWeightMedium,
color: theme.palette.text.primary,
whiteSpace: 'pre',
borderBottom: `1px solid ${theme.palette.divider}`,
padding: 16,
},
'& blockquote': {
borderLeft: '5px solid #ffe564',
backgroundColor: 'rgba(255,229,100,0.2)',
padding: '4px 24px',
margin: '24px 0',
'& p': {
marginTop: '16px',
},
},
'& a, & a code': {
// Style taken from the Link component
color: theme.palette.primary.main,
textDecoration: 'none',
'&:hover': {
textDecoration: 'underline',
},
},
'& img, video': {
maxWidth: '100%',
},
'& img': {
// Avoid layout jump
display: 'inline-block',
},
'& hr': {
height: 1,
margin: theme.spacing(6, 0),
border: 0,
flexShrink: 0,
backgroundColor: theme.palette.divider,
},
'& kbd.key': {
// Style taken from GitHub
padding: '4px 5px',
display: 'inline-block',
whiteSpace: 'nowrap',
margin: '0 1px',
font: '11px SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace',
lineHeight: '10px',
color: theme.palette.text.primary,
verticalAlign: 'middle',
backgroundColor: theme.palette.mode === 'dark' ? 'transparent' : '#fafbfc',
border: `1px solid ${theme.palette.mode === 'dark' ? '#6e7681' : '#d1d5da'}`,
borderRadius: 6,
boxShadow: `inset 0 -1px 0 ${theme.palette.mode === 'dark' ? '#6e7681' : '#d1d5da'}`,
},
},
});
const useStyles = makeStyles(styles, { name: 'MarkdownElement', flip: false });
const MarkdownElement = React.forwardRef(function MarkdownElement(props, ref) {
const { className, renderedMarkdown, ...other } = props;
const classes = useStyles();
const more = {};
if (typeof renderedMarkdown === 'string') {
// workaround for https://github.com/facebook/react/issues/17170
// otherwise we could just set `dangerouslySetInnerHTML={undefined}`
more.dangerouslySetInnerHTML = { __html: renderedMarkdown };
}
return (
<div
className={clsx(classes.root, 'markdown-body', className)}
{...more}
{...other}
ref={ref}
/>
);
});
MarkdownElement.propTypes = {
className: PropTypes.string,
renderedMarkdown: PropTypes.string,
};
export default MarkdownElement;
|
import React from "react";
import { mount, shallow } from "enzyme";
import { Accordion } from "../index";
import renderer from "react-test-renderer";
describe("Test Accordion component", () => {
it("Test render correctly", () => {
const comp =
<Accordion>
<div expanded="true" id>
Text for first accordion item
</div>
<div expanded="true">Text for second accordion item</div>
<div expanded="true">Text for third accordion item</div>
</Accordion>
;
const tree = renderer.create(comp).toJSON();
expect(tree).toMatchSnapshot();
});
});
describe("Test Accordion Component: Basic Tests", () => {
const accordionComponent = shallow(
<Accordion>
<div expanded="true">Text for first accordion item</div>
<div expanded="true">Text for second accordion item</div>
<div expanded="true">Text for third accordion item</div>
</Accordion>
);
it("Basic Accordion", () => {
expect(accordionComponent.exists(<Accordion />)).toBe(true);
});
it("Contains No Child", () => {
const acc = mount(<Accordion />);
expect(acc.props().children).toBeUndefined();
});
it("Contains Child", () => {
expect(accordionComponent.props()).toHaveProperty("children");
});
it("Test Title prop", () => {
const accTitle = mount(
<Accordion>
<div title="first">first</div>
</Accordion>
);
expect(accTitle.props().children.props.title).toBe("first");
});
it("Test all expanded", () => {
expect(accordionComponent.state().activeChildArray[0]).toEqual(true);
expect(accordionComponent.state().activeChildArray[1]).toEqual(true);
expect(accordionComponent.state().activeChildArray[2]).toEqual(true);
});
it("Test multiOpen function", () => {
const accMulti = mount(
<Accordion multiOpen>
<div title="first">first</div>
<div title="second">second</div>
</Accordion>
);
expect(accMulti.props().multiOpen).toBe(true);
});
it("Test component is disabled", () => {
const accDisabled = mount(
<Accordion disabled>
<div title="first">first</div>
<div title="second">second</div>
</Accordion>
);
expect(accDisabled.props().disabled).toBe(true);
});
it("Test TitlePosition is centered", () => {
const accWidth2 = mount(
<Accordion titlePosition="center">
<div title="first">first</div>
<div title="second">second</div>
</Accordion>
);
expect(accWidth2.props().titlePosition).toEqual("center");
});
});
describe("Test Accordion Component: Test _setActiveChildArray() method", () => {
const acc = mount(
<Accordion>
<div>Text for first accordion item</div>
<div>Text for second accordion item</div>
<div>Text for third accordion item</div>
<div>Text for fourth accordion item</div>
</Accordion>
);
const instance = acc.instance();
it("Test initial _setActiveChildArray() call", function() {
const expectedObj = [false, false, false, false];
const returnObject = instance._setActiveChildArray(
acc.state().activeChildArray,
false,
false
);
expect(returnObject).toEqual(expectedObj);
});
it("Test _setActiveChildArray expandAll call", function() {
const expectedObj = [true, true, true, true];
const returnObject = instance._setActiveChildArray(
acc.state().activeChildArray,
true
);
expect(returnObject).toEqual(expectedObj);
});
it("Test _setActiveChildArray _click call", function() {
const expectedObj = [false, false, false, true];
const returnObject = instance._setActiveChildArray(
acc.state().activeChildArray,
false,
3
);
expect(returnObject).toEqual(expectedObj);
});
it("Test _setActiveChildArray _click call then recall _click with a different index", function() {
const expectedObj = [false, false, false, true];
const expectedSecondObj = [false, false, true, false];
const returnObject = instance._setActiveChildArray(
acc.state().activeChildArray,
false,
3
);
expect(returnObject).toEqual(expectedObj);
const returnSecondObject = instance._setActiveChildArray(
acc.state().activeChildArray,
false,
2
);
expect(returnSecondObject).toEqual(expectedSecondObj);
});
it("Test _setActiveChildArray _click call with multiOpen", function() {
const accMulti = mount(
<Accordion multiOpen>
<div>Text for first accordion item</div>
<div>Text for second accordion item</div>
<div>Text for third accordion item</div>
<div>Text for fourth accordion item</div>
</Accordion>
);
const instanceMulti = accMulti.instance();
const expectedObj = [false, false, true, true];
let returnObject = instanceMulti._setActiveChildArray(
acc.state().activeChildArray,
false,
3
);
returnObject = instanceMulti._setActiveChildArray(returnObject, false, 2);
expect(returnObject).toEqual(expectedObj);
});
it("Test _setActiveChildArray _click call then _click same index again to collapse", function() {
const expectedObj = [false, false, false, true];
const expectedCollapsedObj = [false, false, false, false];
let returnObject = instance._setActiveChildArray(
acc.state().activeChildArray,
false,
3
);
expect(returnObject).toEqual(expectedObj);
returnObject = instance._setActiveChildArray(returnObject, false, 3);
expect(returnObject).toEqual(expectedCollapsedObj);
});
});
describe("Test Accordion Component: _getExpandedPanels() method", () => {
const acc = mount(
<Accordion>
<div expanded="true">Text for first accordion item</div>
<div>Text for second accordion item</div>
<div>Text for third accordion item</div>
<div>Text for fourth accordion item</div>
</Accordion>
);
const expectedObj = [true, false, false, false];
const instance = acc.instance();
it("Test initial _getExpandedPanels() call", function() {
const returnObject = instance._getExpandedPanels(acc.props().children);
expect(returnObject).toEqual(expectedObj);
});
});
|
/*
* @require fn.js
*/
/*************** do ***************/
'use strict';
$(function () {
document.getElementById('nav-index').className = 'active';
var defaultEle = $('.navbar-default');
defaultEle.addClass('navbar-bg');
$(document).ready(function () {
drawCanvasOne();
setInterval(function () {
drawCanvasOne()
}, 4000);
$('body').click(function () {
drawCanvasOne()
});
initGithubCharts();
performanceAnalysis();
$('#fullpage').fullpage({
navigation: true,
resize: true,
sectionsColor: ['#fff', '#f0f4fa', '#fff', '#fff', '#f0f4fa','#f0f4fa', '#f0f4fa', '#fff', '#fff', '#f0f4fa', '#fff', '#f0f4fa', '#f0f4fa'],
onLeave: function (index, nextIndex, direction) {
if ($('.navbar-toggle').attr('aria-expanded') === 'true') {
$('.navbar-toggle').trigger('click');
}
$('.dropdown-toggle').each(function () {
var $toggleBtn = $(this);
if ($toggleBtn.attr('aria-expanded') === 'true') {
$toggleBtn.parent().removeClass('open');
$toggleBtn.trigger('click');
}
});
if (nextIndex === 4) {
$('.section-four').find('.text-wrap').addClass('text-wrap-animate')
.end().find('.device-wrap').addClass('device-wrap-animate');
}
defaultEle.toggleClass('navbar-bg', nextIndex === 1);
}
});
var container = $('.container-five');
container.on('mouseenter', 'img', function () {
var target = $(this);
if (target.hasClass('cur-item')) {
return;
}
var index = +target.data('index');
container.find('.cur-item').removeClass('cur-item');
target.addClass('cur-item');
});
});
});
|
/*global describe, it, require*/
const assert = require("node-opcua-assert").assert;
const async = require("async");
const should = require("should");
const opcua = require("node-opcua");
const OPCUAClient = opcua.OPCUAClient;
const VariantArrayType = opcua.VariantArrayType;
const DataType = opcua.DataType;
const StatusCodes = opcua.StatusCodes;
const perform_operation_on_client_session = require("../../test_helpers/perform_operation_on_client_session").perform_operation_on_client_session;
module.exports = function (test) {
describe("Testing issue #223 - Demonstrating how to use call service from client", function () {
it("#223 - calling a method with one input argument", function (done) {
const client1 = OPCUAClient.create();
const endpointUrl = test.endpointUrl;
let the_session;
let objectWithMethodsNodeId;
let methodIONodeId;
async.series([
function (callback) {
client1.connect(endpointUrl, callback);
},
// create a session using client1
function (callback) {
client1.createSession(function (err, session) {
if (err) {
return callback(err);
}
the_session = session;
callback();
});
},
// ------------------------- Call method without arguments
function (callback) {
const path = opcua.makeBrowsePath("RootFolder","/Objects/2:Simulation/2:ObjectWithMethods");
the_session.translateBrowsePath(path,function(err,results){
if (!err) {
if (results.targets.length > 0){
objectWithMethodsNodeId = results.targets[0].targetId;
} else {
// cannot find objectWithMethodNodeId
console.log("cannot find objectWithMethods",results.toString());
err = new Error(" cannot find objectWithMethods");
}
}
callback(err);
});
},
function (callback) {
const path = opcua.makeBrowsePath(objectWithMethodsNodeId,".2:MethodIO");
the_session.translateBrowsePath(path,function(err,results) {
if (!err) {
if (results.targets.length > 0){
methodIONodeId = results.targets[0].targetId;
} else {
// cannot find objectWithMethodNodeId
console.log("cannot find MethodIO",results.toString());
err = new Error(" cannot find MethodIO");
}
}
callback(err);
});
},
// ------------------------- Call method
function (callback) {
const methodsToCall = [];
methodsToCall.push({
objectId: objectWithMethodsNodeId,
methodId: methodIONodeId,
inputArguments: [{
dataType: DataType.UInt32,
arrayType: VariantArrayType.Scalar,
value: 32 }
] //OK
});
the_session.call(methodsToCall,function(err,results){
results.length.should.eql(1);
results[0].statusCode.should.eql(StatusCodes.Good);
///xx console.log(results[0].toString());
callback(err);
});
},
function (callback) {
the_session.close(callback);
},
function (callback) {
client1.disconnect(function () {
callback();
});
}
], done);
});
});
};
|
var app = require('express')(),
wizard = require('hmpo-form-wizard'),
steps = require('./steps'),
fields = require('./fields');
app.use(require('hmpo-template-mixins')(fields, { sharedTranslationKey: 'prototype' }));
app.use(wizard(steps, fields, { templatePath: 'change_of_name_171218/takephoto' }));
module.exports = app;
|
import React, { Component } from 'react';
// eslint-disable-next-line import/no-unresolved
// eslint-disable-next-line import/no-duplicates
import simpleExampleCode from '!!raw-loader!../../../components/Examples/resizeable/SimpleResizeableEditor';
// eslint-disable-next-line import/no-unresolved
import simpleExampleEditorStylesCode from '!!raw-loader!../../../components/Examples/resizeable/SimpleResizeableEditor/editorStyles.module.css';
// eslint-disable-next-line import/no-unresolved
import simpleExampleColorBlockCode from '!!raw-loader!../../../components/Examples/resizeable/SimpleResizeableEditor/colorBlockPlugin';
import Container from '../../../components/Container/Container';
import AlternateContainer from '../../../components/AlternateContainer/AlternateContainer';
import Heading from '../../../components/Heading/Heading';
import styles from './styles.module.css';
import Code from '../../../components/Code/Code';
// eslint-disable-next-line import/no-duplicates
import SimpleResizeableEditor from '../../../components/Examples/resizeable/SimpleResizeableEditor';
import PluginPageFrame from '../../../components/PluginPageFrame/PluginPageFrame';
import ExternalLink from '../../../components/Link/Link';
export default class App extends Component {
render() {
return (
<PluginPageFrame>
<Container>
<Heading level={2}>Resizeable</Heading>
<Heading level={3}>Prerequisite</Heading>
<p>
This plugin exposes a decorator for blocks. You can use it in
combination with any kind of plugin that manages a Draft.js block
e.g. image or video. Keep in mind the plugin must accept a decorator
for the block. The `Simple Resizeable Example` further down contains
an example plugin rendering a colored div. In addition this plugin
only works in combination with the @draft-js-plugins/focus.
</p>
<Heading level={3}>Usage</Heading>
<p>
Hover with the mouse on the right side of the block and drag it to
resize. At which edge resize is possible is configurable.
</p>
<Heading level={3}>Supported Environment</Heading>
<ul className={styles.list}>
<li className={styles.listEntry}>Desktop: Yes</li>
<li className={styles.listEntry}>Mobile: No</li>
<li className={styles.listEntry}>Screen-reader: No</li>
</ul>
</Container>
<AlternateContainer>
<Heading level={2}>Getting Started</Heading>
<Code code="npm install @draft-js-plugins/editor" />
<Code code="npm install @draft-js-plugins/focus" />
<Code code="npm install @draft-js-plugins/resizeable" />
<Heading level={3}>Notes</Heading>
<p>
This plugin needs to read and write the size information to the
resized HTML element. Therefore the resized component needs to use{' '}
<ExternalLink href="https://reactjs.org/docs/forwarding-refs.html">
forwarding ref
</ExternalLink>
. As reported in issue{' '}
<ExternalLink href="https://github.com/draft-js-plugins/draft-js-plugins/issues/2272#issuecomment-909642353">
#2272
</ExternalLink>{' '}
in some cases it might be usefult to wrap the ref with{' '}
<ExternalLink href="https://reactjs.org/docs/hooks-reference.html#useimperativehandle">
useImperativeHandle
</ExternalLink>
.
</p>
</AlternateContainer>
<Container>
<Heading level={2}>Configuration Parameters</Heading>
</Container>
<Container>
<Heading level={2}>Simple Resizeable Example</Heading>
<SimpleResizeableEditor />
<Code code={simpleExampleCode} name="SimpleResizeableEditor.js" />
<Code code={simpleExampleColorBlockCode} name="colorBlockPlugin.js" />
<Code code={simpleExampleEditorStylesCode} name="editorStyles.css" />
</Container>
</PluginPageFrame>
);
}
}
|
const chaiHttp = require('chai-http');
const chai = require('chai');
const supertest = require('supertest');
const should = require('chai').should;
expect = require('chai').expect;
chai.use(chaiHttp);
const request = require('supertest');
expect = require('chai').expect;
const assert = chai.assert;
chai.use(chaiHttp);
const User = require('../server/models').User;
const sinon = require('sinon');
require('sinon-as-promised');
const bcrypt = require('bcrypt-nodejs');
const Role = require('../server/models').Role;
api = supertest('http://localhost:8080');
const app = require('../app');
let token = '';
const testRole = {
name: 'Olga'
};
describe('actions', () => {
const endpoint = '/api/roles';
it('should return all roles', done => {
request(app)
.get('/api/roles')
.set('x-access-login', token)
.accept('application/json')
.end(function(err, res) {
expect(res.status).to.equal(401);
done();
});
});
it('should fail when create fails', done => {
let createStub = sinon.stub(Role, 'create').rejects({});
request(app)
.post(endpoint)
.send(testRole)
.expect(400)
.end((err, res) => {
if (err) throw err;
createStub.restore();
done();
});
});
});
describe('Roles', () => {
it('should create user on /roles/POST', done => {
api.post('/api/roles', (error, response, body) => {
expect(response.statusCode).toEqual(201);
expect(response.data).toEqual('Role successful created');
expect(body).to.equal(true);
});
done();
});
it('should Get all roles', done => {
api.get('/api/roles', (error, response, body) => {
expect(response.statusCode).toEqual(200);
expect(response.statusMessage).toEqual('OK');
});
done();
});
it('should list a single role', done => {
api.get('/api/roles/:id', (error, response, body) => {
expect(response.statusCode).toEqual(200);
expect(response.statusMessage).toEqual('OK');
});
done();
});
it('should delete a role', done => {
api.delete('/api/roles/:id', (error, response, body) => {
expect(response.statusCode).toEqual(204);
expect(response.statusMessage).toEqual('OK');
});
done();
});
it('should update a single role', done => {
api.put('/api/roles/:id', (error, response, body) => {
expect(expect(response.statusCode).to.equal(200));
expect(response.body.name).to.not.equal(null);
});
done();
});
});
|
define([
"../core",
"../time"
], function (radic) {
radic.time.ago = function (timestamp) {
if (timestamp instanceof Date) {
return inWords(timestamp);
} else if (typeof timestamp === "string") {
return inWords(radic.time.ago.parse(timestamp));
} else if (typeof timestamp === "number") {
return inWords(new Date(timestamp));
} else {
return inWords(radic.time.ago.datetime(timestamp));
}
};
var $t = radic.time.ago;
$.extend(radic.time.ago, {
settings: {
refreshMillis: 60000,
allowPast: true,
allowFuture: false,
localeTitle: false,
cutoff: 0,
strings: {
prefixAgo: null,
prefixFromNow: null,
suffixAgo: "ago",
suffixFromNow: "from now",
inPast: 'any moment now',
seconds: "%d seconds",
minute: "1 minute",
minutes: "%d minutes",
hour: "1 hour",
hours: "%d hours",
day: "1 day",
days: "%d days",
month: "1 month",
months: "%d months",
year: "1 year",
years: "%d years",
wordSeparator: " ",
numbers: []
}
},
inWords: function (distanceMillis) {
if (!this.settings.allowPast && !this.settings.allowFuture) {
throw 'timeago allowPast and allowFuture settings can not both be set to false.';
}
var $l = this.settings.strings;
var prefix = $l.prefixAgo;
var suffix = $l.suffixAgo;
if (this.settings.allowFuture) {
if (distanceMillis < 0) {
prefix = $l.prefixFromNow;
suffix = $l.suffixFromNow;
}
}
if (!this.settings.allowPast && distanceMillis >= 0) {
return this.settings.strings.inPast;
}
var seconds = Math.abs(distanceMillis) / 1000;
var minutes = seconds / 60;
var hours = minutes / 60;
var days = hours / 24;
var years = days / 365;
function substitute(stringOrFunction, number) {
var string = $.isFunction(stringOrFunction) ? stringOrFunction(number, distanceMillis) : stringOrFunction;
var value = ($l.numbers && $l.numbers[number]) || number;
return string.replace(/%d/i, value);
}
var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) ||
seconds < 90 && substitute($l.minute, 1) ||
minutes < 45 && substitute($l.minutes, Math.round(minutes)) ||
minutes < 90 && substitute($l.hour, 1) ||
hours < 24 && substitute($l.hours, Math.round(hours)) ||
hours < 42 && substitute($l.day, 1) ||
days < 30 && substitute($l.days, Math.round(days)) ||
days < 45 && substitute($l.month, 1) ||
days < 365 && substitute($l.months, Math.round(days / 30)) ||
years < 1.5 && substitute($l.year, 1) ||
substitute($l.years, Math.round(years));
var separator = $l.wordSeparator || "";
if ($l.wordSeparator === undefined) {
separator = " ";
}
return $.trim([prefix, words, suffix].join(separator));
},
parse: function (iso8601) {
var s = $.trim(iso8601);
s = s.replace(/\.\d+/, ""); // remove milliseconds
s = s.replace(/-/, "/").replace(/-/, "/");
s = s.replace(/T/, " ").replace(/Z/, " UTC");
s = s.replace(/([\+\-]\d\d)\:?(\d\d)/, " $1$2"); // -04:00 -> -0400
s = s.replace(/([\+\-]\d\d)$/, " $100"); // +09 -> +0900
return new Date(s);
},
datetime: function (elem) {
var iso8601 = $t.isTime(elem) ? $(elem).attr("datetime") : $(elem).attr("title");
return $t.parse(iso8601);
},
isTime: function (elem) {
// jQuery's `is()` doesn't play well with HTML5 in IE
return $(elem).get(0).tagName.toLowerCase() === "time"; // $(elem).is("time");
}
});
// functions that can be called via $(el).timeago('action')
// init is default when no action is given
// functions are called with context of a single element
var functions = {
init: function () {
var refresh_el = $.proxy(refresh, this);
refresh_el();
var $s = $t.settings;
if ($s.refreshMillis > 0) {
this._timeagoInterval = setInterval(refresh_el, $s.refreshMillis);
}
},
update: function (time) {
var parsedTime = $t.parse(time);
$(this).data('timeago', {datetime: parsedTime});
if ($t.settings.localeTitle) $(this).attr("title", parsedTime.toLocaleString());
refresh.apply(this);
},
updateFromDOM: function () {
$(this).data('timeago', {datetime: $t.parse($t.isTime(this) ? $(this).attr("datetime") : $(this).attr("title"))});
refresh.apply(this);
},
dispose: function () {
if (this._timeagoInterval) {
window.clearInterval(this._timeagoInterval);
this._timeagoInterval = null;
}
}
};
$.fn.timeago = function (action, options) {
var fn = action ? functions[action] : functions.init;
if (!fn) {
throw new Error("Unknown function name '" + action + "' for timeago");
}
// each over objects here and call the requested function
this.each(function () {
fn.call(this, options);
});
return this;
};
function refresh() {
//check if it's still visible
if (!$.contains(document.documentElement, this)) {
//stop if it has been removed
$(this).timeago("dispose");
return this;
}
var data = prepareData(this);
var $s = $t.settings;
if (!isNaN(data.datetime)) {
if ($s.cutoff == 0 || Math.abs(distance(data.datetime)) < $s.cutoff) {
$(this).text(inWords(data.datetime));
}
}
return this;
}
function prepareData(element) {
element = $(element);
if (!element.data("timeago")) {
element.data("timeago", {datetime: $t.datetime(element)});
var text = $.trim(element.text());
if ($t.settings.localeTitle) {
element.attr("title", element.data('timeago').datetime.toLocaleString());
} else if (text.length > 0 && !($t.isTime(element) && element.attr("title"))) {
element.attr("title", text);
}
}
return element.data("timeago");
}
function inWords(date) {
return $t.inWords(distance(date));
}
function distance(date) {
return (new Date().getTime() - date.getTime());
}
});
|
const
Semaphore = require('./semaphore'),
yallist = require('yallist');
/**
* In-memory asynchronous LIFO buffer
* @class
* @description Queue class implements an asynchronous LIFO queue of limited size
* @param {number} maxSize Queue max size
*/
class Queue {
constructor(maxSize, asArray) {
this.data = asArray? [] : yallist.create([]);
this.sem = maxSize? new Semaphore(maxSize) : null;
this.mutex = new Semaphore(1);
this.ready = this.mutex.take();
}
/**
* Return current queue size (number of stored elements)
* @return {number} Queue size
*/
size() {
return this.data.length;
}
/**
* Returns a formatted string of the queue size
* @return {string} Queue size message
*/
stats() {
return `Data: ${this.data.length}`;
}
/**
* Pushes an element to the end of the queue. This method is asynchronous, so
* in case the queue is full, it doen't block the process; it simply awaits
* asynchronously until a slot is available.
* @param {Object} item Item to store
* @param {Function} callback Callback function. Called when push method ends succesfully
* @return {Promise} Same as callback. Promise is resolved when the item has
* been pushed to the queue
*/
async push(item, callback) {
await this.ready;
if(this.sem) {
await this.sem.take();
}
this.data.unshift(item);
if(!this.mutex.available()) {
this.mutex.leave();
}
if(callback) {
callback();
}
}
/**
* Removes and returns the item from the start of the queue
* @param {number} [timeout] Await timeout. If this time expires, callback and
* promise returns an undefined item.
* @param {Function} callback Callback function
* @return {Promise} Same as callback. If tiemout expires, promise is not rejected; insted,
* it's resolved with an undefined value
*/
async pop(timeout,callback) {
if(typeof(timeout)=='function') {
callback = timeout;
timeout = -1;
}
await this.ready;
while(!this.data.length) {
await this.mutex.take();
}
let item = this.data.pop();
if(this.sem && this.sem.sem.current>0) {
this.sem.leave();
}
if(callback) {
callback(null,item);
}
return item;
}
}
if(module.parent) {
module.exports = Queue;
}
else {
const MAX = 10000;
async function run(asArray) {
let q = new Queue(null, asArray);
let ti1 = Date.now();
for(let i=0;i<MAX;i++) {
await q.push({data:i});
}
while(q.size()) {
let r = await q.pop();
//console.log(r);
}
let tf1 = Date.now();
console.log(`Time [asArray:${asArray}] : ${tf1-ti1}`);
}
async function test() {
await run(false);
await run(true);
}
test();
}
|
import React from 'react'
const SvgUser = props => (
<svg
className="user_svg__feather user_svg__feather-user"
fill="none"
height="1em"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth={2}
viewBox="0 0 24 24"
width="1em"
{...props}
>
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2" />
<circle cx={12} cy={7} r={4} />
</svg>
)
export default SvgUser
|
var searchData=
[
['virtual_20allocator_0',['Virtual allocator',['../group__group__virtual.html',1,'(Global Namespace)'],['../virtual_allocator.html',1,'index']]],
['vk_5famd_5fdevice_5fcoherent_5fmemory_1',['VK_AMD_device_coherent_memory',['../vk_amd_device_coherent_memory.html',1,'index']]],
['vk_5fdefine_5fnon_5fdispatchable_5fhandle_2',['VK_DEFINE_NON_DISPATCHABLE_HANDLE',['../group__group__virtual.html#ga565936f8d98d225b536a2d9703bc7676',1,'vk_mem_alloc.h']]],
['vk_5fext_5fmemory_5fpriority_3',['VK_EXT_memory_priority',['../vk_ext_memory_priority.html',1,'index']]],
['vk_5fkhr_5fdedicated_5fallocation_4',['VK_KHR_dedicated_allocation',['../vk_khr_dedicated_allocation.html',1,'index']]],
['vk_5fmem_5falloc_2eh_5',['vk_mem_alloc.h',['../vk__mem__alloc_8h.html',1,'']]],
['vkallocatememory_6',['vkAllocateMemory',['../struct_vma_vulkan_functions.html#a2943bf99dfd784a0e8f599d987e22e6c',1,'VmaVulkanFunctions']]],
['vkbindbuffermemory_7',['vkBindBufferMemory',['../struct_vma_vulkan_functions.html#a94fc4f3a605d9880bb3c0ba2c2fc80b2',1,'VmaVulkanFunctions']]],
['vkbindbuffermemory2khr_8',['vkBindBufferMemory2KHR',['../struct_vma_vulkan_functions.html#a0c4907235aab9df2767b79836afa2dc9',1,'VmaVulkanFunctions']]],
['vkbindimagememory_9',['vkBindImageMemory',['../struct_vma_vulkan_functions.html#a1338d96a128a5ade648b8d934907c637',1,'VmaVulkanFunctions']]],
['vkbindimagememory2khr_10',['vkBindImageMemory2KHR',['../struct_vma_vulkan_functions.html#ab95aaa73ab8a3fe9fd3daaaec4e0b2bf',1,'VmaVulkanFunctions']]],
['vkcmdcopybuffer_11',['vkCmdCopyBuffer',['../struct_vma_vulkan_functions.html#ae5c0db8c89a3b82593dc16aa6a49fa3a',1,'VmaVulkanFunctions']]],
['vkcreatebuffer_12',['vkCreateBuffer',['../struct_vma_vulkan_functions.html#ae8084315a25006271a2edfc3a447519f',1,'VmaVulkanFunctions']]],
['vkcreateimage_13',['vkCreateImage',['../struct_vma_vulkan_functions.html#a23ebe70be515b9b5010a1d691200e325',1,'VmaVulkanFunctions']]],
['vkdestroybuffer_14',['vkDestroyBuffer',['../struct_vma_vulkan_functions.html#a7e054606faddb07f0e8556f3ed317d45',1,'VmaVulkanFunctions']]],
['vkdestroyimage_15',['vkDestroyImage',['../struct_vma_vulkan_functions.html#a90b898227039b1dcb3520f6e91f09ffa',1,'VmaVulkanFunctions']]],
['vkflushmappedmemoryranges_16',['vkFlushMappedMemoryRanges',['../struct_vma_vulkan_functions.html#a33c322f4c4ad2810f8a9c97a277572f9',1,'VmaVulkanFunctions']]],
['vkfreememory_17',['vkFreeMemory',['../struct_vma_vulkan_functions.html#a4c658701778564d62034255b5dda91b4',1,'VmaVulkanFunctions']]],
['vkgetbuffermemoryrequirements_18',['vkGetBufferMemoryRequirements',['../struct_vma_vulkan_functions.html#a5b92901df89a4194b0d12f6071d4d143',1,'VmaVulkanFunctions']]],
['vkgetbuffermemoryrequirements2khr_19',['vkGetBufferMemoryRequirements2KHR',['../struct_vma_vulkan_functions.html#a9d8d1b05d2b1e7e1d9b27f6f585acf9c',1,'VmaVulkanFunctions']]],
['vkgetdevicebuffermemoryrequirements_20',['vkGetDeviceBufferMemoryRequirements',['../struct_vma_vulkan_functions.html#a3d6cc5633bdbfec728213d6dfae7d413',1,'VmaVulkanFunctions']]],
['vkgetdeviceimagememoryrequirements_21',['vkGetDeviceImageMemoryRequirements',['../struct_vma_vulkan_functions.html#afd4780c565028cd15498528883f51fc6',1,'VmaVulkanFunctions']]],
['vkgetdeviceprocaddr_22',['vkGetDeviceProcAddr',['../struct_vma_vulkan_functions.html#ac383ab9af127e5e136622fa4ebea9e57',1,'VmaVulkanFunctions']]],
['vkgetimagememoryrequirements_23',['vkGetImageMemoryRequirements',['../struct_vma_vulkan_functions.html#a475f6f49f8debe4d10800592606d53f4',1,'VmaVulkanFunctions']]],
['vkgetimagememoryrequirements2khr_24',['vkGetImageMemoryRequirements2KHR',['../struct_vma_vulkan_functions.html#a9cdcdc1e2b2ea7c571f7d27e30ba6875',1,'VmaVulkanFunctions']]],
['vkgetinstanceprocaddr_25',['vkGetInstanceProcAddr',['../struct_vma_vulkan_functions.html#a3eafa102f5f8915f093f40675636b849',1,'VmaVulkanFunctions']]],
['vkgetphysicaldevicememoryproperties_26',['vkGetPhysicalDeviceMemoryProperties',['../struct_vma_vulkan_functions.html#a60d25c33bba06bb8592e6875cbaa9830',1,'VmaVulkanFunctions']]],
['vkgetphysicaldevicememoryproperties2khr_27',['vkGetPhysicalDeviceMemoryProperties2KHR',['../struct_vma_vulkan_functions.html#a0d992896e6ffcf92b9d7ea049fa5c445',1,'VmaVulkanFunctions']]],
['vkgetphysicaldeviceproperties_28',['vkGetPhysicalDeviceProperties',['../struct_vma_vulkan_functions.html#a77b7a74082823e865dd6546623468f96',1,'VmaVulkanFunctions']]],
['vkinvalidatemappedmemoryranges_29',['vkInvalidateMappedMemoryRanges',['../struct_vma_vulkan_functions.html#a5c1093bc32386a8060c37c9f282078a1',1,'VmaVulkanFunctions']]],
['vkmapmemory_30',['vkMapMemory',['../struct_vma_vulkan_functions.html#ab5c1f38dea3a2cf00dc9eb4f57218c49',1,'VmaVulkanFunctions']]],
['vkunmapmemory_31',['vkUnmapMemory',['../struct_vma_vulkan_functions.html#acc798589736f0becb317fc2196c1d8b9',1,'VmaVulkanFunctions']]],
['vma_5fallocation_5fcreate_5fcan_5falias_5fbit_32',['VMA_ALLOCATION_CREATE_CAN_ALIAS_BIT',['../group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597afb0ee060cd733aaa5e249704ff589ad6',1,'vk_mem_alloc.h']]],
['vma_5fallocation_5fcreate_5fdedicated_5fmemory_5fbit_33',['VMA_ALLOCATION_CREATE_DEDICATED_MEMORY_BIT',['../group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597a3fc311d855c2ff53f1090ef5c722b38f',1,'vk_mem_alloc.h']]],
['vma_5fallocation_5fcreate_5fdont_5fbind_5fbit_34',['VMA_ALLOCATION_CREATE_DONT_BIND_BIT',['../group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597a2310568c62208af432724305fe29ccea',1,'vk_mem_alloc.h']]],
['vma_5fallocation_5fcreate_5fflag_5fbits_5fmax_5fenum_35',['VMA_ALLOCATION_CREATE_FLAG_BITS_MAX_ENUM',['../group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597ae5633ec569f4899cf8f29e7385b2f882',1,'vk_mem_alloc.h']]],
['vma_5fallocation_5fcreate_5fhost_5faccess_5fallow_5ftransfer_5finstead_5fbit_36',['VMA_ALLOCATION_CREATE_HOST_ACCESS_ALLOW_TRANSFER_INSTEAD_BIT',['../group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597a11337f96eacf34c1016c339eac165cad',1,'vk_mem_alloc.h']]],
['vma_5fallocation_5fcreate_5fhost_5faccess_5frandom_5fbit_37',['VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT',['../group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597add61238d98e20917b9a06c617763f492',1,'vk_mem_alloc.h']]],
['vma_5fallocation_5fcreate_5fhost_5faccess_5fsequential_5fwrite_5fbit_38',['VMA_ALLOCATION_CREATE_HOST_ACCESS_SEQUENTIAL_WRITE_BIT',['../group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597a9be224df3bfc1cfa06203aed689a30c5',1,'vk_mem_alloc.h']]],
['vma_5fallocation_5fcreate_5fmapped_5fbit_39',['VMA_ALLOCATION_CREATE_MAPPED_BIT',['../group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597a11da372cc3a82931c5e5d6146cd9dd1f',1,'vk_mem_alloc.h']]],
['vma_5fallocation_5fcreate_5fnever_5fallocate_5fbit_40',['VMA_ALLOCATION_CREATE_NEVER_ALLOCATE_BIT',['../group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597a89759603401014eb325eb22a3839f2ff',1,'vk_mem_alloc.h']]],
['vma_5fallocation_5fcreate_5fstrategy_5fbest_5ffit_5fbit_41',['VMA_ALLOCATION_CREATE_STRATEGY_BEST_FIT_BIT',['../group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597a839826775c62319466441f86496f036d',1,'vk_mem_alloc.h']]],
['vma_5fallocation_5fcreate_5fstrategy_5ffirst_5ffit_5fbit_42',['VMA_ALLOCATION_CREATE_STRATEGY_FIRST_FIT_BIT',['../group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597a33eb2052674f3ad92386c714a65fb777',1,'vk_mem_alloc.h']]],
['vma_5fallocation_5fcreate_5fstrategy_5fmask_43',['VMA_ALLOCATION_CREATE_STRATEGY_MASK',['../group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597a8e16845d81ae3d27c47106d4770d5c7e',1,'vk_mem_alloc.h']]],
['vma_5fallocation_5fcreate_5fstrategy_5fmin_5fmemory_5fbit_44',['VMA_ALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT',['../group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597a8af1210cf591784afa026d94998f735d',1,'vk_mem_alloc.h']]],
['vma_5fallocation_5fcreate_5fstrategy_5fmin_5foffset_5fbit_45',['VMA_ALLOCATION_CREATE_STRATEGY_MIN_OFFSET_BIT',['../group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597a8099acedc0d04cdccaaddcfe37fd227d',1,'vk_mem_alloc.h']]],
['vma_5fallocation_5fcreate_5fstrategy_5fmin_5ftime_5fbit_46',['VMA_ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT',['../group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597a0729e932b7ea170e3a128cad96c5cf6d',1,'vk_mem_alloc.h']]],
['vma_5fallocation_5fcreate_5fupper_5faddress_5fbit_47',['VMA_ALLOCATION_CREATE_UPPER_ADDRESS_BIT',['../group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597a42ba3a2d2c7117953210b7c3ef8da0df',1,'vk_mem_alloc.h']]],
['vma_5fallocation_5fcreate_5fuser_5fdata_5fcopy_5fstring_5fbit_48',['VMA_ALLOCATION_CREATE_USER_DATA_COPY_STRING_BIT',['../group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597aa6f24f821cd6a7c5e4a443f7bf59c520',1,'vk_mem_alloc.h']]],
['vma_5fallocation_5fcreate_5fwithin_5fbudget_5fbit_49',['VMA_ALLOCATION_CREATE_WITHIN_BUDGET_BIT',['../group__group__alloc.html#ggad9889c10c798b040d59c92f257cae597ab8b1764f3e9022368e440c057783b92d',1,'vk_mem_alloc.h']]],
['vma_5fallocator_5fcreate_5famd_5fdevice_5fcoherent_5fmemory_5fbit_50',['VMA_ALLOCATOR_CREATE_AMD_DEVICE_COHERENT_MEMORY_BIT',['../group__group__init.html#gga4f87c9100d154a65a4ad495f7763cf7ca2acce4886d8078552efa38878413970f',1,'vk_mem_alloc.h']]],
['vma_5fallocator_5fcreate_5fbuffer_5fdevice_5faddress_5fbit_51',['VMA_ALLOCATOR_CREATE_BUFFER_DEVICE_ADDRESS_BIT',['../group__group__init.html#gga4f87c9100d154a65a4ad495f7763cf7ca5f1b28b0414319d1687e1f2b30ab0089',1,'vk_mem_alloc.h']]],
['vma_5fallocator_5fcreate_5fext_5fmemory_5fbudget_5fbit_52',['VMA_ALLOCATOR_CREATE_EXT_MEMORY_BUDGET_BIT',['../group__group__init.html#gga4f87c9100d154a65a4ad495f7763cf7ca4d4687863f7bd4b418c6006dc04400b0',1,'vk_mem_alloc.h']]],
['vma_5fallocator_5fcreate_5fext_5fmemory_5fpriority_5fbit_53',['VMA_ALLOCATOR_CREATE_EXT_MEMORY_PRIORITY_BIT',['../group__group__init.html#gga4f87c9100d154a65a4ad495f7763cf7caffdd7a5169be3dbd7cbf6b3619e4f78a',1,'vk_mem_alloc.h']]],
['vma_5fallocator_5fcreate_5fexternally_5fsynchronized_5fbit_54',['VMA_ALLOCATOR_CREATE_EXTERNALLY_SYNCHRONIZED_BIT',['../group__group__init.html#gga4f87c9100d154a65a4ad495f7763cf7ca4816ddaed324ba110172ca608a20f29d',1,'vk_mem_alloc.h']]],
['vma_5fallocator_5fcreate_5fflag_5fbits_5fmax_5fenum_55',['VMA_ALLOCATOR_CREATE_FLAG_BITS_MAX_ENUM',['../group__group__init.html#gga4f87c9100d154a65a4ad495f7763cf7cae4d5ad929caba5f23eb502b13bd5286c',1,'vk_mem_alloc.h']]],
['vma_5fallocator_5fcreate_5fkhr_5fbind_5fmemory2_5fbit_56',['VMA_ALLOCATOR_CREATE_KHR_BIND_MEMORY2_BIT',['../group__group__init.html#gga4f87c9100d154a65a4ad495f7763cf7ca8fb75bf07cd184ab903596295e863dee',1,'vk_mem_alloc.h']]],
['vma_5fallocator_5fcreate_5fkhr_5fdedicated_5fallocation_5fbit_57',['VMA_ALLOCATOR_CREATE_KHR_DEDICATED_ALLOCATION_BIT',['../group__group__init.html#gga4f87c9100d154a65a4ad495f7763cf7cace7da7cc6e71a625dfa763c55a597878',1,'vk_mem_alloc.h']]],
['vma_5fbind_5fmemory2_58',['VMA_BIND_MEMORY2',['../vk__mem__alloc_8h.html#a88bef97f86d70a34a4c0746e09a2680d',1,'vk_mem_alloc.h']]],
['vma_5fbuffer_5fdevice_5faddress_59',['VMA_BUFFER_DEVICE_ADDRESS',['../vk__mem__alloc_8h.html#a7f9d5e71b70dd1a137c303a8a8262c10',1,'vk_mem_alloc.h']]],
['vma_5fdedicated_5fallocation_60',['VMA_DEDICATED_ALLOCATION',['../vk__mem__alloc_8h.html#af7b860e63b96d11e44ae8587ba06bbf4',1,'vk_mem_alloc.h']]],
['vma_5fdefragmentation_5fflag_5falgorithm_5fbalanced_5fbit_61',['VMA_DEFRAGMENTATION_FLAG_ALGORITHM_BALANCED_BIT',['../group__group__alloc.html#gga6552a65b71d16f378c6994b3ceaef50caec35a4138111605a6ff32ca61aa871b6',1,'vk_mem_alloc.h']]],
['vma_5fdefragmentation_5fflag_5falgorithm_5fextensive_5fbit_62',['VMA_DEFRAGMENTATION_FLAG_ALGORITHM_EXTENSIVE_BIT',['../group__group__alloc.html#gga6552a65b71d16f378c6994b3ceaef50cae45a9469e5337731627758671741e412',1,'vk_mem_alloc.h']]],
['vma_5fdefragmentation_5fflag_5falgorithm_5ffast_5fbit_63',['VMA_DEFRAGMENTATION_FLAG_ALGORITHM_FAST_BIT',['../group__group__alloc.html#gga6552a65b71d16f378c6994b3ceaef50ca2e6469bcf5a094776ceb5d118263f04b',1,'vk_mem_alloc.h']]],
['vma_5fdefragmentation_5fflag_5falgorithm_5ffull_5fbit_64',['VMA_DEFRAGMENTATION_FLAG_ALGORITHM_FULL_BIT',['../group__group__alloc.html#gga6552a65b71d16f378c6994b3ceaef50cafa162eac5be800bcdd4011427a71156d',1,'vk_mem_alloc.h']]],
['vma_5fdefragmentation_5fflag_5falgorithm_5fmask_65',['VMA_DEFRAGMENTATION_FLAG_ALGORITHM_MASK',['../group__group__alloc.html#gga6552a65b71d16f378c6994b3ceaef50cabcbbdb3bfd53c4c3ab4eaeb5fd4894e9',1,'vk_mem_alloc.h']]],
['vma_5fdefragmentation_5fflag_5fbits_5fmax_5fenum_66',['VMA_DEFRAGMENTATION_FLAG_BITS_MAX_ENUM',['../group__group__alloc.html#gga6552a65b71d16f378c6994b3ceaef50cab87ec33154803bfeb5ac2b379f1d6a97',1,'vk_mem_alloc.h']]],
['vma_5fdefragmentation_5fmove_5foperation_5fcopy_67',['VMA_DEFRAGMENTATION_MOVE_OPERATION_COPY',['../group__group__alloc.html#ggada9e3861caf96f08894b0bcc160ec257ad4a06ac46c4cb1c67b0ebc1edfab9f18',1,'vk_mem_alloc.h']]],
['vma_5fdefragmentation_5fmove_5foperation_5fdestroy_68',['VMA_DEFRAGMENTATION_MOVE_OPERATION_DESTROY',['../group__group__alloc.html#ggada9e3861caf96f08894b0bcc160ec257a9786f8492a9be2c03bd26395e352ab85',1,'vk_mem_alloc.h']]],
['vma_5fdefragmentation_5fmove_5foperation_5fignore_69',['VMA_DEFRAGMENTATION_MOVE_OPERATION_IGNORE',['../group__group__alloc.html#ggada9e3861caf96f08894b0bcc160ec257ad25bc6f816b226b4fd5170e845f218d2',1,'vk_mem_alloc.h']]],
['vma_5fmemory_5fbudget_70',['VMA_MEMORY_BUDGET',['../vk__mem__alloc_8h.html#a05decf1cf4ebf767beba7acca6c1ec3a',1,'vk_mem_alloc.h']]],
['vma_5fmemory_5fusage_5fauto_71',['VMA_MEMORY_USAGE_AUTO',['../group__group__alloc.html#ggaa5846affa1e9da3800e3e78fae2305cca27cde9026a84d34d525777baa41fce6e',1,'vk_mem_alloc.h']]],
['vma_5fmemory_5fusage_5fauto_5fprefer_5fdevice_72',['VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE',['../group__group__alloc.html#ggaa5846affa1e9da3800e3e78fae2305ccae2adb696d6a73c18bb20c23666661327',1,'vk_mem_alloc.h']]],
['vma_5fmemory_5fusage_5fauto_5fprefer_5fhost_73',['VMA_MEMORY_USAGE_AUTO_PREFER_HOST',['../group__group__alloc.html#ggaa5846affa1e9da3800e3e78fae2305cca9b422585242160b8ed3418310ee6664d',1,'vk_mem_alloc.h']]],
['vma_5fmemory_5fusage_5fcpu_5fcopy_74',['VMA_MEMORY_USAGE_CPU_COPY',['../group__group__alloc.html#ggaa5846affa1e9da3800e3e78fae2305cca416a444d4d0fc20067c3f76f32ff2500',1,'vk_mem_alloc.h']]],
['vma_5fmemory_5fusage_5fcpu_5fonly_75',['VMA_MEMORY_USAGE_CPU_ONLY',['../group__group__alloc.html#ggaa5846affa1e9da3800e3e78fae2305cca40bdf4cddeffeb12f43d45ca1286e0a5',1,'vk_mem_alloc.h']]],
['vma_5fmemory_5fusage_5fcpu_5fto_5fgpu_76',['VMA_MEMORY_USAGE_CPU_TO_GPU',['../group__group__alloc.html#ggaa5846affa1e9da3800e3e78fae2305cca9066b52c5a7079bb74a69aaf8b92ff67',1,'vk_mem_alloc.h']]],
['vma_5fmemory_5fusage_5fgpu_5flazily_5fallocated_77',['VMA_MEMORY_USAGE_GPU_LAZILY_ALLOCATED',['../group__group__alloc.html#ggaa5846affa1e9da3800e3e78fae2305cca835333d9072db63a653818030e17614d',1,'vk_mem_alloc.h']]],
['vma_5fmemory_5fusage_5fgpu_5fonly_78',['VMA_MEMORY_USAGE_GPU_ONLY',['../group__group__alloc.html#ggaa5846affa1e9da3800e3e78fae2305ccac6b5dc1432d88647aa4cd456246eadf7',1,'vk_mem_alloc.h']]],
['vma_5fmemory_5fusage_5fgpu_5fto_5fcpu_79',['VMA_MEMORY_USAGE_GPU_TO_CPU',['../group__group__alloc.html#ggaa5846affa1e9da3800e3e78fae2305cca7b586d2fdaf82a463b58f581ed72be27',1,'vk_mem_alloc.h']]],
['vma_5fmemory_5fusage_5fmax_5fenum_80',['VMA_MEMORY_USAGE_MAX_ENUM',['../group__group__alloc.html#ggaa5846affa1e9da3800e3e78fae2305cca091e69437ef693e8d0d287f1c719ba6e',1,'vk_mem_alloc.h']]],
['vma_5fmemory_5fusage_5funknown_81',['VMA_MEMORY_USAGE_UNKNOWN',['../group__group__alloc.html#ggaa5846affa1e9da3800e3e78fae2305ccaf50d27e34e0925cf3a63db8c839121dd',1,'vk_mem_alloc.h']]],
['vma_5fpool_5fcreate_5falgorithm_5fmask_82',['VMA_POOL_CREATE_ALGORITHM_MASK',['../group__group__alloc.html#gga9a7c45f9c863695d98c83fa5ac940fe7af4d270f8f42517a0f70037ceb6ac1d9c',1,'vk_mem_alloc.h']]],
['vma_5fpool_5fcreate_5fflag_5fbits_5fmax_5fenum_83',['VMA_POOL_CREATE_FLAG_BITS_MAX_ENUM',['../group__group__alloc.html#gga9a7c45f9c863695d98c83fa5ac940fe7a1c7312bea9ea246846b9054fd6bd6aec',1,'vk_mem_alloc.h']]],
['vma_5fpool_5fcreate_5fignore_5fbuffer_5fimage_5fgranularity_5fbit_84',['VMA_POOL_CREATE_IGNORE_BUFFER_IMAGE_GRANULARITY_BIT',['../group__group__alloc.html#gga9a7c45f9c863695d98c83fa5ac940fe7a9f1a499508a8edb4e8ba40aa0290a3d2',1,'vk_mem_alloc.h']]],
['vma_5fpool_5fcreate_5flinear_5falgorithm_5fbit_85',['VMA_POOL_CREATE_LINEAR_ALGORITHM_BIT',['../group__group__alloc.html#gga9a7c45f9c863695d98c83fa5ac940fe7a13c8a444197c67866be9cb05599fc726',1,'vk_mem_alloc.h']]],
['vma_5fstats_5fstring_5fenabled_86',['VMA_STATS_STRING_ENABLED',['../vk__mem__alloc_8h.html#ae25f0d55fd91cb166f002b63244800e1',1,'vk_mem_alloc.h']]],
['vma_5fvirtual_5fallocation_5fcreate_5fflag_5fbits_5fmax_5fenum_87',['VMA_VIRTUAL_ALLOCATION_CREATE_FLAG_BITS_MAX_ENUM',['../group__group__virtual.html#gga2e9c64d405b14156fea7e10c4ad06cb6ac1163c03ea837fa663462dc286d6a1a9',1,'vk_mem_alloc.h']]],
['vma_5fvirtual_5fallocation_5fcreate_5fstrategy_5fmask_88',['VMA_VIRTUAL_ALLOCATION_CREATE_STRATEGY_MASK',['../group__group__virtual.html#gga2e9c64d405b14156fea7e10c4ad06cb6ac5b5e45c335368d18df59c9f27df17e3',1,'vk_mem_alloc.h']]],
['vma_5fvirtual_5fallocation_5fcreate_5fstrategy_5fmin_5fmemory_5fbit_89',['VMA_VIRTUAL_ALLOCATION_CREATE_STRATEGY_MIN_MEMORY_BIT',['../group__group__virtual.html#gga2e9c64d405b14156fea7e10c4ad06cb6ae2a9591a62b5e3b1bdcbc81c6188a1bf',1,'vk_mem_alloc.h']]],
['vma_5fvirtual_5fallocation_5fcreate_5fstrategy_5fmin_5foffset_5fbit_90',['VMA_VIRTUAL_ALLOCATION_CREATE_STRATEGY_MIN_OFFSET_BIT',['../group__group__virtual.html#gga2e9c64d405b14156fea7e10c4ad06cb6a3bb82d2aedd587a64846a1d7778852e6',1,'vk_mem_alloc.h']]],
['vma_5fvirtual_5fallocation_5fcreate_5fstrategy_5fmin_5ftime_5fbit_91',['VMA_VIRTUAL_ALLOCATION_CREATE_STRATEGY_MIN_TIME_BIT',['../group__group__virtual.html#gga2e9c64d405b14156fea7e10c4ad06cb6a562d10a46012719d33167d3dc5dbbf9b',1,'vk_mem_alloc.h']]],
['vma_5fvirtual_5fallocation_5fcreate_5fupper_5faddress_5fbit_92',['VMA_VIRTUAL_ALLOCATION_CREATE_UPPER_ADDRESS_BIT',['../group__group__virtual.html#gga2e9c64d405b14156fea7e10c4ad06cb6a9524a329a55b5ec390d57d90b67ad78e',1,'vk_mem_alloc.h']]],
['vma_5fvirtual_5fblock_5fcreate_5falgorithm_5fmask_93',['VMA_VIRTUAL_BLOCK_CREATE_ALGORITHM_MASK',['../group__group__virtual.html#gga88bcf8c1cd3bb1610ff7343811c65bcaaf9487467136e1a9e371894dc3a7c4844',1,'vk_mem_alloc.h']]],
['vma_5fvirtual_5fblock_5fcreate_5fflag_5fbits_5fmax_5fenum_94',['VMA_VIRTUAL_BLOCK_CREATE_FLAG_BITS_MAX_ENUM',['../group__group__virtual.html#gga88bcf8c1cd3bb1610ff7343811c65bcaa5fc0d333c3d5687a8bbf57df9b377a87',1,'vk_mem_alloc.h']]],
['vma_5fvirtual_5fblock_5fcreate_5flinear_5falgorithm_5fbit_95',['VMA_VIRTUAL_BLOCK_CREATE_LINEAR_ALGORITHM_BIT',['../group__group__virtual.html#gga88bcf8c1cd3bb1610ff7343811c65bcaae6423e2fa2f3c9211b21c819e3f10f96',1,'vk_mem_alloc.h']]],
['vmaallocatememory_96',['vmaAllocateMemory',['../group__group__alloc.html#gabf28077dbf82d0908b8acbe8ee8dd9b8',1,'vk_mem_alloc.h']]],
['vmaallocatememoryforbuffer_97',['vmaAllocateMemoryForBuffer',['../group__group__alloc.html#ga7fdf64415b6c3d83c454f28d2c53df7b',1,'vk_mem_alloc.h']]],
['vmaallocatememoryforimage_98',['vmaAllocateMemoryForImage',['../group__group__alloc.html#ga0faa3f9e5fb233d29d1e00390650febb',1,'vk_mem_alloc.h']]],
['vmaallocatememorypages_99',['vmaAllocateMemoryPages',['../group__group__alloc.html#gad37e82e492b3de38fc3f4cffd9ad0ae1',1,'vk_mem_alloc.h']]],
['vmaallocation_100',['VmaAllocation',['../struct_vma_allocation.html',1,'']]],
['vmaallocationcreateflagbits_101',['VmaAllocationCreateFlagBits',['../group__group__alloc.html#ga4fceecc301f4064dc808d3cd6c038941',1,'VmaAllocationCreateFlagBits(): vk_mem_alloc.h'],['../group__group__alloc.html#gad9889c10c798b040d59c92f257cae597',1,'VmaAllocationCreateFlagBits(): vk_mem_alloc.h']]],
['vmaallocationcreateflags_102',['VmaAllocationCreateFlags',['../group__group__alloc.html#ga5225e5e11f8376f6a31a1791f3d6e817',1,'vk_mem_alloc.h']]],
['vmaallocationcreateinfo_103',['VmaAllocationCreateInfo',['../struct_vma_allocation_create_info.html',1,'VmaAllocationCreateInfo'],['../group__group__alloc.html#ga3bf110892ea2fb4649fedb68488d026a',1,'VmaAllocationCreateInfo(): vk_mem_alloc.h']]],
['vmaallocationinfo_104',['VmaAllocationInfo',['../struct_vma_allocation_info.html',1,'VmaAllocationInfo'],['../group__group__alloc.html#ga1cf7774606721026a68aabe3af2e5b50',1,'VmaAllocationInfo(): vk_mem_alloc.h']]],
['vmaallocator_105',['VmaAllocator',['../struct_vma_allocator.html',1,'']]],
['vmaallocatorcreateflagbits_106',['VmaAllocatorCreateFlagBits',['../group__group__init.html#ga4f87c9100d154a65a4ad495f7763cf7c',1,'VmaAllocatorCreateFlagBits(): vk_mem_alloc.h'],['../group__group__init.html#gafd73b95e737ee7e76f827cb5472f559f',1,'VmaAllocatorCreateFlagBits(): vk_mem_alloc.h']]],
['vmaallocatorcreateflags_107',['VmaAllocatorCreateFlags',['../group__group__init.html#gacfe6863e160722c2c1bbcf7573fddc4d',1,'vk_mem_alloc.h']]],
['vmaallocatorcreateinfo_108',['VmaAllocatorCreateInfo',['../struct_vma_allocator_create_info.html',1,'VmaAllocatorCreateInfo'],['../group__group__init.html#gaad9652301d33759b83e52d4f3605a14a',1,'VmaAllocatorCreateInfo(): vk_mem_alloc.h']]],
['vmaallocatorinfo_109',['VmaAllocatorInfo',['../struct_vma_allocator_info.html',1,'VmaAllocatorInfo'],['../group__group__init.html#ga1988031b0223fdbd564250fa1edd942c',1,'VmaAllocatorInfo(): vk_mem_alloc.h']]],
['vmabegindefragmentation_110',['vmaBeginDefragmentation',['../group__group__alloc.html#gac3335566858b45541fa9c0d7a6bbb57e',1,'vk_mem_alloc.h']]],
['vmabegindefragmentationpass_111',['vmaBeginDefragmentationPass',['../group__group__alloc.html#ga980d7da2ce3b1fd5c8b8476bc362cc00',1,'vk_mem_alloc.h']]],
['vmabindbuffermemory_112',['vmaBindBufferMemory',['../group__group__alloc.html#ga6b0929b914b60cf2d45cac4bf3547470',1,'vk_mem_alloc.h']]],
['vmabindbuffermemory2_113',['vmaBindBufferMemory2',['../group__group__alloc.html#ga927c944f45e0f2941182abb6f608e64a',1,'vk_mem_alloc.h']]],
['vmabindimagememory_114',['vmaBindImageMemory',['../group__group__alloc.html#ga3d3ca45799923aa5d138e9e5f9eb2da5',1,'vk_mem_alloc.h']]],
['vmabindimagememory2_115',['vmaBindImageMemory2',['../group__group__alloc.html#gaa8251ee81b0045a443e35b8e8aa021bc',1,'vk_mem_alloc.h']]],
['vmabudget_116',['VmaBudget',['../struct_vma_budget.html',1,'VmaBudget'],['../group__group__stats.html#gaa078667e71b1ef24e87a6a30d128381d',1,'VmaBudget(): vk_mem_alloc.h']]],
['vmabuildstatsstring_117',['vmaBuildStatsString',['../group__group__stats.html#gaa4fee7eb5253377599ef4fd38c93c2a0',1,'vk_mem_alloc.h']]],
['vmabuildvirtualblockstatsstring_118',['vmaBuildVirtualBlockStatsString',['../group__group__stats.html#ga52d810e1222c592e5d80556ad005f1e6',1,'vk_mem_alloc.h']]],
['vmacalculatepoolstatistics_119',['vmaCalculatePoolStatistics',['../group__group__stats.html#ga50ba0eb25d2b363b792be4645ca7a380',1,'vk_mem_alloc.h']]],
['vmacalculatestatistics_120',['vmaCalculateStatistics',['../group__group__stats.html#ga36f3484de7aa6cd6edc4de9edfa0ff59',1,'vk_mem_alloc.h']]],
['vmacalculatevirtualblockstatistics_121',['vmaCalculateVirtualBlockStatistics',['../group__group__virtual.html#ga93c5741bca44b43e5b849cacbd616098',1,'vk_mem_alloc.h']]],
['vmacheckcorruption_122',['vmaCheckCorruption',['../group__group__alloc.html#ga49329a7f030dafcf82f7b73334c22e98',1,'vk_mem_alloc.h']]],
['vmacheckpoolcorruption_123',['vmaCheckPoolCorruption',['../group__group__alloc.html#gad535935619c7a549bf837e1bb0068f89',1,'vk_mem_alloc.h']]],
['vmaclearvirtualblock_124',['vmaClearVirtualBlock',['../group__group__virtual.html#ga5eda6f55919fb05bd2f56a112590c571',1,'vk_mem_alloc.h']]],
['vmacreateallocator_125',['vmaCreateAllocator',['../group__group__init.html#ga200692051ddb34240248234f5f4c17bb',1,'vk_mem_alloc.h']]],
['vmacreatebuffer_126',['vmaCreateBuffer',['../group__group__alloc.html#gac72ee55598617e8eecca384e746bab51',1,'vk_mem_alloc.h']]],
['vmacreatebufferwithalignment_127',['vmaCreateBufferWithAlignment',['../group__group__alloc.html#gaa06a690013a0d01e60894ac378083834',1,'vk_mem_alloc.h']]],
['vmacreateimage_128',['vmaCreateImage',['../group__group__alloc.html#ga02a94f25679275851a53e82eacbcfc73',1,'vk_mem_alloc.h']]],
['vmacreatepool_129',['vmaCreatePool',['../group__group__alloc.html#ga5c8770ded7c59c8caac6de0c2cb00b50',1,'vk_mem_alloc.h']]],
['vmacreatevirtualblock_130',['vmaCreateVirtualBlock',['../group__group__virtual.html#gab585754076877265fdae33e5c40ef13b',1,'vk_mem_alloc.h']]],
['vmadefragmentationcontext_131',['VmaDefragmentationContext',['../struct_vma_defragmentation_context.html',1,'']]],
['vmadefragmentationflagbits_132',['VmaDefragmentationFlagBits',['../group__group__alloc.html#ga13415cc0b443353a7b5abda300b833fc',1,'VmaDefragmentationFlagBits(): vk_mem_alloc.h'],['../group__group__alloc.html#ga6552a65b71d16f378c6994b3ceaef50c',1,'VmaDefragmentationFlagBits(): vk_mem_alloc.h']]],
['vmadefragmentationflags_133',['VmaDefragmentationFlags',['../group__group__alloc.html#ga88a77cef37e5d3c4fc9eb328885d048d',1,'vk_mem_alloc.h']]],
['vmadefragmentationinfo_134',['VmaDefragmentationInfo',['../group__group__alloc.html#ga2bf47f96bf92bed2a49461bd9af3acfa',1,'VmaDefragmentationInfo(): vk_mem_alloc.h'],['../struct_vma_defragmentation_info.html',1,'VmaDefragmentationInfo']]],
['vmadefragmentationmove_135',['VmaDefragmentationMove',['../struct_vma_defragmentation_move.html',1,'VmaDefragmentationMove'],['../group__group__alloc.html#ga563f4b43d3e31ed603d80cacc9ba8589',1,'VmaDefragmentationMove(): vk_mem_alloc.h']]],
['vmadefragmentationmoveoperation_136',['VmaDefragmentationMoveOperation',['../group__group__alloc.html#ga2ea666deeb3c2c74806a097e27cdb4a1',1,'VmaDefragmentationMoveOperation(): vk_mem_alloc.h'],['../group__group__alloc.html#gada9e3861caf96f08894b0bcc160ec257',1,'VmaDefragmentationMoveOperation(): vk_mem_alloc.h']]],
['vmadefragmentationpassmoveinfo_137',['VmaDefragmentationPassMoveInfo',['../struct_vma_defragmentation_pass_move_info.html',1,'VmaDefragmentationPassMoveInfo'],['../group__group__alloc.html#gad6799e8e2b1527abfc84d33bc44aeaf5',1,'VmaDefragmentationPassMoveInfo(): vk_mem_alloc.h']]],
['vmadefragmentationstats_138',['VmaDefragmentationStats',['../struct_vma_defragmentation_stats.html',1,'VmaDefragmentationStats'],['../group__group__alloc.html#gad94034192259c2e34a4d1c5e27810403',1,'VmaDefragmentationStats(): vk_mem_alloc.h']]],
['vmadestroyallocator_139',['vmaDestroyAllocator',['../group__group__init.html#gaa8d164061c88f22fb1fd3c8f3534bc1d',1,'vk_mem_alloc.h']]],
['vmadestroybuffer_140',['vmaDestroyBuffer',['../group__group__alloc.html#ga0d9f4e4ba5bf9aab1f1c746387753d77',1,'vk_mem_alloc.h']]],
['vmadestroyimage_141',['vmaDestroyImage',['../group__group__alloc.html#gae50d2cb3b4a3bfd4dd40987234e50e7e',1,'vk_mem_alloc.h']]],
['vmadestroypool_142',['vmaDestroyPool',['../group__group__alloc.html#ga5485779c8f1948238fc4e92232fa65e1',1,'vk_mem_alloc.h']]],
['vmadestroyvirtualblock_143',['vmaDestroyVirtualBlock',['../group__group__virtual.html#ga3795f7783ae2c182cede067d656f66a5',1,'vk_mem_alloc.h']]],
['vmadetailedstatistics_144',['VmaDetailedStatistics',['../struct_vma_detailed_statistics.html',1,'VmaDetailedStatistics'],['../group__group__stats.html#ga9ab0c535a6ca655dc63b8609ab4b8394',1,'VmaDetailedStatistics(): vk_mem_alloc.h']]],
['vmadevicememorycallbacks_145',['VmaDeviceMemoryCallbacks',['../struct_vma_device_memory_callbacks.html',1,'VmaDeviceMemoryCallbacks'],['../group__group__init.html#ga77692d3c8770ea8882d573206bd27b2b',1,'VmaDeviceMemoryCallbacks(): vk_mem_alloc.h']]],
['vmaenddefragmentation_146',['vmaEndDefragmentation',['../group__group__alloc.html#ga59f01ca3d53d50b7cca9b442b77a3e87',1,'vk_mem_alloc.h']]],
['vmaenddefragmentationpass_147',['vmaEndDefragmentationPass',['../group__group__alloc.html#gaded05a445742a00718ee766144c5c226',1,'vk_mem_alloc.h']]],
['vmafindmemorytypeindex_148',['vmaFindMemoryTypeIndex',['../group__group__alloc.html#gaef15a94b58fbcb0fe706d5720e84a74a',1,'vk_mem_alloc.h']]],
['vmafindmemorytypeindexforbufferinfo_149',['vmaFindMemoryTypeIndexForBufferInfo',['../group__group__alloc.html#gae790ab9ffaf7667fb8f62523e6897888',1,'vk_mem_alloc.h']]],
['vmafindmemorytypeindexforimageinfo_150',['vmaFindMemoryTypeIndexForImageInfo',['../group__group__alloc.html#ga088da83d8eaf3ce9056d9ea0b981d472',1,'vk_mem_alloc.h']]],
['vmaflushallocation_151',['vmaFlushAllocation',['../group__group__alloc.html#ga30c37c1eec6025f397be41644f48490f',1,'vk_mem_alloc.h']]],
['vmaflushallocations_152',['vmaFlushAllocations',['../group__group__alloc.html#gac3dd00da721875ed99fa8a881922bdfc',1,'vk_mem_alloc.h']]],
['vmafreememory_153',['vmaFreeMemory',['../group__group__alloc.html#ga5fea5518972ae9094b1526cbcb19b05f',1,'vk_mem_alloc.h']]],
['vmafreememorypages_154',['vmaFreeMemoryPages',['../group__group__alloc.html#ga834b1e4aef395c0a1d56a28e69a4a17e',1,'vk_mem_alloc.h']]],
['vmafreestatsstring_155',['vmaFreeStatsString',['../group__group__stats.html#ga3104eb30d8122c84dd8541063f145288',1,'vk_mem_alloc.h']]],
['vmafreevirtualblockstatsstring_156',['vmaFreeVirtualBlockStatsString',['../group__group__stats.html#ga47fb8d8aa69df4a7c23a9719b4080623',1,'vk_mem_alloc.h']]],
['vmagetallocationinfo_157',['vmaGetAllocationInfo',['../group__group__alloc.html#ga86dd08aba8633bfa4ad0df2e76481d8b',1,'vk_mem_alloc.h']]],
['vmagetallocationmemoryproperties_158',['vmaGetAllocationMemoryProperties',['../group__group__alloc.html#ga571e87dd38e552249b56b1b0b982fad1',1,'vk_mem_alloc.h']]],
['vmagetallocatorinfo_159',['vmaGetAllocatorInfo',['../group__group__init.html#gafa02231a791b37255720d566a52683e7',1,'vk_mem_alloc.h']]],
['vmagetheapbudgets_160',['vmaGetHeapBudgets',['../group__group__stats.html#ga9f88db9d46a432c0ad7278cecbc5eaa7',1,'vk_mem_alloc.h']]],
['vmagetmemoryproperties_161',['vmaGetMemoryProperties',['../group__group__init.html#gab88db292a17974f911182543fda52d19',1,'vk_mem_alloc.h']]],
['vmagetmemorytypeproperties_162',['vmaGetMemoryTypeProperties',['../group__group__init.html#ga8701444752eb5de4464adb5a2b514bca',1,'vk_mem_alloc.h']]],
['vmagetphysicaldeviceproperties_163',['vmaGetPhysicalDeviceProperties',['../group__group__init.html#gaecabf7b6e91ea87d0316fa0a9e014fe0',1,'vk_mem_alloc.h']]],
['vmagetpoolname_164',['vmaGetPoolName',['../group__group__alloc.html#gaf09b4e4eafdbee812e8d73ddf960f030',1,'vk_mem_alloc.h']]],
['vmagetpoolstatistics_165',['vmaGetPoolStatistics',['../group__group__stats.html#ga34d8e7d83774eed0caee5c5ae88e217d',1,'vk_mem_alloc.h']]],
['vmagetvirtualallocationinfo_166',['vmaGetVirtualAllocationInfo',['../group__group__virtual.html#ga8ee14ceb1fe033ec84d8aa29e1f75afa',1,'vk_mem_alloc.h']]],
['vmagetvirtualblockstatistics_167',['vmaGetVirtualBlockStatistics',['../group__group__virtual.html#ga2902aa3130866afcc64bb5f984113db3',1,'vk_mem_alloc.h']]],
['vmainvalidateallocation_168',['vmaInvalidateAllocation',['../group__group__alloc.html#gaaa8412919139ef413a4215ac6a290fae',1,'vk_mem_alloc.h']]],
['vmainvalidateallocations_169',['vmaInvalidateAllocations',['../group__group__alloc.html#gab25b558d75f7378ec944a1522fdcc3c5',1,'vk_mem_alloc.h']]],
['vmaisvirtualblockempty_170',['vmaIsVirtualBlockEmpty',['../group__group__virtual.html#gacd53b5b1d23f8fcbad692ccfdc1811f1',1,'vk_mem_alloc.h']]],
['vmamapmemory_171',['vmaMapMemory',['../group__group__alloc.html#gad5bd1243512d099706de88168992f069',1,'vk_mem_alloc.h']]],
['vmamemoryusage_172',['VmaMemoryUsage',['../group__group__alloc.html#gaa5846affa1e9da3800e3e78fae2305cc',1,'VmaMemoryUsage(): vk_mem_alloc.h'],['../group__group__alloc.html#ga806e8499dde802e59eb72a1dc811c35f',1,'VmaMemoryUsage(): vk_mem_alloc.h']]],
['vmapool_173',['VmaPool',['../struct_vma_pool.html',1,'']]],
['vmapoolcreateflagbits_174',['VmaPoolCreateFlagBits',['../group__group__alloc.html#ga9a7c45f9c863695d98c83fa5ac940fe7',1,'VmaPoolCreateFlagBits(): vk_mem_alloc.h'],['../group__group__alloc.html#ga4d4f2efc2509157a9e4ecd4fd7942303',1,'VmaPoolCreateFlagBits(): vk_mem_alloc.h']]],
['vmapoolcreateflags_175',['VmaPoolCreateFlags',['../group__group__alloc.html#ga2770e325ea42e087c1b91fdf46d0292a',1,'vk_mem_alloc.h']]],
['vmapoolcreateinfo_176',['VmaPoolCreateInfo',['../struct_vma_pool_create_info.html',1,'VmaPoolCreateInfo'],['../group__group__alloc.html#ga1017aa83489c0eee8d2163d2bf253f67',1,'VmaPoolCreateInfo(): vk_mem_alloc.h']]],
['vmasetallocationname_177',['vmaSetAllocationName',['../group__group__alloc.html#gabe02cbb0cd913b3f125958179f2020fc',1,'vk_mem_alloc.h']]],
['vmasetallocationuserdata_178',['vmaSetAllocationUserData',['../group__group__alloc.html#gaf9147d31ffc11d62fc187bde283ed14f',1,'vk_mem_alloc.h']]],
['vmasetcurrentframeindex_179',['vmaSetCurrentFrameIndex',['../group__group__init.html#gade56bf8dc9f5a5eaddf5f119ed525236',1,'vk_mem_alloc.h']]],
['vmasetpoolname_180',['vmaSetPoolName',['../group__group__alloc.html#gadbae3a0b4ab078024462fc85c37f3b58',1,'vk_mem_alloc.h']]],
['vmasetvirtualallocationuserdata_181',['vmaSetVirtualAllocationUserData',['../group__group__virtual.html#ga001ea1850458a4062b829e09c303fca2',1,'vk_mem_alloc.h']]],
['vmastatistics_182',['VmaStatistics',['../struct_vma_statistics.html',1,'VmaStatistics'],['../group__group__stats.html#gac94bd1a382a3922ddc8de3af4d3ddd06',1,'VmaStatistics(): vk_mem_alloc.h']]],
['vmatotalstatistics_183',['VmaTotalStatistics',['../group__group__stats.html#ga68916e729e55d513f88ffafbadddb770',1,'VmaTotalStatistics(): vk_mem_alloc.h'],['../struct_vma_total_statistics.html',1,'VmaTotalStatistics']]],
['vmaunmapmemory_184',['vmaUnmapMemory',['../group__group__alloc.html#ga9bc268595cb33f6ec4d519cfce81ff45',1,'vk_mem_alloc.h']]],
['vmavirtualallocate_185',['vmaVirtualAllocate',['../group__group__virtual.html#ga6b7cdcc1c3e5103c323fedc4e1319e01',1,'vk_mem_alloc.h']]],
['vmavirtualallocation_186',['VmaVirtualAllocation',['../struct_vma_virtual_allocation.html',1,'']]],
['vmavirtualallocationcreateflagbits_187',['VmaVirtualAllocationCreateFlagBits',['../group__group__virtual.html#ga2e9c64d405b14156fea7e10c4ad06cb6',1,'VmaVirtualAllocationCreateFlagBits(): vk_mem_alloc.h'],['../group__group__virtual.html#ga936815e64946a6b6d812d08d10184c23',1,'VmaVirtualAllocationCreateFlagBits(): vk_mem_alloc.h']]],
['vmavirtualallocationcreateflags_188',['VmaVirtualAllocationCreateFlags',['../group__group__virtual.html#gae96ffc099bf898257fb19e9410ed08a7',1,'vk_mem_alloc.h']]],
['vmavirtualallocationcreateinfo_189',['VmaVirtualAllocationCreateInfo',['../struct_vma_virtual_allocation_create_info.html',1,'VmaVirtualAllocationCreateInfo'],['../group__group__virtual.html#gac3c90d80bedc6847a41b82d0e2158c9e',1,'VmaVirtualAllocationCreateInfo(): vk_mem_alloc.h']]],
['vmavirtualallocationinfo_190',['VmaVirtualAllocationInfo',['../struct_vma_virtual_allocation_info.html',1,'VmaVirtualAllocationInfo'],['../group__group__virtual.html#ga75bc33ff7cf18c98e101f570dc2a5ebc',1,'VmaVirtualAllocationInfo(): vk_mem_alloc.h']]],
['vmavirtualblock_191',['VmaVirtualBlock',['../struct_vma_virtual_block.html',1,'']]],
['vmavirtualblockcreateflagbits_192',['VmaVirtualBlockCreateFlagBits',['../group__group__virtual.html#ga88bcf8c1cd3bb1610ff7343811c65bca',1,'VmaVirtualBlockCreateFlagBits(): vk_mem_alloc.h'],['../group__group__virtual.html#ga0860ba1c0a67178fae4aecb63a78573e',1,'VmaVirtualBlockCreateFlagBits(): vk_mem_alloc.h']]],
['vmavirtualblockcreateflags_193',['VmaVirtualBlockCreateFlags',['../group__group__virtual.html#ga4e49c2f0ab7f6b4868833e5bac78d91e',1,'vk_mem_alloc.h']]],
['vmavirtualblockcreateinfo_194',['VmaVirtualBlockCreateInfo',['../group__group__virtual.html#ga4753d42d40217a3a652a3cdf253ad773',1,'VmaVirtualBlockCreateInfo(): vk_mem_alloc.h'],['../struct_vma_virtual_block_create_info.html',1,'VmaVirtualBlockCreateInfo']]],
['vmavirtualfree_195',['vmaVirtualFree',['../group__group__virtual.html#ga09fc688c0c3653ff23723b037e5d5033',1,'vk_mem_alloc.h']]],
['vmavulkanfunctions_196',['VmaVulkanFunctions',['../group__group__init.html#gabb0a8e3b5040d847571cca6c7f9a8074',1,'VmaVulkanFunctions(): vk_mem_alloc.h'],['../struct_vma_vulkan_functions.html',1,'VmaVulkanFunctions']]],
['vulkan_20memory_20allocator_197',['Vulkan Memory Allocator',['../index.html',1,'']]],
['vulkanapiversion_198',['vulkanApiVersion',['../struct_vma_allocator_create_info.html#ae0ffc55139b54520a6bb704b29ffc285',1,'VmaAllocatorCreateInfo']]]
];
|
const createClient = require('../client')
const wrap = require('../../libs/wrap')
module.exports = async (s, q) => {
let c = await q.push(() => createClient(s, 'patient'))
return {
describe: () => c.describe(),
createPatient: d => wrap(q, () => c.createPatientAsync(d)),
getPatient: d => wrap(q, () => c.getPatientAsync(d)),
getPatientReg: d => wrap(q, () => c.getPatientRegAsync(d)),
getPatientRegs: d => wrap(q, () => c.getPatientRegsAsync(d)),
searchPatient: d => wrap(q, () => c.searchPatientAsync(d))
}
}
|
// All symbols in the Braille Patterns block as per Unicode v6.3.0:
[
'\u2800',
'\u2801',
'\u2802',
'\u2803',
'\u2804',
'\u2805',
'\u2806',
'\u2807',
'\u2808',
'\u2809',
'\u280A',
'\u280B',
'\u280C',
'\u280D',
'\u280E',
'\u280F',
'\u2810',
'\u2811',
'\u2812',
'\u2813',
'\u2814',
'\u2815',
'\u2816',
'\u2817',
'\u2818',
'\u2819',
'\u281A',
'\u281B',
'\u281C',
'\u281D',
'\u281E',
'\u281F',
'\u2820',
'\u2821',
'\u2822',
'\u2823',
'\u2824',
'\u2825',
'\u2826',
'\u2827',
'\u2828',
'\u2829',
'\u282A',
'\u282B',
'\u282C',
'\u282D',
'\u282E',
'\u282F',
'\u2830',
'\u2831',
'\u2832',
'\u2833',
'\u2834',
'\u2835',
'\u2836',
'\u2837',
'\u2838',
'\u2839',
'\u283A',
'\u283B',
'\u283C',
'\u283D',
'\u283E',
'\u283F',
'\u2840',
'\u2841',
'\u2842',
'\u2843',
'\u2844',
'\u2845',
'\u2846',
'\u2847',
'\u2848',
'\u2849',
'\u284A',
'\u284B',
'\u284C',
'\u284D',
'\u284E',
'\u284F',
'\u2850',
'\u2851',
'\u2852',
'\u2853',
'\u2854',
'\u2855',
'\u2856',
'\u2857',
'\u2858',
'\u2859',
'\u285A',
'\u285B',
'\u285C',
'\u285D',
'\u285E',
'\u285F',
'\u2860',
'\u2861',
'\u2862',
'\u2863',
'\u2864',
'\u2865',
'\u2866',
'\u2867',
'\u2868',
'\u2869',
'\u286A',
'\u286B',
'\u286C',
'\u286D',
'\u286E',
'\u286F',
'\u2870',
'\u2871',
'\u2872',
'\u2873',
'\u2874',
'\u2875',
'\u2876',
'\u2877',
'\u2878',
'\u2879',
'\u287A',
'\u287B',
'\u287C',
'\u287D',
'\u287E',
'\u287F',
'\u2880',
'\u2881',
'\u2882',
'\u2883',
'\u2884',
'\u2885',
'\u2886',
'\u2887',
'\u2888',
'\u2889',
'\u288A',
'\u288B',
'\u288C',
'\u288D',
'\u288E',
'\u288F',
'\u2890',
'\u2891',
'\u2892',
'\u2893',
'\u2894',
'\u2895',
'\u2896',
'\u2897',
'\u2898',
'\u2899',
'\u289A',
'\u289B',
'\u289C',
'\u289D',
'\u289E',
'\u289F',
'\u28A0',
'\u28A1',
'\u28A2',
'\u28A3',
'\u28A4',
'\u28A5',
'\u28A6',
'\u28A7',
'\u28A8',
'\u28A9',
'\u28AA',
'\u28AB',
'\u28AC',
'\u28AD',
'\u28AE',
'\u28AF',
'\u28B0',
'\u28B1',
'\u28B2',
'\u28B3',
'\u28B4',
'\u28B5',
'\u28B6',
'\u28B7',
'\u28B8',
'\u28B9',
'\u28BA',
'\u28BB',
'\u28BC',
'\u28BD',
'\u28BE',
'\u28BF',
'\u28C0',
'\u28C1',
'\u28C2',
'\u28C3',
'\u28C4',
'\u28C5',
'\u28C6',
'\u28C7',
'\u28C8',
'\u28C9',
'\u28CA',
'\u28CB',
'\u28CC',
'\u28CD',
'\u28CE',
'\u28CF',
'\u28D0',
'\u28D1',
'\u28D2',
'\u28D3',
'\u28D4',
'\u28D5',
'\u28D6',
'\u28D7',
'\u28D8',
'\u28D9',
'\u28DA',
'\u28DB',
'\u28DC',
'\u28DD',
'\u28DE',
'\u28DF',
'\u28E0',
'\u28E1',
'\u28E2',
'\u28E3',
'\u28E4',
'\u28E5',
'\u28E6',
'\u28E7',
'\u28E8',
'\u28E9',
'\u28EA',
'\u28EB',
'\u28EC',
'\u28ED',
'\u28EE',
'\u28EF',
'\u28F0',
'\u28F1',
'\u28F2',
'\u28F3',
'\u28F4',
'\u28F5',
'\u28F6',
'\u28F7',
'\u28F8',
'\u28F9',
'\u28FA',
'\u28FB',
'\u28FC',
'\u28FD',
'\u28FE',
'\u28FF'
]; |
lychee.define('game.Renderer').includes([
'lychee.ui.Renderer'
]).exports(function(lychee, global) {
var Class = function(id) {
lychee.ui.Renderer.call(this, id);
};
Class.prototype = {
};
return Class;
});
|
var chai = require('chai');
var Strategy = require('../lib/strategy');
var CryptoJS = require('crypto-js');
describe('Strategy', function() {
var keys = { publicKey: 'public-key', privateKey: 'private-key' };
var strategy = new Strategy(function(publicKey, done) {
if (publicKey === keys.publicKey) {
return done(null, {id: '1234', name: 'Test'}, keys.privateKey, { scope: 'read'});
}
return done(null, false);
});
describe('handling a request with valid credentials', function() {
var user;
var info;
describe('with json content', function() {
before(function(done) {
chai.passport.use(strategy)
.success(function(u, i) {
user = u;
info = i;
done();
})
.req(function(req) {
req.body = {name: 'Test', body: 'Include UTF8 data: 🐶🐮'};
req.headers['content-type'] = 'application/json';
req.headers.date = new Date().toUTCString();
var encString = CryptoJS.enc.Base64.stringify(
CryptoJS.HmacSHA1(
unescape(encodeURIComponent(
req.method + '\n' +
CryptoJS.MD5(JSON.stringify(req.body)) + '\n' +
req.headers['content-type'] + '\n' +
req.headers.date
)),
keys.privateKey
));
req.headers.authorization = 'Hmac ' + keys.publicKey + ':' + encString;
})
.authenticate();
});
it('should supply user', function() {
expect(user).to.be.an.object;
expect(user.id).to.equal('1234');
});
it('should supply info', function() {
expect(info).to.be.an.object;
expect(info.scope).to.equal('read');
});
});
describe('without json content', function() {
before(function(done) {
chai.passport.use(strategy)
.success(function(u, i) {
user = u;
info = i;
done();
})
.req(function(req) {
req.headers.date = new Date().toUTCString();
var encString = CryptoJS.enc.Base64.stringify(
CryptoJS.HmacSHA1(
unescape(encodeURIComponent(
req.method + '\n' +
'' + '\n' +
'' + '\n' +
req.headers.date
)),
keys.privateKey
));
req.headers.authorization = 'Hmac ' + keys.publicKey + ':' + encString;
})
.authenticate();
});
it('should supply user', function() {
expect(user).to.be.an.object;
expect(user.id).to.equal('1234');
});
it('should supply info', function() {
expect(info).to.be.an.object;
expect(info.scope).to.equal('read');
});
});
});
describe('handling a request with malformed authorization header', function() {
var info;
before(function(done) {
chai.passport.use(strategy)
.fail(function(i) {
info = i;
done();
})
.req(function(req) {
req.headers.authorization = 'Hmac bad_public_key';
})
.authenticate();
});
it('should fail with bad authorization message', function() {
expect(info).to.be.a.string;
expect(info.message).to.equal('Bad authorization header');
});
});
describe('handling a request with bad public key in authorization header', function() {
before(function(done) {
chai.passport.use(strategy)
.fail(function(i) {
info = i;
done();
})
.req(function(req) {
req.headers.authorization = 'Hmac bad_public_key:dGhpcyBpcyBhIHRlc3Q=';
})
.authenticate();
});
it('should fail with bad credentials message', function() {
expect(info).to.be.a.string;
expect(info.message).to.equal('Bad credentials');
});
});
describe('handling a request with bad signature', function() {
var info;
before(function(done) {
chai.passport.use(strategy)
.fail(function(i) {
info = i;
done();
})
.req(function(req) {
req.headers.date = new Date().toUTCString();
req.headers.authorization = 'Hmac ' + keys.publicKey + ':dGhpcyBpcyBhIHRlc3Q=';
})
.authenticate();
});
it('should fail with bad signature message in authorization header', function() {
expect(info).to.be.a.string;
expect(info.message).to.equal('Bad signature');
});
});
describe('handling a request with a missing authorization header', function() {
it('should fail with a missing authorization header message', function(done) {
chai.passport.use(strategy)
.fail(function(i) {
info = i;
done();
})
.req(function(req) {
req.headers.date = new Date().toUTCString();
})
.authenticate();
});
});
});
|
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
import './index.css';
import store from './store';
import { Provider } from 'react-redux'
ReactDOM.render(
<Provider store={store}>
<App />
</Provider>,
document.getElementById('root')
);
|
/**
* jQuery UI EmbeddedComponent Widget (used by S3EmbeddedComponentWidget)
*
* @copyright 2015-2016 (c) Sahana Software Foundation
* @license MIT
*/
(function($, undefined) {
"use strict";
var embeddedComponentID = 0;
/**
* Embedded Component Widget
*/
$.widget('s3.embeddedComponent', {
/**
* Default options
*
* @prop {string} ajaxURL - the URL to retrieve the component data from
* @prop {string} fieldname - the name of the real input field in the outer form
* @prop {string} component - the tablename of the component
* @prop {number} recordID - the currently selected record ID
* @prop {boolean} autocomplete - whether or not the widget is using
* an autocomplete-selector
* @prop {script} postprocess - script to execute after selection/deselection
*/
options: {
ajaxURL: null,
fieldname: null,
component: null,
recordID: null,
autocomplete: false
},
/**
* Create the widget
*/
_create: function() {
this.id = embeddedComponentID;
embeddedComponentID += 1;
// Namespace for events
this.namespace = '.embeddedComponent';
this.namespaceID = this.namespace + this.id;
},
/**
* Update the widget options
*/
_init: function() {
var fieldname = this.options.fieldname;
// Element references
this.input = $(this.element);
this.fieldname = fieldname;
this.selectBtn = $('#' + fieldname + '-select');
this.editBtn = $('#' + fieldname + '-edit');
this.clearBtn = $('#' + fieldname + '-clear');
this.loadThrobber = this.selectBtn.siblings('.throbber');
this.selectRow = $('#' + fieldname + '-select-row');
this.dummyInput = $('#dummy_' + fieldname);
this.autocompleteRow = $('#' + fieldname + '-autocomplete-row');
this.autocompleteLabel = $('#' + fieldname + '-autocomplete-label');
this.refresh();
},
/**
* Remove generated elements & reset other changes
*/
_destroy: function() {
$.Widget.prototype.destroy.call(this);
},
/**
* Redraw contents
*/
refresh: function() {
this._unbindEvents();
this.dummyInput.hide();
var recordID = this.options.recordID;
if (recordID != 'None') {
this.input.val(recordID);
this.select(recordID);
}
if (this.input.val() > 0) {
this.clearBtn.removeClass('hide').show();
this.editBtn.removeClass('hide').show();
this._disableEmbedded();
}
this._bindEvents();
},
/**
* Select a record from the registry
*
* @param {number} componentID - the record ID (optional, defaults to real input)
*/
select: function(componentID) {
if (typeof componentID == 'undefined') {
componentID = this.input.val();
} else {
this.input.val(componentID);
}
this.selectBtn.hide();
this.clearBtn.hide();
this.loadThrobber.removeClass('hide').show();
this._clear();
var componentName = this.options.component,
url = this.options.ajaxURL + componentID + '.s3json?show_ids=true',
self = this;
$.getJSONS3(url, function (data) {
try {
var record = data['$_' + componentName][0];
self._disableEmbedded();
self.input.val(record['@id']);
var re = new RegExp("^[\$|\@].*"),
fk = new RegExp("^[\$]k_.*");
var field, fieldID;
for (field in record) {
if (field.match(re)) {
if (field.match(fk)) {
fieldID = '#' + componentName + "_" + field.slice(3);
} else {
continue;
}
} else {
fieldID = '#' + componentName + "_" + field;
}
try {
var value = record[field];
if (value.hasOwnProperty('@id')) {
$(fieldID).val(eval(value['@id']));
} else
if (value.hasOwnProperty('@value')) {
var val;
try {
val = JSON.parse(value['@value']);
}
catch(e) {
val = value['@value'];
}
$(fieldID).val(val);
}
else {
$(fieldID).val(value);
}
}
catch(e) {
// skip
}
}
}
catch(e) {
self.input.val('');
}
self.loadThrobber.hide();
self.selectBtn.removeClass('hide').show();
self.editBtn.removeClass('hide').show();
self.clearBtn.removeClass('hide').show();
var postprocess = self.options.postprocess;
if (postprocess) {
eval(postprocess);
}
});
self.autocompleteRow.hide();
self.selectRow.removeClass('hide').show();
},
/**
* Remove previously selected values
*/
_clear: function() {
var input = $(this.input);
var form = input.closest('form');
form.find('.embedded-' + this.fieldname).each(function() {
$(this).find('input, select, textarea').prop('disabled', false)
.val('');
});
input.val('');
this.clearBtn.hide();
this.editBtn.hide();
var postprocess = this.options.postprocess;
if (postprocess) {
eval(postprocess);
}
},
/**
* Enable the embedded fields, hide the Edit-button
*/
_edit: function() {
this._enableEmbedded();
this.editBtn.hide();
},
/**
* Enable the embedded fields
*/
_enableEmbedded: function() {
var form = $(this.element).closest('form');
form.find('.embedded-' + this.fieldname).each(function() {
$(this).find('input, select, textarea').prop('disabled', false);
});
},
/**
* Disable the embedded fields
*/
_disableEmbedded: function() {
var form = $(this.element).closest('form');
form.find('.embedded-' + this.fieldname).each(function() {
$(this).find('input, select, textarea').prop('disabled', true);
});
},
/**
* Tasks before form submission
*/
_onFormSubmission: function() {
S3ClearNavigateAwayConfirm();
this._enableEmbedded();
},
/**
* Bind event handlers (after refresh)
*/
_bindEvents: function() {
var self = this,
ns = this.namespace;
this.input.closest('form').bind('submit' + this.namespaceID, function () {
self._onFormSubmission();
return true;
});
this.selectBtn.bind('click' + ns, function() {
// Activate search
self.selectRow.hide();
self.autocompleteRow.removeClass('hide').show();
self.autocompleteLabel.removeClass('hide').show();
self.dummyInput.removeClass('hide').show().focus();
});
this.editBtn.bind('click' + ns, function() {
self._edit();
});
this.clearBtn.bind('click' + ns, function() {
self._clear();
});
this.dummyInput.bind('focusout' + ns, function() {
// Reset form when clicking outside of dummy input
var componentID = self.input.val();
$(this).hide();
self.autocompleteLabel.hide();
self.selectRow.removeClass('hide').show();
if (self.input.val() > 0) {
self.clearBtn.removeClass('hide').show();
}
});
if (!this.options.autocomplete) {
this.dummyInput.bind('change' + ns, function() {
var value = $(this).val();
if (value) {
self.input.val(value).change();
}
})
}
this.input.bind('change' + ns, function() {
var value = $(this).val();
if (value) {
self.select(value);
}
});
return true;
},
/**
* Unbind events (before refresh)
*/
_unbindEvents: function() {
var ns = this.namespace;
this.input.closest('form').unbind(this.namespaceID);
this.selectBtn.unbind(ns);
this.editBtn.unbind(ns);
this.clearBtn.unbind(ns);
this.dummyInput.unbind(ns);
return true;
}
});
})(jQuery);
// END ========================================================================
|
require('./football.js') |
function other () {
console.log('hello');
}
/* this is the comment to find */
/* and this */
/**
* And this jsdoc
* @name withcomment
* @function
*/
function withcomment () {
console.log('hi');
}
|
var photomgrServices = angular.module('photomgrServices', ['ngResource']);
photomgrServices.factory('Photo', ['$resource',
function($resource){
return $resource('/photos/:id/', { id: '@_id'}, {
query: {method:'GET', isArray: true},
uploadPhoto: {
method: 'POST',
url: '/upload',
headers: {'Content-Type': undefined },
transformRequest: angular.identity
}
});
}]);
photomgrServices.factory('Album', ['$resource',
function($resource){
return $resource('/albums/:id/', {id: '@_id'}, {
query: {method:'GET', isArray:true},
getPhotos: {
method:'GET', isArray: true, url:'/gallery/:id/'
},
editAlbumPhotos: {
method: 'POST', params: {photoId: '@photoId', action: '@action'}, isArray:false, url:'/albums/:id/:action/:photoId/'
}
});
}]);
photomgrServices.factory('Auth', ['$http', '$cookies',
function($http, $cookies){
var auth = {};
auth.user = {}
auth.isLoggedIn = false;
auth.logIn = function(userData) {
if (userData) {
return $http.post("/login", userData);
}
};
auth.logOut = function() {
return $http.get("/logout");
};
auth.loggedIn = function() {
return $http.get("/isloggedin");
};
auth.register = function() {
};
auth.loggedIn().then(function(data,status,header){
auth.user = data.data;
auth.isLoggedIn = true;
});
return auth;
}]);
photomgrServices.factory('PhotoMgrService', ['Album', 'Photo',
function(Album, Photo) {
var pmSvc = {};
pmSvc.editAlbumPhotos = function (action, photo, album) {
return Album.editAlbumPhotos({action: action, _id: album._id, photoId: photo._id}, function(data){
return data;
})
}
pmSvc.getAlbum = function (id) {
return Album.get({id: id}, function(data) {
return data;
});
}
pmSvc.getPhoto = function(id) {
return Photo.get({id: id}, function(data) {
return data;
});
}
pmSvc.getAllPhotos = function() {
return Photo.query({}, function(data) {
return data;
});
}
pmSvc.getAllAlbums = function() {
return Album.query({}, function(data) {
return data;
});
}
pmSvc.saveAlbum = function(album) {
return Album.save({}, album, function(data) {
return data;
});
}
pmSvc.savePhoto = function (photo) {
return Photo.save({}, photo, function(data) {
return data;
});
}
pmSvc.deleteAlbum = function (album) {
return Album.delete({}, album, function(data) {
return data;
});
}
pmSvc.deletePhoto = function (photo) {
return Photo.delete({}, photo, function(data) {
return data;
});
}
pmSvc.toggleEnabled = function(id) {
return Album.get({id: id}, function(album) {
album.enabled = (!album.enabled)
album.$save();
});
}
pmSvc.getAlbumPhotos = function(id) {
return Album.getPhotos({id: id}, function(data) {
return data;
});
}
pmSvc.newAlbum = function () {
return new Album();
}
pmSvc.newPhoto = function () {
return new Photo();
}
pmSvc.uploadFile = function (formData) {
return Photo.uploadPhoto({}, formData).$promise;
}
return pmSvc;
}]); |
(function() {
'use strict';
var socket = io(),
request = window.superagent;
Vue.config.delimiters = ['${', '}'];
Vue.component('exp-table-metricrow', {
template: '<table class="table">\
<tr v-for="m in measurements._keys">\
<td>${m}</td>\
<template v-if="measurements[m].length == 1">\
<td title="${ measurements[m][0] }">\
${ measurements[m][0] | truncate "6" }</td>\
<td>—</td><td>—</td><td>—</td>\
</template>\
<template v-else>\
<td>—</td>\
<td title="${measurements[m] | avg }">\
${ measurements[m] | avg | truncate "6" }</td>\
<td title="${measurements[m] | min }">\
${ measurements[m] | min | truncate "6" }</td>\
<td title="${ measurements[m] | max }">\
${ measurements[m] | max | truncate "6" }</td>\
</template>\
</tr></table>',
props: ['measurements']
});
var emptyExp = {};
var expId = document.body.getAttribute('data-experiment-id');
emptyExp.name = 'Loading';
emptyExp.date = 'Loading';
emptyExp.models = [];
emptyExp.description = 'Loading';
Vue.filter('avg', function(arr) {
var acc = 0;
if (arr === undefined || !arr) {
return 0;
}
console.log('avg called:', arr);
for (var i = 0; i < arr.length; i++) {
acc += arr[i];
}
return (acc / arr.length);
});
Vue.filter('max', function(arr) {
var max = null;
if (arr === undefined || !arr) {
return 0;
}
for (var i = 0; i < arr.length; i++) {
if (max === null) {
max = arr[i];
} else if (max < arr[i]) {
max = arr[i];
}
}
return max || 0;
});
Vue.filter('min', function(arr) {
var min = null;
if (arr === undefined || !arr) {
return 0;
}
for (var i = 0; i < arr.length; i++) {
if (min === null) {
min = arr[i];
} else if (min > arr[i]) {
min = arr[i];
}
}
return min || 0;
});
Vue.filter('truncate', function(str, value) {
var s = new String(str);
if (s.length <= value) {
return s;
}
return (new String(s)).substring(0, value) + '…';
});
function _deleteModel(model_id) {
request
.del('/api/v1/experiment/' + expId + '/model/' + model_id)
.end(function(res) {
// TODO: do something
console.log(res);
});
}
function _sortByKey(model) {
var kv = {};
kv._keys = [];
if (model.measurements === undefined) {
model.measurements = [];
}
for (var i = 0; i < model.measurements.length; i++) {
var m = model.measurements[i];
kv = _updateMeasurements(kv, m);
}
return kv;
}
function _updateMeasurements(kv, data) {
if (kv === undefined || kv._keys === undefined) {
return _sortByKey(data);
}
if (kv._keys.indexOf(data.name) === -1) {
kv._keys.push(data.name);
kv[data.name] = [data.value];
} else {
kv[data.name].push(data.value);
}
return kv;
}
var vm = new Vue({
el: '#vue-instance',
data: {
experiment: {'models':[]},
columns: ['name', 'description', 'metric', 'value', 'avg', 'min', 'max']
},
methods: {
deleteModel: _deleteModel,
sortBy: function (key) {
this.sortKey = key
this.sortOrders[key] = this.sortOrders[key] * -1
},
modelKeys: function(model) {
return model.sortedMeasurements._keys;
}
},
created: function() {
this.experiment = emptyExp;
socket.emit('fetch-experiment', expId);
socket.on('fetch-experiment-result', function(data) {
Vue.set(this, 'experiment', data)
for (var i = 0; i < this.experiment.models.length; i++) {
Vue.set(this.experiment.models[i],
'sortedMeasurements',
_sortByKey(this.experiment.models[i]));
Vue.set(this.experiment.models[i], 'metrics',
this.experiment.models[i].sortedMeasurements._keys);
}
}.bind(this));
socket.on('experiment-udpate', function(data) {
if (data._id == expId) {
for (var i = 0; i < thix.experiment.models.length; i++) {
var sortedMeasurements = _sortByKey(this.experiment.models[i]);
Vue.set(this.experiment.models[i],
'sortedMeasurements',
sortedMeasurements);
Vue.set(this.experiment.models[i], 'metrics',
sortedMeasurements._keys);
}
}
});
socket.on('model-added', function(data) {
if (data.experiment_id == expId) {
this.experiment.models.push(data.data);
}
}.bind(this));
socket.on('model-updated', function(data) {
console.log('model-updated')
if (data.experiment_id == expId) {
for (var i = 0; i < this.experiment.models.length; i++) {
if (this.experiment.models[i]._id == data._id) {
for (var key in data.data) {
if (data.data.hasOwnProperty(key)) {
Vue.set(this.experiment.models[i],
key,
data.data[key]);
}
}
var sortedMeasurements = _sortByKey(this.experiment.models[i]);
Vue.set(this.experiment.models[i],
'sortedMeasurements',
sortedMeasurements);
Vue.set(this.experiment.models[i], 'metrics',
sortedMeasurements._keys);
return;
}
}
}
}.bind(this));
socket.on('model-removed', function(data) {
if (data.experiment_id == expId) {
for (var i = 0; i < this.experiment.models.length; i++) {
if (this.experiment.models[i]._id == data._id) {
this.experiment.models.$remove(this.experiment.models[i]);
}
}
}
}.bind(this));
socket.on('measurement-added', function(data) {
if (data.experiment_id == expId) {
for (var i = 0; i < this.experiment.models.length; i++) {
if (this.experiment.models[i]._id == data.model_id) {
Vue.set(this.experiment.models[i],
'sortedMeasurements',
_updateMeasurements(this.experiment.models[i].sortedMeasurements,
data.data));
}
}
}
}.bind(this));
}
});
})();
|
(function () {
'use strict';
var wiredep = require('wiredep');
var gulp = require('gulp');
var $ = require('gulp-load-plugins')({
pattern: ['gulp-*']
});
var testFiles;
gulp.task('preparetesthtml', function () {
return gulp.src('test/unit/**/*.html')
.pipe($.ngHtml2js({
moduleName: 'test-partials',
prefix: '/',
}))
.pipe($.rename(function(path){
path.extname = '.tpl.js';
return path;
}))
.pipe(gulp.dest('test/unit'))
.pipe($.size());
});
gulp.task('preparetestfiles', ['preparetesthtml'], function () {
var bowerDeps = wiredep({
directory: 'bower_components',
dependencies: true,
devDependencies: true
});
testFiles = bowerDeps.js.concat([
'src/**/*.js',
'test/unit/*.js',
]);
});
gulp.task('test', ['preparetestfiles'], function() {
return gulp.src(testFiles)
.pipe($.karma({
configFile: 'karma.conf.js',
action: 'run'
}))
.on('error', function(err) {
// Make sure failed tests cause gulp to exit non-zero
throw err;
});
});
gulp.task('jshint', function () {
return gulp.src(['.tmp/**/*.js'])
.pipe($.jshint())
.pipe($.jshint.reporter('jshint-stylish'))
.pipe($.jshint.reporter('fail'));
});
gulp.task('compress', function() {
return gulp.src(['src/**/*.js'])
.pipe($.uglify())
.pipe($.concat('toggles.min.js'))
.pipe(gulp.dest('./'));
});
gulp.task('concat', function() {
return gulp.src(['src/**/*.js'])
.pipe($.concat('toggles.js'))
.pipe(gulp.dest('./'));
});
gulp.task('default', ['build']);
gulp.task('build', ['test', 'jshint', 'compress', 'concat']);
})();
|
var app = require('express')();
var http = require('http').Server(app);
var io = require('socket.io')(http);
var port = process.env.PORT || 8080;
var NanoTimer = require('nanotimer');
// When a user visits the website
app.get('/', function(req, res){
res.send('moppy megserver');
});
// This is called when a client connects
io.on('connection', function(socket){
console.log('connected client');
client = socket;
startTimer();
// Make the session timeout after 10s automatically
const sessionTimeout = 60;
setTimeout(function(){
timer.clearInterval();
endSession();
}, sessionTimeout*1000);
});
// Log the session statistics when the user disconnects
io.on('disconnect', function(socket){
console.log('user disconnected!')
endSession();
});
http.listen(port, function(){
console.log('begin listening for connections');
});
// Define variables
var client; // The iPhone app
var timer = new NanoTimer(); // Used to time sending new samples
var numberChannels = 10; // The number of channels to simulate
var startTime = Date.now(); // Used to get time t for sine waves
var frequency = 30; // The frequency to send samples at
var samplesSent = 0; // The number of samples sent so far
// Generate Random Data at regular intervals
function startTimer() {
// Mark the time when the signals begin
startTime = Date.now();
samplesSent = 0;
timer.setInterval(function(){
// Time t for calculating this set of samples
const t = (Date.now() - startTime)/1000;
// An array of measurements
// Sine waves for now
var measurements = Array(numberChannels);
for(var i = 0; i < numberChannels; i++) {
measurements[i] = Math.sin(2*Math.PI*5*t - i*(Math.PI/numberChannels)) + 0.25*Math.sin(2*Math.PI*3*t)
+ Math.random()*0.1;
}
// Create a JavaScript object of data
var data = {
"data":measurements
};
// Convert to a UTF8 JSON string
var stringy = JSON.stringify(data);
// Send the measurenemts out to all of the clients
io.emit('data', stringy);
samplesSent += 1;
// How often the timer fires is set to the sampling interval in ms
}, '', 1000/frequency + 'm');
}
// Log the session statistics and disconnect the client
function endSession() {
console.log('Session Statistics')
const t = (Date.now() - startTime)/1000;
console.log('time: ' + t + 's');
console.log('samples: ' + samplesSent);
console.log('freq: ' + samplesSent/t + '\n');
client.disconnect();
}
|
import fetch from 'isomorphic-fetch'
export const TOPIC_CHANGE_STATUS = 'TOPIC_CHANGE_STATUS' // list details
export const TOPIC_CHANGE_PAGE = 'TOPIC_CHANGE_PAGE'
export const REQUEST_TOPIC_START = 'REQUEST_TOPIC_START'
export const REQUEST_TOPIC_SUCCESS = 'REQUEST_TOPIC_SUCCESS'
export const REQUEST_TOPIC_ERROR = 'REQUEST_TOPIC_ERROR'
export const REQUEST_TOPICS_START = 'REQUEST_TOPICS_START'
export const REQUEST_TOPICS_SUCCESS = 'REQUEST_TOPICS_SUCCESS'
export const REQUEST_TOPICS_ERROR = 'REQUEST_TOPICS_ERROR'
export const changeStatus = status => ({
type: TOPIC_CHANGE_STATUS,
status
})
export const changePage = (status, page) => ({
type: TOPIC_CHANGE_PAGE,
status,
page
})
export const requestTopicsStart = status => ({
type: REQUEST_TOPICS_START,
status
})
export const requestTopicsSuccess = (status, data) => ({
type: REQUEST_TOPICS_SUCCESS,
status
})
export const requestTopicsError = (status, error) => ({
type: REQUEST_TOPICS_ERROR,
status,
error
})
export const requestTopicStart = status => ({
type: REQUEST_TOPIC_START,
status
})
export const requestTopicSuccess = (status, data) => ({
type: REQUEST_TOPIC_SUCCESS,
status
})
export const requestTopicError = (status, error) => ({
type: REQUEST_TOPIC_ERROR,
status,
error
})
const fetchTopics = status => dispatch => {
dispatch(requestTopicsStart(status))
return fetch(`/a/topic/1`)
.then(response => response.json())
.then(json => dispatch(requestTopicsSuccess(status, json)))
.catch(e => dispatch(requestTopicsError(status, e)))
}
const shouldFetchTopics = (state, status) => {
const posts = state.topicsByPage[status]
if (!posts) {
return true
}
if (posts.isFetching) {
return false
}
return posts.didInvalidate
}
export const fetchTopicsIfNeeded = status => (dispatch, getState) => {
if (shouldFetchTopics(getState(), status)) {
return dispatch(fetchTopics(status))
}
}
|
import React, { Component } from 'react'
import { render } from 'react-dom'
import Nav from './nav'
import Footer from './footer'
class App extends Component {
render() {
return (
<div>
<Nav />
{this.props.children}
<Footer />
</div>
)
}
}
export default App |
export default from './Tiwae';
|
(function() {
'use strict';
angular
.module('falconcmsApp')
.config(stateConfig);
stateConfig.$inject = ['$stateProvider'];
function stateConfig($stateProvider) {
$stateProvider.state('social-register', {
parent: 'account',
url: '/social-register/:provider?{success:boolean}',
data: {
authorities: [],
pageTitle: 'social.register.title'
},
views: {
'content@': {
templateUrl: 'app/account/social/social-register.html',
controller: 'SocialRegisterController',
controllerAs: 'vm'
}
},
resolve: {
translatePartialLoader: ['$translate', '$translatePartialLoader', function ($translate, $translatePartialLoader) {
$translatePartialLoader.addPart('social');
return $translate.refresh();
}]
}
});
}
})();
|
import { combineReducers } from 'redux'
import config from './config'
import account from './account'
import designs from './designs'
import preview from './preview'
export default combineReducers({
config,
account,
designs,
preview
})
|
var Emitter = require('events'); // Node event emitter
var eventConfig = require('./config').events;
var emitter = new Emitter();
emitter.on(eventConfig.GREET, function () {
console.log('Somewhere, someone said hello');
});
emitter.on(eventConfig.GREET, function () {
console.log('A greeting occurred');
});
console.log('Hello');
emitter.emit(eventConfig.GREET);
|
var banner = '/** <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today() %>\n' +
' * (c) 2013 Christoph Körner, office@chaosmail.at, http://chaosmail.at\n' +
' * License: MIT\n' +
' */\n';
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
clean: {
dist: {
src: ["dist/", "demo/js"]
}
},
concat: {
options: {
stripBanners: true,
banner: banner
},
js: {
src: ['src/<%= pkg.name %>.js'],
dest: 'dist/<%= pkg.name %>.js'
}
},
uglify: {
options: {
banner: banner
},
dist: {
files: {
'dist/<%= pkg.name %>.min.js': ['dist/*.js']
}
}
},
copy: {
demo: {
files: {
'demo/js/<%= pkg.name %>.js': 'dist/<%= pkg.name %>.js',
'demo/js/<%= pkg.name %>.min.js': 'dist/<%= pkg.name %>.min.js'
}
},
libs: {
files: {
'demo/lib/d3.js': 'components/d3/d3.js',
'demo/lib/d3.min.js': 'components/d3/d3.min.js'
}
},
def: {
files: {
'dist/<%= pkg.name %>.d.ts': 'src/<%= pkg.name %>.d.ts'
}
}
},
shell: {
deploy: {
options: {
stdout: true
},
command: 'sh publish_demo'
}
},
watch: {
scripts: {
files: ['src/*.js'],
tasks: ['default']
}
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-shell');
// Default task(s).
grunt.registerTask('default', ['clean:dist', 'concat', 'uglify', 'copy']);
grunt.registerTask('deploy', ['shell:deploy']);
}; |
/*
* Basic function call performance.
*/
function test() {
var i;
function f() { return; }
for (i = 0; i < 1e7; i++) {
f();
f();
f();
f();
f();
f();
f();
f();
f();
f();
}
}
try {
test();
} catch (e) {
print(e.stack || e);
throw e;
}
|
'use strict';
angular.module('users')
.controller('PasswordController',
['$scope', '$stateParams', '$http', '$location', 'Authentication',
function($scope, $stateParams, $http, $location, Authentication) {
$scope.authentication = Authentication;
//If user is signed in then redirect back home
if ($scope.authentication.user){
$location.path('/');
}
// Submit forgotten password account id
$scope.askForPasswordReset = function() {
$scope.success = $scope.error = null;
$http.post('/auth/forgot', $scope.credentials)
.success(function(response) {
// Show user success message and clear form
$scope.credentials = null;
$scope.success = response.message;
})
.error(function(response) {
// Show user error message and clear form
$scope.credentials = null;
$scope.error = response.message;
});
};
// Change user password
$scope.resetUserPassword = function() {
$scope.success = $scope.error = null;
$http.post('/auth/reset/' + $stateParams.token, $scope.passwordDetails)
.success(function(response) {
// If successful show success message and clear form
$scope.passwordDetails = null;
// Attach user profile
Authentication.user = response;
// And redirect to the index page
$location.path('/password/reset/success');
})
.error(function(response) {
$scope.error = response.message;
});
};
}
]);
|
module.exports = function redirectVhost (opts) {
return `server {
listen 80;
listen 443 ssl http2;
server_name ${opts.redirect};
return 301 ${opts.domain}$request_uri;
}`
}
|
"use strict";
jest.dontMock('lodash');
jest.dontMock('../game.js');
jest.dontMock('../util/request.js');
var _ = require('lodash');
var requestUtil = require('../util/request');
var MOCKS = {
game: {
gameId: "mockedID",
settings: {
captureTime: 5,
afterCaptureDelay: 10,
gameTime: 10,
victoryPoints: 10000,
pointsPerTick: 10,
tickPeriod: 10,
maxPlayers: 2
},
beacons: [],
players: [],
host: "MYHOST",
state: "lobby",
sys: {}
},
player: {
userId: '12345',
socket: {
write: function() {
return true;
}
},
ready: true
},
beacon: {
beaconId: '12345'
}
};
MOCKS.progress = _.extend({},
_.cloneDeep(MOCKS.game), {
players: [MOCKS.player],
beacons: [MOCKS.beacon],
state: 'started',
progress: {
beacons: [{
beaconId: '12345',
state: 'captured',
owner: 'neutral',
currentCapturingTime: 0,
movementLockTime: 0,
stats: {
allCaptures: [],
lastCaptureTry: null,
capturingTimeTotal: 0,
longestInHold: {
by: 'neutral',
time: 0
},
firstCapturedBy: null
},
sys: {
captureInterval: null,
lastCaptures: []
}
}],
players: [{
userId: '12345',
score: 0,
stats: {
timeSpentOnCaptures: 0,
totalCaptureTries: 0,
succeededCaptures: 0,
failedCaptures: 0
},
lastSyncDate: 12345
}],
gameStartTime: 12345,
gameLength: 600000
}
}
);
var RESPONSEMOCK = {
command: 'SYNC',
response: {
beacons: [{
beaconId: '12345',
state: 'captured',
owner: 'neutral',
currentCapturingTime: 0,
movementLockTime: 0
}],
players: [{
lastSyncDate: 12345,
userId: '12345',
score: 0,
stats: {
timeSpentOnCaptures: 0,
totalCaptureTries: 0,
succeededCaptures: 0,
failedCaptures: 0
}
}, {
lastSyncDate: 12345,
userId: '12345',
score: 0,
stats: {
timeSpentOnCaptures: 0,
totalCaptureTries: 0,
succeededCaptures: 0,
failedCaptures: 0
}
}],
gameStartTime: 12345,
gameLength: 600000
},
status: 'OK',
date: 12345
};
function createGame(Game) {
var newGame = Game.factory("MYHOST");
expect(newGame).toEqual(MOCKS.game);
return newGame;
}
function startGame(Game, newGame) {
if (!newGame) newGame = createGame(Game);
newGame.players.push(MOCKS.player);
newGame.beacons.push(MOCKS.beacon);
Game.start(newGame);
return newGame;
}
describe('Game', function() {
var Game;
beforeEach(function() {
Game = require('../game.js');
Date.now = function() {
return 12345;
};
});
it("should create a new game with default settings and MYHOST as host", function() {
createGame(Game);
});
it("should return game instance if game was found", function() {
createGame(Game);
expect(Game.get('mockedID')).toEqual(MOCKS.game);
});
it("should return an error if game with provided ID doesn't exit", function() {
expect(Game.get("I'm pretty sure this ID doesn't exist.")).toEqual(null);
});
it("should start the game and override current object", function() {
var newGame = startGame(Game);
// remove game loops
newGame.sys = {};
expect(newGame).toEqual(MOCKS.progress);
});
it("should have timers set up after game start", function() {
var newGame = startGame(Game);
expect(newGame.sys).not.toEqual(MOCKS.progress.sys);
expect(newGame.sys.scoreInterval).not.toBeUndefined();
expect(newGame.sys.syncInterval).not.toBeUndefined();
});
it("should clean up after game's finished", function() {
var newGame = startGame(Game);
Game.cleanup(newGame);
expect(newGame).toEqual(MOCKS.progress);
});
it("should call SYNC (write to game socket) immidiately after startGame", function() {
var newGame = createGame(Game);
newGame.players.push(MOCKS.player);
spyOn(newGame.players[0].socket, 'write');
startGame(Game, newGame);
expect(newGame.players[0].socket.write).toHaveBeenCalled();
expect(newGame.players[0].socket.write.calls.length).toEqual(2);
expect(newGame.players[0].socket.write.mostRecentCall.args[0]).toEqual(requestUtil.build(RESPONSEMOCK));
});
});
|
function BrowserCanvasSaver () {
this.anchor = document.createElement('a');
}
BrowserCanvasSaver.prototype.save = function(canvas, successCallback, errorCallback, directory, filename) {
this.anchor.download = filename || 'canvas.png';
this.anchor.href = canvas.toDataURL('image/png');
this.anchor.click();
successCallback(canvas, filename);
};
|
/*
* luck2.js 1.1 (yuga.js TT Custom customized jQuery plugin)
*
* Copyright (c) 2014 Tomoki Sawamura
* tomoki.sawamura0118@gmail.com
*/
/*
* yuga.js 0.7.2
* Copyright (c) 2009 Kyosuke Nakamura (kyosuke.jp)
*/
/*
* yuga.js TT Custom
* Copyright (c) 2011 TAGAWA takao (dounokouno@gmail.com)
*/
/*
* fixHeight 2.1
* http://www.starryworks.co.jp/blog/tips/fixheightjs.html
*
* Author Koji Kimura @ STARRYWORKS inc.
* http://www.starryworks.co.jp/
*/
/*
* !! Above mentioned all plugins !!
*
* Licensed under the MIT License:
* http://www.opensource.org/licenses/mit-license.php
*/
var uaSet = (function() {
return {
ltIE6:typeof window.addEventListener == "undefined" && typeof document.documentElement.style.maxHeight == "undefined",
ltIE7:typeof window.addEventListener == "undefined" && typeof document.querySelectorAll == "undefined",
ltIE8:typeof window.addEventListener == "undefined" && typeof document.getElementsByClassName == "undefined",
ltIE9:document.uniqueID && !window.matchMedia,
gtIE10:document.uniqueID && document.documentMode >= 10,
Trident:document.uniqueID,
Gecko:'MozAppearance' in document.documentElement.style,
Presto:window.opera,
Blink:window.chrome,
Webkit:!window.chrome && 'WebkitAppearance' in document.documentElement.style,
Touch:typeof document.ontouchstart != "undefined",
Mobile:typeof window.orientation != "undefined",
Pointer:window.navigator.pointerEnabled,
MSPoniter:window.navigator.msPointerEnabled
}
})();
(function($) {
$(function() {
$.luck2.rollover();
$.luck2.externalLink();
$.luck2.scroll();
$.luck2.autoCurrent();
$.luck2.tab();
$.luck2.child();
$.luck2.icon();
$.luck2.fixHeight();
$.luck2.placeholder();
$.luck2.toggleBox();
});
$.luck2 = {
//URIを解析したオブジェクトを返すfunction
Uri: function(path) {
var self = this;
this.originalPath = path;
//絶対パスを取得
this.absolutePath = (function() {
var e = document.createElement('a');
e.href = path;
return e.href;
})();
//絶対パスを分解
var fields = {'schema' : 2, 'username' : 5, 'password' : 6, 'host' : 7, 'path' : 9, 'query' : 10, 'fragment' : 11};
var r = /^((\w+):)?(\/\/)?((\w+):?(\w+)?@)?([^\/\?:]+):?(\d+)?(\/?[^\?#]+)?\??([^#]+)?#?(\w*)/.exec(this.absolutePath);
for (var field in fields) {
this[field] = r[fields[field]];
}
this.querys = {};
if (this.query) {
$.each(self.query.split('&'), function() {
var a = this.split('=');
if (a.length == 2) self.querys[a[0]] = a[1];
});
}
},
//ユニークな配列を取得
uniqueArray: function(array) {
var storage = new Object;
var uniqueArray = new Array();
var i, value;
for (var i=0;i<array.length;i++) {
value = array[i];
if (!(value in storage)) {
storage[value] = true;
uniqueArray.push(value);
}
}
return uniqueArray;
},
//ロールオーバー
rollover: function(options) {
var c = $.extend({
hoverSelector: '.imgOver, .imgOvers img',
groupSelector: '.imgGroup',
postfix: '_on'
}, options);
//ロールオーバーするノードの初期化
var rolloverImgs = $(c.hoverSelector).filter(isNotCurrent);
rolloverImgs.each(function() {
this.originalSrc = $(this).attr('src');
this.rolloverSrc = this.originalSrc.replace(new RegExp('('+c.postfix+')?(\.gif|\.jpg|\.png)$'), c.postfix+"$2");
this.rolloverImg = new Image;
this.rolloverImg.src = this.rolloverSrc;
});
//グループ内のimg要素を指定するセレクタ生成
var groupingImgs = $(c.groupSelector).find('img').filter(isRolloverImg);
//通常ロールオーバー
rolloverImgs.not(groupingImgs).hover(function() {
$(this).attr('src',this.rolloverSrc);
},function() {
$(this).attr('src',this.originalSrc);
});
//グループ化されたロールオーバー
$(c.groupSelector).hover(function() {
$(this).find('img').filter(isRolloverImg).each(function() {
$(this).attr('src',this.rolloverSrc);
});
},function() {
$(this).find('img').filter(isRolloverImg).each(function() {
$(this).attr('src',this.originalSrc);
});
});
//フィルタ用function
function isNotCurrent(i) {
return Boolean(!this.currentSrc);
}
function isRolloverImg(i) {
return Boolean(this.rolloverSrc);
}
},
//外部リンクは別ウインドウを設定
externalLink: function(options) {
var c = $.extend({
windowOpen: true
}, options);
var uri = new $.luck2.Uri(location.href);
var e = $('a[href^="http://"],a[href^="https://"],a[href^="//"]').not('a[href^="' + uri.schema + '://' + uri.host + '/' + '"],a[href^="//' + uri.host + '/' + '"]');
if (c.windowOpen) {
e.click(function() {
window.open(this.href, '_blank');
return false;
});
}
e.addClass(c.externalClass);
},
//ページ内リンクはするするスクロール
scroll: function(options) {
var c = $.extend({
duration: 500
}, options);
var $anchors = $('a[href^="#"], area[href^="#"]');
if (uaSet.Blink || uaSet.Webkit) {
rootSelector = 'html,body';
} else if (uaSet.ltIE6) {
rootSelector = 'html,body';
} else {
rootSelector = 'html';
}
var $doc = $(rootSelector);
$anchors.each(function() {
var $target = $(this.hash);
$target = $target.length && $target || $('[name='+ this.hash.slice(1) +']');
$(this).click(function(e) {
if ($target.length === 0) {
e.preventDefault();
return;
}
var targetPositionTop = $target.offset().top;
$doc.stop().animate({
scrollTop: targetPositionTop
},{
duration: c.duration,
complete: function () {
}
});
e.preventDefault();
return false;
});
});
},
//グローバルナビ、サブナビのカレント表示
autoCurrent: function(options) {
var c = $.extend({
rootDir: 1,
currentClass: 'active',
currentPostfix: '_on',
gNavSelector: '#gNav',
gNavCurrentType: 'signature',//auto,signature
gNavList: ['top','about','works','service','contact'],//gNavCurrentType: 'signature' bodyId設定
sNavSelector: '',
sNavNestElement: 'ul'//CSSでdisplay:none;設定を推奨
}, options);
//表示ページのパスを取得
$.getDirFileName = function(fileUrl) {
if (fileUrl.match(new RegExp('#'))) {//アンカーを除外
fileUrl = fileUrl.substring(0,fileUrl.indexOf("#"));
}
if (fileUrl.match(new RegExp('/$'))) {//スラッシュ時のファイル名補填
fileUrl = fileUrl + 'index.';
}
fileUrl = fileUrl.substring(fileUrl.lastIndexOf('/') && fileUrl.indexOf(currentDir), fileUrl.length);
fileUrl = fileUrl.substring(0,fileUrl.indexOf(".")+1);//拡張子を除外
return fileUrl;
}
var currentDir = "/" + new $.luck2.Uri(location.href).path.split("/")[c.rootDir],
dirFileName = $.getDirFileName(location.href),
bodyId = $('body').attr('id'),
gNavNum;
//グローバルナビゲーション
$(c.gNavSelector).find('a').each(function() {
var originalSrc = $(c.gNavSelector).find('a[href*="'+currentDir+'"]').find('img').attr('src'),
rolloverMethod;
if (c.gNavCurrentType == 'auto') {
if (currentDir != "//" && currentDir != "/" && dirFileName != "/index.") {
rolloverMethod = $(c.gNavSelector).find('a[href*="'+currentDir+'"]');
} else if (currentDir.match(new RegExp('.')) && dirFileName === "/index.") {
rolloverMethod = $(c.gNavSelector).find('a[href^="'+currentDir+'"],a[href^="'+dirFileName+'"]');
}
} else if (c.gNavCurrentType == 'signature') {
if ($.inArray(bodyId, c.gNavList)!=-1) {
gNavNum = $.inArray(bodyId, c.gNavList);
rolloverMethod = $(c.gNavSelector).find('a').eq(gNavNum);
}
}
$(rolloverMethod).addClass(c.currentClass);
if (typeof originalSrc == 'undefined') return;
var rolloverSrc = originalSrc.replace(new RegExp('('+c.currentPostfix+')?(\.gif|\.jpg|\.png)$'), c.currentPostfix+"$2");
$(rolloverMethod).find('img').attr('src', rolloverSrc);
$(c.gNavSelector).find('a').hover(function() {
}, function() {
$(rolloverMethod).find('img').attr('src', rolloverSrc);
});
return false;
});
//サブナビゲーション
$(c.sNavSelector).find(c.sNavNestElement).hide();
if (currentDir != "//" && currentDir != "/" && dirFileName != "/index.") {
$(c.sNavSelector).find('a').each(function() {
//スラッシュ時のファイル名補填
if ($(this).attr('href').match(new RegExp('/$'))) {
$(this).attr('href',$(this).attr('href') + 'index.html');
}
//aタグのhrefにカテゴリ名~ファイル名が一致するファイルパスがある場合はカレント表示
if($(this).attr('href').lastIndexOf(dirFileName)!=-1 && dirFileName != "/index.") {
$(this).addClass(c.currentClass);
//ページ内リンクはカレント表示から除外
if($(this).attr('href').match(new RegExp('#'))) {
$(this).removeClass(c.currentClass);
}
//2階層目以降の表示設定
if($(this).parents(c.sNavSelector).find(c.sNavNestElement)) {
$(this).parents(c.sNavNestElement).show().prev().addClass(c.currentClass);
$(this).next(c.sNavNestElement).show();
}
}
});
}
},
//タブ機能
tab: function(options) {
var c = $.extend({
tabNavSelector: '.tabNav',
activeTabClass: 'active'
}, options);
$(c.tabNavSelector).each(function() {
var tabNavList = $(this).find('a[href^=#], area[href^=#]');
var tabBodyList;
var lhash = location.search.replace('?','#');
tabNavList.each(function() {
this.hrefdata = new $.luck2.Uri(this.getAttribute('href'));
var selecter = '#'+this.hrefdata.fragment;
if (tabBodyList) {
tabBodyList = tabBodyList.add(selecter);
} else {
tabBodyList = $(selecter);
}
$(this).unbind('click');
$(this).click(function() {
tabNavList.removeClass(c.activeTabClass);
$(this).addClass(c.activeTabClass);
tabBodyList.hide();
$(selecter).show();
return false;
});
});
tabBodyList.hide()
tabNavList.filter(':first').trigger('click');
if (lhash) {
$(this).find('a[href$='+lhash+'], area[href$='+lhash+']').click();
}
});
},
//odd,even,first-child,last-child,nth-childクラスを追加
child: function(options) {
var c = $.extend({
selector: '#wrap',
oeParentClass: '.oeParent,ul,ol,dl,table,tbody,tr',
nthParentClass: '.nthParent',
oddClass: 'odd',
evenClass: 'even',
nthChildClass: 'nthChild',
firstChildClass: 'firstChild',
lastChildClass: 'lastChild'
}, options);
$(c.selector).each(function() {
var n=0;
$(c.oeParentClass).children().each(function() {
//:odd,:evenをクラスとして追加
$(this).siblings(':nth-child(2n+1)').addBack(':only-child').addClass(c.oddClass);
$(this).siblings(':nth-child(2n)').addClass(c.evenClass);
});
//:nth-childをクラスとして追加
$(c.nthParentClass).children().each(function() {
n++;
for (var i=2;i<=n;i++) {
if ((n%i) == 0) {
//:nth-child(i)
$(this).siblings(':nth-child('+i+')').addBack(':nth-child('+i+')').addClass(c.nthChildClass+i);
//:nth-child(in)
$(this).siblings(':nth-child('+i+'n)').addBack(':nth-child('+i+'n)').addClass(c.nthChildClass+i+'n');
}
}
});
//:first-child,:last-childをクラスとして追加
$(this).find(':first-child').addClass(c.firstChildClass);
$(this).find(':last-child').addClass(c.lastChildClass);
});
},
//href属性の内容に合わせてクラスを追加
icon: function(options) {
var c = $.extend({
ignoreClass: '.icoNone'
}, options);
//IE7以下で複数行に対応 バグフィクス用タグ挿入
$.fn.extend({
inlineBgFix: function() {
if (uaSet.ltIE7) {
$(this).css("cssText","background-image: none !important; padding-right: 0 !important; padding-left: 0 !important;")
.prepend($.parseHTML('<span class="bgFixFront"> </span>'))
.append($.parseHTML('<span class="bgFixBack"> </span>'));
}
}
});
//別ウィンドウクラス
var uri = new $.luck2.Uri(location.href);
var e = $('a[href^="http://"],a[href^="https://"],a[href^="//"]').not('a[href^="' + uri.schema + '://' + uri.host + '/' + '"],a[href^="//' + uri.host + '/' + '"]').not(c.ignoreClass);
e.addClass('icoBlank');
//その他クラス
$('a[href^="mailto"]').not(c.ignoreClass).addClass('icoMail').inlineBgFix();
$('a[href$=".pdf"]').not(c.ignoreClass).addClass('icoPdf').inlineBgFix();
$('a[href$=".doc"], a[href$=".docx"], a[href$=".rtf"]').not(c.ignoreClass).addClass('icoWord').inlineBgFix();
$('a[href$=".xls"], a[href$=".xlsx"]').not(c.ignoreClass).addClass('icoExcel').inlineBgFix();
$('a[href$=".ppt"], a[href$=".pptx"]').not(c.ignoreClass).addClass('icoPwp').inlineBgFix();
$('a[href$=".zip"]').not(c.ignoreClass).addClass('icoZip').inlineBgFix();
},
//ボックスの高さを揃える
fixHeight: function(options) {
var parents = [];
var isInitialized = false;
var textHeight = 0;
var $fontSizeDiv;
$.fn.fixHeight = function( i_force ) {
init();
this.each(function(){
var childrenGroups = getChildren( this );
var children = childrenGroups.shift() || [];
var rows = [[]];
var top = 0;
var c=0;
var $c;
for ( c=0; c<children.length; c++ ) {
$c = $(children[c]);
var i;
if ( top != $c.offset().top ) {
for ( i=0; i<rows.length; i++ ) if ( !$(rows[i]).hasClass("fixedHeight") || i_force ) $(rows[i]).sameHeight().addClass("fixedHeight");
rows = [[]];
top = $c.offset().top;
for ( i=0; i<childrenGroups.length; i++ ) rows.push([]);
}
rows[0].push(children[c]);
for ( i=0; i<childrenGroups.length; i++ ) {
rows[i+1].push(childrenGroups[i][c]);
}
}
if ( rows[0] && rows[0].length ) for ( i=0; i<rows.length; i++ ) $(rows[i]).sameHeight();
_addParent( this );
});
return this;
};
function _addParent( i_parent ) {
for ( var i=0, len=parents.length; i<len; i++ ) {
if ( parents[i] == i_parent ) return;
}
parents.push(i_parent);
}
$.fn.sameHeight = function() {
var maxHeight = 0;
this.css("height","auto");
this.each(function(){
if ( $(this).height() > maxHeight ) maxHeight = $(this).height();
});
return this.height(maxHeight);
};
$.checkFixHeight = function( i_force ) {
if ( $fontSizeDiv.height() == textHeight && i_force !== true ) return;
textHeight = $fontSizeDiv.height();
if ( parents.length ) $(parents).fixHeight( i_force );
}
function init() {
if ( isInitialized ) return;
isInitialized = true;
$fontSizeDiv = $('body').append($.parseHTML('<div style="position:absolute; top:-3em; left:0; padding-top:1em; height:0; line-height:2; overflow:hidden;">s</div>'));
setInterval($.checkFixHeight,1000);
$.checkFixHeight();
$(window).on("resize",$.checkFixHeight);
$(window).on("load",$.checkFixHeight);
}
function getChildren( i_parent ) {
var $parent = $( i_parent );
var childrenGroups = [];
var $children = $parent.find(".fixHeightChild");
if ( $children.length ) childrenGroups.push( $children );
var $groupedChildren = $parent.find("*[class*='fixHeightChild']:not(.fixHeightChild)");
if ( $groupedChildren.length ) {
var classNames = {};
$groupedChildren.each(function(){
var a = $(this).attr("class").split(" ");
var i;
var l = a.length;
var c;
for ( i=0; i<l; i++ ) {
c = a[i].match(/fixHeightChild[a-z0-9_-]+/i);
if ( !c ) continue;
c = c.toString();
if ( c ) classNames[c] = c;
}
});
for ( var c in classNames ) childrenGroups.push( $parent.find("."+c) );
}
if ( !childrenGroups.length ) {
$children = $parent.children();
if ( $children.length ) childrenGroups.push( $children );
}
return childrenGroups;
}
$(document).ready(function(){
$(".fixHeight").fixHeight();
});
},
//プレースホルダー
placeholder: function(options) {
var c = $.extend({
selector: '.placeholder',
hintClass: 'active'
}, options);
$(c.selector).each(function() {
var _this = this;
if ($(this).attr('title')) {
$(this).focus(function() {
if ($(this).val() == $(this).attr('title')) {
$(this).val('').removeClass(c.hintClass);
}
}).blur(function() {
if (!$(this).val()) {
$(this).addClass(c.hintClass).val($(this).attr('title'));
}
}).closest('form').submit(function() {
if ($(_this).val() == $(this).attr('title')) {
$(_this).val('');
}
});
if (!$(this).val()) {
$(this).addClass(c.hintClass).val($(this).attr('title'));
}
}
});
},
//トグル表示
toggleBox: function(options) {
var c = $.extend({
selector: '.toggle dt',
displayType: 'show',//hide,show
toggleClass: 'active',
toggleType: 'slide',//fade,slide
speed: 'normal'
}, options);
//要素を非表示
$(c.selector).each(function() {
if (c.displayType == 'hide') {
$(this).next().hide();
} else if (c.displayType == 'show') {
$(this).addClass(c.toggleClass).next().show();
}
});
$(c.selector).on("click", function() {
$(this).toggleClass(c.toggleClass);
if (c.toggleType == 'fade') {
$(this).next().fadeToggle(c.speed);
} else if (c.toggleType == 'slide') {
$(this).next().slideToggle(c.speed);
}
});
}
};
})(jQuery);
|
'use strict';
var path = require('path');
var helpers = require('yeoman-test');
var assert = require('yeoman-assert');
var wpCli = require('../../helpers/wpCli');
const TEN_SECONDS = 10000;
const FOUR_MINUTES = 240000;
const STDOUT = 0;
describe('Chisel Generator with WordPress (wp-plugins subgenerator)', function () {
this.timeout(TEN_SECONDS)
before(function (done) {
this.timeout(FOUR_MINUTES)
// We skip those tests when running locally because they
// require database at 127.0.0.1 with root user and no password.
if(!process.env.TRAVIS) {
this.skip(); return;
}
helpers
.run(path.join(__dirname, '../../generators/app'))
.withOptions({
'skip-install': true,
'run-wp': true
})
.withPrompts({
name: 'Test Project Plugins',
author: 'Test Author',
projectType: 'wp-with-fe',
databasePassword: new String(''),
adminPassword: 'pass',
adminEmail: 'user@example.com',
plugins: ['https://github.com/wp-premium/advanced-custom-fields-pro/archive/master.zip',
'https://github.com/wp-sync-db/wp-sync-db/archive/master.zip']
})
.on('end', done);
});
it('should download and activate ACF', function(done) {
wpCli(['plugin', 'status', 'advanced-custom-fields-pro'], (err, stdio) => {
assert(stdio[STDOUT].toString('utf8').indexOf('Active') != -1);
done();
})
})
it('should download and activate WP Sync DB', function(done) {
wpCli(['plugin', 'status', 'wp-sync-db'], (err, stdio) => {
assert(stdio[STDOUT].toString('utf8').indexOf('Active') != -1);
done();
})
})
});
|
var Canvas21 = {};
(function () {
function Card (rank, suit) {
this.rank = rank;
this.suit = suit;
}
Module._export(Canvas21, "Card", Card);
Card.Ranks = new Enum(11, 'Jack', 'Queen', 'King', 'Ace');
Card.Suits = new Enum('Clubs', 'Diamonds', 'Hearts', 'Spades');
Card.Width = 30;
Card.Height = 20;
Card.prototype.isRed = function () {
return this.suit === Card.Suits.Diamonds
|| this.suit == Card.Suits.Hearts
};
Card.prototype.render = function (ctx, x, y, hidden) {
var oldFill = ctx.fillStyle;
var oldStroke = ctx.strokeStyle;
if (hidden) {
ctx.fillStyle = Colors.CardBack;
ctx.fillRect(x, y, Card.Width, Card.Height);
} else {
ctx.fillStyle = Colors.CardInterior;
ctx.fillRect(x, y, Card.Width, Card.Height);
if (this.isRed()) {
ctx.fillStyle = Colors.RedColor;
} else {
ctx.fillStyle = Colors.BlackColor;
}
ctx.fillText(this.rankString() + this.suitString(),
x + 5, y + 10);
}
ctx.strokeStyle = Colors.CardBorder;
ctx.strokeRect(x, y, Card.Width, Card.Height);
ctx.fillStyle = oldFill;
ctx.strokeStyle = oldStroke;
};
Card.prototype.rankString = function () {
switch (this.rank) {
case Card.Ranks.Ace:
return 'A';
case Card.Ranks.King:
return 'K';
case Card.Ranks.Queen:
return 'Q';
case Card.Ranks.Jack:
return 'J';
default:
return this.rank.toString();
}
};
Card.prototype.suitString = function () {
switch (this.suit) {
case Card.Suits.Clubs:
return '\u2663';
case Card.Suits.Diamonds:
return '\u2666';
case Card.Suits.Hearts:
return '\u2665';
case Card.Suits.Spades:
return '\u2660';
}
}
Card.prototype.toString = function () {
var rank;
var suit;
switch (this.rank) {
case Card.Ranks.Ace:
rank = 'Ace';
break;
case Card.Ranks.King:
rank = 'King';
break;
case Card.Ranks.Queen:
rank = 'Queen';
break;
case Card.Ranks.Jack:
rank = 'Jack';
break;
default:
rank = this.rank.toString();
}
switch (this.suit) {
case Card.Suits.Clubs:
suit = 'Clubs';
break;
case Card.Suits.Diamonds:
suit = 'Diamonds';
break;
case Card.Suits.Hearts:
suit = 'Hearts';
break;
case Card.Suits.Spades:
suit = 'Spades';
break;
}
return rank + ' of ' + suit;
};
function Deck () {
var cards = [];
this.cards = cards;
Iter.forEachIn(Card.Suits,
function (suit) {
for (var i = 2; i <= 10; i++) {
cards.push(new Card(i, suit));
}
Iter.forEachIn(Card.Ranks,
function (face) {
cards.push(new Card(face, suit));
});
});
}
Module._export(Canvas21, "Deck", Deck);
Deck.prototype.shuffle = function () {
for (var i = this.cards.length - 1; i > 1; i--) {
var j = Math.round(Math.random() * i);
var tmp = this.cards[i];
this.cards[i] = this.cards[j];
this.cards[j] = tmp;
}
};
Deck.prototype.draw = function () {
var result = this.cards.pop();
if (result === undefined) {
window.deck = this;
throw new Error(["Undefined draw...", this]);
}
return result;
};
function Game () {
this.canvas = document.getElementById('gameCanvas');
this.ctx = this.canvas.getContext('2d');
this.deck = new Deck();
this.deck.shuffle();
this.dealer = [];
this.player = [];
this.hit(this.player);
this.hit(this.dealer, {hidden: 1});
this.hit(this.player);
this.hit(this.dealer);
this.render();
}
Module._export(Canvas21, 'Game', Game);
Game.ResultX = 10;
Game.ResultY = 10;
Game.PlayerX = 60;
Game.PlayerY = 30;
Game.DealerX = 60;
Game.DealerY = 60;
Game.prototype.dealerCanPlay = function () {
return this.score(this.dealer) <= 17;
};
Game.prototype.render = function () {
this.ctx.fillText("Player", 0, Game.PlayerY);
this.ctx.fillText("Dealer", 0, Game.DealerY);
var winner;
if (winner = this.whoWon()) {
this.ctx.fillText('The ' + winner + ' won.',
Game.ResultX, Game.ResultY);
function unhide(item) {
item.hidden = false;
}
Iter.map(this.player, unhide);
Iter.map(this.dealer, unhide);
var alertMessage = "alert('The game is already over." +
" Press the New Game button to play again.')";
document.getElementById("hitButton")
.setAttribute("onclick", alertMessage);
document.getElementById("standButton")
.setAttribute("onclick", alertMessage);
}
var ctx = this.ctx;
var x = Game.PlayerX;
var y = Game.PlayerY;
Iter.map(this.player, function (item) {
item.card.render(ctx, x, y, item.hidden);
x += Card.Width + 10;
});
var x = Game.DealerX;
var y = Game.DealerY;
Iter.map(this.dealer, function (item) {
item.card.render(ctx, x, y, item.hidden);
x += Card.Width + 10;
});
}
Game.prototype.hasBusted = function (hand) {
return this.score(hand) > 21;
};
Game.prototype.hit = function (hand, options) {
if (this.deck.cards.length > 0) {
var card = this.deck.draw();
hand.push({
card: card,
hidden: ((options && options.hidden) ? true : false)
});
} else {
throw new Error("Can't hit when the deck is empty.");
}
};
Game.prototype.score = function (hand) {
var aces = 0;
var result =
Iter.reduce(
Iter.map(hand, function (item) {
switch (item.card.rank) {
case Card.Ranks.Ace:
aces++;
return 1;
case Card.Ranks.King:
case Card.Ranks.Queen:
case Card.Ranks.Jack:
return 10;
default:
return item.card.rank;
}
}),
Functional.add, 0);
while (aces && result < 12) {
aces--;
result += 10;
}
return result;
};
Game.prototype.step = function (playerHit) {
var dealerHit;
if (playerHit) {
this.hit(this.player);
}
if (dealerHit = this.dealerCanPlay()) {
this.hit(this.dealer);
}
this.render(playerHit, dealerHit);
};
Game.prototype.whoWon = function () {
var dealerScore = this.score(this.dealer);
var playerScore = this.score(this.player);
if (dealerScore === 21) {
return 'dealer';
} else if (playerScore === 21) {
return 'player';
} else if (this.hasBusted(this.player)) {
return 'dealer';
} else if (this.hasBusted(this.dealer)) {
return 'player';
} else if (!this.dealerCanPlay() && playerScore > dealerScore) {
return 'player';
} else {
return null;
}
};
})();
|
/**
* Created by Steven on 2/20/2016.
*/
(function () {
var app = angular.module('DataManager', []);
var host = "http://137.112.137.116:5000/";
var token;
var user;
app.service('AuthService', ['$http', '$state', function ($http, $state) {
var self = this;
self.login = function (username, password, callback) {
var pkt = { username: username, password: CryptoJS.SHA256(password+username).toString()};
console.log(pkt);
$http({
method: 'POST',
url: host + "login",
data: pkt,
headers: {
'Content-Type': "application/json",
'Accept': "application/json"
}
}).then(function (data) {
console.log('SUCCESS - login', data.data, data.data.access_token);
setToken('auth-token', data.data.access_token);
user = username;
$http.defaults.headers.common.Authorization = 'Bearer ' + data.data.access_token;
token = 'Bearer ' + data.data.access_token;
setRole(data.data.role);
callback(data.data.access_token);
}, function errorCallback(response) {
console.log('error occured: ', response);
callback('', response);
//UPDATE STUFF FOR INCORRECT USER NAME PASSWORD VS SERVER ERROR
});
};
self.newUser = function (username, pwd) {
var pkt = { username: username, password: CryptoJS.SHA256(pwd+username).toString()};
console.log(pkt);
$http({
method: 'POST',
url: host + "createUser",
data: pkt,
headers: {
'Content-Type': "application/json",
'Accept': "application/json"
}
}).then(function (response) {
setToken('auth-token', response.data.access_token);
$http.defaults.headers.common.Authorization = 'Bearer ' + response.data.access_token;
token = 'Bearer ' + response.data.access_token;
setRole('basic');
$state.go('homepage');
}, function errorCallback(response) {
console.log('error occured: ', response);
});
};
}]);
app.service('DataService', ['$http', function ($http) {
var self = this;
self.search = function(searchTerm, type, callback){
$http({
method: 'GET',
url: host + 'search?name=' + searchTerm+'&type='+type,
headers: {
'Content-Type': "application/json",
'Accept': "application/json"
}
}).then(function(response){
callback(response.data);
});
};
self.createChar = function(Pname, Cname,img, callback){
var pkt = {P_name:Pname, C_name:Cname, Img_URL:img, type:'cape'};
$http({
method: 'POST',
url: host + 'create',
data: pkt,
headers: {
'Content-Type': "application/json",
'Accept': "application/json",
'Authorization': getToken('auth-token')
}
}).then(function(response){
callback(response.data);
});
};
self.createSeries = function(Sname, Uname, Pname, img, callback){
var pkt = {S_name:Sname, U_name:Uname, P_name:Pname, Img_URL:img, type:'series'};
$http({
method: 'POST',
url: host + 'create',
data: pkt,
headers: {
'Content-Type': "application/json",
'Accept': "application/json",
'Authorization': getToken('auth-token')
}
}).then(function(response){
callback(response.data);
});
};
self.createUniverse = function(Uname, size, Pname, location, img, callback){
var pkt = {U_name:Uname, Size:size, P_name:Pname, Location:location, Img_URL:img, type:'universe'};
$http({
method: 'POST',
url: host + 'create',
data: pkt,
headers: {
'Content-Type': "application/json",
'Accept': "application/json",
'Authorization': getToken('auth-token')
}
}).then(function(response){
callback(response.data);
});
};
self.createPublisher = function(Pname, Hname, img, callback){
var pkt = {P_name:Pname, H_name:Hname, Img_URL:img, type:'publisher'};
$http({
method: 'POST',
url: host + 'create',
data: pkt,
headers: {
'Content-Type': "application/json",
'Accept': "application/json",
'Authorization': getToken('auth-token')
}
}).then(function(response){
callback(response.data);
});
};
self.createDeath = function(KillerName, KilledName, iss, desc, callback){
var rName ='';
var pkt = {KillerID:KillerName, KilledID:KilledName, Issue:iss, Dsc:desc, type:'kills'};
$http({
method: 'POST',
url: host + 'create',
data: pkt,
headers: {
'Content-Type': "application/json",
'Accept': "application/json",
'Authorization': getToken('auth-token')
}
}).then(function(response){
callback(response.data);
});
};
self.createRating = function(killID, val, callback){
var pkt = {Username:user, KID:klilID, Value:val, type:'rating'};
$http({
method: 'POST',
url: host + 'create',
data: pkt,
headers: {
'Content-Type': "application/json",
'Accept': "application/json"
}
}).then(function(response){
callback(response.data);
});
};
self.createCharSeries = function(sname, cid, callback){
var pkt = {S_name:sname, C_ID:cid, type:'charSeries'};
$http({
method: 'POST',
url: host + 'create',
data: pkt,
headers: {
'Content-Type': "application/json",
'Accept': "application/json",
'Authorization': getToken('auth-token')
}
}).then(function(response){
callback(response.data);
});
};
self.deleteChar = function(charID, callback){
var pkt = {delID:charID, type:'cape'};
$http({
method: 'POST',
url: host + 'delete',
data: pkt,
headers: {
'Content-Type': "application/json",
'Accept': "application/json",
'Authorization': getToken('auth-token')
}
}).then(function(response){
callback(response.data);
});
};
self.deleteSeries = function(sname, callback){
var pkt = {S_name:sname, type:'series'};
$http({
method: 'POST',
url: host + 'delete',
data: pkt,
headers: {
'Content-Type': "application/json",
'Accept': "application/json",
'Authorization': getToken('auth-token')
}
}).then(function(response){
callback(response.data);
});
};
self.deleteUniverse = function(name, callback){
var pkt = {U_name:name, type:'universe'};
$http({
method: 'POST',
url: host + 'delete',
data: pkt,
headers: {
'Content-Type': "application/json",
'Accept': "application/json",
'Authorization': getToken('auth-token')
}
}).then(function(response){
callback(response.data);
});
};
self.deletePublisher = function(name, callback){
var pkt = {P_name:name, type:'publisher'};
$http({
method: 'POST',
url: host + 'delete',
data: pkt,
headers: {
'Content-Type': "application/json",
'Accept': "application/json",
'Authorization': getToken('auth-token')
}
}).then(function(response){
callback(response.data);
});
};
self.deleteKill = function(name, callback){
var pkt = {KID:name, type:'kills'};
console.log(pkt);
$http({
method: 'POST',
url: host + 'delete',
data: pkt,
headers: {
'Content-Type': "application/json",
'Accept': "application/json",
'Authorization': getToken('auth-token')
}
}).then(function(response){
callback(response.data);
});
};
self.updateChar = function(id, Pname, Cname,img, callback){
var pkt = {ID:id, P_name:Pname, C_name:Cname, Img_URL:img, type:'cape'};
$http({
method: 'POST',
url: host + 'update',
data: pkt,
headers: {
'Content-Type': "application/json",
'Accept': "application/json",
'Authorization': getToken('auth-token')
}
}).then(function(response){
callback(response.data);
});
};
self.updateDeath = function(id, killerID, killedID, iss, desc, callback){
var pkt = {ID:id, Killer:killerID, Killed:killedID, diedinissue:iss, description:desc, type:'kills'};
$http({
method: 'POST',
url: host + 'update',
data: pkt,
headers: {
'Content-Type': "application/json",
'Accept': "application/json",
'Authorization': getToken('auth-token')
}
}).then(function(response){
callback(response.data);
});
};
self.updateSeries = function(oldName, newName, uname, pname, imgurl, callback){
var pkt = {old:oldName, new:newName, U_name:uname, P_name:pname, Img_URL:imgurl, type:'series'};
$http({
method: 'POST',
url: host + 'update',
data: pkt,
headers: {
'Content-Type': "application/json",
'Accept': "application/json",
'Authorization': getToken('auth-token')
}
}).then(function(response){
callback(response.data);
});
};
self.updateUniverse = function(oldName, newName, size, pname, location, imgurl, callback){
var pkt = {old:oldName, new:newName, size:size, P_name:pname, location:location, Img_URL:imgurl, type:'universe'};
$http({
method: 'POST',
url: host + 'update',
data: pkt,
headers: {
'Content-Type': "application/json",
'Accept': "application/json",
'Authorization': getToken('auth-token')
}
}).then(function(response){
callback(response.data);
});
};
self.updatePublisher = function(oldName, newName, hnames, imgurl, callback){
var pkt = {old:oldName, new:newName, H_name:hnames, Img_URL:imgurl, type:'publisher'};
$http({
method: 'POST',
url: host + 'update',
data: pkt,
headers: {
'Content-Type': "application/json",
'Accept': "application/json",
'Authorization': getToken('auth-token')
}
}).then(function(response){
callback(response.data);
});
};
}]);
})();
|
'use strict';
/* Controllers */
var phonecatControllers = angular.module('phonecatControllers', []);
phonecatControllers.controller('PhoneListCtrl', ['$scope', 'Phone', 'Cart',
function ($scope, Phone, Cart) {
$scope.phones = Phone.query();
$scope.orderProp = 'age';
$scope.addToCart = function (phone) {
Cart.addItem(phone);
};
}]);
phonecatControllers.controller('PhoneDetailCtrl', ['$scope', '$routeParams', 'Phone',
function ($scope, $routeParams, Phone) {
$scope.phone = Phone.get({phoneId: $routeParams.phoneId}, function (phone) {
$scope.mainImageUrl = phone.images[0];
});
$scope.setImage = function (imageUrl) {
$scope.mainImageUrl = imageUrl;
};
}]);
phonecatControllers.controller('PhoneCartCtrl', ['$scope', 'Cart',
function ($scope, Cart) {
$scope.cartText = {
itemSingular: "item",
itemPlural: "items",
checkout: "Checkout"
};
$scope.cart = Cart;
}]);
phonecatControllers.controller('PhoneCartCheckoutCtrl', ['$scope', 'CookieService',
function ($scope, CookieService) {
$scope.orderText = {
confirmation: "Order confirmation",
totalAmount: "Total amount"
};
$scope.order = CookieService.getCookie('Cart');
}]);
phonecatControllers.controller('sandboxCtrl', ['$scope', '$log',
function ($scope, $log) {
$scope.checkboxModel = {
value: 'unchecked'
};
$scope.isSelected = function (event) {
var value = $scope.checkboxModel.value;
if (value === 'checked') {
$('#myModal').modal('show');
}
};
$scope.editInput = function () {
angular.element('#numberInput').focus();
//TODO uncheck checkbox
};
}]);
|
// Copyright (C) 2016 Goom Inc. All rights reserved.
import { combineReducers } from 'redux';
import _ from 'lodash';
import CommonReducers from '../../commons/redux/reducers';
import { initColorsAndSizes } from 'commons/utils/productUtil';
function popup(state = {}, action) {
if (action.type === 'OPEN_POPUP') {
const next = { popupName: action.popupName };
return next;
} else if (action.type === 'CLOSE_POPUP') {
return {};
}
return state;
}
function errorHandler(state = {}, action) {
if (action.type === 'RESET_ERROR') {
return Object.assign({}, state, { error: {} });
}
return state;
}
function headerSearchCategory(state = {}, action) {
if (action.type === 'SET_SEARCH_CATEGORY') {
return Object.assign({}, state, { activeCategory: action.category });
} else if (action.type === 'TOGGLE_SEARCH_DROPDOWN') {
return Object.assign({}, state, { showDropdown: !state.showDropdown });
}
if (state.showDropdown) {
state.shoDropdown = false;
}
return state;
}
function checkout(state = {}, action) {
if (action.type === 'CHECKOUT_SET_STEP') {
const nextState = Object.assign({}, state);
nextState.step = action.step;
return nextState;
}
return state;
}
// BEGIN page-wide reducers
function pageProductDetail(state = {}, action) {
const updateColorsAndSizes = (variants, activeColor, activeSize, state2) => {
const { variantAttributes } = state2;
// 2016. 02. 25. [heekyu] copy object for render view
const newAttributes = JSON.parse(JSON.stringify(variantAttributes));
for (let i = 0; i < variants.length; i++) {
const variant = variants[i];
if (!newAttributes.sizes[variant.data.size] || !newAttributes.colors[variant.data.color]) {
console.log(`${variant.sku} does not have color or size`); // eslint-disable-line no-console
continue;
}
// 2016. 02. 25. [heekyu] set disable attributes
if (!activeColor || activeColor === variant.data.color) {
newAttributes.sizes[variant.data.size].enable = true;
}
if (!activeSize || activeSize === variant.data.size) {
newAttributes.colors[variant.data.color].enable = true;
}
// 2016. 02. 25. [heekyu] set selected attributes
if (activeColor === variant.data.color) {
newAttributes.colors[variant.data.color].selected = true;
}
if (activeSize === variant.data.size) {
newAttributes.sizes[variant.data.size].selected = true;
}
}
state2.variantAttributes = newAttributes;
return state2;
};
const resetColorsAndSizes = (state2) => {
const { variantAttributes } = state2;
const colorKeys = Object.keys(variantAttributes.colors);
for (let i = 0; i < colorKeys.length; i++) {
variantAttributes.colors[colorKeys[i]].enable = false;
variantAttributes.colors[colorKeys[i]].selected = false;
}
const sizeKeys = Object.keys(variantAttributes.sizes);
for (let i = 0; i < sizeKeys.length; i++) {
variantAttributes.sizes[sizeKeys[i]].enable = false;
variantAttributes.sizes[sizeKeys[i]].selected = false;
}
state2.variantAttributes = variantAttributes;
return state2;
};
const colorsAndSizesFromState = (state2) => {
state2 = resetColorsAndSizes(state2);
const variants = state2.variants;
const activeColor = state2.activeColor;
const activeSize = state2.activeSize;
state2 = updateColorsAndSizes(variants, activeColor, activeSize, state2);
if (activeColor) {
for (let i = 0; i < variants.length; i++) {
const variant = variants[i];
if (variant.data.color === activeColor) {
state2.activeImage = variant.appImages.default[0];
break;
}
}
}
if (activeColor && activeSize) {
for (let i = 0; i < variants.length; i++) {
const variant = variants[i];
if (variant.data.color === activeColor && variant.data.size === activeSize) {
state2.selectedVariant = variant;
return state2;
}
}
}
state2.selectedVariant = null;
return state2;
};
if (action.type === 'ACTIVE_IMAGE') {
return Object.assign({}, state, { activeImage: action.image });
} else if (action.type === 'PRODUCT_DETAIL_VARIANTS') {
const initialVariantState = {
variants: action.variants, selectedVariant: null, activeColor: null, activeSize: null,
};
// 2016. 03. 25. [heekyu] Select First Color and size
return Object.assign({}, state, initialVariantState, initColorsAndSizes(action.variants));
/*
const state2 = Object.assign({}, state, initialVariantState, initColorsAndSizes(action.variants));
const colors = Object.keys(_.get(state2, 'variantAttributes.colors') || {});
const sizes = Object.keys(_.get(state2, 'variantAttributes.sizes') || {});
if (colors.length > 0 && sizes.length > 0) {
state2.activeColor = colors[0];
state2.activeSize = sizes[0];
}
return colorsAndSizesFromState(state2);
*/
} else if (action.type === 'PRODUCT_DETAIL_SET_COLOR') {
const color = action.color;
if (color === state.activeColor) {
state.activeColor = null;
} else {
state.activeColor = color;
}
const next = colorsAndSizesFromState(state);
return Object.assign({}, next);
} else if (action.type === 'PRODUCT_DETAIL_SET_SIZE') {
const size = action.size;
if (size === state.activeSize) {
state.activeSize = null;
} else {
state.activeSize = size;
}
const next = Object.assign({}, colorsAndSizesFromState(state));
return next;
}
return state;
}
function pageProductList(state = {}) {
// TODO query related state management
return state;
}
function pageCheckout(state = { isEditMode: false }, action) {
if (action.type === 'CHECKOUT_NEW_ADDRESS') {
return Object.assign({}, state, { isEditMode: true, isNewAddress: true });
} else if (action.type === 'CHECKOUT_TOGGLE_EDIT_MODE') {
return Object.assign({}, state, { isEditMode: !state.isEditMode, isNewAddress: false });
}
return state;
}
const pageReducers = combineReducers({
pageProductDetail,
pageProductList,
pageCheckout,
});
// END page-wide reducers
// {
// brandId
// }
function mypage(state = {}, action) {
if (action.type === 'SET_MYPAGE_MENU_NAME') {
return Object.assign({}, state, { menuName: action.menuName });
}
return state;
}
function reorder(state = {}, action) {
if (action.type === 'REORDER_SET_BRAND') {
return Object.assign({}, state, { brand: action.brand, product: null });
} else if (action.type === 'REORDER_SET_PRODUCT') {
return Object.assign({}, state, { product: action.product });
}
return state;
}
const rootReducer = combineReducers(
Object.assign({}, CommonReducers.reducers,
{ errorHandler, popup, headerSearchCategory, checkout, mypage, reorder, page: pageReducers })
);
export default (state = {}, action) => {
if (action.error) {
return Object.assign({}, state, { errorHandler: { error: action.error } });
}
if (action.type === 'RESET') {
return rootReducer({}, action);
}
return rootReducer(state, action);
};
|
define('kbaseTable',
[
'jquery',
'kbwidget',
'kbaseDeletePrompt',
'kbaseButtonControls',
'kbaseSearchControls',
//'jqueryui', //XXX - removed. But do I need this? I can't have it in right now because it directly conflicts with bootstrap's tooltip. Need to remember why it's here.
],
function ($) {
$.KBWidget({
name: "kbaseTable",
version: "1.0.0",
_accessors : ['numRows', 'sortButtons', 'visRowString'],
options: {
sortable : false,
striped : true,
hover : true,
bordered : true,
headerOptions : {},
resizable : false,
header_callback : function(header) {
if (header.label != undefined) {
return header.label;
}
else {
return header.value.replace(/(?:^|\s+)([a-z])/g, function(v) { return v.toUpperCase(); });
}
},
row_callback : function (cell, header, row, $kb) {},
sortButtons : {},
navControls : false,
},
default_row_callback : function (cell) {
if (cell == undefined) {
return cell;
}
if (cell.label != undefined) {
return cell.label;
}
else {
value = typeof cell != 'object'
? cell
: cell.value;
if (cell.type == 'th') {
value = value.replace(/(?:^|\s+)([a-z])/g, function(v) { return v.toUpperCase(); });
value += ' : ';
}
if (typeof cell == 'object' && cell.setup != undefined) {
cell.setup(value, cell);
}
return value;
}
},
init: function(options) {
this._super(options);
this.appendUI( $( this.$elem ), this.options.structure );
return this;
},
appendUI : function ($elem, struct) {
$elem.empty();
var $tbl = $('<table></table>')
.attr('id', 'table')
.css('margin', '0px')
.addClass('table');
if (this.options.tblOptions) {
this.addOptions($tbl, this.options.tblOptions);
}
if (this.options.striped) {
$tbl.addClass('table-striped');
}
if (this.options.hover) {
$tbl.addClass('table-hover');
}
if (this.options.bordered) {
$tbl.addClass('table-bordered');
}
if (this.options.caption) {
$tbl.append(
$('<caption></caption>')
.append(this.options.caption)
)
}
if (struct.header) {
var $thead = $('<thead></thead>')
.attr('id', 'thead');
$thead.append(this.navControls(struct.header.length));
var $tr = $('<tr></tr>')
.attr('id', 'headerRow');
$.each(
struct.header,
$.proxy(function (idx, header) {
if (typeof header == 'string') {
header = {value : header};
struct.header[idx] = header;
}
var callback = header.callback || this.options.header_callback;
var label = callback(header, this);
var h = header.value;
var $th = $.jqElem('th')
.append(label)
;
if (this.options.resizable) {
$th.resizable({
handles: 'e'
});
}
this.addOptions($th, $.extend(true, {}, this.options.headerOptions, header));
if (header.sortable || (header.sortable == undefined && this.options.sortable)) {
var buttonId = header.value + '-sortButton';
var $buttonIcon = $('<i></i>')
.addClass('fa fa-sort');
var $button = $('<button></button>')
.addClass('btn btn-default btn-xs')
.attr('id', buttonId)
.css('display', 'none')
.css('float', 'right')
.append($buttonIcon)
.data('shouldHide', true)
;
$button.bind('click', $.proxy(function (e) {
var $lastSort = this.data('lastSort');
if ($lastSort != undefined && $lastSort.get(0) != $button.get(0)) {
$lastSort.children(':first').removeClass('fa fa-sort-up');
$lastSort.children(':first').removeClass('fa fa-sort-down');
$lastSort.children(':first').addClass('fa fa-sort');
$lastSort.data('shouldHide', true);
$lastSort.css('display', 'none');
}
this.data('lastSortHeader', h);
if ($buttonIcon.hasClass('fa fa-sort')) {
$buttonIcon.removeClass('fa fa-sort');
$buttonIcon.addClass('fa fa-sort-up');
$button.data('shouldHide', false);
this.sortAndLayoutOn(h, 1);
this.data('lastSortDir', 1);
this.data('lastSort', $button);
}
else if ($buttonIcon.hasClass('fa fa-sort-up')) {
$buttonIcon.removeClass('fa fa-sort-up');
$buttonIcon.addClass('fa fa-sort-down');
$button.data('shouldHide', false);
this.sortAndLayoutOn(h, -1);
this.data('lastSortDir', -1);
this.data('lastSort', $button);
}
else if ($buttonIcon.hasClass('fa fa-sort-down')) {
$buttonIcon.removeClass('fa fa-sort-down');
$buttonIcon.addClass('fa fa-sort');
$button.data('shouldHide', true);
this.sortAndLayoutOn(undefined);
this.data('lastSortHeader', undefined);
this.data('lastSortDir', undefined);
this.data('lastSort', undefined);
}
}, this))
;
this.sortButtons()[header.value] = $button;
$th.append($button);
$th.bind('mouseover', $.proxy(function(e) {
$button.css('display', 'inline');
}, this));
$th.bind('mouseout', $.proxy(function(e) {
if ($button.data('shouldHide')) {
$button.css('display', 'none');
}
}, this));
}
$tr.append($th);
}, this)
);
$thead.append($tr);
$tbl.append($thead);
}
if (struct.rows) {
var $tbody = this.data('tbody', $('<tbody></tbody>'));
this.layoutRows(struct.rows, struct.header);
$tbl.append($tbody);
}
if (struct.footer) {
var $tfoot = $('<tfoot></tfoot>')
.attr('id', 'tfoot')
;
var $tfootTR = $.jqElem('tr');
$tfoot.append($tfootTR);
for (var idx = 0; idx < struct.footer.length; idx++) {
var fcell = struct.footer[idx];
var value = fcell;
var style;
var colspan;
if (typeof fcell == 'object') {
value = fcell.value;
style = fcell.style;
colspan = fcell.colspan;
}
var $td = $.jqElem('td')
.append(value)
;
if (style) {
$td.attr('style', style);
}
if (colspan) {
$td.attr('colspan', colspan);
}
$tfootTR.append($td);
}
$tbl.append($tfoot);
}
this._rewireIds($tbl, this);
$elem.append($tbl);
return $elem;
},
navControls : function(colspan) {
var $tbl = this;
var controlsTR = $.jqElem('tr')
.css('display', this.options.navControls ? undefined : 'none')
.append(
$.jqElem('td')
.attr('colspan', colspan)
.css('background-color', 'lightgray')
.append(
$.jqElem('div')
.addClass('pull-left')
.addClass('input-group input-group-sm')
.append(
$.jqElem('span')
.addClass('input-group-btn')
.append(
$.jqElem('button')
.addClass('btn btn-default')
.attr('id', 'pageLeftButton')
.append(
$.jqElem('i')
.attr('id', 'leftIcon')
.addClass('fa fa-caret-left')
)
.on('click', function(e) {
var maxRows = $tbl.options.maxVisibleRowIndex || $tbl.numRows();
var minRows = $tbl.options.minVisibleRowIndex || 0;
var visRows = maxRows - minRows;
var newMin = minRows - visRows;
if (newMin <= 0) {
$(this).attr('disabled', true);
newMin = 0;
}
var newMax = newMin + visRows;
$tbl.options.minVisibleRowIndex = newMin;
$tbl.options.maxVisibleRowIndex = newMax;
$tbl.displayRows();
})
)
)
/*.append(
$.jqElem('span')
.attr('id', 'visRecords')
.kb_bind(this, 'visRowString')
)*/
.append(
$.jqElem('span')
.attr('id', 'visRecords')
.addClass('input-group-addon')
.kb_bind(this, 'visRowString')
)
.append(
$.jqElem('span')
.addClass('input-group-btn')
.append(
$.jqElem('button')
.addClass('btn btn-default')
.attr('id', 'pageRightButton')
.append(
$.jqElem('i')
.attr('id', 'rightIcon')
.addClass('fa fa-caret-right')
)
.on('click', function(e) {
var maxRows = $tbl.options.maxVisibleRowIndex || $tbl.numRows();
var minRows = $tbl.options.minVisibleRowIndex || 0;
var visRows = maxRows - minRows;
var newMax = maxRows + visRows;
if (newMax >= $tbl.numRows()) {
newMax = $tbl.numRows();
$(this).attr('disabled', true);
}
var newMin = newMax - visRows;
$tbl.options.minVisibleRowIndex = newMin;
$tbl.options.maxVisibleRowIndex = newMax;
$tbl.displayRows();
})
)
)
)
.append(
$.jqElem('div')
.addClass('pull-left')
.addClass('input-group input-group-sm')
.append(
$.jqElem('span')
.addClass('input-group-btn')
.append(
$.jqElem('button')
.addClass('btn btn-default')
.attr('id', 'removeButton')
.append(
$.jqElem('i')
.attr('id', 'removeIcon')
.addClass('fa fa-minus')
)
.on('click', function(e) {
var currentVis = $tbl.options.maxVisibleRowIndex || 0;
currentVis--;
if (currentVis < 1) {
currentVis = 1;
}
$tbl.options.maxVisibleRowIndex = currentVis;
$tbl.displayRows();
})
)
)
.append(
$.jqElem('span')
.addClass('input-group-btn')
.append(
$.jqElem('button')
.addClass('btn btn-default')
.attr('id', 'addButton')
.append(
$.jqElem('i')
.attr('id', 'addIcon')
.addClass('fa fa-plus')
)
.on('click', function(e) {
var currentVis = $tbl.options.maxVisibleRowIndex || 0;
currentVis++;
if (currentVis > $tbl.numRows()) {
var visDiff = currentVis - $tbl.numRows();
currentVis = $tbl.options.structure.rows.length;
$tbl.options.minVisibleRowIndex -= visDiff;
if ($tbl.options.minVisibleRowIndex < 0) {
$tbl.options.minVisibleRowIndex = 0;
}
}
$tbl.options.maxVisibleRowIndex = currentVis;
$tbl.displayRows();
})
)
)
)
.append(
$.jqElem('div')
.addClass('pull-right')
.attr('id', 'searchDiv')
)
)
;
this._rewireIds(controlsTR, this);
this.data('searchDiv').kbaseSearchControls(
{
onMouseover : false,
type : 'inline',
context : this,
searchCallback : function(e, value, $tbl) {
$tbl.refilter(value);
}
}
);
return controlsTR;
},
sort : function(header, direction) {
var $sortButton = this.sortButtons()[header];
if (direction == -1 || direction == 1 && $sortButton != undefined) {
var lsh = this.data('lastSortHeader');
var lsd = this.data('lastSortDir');
if (header == lsh && direction == lsd) {
return;
}
else if (header == lsh) {
if (direction == 1 && lsh == -1) {
$sortButton.trigger('click');
$sortButton.trigger('click');
}
else if (direction == -1 && lsh == 1) {
$sortButton.trigger('click');
}
}
else {
$sortButton.trigger('click');
if (direction == -1) {
$sortButton.trigger('click');
}
}
$sortButton.css('display', 'inline');
}
},
refilter : function (filter) {
this.options.filter = filter;
this.sortAndLayoutOn(this.data('lastSortHeader'), this.data('lastSortDir'));
},
sortAndLayoutOn : function(h, dir) {
var sortedRows = this.options.structure.rows;
if (h != undefined) {
//var h = header.value;
sortedRows =
this.options.structure.rows.slice().sort(
function (a,b) {
var keyA = a[h];
var keyB = b[h];
if (keyA != undefined && keyA.sortValue != undefined) {
keyA = keyA.sortValue;
}
else {
keyA = typeof keyA == 'string' ? keyA.toLowerCase() : keyA;
}
if (keyB != undefined && keyB.sortValue != undefined) {
keyB = keyB.sortValue;
}
else {
keyB = typeof keyB == 'string' ? keyB.toLowerCase() : keyB;
}
if (keyA < keyB) { return 0 - dir }
else if (keyA > keyB) { return dir }
else { return 0 }
}
)
;
}
this.layoutRows(sortedRows, this.options.structure.header);
},
layoutRows : function (rows, header) {
this.data('tbody').empty();
var numRows = 0;
if ($.isArray(rows)) {
for (var idx = 0; idx < rows.length; idx++) {
var $row = this.createRow(rows[idx], header);
if ($row != undefined && $row.children().length) {
numRows++;
this.data('tbody').append($row);
}
}
}
else if (this.options.structure.keys != undefined) {
for (var idx = 0; idx < this.options.structure.keys.length; idx++) {
var key = this.options.structure.keys[idx];
if (typeof key != 'object') {
key = { value : key };
}
key.type = 'th';
key.style = 'white-space : nowrap';
var $row = this.createRow(
{
key : key,
value : {value : rows[key.value], key : key.value},
},
[{value : 'key'}, {value : 'value'}]
);
if ($row != undefined && $row.children().length) {
numRows++;
this.data('tbody').append($row);
}
}
}
this.numRows(numRows);
this.displayRows();
},
displayRows : function() {
this.data('tbody')
.find('tr')
.css('display', '');
var maxRows = this.options.maxVisibleRowIndex || this.numRows();
if (maxRows > this.numRows()) {
maxRows = this.numRows();
}
var minRows = this.options.minVisibleRowIndex || 0;
this.data('tbody')
.find('tr:lt(' + minRows + ')')
.css('display', 'none');
this.data('tbody')
.find('tr:gt(' + (maxRows - 1) + ')')
.css('display', 'none');
this.visRowString('Rows ' + (minRows + 1) + ' to ' + maxRows + ' of ' + this.numRows());
this.data('pageLeftButton').attr('disabled', minRows == 0);
this.data('pageRightButton').attr('disabled', maxRows == this.numRows());
this.data('removeButton').attr('disabled', maxRows - minRows == 1);
this.data('addButton').attr('disabled', maxRows == this.numRows());
},
addOptions : function ($cell, options) {
if (typeof options == 'string' || options == undefined) {
return;
}
if (options.style != undefined) {
$cell.attr('style', options.style);
}
if (options.class != undefined) {
var classes = typeof options.class == 'string'
? [ options.class ]
: options.class;
$.each(
classes,
$.proxy(function(idx, cl) {
$cell.addClass(cl);
}, this)
);
}
var events = ['mouseover', 'mouseout', 'click'];
$.each(
events,
$.proxy(function(idx, e) {
if (options[e] != undefined) {
$cell.bind(e,options[e])
}
}, this)
);
if (options.colspan) {
$cell.attr('colspan', options.colspan);
}
if (options.rowspan) {
$cell.attr('rowspan', options.rowspan);
}
},
createRow : function (rowData, headers) {
var $tr = $.jqElem('tr')
//if we don't explicitly set the background color at this level, then
//overlapping background elements will occasionally be visible. This is
//stupid and seems like a rendering error. Nonetheless, we hack around it.
.css('background-color', 'white');
var callback = this.options.row_callback;
var filterString = '';
if ( $.isArray(rowData) ) {
$.each(
rowData,
$.proxy( function(idx, cell) {
var value = typeof cell == 'object'
? cell.value
: cell;
if (value == undefined) {
return;
}
filterString += value instanceof jQuery ? value.text() : value;
var $td = $.jqElem('td').append(value);
if (typeof cell == 'object') {
this.addOptions($td, cell);
}
$tr.append($td);
}, this)
);
}
else if (headers != undefined && headers.length) {
$.each(
headers,
$.proxy(function (hidx, header) {
var h = header.value;
var type = 'td';
// null is an irritating special case. Because it's not defined,
// but it is a type of object. frick.
if (rowData[h] == null) {
rowData[h] = undefined;
}
if (typeof rowData[h] == 'object' && rowData[h].value == null) {
rowData[h].value = '';
}
if (typeof rowData[h] == 'object' && rowData[h].type != undefined) {
type = rowData[h].type;
}
var $td = $.jqElem(type);
var label = callback(rowData[h], h, rowData, this);
if (label == undefined) {
label = this.default_row_callback(rowData[h], h, rowData, this);
}
filterString += label instanceof jQuery ? label.text() : label;
if (rowData[h] && ! rowData[h].externalSortValue) {
rowData[h].sortValue = label instanceof jQuery
? label.text()
: label;
}
$td.append(label);
if (typeof rowData[h] != 'string') {
this.addOptions($td, rowData[h]);
}
if (label != undefined) {
$tr.append($td);
}
}, this)
);
}
if (this.options.filter != undefined) {
var filterRegex = new RegExp(this.options.filter, 'i');
if (! filterString.match(filterRegex)) {
$tr = undefined;
}
}
return $tr;
},
deletePrompt : function(row) {
var $deleteModal = $('<div></div>').kbaseDeletePrompt(
{
name : row,
callback : this.deleteRowCallback(row),
}
);
$deleteModal.openPrompt();
},
deleteRowCallback : function (row) {
},
shouldDeleteRow : function (row) { return 1; },
});
});
|
'use strict';
describe('factory: Menu', function () {
var menu;
beforeEach(function() {
module('cookBookApp');
inject(function (_menu_) {
menu = _menu_;
})
});
it('should be open by default', function () {
expect(menu.isOpen()).toBe(true);
});
it('should be possible to open', function () {
menu.open();
expect(menu.isOpen()).toBe(true);
});
it('should be possible to close', function () {
menu.close();
expect(menu.isOpen()).toBe(false);
});
it('should be open after toggle if it was closed before', function () {
menu.close();
menu.toggle();
expect(menu.isOpen()).toBe(true);
});
it('should be closed after toggle if it was open before', function () {
menu.open();
menu.toggle();
expect(menu.isOpen()).toBe(false);
});
}); |
'use strict';
angular.module(
'jiraScrumTools.jira',
[
'jiraScrumTools.jira.tasks',
'jiraScrumTools.jira.sprints',
'jiraScrumTools.jira.sprintquery',
'jiraScrumTools.jira.issues',
'jiraScrumTools.jira.projects'
]
); |
'use strict';
const BorlandCommander = require('toolbag/plugins/borland_commander');
const Getfile = require('toolbag/plugins/getfile');
const Heapdump = require('toolbag/plugins/heapdump');
const HttpReporter = require('toolbag/plugins/http_reporter');
const Policy = require('toolbag/plugins/policy');
const ProcessReporter = require('toolbag/plugins/process_reporter');
const Profiler = require('toolbag/plugins/profiler');
const SharedSymbol = require('toolbag/plugins/shared_symbol');
const StatsCollector = require('toolbag/plugins/stats_collector');
const Signal = require('toolbag/plugins/signal');
const UdpReporter = require('toolbag/plugins/udp_reporter');
module.exports = function config (defaults, callback) {
callback(null, {
errors: {
policy: 'log'
},
plugins: [
{
plugin: BorlandCommander,
options: {
host: 'http://localhost:5000'
}
},
{
plugin: HttpReporter,
options: {
id: 'http reporter',
method: 'POST',
url: 'http://localhost:5000/report',
options: {}
}
},
{
plugin: ProcessReporter
},
{
plugin: Getfile,
options: defaults.data
},
{
plugin: Heapdump,
options: defaults.data
},
{
plugin: Profiler,
options: defaults.data
},
{ plugin: SharedSymbol },
{ plugin: Signal },
{
plugin: StatsCollector,
options: {
enabled: true,
period: 1000,
eventLoopLimit: 30,
features: {
process: true,
system: true,
cpu: true,
memory: true,
gc: true,
handles: true,
requests: true,
eventLoop: true,
meta: {
tags: ['api']
}
}
}
}
]
});
};
|
module.exports = {
setTitle: function( context, title ) {
context.app.setTitle( title );
context.router.setTitle( title );
}
}; |
(function () {
'use strict';
angular
.module('app')
.run(run);
function run ($rootScope, $location, $http, $localStorage) {
console.log('init run app');
/*alert();
if ($localStorage.globals) {
$http.defaults.headers.common['Authorization'] = 'Basic ' + $localStorage.globals.authdata;
}
$rootScope.$on('$locationChangeStart', function (event, next, current) {
if($location.path() !== '/login' && !$localStorage.globals){
$location.path('/login');
}
});*/
}
})(); |
angular.module('myShowsModule',['movieTrackerApp']); //jshint ignore:line |
/**
* Created by aknauss on 6/21/17.
*/
module.exports = () => {
const mongoose = require('mongoose');
mongoose.Promise = global.Promise;
mongoose.connect(process.env.DB_URL);
const db = mongoose.connection;
db.on('error', console.error.bind(console, 'connection error:'));
return {
mongoose: mongoose,
db: db,
save: (model) => {
console.log(model);
model.save((err) => {
if (err) {
throw err;
} else {
console.log("saved");
}
});
}
};
}
|
/* Copyright (C) 2011-2014 Mattias Ekendahl. Used under MIT license, see full details at https://github.com/developedbyme/dbm/blob/master/LICENSE.txt */
dbm.registerClass("dbm.projects.examples.thirdparty.google.search.SimpleSearchApplication", "dbm.gui.abstract.startup.standalone.StandAlonePage", function(objectFunctions, staticFunctions, ClassReference) {
//console.log("dbm.core.BaseObject");
//Self reference
var SimpleSearchApplication = dbm.importClass("dbm.projects.examples.thirdparty.google.search.SimpleSearchApplication");
//Error report
var ErrorManager = dbm.importClass("dbm.core.globalobjects.errormanager.ErrorManager");
var ReportTypes = dbm.importClass("dbm.constants.error.ReportTypes");
var ReportLevelTypes = dbm.importClass("dbm.constants.error.ReportLevelTypes");
//Dependencies
var JsonAsset = dbm.importClass("dbm.core.globalobjects.assetrepository.assets.JsonAsset");
//Utils
var CallFunctionCommand = dbm.importClass("dbm.core.extendedevent.commands.basic.CallFunctionCommand");
var LogCommand = dbm.importClass("dbm.core.extendedevent.commands.debug.LogCommand");
var GetVariableObject = dbm.importClass("dbm.utils.reevaluation.objectreevaluation.GetVariableObject");
//Constants
var GenericExtendedEventIds = dbm.importClass("dbm.constants.extendedevents.GenericExtendedEventIds");
var LoadingExtendedEventIds = dbm.importClass("dbm.constants.extendedevents.LoadingExtendedEventIds");
/**
* Constructor
*/
objectFunctions._init = function() {
//console.log("dbm.projects.examples.thirdparty.google.search.SimpleSearchApplication::_init");
this.superCall();
this._addStartFunction(this._load, []);
return this;
};
objectFunctions._load = function() {
console.log("dbm.projects.examples.thirdparty.google.search.SimpleSearchApplication::_load");
var key = "AIzaSyCtZDKih6gjAI34VF4qXr28Nn-Z7uA7cPs";
var engineId = "007826195105171803720:r4vu66yn-b4";
var searchQuery = "belgrade";
var url = "https://www.googleapis.com/customsearch/v1?key=" + key + "&cx=" + engineId + "&q=" + searchQuery;
var loader = JsonAsset.create(url);
loader.getExtendedEvent().addCommandToEvent(LoadingExtendedEventIds.LOADED, CallFunctionCommand.createCommand(this, this._dataLoaded, [loader]));
loader.load();
};
objectFunctions._dataLoaded = function(aLoader) {
console.log("dbm.projects.examples.thirdparty.google.search.SimpleSearchApplication::_dataLoaded");
console.log(aLoader.getData());
};
objectFunctions.setAllReferencesToNull = function() {
this._mapView = null;
this.superCall();
};
}); |
$(function(){
// Function for delaying something
//////////////////////////////////
var delay = (function(){
var timer = 0;
return function(callback, ms){
clearTimeout (timer);
timer = setTimeout(callback, ms);
};
})();
// Clear text on focus
//////////////////////
$('.clickclear').live('blur', function(){
if(this.value == ''){
$(this).removeClass('mark');
this.value = this.defaultValue;
}
});
$('.clickclear').live('focus',function(){
if(this.value == this.defaultValue){
$(this).addClass('mark');
this.value = '';
}
});
$('#search_adv select').change(function(){
if($(this).val() == '')
$(this).prev('.selectbox').removeClass('mark');
else
$(this).prev('.selectbox').addClass('mark');
});
// Remove error on typing
/////////////////////////
$('input.error, textarea.error').live('keypress',function(){
$(this).removeClass('error');
});
// Search form / control functionality
//////////////////////////////////////
$('.control').live('click',function(e){
e.preventDefault();
//$('#controls input[name="start_limit"]').val(0);
$(this).attr('href',$(this).attr('href').replace('http://www.autoservicehaarlem.nl/',''));
if($(this).attr('rel') == 'view')
if($(this).attr('href') == 'grid'){
$('#search_adv_submit > p span').html('zoeken');
$('#container .left').addClass('grid').removeClass('list');
}else{
$('#search_adv_submit > p span').html('uitgebreid zoeken');
$('#container .left').addClass('list').removeClass('grid');
}
if($('#wrapper').hasClass('green'))
var color = '_green';
else
var color = '';
if($(this).find('img[rel="sort"]').length){
$('.control img[rel="sort"]').hide();
var $img = $(this).find('img[rel="sort"]');
var sort = $img.attr('alt');
$img.show();
if(sort == 'desc')
var rev = 'asc';
else
var rev = 'desc';
if($(this).hasClass('active')){
$img.attr('alt',rev).attr('src','img/sort_'+rev+color+'.png');
$('#controls input[name="sort_dir"]').val(rev);
}else
$('#controls input[name="sort_dir"]').val(sort);
}
$(this).siblings('.control').each(function(){
$(this).removeClass('active')
.find('img:not([rel="sort"])').attr('src','img/'+$(this).attr('href')+'.png');
});
$(this).addClass('active')
.find('img:not([rel="sort"])').attr('src','img/'+$(this).attr('href')+'_active'+color+'.png');
var prev = $('#controls input[name="prev"]').val();
var curr = $(this).attr('rel')+$(this).attr('href');
$('#controls input[name="'+$(this).attr('rel')+'"]').val($(this).attr('href'));
$('#controls input[name="curr"]').val(curr);
refresh_cars();
$('#controls input[name="prev"]').val(curr);
});
$('#search_adv input, #search_ajax').keypress(function(e){
delay(function(){
filter_cars();
}, 500);
});
$('#search_adv select').change(function(e){
filter_cars();
});
$('#search_adv_submit').live('click',function(e){
e.preventDefault();
filter_cars();
});
// Refresh cars after filter
////////////////////////////
function filter_cars(){
$('#controls input[name="curr"]').val('filter');
refresh_cars();
}
// Refresh cars after control
/////////////////////////////
function refresh_cars(){
$('#controls input[name="start_limit"]').val(0);
$.post('ajax/cars.php?section='+$('input[name="section"]').val(),$('#controls, #search_adv, #search').serialize(),function(data){
$('#cars_holder').html(data);
fit_text();
});
}
// Fit text within a certain amount of width
////////////////////////////////////////////
function fit_text(){
$('.textfit').each(function(){
while($(this).width() > $(this).attr('rel')){
var dFontsize = parseFloat($(this).css("font-size"), 10);
$(this).css("font-size", dFontsize - 1);
}
$(this).removeClass('textfit');
});
}
fit_text();
// Ajax call for refreshing model list on selecting brand
/////////////////////////////////////////////////////////
$('#select_brand').change(function(){
$.post('ajax/models.php',{brand: $(this).val()},function(data){
if(data != 'error')
$('#select_model').html(data);
//$("#select_model").sb("refresh");
});
});
// Ajax forms
/////////////
$('form.ajax').live('submit',function(e){
e.preventDefault();
console.log('form.ajax is aangeroepen');
$(this).children('.error').removeClass('error');
var $this = $(this);
$.post($(this).attr('action'),$(this).serialize(),function(data){
data = $.parseJSON(data);
if(data.status == 'success'){
if(data.returnText != '' && data.special != 'tax')
$this.html(data.returnText);
if(data.trigger && data.triggerType)
$(data.trigger).trigger(data.triggerType);
if(data.special == 'tax'){
$this.parents('.bigblock').find('p').html(data.returnText);
$this.parents('.bigblock').find('.label').remove();
alert(data.returnText);
}
}else
for(var key in data)
if(data.hasOwnProperty(key) && key != 'status')
$this.children('[name="'+key+'"]').addClass('error');
});
});
// detail_toggle
////////////////
$('.detail_button').live('click', function(e){
e.preventDefault();
var rel=$(this).attr('rel');
$(this).children('img').toggle();
$('.specification[rel='+rel+']').slideToggle();
});
// Ajax load more
/////////////////
var ajax_call_busy = false;
$(window).bind('scroll', function(){
if (ajax_call_busy == false) {
var height = $(document).height();
var scrollTop = $(window).scrollTop()+$(window).height();
if (height * .8 < scrollTop) {
ajax_call_busy = true;
var current_limit = parseFloat($('#controls input[name="start_limit"]').val());
var new_limit = current_limit + 10;
$('#controls input[name="start_limit"]').val(new_limit);
$('.ajax_container[rel='+new_limit+']').html('<div class="ajax_loader"></div>');
$.post('ajax/cars.php?section='+$('input[name="section"]').val(),$('#controls, #search_adv, #search').serialize(),function(data){
$('.ajax_container[rel='+new_limit+']').html(data);
fit_text();
ajax_call_busy = false;
});
}
}
});
// Selectbox styling
////////////////////
// Image Scroller
/////////////////
$('a[rel=img_scr]').live('click', function(e){
e.preventDefault();
var img_tot = $('input[name=img_tot]').val();
var img_pos = $('input[name=img_pos]').val();
var img_pos_m = (img_pos*1)-1;
var img_pos_p = (img_pos*1)+1;
var img_pos_r = (img_pos*1)+3;
var img_pos_l = (img_pos*1)-1;
var img_pos_lh = (img_pos*1)+2;
if (img_tot > 3) {
if ( (img_tot-img_pos) > 3 && $(this).hasClass('slid_right') ) {
$('a[rel='+img_pos+']').hide();
$('a[rel='+img_pos_r+']').show();
$('input[name=img_pos]').val(img_pos_p);
} else if (img_pos > 1 && $(this).hasClass('slid_left') ) {
$('a[rel='+img_pos_lh+']').hide();
$('a[rel='+img_pos_l+']').show();
$('input[name=img_pos]').val(img_pos_m);
}
}
img_tot = $('input[name=img_tot]').val();
img_pos = $('input[name=img_pos]').val();
if ((img_tot-img_pos) <= 3) {
$('.slid_right').children('img[rel=i]').show();
$('.slid_right').children('img[rel=a]').hide();
} else {
$('.slid_right').children('img[rel=i]').hide();
$('.slid_right').children('img[rel=a]').show();
}
if (img_pos == 1) {
$('.slid_left').children('img[rel=i]').show();
$('.slid_left').children('img[rel=a]').hide();
} else {
$('.slid_left').children('img[rel=i]').hide();
$('.slid_left').children('img[rel=a]').show();
}
});
$('.img_small').click(function(e){
e.preventDefault();
$('#full_link').attr('href',$(this).attr('href'));
$('#full_img').attr('src',$(this).attr('href'));
});
//$('#search_adv select').sb();
}); |
/**
* Tom Select v1.7.7
* Licensed under the Apache License, Version 2.0 (the "License");
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('../../tom-select.js')) :
typeof define === 'function' && define.amd ? define(['../../tom-select'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TomSelect));
}(this, (function (TomSelect) { 'use strict';
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var TomSelect__default = /*#__PURE__*/_interopDefaultLegacy(TomSelect);
/**
* Return a dom element from either a dom query string, jQuery object, a dom element or html string
* https://stackoverflow.com/questions/494143/creating-a-new-dom-element-from-an-html-string-using-built-in-dom-methods-or-pro/35385518#35385518
*
* param query should be {}
*/
const getDom = query => {
if (query.jquery) {
return query[0];
}
if (query instanceof HTMLElement) {
return query;
}
if (query.indexOf('<') > -1) {
let div = document.createElement('div');
div.innerHTML = query.trim(); // Never return a text node of whitespace as the result
return div.firstChild;
}
return document.querySelector(query);
};
/**
* Plugin: "dropdown_header" (Tom Select)
* Copyright (c) contributors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, 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.
*
*/
TomSelect__default['default'].define('clear_button', function (userOptions) {
const self = this;
const options = Object.assign({
className: 'clear-button',
title: 'Clear All',
html: data => {
return `<div class="${data.className}" title="${data.title}">×</div>`;
}
}, userOptions);
self.on('initialize', () => {
var button = getDom(options.html(options));
button.addEventListener('click', evt => {
self.clear();
evt.preventDefault();
evt.stopPropagation();
});
self.control.appendChild(button);
});
});
})));
//# sourceMappingURL=clear_button.js.map
|
import React from "react"
import cx from "classnames"
export default class IconActivity extends React.PureComponent {
static defaultProps = {
width: 24,
height: 24,
className: null
}
render() {
return (
<svg
xmlns="http://www.w3.org/2000/svg"
width={this.props.width}
height={this.props.height}
viewBox="0 0 24 24"
className={cx(
"m-icon-activity",
"m-icon-path",
this.props.className
)}
>
<g fill="none" fillRule="evenodd">
<path d="M7 11.5h10" />
<path
fillRule="nonzero"
d="M5.5 13a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zm0 1a2.5 2.5 0 1 1 0-5 2.5 2.5 0 0 1 0 5zM18.5 13a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zm0 1a2.5 2.5 0 1 1 0-5 2.5 2.5 0 0 1 0 5z"
/>
</g>
</svg>
)
}
}
|
;define(['model/compare_store.model'], function(__Compare_Store) {
return new (function() {
var __option = {
elem: {
compare_base: null,
compare_null_text: null,
compare_table: null
},
};
this.init = function(_opt) {
__option.elem = $.extend(__option.elem, _opt);
__option.elem.compare_null_text = __option.elem.compare_base.find($('p#compare_null'));
__option.elem.compare_table = __option.elem.compare_base.find($('table'));
};
var item_select = function(_i_list) {
var d_sel = $('<select class="form-control"></select>');
$.each(_i_list, function(_i) {
var item = this;
d_sel.append(
$('<option></option>').attr('value', _i).html(item.name)
);
})
return d_sel;
};
var redraw_table = function(_i_list) {
var _table = __option.elem.compare_table;
var c_1 = _table.find('td#compare_item_select_1 select').val() || 0;
var c_2 = _table.find('td#compare_item_select_2 select').val() || 0;
_table.find('td#compare_item_pic_1').html('').append(
$('<img></img>').attr('src', _i_list[c_1].img_path)
);
_table.find('td#compare_item_pic_2').html('').append(
$('<img></img>').attr('src', _i_list[c_2].img_path)
);
_table.find('td#compare_item_price_1').html(_i_list[c_1].price + '元/份');
_table.find('td#compare_item_price_2').html(_i_list[c_2].price + '元/份');
}
this.show = function() {
if (__Compare_Store.get_count() < 2) {
__option.elem.compare_null_text.show();
__option.elem.compare_table.hide();
}
else {
__option.elem.compare_null_text.hide();
__option.elem.compare_table.show();
var item_list = __Compare_Store.get_list();
__option.elem.compare_table.find('td.compare_item_select').html('').append(item_select(item_list)).change(function() {
redraw_table(__Compare_Store.get_list());
});
redraw_table(item_list);
}
__option.elem.compare_base.modal('show');
}
})();
}); |
import {StatsService} from './services/stats.service';
import {APIService} from './services/API.service';
import {DialogService} from './services/dialog.service';
import {ToastService} from './services/toast.service';
import {FUConfig} from './services/FUconfig.service';
import {TranslateService} from './services/translate.service';
angular.module('app.services')
.service('StatsService', StatsService)
.service('API', APIService)
.service('DialogService', DialogService)
.service('ToastService', ToastService)
.service('FUConfig', FUConfig)
.service('TranslateService', TranslateService)
|
import * as Bookmark from './bookmark/bookmark.entity';
export default function BookmarksApiService(Restangular, $q) {
let api = Restangular.all('bookmarks');
this.list = () =>
api.getList()
.then(rows => rows.map(Bookmark.fromJSON).filter(Bookmark.isInstance));
this.remove = (id) =>
api.one(id).remove();
this.create = (fields) => $q((resolve, reject) =>
api.post(fields.toJSON())
.then(Bookmark.fromJSON)
.then(bookmark => (bookmark instanceof Error ? reject : resolve)(bookmark)));
this.update = (id, fields) => $q((resolve, reject) =>
api.one(id).customPUT(fields.toJSON())
.then(Bookmark.fromJSON)
.then(bookmark => (bookmark instanceof Error ? reject : resolve)(bookmark)));
}
|
const pull = require('pull-stream')
const genStream = require('./')
pull(
genStream.source(function*() {
yield 1
yield 2
yield 3
}),
genStream.through(function*(read) {
while(true) {
var input = yield read()
if(!input) break
yield input + input / 10
}
}),
genStream.sink(function*(read) {
while(true) {
var input = yield read()
if(!input) break
console.log(input)
}
})
)
// =>
// 1.1
// 2.2
// 3.3 |
var express = require('express');
var http = require('http');
var app = express();
app.use(express.static(__dirname + '/public'));
var server = http.createServer(app);
server.listen(8080);
global.Server = new (require('ws').Server)({
server: server
});
require('./lib/world');
require('./lib/server');
require('./lib/loop');
process.on('uncaughtException', function(err) {
console.log(err);
console.log(err.stack);
process.exit(0);
});
|
import {
BEGIN_AJAX_CALL,
AJAX_CALL_ERROR
} from '../actions/ajaxStatusActions';
const actionTypeEndsInSuccess = type => (
type.substring(type.length - 8) === '_SUCCESS'
);
export default function ajaxStatusReducer(state = 0, action) {
if (action.type === BEGIN_AJAX_CALL) {
return state + 1;
} else if (action.type === AJAX_CALL_ERROR || actionTypeEndsInSuccess(action.type)) {
return state - 1;
}
return state;
}
|
#!/usr/bin/env node
var argv = require('minimist')(process.argv.slice(2))
var snoop = require('../')
require('get-stdin')(function(data) {
if (data.length === 0)
return usage(1)
snoop(data, function(err, deps) {
if (err) {
console.error("ERR: Could not parse browserify bundle")
process.exit(1)
}
var out
if (argv.pretty || argv.p) {
out = require('archy')({
label: 'dependencies ['+deps.length+']',
nodes: deps
})
} else
out = JSON.stringify(deps)
console.log(out)
})
})
function usage(code) {
console.log("Usage:\n snoop-bundle-deps [opts] < bundle.js")
process.exit(code||0)
} |
/**
* Created by jayanne on 2017/1/22.
*/
import './_load.scss'; |
'use strict';
var fs = require('fs');
var path = require('path');
var Datastore = require('nedb');
var dbFile = path.join(__dirname, 'base.db');
var db = new Datastore({ filename: dbFile });
exports.name = 'NeDB';
exports.init = function (options, callback) {
fs.unlink(dbFile, function (err) {
if (err && err.code != 'ENOENT') {
callback(err);
} else {
db.loadDatabase(callback);
}
});
};
exports.insert = function (id, entry, callback) {
entry._id = id;
db.insert(entry, callback);
};
exports.get = function (id, callback) {
db.findOne({ _id: id }, callback);
};
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.checkConfigValid = void 0;
const checkConfigMap = {
endpoint: checkEndpoint,
region: /^[a-zA-Z0-9\-_]+$/,
};
function checkEndpoint(endpoint) {
if (typeof endpoint === 'string') {
return /^[a-zA-Z0-9._:/-]+$/.test(endpoint);
}
else if (endpoint.host) {
return /^[a-zA-Z0-9._:/-]+$/.test(endpoint.host);
}
return false;
}
exports.checkConfigValid = (conf, key) => {
if (checkConfigMap[key]) {
let isConfigValid = true;
if (checkConfigMap[key] instanceof Function) {
isConfigValid = checkConfigMap[key](conf);
}
else {
isConfigValid = checkConfigMap[key].test(conf);
}
if (!isConfigValid) {
throw new Error(`The ${key} must be conform to the specifications`);
}
}
};
|
function Departure(data) {
this.TransportMode = data.TransportMode;
this.LineNumber = data.LineNumber;
this.Destination = data.Destination;
this.TimeTabledDateTime = data.TimeTabledDateTime;
this.ExpectedDateTime = data.ExpectedDateTime;
this.JourneyDirection = data.JourneyDirection;
this.DisplayTime = data.DisplayTime;
}
Departure.prototype.ToString = function() {
return this.TransportMode+ ' ' + this.LineNumber;
}
module.exports = Departure; |
var _ = require('underscore');
var Marionette = require('backbone.marionette');
var LoadoutTemplate = require('../../../templates/destiny/loadout.hbs');
module.exports = Marionette.ItemView.extend({
template: LoadoutTemplate,
className: 'loadout',
events: {
click: 'equipLoadout',
'click .delete-loadout': 'deleteLoadout'
},
equipLoadout: function(e) {
var Destiny = window.App.module('Destiny');
var items = this.model.get('items');
_.each(items, _.bind(function(i) {
var itemData = Destiny.manager.locateItem(i);
var itemReceiver = this._parent.model;
Destiny.manager.addToStack(
_.extend(itemData, {
action: 'equip',
itemId: i,
itemReceiver: itemReceiver
}));
}, this));
Destiny.manager.processStack();
this._parent.close();
},
deleteLoadout: function() {
this.model.destroy();
}
});
|
/*!
* Mowe Gallery v1.0.0 (http://letsmowe.org/)
* Copyright 2013-2015 Noibe Developers
* Licensed under MIT (https://github.com/noibe/villa/blob/master/LICENSE)
*/
var Gallery = (function () {
/**
* The constructor
* @constructor
*/
function Gallery() {
var self = this;
this.main = document.getElementById('main');
this.viewport = document.getElementById('hero');
this.gallery = document.getElementById('hero-gallery');
this.slides = this.gallery.querySelectorAll('.GalleryContent');
/**
* Get, update and set the current to next slide
*/
this.nextSlide = function () {
var c, n, i;
if (c = self.getCurrent(true)) {
i = ( c.index == self.slides.length - 1 ) ? 0 : c.index + 1;
n = self.slides[i];
n.index = i;
self.setCurrent(self.updateCurrent(n));
}
self.translateSlides();
self.initInfiniteLoop();
};
/**
* Controller of click and touch events
*/
this.ctrlClick = function () {
if (self.allowClick) self.nextSlide();
};
/**
* Controller of size of gallery and slides
* Also do a nextSlide function after 1200 milliseconds
*/
this.ctrlResize = function () {
setTimeout(function () {
self.resizeGallery();
self.resizeSlides();
}, 400);
self.initInfiniteLoop(1200);
};
}
/**
* Get the current slide
* @param {boolean|undefined} remove
* @return {object} current
*/
Gallery.prototype.getCurrent = function (remove) {
var c, n;
for (var i = this.slides.length; i--;)
if (this.slides[i].classList.contains('current')) {
if (remove) this.slides[i].classList.remove('current');
c = this.slides[i];
c.index = i;
}
if (!c) {
n = this.slides[0];
n.index = 0;
}
return n ? n : c;
};
/**
* Current Setter
* @param {object} current
* @return {object} current
*/
Gallery.prototype.setCurrent = function (current) {
this.current = current;
};
/**
* Current Update Class
* @param {object} current
* @return {object} current
*/
Gallery.prototype.updateCurrent = function (current) {
current.classList.add('current');
return current;
};
/**
* Set the slide translate property (webkit and ie9 support)
* @param {object} a element
* @param {number} b width
*/
Gallery.prototype.setSlideTranslate = function (a, b) {
a.style.transform = 'translateX(' + b + 'px)';
a.style.webkitAlignContent = 'translateX(' + b + 'px)';
a.style.msTransform = 'translateX(' + b + 'px)';
};
/**
* Do the slide translate
*/
Gallery.prototype.translateSlides = function () {
var self = this;
var c, w;
this.allowClick = false;
c = this.current.index;
w = this.current.offsetWidth;
for (var i = this.slides.length; i--;)
this.setSlideTranslate(this.slides[i], ( i - c ) * w);
setTimeout(function () {
self.allowClick = true;
}, 700);
};
/**
* Resize the .gallery-content
*/
Gallery.prototype.resizeSlides = function () {
for (var i = this.slides.length; i--;)
this.slides[i].style.width = this.viewport.offsetWidth + 'px';
};
/**
* Resize the .gallery
*/
Gallery.prototype.resizeGallery = function () {
if (is.portrait()) {
var h;
h = this.viewport.offsetWidth * .7;
if (h > window.innerHeight) h = window.innerHeight;
this.gallery.style.height = h + 'px';
} else {
this.gallery.style.height = '100vh';
}
};
/**
* Controller the global interval function
*/
Gallery.prototype.initInfiniteLoop = function (interval) {
var self = this;
if (interval) {
if (this.infiniteLoop)
clearInterval(this.infiniteLoop);
this.infiniteLoop = setTimeout(function() {
self.nextSlide();
self.doInfiniteLoop();
}, interval);
} else this.doInfiniteLoop();
};
/**
* Do the infinite loop
*/
Gallery.prototype.doInfiniteLoop = function () {
var self = this;
if (self.infiniteLoop) clearInterval(self.infiniteLoop);
self.loopInterval = 5000;
self.infiniteLoop = setInterval(self.nextSlide, self.loopInterval);
};
/**
* Init the gallery
*/
Gallery.prototype.init = function () {
var self = this;
this.current = this.updateCurrent(this.getCurrent(true));
addListener(this.viewport, 'click', 'onclick', self.ctrlClick, false);
this.loopInterval = 6000;
addListener(window, 'resize', false, self.ctrlResize, false);
this.resizeGallery();
this.resizeSlides();
this.translateSlides();
self.initInfiniteLoop();
};
return Gallery;
})(); |
module.exports = {
sourceCode: "i\"f\" true",
result: {
type: "Script",
commands: [
{
type: "SimpleCommand",
name: {
text: "if",
type: "Word"
},
suffix: [
{
text: "true",
type: "Word"
}
]
}
]
}
} |
// Resources prefix
var s_resprefix = "res/";
var s_pathGrossini = "res/Images/grossini.png";
var s_pathSister1 = "res/Images/grossinis_sister1.png";
var s_pathSister2 = "res/Images/grossinis_sister2.png";
var s_pathB1 = "res/Images/b1.png";
var s_pathB2 = "res/Images/b2.png";
var s_pathR1 = "res/Images/r1.png";
var s_pathR2 = "res/Images/r2.png";
var s_pathF1 = "res/Images/f1.png";
var s_pathF2 = "res/Images/f2.png";
var s_pathBlock = "res/Images/blocks.png";
var s_back = "res/Images/background.png";
var s_back1 = "res/Images/background1.png";
var s_back2 = "res/Images/background2.png";
var s_back3 = "res/Images/background3.png";
var s_stars1 = "res/Images/stars.png";
var s_stars2 = "res/Images/stars2.png";
var s_fire = "res/Images/fire.png";
var s_snow = "res/Images/snow.png";
var s_streak = "res/Images/streak.png";
var s_playNormal = "res/Images/btn-play-normal.png";
var s_playSelect = "res/Images/btn-play-selected.png";
var s_aboutNormal = "res/Images/btn-about-normal.png";
var s_aboutSelect = "res/Images/btn-about-selected.png";
var s_highNormal = "res/Images/btn-highscores-normal.png";
var s_highSelect = "res/Images/btn-highscores-selected.png";
var s_ball = "res/Images/ball.png";
var s_paddle = "res/Images/paddle.png";
var s_pathClose = "res/Images/close.png";
var s_menuItem = "res/Images/menuitemsprite.png";
var s_shapeModeMenuItem = "res/Images/shapemode.png";
var s_textureModeMenuItem = "res/Images/texturemode.png";
var s_MovementMenuItem = "res/Images/movement.png";
var s_sendScore = "res/Images/SendScoreButton.png";
var s_pressSendScore = "res/Images/SendScoreButtonPressed.png";
var s_power = "res/Images/powered.png";
var s_atlasTest = "res/Images/atlastest.png";
var s_stars2Grayscale = "res/Images/stars2-grayscale.png";
var s_starsGrayscale = "res/Images/stars-grayscale.png";
var s_grossini_dance_atlas = "res/Images/grossini_dance_atlas.png";
var s_piece = "res/Images/piece.png";
var s_grossini_dance_atlas_mono = "res/Images/grossini_dance_atlas-mono.png";
var s_grossini = "res/animations/grossini.png";
var s_grossini_gray = "res/animations/grossini_gray.png";
var s_grossini_blue = "res/animations/grossini_blue.png";
var s_grossini_aliases = "res/animations/grossini-aliases.png";
var s_dragon_animation = "res/animations/dragon_animation.png";
var s_ghosts = "res/animations/ghosts.png";
var s_grossini_family = "res/animations/grossini_family.png";
var s_tcc_issue_1 = "res/animations/tcc_issue_1.png";
var s_tcc_issue_2 = "res/animations/tcc_issue_2.png";
var s_tcc_issue_1_plist = "res/animations/tcc_issue_1.plist";
var s_tcc_issue_2_plist = "res/animations/tcc_issue_2.plist";
var s_Cowboy_json = "res/armatures/Cowboy.ExportJson";
var s_Cowboy_plist = "res/armatures/Cowboy0.plist";
var s_Cowboy_png = "res/armatures/Cowboy0.png";
var s_cyborg_plist = "res/armatures/cyborg.plist";
var s_cyborg_png = "res/armatures/cyborg.png";
var s_cyborg_xml = "res/armatures/cyborg.xml";
var s_Dragon_plist = "res/armatures/Dragon.plist";
var s_Dragon_png = "res/armatures/Dragon.png";
var s_Dragon_xml = "res/armatures/Dragon.xml";
var s_knight_plist = "res/armatures/knight.plist";
var s_knight_png = "res/armatures/knight.png";
var s_knight_xml = "res/armatures/knight.xml";
var s_robot_plist = "res/armatures/robot.plist";
var s_robot_png = "res/armatures/robot.png";
var s_robot_xml = "res/armatures/robot.xml";
var s_weapon_plist = "res/armatures/weapon.plist";
var s_weapon_png = "res/armatures/weapon.png";
var s_weapon_xml = "res/armatures/weapon.xml";
var s_s9s_blocks9 = "res/Images/blocks9ss.png";
var s_s9s_blocks9_plist = "res/Images/blocks9ss.plist";
var s_blocks9 = "res/Images/blocks9.png";
var s_s9s_ui = "res/Images/ui.png";
var s_s9s_ui_plist = "res/Images/ui.plist";
var s_boilingFoamPlist = "res/Images/BoilingFoam.plist";
var s_grossiniPlist = "res/animations/grossini.plist";
var s_grossini_grayPlist = "res/animations/grossini_gray.plist";
var s_grossini_bluePlist = "res/animations/grossini_blue.plist";
var s_grossini_aliasesPlist = "res/animations/grossini-aliases.plist";
var s_ghostsPlist = "res/animations/ghosts.plist";
var s_grossini_familyPlist = "res/animations/grossini_family.plist";
var s_animations2Plist = "res/animations/animations-2.plist";
var s_animationsPlist = "res/animations/animations.plist";
var s_helloWorld = "res/Images/HelloWorld.png";
var s_grossiniDance01 = "res/Images/grossini_dance_01.png";
var s_grossiniDance02 = "res/Images/grossini_dance_02.png";
var s_grossiniDance03 = "res/Images/grossini_dance_03.png";
var s_grossiniDance04 = "res/Images/grossini_dance_04.png";
var s_grossiniDance05 = "res/Images/grossini_dance_05.png";
var s_grossiniDance06 = "res/Images/grossini_dance_06.png";
var s_grossiniDance07 = "res/Images/grossini_dance_07.png";
var s_grossiniDance08 = "res/Images/grossini_dance_08.png";
var s_grossiniDance09 = "res/Images/grossini_dance_09.png";
var s_grossiniDance10 = "res/Images/grossini_dance_10.png";
var s_grossiniDance11 = "res/Images/grossini_dance_11.png";
var s_grossiniDance12 = "res/Images/grossini_dance_12.png";
var s_grossiniDance13 = "res/Images/grossini_dance_13.png";
var s_grossiniDance14 = "res/Images/grossini_dance_14.png";
var s_arrows = "res/Images/arrows.png";
var s_arrowsBar = "res/Images/arrowsBar.png";
var s_arrows_hd = "res/Images/arrows-hd.png";
var s_arrowsBar_hd = "res/Images/arrowsBar-hd.png";
// tilemaps resource
var s_tilesPng = "res/TileMaps/tiles.png";
var s_levelMapTga = "res/TileMaps/levelmap.tga";
var s_fixedOrthoTest2Png = "res/TileMaps/fixed-ortho-test2.png";
var s_hexaTilesPng = "res/TileMaps/hexa-tiles.png";
var s_isoTestPng = "res/TileMaps/iso-test.png";
var s_isoTest2Png = "res/TileMaps/iso-test2.png";
var s_isoPng = "res/TileMaps/iso.png";
var s_orthoTest1BwPng = "res/TileMaps/ortho-test1_bw.png";
var s_orthoTest1Png = "res/TileMaps/ortho-test1.png";
var s_tilesHdPng = "res/TileMaps/tiles-hd.png";
var s_tmwDesertSpacingHdPng = "res/TileMaps/tmw_desert_spacing-hd.png";
var s_tmwDesertSpacingPng = "res/TileMaps/tmw_desert_spacing.png";
var s_tileISOOffsetPng = "res/TileMaps/tile_iso_offset.png";
var s_tileISOOffsetTmx = "res/TileMaps/tile_iso_offset.tmx";
var s_fnTuffyBoldItalicCharmapPng = "res/fonts/tuffy_bold_italic-charmap.png";
var s_fpsImages = "res/fonts/fps_images.png";
var s_bitmapFontTest = "res/fonts/bitmapFontTest.png";
var s_bitmapFontTest2 = "res/fonts/bitmapFontTest2.png";
var s_bitmapFontTest3 = "res/fonts/bitmapFontTest3.png";
var s_bitmapFontTest4 = "res/fonts/bitmapFontTest4.png";
var s_bitmapFontTest5 = "res/fonts/bitmapFontTest5.png";
var s_konqa32 = "res/fonts/konqa32.png";
var s_konqa32_hd = "res/fonts/konqa32-hd.png";
var s_bitmapFontChinese = "res/fonts/bitmapFontChinese.png";
var s_arial16 = "res/fonts/arial16.png";
var s_larabie_16 = "res/fonts/larabie-16.png";
var s_larabie_16_hd = "res/fonts/larabie-16-hd.png";
var s_futura48 = "res/fonts/futura-48.png";
var s_arial_unicode_26 = "res/fonts/arial-unicode-26.png";
var s_bitmapFontTest_fnt = "res/fonts/bitmapFontTest.fnt";
var s_bitmapFontTest2_fnt = "res/fonts/bitmapFontTest2.fnt";
var s_bitmapFontTest3_fnt = "res/fonts/bitmapFontTest3.fnt";
var s_bitmapFontTest4_fnt = "res/fonts/bitmapFontTest4.fnt";
var s_bitmapFontTest5_fnt = "res/fonts/bitmapFontTest5.fnt";
var s_konqa32_fnt = "res/fonts/konqa32.fnt";
var s_konqa32_hd_fnt = "res/fonts/konqa32-hd.fnt";
var s_bitmapFontChinese_fnt = "res/fonts/bitmapFontChinese.fnt";
var s_arial16_fnt = "res/fonts/arial16.fnt";
var s_futura48_fnt = "res/fonts/futura-48.fnt";
var s_helvetica32_fnt = "res/fonts/helvetica-32.fnt";
var s_geneva32_fnt = "res/fonts/geneva-32.fnt";
var s_helvetica_helvetica_32_png = "res/fonts/helvetica-geneva-32.png";
var s_arial_unicode_26_fnt = "res/fonts/arial-unicode-26.fnt";
var s_markerFelt_fnt = "res/fonts/markerFelt.fnt";
var s_markerFelt_png = "res/fonts/markerFelt.png";
var s_markerFelt_hd_fnt = "res/fonts/markerFelt-hd.fnt";
var s_markerFelt_hd_png = "res/fonts/markerFelt-hd.png";
var s_larabie_16_plist = "res/fonts/larabie-16.plist";
var s_larabie_16_hd_plist = "res/fonts/larabie-16-hd.plist";
var s_tuffy_bold_italic_charmap = "res/fonts/tuffy_bold_italic-charmap.plist";
var s_tuffy_bold_italic_charmap_hd = "res/fonts/tuffy_bold_italic-charmap-hd.plist";
var s_particles = "res/Images/particles.png";
var s_particles_hd = "res/Images/particles-hd.png";
var s_texture512 = "res/Images/texture512x512.png";
var s_hole_effect_png = "res/Images/hole_effect.png";
var s_hole_stencil_png = "res/Images/hole_stencil.png";
var s_pathFog = "res/Images/Fog.png";
var s_circle_plist = "res/Images/bugs/circle.plist";
var s_circle_png = "res/Images/bugs/circle.png";
var s_extensions_background = "res/extensions/background.png";
var s_extensions_buttonBackground = "res/extensions/buttonBackground.png";
var s_extensions_button = "res/extensions/button.png";
var s_extensions_buttonHighlighted = "res/extensions/buttonHighlighted.png";
var s_extensions_ribbon = "res/extensions/ribbon.png";
var s_image_icon = "res/Images/Icon.png";
var g_resources = [
//global
{src:s_grossini_dance_atlas},
{src:s_pathFog},
{src:s_circle_plist},
{src:s_circle_png},
{src:s_texture512},
{src:s_hole_effect_png},
{src:s_hole_stencil_png},
{src:s_pathB1},
{src:s_pathB2},
{src:s_pathR1},
{src:s_pathR2},
{src:s_pathF1},
{src:s_pathF2},
{src:s_pathBlock},
{src:s_back3},
{src:s_fire},
{src:s_pathClose},
{src:s_pathGrossini},
{src:s_pathSister1},
{src:s_pathSister2},
{src:s_grossiniDance01},
{src:s_grossiniDance02},
{src:s_grossiniDance03},
{src:s_grossiniDance04},
{src:s_grossiniDance05},
{src:s_grossiniDance06},
{src:s_grossiniDance07},
{src:s_grossiniDance08},
{src:s_grossiniDance09},
{src:s_grossiniDance10},
{src:s_grossiniDance11},
{src:s_grossiniDance12},
{src:s_grossiniDance13},
{src:s_grossiniDance14},
{src:s_grossini},
{src:s_grossiniPlist},
{src:s_animations2Plist},
{src:s_grossini_blue},
{src:s_grossini_bluePlist},
{src:s_grossini_family},
{src:s_grossini_familyPlist},
{src:s_helloWorld},
{src:s_bitmapFontTest5},
{src:s_playNormal},
{src:s_playSelect},
{src:s_bitmapFontTest5_fnt}
];
var g_sprites = [
{src:s_piece},
{src:s_grossini_gray},
{src:s_grossini_blue},
{src:s_grossini_aliases},
{src:s_dragon_animation},
{src:s_ghosts},
{src:s_grossini_family},
{src:s_grossini_dance_atlas_mono},
{src:s_animationsPlist},
{src:s_grossini_grayPlist},
{src:s_grossini_bluePlist},
{src:s_grossini_aliasesPlist},
{src:s_ghostsPlist},
{src:s_grossini_familyPlist},
{src:s_tcc_issue_1_plist},
{src:s_tcc_issue_2_plist},
{src:s_tcc_issue_1},
{src:s_tcc_issue_2},
{src:s_s9s_blocks9_plist},
{src:s_s9s_blocks9}
];
var g_menu = [
{src:s_bitmapFontTest3_fnt},
{src:s_bitmapFontTest3},
{src:s_aboutNormal},
{src:s_aboutSelect},
{src:s_highNormal},
{src:s_highSelect},
{src:s_menuItem},
{src:s_sendScore},
{src:s_pressSendScore},
{src:s_fpsImages}
];
var g_touches = [
{src:s_ball},
{src:s_paddle}
];
var g_fileUtils = [
{src:"FileUtils/lookup-html5.plist"}
];
var g_s9s_blocks = [
{src:s_s9s_blocks9_plist},
{src:s_s9s_blocks9},
{src:s_blocks9},
{src:s_s9s_ui},
{src:s_s9s_ui_plist}
];
var g_opengl_resources = [
//preload shader source
{src:"res/Shaders/example_Blur.fsh"},
{src:"res/Shaders/example_ColorBars.fsh"},
{src:"res/Shaders/example_ColorBars.vsh"},
{src:"res/Shaders/example_Flower.fsh"},
{src:"res/Shaders/example_Flower.vsh"},
{src:"res/Shaders/example_Heart.fsh"},
{src:"res/Shaders/example_Heart.vsh"},
{src:"res/Shaders/example_Julia.fsh"},
{src:"res/Shaders/example_Julia.vsh"},
{src:"res/Shaders/example_Mandelbrot.fsh"},
{src:"res/Shaders/example_Mandelbrot.vsh"},
{src:"res/Shaders/example_Monjori.fsh"},
{src:"res/Shaders/example_Monjori.vsh"},
{src:"res/Shaders/example_Plasma.fsh"},
{src:"res/Shaders/example_Plasma.vsh"},
{src:"res/Shaders/example_Twist.fsh"},
{src:"res/Shaders/example_Twist.vsh"},
{src:"res/fonts/west_england-64.fnt"},
{src:"res/fonts/west_england-64.png"}
];
var g_label = [
//{src:s_atlasTest},
{src:s_bitmapFontTest},
{src:s_bitmapFontTest2},
{src:s_bitmapFontTest3},
{src:s_bitmapFontTest4},
{src:s_konqa32},
{src:s_konqa32_hd},
{src:s_bitmapFontChinese},
{src:s_arial16},
{src:s_larabie_16},
{src:s_larabie_16_hd},
{src:s_futura48},
{src:s_arial_unicode_26},
{src:s_fnTuffyBoldItalicCharmapPng},
{src:s_arrows},
{src:s_arrowsBar},
{src:s_arrows_hd},
{src:s_arrowsBar_hd},
{src:s_larabie_16_plist},
{src:s_larabie_16_hd_plist},
{src:s_tuffy_bold_italic_charmap},
{src:s_tuffy_bold_italic_charmap_hd},
{src:s_bitmapFontTest_fnt},
{src:s_bitmapFontTest2_fnt},
{src:s_bitmapFontTest3_fnt},
{src:s_bitmapFontTest4_fnt},
{src:s_konqa32_fnt},
{src:s_konqa32_hd_fnt},
{src:s_bitmapFontChinese_fnt},
{src:s_arial16_fnt},
{src:s_futura48_fnt},
{src:s_helvetica32_fnt},
{src:s_geneva32_fnt},
{src:s_helvetica_helvetica_32_png},
{src:s_arial_unicode_26_fnt},
{src:s_markerFelt_fnt},
{src:s_markerFelt_png},
{src:s_markerFelt_hd_fnt},
{src:s_markerFelt_hd_png},
{src:"res/fonts/strings.xml"}
];
var g_transitions = [
{src:s_back1},
{src:s_back2}
];
var g_box2d = [
{src:s_pathBlock}
];
var g_cocosdeshion = [
{src:"res/Sound/background.mp3"},
{src:"res/Sound/effect2.mp3"},
{src:"res/Sound/background.ogg"},
{src:"res/Sound/effect2.ogg"}
];
var g_parallax = [
{src:"res/TileMaps/orthogonal-test2.tmx"},
{src:s_fixedOrthoTest2Png},
{src:s_power},
{src:s_back}
];
var g_particle = [
{src:s_fpsImages},
{src:s_starsGrayscale},
{src:s_stars2Grayscale},
{src:s_textureModeMenuItem},
{src:s_shapeModeMenuItem},
{src:s_MovementMenuItem},
{src:s_stars1},
{src:s_stars2},
{src:s_snow},
{src:s_particles},
{src:s_particles_hd},
{src:"res/Particles/BoilingFoam.plist"},
{src:"res/Particles/BurstPipe.plist"},
{src:"res/Particles/Comet.plist"},
{src:"res/Particles/debian.plist"},
{src:"res/Particles/ExplodingRing.plist"},
{src:"res/Particles/Flower.plist"},
{src:"res/Particles/Galaxy.plist"},
{src:"res/Particles/LavaFlow.plist"},
{src:"res/Particles/Phoenix.plist"},
{src:"res/Particles/SmallSun.plist"},
{src:"res/Particles/SpinningPeas.plist"},
{src:"res/Particles/Spiral.plist"},
{src:"res/Particles/SpookyPeas.plist"},
{src:"res/Particles/TestPremultipliedAlpha.plist"},
{src:"res/Particles/Upsidedown.plist"}
];
var g_fonts = [
//@face-font for WebFonts
{fontName:"Thonburi",
src:[
{src:"res/fonts/Thonburi.eot", type:"embedded-opentype"},
{src:"res/fonts/Thonburi.ttf",type:"truetype"}]},
//{src:"res/fonts/Schwarzwald_Regular.woff", type:"woff"},
//{src:"res/fonts/Schwarzwald Regular.svg",type:"svg"}]},
{fontName:"Schwarzwald Regular",
src:[
{src:"res/fonts/Schwarzwald_Regular.eot", type:"embedded-opentype"},
{src:"res/fonts/Schwarzwald Regular.ttf",type:"truetype"}]},
{fontName:"ThonburiBold",
src:[
{src:"res/fonts/ThonburiBold.eot", type:"embedded-opentype"},
{src:"res/fonts/ThonburiBold.ttf",type:"truetype"}]},
{fontName:"Courier New",
src:[
{src:"res/fonts/Courier New.eot", type:"embedded-opentype"},
{src:"res/fonts/Courier New.ttf",type:"truetype"}]}
];
var g_extensions = [
{src:s_image_icon},
{src:s_extensions_background},
{src:s_extensions_buttonBackground},
{src:s_extensions_button},
{src:s_extensions_buttonHighlighted},
{src:s_extensions_ribbon},
//ccbi resource
{src:"res/ccb/HelloCocosBuilder.ccbi"},
{src:"res/ccb/ccb/TestAnimations.ccbi"},
{src:"res/ccb/ccb/TestAnimationsSub.ccbi"},
{src:"res/ccb/ccb/TestButtons.ccbi"},
{src:"res/ccb/ccb/TestHeader.ccbi"},
{src:"res/ccb/ccb/TestLabels.ccbi"},
{src:"res/ccb/ccb/TestMenus.ccbi"},
{src:"res/ccb/ccb/TestParticleSystems.ccbi"},
{src:"res/ccb/ccb/TestScrollViews.ccbi"},
{src:"res/ccb/ccb/TestScrollViewsContentA.ccbi"},
{src:"res/ccb/ccb/TestSprites.ccbi"},
{src:"res/ccb/ccbParticleStars.png"},
{src:"res/ccb/btn-test-0.png"},
{src:"res/ccb/animated-grossini.png"},
{src:"res/ccb/btn-a-0.png"},
{src:"res/ccb/btn-a-1.png"},
{src:"res/ccb/btn-a-2.png"},
{src:"res/ccb/btn-b-0.png"},
{src:"res/ccb/btn-b-1.png"},
{src:"res/ccb/btn-b-2.png"},
{src:"res/ccb/btn-back-0.png"},
{src:"res/ccb/btn-back-1.png"},
{src:"res/ccb/btn-test-0.png"},
{src:"res/ccb/btn-test-1.png"},
{src:"res/ccb/btn-test-2.png"},
{src:"res/ccb/burst.png"},
{src:"res/ccb/flower.jpg"},
{src:"res/ccb/grossini-generic.png"},
{src:"res/ccb/jungle.png"},
{src:"res/ccb/jungle-left.png"},
{src:"res/ccb/jungle-right.png"},
{src:"res/ccb/logo.png"},
{src:"res/ccb/logo-icon.png"},
{src:"res/ccb/markerfelt24shadow.png"},
{src:"res/ccb/particle-fire.png"},
{src:"res/ccb/particle-smoke.png"},
{src:"res/ccb/particle-snow.png"},
{src:"res/ccb/particle-stars.png"},
{src:"res/ccb/scale-9-demo.png"},
{src:"res/extensions/green_edit.png"},
{src:"res/extensions/orange_edit.png"},
{src:"res/extensions/yellow_edit.png"},
{src:"res/extensions/switch-mask.png"},
{src:"res/extensions/switch-on.png"},
{src:"res/extensions/switch-off.png"},
{src:"res/extensions/switch-thumb.png"},
{src:"res/extensions/sliderProgress.png"},
{src:"res/extensions/sliderProgress2.png"},
{src:"res/extensions/sliderThumb.png"},
{src:"res/extensions/sliderTrack.png"},
{src:"res/extensions/sliderTrack2.png"},
{src:"res/extensions/stepper-minus.png"},
{src:"res/extensions/stepper-plus.png"},
{src:"res/extensions/potentiometerButton.png"},
{src:"res/extensions/potentiometerProgress.png"},
{src:"res/extensions/potentiometerTrack.png"},
{src:"res/extensions/CCControlColourPickerSpriteSheet.plist"},
{src:"res/extensions/CCControlColourPickerSpriteSheet.png"},
{src:"res/ccb/markerfelt24shadow.fnt"},
{src:"res/ccb/grossini-generic.plist"},
{src:"res/ccb/animated-grossini.plist"},
//Armature
{src:s_Cowboy_json },
{src:s_Cowboy_plist},
{src:s_Cowboy_png},
{src:s_cyborg_plist },
{src:s_cyborg_png },
{src:s_cyborg_xml },
{src:s_Dragon_plist },
{src:s_Dragon_png },
{src:s_Dragon_xml },
{src:s_knight_plist },
{src:s_knight_png },
{src:s_knight_xml },
{src:s_robot_plist },
{src:s_robot_png },
{src:s_robot_xml },
{src:s_weapon_plist },
{src:s_weapon_png },
{src:s_weapon_xml },
{src:"res/Particles/SmallSun.plist"}
];
var g_performace = [
{src:"res/animations/crystals.plist"},
{src:"res/animations/crystals.png"},
{src:"res/Images/fps_images.png"},
{src:"res/Images/spritesheet1.png"},
{src:"res/Images/sprites_test/sprite-0-0.png"},
{src:"res/Images/sprites_test/sprite-0-1.png"},
{src:"res/Images/sprites_test/sprite-0-2.png"},
{src:"res/Images/sprites_test/sprite-0-3.png"},
{src:"res/Images/sprites_test/sprite-0-4.png"},
{src:"res/Images/sprites_test/sprite-0-5.png"},
{src:"res/Images/sprites_test/sprite-0-6.png"},
{src:"res/Images/sprites_test/sprite-0-7.png"},
{src:"res/Images/sprites_test/sprite-1-0.png"},
{src:"res/Images/sprites_test/sprite-1-1.png"},
{src:"res/Images/sprites_test/sprite-1-2.png"},
{src:"res/Images/sprites_test/sprite-1-3.png"},
{src:"res/Images/sprites_test/sprite-1-4.png"},
{src:"res/Images/sprites_test/sprite-1-5.png"},
{src:"res/Images/sprites_test/sprite-1-6.png"},
{src:"res/Images/sprites_test/sprite-1-7.png"},
{src:"res/Images/sprites_test/sprite-2-0.png"},
{src:"res/Images/sprites_test/sprite-2-1.png"},
{src:"res/Images/sprites_test/sprite-2-2.png"},
{src:"res/Images/sprites_test/sprite-2-3.png"},
{src:"res/Images/sprites_test/sprite-2-4.png"},
{src:"res/Images/sprites_test/sprite-2-5.png"},
{src:"res/Images/sprites_test/sprite-2-6.png"},
{src:"res/Images/sprites_test/sprite-2-7.png"},
{src:"res/Images/sprites_test/sprite-3-0.png"},
{src:"res/Images/sprites_test/sprite-3-1.png"},
{src:"res/Images/sprites_test/sprite-3-2.png"},
{src:"res/Images/sprites_test/sprite-3-3.png"},
{src:"res/Images/sprites_test/sprite-3-4.png"},
{src:"res/Images/sprites_test/sprite-3-5.png"},
{src:"res/Images/sprites_test/sprite-3-6.png"},
{src:"res/Images/sprites_test/sprite-3-7.png"},
{src:"res/Images/sprites_test/sprite-4-0.png"},
{src:"res/Images/sprites_test/sprite-4-1.png"},
{src:"res/Images/sprites_test/sprite-4-2.png"},
{src:"res/Images/sprites_test/sprite-4-3.png"},
{src:"res/Images/sprites_test/sprite-4-4.png"},
{src:"res/Images/sprites_test/sprite-4-5.png"},
{src:"res/Images/sprites_test/sprite-4-6.png"},
{src:"res/Images/sprites_test/sprite-4-7.png"},
{src:"res/Images/sprites_test/sprite-5-0.png"},
{src:"res/Images/sprites_test/sprite-5-1.png"},
{src:"res/Images/sprites_test/sprite-5-2.png"},
{src:"res/Images/sprites_test/sprite-5-3.png"},
{src:"res/Images/sprites_test/sprite-5-4.png"},
{src:"res/Images/sprites_test/sprite-5-5.png"},
{src:"res/Images/sprites_test/sprite-5-6.png"},
{src:"res/Images/sprites_test/sprite-5-7.png"},
{src:"res/Images/sprites_test/sprite-6-0.png"},
{src:"res/Images/sprites_test/sprite-6-1.png"},
{src:"res/Images/sprites_test/sprite-6-2.png"},
{src:"res/Images/sprites_test/sprite-6-3.png"},
{src:"res/Images/sprites_test/sprite-6-4.png"},
{src:"res/Images/sprites_test/sprite-6-5.png"},
{src:"res/Images/sprites_test/sprite-6-6.png"},
{src:"res/Images/sprites_test/sprite-6-7.png"},
{src:"res/Images/sprites_test/sprite-7-0.png"},
{src:"res/Images/sprites_test/sprite-7-1.png"},
{src:"res/Images/sprites_test/sprite-7-2.png"},
{src:"res/Images/sprites_test/sprite-7-3.png"},
{src:"res/Images/sprites_test/sprite-7-4.png"},
{src:"res/Images/sprites_test/sprite-7-5.png"},
{src:"res/Images/sprites_test/sprite-7-6.png"},
{src:"res/Images/sprites_test/sprite-7-7.png"}
];
var g_tilemaps = [
//image
{src:s_fixedOrthoTest2Png},
{src:s_hexaTilesPng},
{src:s_isoTestPng},
{src:s_isoTest2Png},
{src:s_isoPng},
{src:s_orthoTest1BwPng},
{src:s_orthoTest1Png},
{src:s_tilesHdPng},
{src:s_tmwDesertSpacingHdPng},
{src:s_tmwDesertSpacingPng},
{src:s_tilesPng},
{src:s_tileISOOffsetPng},
{src:s_tileISOOffsetTmx},
{src:"res/TileMaps/ortho-test2.png"},
//tmx
{src:"res/TileMaps/orthogonal-test1.tmx"},
{src:"res/TileMaps/orthogonal-test1.tsx"},
{src:"res/TileMaps/orthogonal-test2.tmx"},
{src:"res/TileMaps/orthogonal-test3.tmx"},
{src:"res/TileMaps/orthogonal-test4.tmx"},
{src:"res/TileMaps/orthogonal-test4-hd.tmx"},
{src:"res/TileMaps/orthogonal-test5.tmx"},
{src:"res/TileMaps/orthogonal-test6.tmx"},
{src:"res/TileMaps/orthogonal-test6-hd.tmx"},
{src:"res/TileMaps/hexa-test.tmx"},
{src:"res/TileMaps/iso-test.tmx"},
{src:"res/TileMaps/iso-test1.tmx"},
{src:"res/TileMaps/iso-test2.tmx"},
{src:"res/TileMaps/iso-test2-uncompressed.tmx"},
{src:"res/TileMaps/ortho-objects.tmx"},
{src:"res/TileMaps/iso-test-objectgroup.tmx"},
{src:"res/TileMaps/iso-test-zorder.tmx"},
{src:"res/TileMaps/orthogonal-test-zorder.tmx"},
{src:"res/TileMaps/iso-test-vertexz.tmx"},
{src:"res/TileMaps/orthogonal-test-vertexz.tmx"},
{src:"res/TileMaps/iso-test-movelayer.tmx"},
{src:"res/TileMaps/orthogonal-test-movelayer.tmx"},
{src:"res/TileMaps/iso-test-bug787.tmx"},
{src:"res/TileMaps/test-object-layer.tmx"},
{src:"res/TileMaps/ortho-tile-property.tmx"},
{src:"res/TileMaps/ortho-rotation-test.tmx"}
]; |
import * as types from '../../constants/CompetitionDetailsActionTypes'
export const competition = {
requested(slug) {
return {
type: types.LOAD_COMPETITION_STARTED,
meta: {
slug
}
}
},
successful(response, slug) {
return {
type: types.LOAD_COMPETITION_FINISHED,
meta: {
slug
},
payload: response
}
},
failure(error) {
return {
type: types.LOAD_COMPETITION_FAILED,
payload: error
}
}
}
export const metadata = {
requested(slug) {
return {
type: types.LOAD_COMPETITION_METADATA_STARTED,
meta: {
slug
}
}
},
successful(response, slug) {
return {
type: types.LOAD_COMPETITION_METADATA_FINISHED,
meta: {
slug
},
payload: response
}
},
failure(error) {
return {
type: types.LOAD_COMPETITION_METADATA_FAILED,
payload: error
}
}
}
export const results = {
requested(slug, filter) {
return {
type: types.LOAD_COMPETITION_RESULTS_STARTED,
meta: {
slug,
filter
}
}
},
successful(response, slug, filter) {
return {
type: types.LOAD_COMPETITION_RESULTS_FINISHED,
meta: {
slug,
filter
},
payload: response
}
},
failure(error) {
return {
type: types.LOAD_COMPETITION_RESULTS_FAILED,
payload: error
}
}
}
export function ageGroupSelected(ageGroup, on) {
return {
type: types.COMPETITION_DETAILS_AGE_GROUP_SELECTED,
payload: {
ageGroup,
on
}
}
}
export function disciplineSelected(discipline, on) {
return {
type: types.COMPETITION_DETAILS_DISCIPLINE_SELECTED,
payload: {
discipline,
on
}
}
}
export function clubSelected(club, on) {
return {
type: types.COMPETITION_DETAILS_CLUB_SELECTED,
payload: {
club,
on
}
}
}
export function resetData(slug) {
return {
type: types.COMPETITION_DETAILS_RESET_DATA,
meta: {
slug
}
}
}
export const loadCompetitionAndDetails = (slug, filter) => ({
type: types.LOAD_COMPETITION_AND_DETAILS,
meta: {
slug,
filter
}
})
|
version https://git-lfs.github.com/spec/v1
oid sha256:e9b216496ddea71c7650fffd5673108b60de11fef09cbd5db42b5a2493c5160d
size 16675
|
/**
* Bootstrap
* (sails.config.bootstrap)
*
* An asynchronous bootstrap function that runs before your Sails app gets lifted.
* This gives you an opportunity to set up your data model, run jobs, or perform some special logic.
*
* For more information on bootstrapping your app, check out:
* http://sailsjs.org/#/documentation/reference/sails.config/sails.config.bootstrap.html
*/
module.exports.bootstrap = function(cb) {
sails.services.passport.loadStrategies();
// It's very important to trigger this callback method when you are finished
// with the bootstrap! (otherwise your server will never lift, since it's waiting on the bootstrap)
cb();
};
|
'use strict';
import curry from 'lodash/curry';
import documentConverter from './documentConverter';
import * as assert from './../utils/variableValidation';
import { ObjectID } from 'mongodb';
/**
* An abstract class for any data models in the system.
*
* @param client { MongoClient } Expected to be either a MongoClient object or a mock.
* @param url { string } The connection string to the Mongo database.
* @param collectionName { string } The name of the collection the intended model is to use.
* @returns { Object } The model object.
*/
function MongoConnector(client, url, collectionName, model) {
/**
* Processes the document and makes sure that it conforms to the given mode.
* normalizeDocument : Object -> Object
*
* @param document { Object } The document object to normalize.
* @return { Object } An object containing either the normalized document, or errors.
*/
const normalizeDocument = documentConverter(model);
/**
* Processes actions against the model.
* processAction : Function -> Promise
*
* @param action { Function } The action to perform on the model.
* @return { Promise } The promise object generated for the action.
*/
function processAction(action) {
return client.connect(
url
).then(db => {
const result = action(db);
return {db, result};
}).then(p => {
p.db.close();
return p.result;
});
}
/**
* Counts the number of documents that match a given query.
* count : Object -> Promise
*
* @param query { Object } The query to use to find the documents we want to count.
* @return { Promise } The promise object created after the count.
*/
function count(query) {
return assert.isObjectOrUndefined(query)
? processAction(db => db.collection(collectionName).count(query))
: Promise.reject('count: Provided query must be an object or undefined');
}
/**
* Deletes a number of documents based on the given query.
* deleteMany : Object -> Promise
*
* @param query { Object } The query to use to find the documents to delete.
* @return { Promise } The promise object created for the deletion.
*/
function deleteMany(query) {
return assert.isPopulatedObject(query)
? processAction(db => db.collection(collectionName).deleteMany(query))
: Promise.reject('deleteMany: You must provide a valid query for deleteMany.');
}
/**
* Deletes the first instance of the matched documents based on the given query.
* deleteOne : Object -> Promise
*
* @param query { Object } The query to use to find the document to delete.
* @return { Promise } The promise object created for the deletion.
*/
function deleteOne(query) {
return assert.isPopulatedObject(query)
? processAction(db => db.collection(collectionName).deleteOne(query))
: Promise.reject('deleteOne: You must provide a valid query for deleteOne.');
}
/**
* Finds the first instance of a document that matches the provided document id. This document
* id is the one assigned to the document by the mongo system.
* findOneById : String -> Promise
*
* @param id { String } The document id to use for the query.
* @return { Promise } The promise object created for the document found.
*/
function deleteOneById(id) {
return assert.isType('string', id)
? processAction(db => db.collection(collectionName).deleteOne({ _id: new ObjectID(id) }))
: Promise.reject('deleteOneById: You must provide a valid id string.');
}
/**
* Finds any number of documents that match a given query.
* find : Object -> Promise
*
* @param query ( Object } The query to use to find the documents.
* @return { Promise } The promise object created for the documents found.
*/
function find(query) {
return assert.isObjectOrUndefined(query)
? processAction(db => db.collection(collectionName).find(query).toArray())
: Promise.reject('find: You must provide a valid search query.');
}
/**
* Finds the first instance of a document that matches a given query.
* findOne : Object -> Promise
*
* @param query ( Object } The query to use to find the document.
* @return { Promise } The promise object created for the document found.
*/
function findOne(query) {
return assert.isObjectOrUndefined(query)
? processAction(db => db.collection(collectionName).findOne(query))
: Promise.reject('findOne: You must provide a valid search query.');
}
/**
* Finds the first instance of a document that matches the provided document id. This document
* id is the one assigned to the document by the mongo system.
* findOneById : String -> Promise
*
* @param id { String } The document id to use for the query.
* @return { Promise } The promise object created for the document found.
*/
function findOneById(id) {
return assert.isType('string', id)
? processAction(db => db.collection(collectionName).findOne({ _id: new ObjectID(id) }))
: Promise.reject('findOneById: You must provide a valid id string.');
}
/**
* Inserts a document into the collection.
* insertOne : Object -> Promise
*
* @param document { Object } The document to insert.
* @return { Promise } The promise object created after the insertion.
*/
function insertOne(document) {
const nDocument = normalizeDocument(document);
if (nDocument.errors.length > 0)
return Promise.reject(nDocument);
return processAction(db => db.collection(collectionName).insertOne(nDocument.document));
}
/**
* Inserts many documents into the collection.
* insertMany : Array<Object> : Promise
*
* @param documents { Array<Object> } The documents to insert.
* @return { Promise } The promise object created after the insertions.
*/
function insertMany(documents) {
if (! assert.arePopulatedObjects(documents))
return Promise.reject('insertMany: All documents in the array must be populated objects');
const nDocuments = documents.map(doc => normalizeDocument(doc));
if (nDocuments.some(doc => doc.errors.length > 0))
return Promise.reject(nDocuments);
return processAction(db => db.collection(collectionName).insertMany(documents));
}
/**
* Replaces a single document with a new document.
* replaceOne : Object -> Object -> Promise
*
* @param query { Object } The query to use to determine which document to replace.
* @param document { Object } The replacement document.
* @return { Promise } The promise created for this transaction.
*/
function replaceOne(query, document) {
const nDocument = normalizeDocument(document);
if (nDocument.errors.length > 0)
return Promise.reject(nDocument);
return processAction(db => db.collection(collectionName).replaceOne(query, nDocument.document));
}
/* TODO: Add updateOne method to make PATCH requests easier */
return {
count,
deleteMany,
deleteOne,
deleteOneById,
find,
findOne,
findOneById,
insertOne,
insertMany,
replaceOne
};
}
export default curry(MongoConnector);
|
const React = require('react/addons');
const PureRenderMixin = React.addons.PureRenderMixin;
const Switch = React.createClass({
mixins: [PureRenderMixin],
propTypes: {
label: React.PropTypes.node,
style: React.PropTypes.object,
},
render: function() {
return (
<p>test</p>
);
},
});
module.exports = Switch;
|
require("colors");
var ScannerSoap = require("./soap");
var fs = require("fs");
var ip = '192.168.40.37';
var jpg_filepath = "./test.jpeg";
ScannerSoap.Scan(ip, jpg_filepath, function(err) {
if(err) return console.log(err.red);
console.log("DONE");
});
//var client = new ScannerSoap(ip, function(err){
// if(err) return console.log(err.red);
//
// client.GetScannerStatus(function (err, status) {
// if (err) throw err;
// var state = status["ScannerState"];
// if (state === "Idle") {
//
// client.CreateJob(function (err, job) {
// if (err) throw err;
// var jobId = job.JobId;
// var jobToken = job.JobToken;
// if (fs.existsSync(jpg_filepath))
// fs.unlinkSync(jpg_filepath);
//
// client.RetrieveImage(jobId, jobToken, jpg_filepath, function(err){
// if(err) return console.log(err.red);
// console.log("DONE");
// });
// });
//
// } else {
// return console.log("Scanner in:", state.red);
// }
// });
//});
|
var gulp = require('gulp');
var sass = require('gulp-sass');
gulp.task('styles', function() {
gulp.src('app/sass/application.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('assets/css/'))
});
//Watch task
gulp.task('default',function() {
gulp.watch('app/sass/application.scss',['styles']);
gulp.watch('app/sass/**/*.scss',['styles']);
gulp.watch('app/components/**/*.scss',['styles']);
}); |
/*
* Clearest Framework
* Provided under MIT License.
* Copyright (c) 2012-2015 Illya Kokshenev <sou@illya.com.br>
*/
"use strict";
var runtime = require("../../../runtime");
var helper = require("./helper"), compile=helper.compile;
if (typeof document !== 'undefined') { // simple trick to prevent this running by mocha from NodeJs
describe("IT: in-browser compilation (necessary for demos and other ITs)", function () {
var run , app;
before(function(){ run= helper.before(); app = run.app; });
after(function(){ helper.after(run)});
it("works", function () {
return run(compile("Hello World")).then(function () {
expect(run.container.innerHTML).to.be.equal("Hello World");
});
});
it("dependencies are resolved", function () {
return run(compile('<t:require rt="runtime"/><t:get text="rt.promise.resolve(\'Hello World\')"><t:get text="text"/></t:get>',{
runtime: runtime
})).then(function () {
expect(run.container.innerHTML).to.be.equal("Hello World");
});
});
});
} |
'use strict';
describe('Controller: MainCtrl', function () {
// load the controller's module
beforeEach(module('durfeeswipeApp'));
var MainCtrl,
scope;
// Initialize the controller and a mock scope
beforeEach(inject(function ($controller, $rootScope) {
scope = $rootScope.$new();
MainCtrl = $controller('MainCtrl', {
$scope: scope
});
}));
describe('Initialization', function () {
it('should attach a list of awesomeThings to the scope', function () {
expect(scope.awesomeThings.length).toBe(3);
});
it('should attach a data persistence service to the scope', function () {
expect(scope.srvc).not.toEqual(null);
expect(scope.srvc.model).not.toEqual(null);
});
it('should attach user search input to the scope', function () {
expect(scope.srvc.model.searchInput).not.toEqual(null);
});
it('should attach a shopping bag to the scope', function () {
expect(scope.srvc.model.shoppingBag).not.toEqual(null);
expect(scope.srvc.model.shoppingBag.totalPrice).toEqual(0);
expect(scope.srvc.model.shoppingBag.remainingCredit(scope.srvc.model)).toEqual(8.00);
expect(scope.srvc.model.shoppingBag.items).toEqual([]);
});
});
describe('Shopping Bag functions', function () {
var newItem = { name: 'd', price: 4.00 };
it('should find items in lists', function () {
var bag = [
{ name: 'a', price: 3.00 },
{ name: 'b', price: 2.39 }
];
var itemName = 'b';
var invalidItemName = 'c';
expect(scope.findItem(itemName, bag)).toEqual(1);
expect(scope.findItem(invalidItemName, bag)).toEqual(-1);
});
it('should add items to the bag', function () {
scope.addItemToBag(newItem);
var newItemIndex = scope.findItem(newItem.name, scope.srvc.model.shoppingBag.items);
expect(newItemIndex).not.toEqual(-1);
expect(scope.srvc.model.shoppingBag.items[newItemIndex].count).toEqual(1);
scope.addItemToBag(newItem);
expect(scope.srvc.model.shoppingBag.items[newItemIndex].count).toEqual(2);
});
it('should remove items from the bag', function () {
scope.addItemToBag(newItem);
var newItemIndex = scope.findItem(newItem.name, scope.srvc.model.shoppingBag.items);
expect(newItemIndex).not.toEqual(-1);
expect(scope.srvc.model.shoppingBag.items[newItemIndex].count).toEqual(1);
scope.removeItemFromBag(newItem);
var newItemIndex = scope.findItem(newItem.name, scope.srvc.model.shoppingBag.items);
expect(newItemIndex).toEqual(-1);
});
it('should update total price of bag when items are added / removed', function () {
expect(scope.srvc.model.shoppingBag.totalPrice).toEqual(0);
scope.addItemToBag(newItem);
expect(scope.srvc.model.shoppingBag.totalPrice).toEqual(4.00);
scope.removeItemFromBag(newItem);
expect(scope.srvc.model.shoppingBag.totalPrice).toEqual(0);
});
});
describe('Suggestions', function () {
it('should be toggle-able', function () {
expect(scope.srvc.model.suggestionsLabel).toEqual('Show Suggestions');
scope.toggleSuggestions();
expect(scope.srvc.model.suggestionsLabel).toEqual('Hide Suggestions');
expect(scope.displaySuggestions()).toBe(true);
});
it('should suggest items priced under remaining credit', function () {
var aboveCreditItem = { name: 'aboveCredit', price: 10.00 };
var underCreditItem1 = { name: 'underCredit1', price: 4.00 };
var underCreditItem2 = { name: 'underCredit2', price: 2.00 };
scope.productsSrvc.products.push(aboveCreditItem);
scope.productsSrvc.products.push(underCreditItem1);
scope.productsSrvc.products.push(underCreditItem2);
var productsSuggested = scope.productsUnderLimit();
expect(scope.findItem('aboveCredit', productsSuggested)).toEqual(-1);
expect(scope.findItem('underCredit1', productsSuggested)).not.toEqual(-1);
expect(scope.findItem('underCredit2', productsSuggested)).not.toEqual(-1);
});
});
describe('Item Lookup', function () {
beforeEach(function () {
var itemInProducts = { name: 'itemInProducts', price: 10.00 };
var itemNotInProducts = { name: 'itemNotInProducts', price: 10.00 };
scope.productsSrvc.products.push(itemInProducts);
});
it('should add item to bag if found in products', function () {
scope.srvc.model.searchInput = 'itemInProducts';
scope.lookUpItem();
expect(scope.findItem('itemInProducts', scope.srvc.model.shoppingBag.items)).not.toEqual(-1);
expect(scope.findItem('itemNotInProducts', scope.srvc.model.shoppingBag.items)).toEqual(-1);
});
it('should add an alert if item not found in products', function () {
scope.srvc.model.searchInput = 'itemNotInProducts';
scope.lookUpItem();
expect(scope.alerts.length).toEqual(1);
});
it('should show suggestions if item added to bag for the first time', function () {
expect(scope.srvc.model.suggestionsLabel).toEqual('Show Suggestions');
scope.srvc.model.searchInput = 'itemInProducts';
scope.lookUpItem();
expect(scope.srvc.model.suggestionsLabel).toEqual('Hide Suggestions');
});
it('should not show suggestions if suggestions toggled before item added for the first time', function () {
scope.toggleSuggestions();
scope.toggleSuggestions();
scope.srvc.model.searchInput = 'itemInProducts';
scope.lookUpItem();
expect(scope.srvc.model.suggestionsLabel).toEqual('Show Suggestions');
});
it('should clear the search input box', function () {
scope.srvc.model.searchInput = 'dummy text';
scope.lookUpItem();
expect(scope.srvc.model.searchInput).toEqual('');
});
});
describe('Alerts', function () {
it('should be create-able', function () {
scope.addAlert('danger', 'dummy danger message');
expect(scope.alerts.length).toEqual(1);
scope.addAlert('success', 'dummy success message');
expect(scope.alerts.length).toEqual(2);
scope.addAlert('', 'dummy notify message');
expect(scope.alerts.length).toEqual(3);
});
});
});
|
const defaultLogoutState = {
loggingOut: false,
loginSuccess: false
}
export default function logout(state=defaultLogoutState, action) {
switch(action.type) {
case 'LOGOUT_ATTEMPT':
return Object.assign({}, state, {
loggingOut: true,
loginSuccess: false
})
case 'LOGOUT_SUCCESS':
return Object.assign({}, state, {
logginOut: false,
loginSuccess: true
})
default:
return state;
}
} |
'use strict';
var q = require('q');
var driver = require('../../driver/index');
//var logger = browser.getLogger('Deployments.Actions');
var css = require('selenium-webdriver').By.css;
var async = require('async');
/**
* Deployment Actions menu
* @constructor
*/
var Actions = function() {
/**
* Open Menu and select one option
* @param {element} actionsHook - element container which include the actions elements
* @param {string} action - option name to choose
* @returns {promise}
*/
this.selectAction = function(actionsHook, action) {
var deferred = q.defer();
// find the multi select menu element
actionsHook.findElement(css('.multiSelectMenu')).then(function(actionMenu){
// now we click on the menu to open it
actionMenu.click().then(function(){
// selection all the options inside the menu to search for the select option
actionMenu.findElements(css('ul li')).then(function(list){
// run over the options and looking for the right match to select
async.each(list, function(option, callback){
// get the text of each option to compere it to the selected option
option.getText().then(function(actionText){
// if we have a match
if(actionText === action) {
// click on the option to mark it as selected
option.click().then(function(){
callback();
});
}
else {
callback();
}
});
}, function(){
// async complete the running of all the option
deferred.resolve();
});
});
});
});
return deferred.promise;
};
/**
* Clicking on enabled play action button
* @param {element} actionsHook - element container which include the actions elements
* @returns {promise}
*/
this.playAction = function(actionsHook) {
var deferred = q.defer();
// wait for the play button to be enabled
driver.get().wait(function(){
// when the button become enabled it returns the element
return actionsHook.findElement(css('i.deployment-play.play')).then(function(playButton){
return playButton;
});
}, 10000).then(function(playButton){
// after the element is found as enabled we can click on it
playButton.click().then(function(){
deferred.resolve(null);
});
}).thenCatch(function(){
// in case the time is out without enabled play button
deferred.resolve('deployment-play undetected!');
});
return deferred.promise;
};
/**
* Clicking on buttons in confirmation dialog which become open after clicking on play button
* @param {string} action - name of action to choose ( Cancel / Confirm / etc.. )
* @returns {promise}
*/
this.playConfirmation = function(action) {
var deferred = q.defer();
// find all the buttons on the confirmation dialog
driver.get().findElements(css('#confirmationDialogContainer .confirmationButtons button')).then(function(confirmButtons){
// run over all the buttons and search for the right match
async.each(confirmButtons, function(button, callback){
button.getText().then(function(buttonText){
// if we have h match
if(buttonText === action) {
// click on the button
button.click().then(function(){
callback();
});
}
else {
callback();
}
});
}, function(){
// async complete the running of all the buttons
deferred.resolve();
});
});
return deferred.promise;
};
};
module.exports = Actions;
|
define([
'angular',
//
'angular-ui-sortable',
'../repos'
], function (angular) {
'use strict';
var exports = angular.module('quanban-dirs', ['ui.sortable', 'quanban-repos']);
return exports;
}); |
/**
* File: entry.js
* Author: liby99
* Date:
*
* Default Entry point of keeling-js
*
* Note: you can move this into your own directory and modify it for
* your own purpose.
*/
// Require the library
var keeling = require("keeling-js");
// Create and start server
var server = keeling.createServer();
server.start();
|
const markdownDocumentationLinkBuilder = (component, type = 'components') => `
##### For design and usage information check out the [documentation.](https://sparkdesignsystem.com/using-spark/${type}/${component})
`;
export { markdownDocumentationLinkBuilder };
|
(function() {
"use strict";
angular
.module('ebikko.email-record')
.controller('EmailRecordController', ['$mdDialog', '$mdToast', 'emailRecordService', 'emailValidator', EmailRecordController]);
function EmailRecordController($mdDialog, $mdToast, emailRecordService, emailValidator) {
var self = this;
self.cancel = cancel;
self.email = {
email_as_content: true,
node_id: this.nodeId,
title: this.title,
file_name: this.file_name
};
self.send = send;
function cancel() {
$mdDialog.cancel();
}
function send() {
self.errors = emailValidator.validate(self.email).errors;
if (self.errors.length === 0) {
self.saving = true;
// The copy prevents the user seeing the '<br/>'s in the text box
var emailCopy = angular.copy(self.email);
emailCopy.message = emailCopy.message.replace("\n", "<br/>");
emailRecordService.emailRecord(emailCopy).then(function(response) {
$mdDialog.hide();
$mdToast.show(
$mdToast.simple()
.content('Email sent successfully')
.position('top left')
.hideDelay(3000)
);
self.saving = false;
}, function(response) {
self.saving = false;
self.errors = [response.data.data.responsemsg];
});
}
}
}
})(); |
var db = require('./db')
//the whole api: put get del batch createReadStream approximateSize on
var name = process.argv[2];
db.sublevel('messages-by-author').createReadStream({
gt: name + '!',
lt: name + '!~'
})
.on('data', function(kv){
db.sublevel('messages').get(kv.value, function(err, value){
console.log(value.message);
});
});
|
'use strict';
describe('Controller: MainCtrl', function () {
// load the controller's module
beforeEach(module('zebraApp'));
var MainCtrl,
scope;
// Initialize the controller and a mock scope
beforeEach(inject(function ($controller, $rootScope) {
scope = $rootScope.$new();
MainCtrl = $controller('MainCtrl', {
$scope: scope
});
}));
it('should attach a list of awesomeThings to the scope', function () {
expect(scope.awesomeThings.length).toBe(3);
});
});
|
var exceptions = require('./exceptions');
var stashResult = function(resp){
var json = {};
var callback = function(){};
json['function'] = 'stash_result';
json['args'] = resp.params;
json['callback'] = callback;
resp.send(json);
};
var source = function(resp,callback){
var json = {};
json['function'] = 'source';
json['args'] = '';
json['callback'] = callback;
resp.send(json);
};
var getData = function(resp,callback){
var json = {};
json['function'] = 'get_data';
json['args'] = '';
json['callback'] = callback;
resp.send(json);
};
var Store = function(){
this.putValue = function(resp,callback){
var json = this.formatJson('put_value',resp.params,callback);
resp.send(json);
};
this.getValue = function(resp,callback){
var json = this.formatJson('get_value',resp.params,callback);
resp.send(json);
};
this.putData = function(resp,callback){
var json = this.formatJson('put_data',resp.params,callback);
resp.send(json);
};
this.getData = function(resp,callback){
var json = this.formatJson('get_data',resp.params,callback);
resp.send(json);
};
this.deleteData = function(resp,callback){
var json = this.formatJson('delete_data',resp.params,callback);
resp.send(json);
};
this.formatJson = function(method,args,callback){
var json = {};
json['kls'] = 'Store';
json['function'] = method;
json['args'] = args;
json['callback'] = callback;
json['route'] = 'request';
return json;
};
};
exports.stashResult = stashResult;
exports.getData = getData;
exports.source = source;
module.exports.Store = new Store();
module.exports.Exception = exceptions.Exception;
module.exports.LoginException = exceptions.LoginException;
module.exports.LogoffException = exceptions.LogoffException;
module.exports.ServerTimeoutException = exceptions.ServerTimeoutException;
module.exports.ServerErrorException = exceptions.ServerErrorException;
module.exports.ObjectConflictErrorException = exceptions.ObjectConflictErrorException; |
var searchData=
[
['compilable',['Compilable',['../classCompilable.html',1,'']]],
['conditions',['Conditions',['/home/shannaracat/dev/gitlab/workspace_oss/LostInCompilation/docs/doxygen/shacat/html/classutil_1_1Conditions.html',1,'util']]],
['consoleappender',['ConsoleAppender',['../classConsoleAppender.html',1,'']]],
['converts',['Converts',['/home/shannaracat/dev/gitlab/workspace_oss/LostInCompilation/docs/doxygen/shacat/html/classutil_1_1Converts.html',1,'util']]]
];
|
var restify = require('restify');
var halfred = require('halfred');
var hal = require('hal');
halfred.enableValidation();
var fs = require('fs');
var data = JSON.parse(fs.readFileSync('statuscodes.json', 'utf8'));
function getPaginatedItems(items, offset) {
//var page = pageNumber || 1;
var per_page = 10;
//var offset = (page - 1) * per_page,
var paginatedItems = items.slice(offset, offset + per_page);
return {
//page: page,
//per_page: per_page,
total: items.length,
//total_pages: Math.ceil(items.length / per_page),
data: paginatedItems
};
}
function respond(req, res, next) {
var item = data.filter(function(item) {
return item.code == req.params.id;
});
if (item.length == 0) {
res.send(404);
return next();
}
var halItem = new hal.Resource(item[0], "/" + item[0].code);
halItem.link(new hal.Link("index", "/"));
var resource = halfred.parse(halItem);
var issues = resource.validationIssues();
if (issues.length) {
res.send(issues);
} else {
res.send(halItem);
}
next();
}
function home(req, res, next) {
var offset = 0;
if (req.query.offset) {
offset = parseInt(req.query.offset, 10);
}
var pagedData = getPaginatedItems(data, offset);
var halPagedData = [];
pagedData.data.forEach(function logArrayElements(element, index, array) {
halPagedData.push(new hal.Resource(element, "/" + element.code));
});
var resource = new hal.Resource({
total: pagedData.total
}, '/');
if (offset >= 0 && offset <= pagedData.total - 20){
resource.link(new hal.Link("next", "/?offset="+(offset+10)));
}
if (offset >= 10 && offset <= pagedData.total - 10){
resource.link(new hal.Link("prev", "/?offset="+(offset-10)));
}
resource.embed("statuses", halPagedData);
res.send(resource);
next();
}
var server = restify.createServer({
formatters: {
'application/hal+json': restify.formatters['application/json; q=0.4']
}
});
server.use(restify.queryParser());
server.use(restify.CORS());
server.get('/', home);
server.get('/:id', respond);
server.listen(8080, function() {
console.log('%s listening at %s', server.name, server.url);
}); |
var gulp = require('gulp');
var uglify = require('gulp-uglify');
gulp.task('minify', function() {
gulp.src(['js/**/*.js', '!js/**/*.min.js'])
.pipe(uglify())
.pipe(gulp.dest('dest'))
}); |
const path = require('canonical-path');
const fs = require('fs');
const glob = require('glob');
var Minimatch = require("minimatch").Minimatch;
/**
* @dgProcessor readFilesProcessor
*
* @description Read documents from files and add them to the docs collection
*
* @property {string} basePath The path against which all paths to files are resolved
*
* @property {Array.<String|Object>} sourceFiles A collection of info about what files to read.
* If the item is a string then it is treated as a glob pattern. If the item is an object then
* it can have the following properties:
*
* * `basePath` {string} the `relativeFile` property of the generated docs will be relative
* to this path. This path is relative to `readFileProcessor.basePath`. Defaults to `.`.
* * `include` {string|Array<string>} glob pattern(s) of files to include (relative to `readFileProcessor.basePath`)
* * `exclude` {string|Array<string>} glob pattern(s) of files to exclude (relative to `readFileProcessor.basePath`)
* * `fileReader` {string} name of a file reader to use for these files
*
* @property {Array.<Function>} fileReaders A collection of file readers. A file reader is an object
* that has the following properties/methods:
* * `name` - the name of the file reader so that sourceFiles can reference it
* * `getDocs(fileInfo)` - this method is called to read the content of the file specified
* by the `fileInfo` object and return an array of documents.
* * `defaultPattern {Regex}` - a regular expression used to match to source files if no fileReader
* is specified in the sourceInfo item.
*
*/
module.exports = function readFilesProcessor(log) {
return {
$validate: {
basePath: { presence: true },
sourceFiles: { presence: true },
fileReaders: { presence: true },
},
$runAfter: ['reading-files'],
$runBefore: ['files-read'],
$process() {
const fileReaders = this.fileReaders;
const fileReaderMap = getFileReaderMap(fileReaders);
const basePath = this.basePath;
const sourcePromises = this.sourceFiles.map(sourceInfo => {
sourceInfo = normalizeSourceInfo(basePath, sourceInfo);
log.debug('Source Info:\n', sourceInfo);
return getSourceFiles(sourceInfo).then(files => {
const docsPromises = [];
log.debug('Found ' + files.length + ' files:\n', files);
files.forEach(file => {
// Load up each file and extract documents using the appropriate fileReader
const docsPromise = readFile(file).then(content => {
// Choose a file reader for this file
const fileReader = sourceInfo.fileReader ? fileReaderMap.get(sourceInfo.fileReader) : matchFileReader(fileReaders, file);
log.debug('Reading File Content\nFile Path:', file, '\nFile Reader:', fileReader.name);
const fileInfo = createFileInfo(file, content, sourceInfo, fileReader, basePath);
const docs = fileReader.getDocs(fileInfo);
// Attach the fileInfo object to each doc
docs.forEach(doc => {
doc.fileInfo = fileInfo;
});
return docs;
});
docsPromises.push(docsPromise);
});
return Promise.all(docsPromises).then(results => results.flat());
});
});
return Promise.all(sourcePromises).then(results => results.flat());
}
};
};
function createFileInfo(file, content, sourceInfo, fileReader, basePath) {
return {
fileReader: fileReader.name,
filePath: file,
baseName: path.basename(file, path.extname(file)),
extension: path.extname(file).replace(/^\./, ''),
basePath: sourceInfo.basePath,
relativePath: path.relative(sourceInfo.basePath, file),
projectRelativePath: path.relative(basePath, file),
content: content
};
}
function getFileReaderMap(fileReaders) {
const fileReaderMap = new Map();
fileReaders.forEach(fileReader => {
if ( !fileReader.name ) {
throw new Error('Invalid File Reader: It must have a name property');
}
if ( typeof fileReader.getDocs !== 'function' ) {
throw new Error('Invalid File Reader: "' + fileReader.name + '": It must have a getDocs property');
}
fileReaderMap.set(fileReader.name, fileReader);
});
return fileReaderMap;
}
function matchFileReader(fileReaders, file) {
const found = fileReaders.find(fileReader => {
// If no defaultPattern is defined then match everything
return !fileReader.defaultPattern || fileReader.defaultPattern.test(file);
});
if ( !found ) { throw new Error('No file reader found for ' + file); }
return found;
}
/**
* Resolve the relative include/exclude paths in the sourceInfo object,
*/
function normalizeSourceInfo(basePath, sourceInfo) {
if ( typeof sourceInfo === 'string' ) {
sourceInfo = { include: [sourceInfo] };
} else if (!('include' in sourceInfo)) {
throw new Error('Invalid sourceFiles parameter. ' +
'You must pass an array of items, each of which is either a string or an object of the form ' +
'{ include: "...", basePath: "...", exclude: "...", fileReader: "..." }');
}
if ( !Array.isArray(sourceInfo.include) ) {
sourceInfo.include = [sourceInfo.include];
}
sourceInfo.exclude = sourceInfo.exclude || [];
if ( !Array.isArray(sourceInfo.exclude) ) {
sourceInfo.exclude = [sourceInfo.exclude];
}
sourceInfo.basePath = path.resolve(basePath, sourceInfo.basePath || '.');
sourceInfo.include = sourceInfo.include.map(include => path.resolve(basePath, include));
sourceInfo.exclude = sourceInfo.exclude.map(exclude => path.resolve(basePath, exclude));
return sourceInfo;
}
function getSourceFiles(sourceInfo) {
// Compute matchers for each of the exclusion patterns
const excludeMatchers = sourceInfo.exclude.map(exclude => new Minimatch(exclude));
// Get a list of files to include
// Each call to glob will produce an array of file paths
const filesPromises = sourceInfo.include.map(include => matchFiles(include));
// Once we have all the file path arrays, flatten them into a single array
return Promise.all(filesPromises)
.then(filesCollections => filesCollections.flat())
.then(files => {
// Filter the files on whether they match the `exclude` property and whether they are files
const filteredFilePromises = files.map(file => {
if ( excludeMatchers.some(excludeMatcher => excludeMatcher.match(file)) ) {
// Return a promise for `null` if the path is excluded
// Doing this first - it is synchronous - saves us even making the isFile call if not needed
return Promise.resolve(null);
} else {
// Return a promise for the file if path is a file, otherwise return a promise for `null`
return isFile(file).then(isFile => { return isFile ? file : null; });
}
});
// Return a promise to a filtered list of files, those that are files and not excluded
// (i.e. those that are not `null` from the previous block of code)
return Promise.all(filteredFilePromises).then(filteredFiles => {
return filteredFiles.filter(filteredFile => filteredFile);
});
});
}
function readFile(file) {
return new Promise((resolve, reject) => {
fs.readFile(file, 'utf-8', (err, data) => {
if (err) { reject(err); }
resolve(data);
});
});
}
function isFile(file) {
return new Promise((resolve, reject) => {
fs.stat(file, (err, stat) => {
if (err) { reject(err); }
resolve(stat.isFile());
});
});
}
function matchFiles(pattern) {
return new Promise((resolve, reject) => {
glob(pattern, (err, data) => {
if (err) { reject(err); }
resolve(data);
});
});
}
|
/**
*
* @module creator
* @author Wilson Flores
*
*/
function Creator(plugins){
/*
*
* @instance messages, wrapper
* @param {plugins} plugins - modules used in firekyll
*
*/
this.plugins = plugins;
this.program = this.plugins.program;
this.cp = this.plugins.cp;
this.fs = this.plugins.fs;
this.path = this.plugins.path;
this.utilities = this.plugins.utilities;
this.table = this.plugins.table;
this.inquirer = this.plugins.inquirer;
this.jekyll = process.platform === 'win32' ? 'jekyll.bat' : 'jekyll';
this.messages = new this.plugins.messages(this.plugins);
this.wrapper = new this.table({
head:[this.plugins.chalk.cyan.bold('Size'),this.plugins.chalk.cyan.bold('Name')],
colWidths:[25,50]
});
this.executeCommandCwd= {
cwd:process.cwd()
}
this.choicesNew = [
new this.inquirer.Separator(),
'Create with firekyll',
'Create with firekyll and (gulp + browserSync + express + sass)',
new this.inquirer.Separator()
]
}
/*
*
* @function create new post for jekyll
*
*/
Creator.prototype.newpost = function(){
var _posts = this.fs.existsSync(this.path.join(process.cwd(),'_posts'));
if(_posts){
var _file = this.fs.existsSync(this.path.join('_posts',this.createNamePost()));
if(_file){
this.messages.postExists();
}
if(!_file){
this.fs.createReadStream(this.path.join(__dirname,'templates/post'))
.pipe(this.fs.createWriteStream(this.path.join('_posts',this.createNamePost())));
this.messages.successCreatePost();
}
}
if(!_posts){
this.messages.directoryPostNotExist();
}
};
/*
*
* @function create new project jekyll
*
*/
Creator.prototype.new = function(){
var ctx = this;
this.inquirer.prompt([
{
type:'list',
name:'home',
message:'What would you like to do?',
choices:ctx.choicesNew,
}
],function(answers){
var _project = ctx.fs.existsSync(ctx.path.join(process.cwd(),ctx.program.new));
if(_project){
ctx.messages.projectExists();
}
if(!_project){
if(answers.home == ctx.choicesNew[1]){
var _commands = ['new',ctx.program.new];
ctx.utilities.executeCommand(ctx.jekyll,_commands,ctx.cp,ctx.executeCommandCwd);
ctx.messages.successCreateProject();
}
if(answers.home == ctx.choicesNew[2]){
ctx.createGenerator();
var _commands = ['new',ctx.program.new];
ctx.utilities.executeCommand(ctx.jekyll,_commands,ctx.cp,ctx.executeCommandCwd);
ctx.fs.createReadStream(ctx.path.join(__dirname,'/templates/config'))
.pipe(ctx.fs.createWriteStream(ctx.path.join(ctx.program.new,'_config.yml')));
ctx.messages.successCreateProject();
}
}
});
}
/*
*
* @function server createGenerator
*
*/
Creator.prototype.createGenerator = function(){
try{
var generator = require('firekyll-generator-gulp-webapp');
var run = new generator();
run.directory(this.program.new);
}catch(e){
this.messages.errorProjectNew(e);
process.exit();
}
}
/*
*
* @function server jekyll
*
*/
Creator.prototype.server = function(){
var _commands = ['server'];
this.utilities.executeCommand(this.jekyll,_commands,this.cp,this.executeCommandCwd);
this.messages.server();
}
/*
*
* @function build jekyll
*
*/
Creator.prototype.build = function(){
var _commands = ['build'];
this.utilities.executeCommand(this.jekyll,_commands,this.cp,this.executeCommandCwd);
this.messages.build();
}
/*
*
* @function create name post
* @return {name} - name for post
*
*/
Creator.prototype.createNamePost = function(){
var d = new Date();
var date = [];
date.push(d.getFullYear());
date.push(d.getMonth()+1);
date.push(d.getDate());
var name = date.join('-')+'-'+this.program.newpost+'.markdown';
return name;
};
/*
*
* @function List all posts
*
*/
Creator.prototype.listPosts = function(){
var _files = [];
var stats;
if(this.fs.existsSync(this.path.join(process.cwd(),'_posts'))){
_files = this.fs.readdirSync('_posts');
for (var _i=0; _i<_files.length;_i++) {
stats = this.fs.statSync(this.path.join(process.cwd(),'_posts',_files[_i]));
this.messages.listPosts(_files[_i],stats.size,this.wrapper,_files.length);
};
process.exit();
}
this.messages.directoryPostNotExist();
};
module.exports = Creator; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.