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
ac9e23154d7f77216016bc84c4a0a1e2e19f7666
281
js
JavaScript
JS-nodeAPI-REST/aula-4/src/models/Autor.js
eso1994/JavaScript_Curso_Alura
b5190d8334aafc57d53f8b625076ec90264b388a
[ "MIT" ]
null
null
null
JS-nodeAPI-REST/aula-4/src/models/Autor.js
eso1994/JavaScript_Curso_Alura
b5190d8334aafc57d53f8b625076ec90264b388a
[ "MIT" ]
null
null
null
JS-nodeAPI-REST/aula-4/src/models/Autor.js
eso1994/JavaScript_Curso_Alura
b5190d8334aafc57d53f8b625076ec90264b388a
[ "MIT" ]
null
null
null
import mongoose from "mongoose"; const autorSchema = new mongoose.Schema( { id: {type: String}, nome: {type: String, required: true}, nacionalidade: {type: String} } ) const autores = mongoose.model("autores", autorSchema) export default autores;
21.615385
54
0.651246
ac9e59f9337e6c46688abe114a5ce887c5fb87d8
1,977
js
JavaScript
docs/script.js
nagasawaaaa/vue-todo-app-sample
68a2e094041846d30ab4165abc3d129cd7e04ca6
[ "MIT" ]
null
null
null
docs/script.js
nagasawaaaa/vue-todo-app-sample
68a2e094041846d30ab4165abc3d129cd7e04ca6
[ "MIT" ]
null
null
null
docs/script.js
nagasawaaaa/vue-todo-app-sample
68a2e094041846d30ab4165abc3d129cd7e04ca6
[ "MIT" ]
null
null
null
'use strict'; Vue.component('task-field', { template: '<li class="list-group-item">\n <p>{{ parentTask }}</p>\n <div class="form-group" v-if="edit">\n <div class="input-group">\n <input type="text" class="form-control" placeholder="Edit task..." v-model="newTask">\n <span class="input-group-btn">\n <button class="btn btn-default" type="button" @click="updateTask">Done</button>\n </span>\n </div>\n </div>\n <div class="text-right">\n <div class="btn-group" role="group" v-if="!edit">\n <button type="button" class="btn btn-success" @click="editToggle">Edit</button>\n </div>\n <div class="btn-group" role="group" v-if="edit">\n <button type="button" class="btn btn-success" @click="editCancel">Cancel</button>\n </div>\n <div class="btn-group" role="group">\n <button type="button" class="btn btn-danger" @click="getIndex">Delete</button>\n </div>\n </div>\n </li>', props: { 'parentTask': String, 'id': Number }, data: function data() { return { edit: false, newTask: '' }; }, methods: { editToggle: function editToggle() { this.edit = !this.edit; }, editCancel: function editCancel() { this.editToggle(); this.newTask = ""; }, getIndex: function getIndex() { this.$emit('get-index', this.id); }, updateTask: function updateTask() { if (this.newTask === "") return; this.$emit('update-task', this.id, this.newTask); this.editCancel(); } } }); var vm = new Vue({ el: '#main', data: { text: '', tasks: [] }, methods: { sendTask: function sendTask() { if (this.text === '') return; this.tasks.push(this.text); this.text = ''; }, deleteTask: function deleteTask(id) { this.tasks.splice(id, 1); }, updateTask: function updateTask(id, task) { this.tasks.splice(id, 1, task); } } });
37.301887
934
0.559433
ac9faed1781460fc4e64c5560c8c86e2bb9db24e
6,064
js
JavaScript
soundspinner/third_party/Tone.js/Tone/source/FMOscillator.js
sharpninja/chrome-music-lab
4e265bef4ce2f8dfce30048a61123ba25a1cd95e
[ "Apache-2.0" ]
1,824
2016-03-09T00:47:23.000Z
2022-03-31T11:40:10.000Z
soundspinner/third_party/Tone.js/Tone/source/FMOscillator.js
sharpninja/chrome-music-lab
4e265bef4ce2f8dfce30048a61123ba25a1cd95e
[ "Apache-2.0" ]
54
2016-03-09T11:12:31.000Z
2022-03-29T12:43:30.000Z
soundspinner/third_party/Tone.js/Tone/source/FMOscillator.js
sharpninja/chrome-music-lab
4e265bef4ce2f8dfce30048a61123ba25a1cd95e
[ "Apache-2.0" ]
482
2016-03-09T07:23:25.000Z
2022-03-28T09:17:33.000Z
define(["Tone/core/Tone", "Tone/source/Source", "Tone/source/Oscillator", "Tone/signal/Multiply", "Tone/core/Gain"], function(Tone){ "use strict"; /** * @class Tone.FMOscillator * * @extends {Tone.Oscillator} * @constructor * @param {Frequency} frequency The starting frequency of the oscillator. * @param {String} type The type of the carrier oscillator. * @param {String} modulationType The type of the modulator oscillator. * @example * //a sine oscillator frequency-modulated by a square wave * var fmOsc = new Tone.FMOscillator("Ab3", "sine", "square").toMaster().start(); */ Tone.FMOscillator = function(){ var options = this.optionsObject(arguments, ["frequency", "type", "modulationType"], Tone.FMOscillator.defaults); Tone.Source.call(this, options); /** * The carrier oscillator * @type {Tone.Oscillator} * @private */ this._carrier = new Tone.Oscillator(options.frequency, options.type); /** * The oscillator's frequency * @type {Frequency} * @signal */ this.frequency = new Tone.Signal(options.frequency, Tone.Type.Frequency); /** * The detune control signal. * @type {Cents} * @signal */ this.detune = this._carrier.detune; this.detune.value = options.detune; /** * The modulation index which is in essence the depth or amount of the modulation. In other terms it is the * ratio of the frequency of the modulating signal (mf) to the amplitude of the * modulating signal (ma) -- as in ma/mf. * @type {Positive} * @signal */ this.modulationIndex = new Tone.Multiply(options.modulationIndex); this.modulationIndex.units = Tone.Type.Positive; /** * The modulating oscillator * @type {Tone.Oscillator} * @private */ this._modulator = new Tone.Oscillator(options.frequency, options.modulationType); /** * Harmonicity is the frequency ratio between the carrier and the modulator oscillators. * A harmonicity of 1 gives both oscillators the same frequency. * Harmonicity = 2 means a change of an octave. * @type {Positive} * @signal * @example * //pitch the modulator an octave below carrier * synth.harmonicity.value = 0.5; */ this.harmonicity = new Tone.Multiply(options.harmonicity); this.harmonicity.units = Tone.Type.Positive; /** * the node where the modulation happens * @type {Tone.Gain} * @private */ this._modulationNode = new Tone.Gain(0); //connections this.frequency.connect(this._carrier.frequency); this.frequency.chain(this.harmonicity, this._modulator.frequency); this.frequency.chain(this.modulationIndex, this._modulationNode); this._modulator.connect(this._modulationNode.gain); this._modulationNode.connect(this._carrier.frequency); this._carrier.connect(this.output); this.detune.connect(this._modulator.detune); this.phase = options.phase; this._readOnly(["modulationIndex", "frequency", "detune", "harmonicity"]); }; Tone.extend(Tone.FMOscillator, Tone.Oscillator); /** * default values * @static * @type {Object} * @const */ Tone.FMOscillator.defaults = { "frequency" : 440, "detune" : 0, "phase" : 0, "modulationIndex" : 2, "modulationType" : "square", "harmonicity" : 1 }; /** * start the oscillator * @param {Time} [time=now] * @private */ Tone.FMOscillator.prototype._start = function(time){ time = this.toSeconds(time); this._modulator.start(time); this._carrier.start(time); }; /** * stop the oscillator * @param {Time} time (optional) timing parameter * @private */ Tone.FMOscillator.prototype._stop = function(time){ time = this.toSeconds(time); this._modulator.stop(time); this._carrier.stop(time); }; /** * The type of the carrier oscillator * @memberOf Tone.FMOscillator# * @type {string} * @name type */ Object.defineProperty(Tone.FMOscillator.prototype, "type", { get : function(){ return this._carrier.type; }, set : function(type){ this._carrier.type = type; } }); /** * The type of the modulator oscillator * @memberOf Tone.FMOscillator# * @type {String} * @name modulationType */ Object.defineProperty(Tone.FMOscillator.prototype, "modulationType", { get : function(){ return this._modulator.type; }, set : function(type){ this._modulator.type = type; } }); /** * The phase of the oscillator in degrees. * @memberOf Tone.FMOscillator# * @type {number} * @name phase */ Object.defineProperty(Tone.FMOscillator.prototype, "phase", { get : function(){ return this._carrier.phase; }, set : function(phase){ this._carrier.phase = phase; this._modulator.phase = phase; } }); /** * The partials of the carrier waveform. A partial represents * the amplitude at a harmonic. The first harmonic is the * fundamental frequency, the second is the octave and so on * following the harmonic series. * Setting this value will automatically set the type to "custom". * The value is an empty array when the type is not "custom". * @memberOf Tone.FMOscillator# * @type {Array} * @name partials * @example * osc.partials = [1, 0.2, 0.01]; */ Object.defineProperty(Tone.FMOscillator.prototype, "partials", { get : function(){ return this._carrier.partials; }, set : function(partials){ this._carrier.partials = partials; } }); /** * Clean up. * @return {Tone.FMOscillator} this */ Tone.FMOscillator.prototype.dispose = function(){ Tone.Source.prototype.dispose.call(this); this._writable(["modulationIndex", "frequency", "detune", "harmonicity"]); this.frequency.dispose(); this.frequency = null; this.detune = null; this.harmonicity.dispose(); this.harmonicity = null; this._carrier.dispose(); this._carrier = null; this._modulator.dispose(); this._modulator = null; this._modulationNode.dispose(); this._modulationNode = null; this.modulationIndex.dispose(); this.modulationIndex = null; return this; }; return Tone.FMOscillator; });
26.713656
117
0.674637
aca011eae998af3e1c6c3d3b664d348d71484fd8
1,133
js
JavaScript
dist/js/script-min.js
fantazer/TOTEST
f3c202701ae5bf0442d21a7446a6b75afe754a78
[ "MIT" ]
null
null
null
dist/js/script-min.js
fantazer/TOTEST
f3c202701ae5bf0442d21a7446a6b75afe754a78
[ "MIT" ]
null
null
null
dist/js/script-min.js
fantazer/TOTEST
f3c202701ae5bf0442d21a7446a6b75afe754a78
[ "MIT" ]
null
null
null
$(document).ready(function(){$(function(){$(".wrap").mixItUp()}),$(".filter-head__el").click(function(){var e=$(this).index();$(".filter-head__el").removeClass("filter-head__el--active"),$(this).addClass("filter-head__el--active"),$(".wrap").each(function(){$(this).index()==e?$(this).addClass("wrap--active"):$(this).removeClass("wrap--active")})}),svg4everybody(),localStorage.clear(),sessionStorage.clear(),$(window).unload(function(){localStorage.clear()})}),function(e,t){"use strict";var a="img/pack.html",n=1;if(!t.createElementNS||!t.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect)return!0;var i,o,l="localStorage"in e&&null!==e.localStorage,r=function(){t.body.insertAdjacentHTML("afterbegin",o)},c=function(){t.body?r():t.addEventListener("DOMContentLoaded",r)};if(l&&localStorage.getItem("inlineSVGrev")==n&&(o=localStorage.getItem("inlineSVGdata")))return c(),!0;try{i=new XMLHttpRequest,i.open("GET",a,!0),i.onload=function(){i.status>=200&&i.status<400&&(o=i.responseText,c(),l&&(localStorage.setItem("inlineSVGdata",o),localStorage.setItem("inlineSVGrev",n)))},i.send()}catch(s){}}(window,document);
1,133
1,133
0.711386
aca028b483a0e04dd79d7b87a6bd973a7c9e450c
2,322
js
JavaScript
backend/node_modules/prisma-yml/dist/utils/yamlComment.test.js
shashankcm/Full-Stack-Online-Shopping-Website
35ddc2d897e74e335e4a02283ab8a6c444e5b7a7
[ "MIT" ]
33
2019-07-12T01:07:43.000Z
2022-03-09T20:59:38.000Z
backend/node_modules/prisma-yml/dist/utils/yamlComment.test.js
shashankcm/Full-Stack-Online-Shopping-Website
35ddc2d897e74e335e4a02283ab8a6c444e5b7a7
[ "MIT" ]
9
2019-07-13T10:33:04.000Z
2021-09-21T00:29:56.000Z
backend/node_modules/prisma-yml/dist/utils/yamlComment.test.js
shashankcm/Full-Stack-Online-Shopping-Website
35ddc2d897e74e335e4a02283ab8a6c444e5b7a7
[ "MIT" ]
16
2019-09-24T19:06:04.000Z
2021-09-05T08:40:06.000Z
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var yamlComment_1 = require("./yamlComment"); describe('replaceYamlValue', function () { test('when document is clean', function () { var input = "endpoint: https://eu1.prisma.sh/public-asdf/my-service/dev\ndatamodel: datamodel.prisma"; var output = yamlComment_1.replaceYamlValue(input, 'endpoint', 'http://localhost:4466'); expect({ input: input, output: output }).toMatchSnapshot(); }); test('when comments already exist', function () { var input = "#anothercomment: asdasd\nendpoint: https://eu1.prisma.sh/public-asdf/my-service/dev\n\n#endpoint: asdasd\ndatamodel: datamodel.prisma"; var output = yamlComment_1.replaceYamlValue(input, 'endpoint', 'http://localhost:4466'); expect({ input: input, output: output }).toMatchSnapshot(); }); test('when key does not yet exist', function () { var input = "datamodel: datamodel.prisma"; var output = yamlComment_1.replaceYamlValue(input, 'endpoint', 'http://localhost:4466'); expect({ input: input, output: output }).toMatchSnapshot(); }); }); describe('migrateToEndpoint', function () { test('ignore when endpoint present', function () { var input = "endpoint: https://eu1.prisma.sh/public-asdf/my-service/dev\ndatamodel: datamodel.prisma"; var output = yamlComment_1.migrateToEndpoint(input, ''); expect({ input: input, output: output }).toMatchSnapshot(); }); test('work in simple case', function () { var input = "service: my-service\nstage: dev\ncluster: public-asdf/prisma-eu1\ndatamodel: datamodel.prisma"; var output = yamlComment_1.migrateToEndpoint(input, 'https://eu1.prisma.sh/public-asdf/my-service/dev'); expect({ input: input, output: output }).toMatchSnapshot(); }); test('work with different order and respect comments', function () { var input = "# don't delete me\nstage: dev\ncluster: public-asdf/prisma-eu1\n\nservice: my-service\n\n\n\ndatamodel: datamodel.prisma"; var output = yamlComment_1.migrateToEndpoint(input, 'https://eu1.prisma.sh/public-asdf/my-service/dev'); expect({ input: input, output: output }).toMatchSnapshot(); }); }); //# sourceMappingURL=yamlComment.test.js.map
61.105263
156
0.676572
aca03935380edcf271a9361748611afb09d00229
558
js
JavaScript
osa6/anecdotes-redux/src/components/Filter.js
ronituohino/fullstackopen_2021
f41a16e5599195f9a8462fd66e0beb9e917d6492
[ "MIT" ]
null
null
null
osa6/anecdotes-redux/src/components/Filter.js
ronituohino/fullstackopen_2021
f41a16e5599195f9a8462fd66e0beb9e917d6492
[ "MIT" ]
null
null
null
osa6/anecdotes-redux/src/components/Filter.js
ronituohino/fullstackopen_2021
f41a16e5599195f9a8462fd66e0beb9e917d6492
[ "MIT" ]
null
null
null
import React from 'react' import { connect } from 'react-redux' //import { useDispatch } from 'react-redux' import { setFilter } from '../reducers/filterReducer' const Filter = (props) => { //const dispatch = useDispatch() const onFilterChange = (event) => { props.setFilter(event.target.value) } return ( <> <p> filter <input onChange={onFilterChange} /> </p> </> ) } const mapDispatchToProps = { setFilter, } const ConnectedFilter = connect(null, mapDispatchToProps)(Filter) export default ConnectedFilter
19.241379
65
0.659498
aca0682c26b3a885b9eec6afda31de8f63567c70
2,746
js
JavaScript
src/lib/F.spec.js
jotaen/connect4-ai
fbdb0b4bc6e32b4edf7686eec6bd98c4a2d67ba7
[ "MIT" ]
1
2021-12-10T18:26:56.000Z
2021-12-10T18:26:56.000Z
src/lib/F.spec.js
jotaen/connect4-ai
fbdb0b4bc6e32b4edf7686eec6bd98c4a2d67ba7
[ "MIT" ]
2
2021-03-10T04:44:36.000Z
2021-05-11T00:40:16.000Z
src/lib/F.spec.js
jotaen/connect4-ai
fbdb0b4bc6e32b4edf7686eec6bd98c4a2d67ba7
[ "MIT" ]
1
2020-01-20T21:08:39.000Z
2020-01-20T21:08:39.000Z
const assert = require("assert") const R = require("ramda") const F = require("./F") describe("F (functional programming utility)", () => { describe("maxBy", () => { it("Finds one of two elements for which fn produces the larger numerical value", () => { assert.deepStrictEqual(F.maxBy(p => p.name)( {name: "Peter", age: 18}, {name: "Sarah", age: 63} ), {name: "Sarah", age: 63} ) assert.deepStrictEqual(F.maxBy(Math.abs)( -99, 44 ), -99 ) }) }) describe("minBy", () => { it("Finds one of two elements for which fn produces the smaller numerical value", () => { assert.deepStrictEqual(F.minBy(p => p.name)( {name: "Boris", age: 23}, {name: "Simone", age: 41} ), {name: "Boris", age: 23} ) assert.deepStrictEqual(F.minBy(Math.abs)( -99, 44 ), 44 ) }) }) describe("compareCloseTo", () => { it("can be used to sort array numbers around specific values", () => { assert.deepStrictEqual(R.sort(F.compareCloseTo(3))( [0, 1, 2, 3, 4, 5] ), [3, 4, 2, 5, 1, 0] ) assert.deepStrictEqual(R.sort(F.compareCloseTo(1))( [0, 1, 2, 3, 4, 5] ), [1, 2, 0, 3, 4, 5] ) }) }) describe("transposeDiagonal", () => { it("Transposes a list of lists diagonally (returns a list of all diagonals)", () => { assert.deepStrictEqual(F.transposeDiagonal([ [1, 2, 3], [4, 5, 6], [7, 8, 9], ]), [ [7], [4, 8], [1, 5, 9], [2, 6], [3], ]) }) }) describe("peek", () => { it("Executes a function and returns the original value", () => { let spy = false const orig = F.peek(s => {spy = s})(true) assert.strictEqual(spy, true) assert.strictEqual(orig, true) }) }) describe("hasLength", () => { it("Checks whether list is of given length", () => { const isTuple = F.hasLength(2) assert.strictEqual(isTuple([1]), false) assert.strictEqual(isTuple([1, 2]), true) assert.strictEqual(isTuple([1, 2, 3]), false) }) }) describe("mapIterateUntil", () => { it("Iterates over array as long as predicate is truthy", () => { const result = F.mapIterateUntil( (xs) => R.sum(xs) < 50, x => x + 1 )([1, 2, 3, 4, 5]) assert.deepStrictEqual(result, [8, 9, 10, 11, 12]) }) it("It checks the predicate on every single iteration", () => { let i = 0 const result = F.mapIterateUntil( () => i++ < 3, x => x + 1 )([10, 10, 10, 10, 10]) assert.deepStrictEqual(result, [11, 11, 11, 10, 10]) }) }) })
25.663551
93
0.502913
aca15dedf59963c8dcd4d9d2a8d055f9db603ae4
7,635
js
JavaScript
packages/core/__tests__/cv-text-input.test.js
ZrianinaMariia/carbon-components-vue
0759b5a1d5f9e65298241a46ab8f387533754d69
[ "Apache-2.0" ]
null
null
null
packages/core/__tests__/cv-text-input.test.js
ZrianinaMariia/carbon-components-vue
0759b5a1d5f9e65298241a46ab8f387533754d69
[ "Apache-2.0" ]
null
null
null
packages/core/__tests__/cv-text-input.test.js
ZrianinaMariia/carbon-components-vue
0759b5a1d5f9e65298241a46ab8f387533754d69
[ "Apache-2.0" ]
2
2019-07-29T18:50:40.000Z
2019-07-29T19:55:16.000Z
import { shallowMount as shallow } from '@vue/test-utils'; import { testComponent } from './_helpers'; import { CvTextInput } from '@/components/cv-text-input'; describe('CvTextInput', () => { const TYPE_PASSWORD = 'password'; const TYPE_TEXT = 'text'; // *************** // PROP CHECKS // *************** testComponent.propsAreType( CvTextInput, ['helperText', 'invalidMessage', 'label', 'passwordHideLabel', 'passwordShowLabel', 'theme', 'type', 'value', 'id'], String ); testComponent.propsAreType(CvTextInput, ['passwordVisible'], Boolean); testComponent.propsHaveDefaultOfUndefined(CvTextInput, ['helperText', 'invalidMessage']); testComponent.propsHaveDefault(CvTextInput, ['passwordHideLabel', 'passwordShowLabel']); // *************** // SNAPSHOT TESTS // *************** it('should render correctly', () => { const propsData = { label: 'test label', value: 'test value', id: '1', type: TYPE_TEXT }; const wrapper = shallow(CvTextInput, { propsData }); expect(wrapper.html()).toMatchSnapshot(); }); it('should render correctly when light theme is used', () => { const propsData = { label: 'test label', value: 'test value', id: '1', theme: 'light', type: TYPE_TEXT }; const wrapper = shallow(CvTextInput, { propsData }); expect(wrapper.html()).toMatchSnapshot(); }); it('should render correctly when invalid message is provided', () => { const propsData = { label: 'test label', value: 'test value', invalidMessage: 'invalid test message', id: '1', type: TYPE_TEXT, }; const wrapper = shallow(CvTextInput, { propsData }); expect(wrapper.html()).toMatchSnapshot(); }); it('should render correctly when invalid message slot is provided', () => { const propsData = { label: 'test label', value: 'test value', id: '1', type: TYPE_TEXT }; const wrapper = shallow(CvTextInput, { slots: { 'invalid-message': '<div class="invalid-message-class">invalid message slot</div>', }, propsData, }); expect(wrapper.html()).toMatchSnapshot(); }); it('should render correctly when helper text is provided', () => { const propsData = { label: 'test label', value: 'test value', helperText: 'helper test message', id: '1', type: TYPE_TEXT, }; const wrapper = shallow(CvTextInput, { propsData }); expect(wrapper.html()).toMatchSnapshot(); }); it('should render correctly when helper text slot is provided', () => { const propsData = { label: 'test label', value: 'test value', id: '1', type: TYPE_TEXT }; const wrapper = shallow(CvTextInput, { slots: { 'helper-text': '<div class="helper-text-class">helper text slot</div>', }, propsData, }); expect(wrapper.html()).toMatchSnapshot(); }); it('should render correctly when type is password and is visible', () => { const propsData = { label: 'test label', value: 'test password value', id: '1', type: TYPE_PASSWORD, passwordVisible: true, }; const wrapper = shallow(CvTextInput, { propsData }); expect(wrapper.html()).toMatchSnapshot(); }); it('should render correctly when type is password and is not visible', () => { const propsData = { label: 'test label', value: 'test password value', id: '1', type: TYPE_PASSWORD, passwordVisible: false, }; const wrapper = shallow(CvTextInput, { propsData }); expect(wrapper.html()).toMatchSnapshot(); }); // *************** // FUNCTIONAL TESTS // *************** it('`passwordVisible` prop should be watched', () => { const propsData = { value: 'test value', id: '1', type: TYPE_PASSWORD, passwordVisible: false }; const wrapper = shallow(CvTextInput, { propsData }); const spy = jest.spyOn(wrapper.vm, 'togglePasswordVisibility'); wrapper.setProps({ passwordVisible: true, }); expect(spy).toBeCalledTimes(1); }); it('`type` prop should be watched', () => { const propsData = { value: 'test value', id: '1', type: TYPE_PASSWORD }; const wrapper = shallow(CvTextInput, { propsData }); expect(wrapper.vm.dataType).toEqual(TYPE_PASSWORD); wrapper.setProps({ type: TYPE_TEXT, }); expect(wrapper.vm.dataType).toEqual(TYPE_TEXT); }); it('should emit current value on change', () => { const value = 'test value'; const propsData = { value, id: '1' }; const wrapper = shallow(CvTextInput, { propsData }); wrapper.find('input').trigger('input'); expect(wrapper.emitted().input[0]).toEqual([value]); }); it('`isPassword` should be true when type is `password`', () => { const propsData = { value: 'test value', id: '1', type: TYPE_PASSWORD }; const wrapper = shallow(CvTextInput, { propsData }); expect(wrapper.vm.isPassword).toEqual(true); }); it('`isPassword` should be false when type is not `password`', () => { const propsData = { value: 'test value', id: '1', type: TYPE_TEXT }; const wrapper = shallow(CvTextInput, { propsData }); expect(wrapper.vm.isPassword).toEqual(false); }); it('`isPasswordVisible` should be true when type is `password` and password is visible', () => { const propsData = { value: 'test value', id: '1', type: TYPE_PASSWORD, passwordVisible: true }; const wrapper = shallow(CvTextInput, { propsData }); wrapper.setData({ dataPasswordVisible: true, }); expect(wrapper.vm.isPasswordVisible).toEqual(true); }); it('`isPasswordVisible` should be false when type is `password` but password is not visible', () => { const propsData = { value: 'test value', id: '1', type: TYPE_PASSWORD, passwordVisible: false }; const wrapper = shallow(CvTextInput, { propsData }); wrapper.setData({ dataPasswordVisible: false, }); expect(wrapper.vm.isPasswordVisible).toEqual(false); }); it('`isPasswordVisible` should be false when type is not `password` even if `passwordVisible` prop is set to true', () => { const propsData = { value: 'test value', id: '1', type: TYPE_TEXT, passwordVisible: true }; const wrapper = shallow(CvTextInput, { propsData }); wrapper.setData({ dataPasswordVisible: false, }); expect(wrapper.vm.isPasswordVisible).toEqual(false); }); it('`passwordHideShowLabel` should be equal to `passwordHideLabel` prop when password is visible', () => { const passwordHideLabel = ' password hide label test'; const propsData = { value: 'test value', id: '1', type: TYPE_PASSWORD, passwordVisible: true, passwordHideLabel }; const wrapper = shallow(CvTextInput, { propsData }); wrapper.setData({ dataPasswordVisible: true, }); expect(wrapper.vm.passwordHideShowLabel).toEqual(passwordHideLabel); }); it('`passwordHideShowLabel` should be equal to `passwordShowLabel` prop when password is visible', () => { const passwordShowLabel = ' password show label test'; const propsData = { value: 'test value', id: '1', type: TYPE_PASSWORD, passwordVisible: false, passwordShowLabel }; const wrapper = shallow(CvTextInput, { propsData }); expect(wrapper.vm.passwordHideShowLabel).toEqual(passwordShowLabel); }); it('`togglePasswordVisibility` works as expected', () => { const propsData = { value: 'test value', id: '1', type: TYPE_PASSWORD, passwordVisible: false }; const wrapper = shallow(CvTextInput, { propsData }); expect(wrapper.vm.dataType).toEqual(TYPE_PASSWORD); wrapper.vm.togglePasswordVisibility(); expect(wrapper.vm.dataType).toEqual(TYPE_TEXT); }); });
37.985075
125
0.641257
aca23975e9f4dfd647d924747f8f2130aea68fc8
335
js
JavaScript
src/cli/commands/clear.js
mazecodes/koala-cli
1af081043006846ee4aac2643f884928c263b4db
[ "MIT" ]
2
2021-02-04T07:15:48.000Z
2021-02-04T07:57:58.000Z
src/cli/commands/clear.js
mazecodes/koala
1af081043006846ee4aac2643f884928c263b4db
[ "MIT" ]
null
null
null
src/cli/commands/clear.js
mazecodes/koala
1af081043006846ee4aac2643f884928c263b4db
[ "MIT" ]
null
null
null
const shortcut = require('../../lib/shortcut'); const logger = require('../../lib/logger'); /** * Clear all shortcuts * * @returns {void} */ module.exports = () => { try { shortcut.clearShortcuts(); logger.success('All shortcuts were cleared successfully.'); } catch (error) { logger.error(error.message); } };
18.611111
63
0.61194
aca258a6445b56e916c8ee8d0151249b9c214b45
1,000
js
JavaScript
src/services/hook.js
mengerzhuanyong/CommonPeopleFarmers
1dd07d8a85a54a633a32aed5b1e675b985c8c322
[ "MIT" ]
17
2018-04-11T13:35:30.000Z
2021-04-01T09:02:30.000Z
src/services/hook.js
mengerzhuanyong/CommonPeopleFarmers
1dd07d8a85a54a633a32aed5b1e675b985c8c322
[ "MIT" ]
1
2019-09-23T08:30:51.000Z
2019-11-06T02:22:32.000Z
src/services/hook.js
mengerzhuanyong/CommonPeopleFarmers
1dd07d8a85a54a633a32aed5b1e675b985c8c322
[ "MIT" ]
1
2018-05-14T13:41:36.000Z
2018-05-14T13:41:36.000Z
import { useEffect, useState, useCallback } from 'react'; import deepmerge from 'deepmerge'; import ServerClient from './request/ServerClient'; const _initRequest = { url: '', params: {}, body: {}, method: 'GET', }; function useService(initRequest) { const [request, setRequest] = useState({ ..._initRequest, ...initRequest }); const [response, setResponse] = useState(null); const updateRequest = useCallback((params = {}) => { setRequest((pre) => { return deepmerge(pre, params); }); }, []); useEffect(() => { if (request.url) { if (request.method === 'GET') { ServerClient.get(request.url, request.params).then((result) => { setResponse(result); }); } else if (request.method === 'POST') { ServerClient.post(request).then((result) => { setResponse(result); }); } } }, [request]); return { request, setRequest: updateRequest, response, }; } export { useService };
22.727273
78
0.585
aca29b067f553cf157cf26e8f348181c67e77e1e
1,294
js
JavaScript
assets/js/header-search.js
germanthemes/gt-drive
23748ee2abfb48c0035e20465e26e23d2d06909c
[ "CC0-1.0", "Apache-2.0", "CC-BY-4.0", "MIT" ]
1
2021-08-20T10:28:18.000Z
2021-08-20T10:28:18.000Z
assets/js/header-search.js
germanthemes/gt-drive
23748ee2abfb48c0035e20465e26e23d2d06909c
[ "CC0-1.0", "Apache-2.0", "CC-BY-4.0", "MIT" ]
3
2021-07-14T12:54:37.000Z
2021-07-14T13:22:09.000Z
assets/js/header-search.js
germanthemes/gt-drive
23748ee2abfb48c0035e20465e26e23d2d06909c
[ "CC0-1.0", "Apache-2.0", "CC-BY-4.0", "MIT" ]
null
null
null
/** * Header Search JS * * @package GT Drive */ ( function( $ ) { $( document ).ready( function() { var searchToggle = $( '#masthead .header-main .header-search-button .header-search-icon' ); var searchForm = $( '.site .header-search-dropdown' ); function closeSearchForm() { searchForm.removeClass( 'active' ).hide(); searchToggle.attr( 'aria-expanded', searchForm.hasClass( 'active' ) ); } // Add an initial value for the attribute. searchToggle.attr( 'aria-expanded', 'false' ); /* Display and hide Search Form when search icon is clicked */ searchToggle.click( function(e) { searchForm.toggle().toggleClass( 'active' ); searchForm.find( '.search-form .search-field' ).focus(); $( this ).attr( 'aria-expanded', searchForm.hasClass( 'active' ) ); e.stopPropagation(); }); /* Close search form if Escape key is pressed */ $( document ).keyup(function(e) { if ( e.which == 27 ) { closeSearchForm(); } }); /* Do not close search form if click is inside header search dropdown */ searchForm.find( '.header-search-form' ).click( function(e) { e.stopPropagation(); }); /* Close search form if click is outside header search element */ $( document ).click( function() { closeSearchForm(); }); } ); } )( jQuery );
26.408163
93
0.639104
aca2b6d10c96e9e439779d43f5a11eb94ee882d8
252
js
JavaScript
plugins/currency.js
kilombo/NuxtPersonalPwa
1f2ebca7331587aa4acf4a0f485d9a2ff5d4a949
[ "MIT" ]
null
null
null
plugins/currency.js
kilombo/NuxtPersonalPwa
1f2ebca7331587aa4acf4a0f485d9a2ff5d4a949
[ "MIT" ]
null
null
null
plugins/currency.js
kilombo/NuxtPersonalPwa
1f2ebca7331587aa4acf4a0f485d9a2ff5d4a949
[ "MIT" ]
null
null
null
export default ({ app }, inject) => { inject('currency', (value) => { const lang = app.i18n.locale if (lang === 'en') { return '€' + parseFloat(value).toFixed(2) } else { return parseFloat(value).toFixed(2) + '€' } }) }
22.909091
47
0.527778
aca2dbcf3c8dcbcb74d1e60995b549694a7e5a5f
544
js
JavaScript
src/math/Within.js
PixelBitCoding/PixelBits-Repository
f1a25921c7512d11868f7dcb3a6f73fff970a731
[ "MIT" ]
1
2017-10-31T15:22:36.000Z
2017-10-31T15:22:36.000Z
src/math/Within.js
PixelBitCoding/PixelBits-Repository
f1a25921c7512d11868f7dcb3a6f73fff970a731
[ "MIT" ]
4
2020-07-27T11:07:03.000Z
2021-05-11T21:01:17.000Z
src/math/Within.js
PixelBitCoding/PixelBits-Repository
f1a25921c7512d11868f7dcb3a6f73fff970a731
[ "MIT" ]
null
null
null
/** * Checks if the two values are within the given `tolerance` of each other. * * @function Phaser.Math.Within * @since 3.0.0 * * @param {number} a - [description] * @param {number} b - [description] * @param {number} tolerance - The tolerance. Anything equal to or less than this value is considered as being within range. * * @return {boolean} Returns `true` if `a` is less than or equal to the tolerance of `b`. */ var Within = function (a, b, tolerance) { return (Math.abs(a - b) <= tolerance); }; module.exports = Within;
28.631579
124
0.667279
aca31c394a8e2f0e65ae4d52e6c1a98cdfe9edac
2,898
js
JavaScript
examples/js/index.js
funktechno/CommentsPress
651a243fb2a31df842621676ca012afdd6afea8e
[ "MIT" ]
null
null
null
examples/js/index.js
funktechno/CommentsPress
651a243fb2a31df842621676ca012afdd6afea8e
[ "MIT" ]
13
2021-03-05T07:17:39.000Z
2021-03-05T14:41:43.000Z
examples/js/index.js
funktechno/CommentsPress
651a243fb2a31df842621676ca012afdd6afea8e
[ "MIT" ]
null
null
null
function renderComments(commentList) { var ele = document.getElementById(`commentThreads`) console.log(commentList); // ele.innerHTML="<li>test</li>" let commentsHtml = ""; commentList.forEach(element => { let commentBody = `<div class="thread thread_theme_light root__thread" v-for="c in comments" role="listitem list" aria-expanded="true" > <article id="remark42__comment-515e3434-4161-4c55-8ee9-2752673c17d7" style="" class="comment comment_guest comment_theme_light"> <div class="comment__info"><img class="avatar-icon avatar-icon_theme_light comment__avatar" src="https://demo.remark42.com/api/v1/avatar/373820495cd26d40c26b6ffd0786b65c230238e2.image" alt=""><span role="button" tabindex="0" class="comment__username" title="anonymous_55d448b815f9829dd31c4f14dad3285350207118">` commentBody += element['displayName'] + `</span><a href="https://remark42.com/demo/#remark42__comment-515e3434-4161-4c55-8ee9-2752673c17d7" class="comment__time">` commentBody += element['updated_at'] + `</a><span class="comment__score"><span class="comment__vote comment__vote_type_up comment__vote_disabled" aria-disabled="true" role="button" title="Sign in to vote">Vote up</span><span class="comment__score-value" title="Controversy: 0.00">0</span><span class="comment__vote comment__vote_type_down comment__vote_disabled" aria-disabled="true" role="button" title="Sign in to vote">Vote down</span></span></div> <div class="comment__body"> <div class="comment__text raw-content raw-content_theme_light">` commentBody += element['commentText'] + ` </div> <div class="comment__actions"><button class="button button_kind_link comment__action" type="button" role="button" tabindex="0">Reply</button><span class="comment__controls"><button class="button button_kind_link comment__control" type="button" role="button" tabindex="0">Hide</button></span></div> </div> </article> <div class="thread__collapse" role="button" tabindex="0"> <div></div> </div> </div>` commentsHtml += commentBody }); ele.innerHTML = commentsHtml } const data = JSON.stringify({ "slug": "test" }); const xhr = new XMLHttpRequest(); xhr.withCredentials = true; xhr.addEventListener("readystatechange", function () { if (this.readyState === this.DONE) { try { const comments = JSON.parse(this.responseText); renderComments(comments); } catch (e) { console.log(e); } console.log(this.responseText); } }); xhr.open("POST", "/comments/?action=get"); xhr.setRequestHeader("content-type", "application/json"); xhr.setRequestHeader("accept", "application/json"); xhr.send(data);
39.162162
121
0.664941
aca406a75ec82ade07263b829abb9c8a3bad45a7
5,728
js
JavaScript
oxigraph/js/test/store.js
docknetwork/sparql2rify
514e20911252a006cead4e8db0ca263b7081d38b
[ "Apache-2.0", "MIT" ]
null
null
null
oxigraph/js/test/store.js
docknetwork/sparql2rify
514e20911252a006cead4e8db0ca263b7081d38b
[ "Apache-2.0", "MIT" ]
30
2020-11-02T07:38:25.000Z
2022-03-11T21:10:54.000Z
oxigraph/js/test/store.js
docknetwork/sparql2rify
514e20911252a006cead4e8db0ca263b7081d38b
[ "Apache-2.0", "MIT" ]
null
null
null
/* global describe, it */ const { MemoryStore } = require('../pkg/oxigraph.js') const assert = require('assert') const dataFactory = require('@rdfjs/data-model') const ex = dataFactory.namedNode('http://example.com') describe('MemoryStore', function () { describe('#add()', function () { it('an added quad should be in the store', function () { const store = new MemoryStore() store.add(dataFactory.triple(ex, ex, ex)) assert(store.has(dataFactory.triple(ex, ex, ex))) }) }) describe('#delete()', function () { it('an removed quad should not be in the store anymore', function () { const store = new MemoryStore([dataFactory.triple(ex, ex, ex)]) assert(store.has(dataFactory.triple(ex, ex, ex))) store.delete(dataFactory.triple(ex, ex, ex)) assert(!store.has(dataFactory.triple(ex, ex, ex))) }) }) describe('#has()', function () { it('an added quad should be in the store', function () { const store = new MemoryStore([dataFactory.triple(ex, ex, ex)]) assert(store.has(dataFactory.triple(ex, ex, ex))) }) }) describe('#size()', function () { it('A store with one quad should have 1 for size', function () { const store = new MemoryStore([dataFactory.triple(ex, ex, ex)]) assert.strictEqual(1, store.size) }) }) describe('#match_quads()', function () { it('blank pattern should return all quads', function () { const store = new MemoryStore([dataFactory.triple(ex, ex, ex)]) const results = store.match() assert.strictEqual(1, results.length) assert(dataFactory.triple(ex, ex, ex).equals(results[0])) }) }) describe('#query()', function () { it('ASK true', function () { const store = new MemoryStore([dataFactory.triple(ex, ex, ex)]) assert.strictEqual(true, store.query('ASK { ?s ?s ?s }')) }) it('ASK false', function () { const store = new MemoryStore() assert.strictEqual(false, store.query('ASK { FILTER(false)}')) }) it('CONSTRUCT', function () { const store = new MemoryStore([dataFactory.triple(ex, ex, ex)]) const results = store.query('CONSTRUCT { ?s ?p ?o } WHERE { ?s ?p ?o }') assert.strictEqual(1, results.length) assert(dataFactory.triple(ex, ex, ex).equals(results[0])) }) it('SELECT', function () { const store = new MemoryStore([dataFactory.triple(ex, ex, ex)]) const results = store.query('SELECT ?s WHERE { ?s ?p ?o }') assert.strictEqual(1, results.length) assert(ex.equals(results[0].get('s'))) }) it('SELECT with NOW()', function () { const store = new MemoryStore([dataFactory.triple(ex, ex, ex)]) const results = store.query('SELECT (YEAR(NOW()) AS ?y) WHERE {}') assert.strictEqual(1, results.length) }) }) describe('#update()', function () { it('INSERT DATA', function () { const store = new MemoryStore() store.update('INSERT DATA { <http://example.com> <http://example.com> <http://example.com> }') assert.strictEqual(1, store.size) }) it('DELETE DATA', function () { const store = new MemoryStore([dataFactory.triple(ex, ex, ex)]) store.update('DELETE DATA { <http://example.com> <http://example.com> <http://example.com> }') assert.strictEqual(0, store.size) }) it('DELETE WHERE', function () { const store = new MemoryStore([dataFactory.triple(ex, ex, ex)]) store.update('DELETE WHERE { ?v ?v ?v }') assert.strictEqual(0, store.size) }) }) describe('#load()', function () { it('load NTriples in the default graph', function () { const store = new MemoryStore() store.load('<http://example.com> <http://example.com> <http://example.com> .', 'application/n-triples') assert(store.has(dataFactory.triple(ex, ex, ex))) }) it('load NTriples in an other graph', function () { const store = new MemoryStore() store.load('<http://example.com> <http://example.com> <http://example.com> .', 'application/n-triples', null, ex) assert(store.has(dataFactory.quad(ex, ex, ex, ex))) }) it('load Turtle with a base IRI', function () { const store = new MemoryStore() store.load('<http://example.com> <http://example.com> <> .', 'text/turtle', 'http://example.com') assert(store.has(dataFactory.triple(ex, ex, ex))) }) it('load NQuads', function () { const store = new MemoryStore() store.load('<http://example.com> <http://example.com> <http://example.com> <http://example.com> .', 'application/n-quads') assert(store.has(dataFactory.quad(ex, ex, ex, ex))) }) it('load TriG with a base IRI', function () { const store = new MemoryStore() store.load('GRAPH <> { <http://example.com> <http://example.com> <> }', 'application/trig', 'http://example.com') assert(store.has(dataFactory.quad(ex, ex, ex, ex))) }) }) describe('#dump()', function () { it('dump dataset content', function () { const store = new MemoryStore([dataFactory.quad(ex, ex, ex, ex)]) assert.strictEqual('<http://example.com> <http://example.com> <http://example.com> <http://example.com> .\n', store.dump('application/n-quads')) }) it('dump named graph content', function () { const store = new MemoryStore([dataFactory.quad(ex, ex, ex, ex)]) assert.strictEqual('<http://example.com> <http://example.com> <http://example.com> .\n', store.dump('application/n-triples', ex)) }) it('dump default graph content', function () { const store = new MemoryStore([dataFactory.quad(ex, ex, ex, ex)]) assert.strictEqual('', store.dump('application/n-triples')) }) }) })
37.933775
150
0.61243
aca42049302be6b83cf804ba9c3f6072a00626b6
4,211
js
JavaScript
lib/install/inflate-shrinkwrap.js
desfero/npm
5d17fc945bcf48b69bc0dc4741028762f6bca02c
[ "Artistic-2.0" ]
2
2019-02-07T02:39:40.000Z
2019-02-08T01:28:16.000Z
lib/install/inflate-shrinkwrap.js
desfero/npm
5d17fc945bcf48b69bc0dc4741028762f6bca02c
[ "Artistic-2.0" ]
1
2021-09-02T17:03:30.000Z
2021-09-02T17:03:30.000Z
lib/install/inflate-shrinkwrap.js
desfero/npm
5d17fc945bcf48b69bc0dc4741028762f6bca02c
[ "Artistic-2.0" ]
5
2018-03-30T14:14:30.000Z
2020-10-20T21:50:21.000Z
'use strict' var asyncMap = require('slide').asyncMap var validate = require('aproba') var iferr = require('iferr') var realizeShrinkwrapSpecifier = require('./realize-shrinkwrap-specifier.js') var isRegistrySpecifier = require('./is-registry-specifier.js') var fetchPackageMetadata = require('../fetch-package-metadata.js') var annotateMetadata = require('../fetch-package-metadata.js').annotateMetadata var addShrinkwrap = require('../fetch-package-metadata.js').addShrinkwrap var addBundled = require('../fetch-package-metadata.js').addBundled var inflateBundled = require('./inflate-bundled.js') var npm = require('../npm.js') var createChild = require('./node.js').create var moduleName = require('../utils/module-name.js') var childPath = require('../utils/child-path.js') module.exports = function (tree, swdeps, finishInflating) { if (!npm.config.get('shrinkwrap')) return finishInflating() tree.loaded = true return inflateShrinkwrap(tree.path, tree, swdeps, finishInflating) } function inflateShrinkwrap (topPath, tree, swdeps, finishInflating) { validate('SOOF', arguments) var onDisk = {} tree.children.forEach(function (child) { onDisk[moduleName(child)] = child }) var dev = npm.config.get('dev') || (!/^prod(uction)?$/.test(npm.config.get('only')) && !npm.config.get('production')) || /^dev(elopment)?$/.test(npm.config.get('only')) var prod = !/^dev(elopment)?$/.test(npm.config.get('only')) // If the shrinkwrap has no dev dependencies in it then we'll leave the one's // already on disk. If it DOES have dev dependencies then ONLY those in the // shrinkwrap will be included. var swHasDev = Object.keys(swdeps).some(function (name) { return swdeps[name].dev }) tree.children = swHasDev ? [] : tree.children.filter(function (child) { return tree.package.devDependencies[moduleName(child)] }) return asyncMap(Object.keys(swdeps), doRealizeAndInflate, finishInflating) function doRealizeAndInflate (name, next) { return realizeShrinkwrapSpecifier(name, swdeps[name], topPath, iferr(next, andInflate(name, next))) } function andInflate (name, next) { return function (requested) { var sw = swdeps[name] var dependencies = sw.dependencies || {} if ((!prod && !sw.dev) || (!dev && sw.dev)) return next() var child = onDisk[name] if (childIsEquivalent(sw, requested, child)) { if (!child.fromShrinkwrap) child.fromShrinkwrap = requested.raw if (sw.dev) child.shrinkwrapDev = true tree.children.push(child) annotateMetadata(child.package, requested, requested.raw, topPath) return inflateShrinkwrap(topPath, child, dependencies || {}, next) } else { var from = sw.from || requested.raw var optional = sw.optional return fetchPackageMetadata(requested, topPath, iferr(next, andAddShrinkwrap(from, optional, dependencies, next))) } } } function andAddShrinkwrap (from, optional, dependencies, next) { return function (pkg) { pkg._from = from pkg._optional = optional addShrinkwrap(pkg, iferr(next, andAddBundled(pkg, dependencies, next))) } } function andAddBundled (pkg, dependencies, next) { return function () { return addBundled(pkg, iferr(next, andAddChild(pkg, dependencies, next))) } } function andAddChild (pkg, dependencies, next) { return function () { var child = createChild({ package: pkg, loaded: true, parent: tree, fromShrinkwrap: pkg._from, path: childPath(tree.path, pkg), realpath: childPath(tree.realpath, pkg), children: pkg._bundled || [] }) tree.children.push(child) if (pkg._bundled) { delete pkg._bundled inflateBundled(child, child, child.children) } inflateShrinkwrap(topPath, child, dependencies || {}, next) } } } function childIsEquivalent (sw, requested, child) { if (!child) return false if (child.fromShrinkwrap) return true if (sw.resolved) return child.package._resolved === sw.resolved if (!isRegistrySpecifier(requested) && sw.from) return child.package._from === sw.from return child.package.version === sw.version }
39.726415
170
0.684635
aca55242b3475770851383f8883d851e0fc21e4c
415
js
JavaScript
Server/userServices/getActivitySummary.js
akila543/javascript
42c4ab5c151d0b8533f6f47f3141b0a04b52f258
[ "MIT" ]
null
null
null
Server/userServices/getActivitySummary.js
akila543/javascript
42c4ab5c151d0b8533f6f47f3141b0a04b52f258
[ "MIT" ]
null
null
null
Server/userServices/getActivitySummary.js
akila543/javascript
42c4ab5c151d0b8533f6f47f3141b0a04b52f258
[ "MIT" ]
null
null
null
const MongoClient = require('mongodb').MongoClient; const RedisClient = require('redis').createClient(); //mongo url var url = "mongodb://localhost:27017/users"; module.exports = function(user,done){ MongoClient.connect(url,function(err,db){ if (err) { console.log(err); } else{ db.collection('profiles').findOne({userName:user},function(err,profile){ }); } }); };
20.75
78
0.633735
aca5659e4f5de72589745d479140f3883f2f2b8c
186
js
JavaScript
backend/web/js/order-status.js
angel-santiago31/electrop
6312502c8396c2e7c0c047ae64d9f2178c4babe2
[ "BSD-3-Clause" ]
1
2019-05-08T01:25:52.000Z
2019-05-08T01:25:52.000Z
backend/web/js/order-status.js
angel-santiago31/electrop
6312502c8396c2e7c0c047ae64d9f2178c4babe2
[ "BSD-3-Clause" ]
null
null
null
backend/web/js/order-status.js
angel-santiago31/electrop
6312502c8396c2e7c0c047ae64d9f2178c4babe2
[ "BSD-3-Clause" ]
null
null
null
$(function() { $('#updateOrderStatus').click(function() { $('#modalS').modal('show') .find('#modalContent') .load($(this).attr('value')); }); });
23.25
45
0.462366
aca5b4a8876dc1c31e833e8f73a614e4712bc97d
1,332
js
JavaScript
src/components/ListItem.js
RoyBurnet/concrete
a8ea78d2bfbdbc4b04c5a1384f699651c0e7800d
[ "MIT" ]
null
null
null
src/components/ListItem.js
RoyBurnet/concrete
a8ea78d2bfbdbc4b04c5a1384f699651c0e7800d
[ "MIT" ]
null
null
null
src/components/ListItem.js
RoyBurnet/concrete
a8ea78d2bfbdbc4b04c5a1384f699651c0e7800d
[ "MIT" ]
null
null
null
import React from "react" import { Link } from "gatsby" import styled from "styled-components" const GridContainerItemCard = styled.div` height: 191px; margin-bottom: 50px; ` const ArticleThumbnailCover = styled.div` background-color: #ff0099; opacity: 0.5; height: 191px; width: 276px; position: absolute; z-index: 10; clip-path: polygon(0 0, 0 100%, 100% 0); ` const GridContainerThumbnailImage = styled.img` width: 100%; ` const LinkTag = styled(Link)` color: white; &:hover { text-decoration: none; color: white; } ` const Title = styled.div` font-family: couture; color: #ff0099; margin: 0; font-size: 40px; margin-top: 50px; margin-bottom: 50px; ` const ListItem = props => { return ( <LinkTag to={`/article/${props.data.node.slug}`}> {console.log(props)} <GridContainerItemCard> <ArticleThumbnailCover> <div style={{ marginLeft: "5px", fontSize: "20px", zIndex: "100", }} > {" "} {props.data.node.title} </div> </ArticleThumbnailCover> <GridContainerThumbnailImage src={props.data.node.featured_media.source_url} /> </GridContainerItemCard> </LinkTag> ) } export default ListItem
19.880597
57
0.594595
aca5ed832f9517c88a26700b04bb5dfade29395a
472
js
JavaScript
sketch.js
Maroxis/Fractal-Tree
20c7e921cebeda1b18a7aba92ddbf1b54484a1a9
[ "MIT" ]
null
null
null
sketch.js
Maroxis/Fractal-Tree
20c7e921cebeda1b18a7aba92ddbf1b54484a1a9
[ "MIT" ]
null
null
null
sketch.js
Maroxis/Fractal-Tree
20c7e921cebeda1b18a7aba92ddbf1b54484a1a9
[ "MIT" ]
null
null
null
function setup(){ noFill() createCanvas(1200,800) branches = [] branches.push(new Branch(600,800,Math.PI/2)) growTree(treeHeight) for(var i = 0; i < branches.length; i++){ branches[i].draw(); } } function growTree(count){ count-- for(var i = branches.length-1; i >= 0 ; i--){ branches[i].age++ if(branches[i].leaf){ branches[i].grow() } } brLenght*=(0.72+0.01*branches[0].age) if(count > 0) growTree(count) }
18.153846
47
0.57839
aca6064045218e61378394b825d68dafbb66b45d
1,870
js
JavaScript
source/assets/js/src/mglAddTerrainControl.js
reyemtm/maps.coz.org
df405185d859f72b636daa592c4bad7fb484c78a
[ "MIT" ]
null
null
null
source/assets/js/src/mglAddTerrainControl.js
reyemtm/maps.coz.org
df405185d859f72b636daa592c4bad7fb484c78a
[ "MIT" ]
null
null
null
source/assets/js/src/mglAddTerrainControl.js
reyemtm/maps.coz.org
df405185d859f72b636daa592c4bad7fb484c78a
[ "MIT" ]
null
null
null
function mglAddTerrainControl() { this.onAdd = function (map) { this._map = map; this._btn = document.createElement('button'); this._btn.type = 'button'; this._btn['aria-label'] = 'Terrain Control'; this._btn['title'] = 'Terrain Control'; this._btn.innerHTML = "<img src='https://icongr.am/material/terrain.svg?size=24color=currentColor'>"; this._btn.style.borderRadius = "3px"; let hasTerrain = false; this._btn.onclick = function () { if (!hasTerrain) { if (!map.getSource('mapbox-dem')) { if (!confirm("This will add 3D rendered terrain to the map. This is experiemntal and my crash your browser. But's cool so check it out!!")) return map.addSource('mapbox-dem', { 'type': 'raster-dem', 'url': 'mapbox://mapbox.mapbox-terrain-dem-v1', 'tileSize': 512, 'maxzoom': 14 }); map.addLayer({ 'id': 'sky', 'type': 'sky', 'paint': { 'sky-type': 'atmosphere', 'sky-atmosphere-sun': [0.0, 0.0], 'sky-atmosphere-sun-intensity': 15 } }); } map.setTerrain({ 'source': 'mapbox-dem', 'exaggeration': 1.5 }); map.setPitch(70) hasTerrain = true this.style.backgroundColor = "yellow" }else{ map.setTerrain(null); hasTerrain = false; this.style.backgroundColor = "white" map.setPitch(0) } }; this._container = document.createElement('div'); this._container.className = 'mapboxgl-ctrl mapboxgl-ctrl-group'; this._container.appendChild(this._btn); return this._container; }; this.onRemove = function () { this._container.parentNode.removeChild(this._container); this._map = undefined; }; } export { mglAddTerrainControl };
31.694915
156
0.572727
aca64294140309a98d8c685cccd145656214c4b3
394
js
JavaScript
packages/chapter3/2_writing_good_assertions/4_asymmetric_matchers/inventoryController.test.js
Wcdaren/testing-javascript-applications
d234b6d0776f03d9c564d6db4923a53adf90d4a3
[ "Apache-2.0" ]
102
2020-03-10T02:04:21.000Z
2022-03-30T15:13:54.000Z
packages/chapter3/2_writing_good_assertions/4_asymmetric_matchers/inventoryController.test.js
Wcdaren/testing-javascript-applications
d234b6d0776f03d9c564d6db4923a53adf90d4a3
[ "Apache-2.0" ]
15
2020-03-09T22:45:03.000Z
2021-12-19T19:47:55.000Z
packages/chapter3/2_writing_good_assertions/4_asymmetric_matchers/inventoryController.test.js
Wcdaren/testing-javascript-applications
d234b6d0776f03d9c564d6db4923a53adf90d4a3
[ "Apache-2.0" ]
34
2020-05-08T18:15:17.000Z
2022-03-13T15:26:08.000Z
const { inventory, getInventory } = require("./inventoryController"); test("inventory contents", () => { inventory .set("cheesecake", 1) .set("macarroon", 3) .set("croissant", 3) .set("eclaire", 7); const result = getInventory(); expect(result).toEqual({ cheesecake: 1, macarroon: 3, croissant: 3, eclaire: 7, generatedAt: expect.any(Date) }); });
20.736842
69
0.604061
aca75170bb29f11d570b00b6ac2a2cbb7580fd5b
555
js
JavaScript
cypress/cypress/support/elements/interactives/connected-bio/RightPanelContentFourUp.js
concord-consortium/lara
a16bbc73b2a8851a525375c1d77ccc8f852d1506
[ "MIT" ]
1
2019-08-07T16:24:58.000Z
2019-08-07T16:24:58.000Z
cypress/cypress/support/elements/interactives/connected-bio/RightPanelContentFourUp.js
concord-consortium/lara
a16bbc73b2a8851a525375c1d77ccc8f852d1506
[ "MIT" ]
452
2015-01-28T16:11:00.000Z
2022-03-31T23:59:17.000Z
cypress/cypress/support/elements/interactives/connected-bio/RightPanelContentFourUp.js
concord-consortium/lara
a16bbc73b2a8851a525375c1d77ccc8f852d1506
[ "MIT" ]
2
2018-10-03T20:46:03.000Z
2020-01-03T09:53:25.000Z
class RightPanelContentFourUp { getFourUp(position) { return cy.get('[data-test="four-up-' + position + '"]') } getRightHeaderTabs() { return cy.get('[data-test="right-header"] > div.button-holder') } getTitle() { return cy.get('[data-test="right-title"]') } getHighlightedTab() { return cy.get("[data-test=four-up-top] > [data-test=two-up-display] > .left-abutment > [data-test=right-header] > .active") } getContent() { return cy.get('[data-test=right-content]') } } export default RightPanelContentFourUp;
22.2
127
0.643243
aca79f60bdbf0e15768fd35f4abd2808067f6bba
2,547
js
JavaScript
client/d3rings-actions-particles.js
sifbuilder/d3rings
2e90044a2374fd118e166661a9689e58dbb043c4
[ "MIT" ]
null
null
null
client/d3rings-actions-particles.js
sifbuilder/d3rings
2e90044a2374fd118e166661a9689e58dbb043c4
[ "MIT" ]
null
null
null
client/d3rings-actions-particles.js
sifbuilder/d3rings
2e90044a2374fd118e166661a9689e58dbb043c4
[ "MIT" ]
null
null
null
/* */ /* d3rings-actions-particles.js */ /* */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (factory((global.d3ringsActionsParticles = global.d3ringsActionsParticles || {}))); }(this, function (exports) { 'use strict'; // ____________________ keyMirror // https://github.com/STRML/keyMirror var keyMirror = function(obj, prefix) { var ret = {}; var key; if (!(obj instanceof Object && !Array.isArray(obj))) { throw new Error('keyMirror(...): Argument must be an object.'); } for (key in obj) { if (obj.hasOwnProperty(key)) { ret[key] = prefix + key; } } return ret; } var cttsParticles = { CREATE_PARTICLES: '', INTRODUCE_PARTICLES: '', START_PARTICLES: '', START_TICKER: '', STOP_PARTICLES: '', STOP_TICKER: '', TICK_PARTICLES: '', } var ActionTypes = keyMirror(cttsParticles, '') // ____________________ actions PARTICLES var ActionCreators = { createParticles(obj) { var action = { type: ActionTypes.CREATE_PARTICLES, // createParticles particlesPerTick: obj.particlesPerTick, x: obj.x, y: obj.y, randNormal: obj.randNormal, randNormal2: obj.randNormal2, xInit: obj.xInit, xEnd: obj.xEnd, lanes: obj.lanes, particlesGenerating: obj.particlesGenerating, currentView: obj.currentView, } return action }, introduceParticles(obj) { return { type: ActionTypes.INTRODUCE_PARTICLES, // introduceParticles particlesPerTick: obj.particlesPerTick, x: obj.x, y: obj.y, randNormal: obj.randNormal, randNormal2: obj.randNormal2, xInit: obj.xInit, xEnd: obj.xEnd, lanes: obj.lanes, particlesGenerating: obj.particlesGenerating, currentView: obj.currentView, } }, startParticles() { return { type: ActionTypes.START_PARTICLES } }, startTicker() { return { type: ActionTypes.START_TICKER }; }, stopTicker() { return { type: ActionTypes.STOP_TICKER }; }, stopParticles() { return { type: ActionTypes.STOP_PARTICLES } }, tickParticles(arg) { return { type: ActionTypes.TICK_PARTICLES, // tickParticles width: arg.width, height: arg.height, gravity: arg.gravity, lanes: arg.lanes, } }, } exports.ActionTypes = ActionTypes exports.ActionCreators = ActionCreators }));
23.583333
85
0.631724
aca7d1ad58c6e1ac3409411f06d7307c00215e42
1,069
js
JavaScript
assets/dashboard/plugins/ckeditor/plugins/flash/lang/et.js
gentaprima/skirpsinurul
e2dbf1e25f04f7667a2c2e83eb68342155824959
[ "MIT" ]
2,950
2016-08-20T11:19:35.000Z
2022-03-25T21:27:51.000Z
assets/dashboard/plugins/ckeditor/plugins/flash/lang/et.js
gentaprima/skirpsinurul
e2dbf1e25f04f7667a2c2e83eb68342155824959
[ "MIT" ]
371
2020-03-04T21:51:56.000Z
2022-03-31T20:59:11.000Z
assets/dashboard/plugins/ckeditor/plugins/flash/lang/et.js
gentaprima/skirpsinurul
e2dbf1e25f04f7667a2c2e83eb68342155824959
[ "MIT" ]
1,947
2016-08-20T21:51:27.000Z
2022-03-10T02:07:05.000Z
CKEDITOR.plugins.setLang("flash","et",{access:"Skriptide ligipääs",accessAlways:"Kõigile",accessNever:"Mitte ühelegi",accessSameDomain:"Samalt domeenilt",alignAbsBottom:"Abs alla",alignAbsMiddle:"Abs keskele",alignBaseline:"Baasjoonele",alignTextTop:"Tekstist üles",bgcolor:"Tausta värv",chkFull:"Täisekraan lubatud",chkLoop:"Korduv",chkMenu:"Flashi menüü lubatud",chkPlay:"Automaatne start ",flashvars:"Flashi muutujad",hSpace:"H. vaheruum",properties:"Flashi omadused",propertiesTab:"Omadused",quality:"Kvaliteet", qualityAutoHigh:"Automaatne kõrge",qualityAutoLow:"Automaatne madal",qualityBest:"Parim",qualityHigh:"Kõrge",qualityLow:"Madal",qualityMedium:"Keskmine",scale:"Mastaap",scaleAll:"Näidatakse kõike",scaleFit:"Täpne sobivus",scaleNoBorder:"Äärist ei ole",title:"Flashi omadused",vSpace:"V. vaheruum",validateHSpace:"H. vaheruum peab olema number.",validateSrc:"Palun kirjuta lingi URL",validateVSpace:"V. vaheruum peab olema number.",windowMode:"Akna režiim",windowModeOpaque:"Läbipaistmatu",windowModeTransparent:"Läbipaistev", windowModeWindow:"Aken"});
356.333333
525
0.810103
aca83284a68aadc0e3ca63d310c8c52bbaa53fa7
7,803
js
JavaScript
dist/realtime/realtimefeed.js
VolatilityGroup/volatility-ws
a70e171ebc7ddfff6aa6691d3435e3fc8d23c9ae
[ "MIT" ]
null
null
null
dist/realtime/realtimefeed.js
VolatilityGroup/volatility-ws
a70e171ebc7ddfff6aa6691d3435e3fc8d23c9ae
[ "MIT" ]
null
null
null
dist/realtime/realtimefeed.js
VolatilityGroup/volatility-ws
a70e171ebc7ddfff6aa6691d3435e3fc8d23c9ae
[ "MIT" ]
null
null
null
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.RealTimeBase = void 0; const debug_1 = __importDefault(require("debug")); const ws_1 = __importDefault(require("ws")); const utils_1 = require("../utils"); let connectionCounter = 1; class RealTimeBase { constructor(_methodology, _timePeriod, _asset, _idleTimeout, _onError, _apiKey) { this._methodology = _methodology; this._timePeriod = _timePeriod; this._asset = _asset; this._idleTimeout = _idleTimeout; this._onError = _onError; this._apiKey = _apiKey; this.ratelimit = 0; this._receivedMessagesCount = 0; this._connectionId = connectionCounter++; this._onConnectionEstabilished = async () => { try { const subscribeMessages = this.buildSubscribe(); let symbolsCount = 0; this.onConnected(); for (const message of subscribeMessages) { this.send(message); if (this.ratelimit > 0) { await (0, utils_1.wait)(this.ratelimit); } } this.debug("(connection id: %d) estabilished connection", this._connectionId); while (this._receivedMessagesCount < symbolsCount * 2) { await (0, utils_1.wait)(100); } // wait a second just in case before starting fetching the snapshots await (0, utils_1.wait)(1 * utils_1.ONE_SEC_IN_MS); if (this._ws.readyState === ws_1.default.CLOSED) { return; } } catch (e) { this.debug("(connection id: %d) providing manual snapshots error: %o", this._connectionId, e); this._ws.emit("error", e); } }; this._onConnectionClosed = (event) => { this.debug("(connection id: %d) connection closed %s", this._connectionId, event.reason); }; this.debug = (0, debug_1.default)(`volatility-ws:realtime:${_methodology}.${_timePeriod}.${_asset}`); const headers = { authorization: `Bearer ${_apiKey}`, }; this._wsClientOptions = { perMessageDeflate: false, handshakeTimeout: 10 * utils_1.ONE_SEC_IN_MS, skipUTF8Validation: true, headers, }; if (utils_1.httpsProxyAgent !== undefined) { this._wsClientOptions.agent = utils_1.httpsProxyAgent; } } [Symbol.asyncIterator]() { return this._stream(); } async *_stream() { let staleConnectionTimerId; let pingTimerId; let retries = 0; while (true) { try { const envUrl = process.env.WSS_URL; const wsUrl = envUrl || this.wssURL; this.debug(`Connected to ${wsUrl}`); this._ws = new ws_1.default(wsUrl, this._wsClientOptions); this._ws.onopen = this._onConnectionEstabilished; this._ws.onclose = this._onConnectionClosed; staleConnectionTimerId = this._monitorConnectionIfStale(); pingTimerId = this.pingTimer(); const realtimeMessagesStream = ws_1.default.createWebSocketStream(this._ws, { readableObjectMode: true, readableHighWaterMark: 8096, // since we're in object mode, let's increase hwm a little from default of 16 messages buffered }); for await (let message of realtimeMessagesStream) { if (this.decompress !== undefined) { message = this.decompress(message); } const messageDeserialized = JSON.parse(message); if (this.isError(messageDeserialized)) { throw new Error(`Received error message:${message.toString()}`); } if (true || this.isHeartbeat(messageDeserialized) === false) { this._receivedMessagesCount++; } this.onMessage(messageDeserialized); yield messageDeserialized; if (retries > 0) { retries = 0; } } // clear monitoring connection timer and notify about disconnect if (staleConnectionTimerId !== undefined) { clearInterval(staleConnectionTimerId); } yield { _disconnect: true }; } catch (error) { if (this._onError !== undefined) { this._onError(error); } retries++; const MAX_DELAY = 32 * 1000; const isRateLimited = error.message.includes("429"); let delay; if (isRateLimited) { delay = (MAX_DELAY / 2) * retries; } else { delay = Math.pow(2, retries - 1) * 1000; if (delay > MAX_DELAY) { delay = MAX_DELAY; } } this.debug("(connection id: %d) %s.%s.%s real-time feed connection error, retries count: %d, next retry delay: %dms, rate limited: %s error message: %o", this._connectionId, this._methodology, this._timePeriod, this._asset, retries, delay, isRateLimited, error); // clear monitoring connection timer and notify about disconnect if (staleConnectionTimerId !== undefined) { clearInterval(staleConnectionTimerId); } yield { _disconnect: true }; await (0, utils_1.wait)(delay); } finally { // stop timers if (staleConnectionTimerId !== undefined) { clearInterval(staleConnectionTimerId); } if (pingTimerId !== undefined) { clearInterval(pingTimerId); } } } } send(msg) { if (this._ws === undefined) { return; } if (this._ws.readyState !== ws_1.default.OPEN) { return; } this._ws.send(JSON.stringify(msg)); } isHeartbeat(_msg) { return false; } onMessage(_msg) { } onConnected() { } _monitorConnectionIfStale() { if (this._idleTimeout === undefined || this._idleTimeout === 0) { return; } // set up timer that checks against open, but stale connections that do not return any data return setInterval(() => { if (this._ws === undefined) { return; } if (this._receivedMessagesCount === 0) { this.debug("(connection id: %d) did not received any messages within %d ms timeout, terminating connection...", this._connectionId, this._idleTimeout); this._ws.terminate(); } this._receivedMessagesCount = 0; }, this._idleTimeout); } pingTimer() { return setInterval(() => { if (this._ws === undefined || this._ws.readyState !== ws_1.default.OPEN) { return; } this.debug(`sending ping`); this._ws.ping(); }, 5 * utils_1.ONE_SEC_IN_MS); } } exports.RealTimeBase = RealTimeBase; //# sourceMappingURL=realtimefeed.js.map
41.951613
278
0.520056
aca84ee144aa312ab128304a0e12aa989569721c
23,170
js
JavaScript
test/t1_esp2.js
Rumbo74/ioBroker.myfirsttest
0bea927c20838077eb139bf6d3ec0492ad7ce127
[ "MIT" ]
null
null
null
test/t1_esp2.js
Rumbo74/ioBroker.myfirsttest
0bea927c20838077eb139bf6d3ec0492ad7ce127
[ "MIT" ]
null
null
null
test/t1_esp2.js
Rumbo74/ioBroker.myfirsttest
0bea927c20838077eb139bf6d3ec0492ad7ce127
[ "MIT" ]
null
null
null
// testing the parser of the exp2 - protocol // ######################################### // load requires const parser = require('../lib/tools/ESP2Packet'); var assert = require('assert'); // information of file describe('in file t1_esp2.js #########################################################', function() { it('for information', function(done) { done(); }); }); // testing - mocha working? describe('mocha working?', function() { it('should pass if mocha is working', function(done) { done(); }); }); // testing - checksum describe('testTelegram with wrong checksum', function() { describe('checksum: not valid', function() { var testTelegram = Buffer.from('a55a0b0500000000000010012049', 'hex'); var result = parser(testTelegram); //console.log(result) it('should return "false"', function() { assert.equal(result.valid, false ); }); }); describe('checksum: valid', function() { var testTelegram = Buffer.from('a55a0b0500000000000010012041', 'hex'); var result = parser(testTelegram); //console.log(result) it('should return "true"', function() { assert.equal(result.valid, true ); }); }); }); // testing - telegram length describe('testTelegram with wrong length', function() { describe('lenght: to short start of telegram', function() { var testTelegram = Buffer.from('a55a0b050000000000001', 'hex'); var result = parser(testTelegram); //console.log(result) it('should return "false"', function() { assert.equal(result.valid, false ); }); }); describe('lenght: to short end of telegram', function() { var testTelegram = Buffer.from('0000010012041', 'hex'); var result = parser(testTelegram); //console.log(result) it('should return "false"', function() { assert.equal(result.valid, false ); }); }); describe('lenght: to long', function() { var testTelegram = Buffer.from('a55a0b0500000056316515631531530000001', 'hex'); var result = parser(testTelegram); //console.log(result) it('should return "false"', function() { assert.equal(result.valid, false ); }); }); }); // testing - Sync-bytes describe('testTelegram with wrong Sync-bytes', function() { describe('Sync-bytes: wrong', function() { var testTelegram = Buffer.from('5aa50b0500000000000010012041', 'hex'); var result = parser(testTelegram); //console.log(result) it('should return "false"', function() { assert.equal(result.valid, false ); }); }); }); // testing - testTelegram_1 describe('testTelegram_1: a55a0b0500000000000010012041', function() { const testTelegram_1 = Buffer.from('a55a0b0500000000000010012041', 'hex'); var result = parser(testTelegram_1); //console.log(result) describe('headerId: "RRT"', function() { it('should return "RRT"', function() { assert.equal(result.headerId, 'RRT'); }); }); describe('valid: "true"', function() { it('should return "true"', function() { assert.equal(result.valid, true); }); }); describe('org: "RPS"', function() { it('should return "RPS"', function() { assert.equal(result.org, "RPS"); }); }); describe('transmitterId: "00001001"', function() { it('should return "00001001"', function() { assert.equal(result.transmitterId, "00001001"); }); }); describe('T21: "PTM 120"', function() { it('should return "PTM 120"', function() { assert.equal(result.T21, "PTM 120"); }); }); describe('NU: "U-message"', function() { it('should return "U-message"', function() { assert.equal(result.NU, "U-message"); }); }); describe('repeaterLevel: 0', function() { it('should return 0', function() { assert.equal(result.repeaterLevel, 0); }); }); describe('simultaneouslyPressed: "0 Buttons"', function() { it('should return "0 Buttons"', function() { assert.equal(result.simultaneouslyPressed, "0 Buttons"); }); }); describe('PR: "released"', function() { it('should return "released"', function() { assert.equal(result.PR, "released"); }); }); }); // testing - testTelegram_2 describe('testTelegram_2: a55a0b0500000000000010022042', function() { const testTelegram_2 = Buffer.from('a55a0b0500000000000010022042', 'hex'); var result = parser(testTelegram_2); //console.log(result) describe('headerId: "RRT"', function() { it('should return "RRT"', function() { assert.equal(result.headerId, 'RRT'); }); }); describe('valid: "true"', function() { it('should return "true"', function() { assert.equal(result.valid, true); }); }); describe('org: "RPS"', function() { it('should return "RPS"', function() { assert.equal(result.org, "RPS"); }); }); describe('transmitterId: "00001002"', function() { it('should return "00001002"', function() { assert.equal(result.transmitterId, "00001002"); }); }); describe('T21: "PTM 120"', function() { it('should return "PTM 120"', function() { assert.equal(result.T21, "PTM 120"); }); }); describe('NU: "U-message"', function() { it('should return "U-message"', function() { assert.equal(result.NU, "U-message"); }); }); describe('repeaterLevel: 0', function() { it('should return 0', function() { assert.equal(result.repeaterLevel, 0); }); }); describe('simultaneouslyPressed: "0 Buttons"', function() { it('should return "0 Buttons"', function() { assert.equal(result.simultaneouslyPressed, "0 Buttons"); }); }); describe('PR: "released"', function() { it('should return "released"', function() { assert.equal(result.PR, "released"); }); }); }); // testing - testTelegram_3 describe('testTelegram_3: a55a0b05500000000000100230a2', function() { const testTelegram_3 = Buffer.from('a55a0b05500000000000100230a2', 'hex'); var result = parser(testTelegram_3); //console.log(result) describe('headerId: "RRT"', function() { it('should return "RRT"', function() { assert.equal(result.headerId, 'RRT'); }); }); describe('valid: "true"', function() { it('should return "true"', function() { assert.equal(result.valid, true); }); }); describe('org: "RPS"', function() { it('should return "RPS"', function() { assert.equal(result.org, "RPS"); }); }); describe('transmitterId: "00001002"', function() { it('should return "00001002"', function() { assert.equal(result.transmitterId, "00001002"); }); }); describe('T21: "PTM 120"', function() { it('should return "PTM 120"', function() { assert.equal(result.T21, "PTM 120"); }); }); describe('NU: "N-message"', function() { it('should return "N-message"', function() { assert.equal(result.NU, "N-message"); }); }); describe('repeaterLevel: 0', function() { it('should return 0', function() { assert.equal(result.repeaterLevel, 0); }); }); describe('rockerId: 1', function() { it('should return 1', function() { assert.equal(result.rockerId, 1); }); }); describe('UD: "I-button"', function() { it('should return "I-button"', function() { assert.equal(result.UD, "I-button"); }); }); describe('PR: "pressed"', function() { it('should return "pressed"', function() { assert.equal(result.PR, "pressed"); }); }); describe('secondRockerId: 0', function() { it('should return 0', function() { assert.equal(result.secondRockerId, 0); }); }); describe('SUD: "I-button"', function() { it('should return "I-button"', function() { assert.equal(result.SUD, "I-button"); }); }); describe('SA: "No second action"', function() { it('should return "No second action"', function() { assert.equal(result.SA, "No second action"); }); }); }); // testing - testTelegram_4 describe('testTelegram_4: a55a0b05700000000000100130c1', function() { const testTelegram_4 = Buffer.from('a55a0b05700000000000100130c1', 'hex'); var result = parser(testTelegram_4); //console.log(result) describe('headerId: "RRT"', function() { it('should return "RRT"', function() { assert.equal(result.headerId, 'RRT'); }); }); describe('valid: "true"', function() { it('should return "true"', function() { assert.equal(result.valid, true); }); }); describe('org: "RPS"', function() { it('should return "RPS"', function() { assert.equal(result.org, "RPS"); }); }); describe('transmitterId: "00001001"', function() { it('should return "00001001"', function() { assert.equal(result.transmitterId, "00001001"); }); }); describe('T21: "PTM 120"', function() { it('should return "PTM 120"', function() { assert.equal(result.T21, "PTM 120"); }); }); describe('NU: "N-message"', function() { it('should return "N-message"', function() { assert.equal(result.NU, "N-message"); }); }); describe('repeaterLevel: 0', function() { it('should return 0', function() { assert.equal(result.repeaterLevel, 0); }); }); describe('rockerId: 1', function() { it('should return 1', function() { assert.equal(result.rockerId, 1); }); }); describe('UD: "O-button"', function() { it('should return "O-button"', function() { assert.equal(result.UD, "O-button"); }); }); describe('PR: "pressed"', function() { it('should return "pressed"', function() { assert.equal(result.PR, "pressed"); }); }); describe('secondRockerId: 0', function() { it('should return 0', function() { assert.equal(result.secondRockerId, 0); }); }); describe('SUD: "I-button"', function() { it('should return "I-button"', function() { assert.equal(result.SUD, "I-button"); }); }); describe('SA: "No second action"', function() { it('should return "No second action"', function() { assert.equal(result.SA, "No second action"); }); }); }); // testing - testTelegram_5 describe('testTelegram_5: a55a8b07020000080000000400a0', function() { const testTelegram_5 = Buffer.from('a55a8b07020000080000000400a0', 'hex'); var result = parser(testTelegram_5); //console.log(result) describe('headerId: "RMT"', function() { it('should return "RMT"', function() { assert.equal(result.headerId, "RMT"); }); }); describe('valid: "true"', function() { it('should return "true"', function() { assert.equal(result.valid, true); }); }); describe('org: "4BS"', function() { it('should return "4BS"', function() { assert.equal(result.org, "4BS"); }); }); describe('transmitterId: "00000004"', function() { it('should return "00000004"', function() { assert.equal(result.transmitterId, "00000004"); }); }); describe('repeaterLevel: 0', function() { it('should return 0', function() { assert.equal(result.repeaterLevel, 0); }); }); describe('analogInput1: 0', function() { it('should return 0', function() { assert.equal(result.analogInput1, 0); }); }); describe('analogInput2: 0', function() { it('should return 0', function() { assert.equal(result.analogInput2, 0); }); }); describe('analogInput3: 2', function() { it('should return 2', function() { assert.equal(result.analogInput3, 2); }); }); describe('digitalInput1: 0', function() { it('should return 0', function() { assert.equal(result.digitalInput1, 0); }); }); describe('digitalInput2: 0', function() { it('should return 0', function() { assert.equal(result.digitalInput2, 0); }); }); describe('digitalInput3: 0', function() { it('should return 0', function() { assert.equal(result.digitalInput3, 0); }); }); describe('digitalInput4: 1', function() { it('should return 1', function() { assert.equal(result.digitalInput4, 1); }); }); }); // testing - testTelegram_6 describe('testTelegram_6: a55a8b07020b00090000000400ac', function() { const testTelegram_6 = Buffer.from('a55a8b07020b00090000000400ac', 'hex'); var result = parser(testTelegram_6); //console.log(result) describe('headerId: "RMT"', function() { it('should return "RMT"', function() { assert.equal(result.headerId, "RMT"); }); }); describe('valid: "true"', function() { it('should return "true"', function() { assert.equal(result.valid, true); }); }); describe('org: "4BS"', function() { it('should return "4BS"', function() { assert.equal(result.org, "4BS"); }); }); describe('transmitterId: "00000004"', function() { it('should return "00000004"', function() { assert.equal(result.transmitterId, "00000004"); }); }); describe('repeaterLevel: 0', function() { it('should return 0', function() { assert.equal(result.repeaterLevel, 0); }); }); describe('analogInput1: 0', function() { it('should return 0', function() { assert.equal(result.analogInput1, 0); }); }); describe('analogInput2: 11', function() { it('should return 11', function() { assert.equal(result.analogInput2, 11); }); }); describe('analogInput3: 2', function() { it('should return 2', function() { assert.equal(result.analogInput3, 2); }); }); describe('digitalInput1: 1', function() { it('should return 1', function() { assert.equal(result.digitalInput1, 1); }); }); describe('digitalInput2: 0', function() { it('should return 0', function() { assert.equal(result.digitalInput2, 0); }); }); describe('digitalInput3: 0', function() { it('should return 0', function() { assert.equal(result.digitalInput3, 0); }); }); describe('digitalInput4: 1', function() { it('should return 1', function() { assert.equal(result.digitalInput4, 1); }); }); }); // testing - testTelegram_7 describe('testTelegram_7: a55a8b07020c00090000000400ad', function() { const testTelegram_7 = Buffer.from('a55a8b07020c00090000000400ad', 'hex'); var result = parser(testTelegram_7); //console.log(result) describe('headerId: "RMT"', function() { it('should return "RMT"', function() { assert.equal(result.headerId, "RMT"); }); }); describe('valid: "true"', function() { it('should return "true"', function() { assert.equal(result.valid, true); }); }); describe('org: "4BS"', function() { it('should return "4BS"', function() { assert.equal(result.org, "4BS"); }); }); describe('transmitterId: "00000004"', function() { it('should return "00000004"', function() { assert.equal(result.transmitterId, "00000004"); }); }); describe('repeaterLevel: 0', function() { it('should return 0', function() { assert.equal(result.repeaterLevel, 0); }); }); describe('analogInput1: 0', function() { it('should return 0', function() { assert.equal(result.analogInput1, 0); }); }); describe('analogInput2: 12', function() { it('should return 12', function() { assert.equal(result.analogInput2, 12); }); }); describe('analogInput3: 2', function() { it('should return 2', function() { assert.equal(result.analogInput3, 2); }); }); describe('digitalInput1: 1', function() { it('should return 1', function() { assert.equal(result.digitalInput1, 1); }); }); describe('digitalInput2: 0', function() { it('should return 0', function() { assert.equal(result.digitalInput2, 0); }); }); describe('digitalInput3: 0', function() { it('should return 0', function() { assert.equal(result.digitalInput3, 0); }); }); describe('digitalInput4: 1', function() { it('should return 1', function() { assert.equal(result.digitalInput4, 1); }); }); }); // // // // //const testTelegram_2 = Buffer.from('', 'hex'); //const testTelegram_3 = Buffer.from('', 'hex'); //const testTelegram_4 = Buffer.from('', 'hex'); //const testTelegram_5 = Buffer.from('', 'hex'); //const testTelegram_6 = Buffer.from('', 'hex'); //const testTelegram_7 = Buffer.from('', 'hex'); // //const arrayOfTelegrams = new Array( Buffer.from('a55a0b0500000000000010012041', 'hex'), // Buffer.from('a55a0b0500000000000010022042', 'hex'), // Buffer.from('a55a0b05500000000000100230a2', 'hex'), // Buffer.from('a55a0b05700000000000100130c1', 'hex'), // Buffer.from('a55a8b07020000080000000400a0', 'hex'), // Buffer.from('a55a8b07020b00090000000400ac', 'hex'), // Buffer.from('a55a8b07020c00090000000400ad', 'hex') // ) // //var result = parser(testTelegram_1); // //console.log(result) // // // // //arrayOfTelegrams.forEach(myFunction) // //function myFunction(item, index, arr) { // // console.log(arr[index]) // // var result = parser(arr[index]); // // console.log(result) // // //} // // hier lesen // https://autom8able.com/blog/mochajs-setup // https://blog.logrocket.com/a-quick-and-complete-guide-to-mocha-testing-d0e0ea09f09d/ // https://www.chaijs.com/api/assert/ // //console.log('in esp2') // //describe('smoke test', function() { // it('should pass if mocha is working', function(done) { // done(); // }); //}); // //describe('smoke test', function() { // it('should pass if mocha is working', function(done) { // done(); // }); // it.skip('should fail a test on error', function(done) { // throw new Error('This test should fail!'); // done(); // }); //}); // // // call something to test //require('./firstTests.js'); // // call the tests for the esp2 protocol //require('./esp2.js'); // // // //console.log('in esp2') // //var assert = require('assert'); //describe('Array', function() { // describe('#indexOf() esp2 ', function() { // it('should return -1 when the value is not present', function() { // assert.equal([1, 2, 3].indexOf(4), -1); // }); // }); //}); // // // //console.log('in firstTests') // //var assert = require('chai').assert; //var numbers = [1, 2, 3, 4, 5]; // //assert.isArray(numbers, 'is array of numbers'); //assert.include(numbers, 2, 'array contains 2'); //assert.lengthOf(numbers, 5, 'array contains 5 numbers'); // // // var assert = require('assert'); //describe('Array', function() { // describe('#indexOf() firstTests', function() { // it('is array of numbers', function() { // assert.isArray(numbers, 'is array of numbers'); // }); // }); //}); // // // // // //var expect = require('chai').expect; //var numbers = [1, 2, 3, 4, 5]; // //expect(numbers).to.be.an('array').that.includes(2); //expect(numbers).to.have.lengthOf(5); // // // // // //var should = require('chai').should(); //var numbers = [1, 2, 3, 4, 5]; // //numbers.should.be.an('array').that.includes(2); //numbers.should.have.lengthOf(5); // ######################################################################################### // Config auslesen um zu speichern?? // // //console.log( getObject( "enocean.0.123450" )); // Objekt 123450 aus Adapter enocean.0 holen //console.log( getObject( "enocean.0.info" )); // Objekt info aus Adapter enocean.0 holen //console.log( getObject( "enocean.0.info" )); // Objekt info aus Adapter enocean.0 holen //console.log( getObject( "system.adapter.enocean.0" )); // angeblich den gesamten Adapter auslesen // // aber Achtung es sind nicht alle Objekte aufgelistet // // //
33.726346
111
0.505999
aca8974582fe86eafc4c242c8459f1cfe890c2d3
68
js
JavaScript
wsh/vendor/Shell.js
bga/safejs
1100324024e34b670bcbe70b35d0667ec3cdfe81
[ "Apache-2.0" ]
null
null
null
wsh/vendor/Shell.js
bga/safejs
1100324024e34b670bcbe70b35d0667ec3cdfe81
[ "Apache-2.0" ]
null
null
null
wsh/vendor/Shell.js
bga/safejs
1100324024e34b670bcbe70b35d0667ec3cdfe81
[ "Apache-2.0" ]
null
null
null
export #(p) { p.stdOut = `` p.stdErr = `` p.exitCode = 0 }
13.6
17
0.455882
aca8e797eb38c4f8103cbc5570ee19dc4d8e727c
1,147
js
JavaScript
webpack.config.js
AlexandrLo/webpack-sass-boilerplate
7c336bc706ac43df4e3b890b4130430e5ad396b2
[ "MIT" ]
null
null
null
webpack.config.js
AlexandrLo/webpack-sass-boilerplate
7c336bc706ac43df4e3b890b4130430e5ad396b2
[ "MIT" ]
null
null
null
webpack.config.js
AlexandrLo/webpack-sass-boilerplate
7c336bc706ac43df4e3b890b4130430e5ad396b2
[ "MIT" ]
null
null
null
const webpack = require("webpack"); const path = require("path"); const HtmlWebpackPlugin = require("html-webpack-plugin"); module.exports = { mode: "development", entry: { app: path.join(__dirname, "src", "js", "app.js"), }, output: { path: path.resolve(__dirname, "dist"), filename: "bundle.js", }, module: { rules: [ { test: /\.s[ac]ss$/i, use: [ "style-loader", { loader: "css-loader", options: { sourceMap: true, }, }, "resolve-url-loader", { loader: "sass-loader", options: { sourceMap: true, }, }, ], }, ], }, plugins: [ new HtmlWebpackPlugin({ filename: "index.html", template: "src/index.html", chunks: ["app"], }), new HtmlWebpackPlugin({ filename: "examples.html", template: "src/examples.html", chunks: ["app"], }), ], devServer: { static: { directory: path.join(__dirname, "public"), }, compress: true, port: 8000, }, };
20.122807
57
0.469922
aca905ed07e089927d18bf37e03b39cde77bf51a
32
js
JavaScript
src/utils/classes/index.js
moshemo/fresh-ui-2
99e82d586e44c8616479d0fa836bf92ca939e448
[ "MIT" ]
null
null
null
src/utils/classes/index.js
moshemo/fresh-ui-2
99e82d586e44c8616479d0fa836bf92ca939e448
[ "MIT" ]
1
2021-05-10T14:46:19.000Z
2021-05-10T14:46:19.000Z
src/utils/classes/index.js
moshemo/fresh-ui-2
99e82d586e44c8616479d0fa836bf92ca939e448
[ "MIT" ]
null
null
null
export * from './firebaseClass'
16
31
0.71875
aca9229a6b9decfbffb3a7a9a85c5f3099a078eb
169
js
JavaScript
app/assets/config/manifest.js
xiaowudeshen/SSID
097e07a11eb5a66600287aa48c5565d99f39514d
[ "Ruby" ]
15
2015-03-15T11:38:06.000Z
2022-03-17T02:16:50.000Z
app/assets/config/manifest.js
xiaowudeshen/SSID
097e07a11eb5a66600287aa48c5565d99f39514d
[ "Ruby" ]
79
2020-07-10T03:36:29.000Z
2022-03-31T01:40:25.000Z
app/assets/config/manifest.js
xiaowudeshen/SSID
097e07a11eb5a66600287aa48c5565d99f39514d
[ "Ruby" ]
16
2016-03-02T06:28:55.000Z
2021-12-16T07:35:26.000Z
//= link_tree ../images //= link_directory ../stylesheets .css //= link_directory ../javascripts .js //= link explorer_canvas/excanvas.compiled.js //= link jit/jit-yc.js
33.8
45
0.715976
acaaafbf4364c20140e383d98f592e2c19d5e455
754
js
JavaScript
demos/gallery/samples/geospatial/Leaflet/Cluster Pins MapBox.js
ghalliday/Visualization
7898acfdfa0c1f6f3551ae01d4af2213a4e2f80e
[ "Apache-2.0" ]
null
null
null
demos/gallery/samples/geospatial/Leaflet/Cluster Pins MapBox.js
ghalliday/Visualization
7898acfdfa0c1f6f3551ae01d4af2213a4e2f80e
[ "Apache-2.0" ]
null
null
null
demos/gallery/samples/geospatial/Leaflet/Cluster Pins MapBox.js
ghalliday/Visualization
7898acfdfa0c1f6f3551ae01d4af2213a4e2f80e
[ "Apache-2.0" ]
null
null
null
import { ClusterPins } from "@hpcc-js/map"; new ClusterPins() .target("target") .columns(["latitude", "longtitude", "color", "icon"]) .data([ [51.897969, -8.475438, "green", "fa-plus"], [35.652930, 139.687128], [37.665074, -122.384375, "navy"], [32.690680, -117.178540], [39.709455, -104.969859], [41.244123, -95.961610, "navy"], [32.688980, -117.192040], [45.786490, -108.526600], [45.796180, -108.535652], [45.774320, -108.494370], [45.777062, -108.549835, "red", "fa-minus"] ]) .mapType("MapBox") .latitudeColumn("latitude") .longtitudeColumn("longtitude") .faCharColumn("icon") .fillColorColumn("color") .render() ;
27.925926
57
0.543767
acab7c0f8f543ca7b72bfcfdcb399f6a20cec370
2,036
js
JavaScript
app/containers/HomePage/ProductCard.js
Mathilol/Fridge-Valet
dadcdebbaa46315375062b93af4a82cefc4e42fc
[ "MIT" ]
null
null
null
app/containers/HomePage/ProductCard.js
Mathilol/Fridge-Valet
dadcdebbaa46315375062b93af4a82cefc4e42fc
[ "MIT" ]
2
2020-03-22T20:38:36.000Z
2021-09-03T00:50:10.000Z
app/containers/HomePage/ProductCard.js
Mathilol/Fridge-Valet
dadcdebbaa46315375062b93af4a82cefc4e42fc
[ "MIT" ]
null
null
null
import React from 'react'; import { Grid, Typography, Link } from '@material-ui/core'; import Card from '@material-ui/core/Card'; import CardActionArea from '@material-ui/core/CardActionArea'; import CardActions from '@material-ui/core/CardActions'; import CardContent from '@material-ui/core/CardContent'; import CardMedia from '@material-ui/core/CardMedia'; import Button from '@material-ui/core/Button'; import { Link as RouterLink } from 'react-router-dom'; import PropTypes from 'prop-types'; import _ from 'lodash'; const ProductCard = ({ product }) => { let imageSrc = 'https://lorempixel.com/100/190/nature/6'; if (!_.isEmpty(product.images[0])) { imageSrc = product.images[0].src_small; } return ( <Grid item key={product._id}> <Card> <CardActionArea> <Link component={RouterLink} color="inherit" style={{ textDecoration: 'none' }} to={`/product/${product._id}`} > <CardMedia component="img" alt="Contemplative Reptile" height="140" image={imageSrc} title={product.name.en} /> <CardContent> <Typography gutterBottom variant="h5" component="h2"> {product.name.en} </Typography> <Typography component="p">{product.shop}</Typography> </CardContent> </Link> </CardActionArea> <CardActions> <Button size="small" color="primary"> Share </Button> <Button size="small" color="primary"> <Link component={RouterLink} color="inherit" style={{ textDecoration: 'none' }} to={`/product/${product._id}`} > product info </Link> </Button> </CardActions> </Card> </Grid> ); }; ProductCard.propTypes = { product: PropTypes.object, }; export default ProductCard;
29.507246
67
0.555992
acab9e70f0bebdd039c4bdb450bc60900d46d987
4,005
js
JavaScript
tests/unit/logger.tests.js
meteor-space/base
57f065de22b3dd406c3c0686c329808a6ac47768
[ "MIT" ]
49
2015-09-07T12:51:35.000Z
2019-04-03T07:30:24.000Z
tests/unit/logger.tests.js
meteor-space/base
57f065de22b3dd406c3c0686c329808a6ac47768
[ "MIT" ]
46
2015-10-12T06:41:53.000Z
2016-05-30T14:59:38.000Z
tests/unit/logger.tests.js
meteor-space/base
57f065de22b3dd406c3c0686c329808a6ac47768
[ "MIT" ]
3
2017-01-28T07:51:38.000Z
2017-09-26T01:33:24.000Z
describe("Space.Logger", function() { beforeEach(function() { this.log = new Space.Logger(); }); afterEach(function() { this.log.stop(); }); it('extends Space.Object', function() { expect(Space.Logger).to.extend(Space.Object); }); it("is available of both client and server", function() { if (Meteor.isServer || Meteor.isClient) expect(this.log).to.be.instanceOf(Space.Logger); }); it("only logs after starting", function() { this.log.start(); this.log._logger.info = sinon.spy(); let message = 'My Log Message'; this.log.info(message); expect(this.log._logger.info).to.be.calledWithExactly(message); }); it("it can log a debug message to the output channel when min level is equal but not less", function() { this.log.start(); this.log.setMinLevel('debug'); this.log._logger.debug = sinon.spy(); let message = 'My log message'; this.log.debug(message); expect(this.log._logger.debug).to.be.calledWithExactly(message); this.log._logger.debug = sinon.spy(); this.log.setMinLevel('info'); this.log.debug(message); expect(this.log._logger.debug).not.to.be.called; }); it("it can log an info message to the output channel when min level is equal or higher, but not less", function() { this.log.start(); this.log.setMinLevel('info'); this.log._logger.info = sinon.spy(); this.log._logger.debug = sinon.spy(); let message = 'My log message'; this.log.info(message); expect(this.log._logger.info).to.be.calledWithExactly(message); expect(this.log._logger.debug).not.to.be.called; this.log._logger.info = sinon.spy(); this.log.setMinLevel('warning'); this.log.info(message); expect(this.log._logger.info).not.to.be.called; }); it.server("it can log a warning message to the output channel when min level is equal or higher, but not less", function() { this.log.start(); this.log.setMinLevel('warning'); this.log._logger.warning = sinon.spy(); this.log._logger.info = sinon.spy(); let message = 'My log message'; this.log.warning(message); expect(this.log._logger.warning).to.be.calledWithExactly(message); expect(this.log._logger.info).not.to.be.called; this.log._logger.warning = sinon.spy(); this.log.setMinLevel('error'); this.log.warning(message); expect(this.log._logger.warning).not.to.be.called; }); it.client("it can log a warning message to the output channel when min level is equal or higher, but not less", function() { this.log.start(); this.log.setMinLevel('warning'); this.log._logger.warn = sinon.spy(); this.log._logger.info = sinon.spy(); let message = 'My log message'; this.log.warning(message); expect(this.log._logger.warn).to.be.calledWithExactly(message); expect(this.log._logger.info).not.to.be.called; this.log._logger.warn = sinon.spy(); this.log.setMinLevel('error'); this.log.warning(message); expect(this.log._logger.warn).not.to.be.called; }); it("it can log an error message to the output channel when min level is equal", function() { this.log.start(); this.log.setMinLevel('error'); this.log._logger.error = sinon.spy(); this.log._logger.info = sinon.spy(); let message = 'My log message'; this.log.error(message); expect(this.log._logger.error).to.be.calledWithExactly(message); expect(this.log._logger.info).not.to.be.called; this.log._logger.info = sinon.spy(); this.log.setMinLevel('debug'); this.log.error(message); expect(this.log._logger.error).to.be.calledWithExactly(message); }); it("allows logging output to be stopped", function() { this.log._logger.info = sinon.spy(); this.log.start(); expect(this.log._is('running')).to.be.true; this.log.stop(); let message = 'My Log Message'; this.log.info(message); expect(this.log._logger.info).not.to.be.called; expect(this.log._is('stopped')).to.be.true; }); });
35.442478
126
0.666916
acabccf3c4f94e8aa0102f86a3be8efc53afebbd
4,756
js
JavaScript
dac/ui/src/components/Menus/MenuItem-spec.js
weltam/dremio-oss
3884cf17630dab71829c2de735a3d7d83759c198
[ "Apache-2.0" ]
1,085
2017-07-19T15:08:38.000Z
2022-03-29T13:35:07.000Z
dac/ui/src/components/Menus/MenuItem-spec.js
weltam/dremio-oss
3884cf17630dab71829c2de735a3d7d83759c198
[ "Apache-2.0" ]
20
2017-07-19T20:16:27.000Z
2021-12-02T10:56:25.000Z
dac/ui/src/components/Menus/MenuItem-spec.js
weltam/dremio-oss
3884cf17630dab71829c2de735a3d7d83759c198
[ "Apache-2.0" ]
398
2017-07-19T18:12:58.000Z
2022-03-30T09:37:40.000Z
/* * Copyright (C) 2017-2019 Dremio Corporation * * 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. */ import { shallow, mount } from 'enzyme'; import MenuItemMaterial from '@material-ui/core/MenuItem'; import MenuItem from './MenuItem'; describe('MenuItem', () => { let minimalProps; let commonProps; beforeEach(() => { minimalProps = {}; commonProps = { ...minimalProps, children: 'node', onClick: sinon.spy() }; }); it('should render with minimal props without exploding', () => { const wrapper = shallow(<MenuItem {...minimalProps}/>); expect(wrapper).to.have.length(1); }); it('should render MenuItemMaterial', () => { const wrapper = shallow(<MenuItem {...commonProps}/>); expect(wrapper.find(MenuItemMaterial)).to.have.length(1); expect(wrapper).to.have.length(1); }); // it('should render Popover if menuItems is defined', () => { // const props = { // ...commonProps, // menuItems: ['item1', 'item2'] // }; // const wrapper = mount(<MenuItem {...props}/>); // const getBoundingClientRect = wrapper.find('div').at(1).getDOMNode().getBoundingClientRect; // const stub = sinon.stub(wrapper.instance().menuItemRef, 'current').value({ // getBoundingClientRect, // clientWidth: getBoundingClientRect().width, // clientHeight: getBoundingClientRect().height // }); // wrapper.setState({ // open: true // }); // expect(wrapper.find('Popper')).to.have.length(1); // stub.restore(); // }); it('should not render Popover if menuItems is not defined', () => { const wrapper = shallow(<MenuItem {...commonProps}/>); expect(wrapper.find('Popper')).to.have.length(0); }); describe('#handleRequestOpen', () => { it('should set state.open to true', () => { const wrapper = shallow(<MenuItem {...commonProps}/>); const instance = wrapper.instance(); instance.handleRequestOpen(); expect(wrapper.state('open')).to.be.true; }); }); describe('#handleRequestClose', () => { it('should set state.open to false', () => { const wrapper = shallow(<MenuItem {...commonProps}/>); const instance = wrapper.instance(); wrapper.setState({ open: false }); instance.handleRequestClose(); expect(wrapper.state('open')).to.be.false; }); }); describe('#handleMouseLeave', () => { let handleRequestCloseSpy; let shouldCloseStub; let instance; let clock; beforeEach(() => { instance = shallow(<MenuItem {...commonProps}/>).instance(); handleRequestCloseSpy = sinon.spy(instance, 'handleRequestClose'); shouldCloseStub = sinon.stub(instance, 'shouldClose'); clock = sinon.useFakeTimers(); }); afterEach(() => { handleRequestCloseSpy.restore(); shouldCloseStub.restore(); clock.restore(); }); it('should call handleRequestClose if shouldClose returns true', () => { shouldCloseStub.returns(true); const dummyEvent = { target: 'node' }; instance.handleMouseLeave(dummyEvent); expect(shouldCloseStub).to.be.calledWith(dummyEvent); expect(instance.state.delayedCloseRequest).to.not.be.null; clock.tick(100); expect(handleRequestCloseSpy).to.be.called; }); it('should not call handleRequestClose if shouldClose returns false', () => { shouldCloseStub.returns(false); instance.handleMouseLeave(); expect(handleRequestCloseSpy).to.be.not.called; }); }); describe('#shouldClose', () => { let wrapper; let instance; beforeEach(() => { const mountWithContext = (node) => mount(node); const props = { ...commonProps, menuItems: ['item1', 'item2'] }; wrapper = mountWithContext(<MenuItem {...props}/>); instance = wrapper.instance(); sinon.spy(instance, 'shouldClose'); }); afterEach(() => { instance.shouldClose.restore(); }); it('should call shouldClose and return true if relatedTarget is not .sub-item', () => { instance.handleMouseLeave({}); expect(instance.shouldClose).to.be.called; expect(instance.shouldClose).to.be.returned(true); }); }); });
33.258741
98
0.62868
acabe08be5fede13c07e5ea322992fbda6c2b279
2,553
js
JavaScript
build/js/webview-controls.js
kirbycope/watt-app
1cc29154a25ca2db6c221d40add7cc7523b0cfb5
[ "MIT" ]
null
null
null
build/js/webview-controls.js
kirbycope/watt-app
1cc29154a25ca2db6c221d40add7cc7523b0cfb5
[ "MIT" ]
null
null
null
build/js/webview-controls.js
kirbycope/watt-app
1cc29154a25ca2db6c221d40add7cc7523b0cfb5
[ "MIT" ]
null
null
null
function toggleMenu(){var visibility=document.getElementById("floating-menu").style["visibility"];if(visibility!="visible"){document.getElementById("floating-menu").style["visibility"]="visible";}else{document.getElementById("floating-menu").style["visibility"]="hidden";}} function webviewReload(){if(window.record){createTestSteps("Refresh","refreshAndWait");} webview.reload();} document.getElementById("webview-back").onclick=function(){if(webview.canGoBack()){if(window.record){createTestSteps("Go back","goBackAndWait");} webview.back();}} document.getElementById("webview-forward").onclick=function(){if(webview.canGoForward()){if(window.record){createTestSteps("Go forward","goForwardAndWait");} webview.forward();}} document.getElementById("webview-refresh").onclick=function(){webviewReload();} document.getElementById("webview-url").onkeydown=function(event){if(event.keyCode==13){if(window.record){createTestSteps("Navigate to: "+getEndpoint(),"openAndWait",getEndpoint());} webview.src=(event.target.value);}};document.getElementById("webview-menu").onclick=function(){toggleMenu();} document.getElementById("verify-location").onclick=function(){createTestSteps("Verify Location: "+getEndpoint(),"waitForLocation",getEndpoint());toggleMenu();} document.getElementById("verify-title").onclick=function(){webview.executeScript({code:"document.title"},function(result){createTestSteps("Verify Title: "+result[0],"waitForTitle",result[0]);toggleMenu();});} document.getElementById("clear-all-caches").onclick=function(){createTestSteps("Clear All Caches (Not Supported in Selenium)","clearAllCaches");webview.clearData({},{appcache:true,cache:true,fileSystems:true,indexedDB:true,localStorage:true,webSQL:true});toggleMenu();} document.getElementById("clear-all-cookies").onclick=function(){createTestSteps("Clear All Cookies","deleteAllVisibleCookies");webview.clearData({},{cookies:true});toggleMenu();} document.getElementById("resize-mobile").onclick=function(){chrome.app.window.current().outerBounds.width=648;toggleMenu();} document.getElementById("resize-mobile-wide").onclick=function(){chrome.app.window.current().outerBounds.width=821;toggleMenu();} document.getElementById("resize-tablet").onclick=function(){chrome.app.window.current().outerBounds.width=981;toggleMenu();} document.getElementById("resize-desktop").onclick=function(){chrome.app.window.current().outerBounds.width=1301;toggleMenu();} document.getElementById("resize-desktop-wide").onclick=function(){chrome.app.window.current().outerBounds.width=1621;toggleMenu();}
134.368421
273
0.788092
acabecec9bf7df3beaa8e6cc4dfe0c3d2beb8674
271
js
JavaScript
6. JavaScript/Aula 219 - BOM parte 2 - Screen/script.js
LuscaMD/WebCompleto2021
5fb32961b2bb3848381ee20bde2e2d1e9c9bfe25
[ "MIT" ]
2
2021-05-18T23:01:16.000Z
2021-05-27T01:49:43.000Z
6. JavaScript/Aula 219 - BOM parte 2 - Screen/script.js
LuscaMD/WebCompleto2021
5fb32961b2bb3848381ee20bde2e2d1e9c9bfe25
[ "MIT" ]
null
null
null
6. JavaScript/Aula 219 - BOM parte 2 - Screen/script.js
LuscaMD/WebCompleto2021
5fb32961b2bb3848381ee20bde2e2d1e9c9bfe25
[ "MIT" ]
null
null
null
// DOM https://www.w3schools.com/jsref/dom_obj_attributes.asp var altura, largura; function especificacoes(){ altura = window.screen.height; largura = window.screen.width; document.write("A altura da sua tela é: "+altura +" e a largura é: " +largura); }
20.846154
83
0.693727
acacfb2d50a546ee93e343c3959a45272ff1b5ab
253
js
JavaScript
src/views/Login/Login.js
VueProjectCourse/BunnyFairy
b6b1f12a85f7409ad2ccba27a7af8dd64a605373
[ "Apache-2.0" ]
null
null
null
src/views/Login/Login.js
VueProjectCourse/BunnyFairy
b6b1f12a85f7409ad2ccba27a7af8dd64a605373
[ "Apache-2.0" ]
null
null
null
src/views/Login/Login.js
VueProjectCourse/BunnyFairy
b6b1f12a85f7409ad2ccba27a7af8dd64a605373
[ "Apache-2.0" ]
null
null
null
import { ref } from "vue"; export const useTogglePattern = () => { // 登录方式 默认的是 账号登录 const loginPattern = ref("account"); const setLoginPattern = (pattern) => { loginPattern.value = pattern; }; return { loginPattern, setLoginPattern }; };
25.3
43
0.656126
acae10179396cf04a021ff32c6e33d4a75d49fc1
1,908
js
JavaScript
SlashCommands/info/banner.js
SpreeHertz/ulob
5f2cc1cc81a50a026b839b681949205e7eb01ca0
[ "MIT" ]
3
2021-10-01T11:11:12.000Z
2021-10-07T04:57:39.000Z
SlashCommands/info/banner.js
SpreeHertz/ulob
5f2cc1cc81a50a026b839b681949205e7eb01ca0
[ "MIT" ]
44
2021-11-08T01:32:32.000Z
2022-03-29T01:23:39.000Z
SlashCommands/info/banner.js
SpreeHertz/ulob
5f2cc1cc81a50a026b839b681949205e7eb01ca0
[ "MIT" ]
2
2021-10-01T10:29:00.000Z
2021-10-04T08:58:51.000Z
const { Client, MessageEmbed } = require('discord.js'); const axios = require('axios') module.exports = { name: 'banner', description: 'Gets a users banner', options: [{ name: "member", description: "Mention a member", type: "USER", required: true, }], /** * @param {Client} client * @param {Message} message * @param {String[]} args */ run: async (client, interaction, options) => { const { user } = interaction.options.get("member"); axios.get(`https://discord.com/api/users/${user.id}`, { headers: { Authorization: `Bot ${process.env.token}`, }, }).then((res) => { const { banner, accent_color } = res.data if (banner) { const extension = banner.startsWith("a_") ? ".gif" : ".png"; const url = `https://cdn.discordapp.com/banners/${user.id}/${banner}${extension}?size=2048`; const embed = new MessageEmbed() .setTitle(`${user.tag}'s banner`) .setImage(url) .setColor(accent_color || "#2F3136"); interaction.followUp({ embeds: [embed] }) } else { if (accent_color) { const embed2 = new MessageEmbed() .setDescription(`**${user.tag} does not have a banner!** The color of the embed is their accent color`) .setColor(accent_color); interaction.followUp({ embeds: [embed2] }) } else { interaction.followUp(`${user.tag} does not have a banner nor a accent color`) } } }) } }
31.278689
127
0.451782
acaf224d6b87b0845a4ba1d92217772bb34ec4de
1,645
js
JavaScript
build/test/api/erasureRequestApiSpec.js
vogger/juice-shop
6003280ff5a6dfa1fdfecfc274b6c182e9f16545
[ "MIT" ]
null
null
null
build/test/api/erasureRequestApiSpec.js
vogger/juice-shop
6003280ff5a6dfa1fdfecfc274b6c182e9f16545
[ "MIT" ]
null
null
null
build/test/api/erasureRequestApiSpec.js
vogger/juice-shop
6003280ff5a6dfa1fdfecfc274b6c182e9f16545
[ "MIT" ]
null
null
null
"use strict"; /* * Copyright (c) 2014-2021 Bjoern Kimminich. * SPDX-License-Identifier: MIT */ Object.defineProperty(exports, "__esModule", { value: true }); const frisby = require("frisby"); const jsonHeader = { 'content-type': 'application/json' }; const BASE_URL = 'http://localhost:3000'; const REST_URL = 'http://localhost:3000/rest'; describe('/dataerasure', () => { it('Erasure request does not actually delete the user', () => { const form = frisby.formData(); form.append('email', 'bjoern.kimminich@gmail.com'); return frisby.post(REST_URL + '/user/login', { headers: jsonHeader, body: { email: 'bjoern.kimminich@gmail.com', password: 'bW9jLmxpYW1nQGhjaW5pbW1pay5ucmVvamI=' } }) .expect('status', 200) .then(({ json: jsonLogin }) => { return frisby.post(BASE_URL + '/dataerasure/', { headers: { Cookie: 'token=' + jsonLogin.authentication.token }, body: form }) .expect('status', 200) .expect('header', 'Content-Type', 'text/html; charset=utf-8') .then(() => { return frisby.post(REST_URL + '/user/login', { headers: jsonHeader, body: { email: 'bjoern.kimminich@gmail.com', password: 'bW9jLmxpYW1nQGhjaW5pbW1pay5ucmVvamI=' } }) .expect('status', 200); }); }); }); }); //# sourceMappingURL=erasureRequestApiSpec.js.map
38.255814
79
0.519149
acaf8b070893ace503b3b9a4b932a6dad2275548
6,683
js
JavaScript
js/originalHeated.js
froxtrel/gw
fcb36060f3958bd3cfe85028a91953d96cee1340
[ "MIT" ]
null
null
null
js/originalHeated.js
froxtrel/gw
fcb36060f3958bd3cfe85028a91953d96cee1340
[ "MIT" ]
null
null
null
js/originalHeated.js
froxtrel/gw
fcb36060f3958bd3cfe85028a91953d96cee1340
[ "MIT" ]
null
null
null
// DRILL CALCULATION [BEGINNER WAY] switch (wS1) { case "DPF%": disdef = parseFloat($('#WS1').val()) ; break; case "DMF%": disdef = parseFloat($('#WS1').val()) ; break; case "CTD%": criticalP = parseFloat($('#WS1').val()); break; case "CTDV": criticalNum = parseInt($('#WS1').val()); break; case "PDMGV": damageNum = parseInt($('#WS1').val()); break; case "MDMGV": MdamageNum = parseInt($('#WS1').val()); break; case "PDMG%": dmgP = parseInt($('#WS1').val()); break; case "MDMG%": dmgP = parseInt($('#WS1').val()); break; } switch (wS2) { case "DPF%": disdef = parseFloat($('#WS2').val()) ; break; case "DMF%": disdef = parseFloat($('#WS2').val()) ; break; case "CTD%": criticalP = parseFloat($('#WS2').val()); break; case "CTDV": criticalNum = parseInt($('#WS2').val()); break; case "PDMGV": damageNum = parseInt($('#WS2').val()); break; case "MDMGV": MdamageNum = parseInt($('#WS2').val()); break; case "PDMG%": dmgP = parseInt($('#WS2').val()); break; case "MDMG%": dmgP = parseInt($('#WS2').val()); break; } switch (gS1) { case "DPF%": disdef += parseFloat($('#GS1').val()) ; break; case "DMF%": disdef += parseFloat($('#GS1').val()) ; break; case "CTD%": criticalP += parseFloat($('#GS1').val()); break; case "CTDV": criticalNum += parseInt($('#GS1').val()); break; case "PDMGV": damageNum += parseInt($('#GS1').val()); break; case "MDMGV": MdamageNum += parseInt($('#GS1').val()); break; case "PDMG%": dmgP += parseInt($('#GS1').val()); break; case "MDMG%": dmgP += parseInt($('#GS1').val()); break; } switch (gS2) { case "DPF%": disdef += parseFloat($('#GS2').val()) ; break; case "DMF%": disdef += parseFloat($('#GS2').val()) ; break; case "CTD%": criticalP += parseFloat($('#GS2').val()); break; case "CTDV": criticalNum += parseInt($('#GS2').val()); break; case "PDMGV": damageNum += parseInt($('#GS2').val()); break; case "MDMGV": MdamageNum += parseInt($('#GS2').val()); break; case "PDMG%": dmgP += parseInt($('#GS2').val()); break; case "MDMG%": dmgP += parseInt($('#GS2').val()); break; } switch (hS1) { case "DPF%": disdef += parseFloat($('#HS1').val()) ; break; case "DMF%": disdef += parseFloat($('#HS1').val()) ; break; case "CTD%": criticalP += parseFloat($('#HS1').val()); break; case "CTDV": criticalNum += parseInt($('#HS1').val()); break; case "PDMGV": damageNum += parseInt($('#HS1').val()); break; case "MDMGV": MdamageNum += parseInt($('#HS1').val()); break; case "PDMG%": dmgP += parseInt($('#HS1').val()); break; case "MDMG%": dmgP += parseInt($('#HS1').val()); break; } switch (hS2) { case "DPF%": disdef += parseFloat($('#HS2').val()) ; break; case "DMF%": disdef += parseFloat($('#HS2').val()) ; break; case "CTD%": criticalP += parseFloat($('#HS2').val()); break; case "CTDV": criticalNum += parseInt($('#HS2').val()); break; case "PDMGV": damageNum += parseInt($('#HS2').val()); break; case "MDMGV": MdamageNum += parseInt($('#HS2').val()); break; case "PDMG%": dmgP += parseInt($('#HS2').val()); break; case "MDMG%": dmgP += parseInt($('#HS2').val()); break; } switch (r1S1) { case "DPF%": disdef += parseFloat($('#R1S1').val()) ; break; case "DMF%": disdef += parseFloat($('#R1S1').val()) ; break; case "CTD%": criticalP += parseFloat($('#R1S1').val()); break; case "CTDV": criticalNum += parseInt($('#R1S1').val()); break; case "PDMGV": damageNum += parseInt($('#R1S1').val()); break; case "MDMGV": MdamageNum += parseInt($('#R1S1').val()); break; case "PDMG%": dmgP += parseInt($('#R1S1').val()); break; case "MDMG%": dmgP += parseInt($('#R1S1').val()); break; } switch (r1S2) { case "DPF%": disdef += parseFloat($('#R1S2').val()) ; break; case "DMF%": disdef += parseFloat($('#R1S2').val()) ; break; case "CTD%": criticalP += parseFloat($('#R1S2').val()); break; case "CTDV": criticalNum += parseInt($('#R1S2').val()); break; case "PDMGV": damageNum += parseInt($('#R1S2').val()); break; case "MDMGV": MdamageNum += parseInt($('#R1S2').val()); break; case "PDMG%": dmgP += parseInt($('#R1S2').val()); break; case "MDMG%": dmgP += parseInt($('#R1S2').val()); break; } switch (r2S1) { case "DPF%": disdef += parseFloat($('#R2S1').val()) ; break; case "DMF%": disdef += parseFloat($('#R2S1').val()) ; break; case "CTD%": criticalP += parseFloat($('#R2S1').val()); break; case "CTDV": criticalNum += parseInt($('#R2S1').val()); break; case "PDMGV": damageNum += parseInt($('#R2S1').val()); break; case "MDMGV": MdamageNum += parseInt($('#R2S1').val()); break; case "PDMG%": dmgP += parseInt($('#R2S1').val()); break; case "MDMG%": dmgP += parseInt($('#R2S1').val()); break; } switch (r2S2) { case "DPF%": disdef += parseFloat($('#R2S2').val()) ; break; case "DMF%": disdef += parseFloat($('#R2S2').val()) ; break; case "CTD%": criticalP += parseFloat($('#R2S2').val()); break; case "CTDV": criticalNum += parseInt($('#R2S2').val()); break; case "PDMGV": damageNum += parseInt($('#R2S2').val()); break; case "MDMGV": MdamageNum += parseInt($('#R2S2').val()); break; case "PDMG%": dmgP += parseInt($('#R2S2').val()); break; case "MDMG%": dmgP += parseInt($('#R2S2').val()); break; } // END DRILL CALCULATION
18.719888
49
0.44471
acafba1dc9293f6a80b185b45d8c5ef5108b5873
298
js
JavaScript
server/permissionRules/canDeleteForum.js
ratchetcloud/powerforums
2bd47cf82938aa1f16cadb475d29f95808f39c3c
[ "MIT" ]
3
2018-08-15T21:26:57.000Z
2018-08-21T21:49:03.000Z
server/permissionRules/canDeleteForum.js
ratchetcloud/powerforums
2bd47cf82938aa1f16cadb475d29f95808f39c3c
[ "MIT" ]
21
2018-07-25T21:22:23.000Z
2018-08-23T22:53:54.000Z
server/permissionRules/canDeleteForum.js
ratchetcloud/powerforums
2bd47cf82938aa1f16cadb475d29f95808f39c3c
[ "MIT" ]
1
2018-08-27T10:08:41.000Z
2018-08-27T10:08:41.000Z
/** * Check permission for canDeleteForum * @param req: include method(GET, POST, PUT, PATCH or DELETE) and node * @returns {boolean} True if allowed, false otherwise */ module.exports = (req) => { switch(req.method) { case 'DELETE': return req.node.type === 'Forum'; } return false; }
22.923077
71
0.66443
acafc7c862d5419b5341094425108b9d821dcfff
3,058
js
JavaScript
app/routes/managers.js
johnwatson484/dream-league-identity
c1eeeca58cb2789f1068ab20b1ca56f77c722385
[ "MIT" ]
1
2022-03-12T14:01:25.000Z
2022-03-12T14:01:25.000Z
app/routes/managers.js
johnwatson484/dream-league-identity
c1eeeca58cb2789f1068ab20b1ca56f77c722385
[ "MIT" ]
2
2022-02-04T22:02:35.000Z
2022-03-26T22:17:55.000Z
app/routes/managers.js
johnwatson484/dream-league-api
51bb495e2d0b70ebd4de1b3ee89d789d70179344
[ "MIT" ]
null
null
null
const db = require('../data') const joi = require('joi') const boom = require('@hapi/boom') const { getManager, getManagers, createManager, editManager, deleteManager, getTeam } = require('../managers') const { getSummary } = require('../results') module.exports = [{ method: 'GET', path: '/managers', options: { handler: async (request, h) => { return h.response(await getManagers()) } } }, { method: 'GET', path: '/manager', handler: async (request, h) => { return h.response(await getManager(request.query.managerId)) } }, { method: 'GET', path: '/manager/detail', options: { validate: { query: joi.object({ managerId: joi.number().required() }), failAction: async (request, h, error) => { return boom.badRequest(error) } }, handler: async (request, h) => { const manager = await getManager(request.query.managerId) const team = await getTeam(request.query.managerId) const results = await getSummary() return h.response({ manager, team, results }) } } }, { method: 'POST', path: '/manager/create', options: { auth: { strategy: 'jwt', scope: ['admin'] }, validate: { payload: joi.object({ name: joi.string(), alias: joi.string(), emails: joi.array().items(joi.string().email().allow('')).single() }), failAction: async (request, h, error) => { return boom.badRequest(error) } }, handler: async (request, h) => { return h.response(await createManager(request.payload)) } } }, { method: 'POST', path: '/manager/edit', options: { auth: { strategy: 'jwt', scope: ['admin'] }, validate: { payload: joi.object({ managerId: joi.number(), name: joi.string(), alias: joi.string(), emails: joi.array().items(joi.string().email().allow('')).single() }), failAction: async (request, h, error) => { return boom.badRequest(error) } }, handler: async (request, h) => { return h.response(await editManager(request.payload)) } } }, { method: 'POST', path: '/manager/delete', options: { auth: { strategy: 'jwt', scope: ['admin'] }, validate: { payload: joi.object({ managerId: joi.number() }), failAction: async (request, h, error) => { return boom.badRequest(error) } }, handler: async (request, h) => { return h.response(await deleteManager(request.payload.managerId)) } } }, { method: 'POST', path: '/manager/autocomplete', options: { validate: { payload: joi.object({ prefix: joi.string() }), failAction: async (request, h, error) => { return boom.badRequest(error) } }, handler: async (request, h) => { const managers = await db.Manager.findAll({ where: { name: { [db.Sequelize.Op.iLike]: request.payload.prefix + '%' } }, order: [['name']] }) return h.response(managers || []) } } }]
26.136752
110
0.561805
acb0f6eaebcb8fc832d0a82335e78cfdb3fe7c91
10,619
js
JavaScript
test/config-tests/login-config-test.js
ChanderG/nodeshift
1443fbdf180be882b2649b17daccfa7be1d0e927
[ "Apache-2.0" ]
45
2018-11-09T08:56:45.000Z
2022-03-05T22:06:40.000Z
test/config-tests/login-config-test.js
ChanderG/nodeshift
1443fbdf180be882b2649b17daccfa7be1d0e927
[ "Apache-2.0" ]
292
2018-11-02T02:00:03.000Z
2022-02-27T22:10:55.000Z
test/config-tests/login-config-test.js
ChanderG/nodeshift
1443fbdf180be882b2649b17daccfa7be1d0e927
[ "Apache-2.0" ]
21
2018-11-19T19:19:44.000Z
2021-12-22T10:11:16.000Z
'use strict'; const test = require('tape'); const proxyquire = require('proxyquire'); test('login-config checkForNodeshiftLogin', (t) => { const nodeshiftLogin = proxyquire('../../lib/config/login-config', { fs: { readFile: (location, cb) => { t.equal(location, 'here/tmp/nodeshift/config/login.json', 'the location of the login.json file'); return cb(null, JSON.stringify({ token: 'abcd', server: 'http' })); } }, '../common-log': () => { return { info: (info) => { t.equal(info, 'login.json file found'); return info; } }; } }); const p = nodeshiftLogin.checkForNodeshiftLogin({ projectLocation: 'here' }).then((loginJSON) => { t.equal(loginJSON.token, 'abcd', 'returns the token'); t.equal(loginJSON.server, 'http', 'returns the server'); t.end(); }).catch(t.fail); t.equal(p instanceof Promise, true, 'should return a Promise'); }); test('login-config checkForNodeshiftLogin - no login.json', (t) => { const nodeshiftLogin = proxyquire('../../lib/config/login-config', { fs: { readFile: (location, cb) => { t.equal(location, 'here/tmp/nodeshift/config/login.json', 'the location of the login.json file'); const err = new Error('no file found'); err.code = 'ENOENT'; return cb(err); } }, '../common-log': () => { return { info: (info) => { t.equal(info, 'No login.json file found'); return info; } }; } }); const p = nodeshiftLogin.checkForNodeshiftLogin({ projectLocation: 'here' }).then((loginJSON) => { t.pass(); t.end(); }).catch(t.fail); t.equal(p instanceof Promise, true, 'should return a Promise'); }); test('login-config checkForNodeshiftLogin - some other error', (t) => { const nodeshiftLogin = proxyquire('../../lib/config/login-config', { fs: { readFile: (location, cb) => { t.equal(location, 'here/tmp/nodeshift/config/login.json', 'the location of the login.json file'); const err = new Error('bad error'); err.code = 'SOMETHING'; return cb(err); } }, '../common-log': () => { return { info: (info) => { t.fail('should not be here'); return info; } }; } }); const p = nodeshiftLogin.checkForNodeshiftLogin({ projectLocation: 'here' }).then((loginJSON) => { t.fail(); t.end(); }).catch(() => { t.pass(); t.end(); }); t.equal(p instanceof Promise, true, 'should return a Promise'); }); test('login-config doNodeshiftLogout', (t) => { const nodeshiftLogin = proxyquire('../../lib/config/login-config', { fs: { readFile: (location, cb) => { t.equal(location, 'here/tmp/nodeshift/config/login.json', 'the location of the login.json file'); return cb(null, JSON.stringify({ token: 'abcd', server: 'http' })); } }, '../utils/rmrf': (location) => { t.equal(location, 'here/tmp/nodeshift/config', 'the location of the directory'); return Promise.resolve(); }, '../common-log': () => { return { info: (info) => { t.equal(info, 'Removing login.json to logout'); return info; } }; } }); const p = nodeshiftLogin.doNodeshiftLogout({ projectLocation: 'here' }).then((loginJSON) => { t.pass(); t.end(); }).catch(t.fail); t.equal(p instanceof Promise, true, 'should return a Promise'); }); test('login-config doNodeshiftLogout - no file to remove', (t) => { const nodeshiftLogin = proxyquire('../../lib/config/login-config', { fs: { readFile: (location, cb) => { t.equal(location, 'here/tmp/nodeshift/config/login.json', 'the location of the login.json file'); const err = new Error('no file found'); err.code = 'ENOENT'; return cb(err); } }, '../common-log': () => { return { info: (info) => { t.equal(info, 'No login.json file found'); return info; } }; } }); const p = nodeshiftLogin.doNodeshiftLogout({ projectLocation: 'here' }).then((loginJSON) => { t.pass(); t.end(); }).catch(t.fail); t.equal(p instanceof Promise, true, 'should return a Promise'); }); test('login-config doNodeshiftLogout - some other error', (t) => { const nodeshiftLogin = proxyquire('../../lib/config/login-config', { fs: { readFile: (location, cb) => { t.equal(location, 'here/tmp/nodeshift/config/login.json', 'the location of the login.json file'); const err = new Error('bad error'); err.code = 'SOMETHING'; return cb(err); } }, '../common-log': () => { return { info: (info) => { t.fail('should not be here'); return info; } }; } }); const p = nodeshiftLogin.doNodeshiftLogout({ projectLocation: 'here' }).then((loginJSON) => { t.fail(); t.end(); }).catch(() => { t.pass(); t.end(); }); t.equal(p instanceof Promise, true, 'should return a Promise'); }); test('login-config doNodeshiftLogin, already logged in, no force', (t) => { const nodeshiftLogin = proxyquire('../../lib/config/login-config', { fs: { readFile: (location, cb) => { t.equal(location, 'here/tmp/nodeshift/config/login.json', 'the location of the login.json file'); return cb(null, JSON.stringify({ token: 'abcd', server: 'http' })); } }, '../common-log': () => { return { info: (info) => { t.equal(info, 'login.json file found'); return info; } }; } }); const p = nodeshiftLogin.doNodeshiftLogin({ projectLocation: 'here' }).then((loginJSON) => { t.equal(loginJSON.token, 'abcd', 'returns the token'); t.equal(loginJSON.server, 'http', 'returns the server'); t.end(); }).catch(t.fail); t.equal(p instanceof Promise, true, 'should return a Promise'); }); test('login-config doNodeshiftLogin, not logged in yet, passing a token', (t) => { let counter = 0; const nodeshiftLogin = proxyquire('../../lib/config/login-config', { fs: { writeFile: (location, data, options, cb) => { t.equal(location, 'here/tmp/nodeshift/config/login.json', 'the location of the login.json file'); t.equal(options.encoding, 'utf8', 'proper encoding'); return cb(null, ''); } }, '../helpers': { createDir: (location) => { t.equal(location, 'here/tmp/nodeshift/config', 'the location of the directory'); return Promise.resolve(); } }, '../common-log': () => { return { info: (info) => { if (counter === 0) { t.equal(info, 'No login.json file found'); } else { t.equal(info, 'logging in with nodeshift cli'); } counter++; return info; } }; } }); const p = nodeshiftLogin.doNodeshiftLogin({ projectLocation: 'here', token: 'abcd', server: 'http' }).then((loginJSON) => { t.equal(loginJSON.token, 'abcd', 'returns the token'); t.equal(loginJSON.server, 'http', 'returns the server'); t.end(); }).catch(t.fail); t.equal(p instanceof Promise, true, 'should return a Promise'); }); test('login-config doNodeshiftLogin, not logged in yet, passing a user/pass', (t) => { let counter = 0; const nodeshiftLogin = proxyquire('../../lib/config/login-config', { 'openshift-rest-client/lib/basic-auth-request': { getTokenFromBasicAuth: (options) => { t.equal(options.user, 'developer', 'has the username developer'); t.equal(options.password, 'developer', 'has the password developer'); t.equal(options.url, 'http', 'has the server http'); return Promise.resolve('abcd'); } }, fs: { writeFile: (location, data, options, cb) => { t.equal(location, 'here/tmp/nodeshift/config/login.json', 'the location of the login.json file'); t.equal(options.encoding, 'utf8', 'proper encoding'); return cb(null, ''); } }, '../helpers': { createDir: (location) => { t.equal(location, 'here/tmp/nodeshift/config', 'the location of the directory'); return Promise.resolve(); } }, '../common-log': () => { return { info: (info) => { if (counter === 0) { t.equal(info, 'No login.json file found'); } else { t.equal(info, 'logging in with nodeshift cli'); } counter++; return info; } }; } }); const p = nodeshiftLogin.doNodeshiftLogin({ projectLocation: 'here', username: 'developer', password: 'developer', server: 'http' }).then((loginJSON) => { t.equal(loginJSON.token, 'abcd', 'returns the token'); t.equal(loginJSON.server, 'http', 'returns the server'); t.end(); }).catch(t.fail); t.equal(p instanceof Promise, true, 'should return a Promise'); }); test('login-config doNodeshiftLogin, already logged in, passing a user/pass, forcing', (t) => { const nodeshiftLogin = proxyquire('../../lib/config/login-config', { 'openshift-rest-client/lib/basic-auth-request': { getTokenFromBasicAuth: (options) => { t.equal(options.user, 'developer', 'has the username developer'); t.equal(options.password, 'developer', 'has the password developer'); t.equal(options.url, 'http', 'has the server http'); return Promise.resolve('abcd'); } }, fs: { writeFile: (location, data, options, cb) => { t.equal(location, 'here/tmp/nodeshift/config/login.json', 'the location of the login.json file'); t.equal(options.encoding, 'utf8', 'proper encoding'); return cb(null, ''); } }, '../helpers': { createDir: (location) => { t.equal(location, 'here/tmp/nodeshift/config', 'the location of the directory'); return Promise.resolve(); } }, '../common-log': () => { return { info: (info) => { t.equal(info, 'logging in with nodeshift cli'); return info; } }; } }); const p = nodeshiftLogin.doNodeshiftLogin({ projectLocation: 'here', username: 'developer', password: 'developer', server: 'http', forceLogin: true }).then((loginJSON) => { t.equal(loginJSON.token, 'abcd', 'returns the token'); t.equal(loginJSON.server, 'http', 'returns the server'); t.end(); }).catch(t.fail); t.equal(p instanceof Promise, true, 'should return a Promise'); });
31.510386
174
0.567003
acb13550966959dff7c3b9fba246cb5318cfbaaa
231
js
JavaScript
lib/get-origin-chain-id.js
cryptosweden/ptokens-erc777-smart-contract
3262e066aa3f2b443995160d298bf0b60de84093
[ "MIT" ]
null
null
null
lib/get-origin-chain-id.js
cryptosweden/ptokens-erc777-smart-contract
3262e066aa3f2b443995160d298bf0b60de84093
[ "MIT" ]
null
null
null
lib/get-origin-chain-id.js
cryptosweden/ptokens-erc777-smart-contract
3262e066aa3f2b443995160d298bf0b60de84093
[ "MIT" ]
null
null
null
const { getPTokenContract } = require('./get-ptoken-contract') const { callReadOnlyFxnInContract } = require('./contract-utils') const getOriginChainId = _deployedContractAddress => || module.exports = { getOriginChainId }
25.666667
65
0.735931
acb156a4269c93d8d0e14bcf96b7389206f7c657
972
js
JavaScript
test/fixtures/customers/subscriptions.js
addaleax/newww
ec7ed58a3406c2ebd7a121218b99349432d8d575
[ "0BSD" ]
4
2017-08-25T04:38:25.000Z
2019-09-04T06:49:04.000Z
test/fixtures/customers/subscriptions.js
addaleax/newww
ec7ed58a3406c2ebd7a121218b99349432d8d575
[ "0BSD" ]
null
null
null
test/fixtures/customers/subscriptions.js
addaleax/newww
ec7ed58a3406c2ebd7a121218b99349432d8d575
[ "0BSD" ]
6
2016-08-08T22:14:51.000Z
2020-10-01T06:12:59.000Z
exports.bob = [ { "id": "sub_12345", "current_period_end": 1437760125, "current_period_start": 1435168125, "quantity": 1, "status": "active", "interval": "month", "amount": 700, "license_id": 145, "npm_org": "_private-modules-bob", "npm_user": "bob", "product_id": "52051d69-f3fe-46fc-919a-1ef1407ef247" } ]; exports.faultyBob = [ { "id": "sub_12345", "current_period_end": 1437760125, "current_period_start": 1435168125, "quantity": 1, "status": "active", "interval": "month", "amount": 700, "license_id": 145, "npm_org": "_private-modules-bob", "npm_user": "bob", "product_id": "52051d69-f3fe-46fc-919a-1ef1407ef247" }, { "amount": 700, "current_period_end": 1443977571, "current_period_start": 1441385571, "id": "sub_6vDsX3MXVHwmIH", "interval": "month", "npm_user": "bob", "product_id": null, "quantity": 1, "status": "active" } ];
23.142857
56
0.59465
acb1613280b2a35851563ffa6bc5d2d04ba6e080
33
js
JavaScript
frontend/js/scripts.js
VensGTH/Lespwa
28e045e916ee8fb8db21e6c18fdd35bc27b87987
[ "Unlicense" ]
null
null
null
frontend/js/scripts.js
VensGTH/Lespwa
28e045e916ee8fb8db21e6c18fdd35bc27b87987
[ "Unlicense" ]
null
null
null
frontend/js/scripts.js
VensGTH/Lespwa
28e045e916ee8fb8db21e6c18fdd35bc27b87987
[ "Unlicense" ]
null
null
null
/*! * * Silence is golden. * */
6.6
20
0.454545
acb19001ea21fd2b0f786654ae10df5b9c6b2456
15,480
js
JavaScript
dashboard/src/scenes/search/index.js
SocialGouv/mano
add4cbf5bd4b09666ca919b0572d48ffd135e123
[ "Apache-2.0" ]
7
2021-08-31T08:12:14.000Z
2022-01-28T15:00:20.000Z
dashboard/src/scenes/search/index.js
SocialGouv/mano
add4cbf5bd4b09666ca919b0572d48ffd135e123
[ "Apache-2.0" ]
469
2021-08-30T15:07:17.000Z
2022-03-31T16:03:21.000Z
dashboard/src/scenes/search/index.js
SocialGouv/mano
add4cbf5bd4b09666ca919b0572d48ffd135e123
[ "Apache-2.0" ]
1
2022-02-09T15:52:40.000Z
2022-02-09T15:52:40.000Z
/* eslint-disable react-hooks/exhaustive-deps */ import React, { useContext, useState, useEffect } from 'react'; import { Container, Row, Col, TabContent, TabPane, Nav, NavItem, NavLink } from 'reactstrap'; import styled from 'styled-components'; import { useHistory, useLocation } from 'react-router-dom'; import { toFrenchDate } from '../../utils'; import DateBloc from '../../components/DateBloc'; import Header from '../../components/header'; import Box from '../../components/Box'; import ActionStatus from '../../components/ActionStatus'; import Table from '../../components/table'; import Observation from '../territory-observations/view'; import dayjs from 'dayjs'; import { capture } from '../../services/sentry'; import UserName from '../../components/UserName'; import PaginationContext, { PaginationProvider } from '../../contexts/pagination'; import Search from '../../components/search'; import TagTeam from '../../components/TagTeam'; import { teamsState } from '../../recoil/auth'; import { useActions } from '../../recoil/actions'; import { usePersons } from '../../recoil/persons'; import { useRelsPerson } from '../../recoil/relPersonPlace'; import { territoriesState } from '../../recoil/territory'; import { useRefresh } from '../../recoil/refresh'; import { useRecoilValue } from 'recoil'; import { actionsSearchSelector, commentsSearchSelector, personsSearchSelector, placesSearchSelector, territoriesObservationsSearchSelector, territoriesSearchSelector, } from '../../recoil/selectors'; import ActionPersonName from '../../components/ActionPersonName'; const initTabs = ['Actions', 'Personnes', 'Commentaires', 'Lieux', 'Territoires', 'Observations']; const View = () => { const { refresh } = useRefresh(); const { search, setSearch } = useContext(PaginationContext); const [tabsContents, setTabsContents] = useState(initTabs); const location = useLocation(); const history = useHistory(); const searchParams = new URLSearchParams(location.search); const [activeTab, setActiveTab] = useState(initTabs.findIndex((value) => value.toLowerCase() === searchParams.get('tab')) || 0); const updateTabContent = (tabIndex, content) => setTabsContents((contents) => contents.map((c, index) => (index === tabIndex ? content : c))); useEffect(() => { if (!search) setTabsContents(initTabs); }, [search]); const renderContent = () => { if (!search) return 'Pas de recherche, pas de résultat !'; if (search.length < 3) return 'Recherche trop courte (moins de 3 caractères), pas de résultat !'; return ( <> <Nav tabs fill style={{ marginBottom: 20 }}> {tabsContents.map((tabCaption, index) => ( <NavItem key={index} style={{ cursor: 'pointer' }}> <NavLink key={index} className={`${activeTab === index && 'active'}`} onClick={() => { const searchParams = new URLSearchParams(location.search); searchParams.set('tab', initTabs[index].toLowerCase()); history.replace({ pathname: location.pathname, search: searchParams.toString() }); setActiveTab(index); }}> {tabCaption} </NavLink> </NavItem> ))} </Nav> <TabContent activeTab={activeTab}> <TabPane tabId={0}> <Actions search={search} onUpdateResults={(total) => updateTabContent(0, `Actions (${total})`)} /> </TabPane> <TabPane tabId={1}> <Persons search={search} onUpdateResults={(total) => updateTabContent(1, `Personnes (${total})`)} /> </TabPane> <TabPane tabId={2}> <Comments search={search} onUpdateResults={(total) => updateTabContent(2, `Commentaires (${total})`)} /> </TabPane> <TabPane tabId={3}> <Places search={search} onUpdateResults={(total) => updateTabContent(3, `Lieux (${total})`)} /> </TabPane> <TabPane tabId={4}> <Territories search={search} onUpdateResults={(total) => updateTabContent(4, `Territoires (${total})`)} /> </TabPane> <TabPane tabId={5}> <TerritoryObservations search={search} onUpdateResults={(total) => updateTabContent(5, `Observations (${total})`)} /> </TabPane> </TabContent> </> ); }; return ( <Container> <Header titleStyle={{ fontWeight: '400' }} title="Rechercher" onRefresh={() => refresh()} /> <Row style={{ marginBottom: 40, borderBottom: '1px solid #ddd' }}> <Col md={12} style={{ display: 'flex', alignItems: 'center', marginBottom: 20 }}> <Search placeholder="Par mot clé" value={search} onChange={setSearch} /> </Col> </Row> {renderContent()} </Container> ); }; const Actions = ({ search, onUpdateResults }) => { const history = useHistory(); const data = useRecoilValue(actionsSearchSelector({ search })); useEffect(() => { onUpdateResults(data.length); }, [search]); if (!data) return <div />; const moreThanOne = data.length > 1; return ( <> <StyledBox> <Table className="Table" title={`Action${moreThanOne ? 's' : ''} (${data.length})`} noData="Pas d'action" data={data} onRowClick={(action) => history.push(`/action/${action._id}`)} rowKey="_id" columns={[ { title: 'À faire le ', dataKey: 'dueAt', render: (action) => <DateBloc date={action.dueAt} /> }, { title: 'Heure', dataKey: '_id', render: (action) => { if (!action.dueAt || !action.withTime) return null; return new Date(action.dueAt).toLocaleString('fr', { hour: '2-digit', minute: '2-digit', }); }, }, { title: 'Nom', dataKey: 'name' }, { title: 'Personne suivie', dataKey: 'person', render: (action) => <ActionPersonName action={action} /> }, { title: 'Créée le', dataKey: 'createdAt', render: (action) => toFrenchDate(action.createdAt || '') }, { title: 'Status', dataKey: 'status', render: (action) => <ActionStatus status={action.status} /> }, ]} /> </StyledBox> <hr /> </> ); }; const Alertness = styled.span` display: block; text-align: center; color: red; font-weight: bold; `; const Persons = ({ search, onUpdateResults }) => { const history = useHistory(); const teams = useRecoilValue(teamsState); const data = useRecoilValue(personsSearchSelector({ search })); useEffect(() => { onUpdateResults(data.length); }, [search]); if (!data) return <div />; const moreThanOne = data.length > 1; const Teams = ({ person: { _id, assignedTeams } }) => ( <React.Fragment key={_id}> {assignedTeams?.map((teamId) => ( <TagTeam key={teamId} teamId={teamId} /> ))} </React.Fragment> ); return ( <> <StyledBox> <Table data={data} title={`Personne${moreThanOne ? 's' : ''} suivie${moreThanOne ? 's' : ''} (${data.length})`} rowKey={'_id'} noData="Pas de personne suivie" onRowClick={(p) => history.push(`/person/${p._id}`)} columns={[ { title: 'Nom', dataKey: 'name' }, { title: 'Vigilance', dataKey: 'alertness', render: (p) => <Alertness>{p.alertness ? '!' : ''}</Alertness>, }, { title: 'Équipe(s) en charge', dataKey: 'assignedTeams', render: (person) => <Teams teams={teams} person={person} /> }, { title: 'Suivi(e) depuis le', dataKey: 'createdAt', render: (p) => toFrenchDate(p.createdAt || '') }, ]} /> </StyledBox> <hr /> </> ); }; const Comments = ({ search, onUpdateResults }) => { const history = useHistory(); const { persons } = usePersons(); const { actions } = useActions(); const data = useRecoilValue(commentsSearchSelector({ search })).map((comment) => { const commentPopulated = { ...comment }; if (comment.person) { commentPopulated.person = persons.find((p) => p._id === comment?.person); commentPopulated.type = 'person'; } if (comment.action) { const action = actions.find((p) => p._id === comment?.action); commentPopulated.action = action; commentPopulated.person = persons.find((p) => p._id === action?.person); commentPopulated.type = 'action'; } return commentPopulated; }); useEffect(() => { onUpdateResults(data.length); }, [search]); if (!data) return <div />; const moreThanOne = data.length > 1; return ( <> <StyledBox> <Table className="Table" title={`Commentaire${moreThanOne ? 's' : ''} (${data.length})`} data={data} noData="Pas de commentaire" onRowClick={(comment) => { try { history.push(`/${comment.type}/${comment[comment.type]._id}`); } catch (errorLoadingComment) { capture(errorLoadingComment, { extra: { message: 'error loading comment from search', comment, search } }); } }} rowKey="_id" columns={[ { title: 'Heure', dataKey: 'createdAt', render: (comment) => <span>{dayjs(comment.createdAt).format('HH:mm')}</span>, }, { title: 'Utilisateur', dataKey: 'user', render: (comment) => <UserName id={comment.user} />, }, { title: 'Type', dataKey: 'type', render: (comment) => <span>{comment.type === 'action' ? 'Action' : 'Personne suivie'}</span>, }, { title: 'Nom', dataKey: 'person', render: (comment) => ( <> <b></b> <b>{comment[comment.type]?.name}</b> {comment.type === 'action' && ( <> <br /> <i>(pour {comment.person?.name || ''})</i> </> )} </> ), }, { title: 'Commentaire', dataKey: 'comment', render: (comment) => { return ( <p> {comment.comment ? comment.comment.split('\n').map((c, i, a) => { if (i === a.length - 1) return c; return ( <React.Fragment key={i}> {c} <br /> </React.Fragment> ); }) : ''} </p> ); }, }, ]} /> </StyledBox> <hr /> </> ); }; const Territories = ({ search, onUpdateResults }) => { const history = useHistory(); const data = useRecoilValue(territoriesSearchSelector({ search })); useEffect(() => { onUpdateResults(data.length); }, [search]); if (!data) return <div />; const moreThanOne = data.length > 1; return ( <> <StyledBox> <Table className="Table" title={`Territoire${moreThanOne ? 's' : ''} (${data.length})`} noData="Pas de territoire" data={data} onRowClick={(territory) => history.push(`/territory/${territory._id}`)} rowKey="_id" columns={[ { title: 'Nom', dataKey: 'name' }, { title: 'Types', dataKey: 'types', render: ({ types }) => (types ? types.join(', ') : '') }, { title: 'Périmètre', dataKey: 'perimeter' }, { title: 'Créé le', dataKey: 'createdAt', render: (territory) => toFrenchDate(territory.createdAt || '') }, ]} /> </StyledBox> <hr /> </> ); }; const Places = ({ search, onUpdateResults }) => { const history = useHistory(); const { relsPersonPlace } = useRelsPerson(); const { persons } = usePersons(); const data = useRecoilValue(placesSearchSelector({ search })); useEffect(() => { onUpdateResults(data.length); }, [search]); if (!data) return <div />; const moreThanOne = data.length > 1; return ( <> <StyledBox> <Table className="Table" title={`Lieu${moreThanOne ? 'x' : ''} fréquenté${moreThanOne ? 's' : ''} (${data.length})`} noData="Pas de lieu fréquenté" data={data} onRowClick={(obs) => history.push(`/territory/${obs.territory._id}`)} rowKey="_id" columns={[ { title: 'Nom', dataKey: 'name' }, { title: 'Personnes suivies', dataKey: 'persons', render: (place) => ( <span dangerouslySetInnerHTML={{ __html: relsPersonPlace .filter((rel) => rel.place === place._id) .map((rel) => persons.find((p) => p._id === rel.person)?.name) .join('<br/>'), }} /> ), }, { title: 'Créée le', dataKey: 'createdAt', render: (place) => toFrenchDate(place.createdAt) }, ]} /> </StyledBox> <hr /> </> ); }; const TerritoryObservations = ({ search, onUpdateResults }) => { const history = useHistory(); const territories = useRecoilValue(territoriesState); const data = useRecoilValue(territoriesObservationsSearchSelector({ search })).map((obs) => ({ ...obs, territory: territories.find((t) => t._id === obs.territory), })); useEffect(() => { onUpdateResults(data.length); }, [search]); if (!data) return <div />; const moreThanOne = data.length > 1; return ( <> <StyledBox> <Table className="Table" title={`Observation${moreThanOne ? 's' : ''} de territoire${moreThanOne ? 's' : ''} (${data.length})`} noData="Pas d'observation" data={data} onRowClick={(obs) => history.push(`/territory/${obs.territory._id}`)} rowKey="_id" columns={[ { title: 'Heure', dataKey: 'createdAt', render: (obs) => <span>{dayjs(obs.createdAt).format('HH:mm')}</span>, }, { title: 'Utilisateur', dataKey: 'user', render: (obs) => <UserName id={obs.user} />, }, { title: 'Territoire', dataKey: 'territory', render: (obs) => obs?.territory?.name }, { title: 'Observation', dataKey: 'entityKey', render: (obs) => <Observation noBorder obs={obs} />, left: true }, ]} /> </StyledBox> <hr /> </> ); }; const StyledBox = styled(Box)` border-radius: 16px; padding: 16px 32px; @media print { margin-bottom: 15px; } .Table { padding: 0; } `; const ViewWithPagination = () => ( <PaginationProvider> <View /> </PaginationProvider> ); export default ViewWithPagination;
32.79661
144
0.519961
acb1dfb2333467f648a4d76a5b3b5d10e955f933
1,472
js
JavaScript
src/reducers/blogReducer.js
Imlerix/personal_app
b75446f16d0747188dbc66b9d921e14e4b084fbe
[ "MIT" ]
2
2019-09-15T01:30:52.000Z
2019-10-01T08:00:11.000Z
src/reducers/blogReducer.js
Imlerix/personal_app
b75446f16d0747188dbc66b9d921e14e4b084fbe
[ "MIT" ]
4
2021-05-10T06:21:22.000Z
2022-02-26T16:11:32.000Z
src/reducers/blogReducer.js
Imlerix/personal_app
b75446f16d0747188dbc66b9d921e14e4b084fbe
[ "MIT" ]
1
2020-02-13T08:59:12.000Z
2020-02-13T08:59:12.000Z
import * as types from '../constants/ActionTypes' const initialState = { isOpenSearch: true, isOpenTags: true, tags: [], articlesAmount: 0, search: '', page: 1, filters: [ { name_ru: 'Все', name_en: 'All', value: 'all', width: 40, left: '0' }, { name_ru: 'Ранее', name_en: 'Recent', value: 'recent', width: 70, left: '40px' }, { name_ru: 'Лучшее', name_en: 'The best', value: 'best', width: 80, left: '110px' } ], currentFilter: 1, articles: [], article: {} } export default function blogReducer(state = initialState, action) { switch (action.type) { case types.SWITCH_SEARCH: return { ...state, isOpenSearch: action.value } case types.SWITCH_TAGS: return { ...state, isOpenTags: action.value } case types.CURRENT_FILTER: return { ...state, currentFilter: action.filter } case types.SET_SEARCH: return { ...state, search: action.search } case types.CHOOSE_TAGS: return { ...state, tags: action.tags } case types.GET_BLOG: return { ...state, articles: action.articles, tags: action.tags } case types.GET_ARTICLE: return { ...state, article: action.article } default: return state; } }
17.52381
67
0.514266
acb270553ff191869cc93c96893255bb77f08bab
313
js
JavaScript
javascript/easy/numberofSegmentsinaString.js
scaffeinate/leetcode
750620f0ab9ed2eb17e0cd3065e51176e0dca77a
[ "MIT" ]
6
2018-03-09T18:45:21.000Z
2020-10-02T22:54:51.000Z
javascript/easy/numberofSegmentsinaString.js
scaffeinate/leetcode
750620f0ab9ed2eb17e0cd3065e51176e0dca77a
[ "MIT" ]
null
null
null
javascript/easy/numberofSegmentsinaString.js
scaffeinate/leetcode
750620f0ab9ed2eb17e0cd3065e51176e0dca77a
[ "MIT" ]
1
2020-08-28T14:48:52.000Z
2020-08-28T14:48:52.000Z
/** * @param {string} s * @return {number} */ var countSegments = function(s) { let count = 0, numSegments = 0; for(let c of s) { if(c !== ' ') { count = 1; } else { numSegments += count; count = 0; } } return numSegments + count; };
18.411765
35
0.4377
acb348158b8e5f5d737a67f61b15dc4cca3f1a3f
3,290
js
JavaScript
src/Pages/Principal/index.js
thi-costa/ifood-app-react-clone
4c8f738596740fb9b0da8efdb9f00fc4a602628a
[ "MIT" ]
null
null
null
src/Pages/Principal/index.js
thi-costa/ifood-app-react-clone
4c8f738596740fb9b0da8efdb9f00fc4a602628a
[ "MIT" ]
null
null
null
src/Pages/Principal/index.js
thi-costa/ifood-app-react-clone
4c8f738596740fb9b0da8efdb9f00fc4a602628a
[ "MIT" ]
null
null
null
import { StatusBar } from 'expo-status-bar'; import React, { useState, useEffect } from 'react'; import { Text, Alert, ActivityIndicator } from 'react-native'; import { SafeAreaView, ViewActivity, CategoriaView, BannerView, ViewPrincipal, ViewRestaurantes, TituloRestaurantes, ButtonTipoSelect, TextTipoSelect, SelectTipo } from './style'; import CategoriaItem from '../../components/CategoriaItem' import BannerItem from '../../components/BannerItem' import RestauranteItem from '../../components/RestauranteItem' export default function Principal() { const [banners, setBanners] = useState([]) const [categorias, setCategorias] = useState([]) const [restaurantes, setRestaurantes] = useState([]) const [loaded, setLoaded] = useState(false) const [tipo, setTipo] = useState('Entrega'); useEffect(() => { async function buscaDados() { try { const response = await fetch('http://my-json-server.typicode.com/pablohdev/app-ifood-clone/db'); const data = await response.json(); setLoaded(true) setBanners(data.banner_principal); setCategorias(data.categorias); setRestaurantes(data.restaurantes); } catch (e) { Alert.alert('Erro consultada' + e); } } buscaDados() }, []) const ViewHome = (props) => { return ( <ViewPrincipal> <SelectTipo> <ButtonTipoSelect onPress={() => setTipo('Entrega')}><TextTipoSelect selected={tipo == 'Entrega'}>Entrega</TextTipoSelect></ButtonTipoSelect> <ButtonTipoSelect onPress={() => setTipo('Retirada')}><TextTipoSelect selected={tipo == 'Retirada'}>Retirada</TextTipoSelect></ButtonTipoSelect> </SelectTipo> <CategoriaView horizontal={true} showsHorizontalScrollIndicator={false}> {categorias.map(categoria => ( <CategoriaItem key={categoria.id} foto={categoria.img_url} texto={categoria.nome} /> ))} </CategoriaView> <BannerView horizontal={true} showsHorizontalScrollIndicator={false}> {banners.map(banner => ( <BannerItem key={banner.id} foto={banner.banner_img_url} /> ))} </BannerView> <TituloRestaurantes>Restaurantes</TituloRestaurantes> <ViewRestaurantes> {restaurantes.map(restaurante => ( <> <RestauranteItem key={restaurante.id} foto={restaurante.url_img} nome={restaurante.nome} nota={restaurante.nota} categoria={restaurante.categoria} distancia={restaurante.distancia} valorFrete={restaurante.valor_frete} tempoEntrega={restaurante.tempo_entrega} /> </> ))} </ViewRestaurantes> </ViewPrincipal> ) } return ( <> <StatusBar style="theme-dark" /> <SafeAreaView> {loaded ? ( <ViewHome /> ) : ( <ViewActivity > <ActivityIndicator color="#F0001A" size="large" /> <Text>Carregando dados aguarde...{loaded}</Text> </ViewActivity> )} </SafeAreaView> </> ); }
25.905512
154
0.590881
acb35bfd4c9ca9e520b58350aabcf934c7616162
258
js
JavaScript
public/view/notificacoes/notificacoes.js
edineibauer/Notification
d642400537cdc4b68b327bcbbf85ccd9c855b447
[ "MIT" ]
null
null
null
public/view/notificacoes/notificacoes.js
edineibauer/Notification
d642400537cdc4b68b327bcbbf85ccd9c855b447
[ "MIT" ]
null
null
null
public/view/notificacoes/notificacoes.js
edineibauer/Notification
d642400537cdc4b68b327bcbbf85ccd9c855b447
[ "MIT" ]
null
null
null
$(async function () { $(".badge-notification").remove(); if (USER.setor === 0 || typeof firebaseConfig === "undefined" || !swRegistration || !swRegistration.pushManager || Notification.permission === "granted") $(".btn-notify").remove(); });
43
157
0.620155
acb3b513a6906527cd6c1e838e407a77056ea06c
2,240
js
JavaScript
src/components/AddFilters.js
labs15-best-places/Frontend
171cdf25ea17659e0d70ba80ab7fa68ad9668820
[ "MIT" ]
4
2019-11-06T00:47:09.000Z
2020-01-19T18:36:11.000Z
src/components/AddFilters.js
labs15-best-places/Frontend
171cdf25ea17659e0d70ba80ab7fa68ad9668820
[ "MIT" ]
6
2019-08-30T17:18:51.000Z
2019-09-25T15:24:20.000Z
src/components/AddFilters.js
BloomTech-Labs/best-places-to-live-fe
171cdf25ea17659e0d70ba80ab7fa68ad9668820
[ "MIT" ]
8
2020-01-07T21:03:32.000Z
2020-10-22T20:42:25.000Z
import React from "react"; import { withRouter } from "react-router-dom"; import { Button, Text, Container, Flex, Nav } from "../styles/index"; import DislikeIcon from "./DislikeIcon"; import theme from "../theme"; import CategoryForm from "./CategoryForm"; import { connect } from "react-redux"; const AddFilters = ({ handleClose, ...rest }) => { const resetForm = () => { const reset = document.getElementById("reset"); reset.click(); }; return ( <> <Container position="absolute" top="0" left="0" width="100%" height="100%" overflow="auto" > <Container width="100%" borderBottom={`.5px solid ${theme.colors.blackPearl}`} backgroundColor="athensGray" > <Nav display="grid" gridTemplateColumns="1fr 4fr 1fr"> <Button border="none" marginBottom="0" backgroundColor="athensGray" padding="0" onClick={resetForm} > Clear All </Button> <Text textAlign="center" fontSize="1.25rem"> Filters </Text> <Flex justifyContent="center" alignItems="center"> <DislikeIcon actionType="closeModal" handleClose={handleClose} iconColor="black" ></DislikeIcon> </Flex> </Nav> </Container> <Container> <Text textAlign="center" color="choronozon" as="h2" fontSize={5}> Refine Your Search </Text> <Text textAlign="center" color="black" as="h3" fontSize={2} color="choronozon" fontWeight="normal" > Select the variables most important to you: </Text> </Container> <CategoryForm resetForm={resetForm} handleClose={handleClose} {...rest} /> </Container> </> ); }; const mapStateToProps = state => { return { selectedFactors: state.selectedFactors }; }; export default withRouter(connect(mapStateToProps, null)(AddFilters));
26.666667
75
0.516518
acb3dfa02108d21bb39947fb3cfad1db5439556e
721
js
JavaScript
src/store/mutations.js
jklwlong/vueui
867ccafd21fe70d4eea3dcff7614a606fb16641a
[ "Apache-2.0" ]
null
null
null
src/store/mutations.js
jklwlong/vueui
867ccafd21fe70d4eea3dcff7614a606fb16641a
[ "Apache-2.0" ]
null
null
null
src/store/mutations.js
jklwlong/vueui
867ccafd21fe70d4eea3dcff7614a606fb16641a
[ "Apache-2.0" ]
null
null
null
export default { register (state, userId) { const date = new Date() const user = state.users.find(user => { return user.id === userId }) user.registered = true const registration = { userId: userId, name: user.name, date: date.getMonth() + '/' + date.getDay() } state.registrations.push(registration) }, unregister (state, payload) { const user = state.users.find(user => { return user.id === payload.userId }) user.registered = false const registration = state.registrations.find(registration => { return registration.userId === payload.userId }) state.registrations.splice(state.registrations.indexOf(registration), 1) } }
27.730769
76
0.631068
acb439a2eba9fa901717cb08b422e749a8b8fa79
2,514
js
JavaScript
public/metronic/js/vendor/ckeditor/plugins/table/lang/si.js
Murukan-GitHub/TalentSaga
194214e8e76f4a0424eb2457d02aeac240f51b08
[ "MIT" ]
1
2021-05-19T01:23:25.000Z
2021-05-19T01:23:25.000Z
public/metronic/js/vendor/ckeditor/plugins/table/lang/si.js
Murukan-GitHub/TalentSaga
194214e8e76f4a0424eb2457d02aeac240f51b08
[ "MIT" ]
1
2017-07-27T18:02:31.000Z
2017-07-27T18:02:31.000Z
public/metronic/js/vendor/ckeditor/plugins/table/lang/si.js
Murukan-GitHub/TalentSaga
194214e8e76f4a0424eb2457d02aeac240f51b08
[ "MIT" ]
1
2021-05-19T01:25:01.000Z
2021-05-19T01:25:01.000Z
/* Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or http://ckeditor.com/license */ CKEDITOR.plugins.setLang( 'table', 'si', { border: 'සීමාවවල විශාලත්වය', caption: 'Caption', // MISSING cell: { menu: 'කොටුව', insertBefore: 'පෙර කොටුවක් ඇතුල්කිරිම', insertAfter: 'පසුව කොටුවක් ඇතුලත් ', deleteCell: 'කොටුව මැකීම', merge: 'කොටු එකට යාකිරිම', mergeRight: 'දකුණට ', mergeDown: 'පහලට ', splitHorizontal: 'තිරස්ව කොටු පැතිරීම', splitVertical: 'සිරස්ව කොටු පැතිරීම', title: 'කොටු ', cellType: 'කොටු වර්ගය', rowSpan: 'පේළි පළල', colSpan: 'සිරස් පළල', wordWrap: 'වචන ගැලපුම', hAlign: 'තිරස්ව ', vAlign: 'සිරස්ව ', alignBaseline: 'පාද රේඛාව', bgColor: 'පසුබිම් වර්ණය', borderColor: 'මායිම් ', data: 'Data', // MISSING header: 'ශීර්ෂක', yes: 'ඔව්', no: 'නැත', invalidWidth: 'කොටු පළල සංඛ්‍ය්ත්මක වටිනාකමක් විය යුතුය', invalidHeight: 'කොටු උස සංඛ්‍ය්ත්මක වටිනාකමක් විය යුතුය', invalidRowSpan: 'Rows span must be a whole number.', // MISSING invalidColSpan: 'Columns span must be a whole number.', // MISSING chooseColor: 'තෝරන්න' }, cellPad: 'Cell padding', // MISSING cellSpace: 'Cell spacing', // MISSING column: { menu: 'Column', // MISSING insertBefore: 'Insert Column Before', // MISSING insertAfter: 'Insert Column After', // MISSING deleteColumn: 'Delete Columns' // MISSING }, columns: 'සිරස් ', deleteTable: 'වගුව මකන්න', headers: 'ශීර්ෂක', headersBoth: 'දෙකම', headersColumn: 'පළමූ සිරස් තීරුව', headersNone: 'කිසිවක්ම නොවේ', headersRow: 'පළමූ පේළිය', invalidBorder: 'Border size must be a number.', // MISSING invalidCellPadding: 'Cell padding must be a positive number.', // MISSING invalidCellSpacing: 'Cell spacing must be a positive number.', // MISSING invalidCols: 'Number of columns must be a number greater than 0.', // MISSING invalidHeight: 'Table height must be a number.', // MISSING invalidRows: 'Number of rows must be a number greater than 0.', // MISSING invalidWidth: 'Table width must be a number.', // MISSING menu: 'Table Properties', // MISSING row: { menu: 'Row', // MISSING insertBefore: 'Insert Row Before', // MISSING insertAfter: 'Insert Row After', // MISSING deleteRow: 'Delete Rows' // MISSING }, rows: 'Rows', // MISSING summary: 'Summary', // MISSING title: 'Table Properties', // MISSING toolbar: 'Table', // MISSING widthPc: 'percent', // MISSING widthPx: 'pixels', // MISSING widthUnit: 'width unit' // MISSING } );
33.52
78
0.638425
acb53bea597d44502af3485fdba2c4d9ac953d2c
1,318
js
JavaScript
src/actions/authActions.js
mysticmetal/ecommerce-react
8c1e47ca1ab6127d92b8412a40d8871d65b308c0
[ "Apache-2.0" ]
1
2020-09-30T06:48:49.000Z
2020-09-30T06:48:49.000Z
src/actions/authActions.js
mysticmetal/ecommerce-react
8c1e47ca1ab6127d92b8412a40d8871d65b308c0
[ "Apache-2.0" ]
null
null
null
src/actions/authActions.js
mysticmetal/ecommerce-react
8c1e47ca1ab6127d92b8412a40d8871d65b308c0
[ "Apache-2.0" ]
1
2022-03-27T07:06:16.000Z
2022-03-27T07:06:16.000Z
import * as type from 'constants/constants'; export const signIn = (email, password) => ({ type: type.SIGNIN, payload: { email, password } }); export const signInWithGoogle = () => ({ type: type.SIGNIN_WITH_GOOGLE }); export const signInWithFacebook = () => ({ type: type.SIGNIN_WITH_FACEBOOK }); export const signInWithGithub = () => ({ type: type.SIGNIN_WITH_GITHUB }); export const signUp = user => ({ type: type.SIGNUP, payload: user }); export const signInSuccess = auth => ({ type: type.SIGNIN_SUCCESS, payload: auth }); export const setAuthPersistence = () => ({ type: type.SET_AUTH_PERSISTENCE }); export const signOut = () => ({ type: type.SIGNOUT }); export const signOutSuccess = () => ({ type: type.SIGNOUT_SUCCESS }); export const setAuthStatus = status => ({ type: type.SET_AUTH_STATUS, payload: status }); export const onAuthStateChanged = () => ({ type: type.ON_AUTHSTATE_CHANGED }); export const onAuthStateSuccess = user => ({ type: type.ON_AUTHSTATE_SUCCESS, payload: user }); export const onAuthStateFail = error => ({ type: type.ON_AUTHSTATE_FAIL, payload: error }); export const resetPassword = email => ({ type: type.RESET_PASSWORD, payload: email }); export const isAuthenticating = (bool = true) => ({ type: type.IS_AUTHENTICATING, payload: bool });
18.054795
51
0.685129
acb594f7fe21efc40625291eb2b211619c2672b3
1,287
js
JavaScript
src/components/image.js
K20shores/kyleshores.com
78a4f451b547530584aac0d19c3bfdc6167d6385
[ "RSA-MD" ]
null
null
null
src/components/image.js
K20shores/kyleshores.com
78a4f451b547530584aac0d19c3bfdc6167d6385
[ "RSA-MD" ]
3
2020-09-25T11:28:17.000Z
2020-10-28T23:48:07.000Z
src/components/image.js
K20shores/kyleshores.com
78a4f451b547530584aac0d19c3bfdc6167d6385
[ "RSA-MD" ]
null
null
null
import React from "react" import Img from "gatsby-image" import { StaticQuery, graphql } from "gatsby" function renderImage(file, alt, caption, style) { return ( <div style={{ ...style, }} > <Img fluid={file.node.childImageSharp.fluid} /> {caption && ( <span dangerouslySetInnerHTML={{ __html: caption }} style={{ display: `block`, textAlign: `center`, color: `grey`, fontSize: `80%`, }} ></span> )} {caption && <hr></hr>} </div> ) } const Image = function (props) { return ( <StaticQuery query={graphql` query { images: allFile { edges { node { extension relativePath childImageSharp { fluid(maxWidth: 1000) { ...GatsbyImageSharpFluid } } } } } } `} render={data => { const image = data.images.edges.find( image => image.node.relativePath === props.src ) return renderImage(image, props.alt, props.caption, props.style) }} /> ) } export default Image
21.45
72
0.452991
acb6ee9f6c8eb06d6efa6cdc049f7c6ecd2567a9
2,256
js
JavaScript
index.js
concordnow/ember-concord-doc
46a0ee0654427190404dd269fbbc71e03e3a7529
[ "MIT" ]
1
2022-03-14T14:41:33.000Z
2022-03-14T14:41:33.000Z
index.js
concordnow/ember-concord-doc
46a0ee0654427190404dd269fbbc71e03e3a7529
[ "MIT" ]
24
2021-06-16T15:52:35.000Z
2022-03-28T05:16:07.000Z
index.js
concordnow/ember-concord-doc
46a0ee0654427190404dd269fbbc71e03e3a7529
[ "MIT" ]
null
null
null
'use strict'; module.exports = { name: require('./package').name, contentFor(type, config) { if ( type === 'head-footer' && config.modulePrefix === 'dummy' && config.environment != 'test' ) { return [ 'tailwindcss@^2.0/dist/base.min.css', 'tailwindcss@^2.0/dist/components.min.css', '@tailwindcss/typography@^0.4/dist/typography.min.css', 'tailwindcss@^2.0/dist/utilities.min.css', ] .map((css) => `<link href="https://unpkg.com/${css}" rel="stylesheet">`) .join(''); } if ( type === 'body-footer' && config.modulePrefix === 'dummy' && config.environment != 'test' ) { return `<script>Prism.plugins.customClass.prefix('prism--')</script>`; } }, included(includer) { if (includer.parent) { throw new Error( `ember-concord-doc should be in your package.json's devDependencies` ); } else if (includer.name === this.project.name()) { throw new Error( `ember-concord-doc cannot be used to document an application` ); } if (!includer.options.snippetSearchPaths) { includer.options.snippetSearchPaths = ['addon', 'tests/dummy/app']; } if (!includer.options['ember-prism']) { includer.options['ember-prism'] = {}; } if (!includer.options['ember-prism'].components) { includer.options['ember-prism'].components = [ 'markup', 'markup-templating', 'handlebars', 'javascript', 'css', ]; } if (!includer.options['ember-prism'].plugins) { includer.options['ember-prism'].plugins = ['custom-class']; } if (!includer.options['ember-md-block']) { includer.options['ember-md-block'] = {}; } if (!includer.options['ember-md-block'].wrapper) { includer.options['ember-md-block'].wrapper = {}; } if (!includer.options['ember-md-block'].wrapper.begin) { includer.options['ember-md-block'].wrapper.begin = '<div class="prose max-w-none">'; } if (!includer.options['ember-md-block'].wrapper.end) { includer.options['ember-md-block'].wrapper.end = '</div>'; } this._super.included.apply(this, arguments); }, };
27.180723
80
0.574025
acb72076fa60262d4f3f0402b618cd2bbbf858db
4,593
js
JavaScript
react-native/src/screens/Login/LoginScreen.js
9State/MacPanel
cb5f89352580e03bb1686708de95643b5a74f10f
[ "MIT" ]
null
null
null
react-native/src/screens/Login/LoginScreen.js
9State/MacPanel
cb5f89352580e03bb1686708de95643b5a74f10f
[ "MIT" ]
null
null
null
react-native/src/screens/Login/LoginScreen.js
9State/MacPanel
cb5f89352580e03bb1686708de95643b5a74f10f
[ "MIT" ]
null
null
null
import { useFormik } from 'formik'; import i18n from 'i18n-js'; import { Box, Button, Center, FormControl, Image, Input, Stack, WarningOutlineIcon } from 'native-base'; import PropTypes from 'prop-types'; import React, { useRef, useState } from 'react'; import { View } from 'react-native'; import { object, string } from 'yup'; import { login } from '../../api/AccountAPI'; import TenantBox from '../../components/TenantBox/TenantBox'; import ValidationMessage from '../../components/ValidationMessage/ValidationMessage'; import AppActions from '../../store/actions/AppActions'; import LoadingActions from '../../store/actions/LoadingActions'; import PersistentStorageActions from '../../store/actions/PersistentStorageActions'; import { connectToRedux } from '../../utils/ReduxConnect'; const ValidationSchema = object().shape({ username: string().required('AbpAccount::ThisFieldIsRequired.'), password: string().required('AbpAccount::ThisFieldIsRequired.'), }); function LoginScreen({ startLoading, stopLoading, setToken, fetchAppConfig }) { const [showTenantSelection, setShowTenantSelection] = useState(false); const passwordRef = useRef(null); const toggleTenantSelection = () => { setShowTenantSelection(!showTenantSelection); }; const submit = ({ username, password }) => { startLoading({ key: 'login' }); login({ username, password }) .then((data) => setToken({ ...data, expire_time: new Date().valueOf() + data.expires_in, scope: undefined, }) ) .then( () => new Promise((resolve) => fetchAppConfig({ showLoading: false, callback: () => resolve(true), }) ) ) .finally(() => stopLoading({ key: 'login' })); }; const formik = useFormik({ validationSchema: ValidationSchema, initialValues: { username: '', password: '' }, onSubmit: submit, }); return ( <Center flex={0.6} px="3"> <Box w={{ base: '100%', }} mb="50" alignItems="center" > <Image alt="Image" source={require('../../../assets/logo.png')} /> </Box> <TenantBox showTenantSelection={showTenantSelection} toggleTenantSelection={toggleTenantSelection} /> <Box w={{ base: '100%', }} display={showTenantSelection ? 'none' : 'flex'} > <FormControl isRequired my="2"> <Stack mx="4"> <FormControl.Label> {i18n.t('AbpAccount::UserNameOrEmailAddress')} </FormControl.Label> <Input onChangeText={formik.handleChange('username')} onBlur={formik.handleBlur('username')} value={formik.values.username} returnKeyType="next" autoCapitalize="none" onSubmitEditing={() => passwordRef?.current?.focus()} size="lg" /> <ValidationMessage>{formik.errors.username}</ValidationMessage> </Stack> </FormControl> <FormControl isRequired my="2"> <Stack mx="4"> <FormControl.Label> {i18n.t('AbpAccount::Password')} </FormControl.Label> <Input type="password" onChangeText={formik.handleChange('password')} onBlur={formik.handleBlur('password')} value={formik.values.password} ref={passwordRef} autoCapitalize="none" size="lg" /> <FormControl.ErrorMessage leftIcon={<WarningOutlineIcon size="xs" />} > {formik.errors.password} </FormControl.ErrorMessage> </Stack> </FormControl> <View style={{ marginTop: 20, alignItems: 'center' }}> <Button onPress={formik.handleSubmit} width="30%" size="lg"> {i18n.t('AbpAccount::Login')} </Button> </View> </Box> </Center> ); } LoginScreen.propTypes = { startLoading: PropTypes.func.isRequired, stopLoading: PropTypes.func.isRequired, setToken: PropTypes.func.isRequired, fetchAppConfig: PropTypes.func.isRequired, }; export default connectToRedux({ component: LoginScreen, dispatchProps: { startLoading: LoadingActions.start, stopLoading: LoadingActions.stop, fetchAppConfig: AppActions.fetchAppConfigAsync, setToken: PersistentStorageActions.setToken, }, });
29.632258
85
0.581537
acb72da0a535f07ffedd1d52352c6acc43f5ecc1
394
js
JavaScript
src/icons/svg-icons/CameraRear.js
JPTredway/styled-material-components
385a87be89640cb1d6864293fb601b9760beb772
[ "MIT" ]
59
2018-02-20T21:01:37.000Z
2019-10-13T14:53:12.000Z
src/icons/svg-icons/CameraRear.js
JPTredway/styled-material-components
385a87be89640cb1d6864293fb601b9760beb772
[ "MIT" ]
150
2018-02-19T17:20:00.000Z
2020-04-07T15:13:45.000Z
src/icons/svg-icons/CameraRear.js
JPTredway/styled-material-components
385a87be89640cb1d6864293fb601b9760beb772
[ "MIT" ]
38
2017-06-01T19:37:58.000Z
2018-02-14T21:23:34.000Z
import React from 'react'; import styled from 'styled-components'; import { Icon } from '../icons'; export const CameraRearIcon = styled(props => ( <Icon {...props}> <path d="M10 20H5v2h5v2l3-3-3-3v2zm4 0v2h5v-2h-5zm3-20H7C5.9 0 5 .9 5 2v14c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V2c0-1.1-.9-2-2-2zm-5 6c-1.11 0-2-.9-2-2s.89-2 1.99-2 2 .9 2 2C14 5.1 13.1 6 12 6z" key='path0' /> </Icon> ))``;
39.4
208
0.634518
acb78886a216f67ce4b0be2056954991bc6683a0
39
js
JavaScript
src/utils/constants.js
SystangoTechnologies/serverless-node-simple-crud
d613b96bff6b6f3bd8a6313d905348130dfaef81
[ "MIT" ]
79
2019-05-14T11:29:36.000Z
2021-06-01T17:43:26.000Z
src/utils/constants.js
SystangoTechnologies/serverless-node-simple-crud
d613b96bff6b6f3bd8a6313d905348130dfaef81
[ "MIT" ]
null
null
null
src/utils/constants.js
SystangoTechnologies/serverless-node-simple-crud
d613b96bff6b6f3bd8a6313d905348130dfaef81
[ "MIT" ]
2
2019-08-19T14:49:03.000Z
2021-10-06T08:17:03.000Z
'use strict' exports.constants = { };
7.8
21
0.641026
acb852507df8eab3a1a8a781dbff34b1ada38be8
530
js
JavaScript
app/src/components/Tree/TreeItem/TreeItemContent/styles/IconSlotStyled.js
VNadygin/booben
6bb864cda5b3ee42876a875882187229bb63fade
[ "Apache-2.0" ]
110
2018-06-20T16:01:53.000Z
2022-02-25T08:55:04.000Z
app/src/components/Tree/TreeItem/TreeItemContent/styles/IconSlotStyled.js
VNadygin/booben
6bb864cda5b3ee42876a875882187229bb63fade
[ "Apache-2.0" ]
83
2018-06-20T20:47:51.000Z
2020-12-31T15:50:55.000Z
app/src/components/Tree/TreeItem/TreeItemContent/styles/IconSlotStyled.js
VNadygin/booben
6bb864cda5b3ee42876a875882187229bb63fade
[ "Apache-2.0" ]
7
2018-10-09T13:15:47.000Z
2021-10-05T19:36:19.000Z
import styled from 'styled-components'; import { iconSizeMixin } from 'reactackle-core'; import constants from '../../../styles/constants'; import { textColorMediumDark, } from '../../../../../styles/themeSelectors'; const iconSize = constants.buttonSize; const iconImgSize = constants.buttonImgSize; export const IconSlotStyled = styled.div` display: flex; color: ${textColorMediumDark}; margin-right: -2px; ${iconSizeMixin(`${iconSize}px`, `${iconImgSize}px`)} `; IconSlotStyled.displayName = 'IconSlotStyled';
25.238095
55
0.716981
acb927b02703052d45639d2808f85ed604b15e00
1,061
js
JavaScript
src/main/resources/static/vendor/lib/svg-icons/maps/local-dining.js
StarterInc/IgniteReact
42c2718b613eae5bd33da6d2126ee64796ec6543
[ "MIT" ]
null
null
null
src/main/resources/static/vendor/lib/svg-icons/maps/local-dining.js
StarterInc/IgniteReact
42c2718b613eae5bd33da6d2126ee64796ec6543
[ "MIT" ]
null
null
null
src/main/resources/static/vendor/lib/svg-icons/maps/local-dining.js
StarterInc/IgniteReact
42c2718b613eae5bd33da6d2126ee64796ec6543
[ "MIT" ]
6
2018-02-16T13:56:29.000Z
2021-06-09T18:53:11.000Z
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _react = require('react'); var _react2 = _interopRequireDefault(_react); var _pure = require('recompose/pure'); var _pure2 = _interopRequireDefault(_pure); var _svgIcon = require('../../svg-icon'); var _svgIcon2 = _interopRequireDefault(_svgIcon); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } var MapsLocalDining = function MapsLocalDining(props) { return _react2.default.createElement( _svgIcon2.default, props, _react2.default.createElement('path', { d: 'M8.1 13.34l2.83-2.83L3.91 3.5c-1.56 1.56-1.56 4.09 0 5.66l4.19 4.18zm6.78-1.81c1.53.71 3.68.21 5.27-1.38 1.91-1.91 2.28-4.65.81-6.12-1.46-1.46-4.2-1.1-6.12.81-1.59 1.59-2.09 3.74-1.38 5.27L3.7 19.87l1.41 1.41L12 14.41l6.88 6.88 1.41-1.41L13.41 13l1.47-1.47z' }) ); }; MapsLocalDining = (0, _pure2.default)(MapsLocalDining); MapsLocalDining.displayName = 'MapsLocalDining'; exports.default = MapsLocalDining; module.exports = exports['default'];
33.15625
309
0.71065
acb9b700befe01d7c1486a76a342289aa974d16b
6,978
js
JavaScript
pigtail/assets/script/PVPOL/HttpUtils.js
zb0712/pig_tail
2b41f6a6acf24ca446252caf5b108c760d91587e
[ "Apache-2.0" ]
null
null
null
pigtail/assets/script/PVPOL/HttpUtils.js
zb0712/pig_tail
2b41f6a6acf24ca446252caf5b108c760d91587e
[ "Apache-2.0" ]
null
null
null
pigtail/assets/script/PVPOL/HttpUtils.js
zb0712/pig_tail
2b41f6a6acf24ca446252caf5b108c760d91587e
[ "Apache-2.0" ]
null
null
null
class HttpUtil { constructor() { this.token = "hello" } /** * 登录 * @param {学号} student_id * @param {密码} password * @returns */ login(student_id, password) { let t = this return new Promise((resolve, reject) => { let formData = { "student_id": student_id, "password": password } let data = [] for (let key in formData) { data.push(''.concat(key, '=', formData[key])) } formData = data.join('&') let xhr = new XMLHttpRequest() xhr.open("post", "http://172.17.173.97:8080/api/user/login", true) xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded') xhr.onreadystatechange = function () { if (xhr.readyState == 4 && xhr.status == 200) { let jsonObj = JSON.parse(xhr.responseText) t.token = ` Bearer ${jsonObj.data.token}` cc.log(t.token) resolve(jsonObj) } } xhr.send(formData) }) } /** * 创建对局 * @param {*} isPrivate * @returns */ createGame(isPrivate) { let t = this return new Promise((resolve, reject) => { let xhr = new XMLHttpRequest() let obj = { "private": isPrivate } xhr.open("post", "http://172.17.173.97:9000/api/game/", true) xhr.setRequestHeader("Content-Type", "application/json") xhr.setRequestHeader("Authorization", t.token) xhr.onreadystatechange = function () { if (xhr.readyState == 4 && xhr.status == 200) { let jsonObj = JSON.parse(xhr.responseText) cc.log(jsonObj.data.uuid) resolve(jsonObj) } } cc.log(JSON.stringify(obj)) xhr.send(JSON.stringify(obj)) }) } /** * 获取对局列表 * @param {*} page_size * @param {*} page_num * @returns */ getGameList(page_size, page_num) { let t = this return new Promise((resolve, reject) => { let xhr = new XMLHttpRequest() xhr.open("get", `http://172.17.173.97:9000/api/game/index?page_size=${page_size}&page_num=${page_num}`, true) xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded') xhr.setRequestHeader('Authorization', t.token) xhr.onreadystatechange = function () { if (xhr.readyState == 4 && xhr.status == 200) { let jsonObj = JSON.parse(xhr.responseText) resolve(jsonObj) } } xhr.send() }) } /** * 根据uuid加入对局 * @param {*} uuid * @returns */ joinGame(uuid) { let t = this return new Promise((resolve, reject) => { let xhr = new XMLHttpRequest() xhr.open("post", `http://172.17.173.97:9000/api/game/${uuid}`, true) xhr.setRequestHeader("Authorization", t.token) xhr.onreadystatechange = function () { if (xhr.readyState == 4 && xhr.status == 200) { let jsonObj = JSON.parse(xhr.responseText) resolve(jsonObj) } else if (xhr.status != 200) { reject(xhr.status) } } xhr.send() }) } /** * 获取上一步操作 * @param {*} uuid * @returns */ getLast(uuid) { let t = this return new Promise((resolve, reject) => { let xhr = new XMLHttpRequest() xhr.open('get', `http://172.17.173.97:9000/api/game/${uuid}/last`, true) xhr.setRequestHeader("Authorization", t.token) xhr.onreadystatechange = function () { if (xhr.readyState == 4 && xhr.status == 200) { let jsonObj = JSON.parse(xhr.responseText) resolve(jsonObj) } else if (xhr.status != 200) { reject(xhr.status) } } xhr.send() }) } touchPoker(uuid) { let t = this return new Promise((resolve, reject) => { let obj = { "type": 0, } let xhr = new XMLHttpRequest() xhr.open('put', `http://172.17.173.97:9000/api/game/${uuid}`, true) xhr.setRequestHeader("Content-Type", "application/json"); xhr.setRequestHeader("Authorization", t.token) xhr.onreadystatechange = function () { if (xhr.readyState == 4 && xhr.status == 200) { let jsonObj = JSON.parse(xhr.responseText) cc.log(jsonObj) resolve(jsonObj) } else if (xhr.status != 200) { reject(xhr.status) } } xhr.send(JSON.stringify(obj)) }) } putPoker(card, uuid) { let t = this return new Promise((resolve, reject) => { let obj = { "type": 1, "card": card } let xhr = new XMLHttpRequest() xhr.open('put', `http://172.17.173.97:9000/api/game/${uuid}`, true) xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded') // xhr.setRequestHeader("Content-Type", "application/json"); xhr.setRequestHeader("Authorization", t.token) xhr.onreadystatechange = function () { if (xhr.readyState == 4 && xhr.status == 200) { let jsonObj = JSON.parse(xhr.responseText) cc.log(jsonObj) resolve(jsonObj) } else if (xhr.status != 200) { reject(xhr.status) } } // xhr.send(JSON.stringify(obj)) xhr.send(`type=1&card=${card}`) }) } getGameResult(uuid) { let t = this return new Promise((resolve, reject) => { let xhr = new XMLHttpRequest() xhr.open('get', `http://172.17.173.97:9000/api/game/${uuid}`, true) xhr.setRequestHeader("Authorization", t.token) xhr.onreadystatechange = function () { if (xhr.readyState == 4 && xhr.status == 200) { let jsonObj = JSON.parse(xhr.responseText) cc.log(jsonObj) resolve(jsonObj) } else if (xhr.status != 200) { reject(xhr.status) } } xhr.send() }) } } // const httpUtil = new HttpUtil() // module.exports=HttpUtil; module.exports = new HttpUtil();
32.760563
121
0.467899
acba16d13c94df05ef7dd10cf15216bde5855e80
589
js
JavaScript
src/api/sysConfig/userConfig.js
zhangbin1010/acp-admin
d8915c014f1d592f11e9c6e2e44a0d90e8f70753
[ "Apache-2.0" ]
19
2019-01-15T08:54:01.000Z
2021-11-07T20:20:02.000Z
src/api/sysConfig/userConfig.js
zhangbin1010/acp-admin
d8915c014f1d592f11e9c6e2e44a0d90e8f70753
[ "Apache-2.0" ]
9
2019-04-26T07:31:35.000Z
2021-05-17T01:16:56.000Z
src/api/sysConfig/userConfig.js
zhangbin1010/acp-admin
d8915c014f1d592f11e9c6e2e44a0d90e8f70753
[ "Apache-2.0" ]
13
2019-02-18T03:29:08.000Z
2021-09-20T06:33:13.000Z
import ApiComm from '../ApiComm' export default { getModifiableUser: () => { return ApiComm.$http.get('/oauth/mod-user-list') }, query: (query) => { return ApiComm.$http.post('/oauth/user', query) }, delete: (idList) => { return ApiComm.$http.delete('/oauth/user', { data: idList }) }, create: (userInfo) => { return ApiComm.$http.put('/oauth/user', userInfo) }, update: (userInfo) => { return ApiComm.$http.patch('/oauth/user', userInfo) }, resetPwd: (userId) => { return ApiComm.$http.get('/oauth/user/reset-pwd/' + userId) } }
23.56
63
0.594228
acba2112042a59055d63cc606d370568ef08452d
611
js
JavaScript
packages/terra-action-footer/tests/wdio/centered-action-footer-spec.js
calebmeyer/terra-core
3089b8d45b33d2f006ed172ee926e78be8a45828
[ "Apache-2.0" ]
null
null
null
packages/terra-action-footer/tests/wdio/centered-action-footer-spec.js
calebmeyer/terra-core
3089b8d45b33d2f006ed172ee926e78be8a45828
[ "Apache-2.0" ]
1
2018-09-05T22:41:14.000Z
2018-09-20T21:30:18.000Z
packages/terra-action-footer/tests/wdio/centered-action-footer-spec.js
gabeparra01/terra-core
45efddb9acfa894b3e7a094b0995fbc7dd1d74a3
[ "Apache-2.0" ]
null
null
null
const { viewports } = require('./common'); describe('CenteredActionFooter', () => { describe('Multiple Actions', () => { beforeEach(() => browser.url('/#/raw/tests/terra-action-footer/action-footer/multiple-action-centered-action-footer')); Terra.should.beAccessible({ viewports }); Terra.should.matchScreenshot({ viewports }); }); describe('Single Action', () => { before(() => browser.url('/#/raw/tests/terra-action-footer/action-footer/single-action-centered-action-footer')); Terra.should.beAccessible({ viewports }); Terra.should.matchScreenshot({ viewports }); }); });
33.944444
123
0.667758
acba50c402532ca82dbd6d04ad6c4775157a856a
417
js
JavaScript
node/topic/demo/http/http4.js
yardfarmer/bone
c4d66ae3fee8d10165438f570ee8aca875633b45
[ "MIT" ]
1
2016-04-04T11:42:39.000Z
2016-04-04T11:42:39.000Z
node/topic/demo/http/http4.js
yardfarmer/bone
c4d66ae3fee8d10165438f570ee8aca875633b45
[ "MIT" ]
5
2016-04-10T08:00:13.000Z
2016-07-02T17:48:57.000Z
node/topic/demo/http/http4.js
yardfarmer/bone
c4d66ae3fee8d10165438f570ee8aca875633b45
[ "MIT" ]
null
null
null
var http = require('http'); var options = { host:"www.drsohanrajtater.com", port:80, path:'/images', method:'POST' }; var req = http.request(options,function(res){ console.log('Status : '+res.statusCode); console.log('Headers: '+JSON.stringify(res.headers)); res.setEncoding('utf8'); res.on('data',function(chunk){ console.log('Body: '+chunk); }); }); req.write('data\n'); req.write('data\n'); req.end();
20.85
54
0.657074
acbb102327e6c8fe117ee17010c2dc0cfe050ba2
309
js
JavaScript
packages/core/src/payments/redux/actions/doResetInstruments.js
Gaspard-Bruno/blackout
3a3e6b494b20c91a60296e0da825524d2446ec8b
[ "MIT" ]
20
2021-11-30T09:50:39.000Z
2022-03-24T16:15:24.000Z
packages/core/src/payments/redux/actions/doResetInstruments.js
Gaspard-Bruno/blackout
3a3e6b494b20c91a60296e0da825524d2446ec8b
[ "MIT" ]
18
2021-11-30T19:35:43.000Z
2022-03-25T16:30:08.000Z
packages/core/src/payments/redux/actions/doResetInstruments.js
Gaspard-Bruno/blackout
3a3e6b494b20c91a60296e0da825524d2446ec8b
[ "MIT" ]
16
2021-11-30T09:46:08.000Z
2022-03-02T12:38:24.000Z
import { RESET_INSTRUMENTS } from '../actionTypes'; /** * Method responsible for resetting instruments. * * @function doResetInstruments * @memberof module:payments/actions * * @returns {Function} Thunk factory. */ export default () => dispatch => { dispatch({ type: RESET_INSTRUMENTS, }); };
19.3125
51
0.679612
acbb35c11dfc78ca5dd1b1f2a016112d59402241
809
js
JavaScript
src/components/product/product-list.js
developerleah/RoomstoGoTest
d1ba7035e58dfe41f526c29961e826d66cb92da4
[ "MIT" ]
null
null
null
src/components/product/product-list.js
developerleah/RoomstoGoTest
d1ba7035e58dfe41f526c29961e826d66cb92da4
[ "MIT" ]
7
2021-03-09T22:55:16.000Z
2022-02-26T20:04:14.000Z
src/components/product/product-list.js
developerleah/RoomstoGoTest
d1ba7035e58dfe41f526c29961e826d66cb92da4
[ "MIT" ]
null
null
null
import React from "react"; import { useStaticQuery, graphql } from "gatsby"; import ProductItem from "./product-item"; import "../../assets/css/components/product/product-list.css"; const ProductList = ({ action }) => { const { allDataJson } = useStaticQuery( graphql` query { allDataJson { edges { node { products { sku title price image } } } } } ` ); return ( <div className="product-list grid-x grid-margin-y"> <h1>Product</h1> {allDataJson.edges[0].node.products.map(product => ( <ProductItem {...product} key={product.sku} action={action} /> ))} </div> ); }; export default ProductList;
22.472222
70
0.506799
acbbc0fdd009dc5a4d11e683b513778f25675c21
1,580
js
JavaScript
src/main/js/bundles/dn_mapflow/DblClickCheck.js
conterra/mapapps-mapflow
61b2e4cf2d122344b86bcad059ca5a8c295af7d9
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
src/main/js/bundles/dn_mapflow/DblClickCheck.js
conterra/mapapps-mapflow
61b2e4cf2d122344b86bcad059ca5a8c295af7d9
[ "ECL-2.0", "Apache-2.0" ]
1
2020-01-15T12:02:29.000Z
2020-01-15T12:02:29.000Z
src/main/js/bundles/dn_mapflow/DblClickCheck.js
conterra/mapapps-mapflow
61b2e4cf2d122344b86bcad059ca5a8c295af7d9
[ "ECL-2.0", "Apache-2.0" ]
null
null
null
/* * Copyright (C) 2019 con terra GmbH (info@conterra.de) * * 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. */ function DblClickCheck(clickCb, dblClickCb) { let clickCounter = 0; let lastClickedItem; let timeout; const reset = function () { lastClickedItem = undefined; clearTimeout(timeout); timeout = 0; clickCounter = 0; }; return function (coverItem) { if (!lastClickedItem || lastClickedItem.index !== coverItem.index) { reset(); lastClickedItem = coverItem; } ++clickCounter; if (!timeout) { const clickTimeout = 250; timeout = setTimeout(() => { try { if (clickCounter > 1) { dblClickCb(lastClickedItem); } else { clickCb(lastClickedItem); } } finally { reset(); } }, clickTimeout); } }; } export default DblClickCheck;
30.384615
76
0.56962
acbc24ca3c5d043d2c45827c41cc8940acaeae97
254
js
JavaScript
src/features/world/actions/reset-game-state.js
ajrussellaudio/react-rpg.com
8dd0ad1b315d7628f29fb0c2b71c38fb10dbf104
[ "MIT" ]
309
2019-01-31T01:51:46.000Z
2022-03-07T15:31:37.000Z
src/features/world/actions/reset-game-state.js
ajrussellaudio/react-rpg.com
8dd0ad1b315d7628f29fb0c2b71c38fb10dbf104
[ "MIT" ]
60
2019-02-04T20:23:43.000Z
2022-02-26T09:58:45.000Z
src/features/world/actions/reset-game-state.js
ajrussellaudio/react-rpg.com
8dd0ad1b315d7628f29fb0c2b71c38fb10dbf104
[ "MIT" ]
56
2019-02-05T18:25:17.000Z
2021-11-19T21:38:54.000Z
export default function resetGameState() { return dispatch => { dispatch({ type: 'RESET', payload: null }); dispatch({ type: 'PAUSE', payload: { pause: true, gameStart: true } }); }; }
13.368421
42
0.484252
acbcb944f6a8038dfdda94141131598df58c12f4
503
js
JavaScript
js/store.js
Enether/react-intro
f22b6059eef6a7eb70181e98bd64377df5b20795
[ "MIT" ]
null
null
null
js/store.js
Enether/react-intro
f22b6059eef6a7eb70181e98bd64377df5b20795
[ "MIT" ]
3
2020-09-05T04:31:41.000Z
2021-05-07T17:50:48.000Z
js/store.js
Enether/react-intro
f22b6059eef6a7eb70181e98bd64377df5b20795
[ "MIT" ]
null
null
null
import { applyMiddleware, createStore, compose } from 'redux' import thunk from 'redux-thunk' import rootReducer from './reducers.js' const store = createStore(rootReducer, compose( applyMiddleware(thunk), // run dev tools in browser if available // essentially a middleware (typeof window === 'object' /* we're in the browser */ && typeof window.devToolsExtension !== 'undefined') ? window.devToolsExtension() : (f) => f )) /* redux middlewares go here */ export default store
31.4375
111
0.701789
acbcc9f1305e34163456feff7a073453cbacf5a8
16,706
js
JavaScript
src/components/undraw/gaming.js
johnamielyasis/landingpage
c3291e32895de8b9130b83bca21200af82c2ecfb
[ "RSA-MD" ]
null
null
null
src/components/undraw/gaming.js
johnamielyasis/landingpage
c3291e32895de8b9130b83bca21200af82c2ecfb
[ "RSA-MD" ]
null
null
null
src/components/undraw/gaming.js
johnamielyasis/landingpage
c3291e32895de8b9130b83bca21200af82c2ecfb
[ "RSA-MD" ]
null
null
null
import React from 'react'; import { useRecoilValue } from 'recoil'; import { settingsAtom } from '../../atoms'; import { themes } from '../../constants'; // {primaryColor} export default function Gaming() { const colors = themes.colorMap; const { primaryColor } = useRecoilValue(settingsAtom); let primaryFill = colors[primaryColor]; return ( <svg id="d73490ac-7a9f-41f3-9c2f-a04fe0e68190" data-name="Layer 1" alt="playstation 5 controller" xmlns="http://www.w3.org/2000/svg" xmlnsXlink="http://www.w3.org/1999/xlink" width="100%" height="100%" viewBox="0 0 976.68 840.3"><defs><linearGradient id="40cb4f85-3adc-4f91-8af7-dda2654c63b5" x1="915.78" y1="706.9" x2="915.78" y2="252.26" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="gray" stop-opacity="0.25"/><stop offset="0.54" stop-color="gray" stop-opacity="0.12"/><stop offset="1" stop-color="gray" stop-opacity="0.1"/></linearGradient><linearGradient id="f74e0c91-e046-415c-8916-3730a2c068f9" x1="582.97" y1="706.75" x2="582.97" y2="221.19" xlinkHref="#40cb4f85-3adc-4f91-8af7-dda2654c63b5"/></defs><title>gaming</title><path d="M1002,485.82c-37.95,64.71-32.78,151.72-18,220.09,4.94,22.89,10.69,47,5.57,72.88-6.26,31.6-27.3,56.75-48.39,71.31-38.44,26.55-81.74,26.74-112.74.5-26.79-22.68-43.93-62.84-71.32-84.27-45.83-35.85-110.08-12.18-166.21,23.41-39.71,25.18-83.48,56.95-119.38,40.25-25.26-11.75-40.48-46.09-47.16-83.67-3.23-18.14-5-38-12.95-51.71-4.73-8.15-11.34-13.53-18.21-17.91-62.77-40-149.46-3.61-209.85-49.08-40.79-30.71-63.06-95.42-69.43-165s1.45-144.33,10.86-218c6.69-52.33,15.46-108.4,41.74-151.41,27.8-45.5,70.64-66.46,107.44-63s68.34,28,95.35,58.18c33.75,37.74,63.91,86.2,108.32,97.67,30.25,7.81,63.66-2.67,96.08-8.89,54.19-10.4,107.39-8.86,160.2-6.5,50.56,2.26,101.41,5.34,148.2,23.55,33.11,12.89,58.17,40.64,89,58.38,20.07,11.56,42.95,12.6,61.55,28.19,22.92,19.21,42.37,55.15,32.14,101.3C1055.08,426,1022.18,451.47,1002,485.82Z" transform="translate(-111.66 -29.85)" fill={`${primaryFill}`} opacity="0.1"/><path d="M274.41,689.83s-66.72-110.51-48-209.67c7.87-41.62,2.81-84.68-15.86-122.7a329,329,0,0,0-31.43-51.3" transform="translate(-111.66 -29.85)" fill="none" stroke="#535461" stroke-miterlimit="10" stroke-width="2"/><path d="M190.6,243.61c3.85,14.68-11.55,64.22-11.55,64.22s-37.75-35.59-41.61-50.27a27.48,27.48,0,0,1,53.16-14Z" transform="translate(-111.66 -29.85)" fill={`${primaryFill}`}/><path d="M255.88,313.39c-4.74,14.42-44.6,47.63-44.6,47.63s-12.35-50.39-7.6-64.81a27.48,27.48,0,1,1,52.2,17.18Z" transform="translate(-111.66 -29.85)" fill={`${primaryFill}`}/><path d="M290.43,452.84c-11.37,10-62.55,18.6-62.55,18.6s14.78-49.73,26.15-59.78a27.48,27.48,0,0,1,36.39,41.18Z" transform="translate(-111.66 -29.85)" fill={`${primaryFill}`}/><path d="M292.82,564.24c-9.51,11.83-58.5,28.9-58.5,28.9s6.16-51.52,15.67-63.34a27.48,27.48,0,0,1,42.83,34.44Z" transform="translate(-111.66 -29.85)" fill={`${primaryFill}`}/><path d="M156.22,378.51c13.21,7.46,65,5.18,65,5.18s-24.8-45.57-38-53a27.48,27.48,0,1,0-27,47.85Z" transform="translate(-111.66 -29.85)" fill={`${primaryFill}`}/><path d="M160.66,508.76c14.84,3.17,63.62-14.52,63.62-14.52S187,458.18,172.13,455a27.48,27.48,0,0,0-11.47,53.75Z" transform="translate(-111.66 -29.85)" fill={`${primaryFill}`}/><path d="M182.35,634.76c14.09,5.63,65.16-3.56,65.16-3.56s-30.67-41.85-44.76-47.48a27.48,27.48,0,0,0-20.39,51Z" transform="translate(-111.66 -29.85)" fill={`${primaryFill}`}/><path d="M190.6,243.61c3.85,14.68-11.55,64.22-11.55,64.22s-37.75-35.59-41.61-50.27a27.48,27.48,0,0,1,53.16-14Z" transform="translate(-111.66 -29.85)" fill={`${primaryFill}`}/><path d="M255.88,313.39c-4.74,14.42-44.6,47.63-44.6,47.63s-12.35-50.39-7.6-64.81a27.48,27.48,0,1,1,52.2,17.18Z" transform="translate(-111.66 -29.85)" fill={`${primaryFill}`}/><path d="M290.43,452.84c-11.37,10-62.55,18.6-62.55,18.6s14.78-49.73,26.15-59.78a27.48,27.48,0,0,1,36.39,41.18Z" transform="translate(-111.66 -29.85)" fill="#fc6681"/><path d="M292.82,564.24c-9.51,11.83-58.5,28.9-58.5,28.9s6.16-51.52,15.67-63.34a27.48,27.48,0,0,1,42.83,34.44Z" transform="translate(-111.66 -29.85)" fill="#fc6681"/><path d="M156.22,378.51c13.21,7.46,65,5.18,65,5.18s-24.8-45.57-38-53a27.48,27.48,0,1,0-27,47.85Z" transform="translate(-111.66 -29.85)" fill={`${primaryFill}`}/><path d="M160.66,508.76c14.84,3.17,63.62-14.52,63.62-14.52S187,458.18,172.13,455a27.48,27.48,0,0,0-11.47,53.75Z" transform="translate(-111.66 -29.85)" fill={`${primaryFill}`}/><path d="M182.35,634.76c14.09,5.63,65.16-3.56,65.16-3.56s-30.67-41.85-44.76-47.48a27.48,27.48,0,0,0-20.39,51Z" transform="translate(-111.66 -29.85)" fill={`${primaryFill}`}/><ellipse cx="496.18" cy="672.58" rx="480.5" ry="33" fill={`${primaryFill}`} opacity="0.1"/><path d="M1021.31,674.16s-.8-1.07-1.91-2.27l.32-.11s-14.28-35.69-11.1-50.76-12.69-51.55-12.69-51.55-23.41-47.94-12.33-86.2a102.72,102.72,0,0,0,2.86-13.73c3.31-22.66,2.14-27.33-3.41-35.61l-.61-.89a7,7,0,0,0,1.59-2.35C988.79,418,961.83,395,969,373.58c6.62-19.85-10.61-60.81-13.17-66.7l0,0-.29-.67-.86.28a20.92,20.92,0,0,1,5.66-13.73l.16-.16c2.38-2.19,5.27-3.8,7.5-6.15l.13-.15c.22-.21.45-.42.66-.64,2.21-2.32,3.72-5.76,2.52-8.74-1.09-2.72-4.15-4.38-4.87-7.22a37.15,37.15,0,0,1-.32-3.85c-.58-4-4.47-6.51-8-8.49-4.39-2.48-9-5-14.07-5.06-6.86,0-13,4.6-19.81,5.17-2.32.2-4.73-.08-6.93.69a15.43,15.43,0,0,0-4.55,2.92,22.38,22.38,0,0,0-2.22,2c-1.54,1.44-2.85,3.14-2.79,5.18a5.64,5.64,0,0,0,1.94,3.85,25.38,25.38,0,0,0,9.19,37.78c.08.55.16,1.11.24,1.7,1,7.51,1.59,18.13-1.08,26.45-11.39,5.87-29.14,15.44-32.32,19.69a3,3,0,0,0-.42,2.49,3.39,3.39,0,0,0-.06,1.19c-2.49.57-5.8,0-9.83-3.68-9.52-8.72-39.65-34.9-39.65-34.9s-13.48-33.31-23-27,11.1,37.28,11.1,37.28L869,381.51s1.59,10.31,18.24,4.76c5.5-1.83,10.47-3.58,14.67-5.09l1,.85c-3.75,21.94-5.69,51.18,8.14,59.76a13.38,13.38,0,0,1,2.3,4.82c-.07.26-.14.53-.2.79a76.15,76.15,0,0,0-2,13.34,42.42,42.42,0,0,0-3.51,18.94l-5.3,75.51s-.79,16.65,4.76,29.34,23,76.14,11.1,80.9l1.13.15c-3.41,3.51-9.15,8.83-13.52,9.88-6.64,1.58-4.78,11.76,9.94,13.46s16.49,1.56,26.84-7.07c9.12-7.6,10.57-11,10.78-11.73l.52.07s-5.55-20.62,0-29.34S941.21,579,941.21,579a171.47,171.47,0,0,1,.75-20.34c2.8,7.33,4.8,12.41,4.8,12.41s4.76,23,10.31,27,34.9,58.69,30.14,82.48l-.55,2.77,1.34-.39.12,0c-1.83,4.53-5.16,11.69-8.84,14.32-5.55,4,0,12.69,14.28,8.72s15.86-4.76,22.21-16.65S1021.31,674.16,1021.31,674.16Z" transform="translate(-111.66 -29.85)" fill="url(#40cb4f85-3adc-4f91-8af7-dda2654c63b5)"/><path d="M916.21,462.4l-3.48-4.29a41.48,41.48,0,0,0-4.91,21.57l-5.18,73.83s-.78,16.28,4.65,28.69,22.49,74.44,10.86,79.09L953,666s-5.43-20.16,0-28.69-12.41-60.48-12.41-60.48-1.55-43.42,13.18-53.51S916.21,462.4,916.21,462.4Z" transform="translate(-111.66 -29.85)" fill="#555388"/><path d="M922.09,658.38s-9.57,11.18-16.05,12.73-4.67,11.49,9.72,13.16,16.12,1.53,26.25-6.91,10.58-11.61,10.58-11.61-2-7.5-4.42-7.66S922.09,658.38,922.09,658.38Z" transform="translate(-111.66 -29.85)" fill="#603556"/><path d="M918.54,464.73l-5.8-6.62a41.48,41.48,0,0,0-4.91,21.57l-5.18,73.83s-.78,16.28,4.65,28.69,22.49,74.44,10.86,79.09L953,666s-5.43-20.16,0-28.69-12.41-60.48-12.41-60.48-1.55-43.42,13.18-53.51S918.54,464.73,918.54,464.73Z" transform="translate(-111.66 -29.85)" opacity="0.1"/><path d="M953.06,565.92s-9.69-190.21-49.47-257.53c0,0-29.17-53.28-53.55-68.82v-6.14c-39.78-27.54-88.73,0-88.73,0v2.72l-10.2,8.5-45.93-.16a22.13,22.13,0,0,0-17.05-8H478.55a22.12,22.12,0,0,0-16.3,7.14h-47.7s-2.81-3.27-10.2-6.56v-3.64c-39.78-27.54-88.73,0-88.73,0v7.39a13.1,13.1,0,0,0-3.06,2.81s-40.29,27-49.47,60.68c0,0-49.47,148.4-50.49,264.67s43.86,132.59,67.31,135.65,65.27-1,106.07-104l17.34-60.17s3.06-35.7,39.78-13.26,69.35-12.24,69.35-12.24H650.15S696,543.48,737.86,521c0,0,16.32-21.42,31.62,51,0,0,46.92,148.91,119.33,133.61S953.06,565.92,953.06,565.92Z" transform="translate(-111.66 -29.85)" fill="url(#f74e0c91-e046-415c-8916-3730a2c068f9)"/><path d="M320.84,248.93v-11s48-27,87,0v10Z" transform="translate(-111.66 -29.85)" fill="#535461"/><path d="M757.84,248.93v-11s48-27,87,0v10Z" transform="translate(-111.66 -29.85)" fill="#535461"/><path d="M320.84,248.93v-11s48-27,87,0v10Z" transform="translate(-111.66 -29.85)" opacity="0.1"/><path d="M757.84,248.93v-11s48-27,87,0v10Z" transform="translate(-111.66 -29.85)" opacity="0.1"/><path d="M464.84,247.93h-47s-12-14-52-13-48,13-48,13-39.5,26.5-48.5,59.5c0,0-48.5,145.5-49.5,259.5s43,130,66,133,64-1,104-102l17-59s3-35,39-13,68-12,68-12h135s45,28,86,6c0,0,16-21,31,50,0,0,46,146,117,131s63-137,63-137-9.5-186.5-48.5-252.5c0,0-37.5-68.5-62.5-71.5,0,0-54-10-75-1l-12,10Z" transform="translate(-111.66 -29.85)" fill="#535461"/><circle cx="244.18" cy="316.08" r="87" fill="#e2e2ec"/><circle cx="698.18" cy="316.08" r="87" fill="#e2e2ec"/><path d="M371,326.53,359.4,336.79a5.38,5.38,0,0,1-7.11,0l-11.62-10.26a5.37,5.37,0,0,1-1.82-4V294.3a5.38,5.38,0,0,1,5.38-5.37h23.25a5.37,5.37,0,0,1,5.38,5.38v28.2A5.37,5.37,0,0,1,371,326.53Z" transform="translate(-111.66 -29.85)" fill="#535461"/><path d="M371,365.32,359.4,355.07a5.38,5.38,0,0,0-7.11,0l-11.62,10.26a5.37,5.37,0,0,0-1.82,4v28.2a5.37,5.37,0,0,0,5.38,5.38h23.25a5.37,5.37,0,0,0,5.38-5.37v-28.2A5.37,5.37,0,0,0,371,365.32Z" transform="translate(-111.66 -29.85)" fill="#535461"/><path d="M336.45,361.11l10.26-11.62a5.38,5.38,0,0,0,0-7.11l-10.26-11.62a5.38,5.38,0,0,0-4-1.82h-28.2a5.38,5.38,0,0,0-5.37,5.38v23.25a5.37,5.37,0,0,0,5.38,5.38h28.2A5.37,5.37,0,0,0,336.45,361.11Z" transform="translate(-111.66 -29.85)" fill="#535461"/><path d="M375.24,361.11,365,349.48a5.37,5.37,0,0,1,0-7.11l10.26-11.62a5.37,5.37,0,0,1,4-1.82h28.2a5.37,5.37,0,0,1,5.38,5.38v23.25a5.37,5.37,0,0,1-5.37,5.38h-28.2A5.37,5.37,0,0,1,375.24,361.11Z" transform="translate(-111.66 -29.85)" fill="#535461"/><polygon points="229.18 252.08 259.18 252.08 244.18 239.08 229.18 252.08" fill="none" stroke="#535461" stroke-miterlimit="10" stroke-width="2"/><polygon points="229.18 380.08 259.18 380.08 244.18 393.08 229.18 380.08" fill="none" stroke="#535461" stroke-miterlimit="10" stroke-width="2"/><polygon points="180.18 301.08 180.18 331.08 167.18 316.08 180.18 301.08" fill="none" stroke="#535461" stroke-miterlimit="10" stroke-width="2"/><polygon points="308.18 301.08 308.18 331.08 321.18 316.08 308.18 301.08" fill="none" stroke="#535461" stroke-miterlimit="10" stroke-width="2"/><circle cx="362.18" cy="411.08" r="63" fill="#e2e2ec"/><circle cx="360.18" cy="401.08" r="42" fill="#535461"/><circle cx="580.18" cy="411.08" r="63" fill="#e2e2ec"/><circle cx="578.18" cy="401.08" r="42" fill="#535461"/><circle cx="360.18" cy="401.08" r="28" fill="none" stroke="#000" stroke-miterlimit="10" stroke-width="2" opacity="0.1"/><circle cx="578.18" cy="401.08" r="28" fill="none" stroke="#000" stroke-miterlimit="10" stroke-width="2" opacity="0.1"/><circle cx="473.18" cy="418.08" r="18" fill="#e2e2ec"/><circle cx="445.67" cy="358" r="3.93" fill="#e2e2ec"/><circle cx="460.39" cy="358" r="3.93" fill="#e2e2ec"/><circle cx="458.43" cy="376.65" r="3.93" fill="#e2e2ec"/><circle cx="472.18" cy="377.08" r="4" fill="#e2e2ec"/><circle cx="485.91" cy="376.65" r="3.93" fill="#e2e2ec"/><circle cx="452.54" cy="367.82" r="3.93" fill="#e2e2ec"/><circle cx="465.18" cy="368.08" r="4" fill="#e2e2ec"/><circle cx="478.18" cy="368.08" r="4" fill="#e2e2ec"/><circle cx="491.8" cy="367.82" r="3.93" fill="#e2e2ec"/><circle cx="472.18" cy="358.08" r="4" fill="#e2e2ec"/><circle cx="486.18" cy="358.08" r="4" fill="#e2e2ec"/><circle cx="497.69" cy="358" r="3.93" fill="#e2e2ec"/><rect x="315.18" y="225.08" width="22" height="38" rx="8.5" ry="8.5" fill="#e2e2ec"/><rect x="607.18" y="225.08" width="22" height="38" rx="8.5" ry="8.5" fill="#e2e2ec"/><circle cx="699.18" cy="263.08" r="24" fill="#535461"/><circle cx="648.18" cy="314.08" r="24" fill="#535461"/><circle cx="752.18" cy="311.08" r="24" fill="#535461"/><circle cx="703.18" cy="364.08" r="24" fill="#535461"/><rect x="347.18" y="211.08" width="249" height="133" rx="21.75" ry="21.75" fill="#e2e2ec"/><polygon points="684.68 273.08 698.68 249.08 713.68 273.08 684.68 273.08" fill="none" stroke="#e2e2ec" stroke-miterlimit="10" stroke-width="2"/><rect x="635.68" y="303.08" width="25" height="22" fill="none" stroke="#e2e2ec" stroke-miterlimit="10" stroke-width="2"/><circle cx="752.18" cy="311.08" r="14" fill="none" stroke="#e2e2ec" stroke-miterlimit="10" stroke-width="2"/><line x1="691.68" y1="352.83" x2="714.18" y2="375.33" fill="none" stroke="#e2e2ec" stroke-miterlimit="10" stroke-width="2"/><line x1="714.68" y1="352.83" x2="691.68" y2="374.83" fill="none" stroke="#e2e2ec" stroke-miterlimit="10" stroke-width="2"/><path d="M455.65,694.48c3-2.29,5.85-5,6.72-8.27a7,7,0,0,0-4.69-8.42c-4.31-1.34-8.91,1.09-12.41,3.55s-7.49,5.27-12.06,4.75c4.73-3.42,7-9,5.68-14a5.43,5.43,0,0,0-1.58-2.85c-2.39-2.09-6.73-1.19-9.59.45-9.11,5.23-11.65,15.32-11.7,24.41-.92-3.28-.14-6.69-.17-10.06s-1.15-7.09-4.63-8.9a16.55,16.55,0,0,0-7.06-1.35c-4.09-.12-8.66.21-11.45,2.66-3.47,3-2.57,8.13.45,11.47s7.62,5.44,11.85,7.75c3.23,1.76,6.49,3.81,8.47,6.59a6,6,0,0,1,.63,1.18h25.67A73.8,73.8,0,0,0,455.65,694.48Z" transform="translate(-111.66 -29.85)" fill={`${primaryFill}`}/><path d="M987.94,674.49s-4.65,14-10.08,17.84,0,12.41,14,8.53,15.51-4.65,21.71-16.28,5.43-14.73,5.43-14.73-4.65-6.2-7-5.43S987.94,674.49,987.94,674.49Z" transform="translate(-111.66 -29.85)" fill="#603556"/><path d="M959.25,326.31s-62.81,34.89-48.08,24.81c9.9-6.77,9.3-24.74,7.84-35.81-.46-3.45-1-6.23-1.33-7.79-.19-.88-.31-1.37-.31-1.37s30.46-18.28,28.75-7.29h0c0,.1,0,.2-.05.3a11.85,11.85,0,0,0-.23,2.23C945.63,312.69,959.25,326.31,959.25,326.31Z" transform="translate(-111.66 -29.85)" fill="#c87486"/><path d="M891,360.43s-5.43,8.53-14.73,0-38.77-34.12-38.77-34.12S824.32,293.74,815,299.95s10.86,36.45,10.86,36.45l44.2,47.3s1.55,10.08,17.84,4.65,27.92-10.08,27.92-10.08Z" transform="translate(-111.66 -29.85)" fill="#c87486"/><path d="M915.83,439.53" transform="translate(-111.66 -29.85)" fill="none"/><path d="M1017.41,667.51l-31,10.86-1.31.38.54-2.71c4.65-23.26-24-76.77-29.47-80.65S946.07,569,946.07,569s-10.16-51.18-11.71-62c-.39-2.71-1.81-4.87-3.53-7.85a62.12,62.12,0,0,1-6-14.36c-3.41-12-11.36-33.3-8.44-45.35.59-2.45-1.82,3.81-1,1.42l.47-1.32L978.64,431a46.9,46.9,0,0,1,2.92,3.95C986.31,442,986,442,987,455.4a138.26,138.26,0,0,1-3.41,24c-8.45,37.63,10.61,88,10.61,88s15.51,35.67,12.41,50.4S1017.41,667.51,1017.41,667.51Z" transform="translate(-111.66 -29.85)" fill="#555388"/><path d="M981.56,434.94c-9.29,11.65-68.8,20.7-68.06,17a7.86,7.86,0,0,0-.28-3.82,75.69,75.69,0,0,1,2.14-7.27l.47-1.32L978.64,431A46.9,46.9,0,0,1,981.56,434.94Z" transform="translate(-111.66 -29.85)" opacity="0.1"/><path d="M954.6,310S929,317.78,922,335.62s5.31,18.81,5.31,18.81-22,58-16.17,88.2c0,0,3.1,3.88,2.33,7.75s64.36-6.2,69-18.61-21.71-34.89-14.73-55.83S954.6,310,954.6,310Z" transform="translate(-111.66 -29.85)" fill="#dfe5ee"/><path d="M946.07,300.72a2.45,2.45,0,0,1-.23.67c-1.06,2-4.43-.19-3.26,2.81-4.5,4.52-5.92,13.57-12.79,13.57A24.66,24.66,0,0,1,919,315.32c-.46-3.45-1-6.23-1.33-7.79,3-1.78,27-15.68,28.44-8.66h0A4.61,4.61,0,0,1,946.07,300.72Z" transform="translate(-111.66 -29.85)" opacity="0.1"/><circle cx="818.12" cy="261.57" r="24.81" fill="#c87486"/><path d="M954.6,370.51l-43.42,20.16S881.71,368.19,886.36,362s41.1-24,41.1-24S964.68,345.7,954.6,370.51Z" transform="translate(-111.66 -29.85)" opacity="0.1"/><path d="M954.6,369l-43.42,20.16s-29.47-22.49-24.81-28.69,41.1-24,41.1-24S964.68,344.15,954.6,369Z" transform="translate(-111.66 -29.85)" fill="#dfe5ee"/><path d="M922.62,280.79c-3.79-.38-7.71-.8-11-2.71-1.91-1.1-3.66-2.92-3.72-5.13-.07-2.6,2.12-4.63,4.13-6.28a15.08,15.08,0,0,1,4.45-2.85c2.15-.75,4.5-.48,6.77-.67,6.68-.56,12.66-5.1,19.37-5.06,4.93,0,9.46,2.52,13.75,4.95,3.43,1.94,7.24,4.4,7.81,8.3a36.31,36.31,0,0,0,.31,3.76c.71,2.78,3.7,4.4,4.77,7.06,1.17,2.91-.31,6.28-2.47,8.55s-5,3.83-7.27,5.95A20.38,20.38,0,0,0,953,312a2,2,0,0,1-.17,1.11,1.94,1.94,0,0,1-1.4.7c-2.47.46-5.52.71-7-1.33s-.31-5.44-2-7.45c-2.15-2.59-6.67-.53-9.58-2.23a5.82,5.82,0,0,1-2.2-2.63C928.25,295,931,290.94,932,286,933.17,280.23,926.69,281.2,922.62,280.79Z" transform="translate(-111.66 -29.85)" opacity="0.1"/><path d="M923.4,280c-3.79-.38-7.71-.8-11-2.71-1.91-1.1-3.66-2.92-3.72-5.13-.07-2.6,2.12-4.63,4.13-6.28a15.08,15.08,0,0,1,4.45-2.85c2.15-.75,4.5-.48,6.77-.67,6.68-.56,12.66-5.1,19.37-5.06,4.93,0,9.46,2.52,13.75,4.95,3.43,1.94,7.24,4.4,7.81,8.3a36.31,36.31,0,0,0,.31,3.76c.71,2.78,3.7,4.4,4.77,7.06,1.17,2.91-.31,6.28-2.47,8.55s-5,3.83-7.27,5.95a20.38,20.38,0,0,0-6.53,15.38,2,2,0,0,1-.17,1.11,1.94,1.94,0,0,1-1.4.7c-2.47.46-5.52.71-7-1.33s-.31-5.44-2-7.45c-2.15-2.59-6.67-.53-9.58-2.23a5.82,5.82,0,0,1-2.2-2.63c-2.42-5.18.34-9.27,1.34-14.26C933.94,279.45,927.46,280.43,923.4,280Z" transform="translate(-111.66 -29.85)" fill="#603456"/></svg> ) }
1,285.076923
16,349
0.660421
acbcde3d538dae451edada3684e3f43be8dd77d0
4,151
js
JavaScript
docs/android/search/variables_11.js
krishnaprasad/alexa-auto-sdk
2fb8d28a9c4138111f9b19c2527478562acc4643
[ "Apache-2.0" ]
122
2019-06-26T17:55:52.000Z
2022-03-25T04:32:28.000Z
docs/android/search/variables_11.js
krishnaprasad/alexa-auto-sdk
2fb8d28a9c4138111f9b19c2527478562acc4643
[ "Apache-2.0" ]
13
2020-12-17T00:32:05.000Z
2022-03-30T10:45:21.000Z
docs/android/search/variables_11.js
krishnaprasad/alexa-auto-sdk
2fb8d28a9c4138111f9b19c2527478562acc4643
[ "Apache-2.0" ]
98
2019-06-28T08:34:20.000Z
2022-03-07T23:14:22.000Z
var searchData= [ ['unauthorized',['UNAUTHORIZED',['../enumcom_1_1amazon_1_1aace_1_1authorization_1_1_authorization_1_1_authorization_state.html#aaee87f5bbcea329c6fec281886880da4',1,'com::amazon::aace::authorization::Authorization::AuthorizationState']]], ['unauthorized_5fclient',['UNAUTHORIZED_CLIENT',['../enumcom_1_1amazon_1_1aace_1_1alexa_1_1_alexa_client_1_1_auth_error.html#af804dbfb32638e3c082d90efa3912a9b',1,'com.amazon.aace.alexa.AlexaClient.AuthError.UNAUTHORIZED_CLIENT()'],['../enumcom_1_1amazon_1_1aace_1_1alexa_1_1_auth_provider_1_1_auth_error.html#a0604dc08653947306fe2eade1c497ef9',1,'com.amazon.aace.alexa.AuthProvider.AuthError.UNAUTHORIZED_CLIENT()']]], ['unfavorite',['UNFAVORITE',['../enumcom_1_1amazon_1_1aace_1_1alexa_1_1_external_media_adapter_1_1_play_control_type.html#a972a844ee00be9757f59e70af72f5d09',1,'com.amazon.aace.alexa.ExternalMediaAdapter.PlayControlType.UNFAVORITE()'],['../enumcom_1_1amazon_1_1aace_1_1alexa_1_1_local_media_source_1_1_play_control_type.html#a3ce434c3847d05357b242a35381db4bd',1,'com.amazon.aace.alexa.LocalMediaSource.PlayControlType.UNFAVORITE()']]], ['unfavorited',['UNFAVORITED',['../enumcom_1_1amazon_1_1aace_1_1alexa_1_1_external_media_adapter_1_1_favorites.html#a6eb5e1fa3c230f445c3ae1147bd67acd',1,'com.amazon.aace.alexa.ExternalMediaAdapter.Favorites.UNFAVORITED()'],['../enumcom_1_1amazon_1_1aace_1_1alexa_1_1_local_media_source_1_1_favorites.html#a07d0bc918d3898558be4025b12068c8a',1,'com.amazon.aace.alexa.LocalMediaSource.Favorites.UNFAVORITED()']]], ['uninitialized',['UNINITIALIZED',['../enumcom_1_1amazon_1_1aace_1_1alexa_1_1_alexa_client_1_1_auth_state.html#a6a54b74d1219d6022a21d1493f607a6b',1,'com.amazon.aace.alexa.AlexaClient.AuthState.UNINITIALIZED()'],['../enumcom_1_1amazon_1_1aace_1_1alexa_1_1_auth_provider_1_1_auth_state.html#a9e8a6803b57d45467f047d3f412ceb27',1,'com.amazon.aace.alexa.AuthProvider.AuthState.UNINITIALIZED()']]], ['unknown',['UNKNOWN',['../enumcom_1_1amazon_1_1aace_1_1alexa_1_1_notifications_1_1_indicator_state.html#a440225fb9b82619cf3336073764c4e80',1,'com.amazon.aace.alexa.Notifications.IndicatorState.UNKNOWN()'],['../enumcom_1_1amazon_1_1aace_1_1apl_1_1_a_p_l_1_1_activity_event.html#affbb173f103e2dc6c9399dd6a3674902',1,'com.amazon.aace.apl.APL.ActivityEvent.UNKNOWN()'],['../enumcom_1_1amazon_1_1aace_1_1network_1_1_network_info_provider_1_1_network_status.html#a6b44a8379299aa098271ca9a9b21ca9e',1,'com.amazon.aace.network.NetworkInfoProvider.NetworkStatus.UNKNOWN()']]], ['unknown_5ferror',['UNKNOWN_ERROR',['../enumcom_1_1amazon_1_1aace_1_1alexa_1_1_alexa_client_1_1_auth_error.html#a110946e49f9624a3823d1457f5efe57b',1,'com.amazon.aace.alexa.AlexaClient.AuthError.UNKNOWN_ERROR()'],['../enumcom_1_1amazon_1_1aace_1_1alexa_1_1_auth_provider_1_1_auth_error.html#ab82213352bde9993de5bda26fbcf1486',1,'com.amazon.aace.alexa.AuthProvider.AuthError.UNKNOWN_ERROR()']]], ['unrecoverable_5ferror',['UNRECOVERABLE_ERROR',['../enumcom_1_1amazon_1_1aace_1_1alexa_1_1_alexa_client_1_1_auth_state.html#a9395e797fd39967a690db2217114b43a',1,'com.amazon.aace.alexa.AlexaClient.AuthState.UNRECOVERABLE_ERROR()'],['../enumcom_1_1amazon_1_1aace_1_1alexa_1_1_alexa_client_1_1_connection_changed_reason.html#a24c07684a8aa086e8cab5c34e84ba245',1,'com.amazon.aace.alexa.AlexaClient.ConnectionChangedReason.UNRECOVERABLE_ERROR()'],['../enumcom_1_1amazon_1_1aace_1_1alexa_1_1_auth_provider_1_1_auth_state.html#a13dec4634da247a0a897f5e2da2ab7c1',1,'com.amazon.aace.alexa.AuthProvider.AuthState.UNRECOVERABLE_ERROR()']]], ['unsupported_5fgrant_5ftype',['UNSUPPORTED_GRANT_TYPE',['../enumcom_1_1amazon_1_1aace_1_1alexa_1_1_alexa_client_1_1_auth_error.html#ae7f34009c855ab19054576a5cf8e5fb7',1,'com.amazon.aace.alexa.AlexaClient.AuthError.UNSUPPORTED_GRANT_TYPE()'],['../enumcom_1_1amazon_1_1aace_1_1alexa_1_1_auth_provider_1_1_auth_error.html#a791e3bdd8b3ef18b34dd57d39871fa1b',1,'com.amazon.aace.alexa.AuthProvider.AuthError.UNSUPPORTED_GRANT_TYPE()']]], ['usb',['USB',['../enumcom_1_1amazon_1_1aace_1_1alexa_1_1_local_media_source_1_1_source.html#a9eeb1241157772d62b8666ca203b59f8',1,'com::amazon::aace::alexa::LocalMediaSource::Source']]] ];
296.5
632
0.860034
acbcf1eb1af8314f50a89b185be4b8496a963a60
4,628
js
JavaScript
cloudfare-assignment-one/index.js
samkitsheth95/cloudflare-2020-general-engineering-assignment
7fee1022c077a019b2d6a45bc4e5b1433038be6d
[ "MIT" ]
null
null
null
cloudfare-assignment-one/index.js
samkitsheth95/cloudflare-2020-general-engineering-assignment
7fee1022c077a019b2d6a45bc4e5b1433038be6d
[ "MIT" ]
null
null
null
cloudfare-assignment-one/index.js
samkitsheth95/cloudflare-2020-general-engineering-assignment
7fee1022c077a019b2d6a45bc4e5b1433038be6d
[ "MIT" ]
null
null
null
const Router = require("./router"); const data = [ { name: "Google", url: "https://www.google.com" }, { name: "Facebook", url: "https://www.facebook.com" }, { name: "Cloudflare", url: "https://www.cloudflare.com" }, ]; const social = `<a href='https://www.twitter.com'><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Twitter icon</title><path d="M23.954 4.569c-.885.389-1.83.654-2.825.775 1.014-.611 1.794-1.574 2.163-2.723-.951.555-2.005.959-3.127 1.184-.896-.959-2.173-1.559-3.591-1.559-2.717 0-4.92 2.203-4.92 4.917 0 .39.045.765.127 1.124C7.691 8.094 4.066 6.13 1.64 3.161c-.427.722-.666 1.561-.666 2.475 0 1.71.87 3.213 2.188 4.096-.807-.026-1.566-.248-2.228-.616v.061c0 2.385 1.693 4.374 3.946 4.827-.413.111-.849.171-1.296.171-.314 0-.615-.03-.916-.086.631 1.953 2.445 3.377 4.604 3.417-1.68 1.319-3.809 2.105-6.102 2.105-.39 0-.779-.023-1.17-.067 2.189 1.394 4.768 2.209 7.557 2.209 9.054 0 13.999-7.496 13.999-13.986 0-.209 0-.42-.015-.63.961-.689 1.8-1.56 2.46-2.548l-.047-.02z"/></svg></a> <a href='https://www.facebook.com'><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>Facebook icon</title><path d="M23.9981 11.9991C23.9981 5.37216 18.626 0 11.9991 0C5.37216 0 0 5.37216 0 11.9991C0 17.9882 4.38789 22.9522 10.1242 23.8524V15.4676H7.07758V11.9991H10.1242V9.35553C10.1242 6.34826 11.9156 4.68714 14.6564 4.68714C15.9692 4.68714 17.3424 4.92149 17.3424 4.92149V7.87439H15.8294C14.3388 7.87439 13.8739 8.79933 13.8739 9.74824V11.9991H17.2018L16.6698 15.4676H13.8739V23.8524C19.6103 22.9522 23.9981 17.9882 23.9981 11.9991Z"/></svg></a> <a href='https://www.linkedin.com'><svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><title>LinkedIn icon</title><path d="M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z"/></svg></a>`; const url = "https://static-links-page.signalnerve.workers.dev"; addEventListener("fetch", (event) => { event.respondWith(handleRequest(event.request)); }); function getLinksHandler(request) { const init = { headers: { "content-type": "application/json" }, }; return new Response(JSON.stringify(data), init); } class ElementHandler { element(element) { if (element.tagName === "div" && element.getAttribute("id") === "links") { let dataToAtag = ""; for (let link of data) { dataToAtag += `<a href='${link.url}'>${link.name}</a>`; } element.setInnerContent(dataToAtag, { html: true }); } else if ( element.tagName === "div" && element.getAttribute("id") === "profile" ) { element.removeAttribute("style"); } else if ( element.tagName === "div" && element.getAttribute("id") === "social" ) { element.removeAttribute("style"); element.setInnerContent(social, { html: true }); } else if ( element.tagName === "img" && element.getAttribute("id") === "avatar" ) { element.setAttribute( "src", "https://www.jennstrends.com/wp-content/uploads/2013/10/bad-profile-pic-2-768x768.jpeg" ); } else if ( element.tagName === "h1" && element.getAttribute("id") === "name" ) { element.setInnerContent("Samkit Sheth"); } else if (element.tagName === "title") { element.setInnerContent("Samkit Sheth"); } else if (element.tagName === "body") { element.setAttribute("class", "bg-blue-500"); } } } async function getHtmlHandler(request) { const init = { headers: { "content-type": "text/html;charset=UTF-8" }, }; const response = await fetch(url, init); const ch = new HTMLRewriter() .on("div", new ElementHandler()) .on("img", new ElementHandler()) .on("h1", new ElementHandler()) .on("title", new ElementHandler()) .on("body", new ElementHandler()) .transform(response); const temp = await ch.text(); console.log(temp); return new Response(temp, init); } async function handleRequest(request) { const r = new Router(); r.get(".*/links", (request) => getLinksHandler(request)); r.get("/", (request) => getHtmlHandler(request)); const resp = await r.route(request); return resp; }
53.195402
811
0.639585
acbd0eac60cf98e82524bb3a2104f2905080afa5
71,010
js
JavaScript
tobserver.js
TobiasNickel/tObservableJS
75ea2a1e3186c913863a8adbbfaceca63b649b6e
[ "MIT" ]
null
null
null
tobserver.js
TobiasNickel/tObservableJS
75ea2a1e3186c913863a8adbbfaceca63b649b6e
[ "MIT" ]
8
2017-03-19T07:49:21.000Z
2017-03-19T07:56:03.000Z
tobserver.js
TobiasNickel/tObservableJS
75ea2a1e3186c913863a8adbbfaceca63b649b6e
[ "MIT" ]
null
null
null
/** * @fileOverview * @author Tobias Nickel * @version 0.11 */ /** * Object, that contains methods, that can not run in StrictMode */ var tObserverNoStricts = (function () { //view types var vt_hOption = 8, //"htmloption", vt_hList = 1, //"htmllist", vt_iHtml = 2, //"innerhtml", vt_v = 3, //"value", vt_disabled = 4, vt_data = 5, //"disables"; vt_src = 6, vt_class = 7; //for shorter htmlArrStrings so they don't need to be handed over as a string var styleKeys = (function () { var out = { option: vt_hOption, OPTION: vt_hOption, Option: vt_hOption, htmlOption: vt_hOption, htmlOPTION: vt_hOption, htmloption: vt_hOption, list: vt_hList, List: vt_hList, LIST: vt_hList, htmlList: vt_hList, htmllist: vt_hList, htmlLIST: vt_hList, html: vt_iHtml, Html: vt_iHtml, HTML: vt_iHtml, innerHTML: vt_iHtml, innerhtml: vt_iHtml, innerHtml: vt_iHtml, value: vt_v, Value: vt_v, VALUE: vt_v, disabled: vt_disabled, DISABLED: vt_disabled, Disabled: vt_disabled, src: vt_src, SRC: vt_src, data: vt_data }; var style = document.createElement('div').style; for (var i in style) { out[i] = i; out[i.toUpperCase()] = i; out[i.toLowerCase()] = i; } return out; })(); /** * gets and interpreted the attr attribute from the element, caches the value and returns the value. * @parem element the dom node */ function getAttr_sloppy(element) { if (element.attr) return element.attr; var attr = element.getAttribute === undefined ? null : element.getAttribute("tObserver"); if (attr === null) return null; with(styleKeys) { try { attr = eval("({" + attr + "})"); // default case without breaces } catch (e) { try { attr = eval("(" + attr + ")"); // optional breaces } catch (e) { attr = { path: attr }; // hand over a string, containing a path } } } if (typeof attr === "string") attr = { path: attr }; if (!attr.path) attr.path = [""]; if (!Array.isArray(attr.path)) attr.path = [attr.path]; for (var i in attr.path) { //when there is a point at the end, remove it. attr.path[i] = attr.path[i][attr.path[i].length - 1] == '.' ? attr.path[i].slice(0, attr.path[i].length - 1) : attr.path[i]; } attr.type = (!attr.type) ? "innerhtml" : attr.type; if (!Array.isArray(attr.type)) attr.type = [attr.type]; for (var i in attr.type) { if (attr.type[i].toLocaleLowerCase && attr.type[i].toLocaleLowerCase() === "htmloption") attr.type[i] = vt_hOption; if (attr.type[i].toLocaleLowerCase && attr.type[i].toLocaleLowerCase() === "htmllist") attr.type[i] = vt_hList; if (attr.type[i].toLocaleLowerCase && attr.type[i].toLocaleLowerCase() === "innerhtml") attr.type[i] = vt_iHtml; if (attr.type[i].toLocaleLowerCase && attr.type[i].toLocaleLowerCase() === "value") attr.type[i] = vt_v; if (attr.type[i].toLocaleLowerCase && attr.type[i].toLocaleLowerCase() === "disables") attr.type[i] = vt_disabled; if (attr.type[i].toLocaleLowerCase && attr.type[i].toLocaleLowerCase() === "data") attr.type[i] = vt_data; } if (!Array.isArray(attr.filter)) attr.filter = [attr.filter]; element.attr = attr; return attr; } return { getAttr: getAttr_sloppy }; })(); // the only global Tobservable caring about the window object var tobserver = (function (window, document, undefined) { "use strict"; /** * @class * Tobservable Class that handle the data * @param {mixed} pData the data to observe * @param {tobservable} pObserverTree the root observertree (used internally) * @param {String} pPath the path of the data that is the current observer is careing about */ function Tobservable(pData, pObserverTree, pPath) { if (!pObserverTree) pObserverTree = new this.ObserverTree(); if (!pPath) pPath = ''; this.data = pData; // the ProgrammData this.observer = pObserverTree; this.path = pPath; } //Helper Begin // the helper are private methods, used within the framework. /** * @param {String} path * data Path as known * @param {type} name * the name to add * @returns {String} */ function addNameToPath(path, name) { if (!name) return path; return path === "" ? name : path + '.' + name; } //two short helper var returnFirst = function (e) { return e; }, emptyFunction = function () {}, callSecoundF = function (e, f) { f(e); }, escapeHTML = (function () { var chr = { '"': '&quot;', '&': '&amp;', "'": '&#39;', '/': '&#47;', '<': '&lt;', '>': '&gt;' }; return function (text) { if (typeof text !== "string") return text; return text.replace(/[\"&'\/<>]/g, function (a) { return chr[a]; }); }; }()), //remove all "" strings removeEmptyStrings = function removeEmptyStrings(array) { while (array.indexOf('') !== -1) array.splice(array.indexOf(''), 1); return array; }; var tobserver; /** * creates an ObjectUpdateView and binds it to the path. * @private * @param {String} path * @param {Object} updateObject */ function updateUpdateObjectComplete(path, updateObject) { var data = tobserver.getData(path); for (var i in data) if (updateObject[i] !== undefined && data) updateObject[i](path, data); } /** * merges a array of names to a path * @private * @param {Array} array * an array containing strings with the names * @returns {String} */ function mergeToPath(array) { var out = ''; for (var ii = 0; ii < array.length; ii++) out += (out === '' ? '' : '.') + array[ii]; return out; } //Helper END /** * will return a tObservable, that observes the given path * * @param {type} pathParts * identifies the path, that you want to have * @returns {tobservable} */ Tobservable.prototype.get = function (pathParts) { if (!(pathParts instanceof Array)) pathParts = (pathParts + '').split('.'); if (pathParts.length === 0) return this; else { var name = pathParts[0]; if (name === "") return this; if (pathParts.length === 1) { return new Tobservable( this.data === undefined ? undefined : this.data[name], this.observer, addNameToPath(this.path, name) ); } else { pathParts.splice(0, 1); return new Tobservable(this.data[name], this.observer, addNameToPath(this.path, name)).get(pathParts); } } }; /** * shortcut for if tobserver.get(somePath).data * if works much faster !! * @param {type} pPath * identifies the path, that you want to have * @returns {tobservable} */ Tobservable.prototype.getData = function (pathParts) { if (!(pathParts instanceof Array)) pathParts = (pathParts + '').split('.'); pathParts = removeEmptyStrings(pathParts); var data = this.data; for (var i in pathParts) { if (data[pathParts[i]] !== undefined && data[pathParts[i]] !== null) { data = data[pathParts[i]]; } else return undefined; } return data; }; /** * used to set a value or execute a method on the data, * it will notify the observer * @param {String} pPath * identifing the data to update * @param {Mixed} value * the new value of the described data * @param {Boolean} run * * @returns {void} */ Tobservable.prototype.innerSet = function (pathParts, value, run) { if (!(pathParts instanceof Array)) pathParts = (pathParts + '').split('.'); var name = pathParts; if (pathParts.length === 0) return null; if (pathParts.length === 1) { if (run) { return this.data[name].apply(this.data, value); } else { if (this.data[name] !== value) { this.data[name] = value; } return this; } } else { name = pathParts.pop(); return this.get(pathParts).innerSet(name, value, run); } }; /** * used to set a value or execute a method on the data, * it will notify the observer * @param {String} pPath * identifing the data to update * @param {Mixed} value * the new value of the described data * @param {Boolean} run * bool, run sais the path describes a method to execute, not value to set. * @param {Boolean} online * an option, to avoid sending the command to the server. * @param {Onject} socket * an object, that has an emit(name, string), method, that will send the command to the server * * @returns {void} */ Tobservable.prototype.set = function (pPath, value, run, online, socket) { if (!run) run = false; if (online === undefined) online = true; var data = tobserver.getData(pPath); if (!run && data === value) return; this.notify(pPath, value, run, online, socket); return this.innerSet(pPath, value, run); }; /** * will apply a function described with the path, * @param {String} pPath * describs the Data-Path * @param {Array} value * the Parameterlist for the given function * @returns {void} */ Tobservable.prototype.exec = Tobservable.prototype.run = function (pPath, value) { this.set(pPath, value, true); }; /** * used to register a opserver on the described path * (it is not calling the update merthod.) * @param {Observer} tObserver * a function * or an object like: {name:"someName",update:function(){}} * @param {type} pPath * describes the path wherer the observer should be registered */ Tobservable.prototype.on = function (pPath, tObserver) { if (!tObserver) return; tObserver = typeof tObserver == 'function' ? { update: tObserver } : tObserver; this.observer.addListener(tObserver, pPath); }; /** * remove the described observer * @param {type} path * tha data-path to the observer, where the last part is the name * @param {view} tObserver * the tObserver to remove. can be a simple method or a view-object */ Tobservable.prototype.off = function (path, tObserver) { this.observer.removeListener(path, tObserver); }; /** * used to tell all observer on the given path to update there view * if fact it is adding commands to the notifiee.path. * @param {String} pPath * identifing the data to update * @param {Mixed} value * the new value of the described data * @param {Boolean} run * bool, run sais the path describes a method to execute, not value to set. * @param {Boolean} online * an option, to avoid sending the command to the server. * @param {Onject} socket * an object, that has an emit(name, string), method, that will send the command to the server * * @returns {void} */ Tobservable.prototype.notify = function (path, data, run, online, socket, round) { if (path === undefined) path = ""; if (round === undefined) round = new Date().getTime() + "" + Math.random(); path = addNameToPath(this.path, path); var index = this.notifyee.commands.indexOfIn(path, "path"); if (run || (data !== tobserver.getData(path)) && (index === -1 || !this.notifyee.commands[index].run)) { this.notifyee.commands.push({ path: path, data: data, run: run, online: tobserver.notifyee.onlineMode ? online : false, socket: socket }); clearTimeout(tobserver.notifyee.timeout); tobserver.notifyee.timeout = setTimeout(function () { tobserver.notifyee.notify(round); }, tobserver.notifyee.speed); } }; Array.prototype.indexOfIn = function (needle, propName) { for (var i in this) { if (this[i][propName] === needle) return i; } return -1; }; Object.defineProperty(Array.prototype, "indexOfIn", { enumerable: false }); /** * used by .notify to cache the update-Paths * @param {type} path * @returns {undefined} */ Tobservable.prototype.notifyee = { /** * THE notify method, that is starting the update on the ObserverTree * round will be used, if avoide infinit loops. */ notify: function (round) { var commands = this.commands; this.commands = []; this.onlineMode = this.onlineLiveMode; for (var i in commands) { tobserver.observer.runUpdate(commands[i].path, round); if (this.socket && commands[i].online && !this.isLocal(commands[i].path)) { //console.log("sharePath: ",commands[i].path,JSON.stringify(commands[i].data)); if (!commands[i].socket) { this.socket.emit("tOmand", JSON.stringify({ path: commands[i].path, data: commands[i].data, run: commands[i].run })); } else { commands[i].socket.broadcast.emit('tOmand', JSON.stringify({ path: commands[i].path, data: commands[i].data, run: commands[i].run })); } } } this.onlineMode = true; }, /** * if onlineMode is false, the actions are not send live to the server. * this is used internally, to avoid sending changes to the server, * that are triggert by the views */ onlineMode: true, /** * livemode, during an update-Round, the onlineMode is by default set to false. * and reactivated afterwards. if the live mode is true, * the changes made in the views are also send to the server. * but this is not nessasary, if all clients use the same data-Views. */ onlineLiveMode: false, /** * list of notify-orders * {path:path,data:data,run:bool,online:bool,socket:Socket(.io)} */ commands: [], // /** * path that whould not be */ locals: [], /** * Method, that checks, if the update-order need to be send to the server. */ isLocal: function (path) { var locals = this.locals; for (var i in locals) { if (path.indexOf(locals[i]) === 0) return true; } return false; }, /** * the socket is a socket.io, socket or namespace * or an jQuery, socket from the utils. */ socket: undefined, /** * id of the timeout, for the next notification. * if there are new updates, the cur timeout will be cleared and a new set. */ timeout: 0, /** * async rendering, 0 millisecond are enought, you might with that to be a bit slower */ speed: 1 }; /** * @class * @private * Only used by the Tobservable to manage the observer * @param {tobserbable} pObserver * @param {String} pNextPath * @returns {tobservable.observerTree} */ Tobservable.prototype.ObserverTree = (function () { function ObserverTree(pObserver, pNextPath) { this.$listener = []; //run initialisation of observertree if (!pNextPath) pNextPath = ''; if (pObserver !== undefined) if (pNextPath === '') this.$listener.push(pObserver); else this.addListener(pObserver, pNextPath); } /** * creates a Propertyname, that will hopefilly never match a name, * used by the application developed using tobservable * so, currently the problem will be, when the developer uses propertynames like * _t__t_name and _t_name what is quite improbable */ function toProertyname(name) { return '_t_' + name; } /** * Only used by the Tobservable to manage the observer * @param {tobserbable} pObserver * @param {String} pNextPath * @returns {tobservable.observerTree} */ ObserverTree.prototype.addListener = function (pListener, pathParts) { if (!(pathParts instanceof Array)) pathParts = (pathParts + '').split('.'); pathParts = removeEmptyStrings(pathParts); if (pathParts.length > 0) { var prop = toProertyname(pathParts[0]); pathParts.shift(); if (this[prop] === undefined) this[prop] = new ObserverTree(pListener, mergeToPath(pathParts)); else this[prop].addListener(pListener, pathParts); } else this.$listener.push(pListener); }; /** * one of the magic functions. it is executing the updatefuntion of all * relevant listeners. so, all listener that are registered along the path, * and all Listeners under the Path. * @param {string} pPath * @param {int} round, used, not to repeat updating the same observer. (optional) * @returns {undefined} */ ObserverTree.prototype.runUpdate = function runUpdate(pPath, round) { if (!round) round = new Date().getTime() + "" + Math.random(); if (!pPath) pPath = ''; var pathParts = removeEmptyStrings(pPath.split('.')); //update the listener on the current node for (var ii in this.$listener) if (this.$listener[ii].tNotificationRoundNumber != round) { this.$listener[ii].tNotificationRoundNumber = round; this.$listener[ii].update(round, pathParts); } //go through the path if (pathParts.length > 0) { var propName = toProertyname(pathParts[0]); if (this[propName] !== undefined) { pathParts.splice(0, 1); this[propName].runUpdate(mergeToPath(pathParts), round); } } else for (var index in this) if (index.indexOf('_t_') === 0) this[index].runUpdate("", round); }; /** * is removing the described Listener * @param {type} pPath * the path to the lsitener, where the last part is the name * @returns {void} */ ObserverTree.prototype.removeListener = function removeListener(pPath, tObserver) { if (!pPath) pPath = ''; var pathParts = pPath.split('.'); pathParts = removeEmptyStrings(pathParts); var PropName = toProertyname(pathParts[0]); if (pathParts.length > 1 || (tObserver && pathParts.length > 0)) { pathParts.shift(); if (this[PropName] !== undefined) this[PropName].removeListener(mergeToPath(pathParts), tObserver); } else if (pathParts.length === 1 && this[pathParts[0]] !== undefined) { for (var i in this.$listener) if (typeof this.$listener[i].name === 'string' && this.$listener[i].name === PropName) this.$listener.splice(i, 1); } else if (tObserver) for (var ii = 0; ii < this.$listener.length; ii++) if (this.$listener[ii] === tObserver || this.$listener[ii].update === tObserver) this.$listener.splice(ii, 1); }; return ObserverTree; })(); /** * the stdView, that is used for document-nodes * @class * @param {dom-node} e * @param {tobservable} tobserver * @returns {tobservable.StdElementView} */ Tobservable.prototype.StdElementView = function () { //view types var vt_hOption = 8, //"htmloption", vt_hList = 1, //"htmllist", vt_iHtml = 2, //"innerhtml", vt_v = 3, //"value", vt_disabled = 4, vt_data = 5, //"disables"; vt_src = 6, vt_class = 7; var getAttr = tObserverNoStricts.getAttr; /** * Contstructor for a StdElementView * it can be a simple view, or a htmlList-View. */ function StdElementView(element, tobserver) { var attr = getAttr(element); if (attr === null) return; if (element._tName !== undefined) return; attr.outer = attr.outer !== undefined ? attr.outer : "div"; attr.path = attr.path === '' ? 'window' : attr.path; this.element = element; attr.defaultValue = []; attr.preview = []; for (var i in attr.type) { if (attr.type[i] === vt_hList || attr.type[i] === vt_hOption || attr.type[i] === vt_hOption) { attr.defaultValue[i] = element.innerHTML; attr.preview[i] = this.element.innerHTML; this.element.innerHTML = ""; } else { attr.defaultValue[i] = element.getAttribute(attr.type); } if (attr.type[i] === vt_v) { this.folowElement(element); } } attr.beforeAdd = attr.beforeAdd !== undefined ? attr.beforeAdd : tobserver.utils.stdViewBehavior.beforeAdd; attr.afterAdd = attr.afterAdd !== undefined ? attr.afterAdd : tobserver.utils.stdViewBehavior.afterAdd; attr.beforeRemove = attr.beforeRemove !== undefined ? attr.beforeRemove : tobserver.utils.stdViewBehavior.beforeRemove; attr.afterRemove = attr.afterRemove !== undefined ? attr.afterRemove : tobserver.utils.stdViewBehavior.afterRemove; attr.beforeUpdate = attr.beforeUpdate !== undefined ? attr.beforeUpdate : tobserver.utils.stdViewBehavior.beforeUpdate; attr.afterUpdate = attr.afterUpdate !== undefined ? attr.afterUpdate : tobserver.utils.stdViewBehavior.afterUpdate; var name = "tObserverName" + Math.random() * 10000000000000000; this.name = name; this.element._tName = name; this.element._tObserver = this; this.element.attr = attr; this.attr = attr; for (i in attr.path) tobserver.on(attr.path[i], this); this.update(); } StdElementView.prototype.templates = {}; /** * the standard updatemethod, called by the tObserver */ StdElementView.prototype.update = function () { var type; var filter = returnFirst; var maxLen = this.attr.path.length; if (maxLen < this.attr.type.length) maxLen = this.attr.type.length; for (var i = 0; i < maxLen; i++) { var path = this.attr.path[i] === undefined ? path : this.attr.path[i]; type = !this.attr.type[i] ? type : this.attr.type[i]; filter = (type === vt_v || type === vt_data || type == "src") ? returnFirst : escapeHTML; var val = tobserver.getData(path); val = typeof val === "number" ? val + "" : val; var orgData = val; filter = this.attr.filter[i] ? this.attr.filter[i] : filter; val = filter(val); val = val !== undefined ? val : this.attr.defaultValue[i]; type = this.attr.type[i] === undefined ? type : this.attr.type[i]; switch (type) { case vt_iHtml: case undefined: if (!val) val = this.attr.defaultValue[i]; this.attr.beforeUpdate(this.element, function (element) { if (element.innerHTML != val) { element.innerHTML = val; element.attr.afterUpdate(element); } element.attr.afterUpdate(element); }); break; case vt_data: this.element.data = val; break; case vt_hList: this.updateList(val, orgData); break; case vt_hOption: this.updateOption(val, orgData); break; case vt_v: this.attr.beforeUpdate(this.element, function (element) { if (element.value == val) return; element.value = val; element.attr.afterUpdate(element); }); break; default: this.attr.beforeUpdate(this.element, function (element) { if (type == vt_disabled) { element.disabled = val; } else if (!(element.style[type] === undefined) || type == vt_src || type == vt_class) { if (element.getAttribute(type) == val) return; if (val === false) element.removeAttribute(type, val); else element.setAttribute(type, val); } else { if (element.style[type] == val) return; element.style[type] = val; } element.attr.afterUpdate(element); }); } } }; StdElementView.prototype.updateOption = function (data, orgData) { if (data === false) { this.element.innerHTML = ""; this.element.display = "none"; } else { this.element.display = ""; if (this.element.innerHTML === "") { var newElement = document.createElement("div"); newElement.innerHTML = this.attr.preview; this.findAndUpdatePath(newElement, this.attr.path); while (newElement.children[0] !== undefined) { this.attr.beforeAdd(newElement.children[0], orgData); this.element.appendChild(newElement.children[0]); this.attr.afterAdd(newElement.children[0], orgData); } } } }; /** * the speaciel bevavior of the htmlList-Views */ StdElementView.prototype.updateList = function (data, orgData) { if (this.displayedOrdData != orgData) this.element.innerHTML = ""; var i = 0; this.displayedOrdData = orgData; var kids = this.element.children; var displayedData = []; var displayedElements = []; //remove deleted Elements and saving the position on the kids for (i = 0; i < kids.length; i++) { var newPosition = data.indexOf(kids[i].item); if (newPosition == -1) { kids[i].innerHTML = kids[i].innerHTML.replace("tobserver", "removedtObserver").trim(); this.attr.beforeRemove(kids[i], function (e) { if (e) { e.remove(); i--; } }); } else { this.attr.beforeUpdate(kids[i], emptyFunction); displayedData.push(kids[i].item); if (kids[i].className == "tobserverlistitem") { if (newPosition != kids[i].position) { this.updateRootPath(kids[i], this.attr.path + "." + newPosition, this.attr.path + "." + kids[i].position); } kids[i].position = newPosition; displayedElements.push(kids[i]); } } } var focussedElement = document.activeElement; displayedElements.sort(function (a, b) { return a.position - b.position; }); for (i = 0; i < displayedElements.length; i++) { this.element.appendChild(displayedElements[i]); } focussedElement.focus(); //appendNewElements var listIndex = 0; if (!orgData) return; for (i = 0; i < data.length; i++) { if (displayedElements[listIndex] !== undefined && data[i] == displayedElements[listIndex].item) listIndex++; else { if (displayedData.indexOf(data[i]) == -1) { //create new insertBefore var orgIndex = orgData.indexOf(data[i]); var kid = document.createElement(this.attr.outer); kid.setAttribute("class", "tobserverlistitem"); kid.innerHTML = this.attr.preview; this.findAndUpdatePath(kid, this.attr.path + "." + orgIndex); kid.position = i; kid.item = data[i]; if (displayedElements[listIndex] !== undefined) displayedElements[listIndex].parentNode.insertBefore(kid, displayedElements[listIndex]); else this.element.appendChild(kid); tobserver.StdElementView.findTObserver(kid); this.attr.beforeAdd(kid, data[i]); this.attr.afterAdd(kid, data[i]); } } } kids = this.element.children; }; /** * if the Path for the a List-Item has changed, this function will update the childs */ StdElementView.prototype.findAndUpdatePath = function (element, root) { var attr = getAttr(element); var kids = element.children; if (attr === null) for (var s in kids) this.findAndUpdatePath(kids[s], root); else this.setRoot(element, root); }; /** * set the rootPath, for a new created List-View-Element */ StdElementView.prototype.setRoot = function setRoot(element, root) { var attr = getAttr(element); if (!attr.path) attr.path = [""]; for (var i in attr.path) { if (attr.path[i].indexOf(root) == -1) attr.path[i] = root + "." + attr.path[i]; } }; /** * similar to findAndUpdatePath, but findAndUpdatePath, * only can be used for the initialisation of the object. */ StdElementView.prototype.updateRootPath = function (element, newRootPath, oldRootPath) { if (!element) return; if (!newRootPath) return; if (!oldRootPath) return; var kids = element.children; for (var i in kids) { if (kids[i].attr) { for (var ii in kids[i].attr.path) { var realOrgPath = kids[i].attr.path[ii].replace(oldRootPath + '.', ''); if (kids[i].attr.type[ii] == vt_hList) { this.updateRootPath(kids[i], realOrgPath + "." + realOrgPath, oldRootPath + "." + realOrgPath); } tobserver.off(kids[i].attr.path[ii] + "." + kids[i]._tName); tobserver.on(newRootPath + '.' + realOrgPath, kids[i]._tObserver); kids[i].attr.path[ii] = newRootPath + '.' + realOrgPath; } } else { this.updateRootPath(kids[i], newRootPath, oldRootPath); } } }; StdElementView.prototype.folowElement = function (element) { var change = function () { var attr = element.attr; for (var i in attr.path) { if (attr.type[i] === vt_v) { var value = element.value; var type = element.getAttribute("type"); if (type !== null && type.toLocaleLowerCase().trim() === "number") value = parseFloat(value); if (type !== null && type.toLocaleLowerCase().trim() === "checkbox") value = element.checked; tobserver.set(attr.path[i], value); } } }; element.addEventListener("change", change); element.addEventListener("keyup", change); }; /** * get all HTML objects with the given klass, and makes a view with them. * if also register observer ther on the DOM to create StdViews for the elements that are new Created */ StdElementView.initDomViews = function () { var html = document.getElementsByTagName("html")[0]; // liveupdate in the dom tobserver.utils.bindEvent(html, 'DOMNodeInserted', function (ev) { var element = ev.srcElement ? ev.srcElement : ev.target; StdElementView.findTObserver(element); }); //document.addEventListener('DOMNodeInserted',); tobserver.utils.bindEvent(html, 'DOMNodeRemoved', function (ev) { var element = ev.srcElement ? ev.srcElement : ev.target; if (element !== undefined && element.getAttribute !== undefined) setTimeout(function () { var attr = getAttr(element); if (attr !== undefined && element._tName !== undefined) { var tPath = attr.path; tPath = tPath !== undefined ? tPath : ""; tobserver.off(tPath + "." + element._tName); } }, 1000); }); this.findTObserver(); }; /** * searches for tobserver on the HTML. * tObserver are html-elements that have an tobserver-Attribute, * with a structure described on the docu. * * @param {htmlNode} element * the Element where to analyse all childs. * if undefined the html-node is taken. */ StdElementView.findTObserver = function (element) { if (element === undefined) { element = document.getElementsByTagName("html")[0]; } var attr = getAttr(element); var kids = element.children; if (attr === null) for (var s in kids) StdElementView.findTObserver(kids[s]); else { //if(element.tagName.toUpperCase()==="TEMPLATE" && element.getAttribute("name") != null){ // tobserver.StdElementView.templates[element.getAttribute("name")]=element.innerHTML; // element.style.display="none"; //} else { element.attr = attr; new tobserver.StdElementView(element, tobserver); //} } }; return StdElementView; }(); Tobservable.prototype.utils = { stdViewBehavior: function () { return { beforeAdd: emptyFunction, afterAdd: emptyFunction, beforeRemove: callSecoundF, afterRemove: emptyFunction, beforeUpdate: callSecoundF, afterUpdate: emptyFunction }; }(), //LINK VIEW BEGIN /** * linkes two paths * is used, when on both paths should be stored the same object. * it is not updating the data (because this is happend automaticly) * but it makes sure, that the observer on both sites are activated. * @param {String} sourcePath * @param {String} destPath */ linkViews: function (sourcePath, destPath) { tobserver.on(sourcePath, new this.LinkView(destPath)); tobserver.on(destPath, new this.LinkView(sourcePath)); }, /** * linkes two paths, where one the secound path is an array, * that contains the object under the first path. * * is used, when on both paths should be stored the same object. * it is not updating the data (because this is happend automaticly) * but it makes sure, that the observer on both sites are activated. * @param {String} elementPath * @param {String} destPath */ linkToArrayViews: function (elementPath, arrayPath) { tobserver.on(elementPath, new this.LinkToArrayView(elementPath, arrayPath)); tobserver.on(arrayPath, new this.LinkFromArrayView(elementPath, arrayPath)); }, /** * constructor for LinkView * it updates the path of destPath. * and can be registered on multiple other paths * @param {String} destPath */ LinkView: function LinkView(destPath) { this.update = function updateLinkView(round) { var data = tobserver.getData(destPath); tobserver.notify(destPath, data, false, true, undefined, round); //(path, data, run, online, socket, round) }; }, /** * constructor for LinkToArrayView * same as linkView, but it points on an Array. that contains the element of elementPath. * @param {String} elementPath * @param {String} arrayPath */ LinkToArrayView: function LinkToArrayView(elementPath, arrayPath) { this.update = function updateLinkToArrayView(round) { var sourceData = tobserver.getData(elementPath); var array = tobserver.getData(arrayPath); var arrayElementPath = arrayPath + "." + array.indexOf(sourceData); tobserver.notify(arrayElementPath, "someCrapthatWIllneverBeAValue5142f7d9aj8496547c6fc6gca37f215cf", false, true, undefined, round); }; }, /** * constructor for LinkFromArrayView * the link from an array to an object, the method only notifies the elementPath-Views, * if the depending element has changed, not if anything changed(smart) * @param {String} elementPath * @param {String} arrayPath */ LinkFromArrayView: function LinkFromArrayView(elementPath, arrayPath) { this.update = function updateLinkView(round, pathParts) { var sourceData = tobserver.getData(elementPath); var array = tobserver.getData(arrayPath); var index = array.indexOf(sourceData); if (pathParts[0] !== undefined && index == pathParts[0]) { if (array[pathParts[0]] !== sourceData) { tobserver.notify(elementPath, "someCrapthatWIllneverBeAValue5142f7d9ja8496547g6fc65ca37f215cf", false, true, undefined, round); } } }; }, //LINK VIEW END //UPDATE VIEW BEGIN /** * constructor for ArrayUpdateView * uses an update-Object, as view, for each element in the array. * @param {String} arrayPath * @param {Object} updateObject */ ArrayUpdateView: function (arrayPath, updateObject) { this.update = function (round, nextPathparts) { if (nextPathparts[0] !== undefined && nextPathparts[1] !== undefined) { var index = nextPathparts.splice(0, 1); var paramName = nextPathparts.splice(0, 1); var newSetValue = tobserver.getData(arrayPath + "." + index); if (newSetValue && updateObject[paramName]) updateObject[paramName](arrayPath + "." + index, newSetValue, nextPathparts); } else { var array = tobserver.getData(arrayPath); for (var i = 0; i < array.length; i++) updateUpdateObjectComplete(arrayPath + "." + i, updateObject); } }; }, /** * creates an ArrayUpdateView and binds it to the path. * @param {String} path * @param {Object} updateObject */ registerArrayUpdateView: function (path, updateObject) { tobserver.on(path, new tobserver.utils.ArrayUpdateView(path, updateObject)); var array = tobserver.getData(path); for (var i = 0; i < array.length; i++) updateUpdateObjectComplete(path + "." + i, updateObject); }, /** * constructor for ObjectUpdateView * uses an update-Object, as view, for the object under the path. * @param {String} objectPath * @param {Object} updateObject */ ObjectUpdateView: function (objectPath, updateObject) { this.update = function (round, nextPathparts) { if (nextPathparts[0] !== undefined) { var paramName = nextPathparts.splice(0, 1); var newSetValue = tobserver.getData(objectPath); if (newSetValue) updateObject[paramName](objectPath, newSetValue, nextPathparts); } else updateUpdateObjectComplete(objectPath, updateObject); }; }, /** * creates an ObjectUpdateView and binds it to the path. * @param {String} path * @param {Object} computeProperty */ registerObjectUpdateView: function (path, updateObject) { tobserver.on(path, new tobserver.utils.ObjectUpdateView(path, updateObject)); updateUpdateObjectComplete(path, updateObject); }, //UPDATE VIEW END /** * the history modul from backbone, changed, that it just updates an URL property on via tobserver. * requires jQuery * @param {String} elementPath * @param {String} arrayPath */ history: function () { //NESSASARY PARTS OF UNDERSCORE var _ = {}; var Ctor = function () {}; var breaker = {}; var slice = Array.prototype.slice, hasOwnProperty = Object.prototype.hasOwnProperty; // All **ECMAScript 5** native function implementations that we hope to use // are declared here. var nativeSome = Array.prototype.some, nativeForEach = Array.prototype.forEach, nativeBind = Function.prototype.bind; // Create a function bound to a given object (assigning `this`, and arguments, // optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if // available. _.bind = function (func, context) { var args, bound; if (nativeBind && func.bind === nativeBind) return nativeBind.apply(func, slice.call(arguments, 1)); if (!_.isFunction(func)) throw new TypeError(); args = slice.call(arguments, 2); return function () { if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments))); Ctor.prototype = func.prototype; var self = new Ctor(); Ctor.prototype = null; var result = func.apply(self, args.concat(slice.call(arguments))); if (Object(result) === result) return result; return self; }; }; // Bind a number of an object's methods to that object. Remaining arguments // are the method names to be bound. Useful for ensuring that all callbacks // defined on an object belong to it. _.bindAll = function (obj) { var funcs = slice.call(arguments, 1); if (funcs.length === 0) throw new Error('bindAll must be passed function names'); each(funcs, function (f) { obj[f] = _.bind(obj[f], obj); }); return obj; }; // The cornerstone, an `each` implementation, aka `forEach`. // Handles objects with the built-in `forEach`, arrays, and raw objects. // Delegates to **ECMAScript 5**'s native `forEach` if available. var each = _.each = _.forEach = function (obj, iterator, context) { if (obj === null) return obj; var i, length; if (nativeForEach && obj.forEach === nativeForEach) { obj.forEach(iterator, context); } else if (obj.length === +obj.length) { for (i = 0, length = obj.length; i < length; i++) { if (iterator.call(context, obj[i], i, obj) === breaker) return; } } else { var keys = _.keys(obj); for (i = 0, length = keys.length; i < length; i++) { if (iterator.call(context, obj[keys[i]], keys[i], obj) === breaker) return; } } return obj; }; // Keep the identity function around for default iterators. _.identity = function (value) { return value; }; // Determine if at least one element in the object matches a truth test. // Delegates to **ECMAScript 5**'s native `some` if available. // Aliased as `any`. _.some = _.any = function (obj, predicate, context) { //predicate || (predicate = _.identity); var result = false; if (obj === null) return result; if (nativeSome && obj.some === nativeSome) return obj.some(predicate, context); each(obj, function (value, index, list) { if (result || (result = predicate.call(context, value, index, list))) return breaker; }); return !!result; }; //UNDERSCORE ENDE // Backbone.History // ---------------- // Handles cross-browser history management, based on either // [pushState](http://diveintohtml5.info/history.html) and real URLs, or // [onhashchange](https://developer.mozilla.org/en-US/docs/DOM/window.onhashchange) // and URL fragments. If the browser supports neither (old IE, natch), // falls back to polling. var History = function () { //this.handlers = []; _.bindAll(this, 'checkUrl'); // Ensure that `History` can be used outside of the browser. if (window !== undefined) { this.location = window.location; this.history = window.history; } }; // Cached regex for stripping a leading hash/slash and trailing space. var routeStripper = /^[#\/]|\s+$/g; // Cached regex for stripping leading and trailing slashes. var rootStripper = /^\/+|\/+$/g; // Cached regex for detecting MSIE. var isExplorer = /msie [\w.]+/; // Cached regex for removing a trailing slash. var trailingSlash = /\/$/; // Cached regex for stripping urls of hash. var pathStripper = /#.*$/; // Has the history handling already been started? History.started = false; // Set up all inheritable **Backbone.History** properties and methods. //History.prototype // The default interval to poll for hash changes, if necessary, is // twenty times a second. History.prototype.interval = 50; // Are we at the app root? History.prototype.atRoot = function () { return this.location.pathname.replace(/[^\/]$/, '$&/') === this.root; }; // Gets the true hash value. Cannot use location.hash directly due to bug // in Firefox where location.hash will always be decoded. History.prototype.getHash = function (window) { var match = (window || this).location.href.match(/#(.*)$/); return match ? match[1] : ''; }; // Get the cross-browser normalized URL fragment, either from the URL, // the hash, or the override. History.prototype.getFragment = function (fragment, forcePushState) { if (fragment === null) { if (this._hasPushState || !this._wantsHashChange || forcePushState) { fragment = decodeURI(this.location.pathname + this.location.search); var root = this.root.replace(trailingSlash, ''); if (!fragment.indexOf(root)) fragment = fragment.slice(root.length); } else { fragment = this.getHash(); } } return fragment.replace(routeStripper, ''); }; // Start the hash change handling, returning `true` if the current URL matches // an existing route, and `false` otherwise. History.prototype.start = function (options) { if (History.started) throw new Error("history has already been started"); History.started = true; // Figure out the initial configuration. Do we need an iframe? // Is pushState desired ... is it available? this.options = options === undefined ? {} : options; this.options.root = "/"; this.path = this.options.path === undefined ? "url" : this.options.path; // _.extend({root: '/'}, this.options, options); this.root = this.options.root; this._wantsHashChange = this.options.hashChange !== false; this._wantsPushState = !!this.options.pushState; this._hasPushState = !!(this.options.pushState && this.history && this.history.pushState); var fragment = this.getFragment(); var docMode = document.documentMode; var oldIE = (isExplorer.exec(navigator.userAgent.toLowerCase()) && (!docMode || docMode <= 7)); // Normalize root to always include a leading and trailing slash. this.root = ('/' + this.root + '/').replace(rootStripper, '/'); if (oldIE && this._wantsHashChange) { var frame = $('<iframe src="javascript:0" tabindex="-1">'); this.iframe = frame.hide().appendTo('body')[0].contentWindow; this.navigate(fragment); } // Depending on whether we're using pushState or hashes, and whether // 'onhashchange' is supported, determine how we check the URL state. if (this._hasPushState) { $(window).on('popstate', this.checkUrl); } else if (this._wantsHashChange && ('onhashchange' in window) && !oldIE) { $(window).on('hashchange', this.checkUrl); } else if (this._wantsHashChange) { this._checkUrlInterval = setInterval(this.checkUrl, this.interval); } // Determine if we need to change the base url, for a pushState link // opened by a non-pushState browser. this.fragment = fragment; var loc = this.location; // Transition from hashChange to pushState or vice versa if both are // requested. if (this._wantsHashChange && this._wantsPushState) { // If we've started off with a route from a `pushState`-enabled // browser, but we're currently in a browser that doesn't support it... if (!this._hasPushState && !this.atRoot()) { this.fragment = this.getFragment(null, true); this.location.replace(this.root + '#' + this.fragment); // Return immediately as browser will do redirect to new url return true; // Or if we've started out with a hash-based route, but we're currently // in a browser where it could be `pushState`-based instead... } else if (this._hasPushState && this.atRoot() && loc.hash) { this.fragment = this.getHash().replace(routeStripper, ''); this.history.replaceState({}, document.title, this.root + this.fragment); } } // my extension to the startMethod to update the Links, // and let them not navigate, // but update the the history $(document).on("click", "a[href^='/']", function (event) { var href = $(event.currentTarget).attr('href'); //# chain 'or's for other black list routes var passThrough = href.indexOf('sign_out') >= 0; //# Allow shift+click for new tabs, etc. if (!passThrough && !event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey) { event.preventDefault(); //# Remove leading slashes and hash bangs (backward compatablility) var url = href.replace(/^\//, '').replace('#!\/', ''); //# Instruct Backbone to trigger routing events tobserver.utils.history.navigate(url, { trigger: true }); return false; } }); tobserver.on(this.path, function () { var url = tobserver.getData(tobserver.utils.history.path); tobserver.utils.router.route(url); }); if (!this.options.silent) return this.loadUrl(); }; // Disable Backbone.history, perhaps temporarily. Not useful in a real app, // but possibly useful for unit testing Routers. History.prototype.stop = function () { $(window).off('popstate', this.checkUrl).off('hashchange', this.checkUrl); if (this._checkUrlInterval) clearInterval(this._checkUrlInterval); History.started = false; }; // Add a route to be tested when the fragment changes. Routes added later // may override previous routes. History.prototype.route = function (route, callback) { this.handlers.unshift({ route: route, callback: callback }); }; // Checks the current URL to see if it has changed, and if it has, // calls `loadUrl`, normalizing across the hidden iframe. History.prototype.checkUrl = function () { var current = this.getFragment(); if (current === this.fragment && this.iframe) { current = this.getFragment(this.getHash(this.iframe)); } if (current === this.fragment) return false; this.navigate(current); if (this.iframe) this.navigate(current); this.loadUrl(); }; // Attempt to load the current URL fragment. If a route succeeds with a // match, returns `true`. If no defined routes matches the fragment, // returns `false`. History.prototype.loadUrl = function (fragment) { fragment = this.fragment = this.getFragment(fragment); tobserver.set(this.path, fragment); }; // Save a fragment into the hash history, or replace the URL state if the // 'replace' option is passed. You are responsible for properly URL-encoding // the fragment in advance. // // The options object can contain `trigger: true` if you wish to have the // route callback be fired (not usually desirable), or `replace: true`, if // you wish to modify the current URL without adding an entry to the history. History.prototype.navigate = function (fragment, options) { if (!History.started) return false; if (!options || options === true) options = { trigger: !!options }; var url = this.root + (fragment = this.getFragment(fragment || '')); // Strip the hash for matching. fragment = fragment.replace(pathStripper, ''); if (this.fragment === fragment) return; this.fragment = fragment; // Don't include a trailing slash on the root. if (fragment === '' && url !== '/') url = url.slice(0, -1); // If pushState is available, we use it to set the fragment as a real URL. if (this._hasPushState) { this.history[options.replace ? 'replaceState' : 'pushState']({}, document.title, url); // If hash changes haven't been explicitly disabled, update the hash // fragment to store history. } else if (this._wantsHashChange) { this._updateHash(this.location, fragment, options.replace); if (this.iframe && (fragment !== this.getFragment(this.getHash(this.iframe)))) { // Opening and closing the iframe tricks IE7 and earlier to push a // history entry on hash-tag change. When replace is true, we don't // want this. if (!options.replace) this.iframe.document.open().close(); this._updateHash(this.iframe.location, fragment, options.replace); } // If you've told us that you explicitly don't want fallback hashchange- // based history, then `navigate` becomes a page refresh. } else return this.location.assign(url); if (options.trigger) return this.loadUrl(fragment); }; // Update the hash location, either replacing the current entry, or adding // a new one to the browser history. History.prototype._updateHash = function (location, fragment, replace) { if (replace) { var href = location.href.replace(/(javascript:|#).*$/, ''); location.replace(href + '#' + fragment); } else { // Some browsers require that `hash` contains a leading #. location.hash = '#' + fragment; } }; // Create the default Backbone.history. return new History(); }(), /** * the router modul from Grapnel, but a lot simplefied, and observing the same URL Property as the historyModul. * @param {String} elementPath * @param {String} arrayPath */ router: (function (root) { function Grapnel() { this.events = []; // Event Listeners this.params = []; // Named parameters } Grapnel.prototype.version = '0.4.2'; // Version /** * Fire an event listener * * @param {String} event * @param {Mixed} [attributes] Parameters that will be applied to event listener * @return self */ Grapnel.prototype.route = function (url) { var params = Array.prototype.slice.call(arguments, 1); // Call matching events this.events.forEach(function (fn) { fn.apply(this, params); }); return this; }; /** * Create a RegExp Route from a string * This is the heart of the router and I've made it as small as possible! * * @param {String} Path of route * @param {Array} Array of keys to fill * @param {Bool} Case sensitive comparison * @param {Bool} Strict mode */ Grapnel.regexRoute = function (path, keys, sensitive, strict) { if (path instanceof RegExp) return path; if (path instanceof Array) path = '(' + path.join('|') + ')'; // Build route RegExp path = path.concat(strict ? '' : '/?') .replace(/\/\(/g, '(?:/') .replace(/\+/g, '__plus__') .replace(/(\/)?(\.)?:(\w+)(?:(\(.*?\)))?(\?)?/g, function (_, slash, format, key, capture, optional) { keys.push({ name: key, optional: !!optional }); slash = slash || ''; return '' + (optional ? '' : slash) + '(?:' + (optional ? slash : '') + (format || '') + (capture || (format && '([^/.]+?)' || '([^/]+?)')) + ')' + (optional || ''); }) .replace(/([\/.])/g, '\\$1') .replace(/__plus__/g, '(.+)') .replace(/\*/g, '(.*)'); return new RegExp('^' + path + '$', sensitive ? '' : 'i'); }; /** * Add an action and handler * * @param {String|RegExp} action name * @param {Function} callback * @return self */ Grapnel.prototype.on = Grapnel.prototype.add = Grapnel.prototype.get = function (route, handler) { var that = this, keys = [], regex = Grapnel.regexRoute(route, keys); var invoke = function (url) { // If action is instance of RegEx, match the action var match = window.url.match(regex); // Test matches against current action if (match) { // Match found var event = { route: route, value: url, handler: handler, params: that.params, regex: match, propagateEvent: true, preventDefault: function () { this.propagateEvent = false; } }; // Callback var req = { params: {}, keys: keys, matches: event.regex.slice(1) }; // Build parameters req.matches.forEach(function (value, i) { var key = (keys[i] && keys[i].name) ? keys[i].name : i; // Parameter key will be its key or the iteration index. This is useful if a wildcard (*) is matched req.params[key] = (value) ? decodeURIComponent(value) : undefined; }); // Call handler handler.call(that, req, event); } // Returns that return that; }; // Invoke and add listeners -- this uses less code this.events.push(invoke); return this; }; return new Grapnel(); }).call({}, window), bindEvent: function bindEvent(el, eventName, eventHandler) { if (el.addEventListener) el.addEventListener(eventName, eventHandler, false); else if (el.attachEvent) el.attachEvent('on' + eventName, eventHandler); }, /** * set a socket, an jQuerySocket or SocketIO-Socket or SocketIO-Namespace. * the socket will be used to tell the server all the changes that are made on the data. */ setSocket: function (socket) { tobserver.notifyee.socket = socket; socket.on('tOmand', function (msg) { try { var msgO = JSON.parse(msg); if (!tobserver.notifyee.isLocal(msgO.path)) tobserver.set( msgO.path, msgO.data, msgO.run, false ); } catch (e) {} }); }, /** * An JQuerySocket - class, that can be used as a socket. * requires jQuery do send all changes on the data to the server, * for example an php-server. on node it is recommented to use socket.io * */ jQuerySocket: function JQuerySocket(file) { this.emit = function emit(name, data) { $.post(file, { name: name, data: data }); }; } }; var tobserver = new Tobservable(window); return tobserver; })(typeof window === "object" ? window : {}, typeof document === "object" ? document : {}); // Window or AMD-module if (typeof module === 'object') { module.exports = tobserver; } else if (window instanceof Window) { tobserver.utils.bindEvent(window, 'load', function () { var style = document.createElement("style"); style.innerHTML = ".tobserverlistitem{margin:0px; padding:0px;}"; document.getElementsByTagName("head")[0].appendChild(style); tobserver.StdElementView.initDomViews(); }); } if (typeof define === "function") { define("tobservable", function () { return tobserver; }); }
44.215442
190
0.492776
acbdc85e2db7d410afa58067a23e4b998caf6dea
1,776
js
JavaScript
lib/stores/activedirectory/data_types/user_account_control.js
firede/openrecord
a56abbfe203b5634a73627af6b03f47369962b68
[ "MIT" ]
486
2015-01-14T16:07:22.000Z
2022-03-15T20:13:42.000Z
lib/stores/activedirectory/data_types/user_account_control.js
firede/openrecord
a56abbfe203b5634a73627af6b03f47369962b68
[ "MIT" ]
90
2015-04-04T09:44:58.000Z
2021-03-08T12:44:18.000Z
lib/stores/activedirectory/data_types/user_account_control.js
firede/openrecord
a56abbfe203b5634a73627af6b03f47369962b68
[ "MIT" ]
50
2015-03-05T10:40:11.000Z
2022-01-31T21:09:28.000Z
var UserAccountControlBitmask = { SCRIPT: 1, ACCOUNTDISABLED: 2, HOMEDIR_REQUIRED: 8, LOCKOUT: 16, PASSWD_NOTREQUIRED: 32, PASSWD_CANT_CHANGE: 64, ENCRYPTED_TEXT_PWD_ALLOWED: 128, TEMP_DUPLICATE_ACCOUNT: 256, NORMAL_ACCOUNT: 512, INTERDOMAIN_TRUST_ACCOUNT: 2048, WORKSTATION_TRUST_ACCOUNT: 4096, SERVER_TRUST_ACCOUNT: 8192, DONT_EXPIRE_PASSWORD: 65536, MNS_LOGON_ACCOUNT: 131072, SMARTCARD_REQUIRED: 262144, TRUSTED_FOR_DELEGATION: 524288, NOT_DELEGATED: 1048576, USE_DES_KEY_ONLY: 2097152, DONT_REQ_PREAUTH: 4194304, PASSWORD_EXPIRED: 8388608, TRUSTED_TO_AUTH_FOR_DELEGATION: 16777216, PARTIAL_SECRETS_ACCOUNT: 67108864 } /* istanbul ignore next: unable to test via travis-ci */ exports.store = { mixinCallback: function() { this.addType( 'user_account_control', { read: function(value) { if (typeof value === 'string') value = parseInt(value, 10) var obj = {} for (var attrName in UserAccountControlBitmask) { obj[attrName] = (value & UserAccountControlBitmask[attrName]) === UserAccountControlBitmask[attrName] } return obj }, write: function(value) { if (typeof value === 'number') return value if (!value) value = {} var bitmask = 0 for (var attrName in UserAccountControlBitmask) { if (value[attrName] === true) bitmask += UserAccountControlBitmask[attrName] } return bitmask } }, { binary: true, defaults: { track_object_changes: true }, operators: { default: 'eq', defaults: ['eq', 'not'] } } ) } }
25.371429
68
0.61036
acbdd4b5b649654f6a53d11bb32aa5289427cdfd
958
js
JavaScript
packages/zeebe-element-templates-json-schema/test/fixtures/number-value.js
bpmn-io/element-templates-json-schema
5579ae200a7b00b8f73dcaaa9a36d3f8f027af10
[ "MIT" ]
null
null
null
packages/zeebe-element-templates-json-schema/test/fixtures/number-value.js
bpmn-io/element-templates-json-schema
5579ae200a7b00b8f73dcaaa9a36d3f8f027af10
[ "MIT" ]
11
2020-09-27T18:51:11.000Z
2020-11-05T13:43:43.000Z
packages/zeebe-element-templates-json-schema/test/fixtures/number-value.js
bpmn-io/element-templates-json-schema
5579ae200a7b00b8f73dcaaa9a36d3f8f027af10
[ "MIT" ]
null
null
null
export const template = { 'name': 'NumberAsValue', 'id': 'com.camunda.example.NumberAsValue', 'appliesTo': [ 'bpmn:Task' ], 'properties': [ { 'label': 'Are you awesome?', 'type': 'String', 'value': 50, 'binding': { 'type': 'property', 'name': 'name' } } ] }; export const errors = [ { keyword: 'type', dataPath: '/properties/0/value', schemaPath: '#/definitions/properties/allOf/0/items/properties/value/type', params: { type: [ 'string', 'boolean' ] }, message: 'should be string,boolean' }, { dataPath: '', keyword: 'type', message: 'should be array', params: { type: 'array', }, schemaPath: '#/oneOf/1/type', }, { dataPath: '', keyword: 'oneOf', message: 'should match exactly one schema in oneOf', params: { passingSchemas: null }, schemaPath: '#/oneOf' } ];
18.423077
79
0.516701
acbdf0109174ef8329eab188e984ead59dc8612b
499
js
JavaScript
src/securedRoutes/SecuredRoutes.js
malzak/voteApp-reactjs
d55879ddda78fba0294fcae8f7bb17593c4ad1c4
[ "MIT" ]
null
null
null
src/securedRoutes/SecuredRoutes.js
malzak/voteApp-reactjs
d55879ddda78fba0294fcae8f7bb17593c4ad1c4
[ "MIT" ]
null
null
null
src/securedRoutes/SecuredRoutes.js
malzak/voteApp-reactjs
d55879ddda78fba0294fcae8f7bb17593c4ad1c4
[ "MIT" ]
null
null
null
import React from "react"; import { Redirect, Route } from "react-router-dom"; import UserService from "../services/user.services"; const SecuredRoutes = (props) => { return ( <div> <Route path={props.path} render={(data) => UserService.isAuthenticated() ? ( <props.component {...data} /> ) : ( <Redirect to={{ pathname: "/sign-in" }} /> ) } ></Route> </div> ); }; export default SecuredRoutes;
21.695652
54
0.521042
acbe86744caa00d00b3f3750b8a13957671e5125
786
js
JavaScript
scheduler/post-task-run-order.any.js
meyerweb/wpt
f04261533819893c71289614c03434c06856c13e
[ "BSD-3-Clause" ]
14,668
2015-01-01T01:57:10.000Z
2022-03-31T23:33:32.000Z
scheduler/post-task-run-order.any.js
meyerweb/wpt
f04261533819893c71289614c03434c06856c13e
[ "BSD-3-Clause" ]
7,642
2018-05-28T09:38:03.000Z
2022-03-31T20:55:48.000Z
scheduler/post-task-run-order.any.js
meyerweb/wpt
f04261533819893c71289614c03434c06856c13e
[ "BSD-3-Clause" ]
5,941
2015-01-02T11:32:21.000Z
2022-03-31T16:35:46.000Z
// META: title=Scheduler: Tasks Run in Priority Order // META: global=window,worker promise_test(async t => { const runOrder = []; const schedule = (id, priority) => scheduler.postTask(() => { runOrder.push(id); }, {priority}); // Post tasks in reverse priority order and expect they are run from highest // to lowest priority. const tasks = []; tasks.push(schedule('B1', 'background')); tasks.push(schedule('B2', 'background')); tasks.push(schedule('UV1', 'user-visible')); tasks.push(schedule('UV2', 'user-visible')); tasks.push(schedule('UB1', 'user-blocking')); tasks.push(schedule('UB2', 'user-blocking')); await Promise.all(tasks); assert_equals(runOrder.toString(),'UB1,UB2,UV1,UV2,B1,B2'); }, 'Test scheduler.postTask task run in priority order');
35.727273
98
0.680662
acc0066e326db7d6d12eb891c6dc9d12d1c2a2e1
1,459
js
JavaScript
src/engine/__tests__/matchers/segment/browser.spec.js
dirkonly/javascript-client
785e2b2b1b6f3453b49c8bdeb995b2f5c5d29322
[ "Apache-2.0" ]
39
2017-01-23T06:02:34.000Z
2022-03-15T21:46:33.000Z
src/engine/__tests__/matchers/segment/browser.spec.js
dirkonly/javascript-client
785e2b2b1b6f3453b49c8bdeb995b2f5c5d29322
[ "Apache-2.0" ]
249
2017-04-21T22:13:13.000Z
2022-03-29T17:14:59.000Z
src/engine/__tests__/matchers/segment/browser.spec.js
dirkonly/javascript-client
785e2b2b1b6f3453b49c8bdeb995b2f5c5d29322
[ "Apache-2.0" ]
32
2017-05-03T20:45:25.000Z
2022-03-24T16:17:16.000Z
/** Copyright 2016 Split Software 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. **/ import tape from 'tape-catch'; import { matcherTypes} from '../../../matchers/types'; import matcherFactory from '../../../matchers'; tape('MATCHER SEGMENT / should return true ONLY when the segment is defined inside the segment storage', async function (assert) { const segment = 'employees'; const matcherTrue = matcherFactory({ type: matcherTypes.IN_SEGMENT, value: segment }, { segments: { isInSegment(segmentName) { return segment === segmentName; } } }); const matcherFalse = matcherFactory({ type: matcherTypes.IN_SEGMENT, value: segment + 'asd' }, { segments: { isInSegment(segmentName) { return segment === segmentName; } } }); assert.true(await matcherTrue(), 'segment found in mySegments list'); assert.false(await matcherFalse(), 'segment not found in mySegments list'); assert.end(); });
30.395833
130
0.703221
acc01ce0cff7bb6aa3f4f7c403e0609068acf847
208
js
JavaScript
src/whereclause/WhereClauseTypes.js
Mya-Mya/spreadsheets-query
f5de74cd450bd3936ac665472173d85816f2c83b
[ "Apache-2.0" ]
null
null
null
src/whereclause/WhereClauseTypes.js
Mya-Mya/spreadsheets-query
f5de74cd450bd3936ac665472173d85816f2c83b
[ "Apache-2.0" ]
null
null
null
src/whereclause/WhereClauseTypes.js
Mya-Mya/spreadsheets-query
f5de74cd450bd3936ac665472173d85816f2c83b
[ "Apache-2.0" ]
null
null
null
/** * @typedef {String} WhereClauseType */ /** * @readonly * @enum {WhereClauseType} */ const WhereClauseTypes = { AND: "And", OR: "Or", COMPARING: "Comparing", }; export default WhereClauseTypes;
14.857143
36
0.639423
acc03dddc3524b13993d27cde7d9fe264c4b57c3
9,487
js
JavaScript
db/mobdb/mobdb376.js
sokomin/sokomin_repository
4c113e964e95ce4c74c934b220059443ae95fb2d
[ "CC-BY-4.0" ]
null
null
null
db/mobdb/mobdb376.js
sokomin/sokomin_repository
4c113e964e95ce4c74c934b220059443ae95fb2d
[ "CC-BY-4.0" ]
null
null
null
db/mobdb/mobdb376.js
sokomin/sokomin_repository
4c113e964e95ce4c74c934b220059443ae95fb2d
[ "CC-BY-4.0" ]
null
null
null
MobData = { 376: [ {"id":"0","inid":0,"type":1,"name":"ガイル","repop":120,"id_area":256,"lv_min":0,"lv_max":0,"is_npc":false,"real_posx":64.73,"real_posy":14.94,"posx":362.51,"posy":41.83}, {"id":"1","inid":1,"type":1,"name":"廃墟ガイド","repop":120,"id_area":4,"lv_min":0,"lv_max":0,"is_npc":false,"real_posx":13.44,"real_posy":17.63,"posx":75.25,"posy":49.35}, {"id":"2","inid":4,"type":1,"name":"傭兵","repop":120,"id_area":5,"lv_min":0,"lv_max":0,"is_npc":false,"real_posx":4.5,"real_posy":10.84,"posx":25.2,"posy":30.36}, {"id":"3","inid":2,"type":1,"name":"おじいさん","repop":120,"id_area":6,"lv_min":0,"lv_max":0,"is_npc":false,"real_posx":15.8,"real_posy":51.66,"posx":88.46,"posy":144.64}, {"id":"4","inid":3,"type":1,"name":"おばあさん","repop":120,"id_area":6,"lv_min":0,"lv_max":0,"is_npc":false,"real_posx":19.09,"real_posy":56.56,"posx":106.93,"posy":158.38}, {"id":"5","inid":4,"type":1,"name":"傭兵","repop":120,"id_area":7,"lv_min":0,"lv_max":0,"is_npc":false,"real_posx":6.2,"real_posy":31.97,"posx":34.74,"posy":89.51}, {"id":"6","inid":5,"type":1,"name":"考古学者","repop":120,"id_area":256,"lv_min":0,"lv_max":0,"is_npc":false,"real_posx":56.55,"real_posy":12.44,"posx":316.66,"posy":34.83}, {"id":"7","inid":7,"type":11,"name":"メルト","repop":120,"id_area":8,"lv_min":0,"lv_max":0,"is_npc":false,"real_posx":32.36,"real_posy":55.88,"posx":181.21,"posy":156.45}, {"id":"8","inid":6,"type":1,"name":"おばさん","repop":120,"id_area":10,"lv_min":0,"lv_max":0,"is_npc":false,"real_posx":43.98,"real_posy":59.47,"posx":246.31,"posy":166.51}, {"id":"9","inid":8,"type":1,"name":"ダマ","repop":120,"id_area":256,"lv_min":0,"lv_max":0,"is_npc":false,"real_posx":34.77,"real_posy":15.41,"posx":194.69,"posy":43.14}, {"id":"10","inid":9,"type":1,"name":"ウェイス","repop":120,"id_area":256,"lv_min":0,"lv_max":0,"is_npc":false,"real_posx":33.69,"real_posy":14.09,"posx":188.65,"posy":39.46}, {"id":"11","inid":24,"type":1,"name":"ジョウカ","repop":120,"id_area":256,"lv_min":0,"lv_max":0,"is_npc":false,"real_posx":9.83,"real_posy":9.06,"posx":55.04,"posy":25.38}, {"id":"12","inid":25,"type":1,"name":"ジョーカー","repop":120,"id_area":17,"lv_min":0,"lv_max":0,"is_npc":false,"real_posx":7.05,"real_posy":17.78,"posx":39.46,"posy":49.79}, {"id":"13","inid":26,"type":1,"name":"ライン","repop":120,"id_area":256,"lv_min":0,"lv_max":0,"is_npc":false,"real_posx":45.31,"real_posy":31.06,"posx":253.75,"posy":86.98}, {"id":"14","inid":10,"type":1,"name":"考古学者助手","repop":120,"id_area":256,"lv_min":0,"lv_max":0,"is_npc":false,"real_posx":31.27,"real_posy":31.16,"posx":175.09,"posy":87.24}, {"id":"15","inid":11,"type":1,"name":"パロ","repop":120,"id_area":256,"lv_min":0,"lv_max":0,"is_npc":false,"real_posx":64.25,"real_posy":53.06,"posx":359.8,"posy":148.57}, {"id":"16","inid":12,"type":10,"name":"ステンリー","repop":120,"id_area":256,"lv_min":0,"lv_max":0,"is_npc":true,"real_posx":22.19,"real_posy":26.31,"posx":124.25,"posy":73.68}, {"id":"17","inid":13,"type":10,"name":"カイネン","repop":120,"id_area":256,"lv_min":0,"lv_max":0,"is_npc":true,"real_posx":46.27,"real_posy":37.28,"posx":259.09,"posy":104.39}, {"id":"18","inid":14,"type":10,"name":"デンバー","repop":120,"id_area":256,"lv_min":0,"lv_max":0,"is_npc":true,"real_posx":35.3,"real_posy":45.09,"posx":197.66,"posy":126.26}, {"id":"19","inid":15,"type":21,"name":"オルブス","repop":120,"id_area":256,"lv_min":0,"lv_max":0,"is_npc":true,"real_posx":40.75,"real_posy":31.16,"posx":228.2,"posy":87.24}, {"id":"20","inid":16,"type":1,"name":"賢者ゲイツ","repop":120,"id_area":256,"lv_min":0,"lv_max":0,"is_npc":true,"real_posx":55.86,"real_posy":34.06,"posx":312.81,"posy":95.38}, {"id":"21","inid":17,"type":1,"name":"ライア","repop":120,"id_area":256,"lv_min":0,"lv_max":0,"is_npc":false,"real_posx":42.52,"real_posy":14.34,"posx":238.09,"posy":40.16}, {"id":"22","inid":19,"type":1,"name":"リベルゲート","repop":120,"id_area":256,"lv_min":0,"lv_max":0,"is_npc":true,"real_posx":36.22,"real_posy":31.25,"posx":202.83,"posy":87.5}, {"id":"23","inid":20,"type":35,"name":"協会専属魔法師","repop":120,"id_area":256,"lv_min":0,"lv_max":0,"is_npc":true,"real_posx":58.28,"real_posy":57.66,"posx":326.38,"posy":161.44}, {"id":"24","inid":22,"type":10,"name":"シュトラウズ","repop":120,"id_area":256,"lv_min":0,"lv_max":0,"is_npc":false,"real_posx":66.36,"real_posy":24.56,"posx":371.61,"posy":68.78}, {"id":"25","inid":21,"type":10,"name":"オクレル","repop":120,"id_area":256,"lv_min":0,"lv_max":0,"is_npc":false,"real_posx":29.3,"real_posy":41.97,"posx":164.06,"posy":117.51}, {"id":"26","inid":23,"type":1,"name":"ベールの歌姫","repop":120,"id_area":256,"lv_min":0,"lv_max":0,"is_npc":false,"real_posx":17.28,"real_posy":65.47,"posx":96.78,"posy":183.31}, ]}; MobList = { 376: ["モンスター", "ガイル","廃墟ガイド","おじいさん","おばあさん","傭兵","考古学者","おばさん","メルト","ダマ","ウェイス","考古学者助手","パロ","ステンリー","カイネン","デンバー","オルブス","賢者ゲイツ","ライア","None.","リベルゲート","協会専属魔法師","オクレル","シュトラウズ","ベールの歌姫","ジョウカ","ジョーカー","ライン",], }; AreaData = { 376: [ {"id":"0","type":0,"name":"_필드 전체","access_map":"","is_secret":0,"real_posx":0,"real_posx2":0,"real_posy":0,"real_posy2":0,"posx":0,"posx2":0,"posy":0,"posy2":0}, {"id":"1","type":0,"name":"_화면","access_map":"","is_secret":0,"real_posx":0,"real_posx2":0,"real_posy":0,"real_posy2":0,"posx":0,"posx2":0,"posy":0,"posy2":0}, {"id":"2","type":12,"name":"ゲールの墓","access_map":"","is_secret":0,"real_posx":61.5,"real_posx2":63.61,"real_posy":17.03,"real_posy2":19.72,"posx":344.4,"posx2":356.21,"posy":47.69,"posy2":55.21}, {"id":"3","type":3,"name":"D09","access_map":"[365]D09.rmd","is_secret":0,"real_posx":71.41,"real_posx2":73.56,"real_posy":62.84,"real_posy2":66.34,"posx":399.88,"posx2":411.95,"posy":175.96,"posy2":185.76}, {"id":"4","type":4,"name":"Area 3","access_map":"","is_secret":0,"real_posx":9,"real_posx2":15.88,"real_posy":10.72,"real_posy2":21.53,"posx":50.4,"posx2":88.9,"posy":30.01,"posy2":60.29}, {"id":"5","type":4,"name":"Area 4","access_map":"","is_secret":0,"real_posx":2.59,"real_posx2":8.02,"real_posy":7.13,"real_posy2":15.13,"posx":14.53,"posx2":44.89,"posy":19.95,"posy2":42.35}, {"id":"6","type":4,"name":"Area 5","access_map":"","is_secret":0,"real_posx":12.28,"real_posx2":21.81,"real_posy":48.38,"real_posy2":61.59,"posx":68.78,"posx2":122.15,"posy":135.45,"posy2":172.46}, {"id":"7","type":4,"name":"Area 6","access_map":"","is_secret":0,"real_posx":2.02,"real_posx2":10.23,"real_posy":28.13,"real_posy2":35.56,"posx":11.29,"posx2":57.31,"posy":78.75,"posy2":99.58}, {"id":"8","type":4,"name":"Area 7","access_map":"","is_secret":0,"real_posx":28.41,"real_posx2":40.14,"real_posy":49.47,"real_posy2":66.44,"posx":159.07,"posx2":224.79,"posy":138.51,"posy2":186.03}, {"id":"9","type":0,"name":"순수 청년 멜트 밖을 궁금해 하다","access_map":"","is_secret":0,"real_posx":33.03,"real_posx2":33.36,"real_posy":54.75,"real_posy2":55.31,"posx":184.98,"posx2":186.81,"posy":153.3,"posy2":154.88}, {"id":"10","type":4,"name":"Area 9","access_map":"","is_secret":0,"real_posx":42.13,"real_posx2":45.88,"real_posy":53.5,"real_posy2":62.31,"posx":235.9,"posx2":256.9,"posy":149.8,"posy2":174.48}, {"id":"11","type":0,"name":"동료 엿먹여서 고마워","access_map":"","is_secret":0,"real_posx":33.33,"real_posx2":33.55,"real_posy":12.25,"real_posy2":12.59,"posx":186.64,"posx2":187.86,"posy":34.3,"posy2":35.26}, {"id":"12","type":3,"name":"주점","access_map":"[394]T07_V01.rmd","is_secret":0,"real_posx":33.41,"real_posx2":34.89,"real_posy":28.16,"real_posy2":29.84,"posx":187.08,"posx2":195.39,"posy":78.84,"posy2":83.56}, {"id":"13","type":3,"name":"잡화점","access_map":"[400]T07_B01.rmd","is_secret":0,"real_posx":42,"real_posx2":43.36,"real_posy":44.94,"real_posy2":46.63,"posx":235.2,"posx2":242.81,"posy":125.83,"posy2":130.55}, {"id":"14","type":0,"name":"무덤에서 이쪽으로","access_map":"","is_secret":0,"real_posx":52.91,"real_posx2":55.63,"real_posy":45.72,"real_posy2":50,"posx":296.27,"posx2":311.5,"posy":128.01,"posy2":140}, {"id":"15","type":3,"name":"T07","access_map":"[404]T07_D01_F01.rmd","is_secret":0,"real_posx":54.08,"real_posx2":55.91,"real_posy":17.13,"real_posy2":19.66,"posx":302.84,"posx2":313.08,"posy":47.95,"posy2":55.04}, {"id":"16","type":0,"name":"maincheck","access_map":"","is_secret":0,"real_posx":16.81,"real_posx2":72.67,"real_posy":19.94,"real_posy2":71.72,"posx":94.15,"posx2":406.96,"posy":55.83,"posy2":200.81}, {"id":"17","type":4,"name":"조커소풍지역","access_map":"","is_secret":0,"real_posx":5.19,"real_posx2":25,"real_posy":6.13,"real_posy2":50.88,"posx":29.05,"posx2":140,"posy":17.15,"posy2":142.45}, {"id":"18","type":0,"name":"짐꾼칭호레벨10 NPC 오르부스","access_map":"","is_secret":0,"real_posx":39.7,"real_posx2":41.98,"real_posy":28.41,"real_posy2":31.59,"posx":222.34,"posx2":235.11,"posy":79.54,"posy2":88.46}, {"id":"19","type":0,"name":"전생 퀘스트","access_map":"","is_secret":0,"real_posx":54.33,"real_posx2":57.45,"real_posy":30.41,"real_posy2":35.78,"posx":304.24,"posx2":321.74,"posy":85.14,"posy2":100.19}, {"id":"20","type":3,"name":"T07_D02_B01","access_map":"[509]T07_D02_B01.rmd","is_secret":0,"real_posx":1.72,"real_posx2":3.86,"real_posy":5.53,"real_posy2":8.63,"posx":9.63,"posx2":21.61,"posy":15.49,"posy2":24.15}, {"id":"21","type":4,"name":"Q. 버서커 칭호 2레벨","access_map":"","is_secret":0,"real_posx":31.23,"real_posx2":33.47,"real_posy":53.28,"real_posy2":57.22,"posx":174.91,"posx2":187.43,"posy":149.19,"posy2":160.21}, {"id":"22","type":24,"name":"地下遺跡の入口","access_map":"","is_secret":0,"real_posx":48.38,"real_posx2":60.45,"real_posy":7.09,"real_posy2":25.09,"posx":270.9,"posx2":338.54,"posy":19.86,"posy2":70.26}, ]};
163.568966
216
0.633182
acc10891426a8ca5739abafa9abd10f1c3280eab
3,951
js
JavaScript
lib/test/item-parser.js
xChrisPx/amazon-associate-ts
3a8d72067b8d29c6e11b10d1389fd41b52817536
[ "MIT" ]
null
null
null
lib/test/item-parser.js
xChrisPx/amazon-associate-ts
3a8d72067b8d29c6e11b10d1389fd41b52817536
[ "MIT" ]
null
null
null
lib/test/item-parser.js
xChrisPx/amazon-associate-ts
3a8d72067b8d29c6e11b10d1389fd41b52817536
[ "MIT" ]
null
null
null
"use strict"; const item_parser_1 = require("../src/item-parser"); const fs = require("fs"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = { 'empty items are parsed correctly'(test) { let parser = new item_parser_1.default; parser.on('error', err => test.fail()); parser.on('end', function (earnings) { test.deepEqual(earnings, []); return test.done(); }); const xml = fs.readFileSync('./test/item1.xml'); parser.write(xml); return parser.close(); }, 'one item is parsed correctly'(test) { const parser = new item_parser_1.default; parser.on('error', err => test.fail()); parser.on('end', function (earnings) { test.deepEqual(earnings, [ { asin: '0060527307', category: '14', date: 'July 07, 2008', edate: '1215414000', earnings: '0.60', linktype: 'asn', price: '7.99', qty: '1', rate: '7.51', revenue: '7.99', seller: 'Amazon.com', tag: 'cse-ce- 20', subtag: '92164|1|ma', title: 'Double Shot (Goldy Culinary Mysteries, Book 12)' } ]); return test.done(); }); const xml = fs.readFileSync('./test/item2.xml'); parser.write(xml); return parser.close(); }, 'three items are parsed correctly'(test) { let parser = new item_parser_1.default; parser.on('error', function (err) { console.log(err); return test.fail(); }); parser.on('end', function (earnings) { let expected = [ { asin: '0060527307', category: '14', date: 'July 07, 2008', edate: '1215414000', earnings: '0.60', linktype: 'asn', price: '7.99', qty: '1', rate: '7.51', revenue: '7.99', seller: 'Amazon.com', tag: 'cse-ce- 20', subtag: '92164|1|ma', title: 'Double Shot (Goldy Culinary Mysteries, Book 12)' }, { asin: '0060527323', category: '14', date: 'July 07, 2008', edate: '1215414000', earnings: '0.60', linktype: 'asn', price: '7.99', qty: '1', rate: '7.51', revenue: '7.99', seller: 'Amazon.com', tag: 'cse-ce- 20', subtag: '92165|3|mb', title: 'Dark Tort (Goldy Culinary Mysteries, Book 13)' }, { asin: '0060723939', category: '14', date: 'July 07, 2008', edate: '1215414000', earnings: '1.12', linktype: 'asn', price: '14.93', qty: '1', rate: '7.50', revenue: '14.93', seller: 'Amazon.com', tag: 'cse- ce-20', subtag: '92166|3|mc', title: 'Crooked Little Vein: A Novel' } ]; test.deepEqual(earnings, expected); return test.done(); }); let xml = fs.readFileSync('./test/item3.xml'); parser.write(xml); return parser.close(); } }; //# sourceMappingURL=item-parser.js.map
35.918182
76
0.397368
acc1681789d4bce7a17412ee011134d0cc3250fc
12,155
js
JavaScript
src/common/components/Menu/index.js
wapplr/wapplr-com
9cb6540a5f9c5daaa21d2dd39a627bb7919b8363
[ "MIT" ]
null
null
null
src/common/components/Menu/index.js
wapplr/wapplr-com
9cb6540a5f9c5daaa21d2dd39a627bb7919b8363
[ "MIT" ]
null
null
null
src/common/components/Menu/index.js
wapplr/wapplr-com
9cb6540a5f9c5daaa21d2dd39a627bb7919b8363
[ "MIT" ]
null
null
null
import React, {useContext, useState, useEffect} from "react"; import {WappContext} from "wapplr-react/dist/common/Wapp"; import IconButton from "@material-ui/core/IconButton"; import MaterialMoreIcon from "@material-ui/icons/MoreVert"; import MaterialMenu from "@material-ui/core/Menu"; import List from "@material-ui/core/List"; import MenuItem from "@material-ui/core/MenuItem"; import ListItem from "@material-ui/core/ListItem"; import ListItemIcon from "@material-ui/core/ListItemIcon"; import ListItemText from "@material-ui/core/ListItemText"; import Divider from "@material-ui/core/Divider"; import Collapse from "@material-ui/core/Collapse"; import ExpandLess from "@material-ui/icons/ExpandLess"; import ExpandMore from "@material-ui/icons/ExpandMore"; import ListItemSecondaryAction from "@material-ui/core/ListItemSecondaryAction"; import clsx from "clsx"; import AppContext from "../App/context"; import {withMaterialStyles} from "../Template/withMaterial"; import style from "./style.css"; import materialStyle from "./materialStyle" import getUtils from "wapplr-react/dist/common/Wapp/getUtils"; function GenerateMenuFunc(props) { const {appContext, context, store} = props; const {wapp} = context; const utils = getUtils(context); const {storage} = appContext; const {menu, ...rest} = props; const {ItemComponent, menuComponentProps, parentRoute, menuProperties, onClick, style, materialStyle, menuKey = "menu_0"} = rest; const initialState = (typeof window !== "undefined" && window[wapp.config.appStateName]) || {req:{timestamp: Date.now()}}; const firstRender = (utils.getGlobalState("req.timestamp") === initialState.req.timestamp || wapp.target === "node"); const [open, _setOpen] = useState((firstRender) ? false : store?.[menuKey] ? store[menuKey] : false); async function setOpen(value) { if (value !== open) { if (storage) { storage({[menuKey]: value}); } await _setOpen(value); } } const name = (typeof menu.name == "function") ? menu.name(menuProperties) : menu.name; const target = menu.target || "self"; const href = (typeof menu.href == "function") ? menu.href(menuProperties) : menu.href; const Icon = menu.Icon; const show = (menu.role) ? menu.role(menuProperties) : true; const inner = !(target === "_blank" || (href && href.slice(0,7) === "http://") || (href && href.slice(0,8) === "https://")); const paddingLeft = menu.paddingLeft; const className = (typeof menu.className == "function") ? menu.className({...menuProperties, style}) : menu.className; useEffect(()=>{ const newOpenState = store?.[menuKey] ? store[menuKey] : false; if (newOpenState !== open){ _setOpen(newOpenState) } // eslint-disable-next-line react-hooks/exhaustive-deps }, []); if (menu.divider){ return ( <Divider/> ) } if (show) { return ( <> <ItemComponent ref={props.forwardedRef} component={"a"} target={target} href={(inner) ? parentRoute + href : href} onClick={async function (e) { if (menu.items?.length){ e.preventDefault(); await setOpen(!open); return; } await onClick(e, menu) }} className={clsx(materialStyle.listItem, {[className]: className})} {...(paddingLeft) ? {sx:{pl: paddingLeft}} : {}} > {(Icon) ? <ListItemIcon className={materialStyle.listItemIcon}> <Icon/> </ListItemIcon> : null } <ListItemText className={(menu.items?.length) ? style.collapseButtonLabel : null} primary={name}/> {(menu.items?.length) ? <ListItemSecondaryAction className={style.collapseIcon}> <IconButton edge={"end"} aria-label={"open"} onClick={()=>setOpen(!open)}> {(open) ? <ExpandLess /> : <ExpandMore />} </IconButton> </ListItemSecondaryAction> : null } </ItemComponent> {(menu.items?.length) ? <Collapse in={open} className={style.collapseContainer}> <div className={style.collapse}> <List {...menuComponentProps} {...{sx: { pl: (paddingLeft) ? paddingLeft : 0}, component:"div", disablePadding:true}} > {[...menu.items.map((m, k)=><GenerateMenu menu={m} key={"menu_collapse_item_" + k} {...rest} menuKey={menuKey+k}/>)]} </List> </div> </Collapse> : null } </> ) } return null; } const GenerateMenu = React.forwardRef((props, ref) => { return <GenerateMenuFunc {...props} forwardedRef={ref} />; }); function Menu(props) { const context = useContext(WappContext); const appContext = useContext(AppContext); const {wapp} = context; const {template, storage} = appContext; const store = storage(); wapp.styles.use(style); const { parentRoute = "", materialStyle = {}, list, effect, menuKey = "menu", MoreIcon = MaterialMoreIcon } = props; const menuProperties = {...(props.menuProperties) ? props.menuProperties : {}, appContext, context}; const [anchorEl, setAnchorEl] = useState(null); const [menu, setMenu] = useState(props.menu || []); function handleMenuOpen (event) { setAnchorEl(event.currentTarget); } function handleMenuClose () { setAnchorEl(null); } async function onClick(e, menu) { const target = menu.target || "self"; const href = (typeof menu.href == "function") ? menu.href(menuProperties) : menu.href; const disableParentRoute = menu.disableParentRoute; const inner = !(target === "_blank" || (href && href.slice(0,7) === "http://") || (href && href.slice(0,8) === "https://")); if (inner) { e.preventDefault(); } if (menu.onClickBefore){ await menu.onClickBefore(menuProperties); } if (menu.onClick){ if (anchorEl !== null) { await setAnchorEl(null); } return menu.onClick(e, menuProperties); } if (inner){ wapp.client.history.push({ search:"", hash:"", ...wapp.client.history.parsePath((disableParentRoute) ? href : parentRoute + href) }); if (template?.actions){ template.actions.scrollTop(); } if (anchorEl !== null) { setAnchorEl(null); } } } const actions = { close: handleMenuClose, setMenu: setMenu }; useEffect(function () { if (effect){ effect({ actions }) } }); const featuredMenus = [...menu.filter(function (menu) {return !!(menu.featured && !list)})]; const showFeaturedMenu = [...featuredMenus.filter(function (menu) {return (menu.role) ? menu.role(menuProperties) : true})]; const moreMenus = [...menu.filter(function (menu) {return !(menu.featured && !list)})]; const showMoreMenu = [...moreMenus.filter(function (menu) {return (menu.role) ? menu.role(menuProperties) : true})]; const MenuComponent = (list) ? List : MaterialMenu; const ItemComponent = (list) ? ListItem : MenuItem; const menuComponentProps = (list) ? {} : { anchorEl, keepMounted: true, open:Boolean(anchorEl), onClose:handleMenuClose }; const generateMenuProps = {ItemComponent, menuComponentProps, parentRoute, menuProperties, onClick, style, materialStyle, appContext, context, store}; return ( <> { (showFeaturedMenu.length) ? [...featuredMenus.map(function (menu, key) { const target = menu.target || "self"; const href = (typeof menu.href == "function") ? menu.href(menuProperties) : menu.href; const Icon = menu.Icon; const show = (menu.role) ? menu.role(menuProperties) : true; const inner = !(target === "_blank" || (href && href.slice(0,7) === "http://") || (href && href.slice(0,8) === "https://")); const Element = menu.Element; if (show) { if (Element){ return ( <Element key={"featured"+key} /> ) } return ( <IconButton key={"featured"+key} component={"a"} color={"inherit"} onClick={async function (e) {await onClick(e, menu);}} href={(inner) ? parentRoute + href : href} > {(Icon) ? <Icon/> : null} </IconButton> ) } return null; })] : null } { (showMoreMenu.length > 0) ? <> {(!list) ? <IconButton className={style.menu} color={"inherit"} onClick={handleMenuOpen} aria-controls={"post-menu"} aria-haspopup={"true"} aria-label={"post-menu"} > <MoreIcon /> </IconButton> : null } <MenuComponent className={clsx(materialStyle.menu, style.menu)} id={"post-menu"} {...menuComponentProps} > {[...moreMenus.map((m, k)=><GenerateMenu menu={m} key={"menu_item_" + k} {...generateMenuProps} menuKey={menuKey+"_"+k}/>)]} </MenuComponent> </> : null } </> ) } const StyledComponent = withMaterialStyles(materialStyle, Menu); export default React.memo( StyledComponent, (prevProps, nextProps)=> { let changes = (Object.keys(prevProps).join("|") !== Object.keys(nextProps).join("|")); if (!changes && prevProps.menuProperties && nextProps.menuProperties) { changes = (Object.keys(prevProps.menuProperties).join("|") !== Object.keys(nextProps.menuProperties).join("|")); if (!changes) { changes = !!(Object.keys(prevProps.menuProperties).filter((key) => { return prevProps.menuProperties[key] !== nextProps.menuProperties[key]; }).length) } } if (prevProps.menuKey !== nextProps.menuKey || prevProps.menu !== nextProps.menu || prevProps.list !== nextProps.list || prevProps.parentRoute !== nextProps.parentRoute || prevProps.effect !== nextProps.effect ) { changes = true; } return !changes; } )
36.722054
154
0.498478
acc24701c79f64d5db8d68b857cd78b91c14765a
3,044
js
JavaScript
lib/utils/trapFocus.js
Bitacora-io/uppy-dashboard
9160af7a1da00caa91e4ff4f297d48a7b024efef
[ "MIT" ]
null
null
null
lib/utils/trapFocus.js
Bitacora-io/uppy-dashboard
9160af7a1da00caa91e4ff4f297d48a7b024efef
[ "MIT" ]
null
null
null
lib/utils/trapFocus.js
Bitacora-io/uppy-dashboard
9160af7a1da00caa91e4ff4f297d48a7b024efef
[ "MIT" ]
null
null
null
"use strict"; const toArray = require('@uppy/utils/lib/toArray'); const FOCUSABLE_ELEMENTS = require('@uppy/utils/lib/FOCUSABLE_ELEMENTS'); const getActiveOverlayEl = require('./getActiveOverlayEl'); function focusOnFirstNode(event, nodes) { const node = nodes[0]; if (node) { node.focus(); event.preventDefault(); } } function focusOnLastNode(event, nodes) { const node = nodes[nodes.length - 1]; if (node) { node.focus(); event.preventDefault(); } } // ___Why not just use (focusedItemIndex === -1)? // Firefox thinks <ul> is focusable, but we don't have <ul>s in our FOCUSABLE_ELEMENTS. Which means that if we tab into // the <ul>, code will think that we are not in the active overlay, and we should focusOnFirstNode() of the currently // active overlay! // [Practical check] if we use (focusedItemIndex === -1), instagram provider in firefox will never get focus on its pics // in the <ul>. function isFocusInOverlay(activeOverlayEl) { return activeOverlayEl.contains(document.activeElement); } function trapFocus(event, activeOverlayType, dashboardEl) { const activeOverlayEl = getActiveOverlayEl(dashboardEl, activeOverlayType); const focusableNodes = toArray(activeOverlayEl.querySelectorAll(FOCUSABLE_ELEMENTS)); const focusedItemIndex = focusableNodes.indexOf(document.activeElement); // If we pressed tab, and focus is not yet within the current overlay - focus on // the first element within the current overlay. // This is a safety measure (for when user returns from another tab e.g.), most // plugins will try to focus on some important element as it loads. if (!isFocusInOverlay(activeOverlayEl)) { focusOnFirstNode(event, focusableNodes); // If we pressed shift + tab, and we're on the first element of a modal } else if (event.shiftKey && focusedItemIndex === 0) { focusOnLastNode(event, focusableNodes); // If we pressed tab, and we're on the last element of the modal } else if (!event.shiftKey && focusedItemIndex === focusableNodes.length - 1) { focusOnFirstNode(event, focusableNodes); } } module.exports = { // Traps focus inside of the currently open overlay (e.g. Dashboard, or e.g. Instagram), // never lets focus disappear from the modal. forModal: (event, activeOverlayType, dashboardEl) => { trapFocus(event, activeOverlayType, dashboardEl); }, // Traps focus inside of the currently open overlay, unless overlay is null - then let the user tab away. forInline: (event, activeOverlayType, dashboardEl) => { // ___When we're in the bare 'Drop files here, paste, browse or import from' screen if (activeOverlayType === null) {// Do nothing and let the browser handle it, user can tab away from Uppy to other elements on the page // ___When there is some overlay with 'Done' button } else { // Trap the focus inside this overlay! // User can close the overlay (click 'Done') if they want to travel away from Uppy. trapFocus(event, activeOverlayType, dashboardEl); } } };
42.873239
155
0.71912
acc2685d937e8a6f3fae352b8274943a9875a8e7
579
js
JavaScript
doc/doxygen/html/constants_8h.js
vidarr/fulisp
19925a3b71cb26be4abb5aa66f15e22ff2ba5a87
[ "BSD-3-Clause" ]
1
2019-05-31T05:21:52.000Z
2019-05-31T05:21:52.000Z
doc/doxygen/html/constants_8h.js
vidarr/fulisp
19925a3b71cb26be4abb5aa66f15e22ff2ba5a87
[ "BSD-3-Clause" ]
null
null
null
doc/doxygen/html/constants_8h.js
vidarr/fulisp
19925a3b71cb26be4abb5aa66f15e22ff2ba5a87
[ "BSD-3-Clause" ]
null
null
null
var constants_8h = [ [ "DOTTED_PAIR_MARKER_STRING", "constants_8h.html#a089cd6a7d3f7a44c788f59c5aed439f1", null ], [ "LOG_TO_LOG10_FACTOR", "constants_8h.html#a385a84ed5f54d69b98f43b2e077e4393", null ], [ "MAX_BYTES_PER_char", "constants_8h.html#a3821952055253131e9aa4a0550e36a60", null ], [ "MAX_BYTES_PER_float", "constants_8h.html#a4054ec68962ad24a69b5626d3cf70a97", null ], [ "MAX_BYTES_PER_int", "constants_8h.html#a086dda975332b6ac461ecd89c83b157c", null ], [ "MAX_BYTES_PER_pointer", "constants_8h.html#ae80685fbdded9f9612790aea40f1df1e", null ] ];
64.333333
97
0.780656
acc368375094de06d1fa3a60ae0d19e58672a302
311
js
JavaScript
node_modules/@iconify/icons-mdi/src/funnel.js
FAD95/NEXT.JS-Course
5177872c4045945f3e952d8b59c99dfa21fff5ef
[ "MIT" ]
1
2021-05-15T00:26:49.000Z
2021-05-15T00:26:49.000Z
node_modules/@iconify/icons-mdi/src/funnel.js
rydockman/YouPick
ad902eafb876ac425baeaef4ec066d335025c5bb
[ "Apache-2.0" ]
1
2021-12-09T01:30:41.000Z
2021-12-09T01:30:41.000Z
node_modules/@iconify/icons-mdi/src/funnel.js
rydockman/YouPick
ad902eafb876ac425baeaef4ec066d335025c5bb
[ "Apache-2.0" ]
null
null
null
let data = { "body": "<path d=\"M14 12v7.88c.04.3-.06.62-.29.83a.996.996 0 0 1-1.41 0l-2.01-2.01a.989.989 0 0 1-.29-.83V12h-.03L4.21 4.62a1 1 0 0 1 .17-1.4c.19-.14.4-.22.62-.22h14c.22 0 .43.08.62.22a1 1 0 0 1 .17 1.4L14.03 12H14z\" fill=\"currentColor\"/>", "width": 24, "height": 24 }; export default data;
44.428571
245
0.614148
acc38c091778a6a61d32cb6133d031dee65df712
1,034
js
JavaScript
assets/sap/ui/commons/FormattedTextViewRenderer.js
jekyll-openui5/jekyll-openui5
159bfa9a764e0f60278774690fc9b01afcaf47ca
[ "Apache-2.0" ]
null
null
null
assets/sap/ui/commons/FormattedTextViewRenderer.js
jekyll-openui5/jekyll-openui5
159bfa9a764e0f60278774690fc9b01afcaf47ca
[ "Apache-2.0" ]
null
null
null
assets/sap/ui/commons/FormattedTextViewRenderer.js
jekyll-openui5/jekyll-openui5
159bfa9a764e0f60278774690fc9b01afcaf47ca
[ "Apache-2.0" ]
null
null
null
/*! * OpenUI5 * (c) Copyright 2009-2021 SAP SE or an SAP affiliate company. * Licensed under the Apache License, Version 2.0 - see LICENSE.txt. */ sap.ui.define(["sap/base/Log"],function(L){"use strict";var F={};F.render=function(r,c){var a=/<embed\s+data-index="([0-9]+)"\s*\/?>/gim;var h=c.getHtmlText();var i=c.getControls().slice();var t=i.length;var l=0;var m=[];r.write("<span");r.writeControlData(c);r.addClass("sapUiFTV");r.writeClasses();if(c.getTooltip_AsString()){r.writeAttributeEscaped("title",c.getTooltip_AsString());}r.write(">");while((m=a.exec(h))!==null){r.write(h.slice(l,m.index));if(this._renderReplacement(r,m[1],i)){t--;}else{L.warning("Could not find matching control to placeholder #"+m[1]);}l=a.lastIndex;}r.write(h.slice(l,h.length));if(t>0){L.warning('There are leftover controls in the aggregation that have not been used in the formatted text',c);}r.write("</span>");};F._renderReplacement=function(r,c,C){if(C[c]){r.renderControl(C[c]);C[c]=null;return true;}else{return false;}};return F;},true);
147.714286
882
0.696325
acc3e892a20bf1e45bc6dc0e95dc8748eb6fe1ef
3,704
js
JavaScript
generator-readme.js
xenonth/README.md-Generator
89b17b64f29b1d03e703db5d408b15f5c13fea6e
[ "MIT" ]
null
null
null
generator-readme.js
xenonth/README.md-Generator
89b17b64f29b1d03e703db5d408b15f5c13fea6e
[ "MIT" ]
null
null
null
generator-readme.js
xenonth/README.md-Generator
89b17b64f29b1d03e703db5d408b15f5c13fea6e
[ "MIT" ]
null
null
null
// have a seperate function for each question which is cleanly listed inside writefile plant await x function inside with file creation inside the seperate functions. const axios= require("axios"); const { Console } = require("console"); const fs = require('fs'); const inquirer = require('inquirer'); const { cpuUsage } = require("process"); const util = require("util"); const writeFileAsync = util.promisify(fs.writeFile); // Ideas Array for questions // following sections need to each have a question description, installation instructions, usage information, contribution guidelines, and test instructions const questions= ["Title of your application?", "Description of your application?", "How does the user install your application?", "Instructions to use the program?", "Usage Information of the Program?", "Which License do you wish your program to be under?", "Names of other contributors for this Project, (if not type N/A)?", "What is your email address for user's to contact?", "Test Instructions for user's to Troubleshoot?", ]; // function to catalogue data then pass it into writeToFile const questionSetPrompt = () => { return inquirer.prompt([ { name: "title", message: questions[0], type: "input", }, { name: "description", message: questions[1], type: "input", }, { name: "install", message: questions[2], type: "input", }, { name: "instruction", message: questions[3], type: "input", }, { name: "usage", message: questions[4], type: "input", }, { name: "license", message: questions[5], type: "list", choices: ["MIT", "AGPL ", "BSD3", "Apache License 2.0"], }, { name: "contributorNumber", message: questions[6], type: "input", }, { name: "test", message: questions[-1], type: "input", }, { name: "email", message: questions[7], type: "input" }, { name: "username", message: "What is your Github User Name?", type: "input", } ]) } // function to generate README function generateReadMeData (answers) { return ` # ${answers.title} ![Github License](https://img.shields.io/badge/license-${answers.license}-blue.svg) ### Table of Contents * [Description](#Description) * [Installation](#Installation) * [Usage](#Usage) * [License](#License) * [Contributing](#Contributing) * [Tests](#TEST) * [Questions](#Questions) ### Description ${answers.description} ### How to Install ${answers.install} ### Instructions ${answers.instruction} ### Usage ${answers.usage} ### Other Contributors ${answers.contributorNumber} ### TEST ${answers.test} ##### Questions For any issues please contact ${answers.email}, and go here to view other projects [!github profile](https://github.com/${answers.username}) ` // //Please send any queries to ${githubLink} } // function to write and append github link // function to initialize program const init = async () => { console.log("hi") try { const answers = await questionSetPrompt(); //const githubSite = await githubLink (); const readme = generateReadMeData (answers); console.log("Updating README.md ...") await writeFileAsync("readme.md", readme); console.log("Successfully wrote to readme.md"); } catch(err) { console.log("An error was encountered please run program again"); } } // function call to initialize program init();
24.051948
167
0.613661
acc430a1a24d4ce7cf5df5c8847e82a1e8351681
1,583
js
JavaScript
tmp/babel-output_path-xb4GCqUW.tmp/modules/lodash/function/modArgs.js
gracielundell/scienceBlog
b45969e7771af81cf18274e2e879c134e8659af4
[ "MIT" ]
null
null
null
tmp/babel-output_path-xb4GCqUW.tmp/modules/lodash/function/modArgs.js
gracielundell/scienceBlog
b45969e7771af81cf18274e2e879c134e8659af4
[ "MIT" ]
null
null
null
tmp/babel-output_path-xb4GCqUW.tmp/modules/lodash/function/modArgs.js
gracielundell/scienceBlog
b45969e7771af81cf18274e2e879c134e8659af4
[ "MIT" ]
null
null
null
import arrayEvery from '../internal/arrayEvery'; import baseFlatten from '../internal/baseFlatten'; import baseIsFunction from '../internal/baseIsFunction'; import restParam from './restParam'; /** Used as the `TypeError` message for "Functions" methods. */ var FUNC_ERROR_TEXT = 'Expected a function'; /* Native method references for those with the same name as other `lodash` methods. */ var nativeMin = Math.min; /** * Creates a function that runs each argument through a corresponding * transform function. * * @static * @memberOf _ * @category Function * @param {Function} func The function to wrap. * @param {...(Function|Function[])} [transforms] The functions to transform * arguments, specified as individual functions or arrays of functions. * @returns {Function} Returns the new function. * @example * * function doubled(n) { * return n * 2; * } * * function square(n) { * return n * n; * } * * var modded = _.modArgs(function(x, y) { * return [x, y]; * }, square, doubled); * * modded(1, 2); * // => [1, 4] * * modded(5, 10); * // => [25, 20] */ var modArgs = restParam(function (func, transforms) { transforms = baseFlatten(transforms); if (typeof func != 'function' || !arrayEvery(transforms, baseIsFunction)) { throw new TypeError(FUNC_ERROR_TEXT); } var length = transforms.length; return restParam(function (args) { var index = nativeMin(args.length, length); while (index--) { args[index] = transforms[index](args[index]); } return func.apply(this, args); }); }); export default modArgs;
27.293103
86
0.667088
acc5027ab947654df510fe1378ccf440a7e2e960
1,217
js
JavaScript
app/src/products/item.js
Yonghui-Lee/SpecuTurtle
db5ad7f7ec1e2e1e8284e45047a4a577912333db
[ "MIT" ]
404
2019-07-28T11:54:30.000Z
2022-03-21T12:48:12.000Z
app/src/products/item.js
satellity/godiscourse
513bdf464d90740b505d95dcb1368d0161027e58
[ "MIT" ]
128
2019-07-31T17:17:14.000Z
2022-03-23T10:13:52.000Z
app/src/products/item.js
satellity/godiscourse
513bdf464d90740b505d95dcb1368d0161027e58
[ "MIT" ]
66
2019-08-17T06:21:28.000Z
2022-03-30T15:08:53.000Z
import style from './index.module.scss'; import React from 'react'; import { Link } from 'react-router-dom'; import LazyLoad from 'react-lazyload'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; export default function Item(props) { const p = props.product; let tags = p.tags.slice(0, 4).map((t, i) => { return ( <Link to={`/products/q/best-${t}-avatar-maker`}>{t}{ i<3 && ','} &nbsp;</Link> ) }); let path = `/products/${p.name.replace(/\W+/mgsi, ' ').replace(/\s+/mgsi, '-').replace(/[^\w-]/mgsi, '')}-${p.short_id}` return ( <div key={p.product_id} className={style.product}> <div className={style.wrapper}> <Link to={path}> <LazyLoad className={style.cover} offset={100}> <div className={style.cover} style={{backgroundImage: `url(${p.cover_url})`}} /> </LazyLoad> </Link> <div className={style.desc}> <Link to={path}> <div className={style.name}>{p.name}</div> </Link> <div className={style.tags}> <FontAwesomeIcon className={style.icon} icon={['fas', 'tags']} /> {tags} </div> </div> </div> </div> ) }
31.205128
122
0.552177
acc531dafe46515d1bf77b7b8dbdd3415275ab9a
1,864
js
JavaScript
src/eurekaJS/geom/Matrix.js
Ignasimg/eurekaJS
a99ff9931911294a8d18a8e59f67a1640036d781
[ "MIT" ]
2
2016-03-16T03:48:33.000Z
2016-03-23T17:03:55.000Z
src/eurekaJS/geom/Matrix.js
Ignasimg/eurekaJS
a99ff9931911294a8d18a8e59f67a1640036d781
[ "MIT" ]
null
null
null
src/eurekaJS/geom/Matrix.js
Ignasimg/eurekaJS
a99ff9931911294a8d18a8e59f67a1640036d781
[ "MIT" ]
null
null
null
import "eurekaJS/geom/Point.js"; var ns = namespace("eurekaJS.geom"); this.Matrix = ns.Matrix = class Matrix { constructor (a, b, c, d, tx, ty) { this.a = a || 1; this.b = b || 0; this.c = c || 0; this.d = d || 1; this.tx = tx || 0; this.ty = ty || 0; } clone () { return new Matrix(this.a, this.b, this.c, this.d, this.tx, this.ty); } concat (m) { var a = this.a; var b = this.b; var c = this.c; var d = this.d; var tx = this.tx; var ty = this.ty; this.a = (a * m.a) + (c * m.b); this.b = (b * m.a) + (d * m.b); this.c = (a * m.c) + (c * m.d); this.d = (b * m.c) + (d * m.d); this.tx = (a * m.tx) + (c * m.ty) + tx; this.ty = (b * m.tx) + (d * m.ty) + ty; } copyFrom (sourceMatrix) { this.a = sourceMatrix.a; this.b = sourceMatrix.b; this.c = sourceMatrix.c; this.d = sourceMatrix.d; this.tx = sourceMatrix.tx; this.ty = sourceMatrix.ty; } identity () { this.a = 1; this.b = 0; this.c = 0; this.d = 1; this.tx = 0; this.ty = 0; } rotate (angle) { var cos = Math.cos(angle); var sin = Math.sin(angle); this.concat(new Matrix(cos, sin, -sin, cos)); } scale (sx, sy) { this.concat(new Matrix(sx, 0, 0, sy)); } setTo (aa, ba, ca, da, txa, tya) { this.a = aa; this.b = ba; this.c = ca; this.d = da; this.tx = txa; this.ty = tya; } toString () { return '(a='+this.a+', b='+this.b+', c='+this.c+', d='+this.d+', tx='+this.tx+', ty='+this.ty+')'; } transformPoint (point) { var x = (this.a * point.x) + (this.c * point.y) + this.tx; var y = (this.b * point.x) + (this.d * point.y) + this.ty; return new Point (x, y); } translate (dx, dy) { //this.tx += dx; //this.ty += dy; this.concat(new Matrix(1, 0, 0, 1, dx, dy)); } }
21.425287
102
0.483906
acc56e7825c7b6feb28b7a2c2ae6dd82e8d58b99
664
js
JavaScript
packages/build/css/postcss-compile.js
naeemcloudguru/design-system
562cd9943b52d83f810d99c76d026667ab51e572
[ "Apache-2.0" ]
298
2017-07-17T06:51:04.000Z
2022-03-25T22:13:30.000Z
packages/build/css/postcss-compile.js
naeemcloudguru/design-system
562cd9943b52d83f810d99c76d026667ab51e572
[ "Apache-2.0" ]
1,277
2017-05-25T22:13:10.000Z
2022-03-31T15:13:01.000Z
packages/build/css/postcss-compile.js
naeemcloudguru/design-system
562cd9943b52d83f810d99c76d026667ab51e572
[ "Apache-2.0" ]
87
2017-08-02T21:37:27.000Z
2022-03-30T22:31:35.000Z
const { execSync } = require('child_process') const path = require('path') const { mkdir } = require('../fs') module.exports = async function postcssCompile(inputPath, outputPaths) { await ensureDirectoryStructure(outputPaths) const firstOutputPath = outputPaths[0] exec(`postcss ${inputPath} -o ${firstOutputPath}`) outputPaths.slice(1).forEach(path => { exec(`cp ${firstOutputPath} ${path}`) }) } function exec(cmd) { execSync(cmd, { stdio: 'inherit', cwd: process.cwd() }) } async function ensureDirectoryStructure(outputPaths) { for (const dirname of outputPaths.map(fullPath => path.dirname(fullPath))) { await mkdir(dirname) } }
26.56
78
0.703313
acc57a1e785c2bbd7e47e56de515414fa2e2a546
2,770
js
JavaScript
webpack.config.js
liuqiyu/core-editor
4e278c62171b78b66c452d39d3e46be72f5d7c4c
[ "MIT" ]
1
2019-12-10T08:54:00.000Z
2019-12-10T08:54:00.000Z
webpack.config.js
liuqiyu/asp-core-editor
b96e470301edbfb52a26bed45a4fb2fe7fe6a754
[ "MIT" ]
5
2021-03-10T03:22:40.000Z
2022-02-18T17:55:34.000Z
webpack.config.js
liuqiyu/asp-core-editor
b96e470301edbfb52a26bed45a4fb2fe7fe6a754
[ "MIT" ]
1
2021-08-01T06:56:43.000Z
2021-08-01T06:56:43.000Z
/* * @Description: * @Author: liuqiyu * @Date: 2019-12-18 15:03:17 * @LastEditors : liuqiyu * @LastEditTime : 2020-01-13 13:41:31 */ const path = require('path') const webpack = require('webpack') const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin function resolve (dir) { return path.join(__dirname, '..', dir) } module.exports = { entry: { 'asp-core-editor': './src/components/core-editor/src/core/index.js' }, output: { path: path.resolve(__dirname, './public'), publicPath: '/public/', filename: '[name].min.js', library: 'AspCoreEditor', libraryTarget: 'umd', umdNamedDefine: true }, module: { rules: [ { test: /\.(js|vue)$/, loader: 'eslint-loader', enforce: 'pre', include: [resolve('src'), resolve('test')], options: { formatter: require('eslint-friendly-formatter') } }, { test: /\.vue$/, loader: 'vue-loader', options: { loaders: { scss: 'vue-style-loader!css-loader!sass-loader' // <style lang="scss"> } } }, { test: /\.js$/, loader: 'babel-loader', exclude: /node_modules/ }, // { // test: /\.(png|jpg|gif|svg)$/, // loader: 'file-loader', // options: { // name: '[name].[ext]?[hash]' // } // }, { test: /\.(png|jpg|gif|svg)$/, use: [ { loader: 'url-loader', options: { esModule: false, // 这里设置为false limit: 10000000 } } ] }, { test: /\.scss$/, use: [ { loader: 'style-loader' // 将 JS 字符串生成为 style 节点 }, { loader: 'css-loader' // 将 CSS 转化成 CommonJS 模块 }, { loader: 'sass-loader' // 将 Sass 编译成 CSS } ] } ] }, devServer: { historyApiFallback: true, noInfo: true }, performance: { hints: false }, // devtool: '#source-map', // 外部扩展 不打包某些以依赖 // externals: { // mxgraph: 'mxgraph' // }, plugins: [ new BundleAnalyzerPlugin() ] } if (process.env.NODE_ENV === 'production') { module.exports.devtool = '#source-map' // http://vue-loader.vuejs.org/en/workflow/production.html module.exports.plugins = (module.exports.plugins || []).concat([ new webpack.DefinePlugin({ 'process.env': { NODE_ENV: '"production"' } }), new webpack.optimize.UglifyJsPlugin({ sourceMap: true, compress: { warnings: false } }), new webpack.LoaderOptionsPlugin({ minimize: true }) ]) }
22.33871
84
0.496029
acc58110434d18ee4c551d9f9e262e9246474e88
99
js
JavaScript
spec/assets/hammer-simulator.run.js
oliveiraaraujo/billboard.js
0ca6b184b05d8c534b324e8fbc6ccf9595006726
[ "MIT" ]
14
2019-04-09T00:50:24.000Z
2021-12-14T02:12:13.000Z
spec/assets/hammer-simulator.run.js
oliveiraaraujo/billboard.js
0ca6b184b05d8c534b324e8fbc6ccf9595006726
[ "MIT" ]
165
2018-04-13T18:24:39.000Z
2022-03-02T03:27:33.000Z
spec/assets/hammer-simulator.run.js
oliveiraaraujo/billboard.js
0ca6b184b05d8c534b324e8fbc6ccf9595006726
[ "MIT" ]
3
2019-12-08T14:04:59.000Z
2021-10-07T11:21:38.000Z
// set hammerjs-simulator config Simulator.setType("touch"); Simulator.events.touch.fakeSupport();
24.75
37
0.787879
acc5b9d8fb476fd7b3642f81b2f7f84e7b2a2a63
1,353
js
JavaScript
components/SteamSupply.js
Luc4sguilherme/BluebotFree
f8ad6c7681ac24b4ef169ad6b88fb924b520ebb6
[ "MIT" ]
1
2021-03-14T06:24:07.000Z
2021-03-14T06:24:07.000Z
components/SteamSupply.js
Luc4sguilherme/BluebotFree
f8ad6c7681ac24b4ef169ad6b88fb924b520ebb6
[ "MIT" ]
null
null
null
components/SteamSupply.js
Luc4sguilherme/BluebotFree
f8ad6c7681ac24b4ef169ad6b88fb924b520ebb6
[ "MIT" ]
null
null
null
const {SteamSupply, maxStock, maxTradeKeys, enableSell} = require('../config/main.js'); const got = require('got'); const Rates = require('../config/rates.json'); module.exports = SendData; async function SendData(Tf2KeysAmount = 0) { let SteamSupplyData = { "tf2buyrate": 0, "csgobuyrate": 0, "gembuyrate": 0 }; //Old pubg data SteamSupplyData["pubgamount"] = 0; SteamSupplyData["pubgrate"] = 0; SteamSupplyData["pubgbuyrate"] = 0; //Not supported data SteamSupplyData["gemamount"] = 0; SteamSupplyData["csgoamount"] = 0; SteamSupplyData["gemrate"] = 0; SteamSupplyData["csgorate"] = 0; SteamSupplyData["csgobuyrate"] = 0; SteamSupplyData["gembuyrate"] = 0; //Bot Setup Data SteamSupplyData["maxTradeKeys"] = maxTradeKeys; SteamSupplyData["maxStock"] = maxStock; //Inventory Amount SteamSupplyData["tf2amount"] = Tf2KeysAmount; //Sell Rate SteamSupplyData["tf2rate"] = Rates.SellPrice; //Buy Rate if (enableSell) SteamSupplyData["tf2buyrate"] = Rates.BuyPrice; if(SteamSupply.Api === "") throw new Error("Steam.Supply API its empty!"); const o = { "url": "https://steam.supply/API/" + SteamSupply.Api + "/update/", "searchParams": SteamSupplyData }; try { got(o); } catch (e) {} }
26.529412
87
0.629712
acc5ed34797820cfc20bad1c29f0fe6c88ad0e55
1,104
js
JavaScript
scripts/build.js
height/best-poller
13ac7444d78197561697bdf712605651a0784388
[ "MIT" ]
3
2019-11-08T23:32:30.000Z
2020-02-28T12:26:44.000Z
scripts/build.js
height/best-response
64742d1fc92b611af0df06aa8da58d9a7a487614
[ "MIT" ]
null
null
null
scripts/build.js
height/best-response
64742d1fc92b611af0df06aa8da58d9a7a487614
[ "MIT" ]
null
null
null
const sh = require('./util').sh const rollup = require('rollup').rollup const rollupConfig = require('./rollup.config') const typescript = require('rollup-plugin-typescript2') const merge = require('lodash.merge') ;(async () => { await sh('npm run clean && npx rollup -c scripts/rollup.config.js') rollupEach([ { format: 'cjs', name: 'jsonuri', file: 'dist/index.common.js', _ts: { module: 'esnext' } }, { format: 'es', name: 'jsonuri', file: 'dist/index.mjs', _ts: { module: 'esnext', target: 'es2016' } } ]) await sh(`npx uglifyjs dist/index.js \ -c hoist_funs,hoist_vars \ -m \ -o dist/index.min.js`) })() function rollupEach (options) { options.forEach(async c => { const bundle = await rollup(genRollupConfig(c, c._ts)) await bundle.write(c) }) } function genRollupConfig (c, tsConfig) { const _rollupConfig = merge({}, rollupConfig, { output: c }) _rollupConfig.plugins[0] = typescript({ verbosity: 1, tsconfigOverride: { compilerOptions: Object.assign({ declaration: false }, tsConfig) } }) return _rollupConfig }
29.052632
106
0.644928
acc6043d8e39dc8679a39789e8c44a210de90293
6,136
js
JavaScript
packages/react-searchbox/examples/with-controlled-props/src/App.js
rabonas/searchbox
a54b6d29ac037d4a9509aa7afb2c43fbbd18fa61
[ "Apache-2.0" ]
1
2021-12-27T10:01:20.000Z
2021-12-27T10:01:20.000Z
packages/react-searchbox/examples/with-controlled-props/src/App.js
rabonas/searchbox
a54b6d29ac037d4a9509aa7afb2c43fbbd18fa61
[ "Apache-2.0" ]
null
null
null
packages/react-searchbox/examples/with-controlled-props/src/App.js
rabonas/searchbox
a54b6d29ac037d4a9509aa7afb2c43fbbd18fa61
[ "Apache-2.0" ]
null
null
null
import React, { Component } from 'react'; import { SearchBox, SearchComponent } from '@appbaseio/react-searchbox'; import ReactPaginate from 'react-paginate'; import './styles.css'; export class App extends Component { constructor(props) { super(props); this.state = { text: '' }; } render() { return ( <div> <div> <h2> React Searchbox Demo{`${this.state.text}`} <span style={{ fontSize: '1rem' }}> <a href="https://docs.appbase.io/docs/reactivesearch/react-searchbox/apireference/" target="_blank" rel="noopener noreferrer" > API reference </a> </span> </h2> <SearchBox id="search-component" dataField={[ { field: 'original_title', weight: 1 }, { field: 'original_title.search', weight: 3 } ]} title="Search" placeholder="Search for Books" size={5} value={this.state.text} onChange={(value, searchComponent, e) => { // Perform actions after updating the value this.setState( { text: value }, () => { // To update results searchComponent.triggerCustomQuery(); } ); }} /> <SearchComponent id="result-component" highlight dataField="original_title" size={10} react={{ and: ['search-component'] }} > {({ results, loading, size, setValue, setFrom }) => { return ( <div className="result-list-container"> {loading ? ( <div>Loading Results ...</div> ) : ( <div> {!results.data.length ? ( <div>No results found</div> ) : ( <p> {results.numberOfResults} results found in{' '} {results.time} ms </p> )} {results.data.map(item => ( <div className="flex book-content text-left" key={item._id} > <img src={item.image} alt="Book Cover" className="book-image" /> <div className="flex column justify-center" style={{ marginLeft: 20 }} > <div className="book-header" dangerouslySetInnerHTML={{ __html: item.original_title }} /> <div className="flex column justify-space-between"> <div> <div> by{' '} <span className="authors-list"> {item.authors} </span> </div> <div className="ratings-list flex align-center"> <span className="stars"> {Array(item.average_rating_rounded) .fill('x') .map((i, index) => ( <i className="fas fa-star" key={item._id + `_${index}`} /> )) // eslint-disable-line } </span> <span className="avg-rating"> ({item.average_rating} avg) </span> </div> </div> <span className="pub-year"> Pub {item.original_publication_year} </span> </div> </div> </div> ))} </div> )} <ReactPaginate pageCount={Math.floor(results.numberOfResults / size)} onPageChange={({ selected }) => setFrom((selected + 1) * size) } previousLabel="previous" nextLabel="next" breakLabel="..." breakClassName="break-me" marginPagesDisplayed={2} pageRangeDisplayed={5} subContainerClassName="pages pagination" breakLinkClassName="page-link" containerClassName="pagination" pageClassName="page-item" pageLinkClassName="page-link" previousClassName="page-item" previousLinkClassName="page-link" nextClassName="page-item" nextLinkClassName="page-link" activeClassName="active" /> </div> ); }} </SearchComponent> </div> </div> ); } } export default App;
35.674419
96
0.335724
acc64d0f0f75a944d2da6811fdbbd1dd4c1b0389
759
js
JavaScript
.eslintrc.js
AnonymousX86/jakub-suchenek
d882bcf445fdc4b05d86b8d5c1db305438071cbe
[ "MIT" ]
null
null
null
.eslintrc.js
AnonymousX86/jakub-suchenek
d882bcf445fdc4b05d86b8d5c1db305438071cbe
[ "MIT" ]
70
2021-08-03T00:29:55.000Z
2022-03-31T00:20:28.000Z
.eslintrc.js
AnonymousX86/jakub-suchenek
d882bcf445fdc4b05d86b8d5c1db305438071cbe
[ "MIT" ]
null
null
null
module.exports = { root: true, env: { browser: true, node: true, }, extends: [ "@nuxtjs/eslint-config-typescript", "plugin:nuxt/recommended", "prettier", ], plugins: [], rules: { "array-bracket-spacing": [ "error", "always", { "arraysInArrays": false, "objectsInArrays": false, "singleValue": false }], "brace-style": [ "error", "1tbs", { allowSingleLine: true }], "comma-spacing": [ "error", { "before": false, "after": true }], "curly": [ "error", "multi-or-nest" ], "object-curly-spacing": [ "error", "always", { "arraysInObjects": false, "objectsInObjects": false }], "prefer-const": "error", "quotes": [ "error", "double" ], "semi": [ "error", "never" ], "sort-vars": "error", }, }
30.36
127
0.566535