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
0d7a7282d5945c2f352cfca85e59e90789ae823e
1,047
js
JavaScript
node_modules/remark-parse-yaml/lib/index.js
themattmayfield/Docs
8995a2739df2c0b8e35a6740a9113651ea9f609d
[ "MIT" ]
null
null
null
node_modules/remark-parse-yaml/lib/index.js
themattmayfield/Docs
8995a2739df2c0b8e35a6740a9113651ea9f609d
[ "MIT" ]
28
2020-04-06T01:32:17.000Z
2022-03-24T11:35:11.000Z
ver01/materialuitry/node_modules/remark-parse-yaml/lib/index.js
pawsagainsthoomanity/atomic_design_assets
edc4894e31dfe7386fac36bd7ef65f4cc9ab31d0
[ "MIT" ]
null
null
null
'use strict'; var map = require('unist-util-map'); var yaml = require('js-yaml'); var yamlPlugin = function yamlPlugin(options) { options = options || {}; function transformer(ast) { return map(ast, function (node) { if (node.type == "yaml") { var parsedValue = yaml.safeLoad(node.value, 'utf8'); var newNode = Object.assign({}, node, { data: { parsedValue: parsedValue } }); return newNode; } else { return node; } }); } // Stringify for yaml var Compiler = this.Compiler; if (Compiler != null) { var visitors = Compiler.prototype.visitors; if (visitors) { visitors.yaml = function (node) { if (node.data && node.data.parsedValue) { var yml = yaml.safeDump(node.data.parsedValue); return '---\n' + yml + '---'; } }; } } return transformer; }; module.exports = yamlPlugin;
26.846154
94
0.499522
0d7c6dc25e2cac45b8e3ae3a62ec20fec243a7d1
558
js
JavaScript
CosimRisk/app/view/ResourceWarehousePanel.js
LUYUJIA/CosimRisk
add0ab8e975027679e1107c57656fe9211e699fb
[ "MIT" ]
null
null
null
CosimRisk/app/view/ResourceWarehousePanel.js
LUYUJIA/CosimRisk
add0ab8e975027679e1107c57656fe9211e699fb
[ "MIT" ]
null
null
null
CosimRisk/app/view/ResourceWarehousePanel.js
LUYUJIA/CosimRisk
add0ab8e975027679e1107c57656fe9211e699fb
[ "MIT" ]
null
null
null
Ext.define('CosimRisk.view.ResourceWarehousePanel', { extend: 'Ext.panel.Panel', alias: 'widget.ResourceWarehousePanel', id: 'ResourceWarehousePanel', title: '总资源管理', closable: true, autoScroll: true, bodyStyle: 'background:#E5E5E5;padding:0px', layout: 'border', items: [{ xtype: 'ResourceGrid', id: 'Warehouse_ResourceGrid', region: 'north' }, { xtype: "ResourceAddedPanel", id: 'ResourceAddedPanel', height: 120, region: 'south' }] });
27.9
55
0.578853
0d7c78ad998a69a5d5090ba1b6171a4d936bc1e3
214
js
JavaScript
projs/ExerciseRunner/ex/week1/15.js
shaharzil/protfolio
0d4b4c77b3f80576499082c6c072712b9fd2640b
[ "MIT" ]
null
null
null
projs/ExerciseRunner/ex/week1/15.js
shaharzil/protfolio
0d4b4c77b3f80576499082c6c072712b9fd2640b
[ "MIT" ]
null
null
null
projs/ExerciseRunner/ex/week1/15.js
shaharzil/protfolio
0d4b4c77b3f80576499082c6c072712b9fd2640b
[ "MIT" ]
null
null
null
'use strict'; console.log('Ex 15'); // Write a function that gets 2 numbers and return their sum function sum(num1, num2) { return num1 + num2; } var theSum = sum(8, 9); console.log('The sum is: ' + theSum);
19.454545
60
0.658879
0d7cc3ae391c56add3f907089e65ed697b032c5b
769
js
JavaScript
src/ext/joi.js
srph/react-validation-mixin
4c36e21d84246920cbfcc32a0ea58fb0c0076bb4
[ "BSD-3-Clause" ]
null
null
null
src/ext/joi.js
srph/react-validation-mixin
4c36e21d84246920cbfcc32a0ea58fb0c0076bb4
[ "BSD-3-Clause" ]
null
null
null
src/ext/joi.js
srph/react-validation-mixin
4c36e21d84246920cbfcc32a0ea58fb0c0076bb4
[ "BSD-3-Clause" ]
1
2022-01-08T19:00:03.000Z
2022-01-08T19:00:03.000Z
var Joi = require('joi'); var Vixin = require('../index'); /** * A validator which uses our boilerplate * with hapijs/joi * * @usage * * // https://github.com/hapijs/joi * var rules = { ...Joi Schema... } * React.createClass({ * mixins: [VixinJoi(rules)] * }); * * @param {Object} rules Rules to be provided to the mixin * @return {Object} Our mixin with Joi as validator */ module.exports = function(rules) { return Vixin(rules, function(data) { Joi.validate(data, rules, function(err, value) { // Joi states that when err is null, // then the object is valid. this.setState({ errors: err == null ? {} : err }) }.bind(this)); }, { isValid: function() { }, getValidationMessages: function() { } }); }
21.361111
58
0.596879
0d7cd6a8eb96a72a8c727972f9a9e322fdb1e8d6
9,159
js
JavaScript
src/js/tonejs/synths.js
ageller/Tonejs-synth-vis
c04bcd42920aa241afe999c472dd3f6d96b88bd7
[ "MIT" ]
null
null
null
src/js/tonejs/synths.js
ageller/Tonejs-synth-vis
c04bcd42920aa241afe999c472dd3f6d96b88bd7
[ "MIT" ]
null
null
null
src/js/tonejs/synths.js
ageller/Tonejs-synth-vis
c04bcd42920aa241afe999c472dd3f6d96b88bd7
[ "MIT" ]
null
null
null
var kickWaveform, kickFFT, kickInitialWaveform; var snareWaveform, snareFFT, snareInitialWaveform;; var bass, bassWaveform, bassFFT, bassInitialWaveform;; var piano, pianoWaveform, pianoFFT, pianoInitialWaveform;; var stepIndex = 0; var nSteps = 16 var beat = nSteps/8; var BPMfac = 6.; var currentPreset = 2; var toneTime = 0; var extendedContainerWidth = 500; //pixels var stepHeight = 100; //pixels var oscillatorMap = {0:"sine", 1:"square", 2:"triangle", 3:"sawtooth"}; var oscillatorMapReverse = {"sine":0, "square":1, "triangle":2, "sawtooth":3}; //to fix in error that comes up at the start bassInitialWaveform = {'getValue':function(){return null}}; //pulse oscillator looks like EB, with large width value var synthParams = {'kick':{ 'instrument':null, 'notes':['C2'], 'volume':-1, 'attack':0.1, 'decay':0.8, 'oscillator':'sine', 'color': [255,165,0], 'left':0, 'top':50, 'seed':1.111, 'starMesh':[], 'coronaMesh':[], }, 'snare':{ 'instrument':null, 'notes':[null], 'volume':-5, 'attack':0.001, 'decay':0.2, 'oscillator':'sine', 'color': [0,255,0], 'left':200, 'top':300, 'seed':2.222, 'starMesh':[], 'coronaMesh':[], }, 'bass':{ 'instrument':null, 'notes':['C3','E2','D2','C2','A1'], 'volume':-5, 'attack':0.1, 'decay':0.3, 'color': [0,0,255], 'oscillator':'custom', 'partials': [10,9,8,7,6,5,4,3,2,1], 'left':800, 'top':50, 'seed':3.333, 'starMesh':[], 'coronaMesh':[], }, 'piano':{ 'instrument':null, 'notes':['C4','D4','E4','F4','G4','A4','B4','C5'], 'volume':-6, 'attack':0.2, 'decay':0.4, 'color': [255,0,0], 'oscillator':'pulse', 'left':1000, 'top':300, 'seed':4.444, 'starMesh':[], 'coronaMesh':[], 'orbit':{'position1':[[0,0,0]],'position2':[[0,0,0]]}, }, }; var repeatList = ['kick', 'snare', 'bass', 'piano']; var visParams; var haveWaveVis = {'kick':false, 'snare':false, 'bass':false, 'piano':false}; var haveCircleVis = {'kick':false, 'snare':false, 'bass':false, 'piano':false}; //taken from the events example function defineInst(key){ //this seems necessary to avoid ringing that happens occasionally, but it also means that I can't smoothly change the knobs if (synthParams[key].instrument){ synthParams[key].instrument.dispose(); } //Note: Volume is in dB switch (key) { case 'kick': var kick = new Tone.MembraneSynth({ "pitchDecay" : 0.05 , "octaves" : 10 , "oscillator" : { "type" : synthParams[key].oscillator } , "envelope" : { "baseFrequency": 200, "attack" : synthParams[key].attack, "decay" : synthParams[key].decay, "sustain" : 0.02 , "release" : 0.04 , "attackCurve" : "exponential" }, "volume": synthParams[key].volume, }).toMaster(); //for visualizing kickFFT = new Tone.Analyser("fft", 1024); kickWaveform = new Tone.Analyser("waveform", 1024); kick.fan(kickWaveform, kickFFT); synthParams['kick'].instrument = kick; //can I get the initial waveform by playing it once? Tone.Offline(function(){ //only nodes created in this callback will be recorded var oscillator = new Tone.Oscillator(synthParams[key].notes[0], synthParams[key].oscillator).toMaster().start(0) kickInitialWaveform = new Tone.Analyser("waveform", 1024); oscillator.fan(kickInitialWaveform) }, 2).then(function(buffer){ defineVisParms(); if (!haveCircleVis['kick']) new p5(circleVis, 'kickVis'); if (!haveWaveVis['kick']) new p5(waveVis, 'kickWave'); }) break; case 'snare': var snare = new Tone.NoiseSynth({ "volume" : synthParams[key].volume, "oscillator" : { "type" : synthParams[key].oscillator } , "envelope" : { "attack" : synthParams[key].attack, "decay" : synthParams[key].decay, "sustain" : 0 }, "filterEnvelope" : { "attack" : 0.001, "decay" : 0.1, "sustain" : 0 } }).toMaster(); //for visualizing snareFFT = new Tone.Analyser("fft", 1024); snareWaveform = new Tone.Analyser("waveform", 1024); snare.fan(snareWaveform, snareFFT); synthParams['snare'].instrument = snare; //can I get the initial waveform by playing it once? Tone.Offline(function(){ //only nodes created in this callback will be recorded var oscillator = new Tone.Noise().toMaster().start(0) //var oscillator = new Tone.PulseOscillator("C3", 0.7).toMaster().start(0) snareInitialWaveform = new Tone.Analyser("waveform", 1024); oscillator.fan(snareInitialWaveform) }, 2).then(function(buffer){ defineVisParms(); if (!haveCircleVis['snare']) new p5(circleVis, 'snareVis'); if (!haveWaveVis['snare']) new p5(waveVis, 'snareWave'); }) break; case 'bass': var bass = new Tone.MonoSynth({ "oscillator" : { "type" : synthParams[key].oscillator, "partials": synthParams[key].partials } , "volume" : synthParams[key].volume, "envelope" : { "attack" : synthParams[key].attack, "decay" : synthParams[key].decay, "release" : 2 }, "filterEnvelope" : { "attack" : 0.001, "decay" : 0.01, "sustain" : 0.5, "bassFrequency": 200, "octaves" : 2.6, } }).toMaster(); //for visualizing bassFFT = new Tone.Analyser("fft", 1024); bassWaveform = new Tone.Analyser("waveform", 1024); bass.fan(bassWaveform, bassFFT); synthParams['bass'].instrument = bass; //can I get the initial waveform by playing it once? Tone.Offline(function(){ //only nodes created in this callback will be recorded var oscillator = new Tone.Oscillator(synthParams[key].notes[0], synthParams[key].oscillator) oscillator.partials = synthParams[key].partials; oscillator.toMaster().start(0) bassInitialWaveform = new Tone.Analyser("waveform", 1024); oscillator.fan(bassInitialWaveform) }, 2).then(function(buffer){ defineVisParms(); if (!haveCircleVis['bass']) new p5(circleVis, 'bassVis'); if (!haveWaveVis['bass']) new p5(waveVis, 'bassWave'); }) break; case 'piano': var piano = new Tone.PolySynth(8, Tone.Synth, { "volume" : synthParams[key].volume, "oscillator" : { "type" : synthParams[key].oscillator, } , "envelope" : { "attack" : synthParams[key].attack, "decay" : synthParams[key].decay, "release" : 2 }, }).toMaster(); piano.voices.forEach(function(v){ v.oscillator.width.value = 0.7; }) //for visualizing pianoFFT = new Tone.Analyser("fft", 1024); pianoWaveform = new Tone.Analyser("waveform", 1024); piano.fan(pianoWaveform, pianoFFT); synthParams['piano'].instrument = piano; //can I get the initial waveform by playing it once? Tone.Offline(function(){ //only nodes created in this callback will be recorded var oscillator = new Tone.OmniOscillator(synthParams[key].notes[0], synthParams[key].oscillator) oscillator.width.value = 0.7 oscillator.toMaster().start(0) pianoInitialWaveform = new Tone.Analyser("waveform", 1024); oscillator.fan(pianoInitialWaveform) }, 2).then(function(buffer){ defineVisParms(); if (!haveCircleVis['piano']) new p5(circleVis, 'pianoVis'); if (!haveWaveVis['piano']) new p5(waveVis, 'pianoWave'); }) break; } } function repeat(time) { //change the step boxes var stepDOMs = document.getElementsByClassName('step'); for (var i = 0; i < stepDOMs.length; i++) { stepDOMs[i].style.borderColor = "lightgray"; } repeatList.forEach(function(key){ var step = document.getElementById(key+"Container").querySelectorAll(".col" + stepIndex); for (var i=0; i<step.length; i+=1){ step[i].style.borderColor = 'black'; if (step[i].dataset.playMe == 'true') { //console.log(step[i], step[i].dataset.playMe, step[i].dataset.note, synthParams[key].instrument) if (key == 'snare') { synthParams[key].instrument.triggerAttackRelease(time); } else { synthParams[key].instrument.triggerAttackRelease(step[i].dataset.note, nSteps+'n', time); } } } }); stepIndex = (stepIndex + 1) % nSteps; toneTime = time; } function setupInst(key, controlsList, poly){ //the DOM elements setupDOM(key, synthParams[key].left, synthParams[key].top); //the instrument defineInst(key); //connect the controls setupControls(key, controlsList) //format the steps container and add the steps setupSteps(key, poly); } function initTonejs(){ setupInst('kick', ['volume', 'attack', 'decay', 'mute'], false); setupInst('snare', ['volume', 'attack', 'decay', 'mute'], false); setupInst('bass', ['volume', 'attack', 'decay', 'mute'], false); setupInst('piano', ['volume', 'attack', 'decay', 'mute'], true); loadPreset(null, currentPreset); defineVisParms(); //set the tempo Tone.Transport.bpm.value = nSteps*BPMfac; } function tonejsStart(){ initTonejs(); defineGUI(); Tone.Transport.scheduleRepeat(repeat, nSteps+'n'); //for step sequencing }
25.872881
124
0.624741
0d7d27b70fedca5055febc4ba8711f4c788102ac
7,180
js
JavaScript
src/transformers/jasmine-this.js
bjohn465/jest-codemods
b78fa86394d91c06b86882fed60268cffa357949
[ "MIT" ]
null
null
null
src/transformers/jasmine-this.js
bjohn465/jest-codemods
b78fa86394d91c06b86882fed60268cffa357949
[ "MIT" ]
null
null
null
src/transformers/jasmine-this.js
bjohn465/jest-codemods
b78fa86394d91c06b86882fed60268cffa357949
[ "MIT" ]
null
null
null
/** * Codemod for transforming Jasmine `this` context into Jest v20+ compatible syntax. */ import finale from '../utils/finale'; const testFunctionNames = ['after', 'afterEach', 'before', 'beforeEach', 'it', 'test']; const allFunctionNames = ['describe'].concat(testFunctionNames); const ignoredIdentifiers = ['retries', 'skip', 'slow', 'timeout']; const contextName = 'testContext'; function isFunctionExpressionWithinSpecificFunctions(path, acceptedFunctionNames) { if (!path || !path.parentPath || !Array.isArray(path.parentPath.value)) { return false; } const callExpressionPath = path.parentPath.parentPath; return ( !!callExpressionPath && !!callExpressionPath.value && callExpressionPath.value.callee && callExpressionPath.value.callee.type === 'Identifier' && acceptedFunctionNames.indexOf(callExpressionPath.value.callee.name) > -1 ); } function isWithinObjectOrClass(path) { const invalidParentTypes = ['Property', 'MethodDefinition']; let currentPath = path; while ( currentPath && currentPath.value && invalidParentTypes.indexOf(currentPath.value.type) === -1 ) { currentPath = currentPath.parentPath; } return currentPath ? invalidParentTypes.indexOf(currentPath.value.type) > -1 : false; } function isWithinSpecificFunctions(path, acceptedFunctionNames, matchAll) { if (!matchAll) { // Do not replace within functions declared as object properties or class methods // See `transforms plain functions within lifecycle methods` test if (isWithinObjectOrClass(path)) { return false; } } let currentPath = path; while ( currentPath && currentPath.value && currentPath.value.type !== 'FunctionExpression' ) { currentPath = currentPath.parentPath; } return ( isFunctionExpressionWithinSpecificFunctions(currentPath, acceptedFunctionNames) || (currentPath ? isWithinSpecificFunctions(currentPath.parentPath, testFunctionNames, false) : false) ); } export default function jasmineThis(fileInfo, api, options) { const j = api.jscodeshift; const root = j(fileInfo.source); const getValidThisExpressions = node => { return j(node) .find(j.MemberExpression, { object: { type: j.ThisExpression.name, }, property: { name: name => ignoredIdentifiers.indexOf(name) === -1, }, }) .filter(path => isWithinSpecificFunctions(path, allFunctionNames, true)); }; const mutateScope = (ast, body) => { const replacedIdentifiers = []; const updateThisExpressions = () => { return ast .find(j.MemberExpression, { object: { type: j.ThisExpression.name, }, }) .filter(path => isWithinSpecificFunctions(path, allFunctionNames, true)) .replaceWith(replaceThisExpression) .size(); }; const replaceThisExpression = path => { const name = path.value.property.name; replacedIdentifiers.push(name); return j.memberExpression( j.identifier(contextName), j.identifier(name), false ); }; const addDeclarations = () => { if (!replacedIdentifiers.length) { return; } body.unshift( j.expressionStatement( j.callExpression(j.identifier('beforeEach'), [ j.arrowFunctionExpression( [], j.blockStatement([ j.expressionStatement( j.assignmentExpression( '=', j.identifier(contextName), j.objectExpression([]) ) ), ]) ), ]) ) ); body.unshift( j.variableDeclaration('let', [ j.variableDeclarator(j.identifier(contextName), null), ]) ); }; updateThisExpressions(); addDeclarations(); }; const mutateDescribe = path => { const functionExpression = path.value.arguments.find( node => node.type === 'FunctionExpression' || node.type === 'ArrowFunctionExpression' ); const functionBody = functionExpression.body; const ast = j(functionBody); mutateScope(ast, functionBody.body); }; const updateRoot = () => { const topLevelLifecycleMethods = root .find(j.CallExpression, { callee: { type: j.Identifier.name, name: name => testFunctionNames.indexOf(name) > -1, }, }) // Find only lifecyle methods which are in the root scope .filter( path => path.parentPath.value.type === j.ExpressionStatement.name && Array.isArray(path.parentPath.parentPath.value) && path.parentPath.parentPath.parentPath.value.type === j.Program.name ) .filter(path => getValidThisExpressions(path.value).size() > 0) .size(); if (topLevelLifecycleMethods > 0) { const path = root.get(); mutateScope(root, path.value.program.body); return 1; } return 0; }; const updateDescribes = () => { return root .find(j.CallExpression, { callee: { type: j.Identifier.name, name: 'describe', }, }) .filter(path => getValidThisExpressions(path.value).size() > 0) .forEach(mutateDescribe) .size(); }; const updateFunctionExpressions = () => { return root .find(j.FunctionExpression) .filter(path => isFunctionExpressionWithinSpecificFunctions(path, allFunctionNames) ) .filter(path => !path.value.generator) .replaceWith(path => { const newFn = j.arrowFunctionExpression( path.value.params, path.value.body, path.value.expression ); newFn.async = path.value.async; return newFn; }) .size(); }; const mutations = updateRoot() + updateDescribes() + updateFunctionExpressions(); if (!mutations) { return null; } return finale(fileInfo, j, root, options); }
32.053571
90
0.518802
0d7e07cacbdb4f03cd8b33b25499e2accbd57997
461
js
JavaScript
src/client/__test__/components/ContactDetails.test.js
ganeshkhutwad/Contact_Dictionary
ba8646ddbf64ac7f6cb4611c9598466e46577609
[ "MIT" ]
1
2018-09-06T19:51:35.000Z
2018-09-06T19:51:35.000Z
src/client/__test__/components/ContactDetails.test.js
ganeshkhutwad/Contact_Dictionary
ba8646ddbf64ac7f6cb4611c9598466e46577609
[ "MIT" ]
null
null
null
src/client/__test__/components/ContactDetails.test.js
ganeshkhutwad/Contact_Dictionary
ba8646ddbf64ac7f6cb4611c9598466e46577609
[ "MIT" ]
null
null
null
/** Test `AddButton` Presentational Component. @author Ganesh Khutwad */ import React from 'react'; import { ContactDetails } from '../../components/ContactDetails'; const classes = { }; const list = { }; describe('`ContactDetails` Tests', () => { it('`ContactDetails` Snapshot', () => { const contactDetailsWrapper = shallow(<ContactDetails classes={classes} list={list} />); expect(contactDetailsWrapper).toMatchSnapshot(); }); });
27.117647
96
0.663774
0d7eba3c4a0f18d0b62f98001eef9213963239f2
2,063
js
JavaScript
src/app/VerticalNav.js
lushiyun/teamwork-frontend
c88bc8f804b38acfb1c29a1328d6943e24ef2acd
[ "MIT" ]
2
2021-01-11T04:10:02.000Z
2022-01-11T04:38:15.000Z
src/app/VerticalNav.js
lushiyun/teamwork-frontend
c88bc8f804b38acfb1c29a1328d6943e24ef2acd
[ "MIT" ]
null
null
null
src/app/VerticalNav.js
lushiyun/teamwork-frontend
c88bc8f804b38acfb1c29a1328d6943e24ef2acd
[ "MIT" ]
1
2021-08-22T19:38:55.000Z
2021-08-22T19:38:55.000Z
import React from 'react' import { makeStyles, useTheme } from '@material-ui/core/styles' import { Hidden, Drawer, Typography, Link, Toolbar } from '@material-ui/core' import TeamsList from '../features/teams/TeamsList' export const drawerWidth = 300 const useStyles = makeStyles((theme) => ({ drawer: { [theme.breakpoints.up('sm')]: { width: drawerWidth, flexShrink: 0, }, }, toolbar: theme.mixins.toolbar, drawerPaper: { width: drawerWidth, }, footer: { [theme.breakpoints.up('sm')]: { width: drawerWidth, flexShrink: 0, }, position: 'fixed', left: 0, bottom: 0, }, })) const VerticalNav = ({ handleDrawerToggle, container, open }) => { const classes = useStyles() const theme = useTheme() const footer = ( <Toolbar className={classes.footer}> <Typography variant="body2" color="textSecondary" align="center"> {'Copyright © '} <Link color="inherit" target="_blank" rel="noopener" href="https://medium.com/@lushiyun"> Shiyun Lu </Link>{' '} {new Date().getFullYear()} {'.'} </Typography> </Toolbar> ) const drawerContent = ( <div className={classes.toolbar}> <TeamsList /> {footer} </div> ) return ( <nav className={classes.drawer} aria-label="teams and messages folders"> <Hidden smUp implementation="css"> <Drawer container={container} variant="temporary" anchor={theme.direction === 'rtl' ? 'right' : 'left'} open={open} onClose={handleDrawerToggle} classes={{ paper: classes.drawerPaper, }}> {drawerContent} </Drawer> </Hidden> <Hidden xsDown implementation="css"> <Drawer classes={{ paper: classes.drawerPaper, }} variant="permanent" open> {drawerContent} </Drawer> </Hidden> </nav> ) } export default VerticalNav
22.922222
77
0.557441
0d7ed2d6a024ac33d2b1f6268c0c25d91422c094
15,769
js
JavaScript
web/dist/js/old/wx_forgetpassword.js
nongfadai/cordova
dcfde2d0c64219fd6f16f7fa2538f0b1be74d5a7
[ "MIT" ]
1
2015-06-04T05:38:04.000Z
2015-06-04T05:38:04.000Z
web/src/notuse/app/js/old/wx_forgetpassword.js
91blb/weixin
6290a69abcc056940d8d24105c1ee2c3cedf31e4
[ "Apache-2.0" ]
null
null
null
web/src/notuse/app/js/old/wx_forgetpassword.js
91blb/weixin
6290a69abcc056940d8d24105c1ee2c3cedf31e4
[ "Apache-2.0" ]
null
null
null
$(function(){ var $fp = $("#forgetpassword"); //验证码地址 var codePath = "/weixin/forgetpassword/captcha"; var request = { stepOneCheckPhone: "/weixin/forgetpassword/type/phone/param", //验证手机号码是否存在 stepOneVerify: "/weixin/forgetpassword/verifycode", //第一步验证数据有效性 stepOneSubmit: "/weixin/forgetpassword/step1", //第一步跳转第二步form的action stepTwoUrl: "/weixin/forgetpassword2", //第二步地址 stepTwoVerify: "/weixin/forgetpassword/verifyUserInfo", //第二步验证数据有效性 stepTwoCode: "/weixin/forgetpassword/sendcode", //第二步获取短信验证码 stepThreeUrl: "/weixin/forgetpassword", // stepThreeTimeout: "/weixin/forgetpassword/retryexceceed", //设置密码超时跳转地址 stepFour: "/weixin/forgetpassword/last", stepError: "/weixin/forgetpassword/retryexceceed", stepOK: "/weixin/forgetpassword/last" }; //验证码是否发送成功 var isCodeSend = false; //倒计时timer var isCountDown = null; //语音验证提示 var fpVoiceTip = $(".wx_fp_voice"); //初始化 function init(){ var step = $("#step").val(); if(step==1){ stepOne(); } else if(step==2){ stepTwo(); } else if(step==3){ stepThree(); } } init(); //找回密码第一步 function stepOne(){ var $codeImg =$("#captchaImg"); switchCode($codeImg); //tips var wxTips = $(".wx_tip"); var tipMobile = wxTips.eq(0); var tipCode = wxTips.eq(1); //手机号码 var inputMobile = "#mobile"; $fp.on("blur",inputMobile,function(){ check("mobile",$(this),tipMobile); }).on("focus",inputMobile,function(){ $(this).removeClass("input-error"); tipMobile.hide(); }); //图形验证码 var inputCaptcha = "#captcha"; $fp.on("blur",inputCaptcha,function(){ check("captcha",$(this),tipCode); }).on("focus",inputCaptcha,function(){ $(this).removeClass("input-error"); tipCode.hide(); }); //单击更换图形验证码 $codeImg.on("click",function(){ switchCode($codeImg); }); //第一步:下一步 var fpStepOneNext = "#fpStepOneNext"; $fp.on("click",fpStepOneNext,function(){ var $this = $(this); var checked = true; if($this.hasClass("wx_btn_disabled")){ return; } if(!check("mobile",$(inputMobile),tipMobile)){ checked = false; } if(!check("captcha",$(inputCaptcha),tipCode)){ checked = false; } if(!checked){ return false; } var formOne = $("#formOne"); var param = {}; param["mobile"] = $(inputMobile).val(); param["randomCode"] = $(inputCaptcha).val(); //先ajax验证手机号码,才提交下一步 checkPhone(param["mobile"],$(inputMobile),tipMobile,submitStepOne); //提交第一步 function submitStepOne(){ $.ajax({ type:"POST", url:request.stepOneVerify+"?"+new Date().getTime(), data:param, beforeSend: function(){ tipCode.hide(); }, success: function(data){ if(data=="0"){ //成功 formOne.attr("action",request.stepOneSubmit).submit(); return; } if(data=="5"){ tip(tipMobile,"请输入您的手机号码");//手机号为空 } else if(data=="10"){ tip(tipCode,"请输入图形验证码");//验证码为空 } else if(data=="11"){ tip(tipCode,"请输入正确的图形验证码"); switchCode($codeImg); } else if(data=="12"){ tip(tipCode,"请输入正确的图形验证码");//session中验证码不存在 switchCode($codeImg); } $this.removeClass("wx_btn_disabled"); }, error:function(xhr,err){ tip(tipCode,"网络异常,请重试..."); $this.removeClass("wx_btn_disabled"); } }); } }); } //找回密码第二步 function stepTwo(){ //用户名 var username = "#username"; var tipUsername = $("#tipUsername"); $fp.on("blur",username,function(){ check("username",$(this),tipUsername); }).on("focus",username,function(){ $(this).removeClass("input-error"); tipUsername.hide(); }); //身份证号码 var idcard = "#idcard"; var tipIDCard = $("#tipIDCard"); $fp.on("blur",idcard,function(){ //check("idcard",$(this),tipIDCard); }).on("focus",idcard,function(){ $(this).removeClass("input-error"); tipIDCard.hide(); }); //短信验证码 var tipMobileCode = $("#tipMobileCode"); var mobileCode = "#mobileCode"; $fp.on("blur",mobileCode,function(){ check("mobileCode",$(this),tipMobileCode); }).on("focus",mobileCode,function(){ $(this).removeClass("input-error"); tipMobileCode.hide(); }); //获取短信验证码按钮 $fp.on("click","#getMobileCode",function(){ if($(this).hasClass("wx_btn_disabled")){ return false; } $(this).attr("sendCode","true"); fpVoiceTip.eq(0).show(); sendCode($(this),tipMobileCode); }); //获取语音验证码 $fp.on("click","#sendVoice",function(){ sendCode($("#getMobileCode"),tipMobileCode,true); }); //提交二 var fpStepOneNext = "#fpStepTwoNext"; $fp.on("click",fpStepOneNext,function(){ var $this = $(this); var checked = true; if($this.hasClass("wx_btn_disabled")){ return false; } //验证用户名是否为空 if($(username)[0]){ if(!check("username",$(username),tipUsername)){ checked = false; } } //验证身份证号码是否为空 /* if($(idcard)[0]){ if(!check("idcard",$(idcard),tipIDCard)){ checked = false; } } */ //提交时验证短信是否为空 if(!check("mobileCode",$(mobileCode),tipMobileCode)){ checked = false; } if(!checked){ return false; } //验证是否有获取短信验证码 if(!isCodeSend){ tip(tipMobileCode,"请获取短信验证码"); return false; } var param = {}; param["userName"] = $(username).val(); param["idNumber"] = $(idcard).val(); param["randomCode"] = $(mobileCode).val(); //提交 $.ajax({ type:"POST", url:request.stepTwoVerify+"?"+new Date().getTime(), data:param, beforeSend: function(){ $this.addClass("wx_btn_disabled"); }, success: function(data){ if(data=="0"){ //tip(tipMobileCode,"用户信息校验成功"); location.href = request.stepTwoUrl+"?"+new Date().getTime(); return; } if(data=="5"){ tip(tipMobileCode,"请输入您的手机号码");//手机号为空 } else if(data=="9"){ tip(tipMobileCode,"请刷新页面后重试");//用户信息为空 } else if(data=="10"){ tip(tipMobileCode,"请输入短信验证码");//校验码为空 } else if(data=="11"){ tip(tipMobileCode,"请输入正确的短信验证码");//校验码不匹配 } else if(data=="12"){ tip(tipMobileCode,"请输入正确的短信验证码");//session中不存在对应的验证码 } else if(data=="18"){ tip(tipIDCard,"请输入您的身份证号码");//身份证号为空 } else if(data=="19"){ tip(tipIDCard,"您输入的身份证号与账户不对应");//身份证号码不匹配 } else if(data=="20"){ location.href = request.stepError; //tip(tipMobileCode,"校验次数超过当日最大限制"); } else if(data=="21"){ tip(tipUsername,"请输入正确的用户名");//用户名为空 } else if(data=="22"){ tip(tipUsername,"请输入正确的用户名");//用户名不匹配 } $this.removeClass("wx_btn_disabled"); }, error:function(xhr,err){ tip(tipMobileCode,"网络异常,请重试..."); $this.removeClass("wx_btn_disabled"); } }); }); } //找回密码第三步 function stepThree(){ //新密码 var password = "#password"; var tipPassword = $("#tipPassword"); var tipInfo = $(".wx_tip_pass"); $fp.on("blur",password,function(){ var checkpass = check("password",$(this),tipPassword); if(!checkpass){ $(this).next().removeClass("input-checking-ok").hide(); tipInfo.eq(0).hide(); } else { $(this).next().addClass("input-checking-ok").show(); tipInfo.eq(0).hide(); } }).on("focus",password,function(){ $(this).next().removeClass("input-checking-ok").hide(); $(this).removeClass("input-error"); tipPassword.hide(); tipInfo.eq(0).show(); }); //确认新密码 var password2 = "#password2"; var tipPassword2 = $("#tipPassword2"); $fp.on("blur",password2,function(){ var checkpass = check("password",$(this),tipPassword2); if(!checkpass){ $(this).next().removeClass("input-checking-ok").hide(); } else if($(password).val()!==$(password2).val()) { $(this).next().removeClass("input-checking-ok").hide(); tip(tipPassword2,"两次密码输入不一致"); } else { $(this).next().addClass("input-checking-ok").show(); } tipInfo.eq(1).hide(); }).on("focus",password2,function(){ $(this).next().removeClass("input-checking-ok").hide(); $(this).removeClass("input-error"); tipPassword2.hide(); tipInfo.eq(1).show(); }); //提交三 var fpStepOneNext = "#fpStepThreeNext"; $fp.on("click",fpStepOneNext,function(){ var $this = $(this); if($this.hasClass("wx_btn_disabled")){ return false; } //提交时验证密码 var pass1 = $.trim($(password).val()); var pass2 = $.trim($(password2).val()); var checkpass = check("password",$(password),tipPassword); var checkpass2 = check("password",$(password2),tipPassword2); if(!checkpass || !checkpass2){ return false; } //判断密码是否一致 if(pass1!==pass2){ tip($(tipPassword2),"两次密码输入不一致"); return false; } var param = {}; param["userName"] = $("#userName").val(); param["password"] = RSAUtils.pwdEncode(pass1); param["confirmPassword"] = RSAUtils.pwdEncode(pass2); //提交 $.ajax({ type:"POST", url:request.stepThreeUrl+"?"+new Date().getTime(), data:param, beforeSend: function(){ $(".wx_tip").hide(); $this.addClass("wx_btn_disabled"); }, success: function(data){ if(data=="0"){ //更新密码成功 location.href=" request.stepOK; return; } if(data=="1"){ tip(tipPassword2,"更新密码失败"); } else if(data=="9"){ tip(tipPassword2,"请刷新页面后重试");//用户信息为空(需要刷新页面) } else if(data=="11"){ tip(tipPassword2,"短信验证码不正确");//校验码不匹配 } else if(data=="13"){ tip(tipPassword2,"请输入密码");//用户密码为空 } else if(data=="14"){ tip(tipPassword2,"请输入正确的密码格式");//用户密码格式错误 } else if(data=="15"){ tip(tipPassword2,"两次密码输入不一致");//用户密码与确认密码不匹配 } else if(data=="17"){ tip(tipPassword2,"非法请求,请刷新页面后重试");//非法的更新请求(需要刷新页面) } $this.removeClass("wx_btn_disabled"); }, error:function(xhr,err){ if(err=="timeout"){ location.href = request.stepThreeTimeout; } else { tip(tipPassword2,"网络异常,请重试..."); $this.removeClass("wx_btn_disabled"); } } }); }); } //获取短信验证码 function sendCode($this,$tip,voice){ var mobile = $("#mobile").val(); var param = {}; param["mobile"] = mobile; if(voice){ param["type"] = "wechat_pvoice"; } else { param["type"] = "wechat_phone"; } $.ajax({ url:request.stepTwoCode+"?"+new Date().getTime(), data:param, type:"POST", beforeSend: function(){ $tip.hide(); if(voice){ fpVoiceTip.eq(0).hide(); fpVoiceTip.eq(1).show(); } if(!isCountDown){ $this.html("发送验证码...").addClass("wx_btn_disabled"); } }, success: function(data){ if(data=="0"){ //发送校验码成功 isCodeSend = true; tip($("#tipStepTwo"),"验证码已发送,请查收手机短信","wx_tip2"); countdown($this,data); return; } if(data=="1"){ tip($tip,"发送校验码失败"); } else if(data=="2"){ tip($tip,"获取短信验证码失败,请刷新页面后重试");/*非正常跳转用户,禁止发送短信*/ } else if(data=="3"){ tip($tip,"发送验证码间隔不能小于60s"); } else if(data=="5"){ tip($tip,"请输入您的手机号码");//手机号为空 } else if(data=="8"){ tip($tip,"提交参数无效");//提交参数无效(验证类型无法识别) } else if(data=="9"){ tip($tip,"请刷新页面后重试");//用户信息为空 } else { tip($tip,"发送校验码失败,请重试!"); } resetSendBtn($this); }, error:function(xhr,err){ tip($tip,"发送校验码失败,请重试!"); resetSendBtn($this); } }); } //重置发送短信验证码按钮 function resetSendBtn($this){ $this.removeClass("wx_btn_disabled").html("获取验证码"); } //验证码倒计时 function countdown($this,data){ if(isCountDown){ clearInterval(isCountDown); } //按钮倒计时 $this.addClass("wx_btn_disabled").html("获取验证码("+$this.attr("left_time_int")+"秒)"); $this.countdown("left_time_int",function($this,str,timer){ if(isCountDown===null){ isCountDown = timer; } $this.html("获取验证码("+str+")"); if(str=="0秒"){ isCountDown = null; resetSendBtn($this); fpVoiceTip.hide(); } },true); } //ajax验证手机号码 function checkPhone(phone,$this,$tip,callback){ $tip.hide(); $this.attr("disabled","disabled"); var url = request.stepOneCheckPhone+"/"+phone; var fpStepOneNext = $("#fpStepOneNext"); $.ajax({ type:"GET", url : url+"?"+new Date().getTime(), beforeSend: function(){ fpStepOneNext.addClass("wx_btn_disabled"); }, success : function(data){ $this.removeAttr("disabled"); if(data=="0"){ if($.type(callback)==="function"){ callback(data); } return; } if(data=="5"){ tip($tip,"请输入您的手机号码");//手机号为空 } else if(data=="6"){ tip($tip,"请输入正确的手机号码");//手机格式错误 } else if(data=="7"){ tip($tip,"该手机号码没有对应的账户"); } fpStepOneNext.removeClass("wx_btn_disabled"); }, error : function(){ $this.removeAttr("disabled"); fpStepOneNext.removeClass("wx_btn_disabled"); tip(tipStepOne,"网络异常,请刷新页面重试..."); } }); } //验证表单 function check(type,$this,$tip){ var checked = true,error=""; var fn = {}; fn["error"] = function(obj,tipObj,error){ obj.addClass("input-error"); tip(tipObj,error); return false; }; //验证手机 fn["mobile"] = function(){ var phone = $this.val(); var phoneReg = /(^[1][3][0-9]{9}$)|(^[1][4][0-9]{9}$)|(^[1][5][0-9]{9}$)|(^[1][8][0-9]{9}|17[0-9]{9}$)/; if(phone === ""){ checked = false; error = "请输入与账户绑定的手机号码"; } else { if(!phoneReg.test(phone)){ checked = false; error = "请输入正确的手机号码"; } } if(!checked){ return fn.error($this,$tip,error); } return true; }; //验证用户名 fn["username"] = function(){ var username = $this.val(); if(username===""){ checked = false; error = "请输入您的用户名"; } if(!checked){ return fn.error($this,$tip,error); } return true; }; //验证身份证号码 fn["idcard"] = function(){ var idcard = $.trim($this.val()); if(idcard===""){ checked = false; error = "请输入实名登录的身份证号码"; } else { if(!$.validate.idCard(idcard)){ checked = false; error = "请输入正确的身份证号码"; } } if(!checked){ return fn.error($this,$tip,error); } return true; }; //验证短信 fn["mobileCode"] = function(){ var code = $this.val(); if(code===""){ checked = false; error = "请输入短信验证码"; } else { if(code.length<4){ checked = false; error = "请输入正确的短信验证码"; } } if(!checked){ return fn.error($this,$tip,error); } return true; }; //验证图形验证码 fn["captcha"] = function(){ var captcha = $.trim($this.val()); if(captcha === ""){ checked = false; error = "请输入图形验证码"; } else { if(captcha.length<4){ checked = false; error = "请输入正确的图形验证码"; } } if(!checked){ return fn.error($this,$tip,error); } return true; }; //检测密码 fn["password"] = function(){ var p = $this.val(); var passWord1=/^\d+$/, passWord2=/^[a-z]+$/, passWord3=/^[A-Z]+$/, passWord4=/^[^0-9a-zA-Z]+$/, passWord5=/\s/, passWord6=/[\u4e00-\u9fa5]/; if(p.length<6||p.length>20){ checked = false; error = "请输入6~20个字符的密码"; } if(passWord1.test(p)){ checked = false; error = "密码不能为纯数字"; } if(passWord2.test(p)){ checked = false; error = "密码不能为纯小写字母"; } if(passWord3.test(p)){ checked = false; error = "密码不能为纯大写字母"; } if(passWord4.test(p)){ checked = false; error = "密码不能为纯符号"; } if(passWord5.test(p)){ checked = false; error = "密码不能包含空格"; } if(passWord6.test(p)){ checked = false; error = "密码不能包含中文"; } if(!checked){ return fn.error($this,$tip,error); } return true; }; if(type && $.type(fn[type])=="function"){ return fn[type](); } else { return true; } } //刷新验证码 function switchCode($codeImg) { $codeImg.attr("src", codePath+"?" + new Date().getTime()); } //提示信息 function tip(obj,text,cla){ if($.type(obj)==="undefined"){ return; } if(text){ obj.removeClass("wx_tip2").html(text).show(); if(cla){ obj.addClass(cla); } } return obj; } });
24.794025
107
0.580126
0d815304b6e63b77448d262d3a92cd7b86d43bfa
1,433
js
JavaScript
src/components/Intro/index.js
chengluyu/gossip
0e00a59d1deb5d1c9c3c49532efa0c2fba8ccd3f
[ "MIT" ]
null
null
null
src/components/Intro/index.js
chengluyu/gossip
0e00a59d1deb5d1c9c3c49532efa0c2fba8ccd3f
[ "MIT" ]
null
null
null
src/components/Intro/index.js
chengluyu/gossip
0e00a59d1deb5d1c9c3c49532efa0c2fba8ccd3f
[ "MIT" ]
null
null
null
import { Icon, Button } from "antd"; import classNames from "./index.css"; import { connect } from "dva"; export default connect(({ global }) => ({ locales: global.locales, lang: global.lang, }))(function({ height, locales, lang }) { const styles = { container: { height, }, header: { height: 60, }, content: { minHeight: height, }, }; return ( <div className={classNames.container} style={styles.container}> <header className={classNames.header} style={styles.header}> <div className={classNames.logo}>Gossip</div> <Icon className={classNames.icon} type="github" onClick={() => window.open("https://github.com/pearmini/gossip")} /> </header> <div className={classNames.content} style={styles.content}> <div className={classNames.title}> <h1 className={classNames.big}>Gossip</h1> <p>{locales.HEADER_INFO[lang]}</p> <Button type="primary">{locales.BIG_SCREEN[info]}</Button> </div> <div className={classNames.imageWrapper}> <img src="https://i.loli.net/2020/03/26/uFrys8ReZdghXL3.png" width="65%" className={classNames.top} /> <img src="https://i.loli.net/2020/03/26/YzhWKcCUMvH8m9D.png" width="65%" /> </div> </div> </div> ); });
28.66
75
0.553385
0d8156485f9354a1ccc91f1806c7756ea9882ec1
646
js
JavaScript
Clock/thinkswell/sript.js
Ratheshan03/javascript-mini-projects
a9888af3b8f0d476bddebb37432459a84194f4ce
[ "Unlicense" ]
219
2020-10-07T19:04:11.000Z
2022-03-31T23:16:56.000Z
Clock/thinkswell/sript.js
Ratheshan03/javascript-mini-projects
a9888af3b8f0d476bddebb37432459a84194f4ce
[ "Unlicense" ]
137
2020-10-07T04:12:44.000Z
2022-02-20T18:21:35.000Z
Clock/thinkswell/sript.js
Ratheshan03/javascript-mini-projects
a9888af3b8f0d476bddebb37432459a84194f4ce
[ "Unlicense" ]
265
2020-10-07T07:43:46.000Z
2022-03-22T08:33:39.000Z
const secHand = document.querySelector(".sec"); const minHand = document.querySelector(".min"); const hrsHand = document.querySelector(".hrs"); function setTime() { const now = new Date(); const sec = now.getSeconds(); const min = now.getMinutes(); const hrs = now.getHours(); console.log(`${hrs} ${min} ${sec}`); const secDegree = (sec / 60) * 360; const minDegree = (min / 60) * 360; const hrsDegree = (hrs / 12) * 360; secHand.style.transform = `rotate(${secDegree + 90}deg)`; minHand.style.transform = `rotate(${minDegree}deg)`; hrsHand.style.transform = `rotate(${hrsDegree}deg)`; } setInterval(setTime, 1000);
29.363636
59
0.657895
0d81c0e417e7d4d64f6f5dbd52a350cfebf4625f
1,647
js
JavaScript
Contact/common/services/common-business-partner-data-service.js
15920824726/Contact
7c72cc5853276b8d6fcd0230dbf6b9cfc3a14a1e
[ "Apache-2.0" ]
null
null
null
Contact/common/services/common-business-partner-data-service.js
15920824726/Contact
7c72cc5853276b8d6fcd0230dbf6b9cfc3a14a1e
[ "Apache-2.0" ]
null
null
null
Contact/common/services/common-business-partner-data-service.js
15920824726/Contact
7c72cc5853276b8d6fcd0230dbf6b9cfc3a14a1e
[ "Apache-2.0" ]
null
null
null
/** * Created by yar on 6/23/2016. */ (function () { 'use strict'; angular.module('App.common').factory('commonBusinessPartnerDataService', ['CommonDataService', function (CommonDataService) { var service = new CommonDataService(); var totalRecords = 0; var companies = {}; var parrent,bpname; service.setTotalRecords = function (data) { totalRecords = data; }; service.getTotalRecords = function () { return totalRecords; }; service.setCompanies = function (data) { companies = data; }; service.getCompanies = function () { return companies; }; service.setTotalRecords = function (data) { totalRecords = data; }; service.getTotalRecords = function () { return totalRecords; }; service.setParrent=function(data){ parrent=data; } service.returnParrent=function(){ return parrent; } service.setBpName=function(tempname){ bpname=tempname; } service.returnBpName=function(){ return bpname; } return service; } ]); })(angular);
27
77
0.414693
0d8335ec2c577a8266cb72316bd40bfd1cef60b1
1,314
js
JavaScript
src/server/apiRoutes/users/resetPassword.js
yo8568/react-express-seed
dc02fa77d5bfb13d7aa4619af67aee61cfc98992
[ "MIT" ]
null
null
null
src/server/apiRoutes/users/resetPassword.js
yo8568/react-express-seed
dc02fa77d5bfb13d7aa4619af67aee61cfc98992
[ "MIT" ]
null
null
null
src/server/apiRoutes/users/resetPassword.js
yo8568/react-express-seed
dc02fa77d5bfb13d7aa4619af67aee61cfc98992
[ "MIT" ]
null
null
null
import express from 'express'; import httpStatus from 'http-status-codes'; let router = new express.Router(); router.post('/users/resetPassword', (req, res) => { var logger = req.app.get('logger'); var config = req.app.get('config'); var actions = req.app.get('actions'); var models = req.app.get('models'); req.checkGroup('email'); var errors = req.validationErrors(); if (errors) { return res.status(httpStatus.UNPROCESSABLE_ENTITY).end(); } var email = req.body.email; actions.users.list({ where: { email: email, status: models.user.STATUS.ACTIVE } }, (err, users) => { if(err) { logger.error('DB error find reset user password configrmation', err); return res.status(httpStatus.INTERNAL_SERVER_ERROR).end(); } if(!users || users.length === 0) { return res.status(httpStatus.NOT_FOUND).end(); } actions.users.createResetPasswordToken({ id: users[0].id }, (err, tokenResponse) => { actions.users.sendResetPasswordEmail({ token: tokenResponse, targetEmail: users[0].email }, (error, response) => { if(error) { logger.error('send reset password email error', error); } res.status(httpStatus.OK).end(); }); }); }); }); export default router;
26.816327
75
0.61796
0d8352178d58d4b8b1834453e5d44b8abfad9317
6,595
js
JavaScript
lib/hash-assets-plugin/index.js
AFE-GmdG/a-new-life
22f3e5590ff6a5ec2c96f5855ad9e51dde36fe3c
[ "MIT" ]
1
2019-10-27T17:09:46.000Z
2019-10-27T17:09:46.000Z
lib/hash-assets-plugin/index.js
a-friedel/a-new-life
22f3e5590ff6a5ec2c96f5855ad9e51dde36fe3c
[ "MIT" ]
null
null
null
lib/hash-assets-plugin/index.js
a-friedel/a-new-life
22f3e5590ff6a5ec2c96f5855ad9e51dde36fe3c
[ "MIT" ]
null
null
null
const path = require("path"); const pluginName = "hash-assets-plugin"; const hotUpdateTester = /\.hot-update\.(js|json)$/; function crc32FromString(str, hex) { let crc = ~0, i; for (i = 0, l = str.length; i < l; i++) { crc = (crc >>> 8) ^ crc32tab[(crc ^ str.charCodeAt(i)) & 0xff]; } crc = Math.abs(crc ^ -1); return hex ? crc.toString(16) : crc; } function crc32FromBuffer(buffer, hex) { let crc = ~0, i; for (i = 0, l = buffer.byteLength; i < l; i++) { crc = (crc >>> 8) ^ crc32tab[(crc ^ buffer[i]) & 0xff]; } crc = Math.abs(crc ^ -1); return hex ? crc.toString(16) : crc; } const crc32tab = [ 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d ]; function HashAssetsPlugin(options) { this.options = Object.assign({}, { path: __dirname, filename: "hashes.json", prettyPrint: false, exclude: /\.(?:map)$/i }, options); } HashAssetsPlugin.prototype = { constructor: HashAssetsPlugin, apply: function (compiler) { const options = this.options; compiler.hooks.afterEmit.tapAsync(pluginName, (compilation, callback) => { const targetPath = compilation.compiler.outputFileSystem.join(options.path || compilation.compiler.outputPath, options.filename); const assets = compilation.assets; let hashMap = {}; for (let key in assets) { if (hotUpdateTester.test(key)) { continue; } const outputFilePath = path.resolve(compilation.compiler.outputPath, key); const relativeFilePath = path.relative(options.path || compilation.compiler.outputPath, outputFilePath); if (!options.exclude.test(relativeFilePath)) { const relativeUrl = relativeFilePath.replace(/\\/, "/"); const value = assets[key].source(); if (typeof value === "string") { hashMap[relativeUrl] = crc32FromString(value, true); } else if (value instanceof Buffer) { hashMap[relativeUrl] = crc32FromBuffer(value, true); } else { // Fallback if i did not get any source. hashMap[relativeUrl] = new Date().getTime().toString(16); } } } try { // Im webpack-dev-server existiert ein MemoryFileSystem, welches auch existsSync und readFileSync // bereitstellt. Leider ist das Dateisystem im webpack ohne den DevServer ein NodeOutputFileSystem, // welches die beiden Funktionen nicht bereitstellt. In diesem Fall liegen die Compileergebnisse // aber auf der echten Festplatte und ich kann auf das Standard Filesystem aus Node zurückgreifen. const fs = compilation.compiler.outputFileSystem.constructor.name === "MemoryFileSystem" ? compilation.compiler.outputFileSystem : require("fs"); if (fs.existsSync && fs.readFileSync && fs.existsSync(targetPath)) { const oldContent = fs.readFileSync(targetPath, "utf8"); const oldHashMap = (oldContent && JSON.parse(oldContent)) || {}; hashMap = { ...oldHashMap, ...hashMap }; } } catch (e) { // Ignore any error - the hashMap is calculated only with the compilation assets. } const newContent = JSON.stringify(hashMap, undefined, options.prettyPrint ? '\t' : ''); const output = Buffer.from(newContent, "utf8"); compilation.compiler.outputFileSystem.writeFile(targetPath, output, callback); }); } }; module.exports = HashAssetsPlugin;
41.740506
135
0.71539
0d83da09c967efaabb583cd0eda45029ef647176
2,931
js
JavaScript
src/pages/quotation/components/HistroryListItem.js
ZoeDL/FitcReact
e49378af274953376c6a6dee78aeb86315e733e1
[ "MIT" ]
null
null
null
src/pages/quotation/components/HistroryListItem.js
ZoeDL/FitcReact
e49378af274953376c6a6dee78aeb86315e733e1
[ "MIT" ]
null
null
null
src/pages/quotation/components/HistroryListItem.js
ZoeDL/FitcReact
e49378af274953376c6a6dee78aeb86315e733e1
[ "MIT" ]
null
null
null
/* * @Author: zhangyuhao * @Date: 2018-03-26 11:30:26 * @Last Modified by: zhangyuhao * @Last Modified time: 2018-03-26 14:45:08 * 成交逐笔的item */ 'use strict'; import React from 'react'; import styles from './ListItem.less'; import { Button } from 'antd-mobile'; import convertUtil from '../../../utils/convertUtil'; import DateUtil from '../../../utils/dateUtil'; class HistoryListItem extends React.PureComponent { onItemClick = () => { const { onClick } = this.props; onClick && onClick(); } render() { const {item} =this.props; return ( <div className={styles.itemWrapper} onClick={ this.onItemClick }> <div className={ styles.top }> <div className={styles.smallGroup}> <Button className={styles.smallButton} size="small" inline >{convertUtil.ticketTypeConvert(item.ticketType)} </Button> <Button className={styles.smallButton} size="small" inline type="ghost">{convertUtil.paymentTypeConvert(item.bankType)} </Button> <Button className={styles.smallButton} size="small" inline type="ghost">{convertUtil.tradeModeConvert(item.tradeMode)} </Button> </div> <div className={convertUtil.getTradeStatusColor('4')}>交易成功</div> </div> <div className={styles.middle}> <div> <div className={styles.middleTitle}>票面总额(万)</div> <div>{item.ticketPrice/10000}</div> </div> <div> <div className={styles.middleTitle}>剩余天数</div> <div>{this.displayRestDay()}</div> </div> <div> <div className={styles.middleTitle}>报价利率(%)</div> <div>{item.dealRate.toFixed(2)}</div> </div> </div> <div className={styles.bottom}> <div>发起时间:{DateUtil.format(DateUtil.formatToDate(item.transferDate),'yyyy-MM-dd')}</div> <div>交易编号:{item.inquriyNo}</div> </div> </div> ) } displayRestDay(){ const {item} =this.props; if(item.maxRestDay!==item.minRestDay){ return `${item.minRestDay}~${item.maxRestDay}` }else{ return item.minRestDay } } } export default HistoryListItem;
36.6375
109
0.451723
0d8420cb35e644a100c3017e5fec114ac930a6f3
1,007
js
JavaScript
day1/3-express/src/app.js
sahibinden-com-node-egitimi/sources
043d09a391a21e52eb6d077422a826620bf65db6
[ "MIT" ]
null
null
null
day1/3-express/src/app.js
sahibinden-com-node-egitimi/sources
043d09a391a21e52eb6d077422a826620bf65db6
[ "MIT" ]
null
null
null
day1/3-express/src/app.js
sahibinden-com-node-egitimi/sources
043d09a391a21e52eb6d077422a826620bf65db6
[ "MIT" ]
1
2022-03-28T10:03:50.000Z
2022-03-28T10:03:50.000Z
import express from 'express'; import bodyParser from 'body-parser'; import createError from 'http-errors'; import path from 'path'; // routes import Index from './routes'; import Users from './routes/users'; import Settings from './routes/settings'; const app = express(); app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'pug'); app.use(express.static('src/public')); app.use(bodyParser.urlencoded({ extended: false })); app.use('/', Index); app.use('/users', Users); app.use('/settings', Settings); // catch 404 and forward to error handler app.use(function (req, res, next) { next(createError(404)); }); // error handler app.use(function (err, req, res, next) { // set locals, only providing error in development res.locals.message = err.message; res.locals.error = req.app.get('env') === 'development' ? err : {}; // render the error page res.status(err.status || 500); res.json(err); }); app.listen(3000, () => console.log('Server is up on 3000 PORT! '));
25.820513
69
0.677259
0d8451564767985f8142eb4a144abc5d62aa3411
1,226
js
JavaScript
src/components/Search.js
lewihansel/movie_app
26e9c46d0591db19d5baf59ea2e4875e6f0848aa
[ "MIT" ]
null
null
null
src/components/Search.js
lewihansel/movie_app
26e9c46d0591db19d5baf59ea2e4875e6f0848aa
[ "MIT" ]
null
null
null
src/components/Search.js
lewihansel/movie_app
26e9c46d0591db19d5baf59ea2e4875e6f0848aa
[ "MIT" ]
null
null
null
import React, { useState } from "react"; import { Input, Flex, Button } from "@chakra-ui/core"; const Search = ({search, loading}) => { const [searchValue, setSearchValue] = useState(""); const handleSearchInputChanges = (e) => { setSearchValue(e.target.value); }; const callSearchFunction = (e) => { e.preventDefault(); search(searchValue); //this is the triger function for our movie list component }; const onKeyUp = (e) => { if (e.key === "Enter") { search(searchValue); } }; return ( <Flex align="center" justify="center" my="2rem"> <Input id="searchmov" placeholder="search by title" value={searchValue} onChange={handleSearchInputChanges} onKeyPress={onKeyUp} type="text" focusBorderColor="teal.400" maxW={{ base: "10rem", sm: "30rem" }} /> <Button variantColor="teal" variant="solid" onClick={callSearchFunction} isLoading={loading} loadingText="searching" type="submit" mx="0.5rem" px="2rem" minW="5rem" maxW="7rem" > Find Movie! </Button> </Flex> ); }; export default Search;
23.132075
83
0.566884
0d847a0ea321ba4e2f1140d09489488236166860
776
js
JavaScript
packages/boxBoxCollision2D/1.0/components.js
ClockworkDev/ClockworkPackages
c01da108177391b69255acfb37621fef2014e463
[ "MIT" ]
null
null
null
packages/boxBoxCollision2D/1.0/components.js
ClockworkDev/ClockworkPackages
c01da108177391b69255acfb37621fef2014e463
[ "MIT" ]
2
2017-07-10T20:57:54.000Z
2017-09-04T15:17:28.000Z
boxBoxCollision2D.js
ClockworkDev/OfficialClockworkPackages
3e5e0f8f941423cd708b162fd5ce0375ab1151f2
[ "MIT" ]
null
null
null
CLOCKWORKRT.collisions.register({ shape1: "box", shape1dataSchema: { x: "<The x coordinate of the box>", y: "<The y coordinate of the box>", w: "<The width of the box>", h: "<The height of the box>" }, shape2: "box", shape2dataSchema: { x: "<The x coordinate of the box>", y: "<The y coordinate of the box>", w: "<The width of the box>", h: "<The height of the box>" }, description: "The collision happens when one box overlaps with the other.", detector: function (b1, b2, data) { if (!((b1.x + b1.w) > b2.x && (b2.x + b2.w) > b1.x && (b1.y + b1.h) > b2.y && (b2.y + b2.h) > b1.y)) { return false; } else { return true; } } });
32.333333
110
0.5
0d85c188697c6060bf2afb3dbd807ff4612f31fe
776
js
JavaScript
database/models/booktour.js
4akhilkumar/4akhilkumar.github.io
fb45124531850ffc2c717963201f9854c23864da
[ "MIT" ]
null
null
null
database/models/booktour.js
4akhilkumar/4akhilkumar.github.io
fb45124531850ffc2c717963201f9854c23864da
[ "MIT" ]
1
2022-03-02T10:07:07.000Z
2022-03-02T10:07:07.000Z
models/booktour.js
4akhilkumar/WhiN-Heroku
ad6e598aa825d4020b7f03e9dfe5f3677c996254
[ "MIT" ]
1
2022-02-21T08:51:06.000Z
2022-02-21T08:51:06.000Z
const mongoose = require('mongoose'); const Schema = mongoose.Schema let booktourSchema = new Schema({ userid :{ type:Schema.Types.ObjectId, required:true }, place :{ type:String, required:true }, name :{ type:String, required:true }, money :{ type:String, required:true }, phone :{ type:Number, required:true }, doa :{ type:String, required:true }, dod :{ type:String, required:true }, email :{ type:String, required:true }, lplace :{ type:String, required:true } }) booktourSchema=mongoose.model("booktours",booktourSchema); module.exports=booktourSchema;
17.244444
58
0.527062
0d8625082d9e0b5262db1f11cd4da73d1183a77a
628
js
JavaScript
lib/rss.js
emberwatch/broccoli-plugins-server
25dec42cd8e94860f67a1c87d4aa66dac897b387
[ "MIT" ]
null
null
null
lib/rss.js
emberwatch/broccoli-plugins-server
25dec42cd8e94860f67a1c87d4aa66dac897b387
[ "MIT" ]
null
null
null
lib/rss.js
emberwatch/broccoli-plugins-server
25dec42cd8e94860f67a1c87d4aa66dac897b387
[ "MIT" ]
null
null
null
var RSS = require('rss'); var RssFeed = function(options) { this.options = options || {}; this.feed = new RSS(options); }; RssFeed.prototype.appendItem = function(item) { this.feed.item({ title: item.name, description: item.description, url: 'https://npmjs.org/package/' + item.name, author: item._npmUser.name, date: item.time.created }); }; RssFeed.prototype.getXml = function(items) { items.sort(function(a, b) { return b.time.created - a.time.created; }); items.forEach(function(item) { this.appendItem(item); }, this); return this.feed.xml(); }; module.exports = RssFeed;
20.933333
50
0.649682
0d86423eb1569c3768a63640d6c6848604f30301
217
js
JavaScript
ContactsApp/src/redux-store/reducers/index.js
MustaMohamed/phone-contacts-list-task
05dddfcb1ecb6908723edacaaa0aa52562560aed
[ "MIT" ]
null
null
null
ContactsApp/src/redux-store/reducers/index.js
MustaMohamed/phone-contacts-list-task
05dddfcb1ecb6908723edacaaa0aa52562560aed
[ "MIT" ]
null
null
null
ContactsApp/src/redux-store/reducers/index.js
MustaMohamed/phone-contacts-list-task
05dddfcb1ecb6908723edacaaa0aa52562560aed
[ "MIT" ]
null
null
null
import { combineReducers } from 'redux'; import { app } from './app.reducer'; import { contacts } from './contacts.reducer'; const rootReducer = combineReducers ({ app, contacts }); export default rootReducer;
18.083333
46
0.700461
0d869afbabcd73e5f6786b074dd2dfe285480926
224
js
JavaScript
config/server.dev.js
willin/up.js.cool
ce0c297299fac967a478c83cd02e5710a730d73d
[ "Apache-2.0" ]
10
2017-07-13T00:44:31.000Z
2020-04-12T10:16:52.000Z
config/server.dev.js
willin/up.js.cool
ce0c297299fac967a478c83cd02e5710a730d73d
[ "Apache-2.0" ]
1
2019-01-07T16:47:22.000Z
2019-01-07T16:47:22.000Z
config/server.dev.js
willin/up.js.cool
ce0c297299fac967a478c83cd02e5710a730d73d
[ "Apache-2.0" ]
1
2020-04-12T10:17:10.000Z
2020-04-12T10:17:10.000Z
exports.cdn = 'http://localhost:4124/'; exports.redis = { host: '127.0.0.1', port: 6379, db: 2 }; exports.mysql = { host: '127.0.0.1', user: 'root', password: 'root', database: 'up' }; exports.dingBot = '';
13.176471
39
0.5625
0d872049ec746fa202b37b33c6540025ac61b301
321
js
JavaScript
src/components/Jsx.js
davidlondonor/reacthooks0tohero
a61d123423b89f585cb2368998a6ae5681c678d9
[ "MIT" ]
null
null
null
src/components/Jsx.js
davidlondonor/reacthooks0tohero
a61d123423b89f585cb2368998a6ae5681c678d9
[ "MIT" ]
3
2021-03-10T09:00:22.000Z
2022-02-27T00:13:52.000Z
src/components/Jsx.js
davidlondonor/reacthooks0tohero
a61d123423b89f585cb2368998a6ae5681c678d9
[ "MIT" ]
null
null
null
import React, { Fragment } from "react"; const Jsx = () => { //const saludo = "Hola Monstro"; const temperatura = 21; return ( <Fragment> <h1>Frio o Calor?</h1> <h4>{temperatura > 20 ? "Sí, que calor" : "No, que frio"}</h4> </Fragment> ); }; export default Jsx;
20.0625
74
0.510903
0d8974b5523b58aa38496ede98098a20e91fe73d
2,488
js
JavaScript
color-admin/assets/plugins/password-indicator/js/password-indicator.js
irfanbukaide/rsc
453ac20ac28fad960b43d269f07abcf0ba8a1578
[ "MIT" ]
null
null
null
color-admin/assets/plugins/password-indicator/js/password-indicator.js
irfanbukaide/rsc
453ac20ac28fad960b43d269f07abcf0ba8a1578
[ "MIT" ]
null
null
null
color-admin/assets/plugins/password-indicator/js/password-indicator.js
irfanbukaide/rsc
453ac20ac28fad960b43d269f07abcf0ba8a1578
[ "MIT" ]
null
null
null
$.fn.passwordStrength = function (options) { return this.each(function () { var that = this; that.opts = {}; that.opts = $.extend({}, $.fn.passwordStrength.defaults, options); that.div = $(that.opts.targetDiv); that.defaultClass = that.div.attr('class'); that.percents = (that.opts.classes.length) ? 100 / that.opts.classes.length : 100; v = $(this) .keyup(function () { if (typeof el == "undefined") this.el = $(this); var s = getPasswordStrength(this.value); var p = this.percents; var t = Math.floor(s / p); if (100 <= s) t = this.opts.classes.length - 1; this.div .removeAttr('class') .addClass(this.defaultClass) .addClass(this.opts.classes[t]); }) .after('<a href="#">Generate Password</a>') .next() .click(function () { $(this).prev().val(randomPassword()).trigger('keyup'); return false; }); }); function getPasswordStrength(H) { var D = (H.length); if (D > 5) { D = 5 } var F = H.replace(/[0-9]/g, ""); var G = (H.length - F.length); if (G > 3) { G = 3 } var A = H.replace(/\W/g, ""); var C = (H.length - A.length); if (C > 3) { C = 3 } var B = H.replace(/[A-Z]/g, ""); var I = (H.length - B.length); if (I > 3) { I = 3 } var E = ((D * 10) - 20) + (G * 10) + (C * 15) + (I * 10); if (E < 0) { E = 0 } if (E > 100) { E = 100 } return E } function randomPassword() { var chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$_+"; var size = 10; var i = 1; var ret = "" while (i <= size) { $max = chars.length - 1; $num = Math.floor(Math.random() * $max); $temp = chars.substr($num, 1); ret += $temp; i++; } return ret; } }; $.fn.passwordStrength.defaults = { classes: Array('is10', 'is20', 'is30', 'is40', 'is50', 'is60', 'is70', 'is80', 'is90', 'is100'), targetDiv: '#passwordStrengthDiv', cache: {} }
28.272727
100
0.422428
0d8acd63f7b986385d9249ae3b1418fd79e5d0d5
8,768
js
JavaScript
raheem/src/styles/dashboard/filter.js
SoosheBot/Raheem
d18c6be564b6307a9b2428fea8369e607dc23d28
[ "MIT" ]
null
null
null
raheem/src/styles/dashboard/filter.js
SoosheBot/Raheem
d18c6be564b6307a9b2428fea8369e607dc23d28
[ "MIT" ]
18
2020-03-24T15:07:26.000Z
2020-04-29T14:53:18.000Z
raheem/src/styles/dashboard/filter.js
SoosheBot/Raheem
d18c6be564b6307a9b2428fea8369e607dc23d28
[ "MIT" ]
2
2020-03-18T21:50:13.000Z
2020-04-30T14:58:04.000Z
import styled from 'styled-components'; export const FilterContainer = styled.div` width: 100%; position: absolute; top: 0; z-index: 99; background: #ffffff; box-shadow: 1px 0px 4px 1px #111111; `; export const TopBar = styled.div` width: 100%; height: 3.6rem; background: #555555; `; export const FilterTop = styled.div` font-family: 'neuzeit-grotesk', sans-serif; width: 100%; display: flex; flex-direction: column; align-items: flex-start; margin-bottom: 7.4rem; .close { font-family: 'neuzeit-grotesk', sans-serif; width: 100%; padding: 0 20px; height: 4.7rem; display: flex; align-items: center; border-bottom: 1px solid #C4C4C4; .exit { width: 15%; height: 4.7rem; display: flex; align-items: center; justify-content: flex-end; font-size: 2rem; &:hover { cursor: pointer; } } .top-text { width: 85%; height: 4.7rem; display: flex; align-items: center; p { font-size: 1.8rem; line-height: 2.4rem; letter-spacing: -0.196364px; color: #111111; } } } .matched-stories { padding: 0 20px; width: 100%; height: 3.6rem; font-family: 'neuzeit-grotesk', sans-serif; border-bottom: 1px solid #C4C4C4; display: flex; align-items: center; p { font-size: 1.6rem; line-height: 2.2rem; color: #111111; } } `; export const FilterHeading = styled.h2` font-family: 'neuzeit-grotesk', sans-serif; font-weight: 900; font-size: 2.6rem; line-height: 2.8rem; letter-spacing: -0.283636px; color: #000000; padding: 0 20px; margin-bottom: 2.4rem; `; export const GroupInputContainer = styled.div` width: 100%; margin-bottom: 5rem; padding: 0 20px; font-family: 'neuzeit-grotesk', sans-serif; .inp-text { font-size: 3rem; line-height: 1.8rem; letter-spacing: -0.166667px; color: #000000; } h3 { font-size: 1.8rem; font-weight: normal; line-height: 2.4rem; letter-spacing: -0.196364px; color: #111111; border-bottom: 1px solid #C4C4C4; padding-bottom: 0.1rem; margin-bottom: 1.4rem; } .inputs { display: grid; grid-template-columns: 50% 50%; /* Customize the label (the container) */ .container { display: block; position: relative; padding-top: 0.4rem; padding-left: 35px; margin-top: 1rem; margin-bottom: 12px; cursor: pointer; color: #000000; font-size: 1.4rem; line-height: 1.8rem; letter-spacing: -0.166667px; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } /* Hide the browser's default checkbox */ .container input { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; } /* Create a custom checkbox */ .checkmark { position: absolute; top: 0; left: 0; height: 24px; width: 24px; background-color: #C4C4C4; border-radius: 0.6rem; } /* Create the checkmark/indicator (hidden when not checked) */ .checkmark:after { content: ""; position: absolute; display: none; } /* Show the checkmark when checked */ .container input:checked ~ .checkmark:after { display: block; } /* Style the checkmark/indicator */ .container .checkmark:after { left: 9px; top: 5px; width: 5px; height: 10px; border: solid #000000; border-width: 0 3px 3px 0; -webkit-transform: rotate(45deg); -ms-transform: rotate(45deg); transform: rotate(45deg); } } `; export const FilterSearch = styled.div` width: 100%; display: flex; flex-direction: column; align-items: center; .query { width: 100%; display: flex; padding: 0 20px; input[type=text] { width: 85%; height: 3.6rem; background: #F2F2F2; border: none; padding-left: 0.5rem; font-size: 1.6rem; font-family: 'neuzeit-grotesk', sans-serif; &:focus { outline: none; border: 1px solid #FFF600; } } .search { width: 15%; height: 3.6rem; display: flex; justify-content: center; align-items: center; background: #F2F2F2; img { width: 100%; height: 2rem; object-fit: contain; } } } .filter { margin-top: 2.5rem; width: 100%; height: 3.6rem; background: #F2F2F2; font-family: 'neuzeit-grotesk', sans-serif; display: flex; justify-content: space-evenly; div { width: 45%; text-align: center; &:hover { cursor: pointer; } p { font-size: 1.4rem; line-height: 3.4rem; letter-spacing: 0.36px; color: #555555; span { font-weight: 900; } } } } `; export const Controls = styled.div` width: 100%; padding: 0 20px; display: flex; justify-content: space-evenly; align-items: center; margin: 11.9rem 0 3.2rem; `; export const SortContainer = styled.div` width: 100%; padding: 0 20px; display: flex; .inputs { width: 100%; margin-top: 1rem; /* Customize the label (the container) */ .container { font-family: 'neuzeit-grotesk', sans-serif; display: block; position: relative; padding-left: 35px; margin-bottom: 12px; cursor: pointer; font-size: 1.6rem; line-height: 2.2rem; color: #111111; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; border-bottom: 1px solid #C4C4C4; padding-top: 1rem; .inp-text { position: relative; top: -8px; } } /* Hide the browser's default radio button */ .container input { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; } /* Create a custom radio button */ .checkmark { position: absolute; top: 0; left: 0; height: 25px; width: 25px; border-radius: 50%; } /* When the radio button is checked, add a blue background */ .container input:checked ~ .checkmark { // background-color: #111111; } /* Create the indicator (the dot/circle - hidden when not checked) */ .checkmark:after { content: ""; position: absolute; display: none; } /* Show the indicator (dot/circle) when checked */ .container input:checked ~ .checkmark:after { display: block; } /* Style the indicator (dot/circle) */ .container .checkmark:after { top: 9px; left: 9px; width: 8px; height: 8px; border-radius: 50%; background: #111111; } } `; export const SortTop = styled.div` font-family: 'neuzeit-grotesk', sans-serif; width: 100%; display: flex; flex-direction: column; align-items: flex-start; .close { font-family: 'neuzeit-grotesk', sans-serif; width: 100%; padding: 0 20px; height: 4.7rem; display: flex; align-items: center; border-bottom: 1px solid #C4C4C4; .exit { width: 15%; height: 4.7rem; display: flex; align-items: center; justify-content: flex-end; font-size: 2rem; &:hover { cursor: pointer; } } .top-text { width: 85%; height: 4.7rem; display: flex; align-items: center; p { font-size: 1.8rem; line-height: 2.4rem; letter-spacing: -0.196364px; color: #111111; } } } `;
22.424552
77
0.501255
0d8ba310209499858290fcf444b174423add8827
3,036
js
JavaScript
lib/networks/actions/index.js
baumannsven/hcloud-js
d666d280793f229f5a5874bea36eafef5c27909b
[ "MIT" ]
45
2018-01-26T12:35:26.000Z
2022-03-18T09:18:38.000Z
lib/networks/actions/index.js
baumannsven/hcloud-js
d666d280793f229f5a5874bea36eafef5c27909b
[ "MIT" ]
32
2018-01-25T16:57:45.000Z
2021-08-24T10:12:23.000Z
lib/networks/actions/index.js
thegreenwebfoundation/hcloud-js
d666d280793f229f5a5874bea36eafef5c27909b
[ "MIT" ]
16
2018-02-21T18:19:59.000Z
2021-12-27T08:40:35.000Z
const { snakeCase } = require('snake-case') const Action = require('../../actions/action') const NetworkActionList = require('./networkActionList') class NetworkActionsEndpoint { constructor (client) { this.client = client } async list (id, params) { const snakeCaseParams = {} if (params) { Object.keys(params).forEach(key => { snakeCaseParams[snakeCase(key)] = params[key] }) } const response = await this.client.axios({ url: '/networks/' + id + '/actions', method: 'GET', params: snakeCaseParams }) const actions = [] response.data.actions.forEach(action => actions.push(new Action(action))) const meta = response.data.meta return new NetworkActionList(this, params, meta, id, actions) } async get (networkID, actionID) { const response = await this.client.axios({ url: '/networks/' + networkID + '/actions/' + actionID, method: 'GET' }) // Return new Action instance return new Action(response.data.action) } async addSubnet (id, type, ipRange, networkZone = 'eu-central') { const response = await this.client.axios({ url: '/networks/' + id + '/actions/add_subnet', method: 'POST', data: { type, ip_range: ipRange, network_zone: networkZone } }) // Return new Action instance return new Action(response.data.action) } async deleteSubnet (id, ipRange) { const response = await this.client.axios({ url: '/networks/' + id + '/actions/delete_subnet', method: 'POST', data: { ip_range: ipRange } }) // Return new Action instance return new Action(response.data.action) } async addRoute (id, destination, gateway) { const response = await this.client.axios({ url: '/networks/' + id + '/actions/add_route', method: 'POST', data: { destination, gateway } }) // Return new Action instance return new Action(response.data.action) } async deleteRoute (id, destination, gateway) { const response = await this.client.axios({ url: '/networks/' + id + '/actions/delete_route', method: 'POST', data: { destination, gateway } }) // Return new Action instance return new Action(response.data.action) } async changeIPRange (id, ipRange) { const response = await this.client.axios({ url: '/networks/' + id + '/actions/change_ip_range', method: 'POST', data: { ip_range: ipRange } }) // Return new Action instance return new Action(response.data.action) } async changeNetworkProtection (id, disableDelete) { const response = await this.client.axios({ url: '/networks/' + id + '/actions/change_protection', method: 'POST', data: { delete: disableDelete } }) // Return new Action instance return new Action(response.data.action) } } module.exports = NetworkActionsEndpoint
24.288
77
0.608366
0d8edb043449b33d6ec7c4fe7676f4338ecfd7b4
1,474
js
JavaScript
commands/flowa.js
MouadElJanati/Oni-beta
c1192bba9f05625790162b862a2815e1ee66d71b
[ "MIT" ]
1
2022-01-07T04:02:03.000Z
2022-01-07T04:02:03.000Z
commands/flowa.js
MouadElJanati/Oni-beta
c1192bba9f05625790162b862a2815e1ee66d71b
[ "MIT" ]
null
null
null
commands/flowa.js
MouadElJanati/Oni-beta
c1192bba9f05625790162b862a2815e1ee66d71b
[ "MIT" ]
null
null
null
const axios = require("axios"); const helper = require("../helper.js"); const config = require("../config.json"); const FLOWA_MAX = 1000; var Discord = require("discord.js"); const pexels_api = axios.create({ baseURL: "https://api.pexels.com/v1/", }); module.exports = { command: "flowa", description: "Show a random flower picture. Images from <https://pexels.com/>.", usage: "[optional tags separated by space]", example: { run: "flowa sakura tree", result: "Returns a random picture of a sakura tree.", }, configRequired: ["credentials.pexels_key"], call: (obj) => { return new Promise((resolve, reject) => { let { argv } = obj; let query = "flower nature"; let max = FLOWA_MAX; if (argv.length > 1) { query += " " + argv.slice(1).join(" "); max = 50; } pexels_api .get("search", { params: { query: query, per_page: 1, page: helper.getRandomInt(1, max), }, headers: { Authorization: config.credentials.pexels_key, }, }) .then((response) => { let photos = response.data.photos; const embed = new Discord.RichEmbed() .setTitle("Flowa🌸") .setColor(0xe0e0e0) ///0x00ff40 (ok) | 0xff3e3e(fail)////// .setImage(response.data.photos[0].src.original); if (photos.length == 0) reject("No results"); else resolve(embed); }) .catch((err) => { helper.error(err); reject("Couldn't connect to Pexels API"); }); }); }, };
25.413793
69
0.597015
0d8f3f608e2f17d45da775fc74f3e1e340b7e605
1,007
js
JavaScript
node_modules/@react-icons/all-files/cg/CgGym.js
syazwanirahimin/dotcom
162acf4500655ec965d27bd1e45ef0415963d346
[ "MIT" ]
null
null
null
node_modules/@react-icons/all-files/cg/CgGym.js
syazwanirahimin/dotcom
162acf4500655ec965d27bd1e45ef0415963d346
[ "MIT" ]
null
null
null
node_modules/@react-icons/all-files/cg/CgGym.js
syazwanirahimin/dotcom
162acf4500655ec965d27bd1e45ef0415963d346
[ "MIT" ]
null
null
null
// THIS FILE IS AUTO GENERATED var GenIcon = require('../lib').GenIcon module.exports.CgGym = function CgGym (props) { return GenIcon({"tag":"svg","attr":{"viewBox":"0 0 24 24","fill":"none"},"child":[{"tag":"path","attr":{"d":"M20.2739 9.86883L16.8325 4.95392L18.4708 3.80676L21.9122 8.72167L20.2739 9.86883Z","fill":"currentColor"}},{"tag":"path","attr":{"d":"M18.3901 12.4086L16.6694 9.95121L8.47783 15.687L10.1985 18.1444L8.56023 19.2916L3.97162 12.7383L5.60992 11.5912L7.33068 14.0487L15.5222 8.31291L13.8015 5.8554L15.4398 4.70825L20.0284 11.2615L18.3901 12.4086Z","fill":"currentColor"}},{"tag":"path","attr":{"d":"M20.7651 7.08331L22.4034 5.93616L21.2562 4.29785L19.6179 5.445L20.7651 7.08331Z","fill":"currentColor"}},{"tag":"path","attr":{"d":"M7.16753 19.046L3.72607 14.131L2.08777 15.2782L5.52923 20.1931L7.16753 19.046Z","fill":"currentColor"}},{"tag":"path","attr":{"d":"M4.38208 18.5549L2.74377 19.702L1.59662 18.0637L3.23492 16.9166L4.38208 18.5549Z","fill":"currentColor"}}]})(props); };
167.833333
884
0.701092
0d8f91d61c9782510606ab39a0070fcba61cf982
890
js
JavaScript
src/server/app.js
PAI-ULL/2020-2021-pai-mvc-alberto-cruz-jeremy-luis
5a11d9e4f5ede7e417ac587d70ccfe4bd21b3cb2
[ "MIT" ]
null
null
null
src/server/app.js
PAI-ULL/2020-2021-pai-mvc-alberto-cruz-jeremy-luis
5a11d9e4f5ede7e417ac587d70ccfe4bd21b3cb2
[ "MIT" ]
null
null
null
src/server/app.js
PAI-ULL/2020-2021-pai-mvc-alberto-cruz-jeremy-luis
5a11d9e4f5ede7e417ac587d70ccfe4bd21b3cb2
[ "MIT" ]
null
null
null
/** * University of La Laguna * Computer engineering Degree * Interactive application programming * Project: Presentation of MVC * @author Alberto Cruz Luis * @email alu0101217734@ull.edu.es * * @author Jeremy Manuel Luis Leon * @email alu0101244587@ull.edu.es * * @since * @link * @description * * Server */ 'use strict'; import express from 'express'; import path, {dirname} from 'path'; import {fileURLToPath} from 'url'; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); const HOST = '127.0.0.1'; const PORT = 3000; // const IP_ADRESS = ''; const app = express(); app.use(express.static(path.join(__dirname, '../TicTacToe'))); app.use(express.static(path.join(__dirname, '../formas'))); app.use(express.static(path.join(__dirname, '../src'))); app.listen(PORT, HOST); console.log(`Running server at http://${HOST}:` + PORT);
23.421053
62
0.696629
0d8ff93523a3ff6edaacf3ff4e5e1ddfa0006964
3,397
js
JavaScript
client/src/components/User/UserProfile.js
branjames117/bashhub
ffe8a2676ace5c9f4d515b5f8c4adba1fc4b5354
[ "Unlicense" ]
1
2022-03-11T11:39:11.000Z
2022-03-11T11:39:11.000Z
client/src/components/User/UserProfile.js
branjames117/bashhub
ffe8a2676ace5c9f4d515b5f8c4adba1fc4b5354
[ "Unlicense" ]
12
2022-03-11T04:24:29.000Z
2022-03-28T03:14:07.000Z
client/src/components/User/UserProfile.js
branjames117/bashhub
ffe8a2676ace5c9f4d515b5f8c4adba1fc4b5354
[ "Unlicense" ]
null
null
null
import { useEffect, useState } from 'react'; import { useParams } from 'react-router-dom'; import { useQuery } from '@apollo/client'; import { QUERY_USER } from '../../utils/queries'; import { Grid, Paper, Typography } from '@mui/material'; import UserBio from './UserBio'; import UserProfilePicture from './UserProfilePicture'; import Banner from './Banner'; import Loading from '../Loading'; import DateFormatter from '../../utils/dateFormat'; import Auth from '../../utils/auth'; export default function UserProfile({ myUsername }) { const { username } = useParams(); const { data: userData, loading } = useQuery(QUERY_USER, { variables: { username: username }, }); const [owned, setOwned] = useState(false); useEffect(() => { // is logged in user same as profile? if so, give them control if (username === myUsername) { setOwned(true); } else { setOwned(false); } }, [myUsername, username, loading, userData]); return loading || !userData.user ? ( <Loading /> ) : ( <Grid container spacing={3}> {/* Profile Picture */} <Grid item xs={12} sm={5} md={4} lg={3}> <UserProfilePicture owned={owned} currAvatar={userData?.user?.avatar} /> </Grid> {/* Bio */} <Grid item xs={12} sm={7} md={8} lg={9}> <UserBio username={username} owned={owned} currBio={userData?.user?.bio} /> </Grid> {/* Event's I'm Managing */} {Auth.loggedIn() && owned && ( <Grid item xs={12}> <Paper sx={{ p: 2, display: 'flex', flexDirection: 'column' }}> <Typography variant='h5'>Events I'm Managing</Typography> {userData && userData?.user?.eventsManaged.map((event) => ( <Banner key={event._id} _id={event._id} slug={event.slug} hero={event.hero} name={event.name} eventType={event.eventType} startDate={DateFormatter.getDate(event.startDate)} startTime={DateFormatter.getTime(event.startTime)} endDate={DateFormatter.getDate(event.endDate)} endTime={DateFormatter.getTime(event.endTime)} location={event.location} /> ))} </Paper> </Grid> )} {/* Events I'm Attending */} {Auth.loggedIn() && owned && ( <Grid item xs={12}> <Paper sx={{ p: 2, display: 'flex', flexDirection: 'column' }}> <Typography variant='h5'>Events I'm Attending</Typography> {userData && userData?.user?.eventsAttending.map((event) => ( <Banner key={event._id} _id={event._id} slug={event.slug} hero={event.hero} name={event.name} eventType={event.eventType} startDate={DateFormatter.getDate(event.startDate)} startTime={DateFormatter.getTime(event.startTime)} endDate={DateFormatter.getDate(event.endDate)} endTime={DateFormatter.getTime(event.endTime)} location={event.location} /> ))} </Paper> </Grid> )} </Grid> ); }
33.303922
80
0.526936
0d901f6df012b278cd3fb80d1f48ebb46807cfb3
258
js
JavaScript
src/components/not-found/no-page.js
genesisschaerrer/bottega-capstone
2dbb992bcf600773d5f04f2aa89b43d2d6a2ba47
[ "MIT" ]
null
null
null
src/components/not-found/no-page.js
genesisschaerrer/bottega-capstone
2dbb992bcf600773d5f04f2aa89b43d2d6a2ba47
[ "MIT" ]
null
null
null
src/components/not-found/no-page.js
genesisschaerrer/bottega-capstone
2dbb992bcf600773d5f04f2aa89b43d2d6a2ba47
[ "MIT" ]
null
null
null
import React from "react" const NoPage = () => { return ( <div className="no-page-container"> <div className='oops'>Opps...</div> <div className="messege">PAGE NOT FOUND</div> </div> ) } export default NoPage
21.5
57
0.554264
0d912436c3817dec20741a14ad839c0cb3fba618
1,248
js
JavaScript
Open Sim/sdk/doc/html_user/classOpenSim_1_1BallJoint.js
GSimas/EEL7125
21e933337665a93947c3b8e3c31416b0c79c003f
[ "MIT" ]
null
null
null
Open Sim/sdk/doc/html_user/classOpenSim_1_1BallJoint.js
GSimas/EEL7125
21e933337665a93947c3b8e3c31416b0c79c003f
[ "MIT" ]
null
null
null
Open Sim/sdk/doc/html_user/classOpenSim_1_1BallJoint.js
GSimas/EEL7125
21e933337665a93947c3b8e3c31416b0c79c003f
[ "MIT" ]
null
null
null
var classOpenSim_1_1BallJoint = [ [ "clone", "classOpenSim_1_1BallJoint.html#a6dc8365f82ad28ab74ace3da0568563f", null ], [ "extendAddToSystem", "classOpenSim_1_1BallJoint.html#a77accb7de90d1d1077bed0d852c0e1af", null ], [ "extendInitStateFromProperties", "classOpenSim_1_1BallJoint.html#aad1d30692360ad620fd7f22a34943ba0", null ], [ "extendSetPropertiesFromState", "classOpenSim_1_1BallJoint.html#a7fa7d3e0aae41ae7f2dda0327b8f457b", null ], [ "getConcreteClassName", "classOpenSim_1_1BallJoint.html#adce7c32bbd7bf920f8427e5615c65b84", null ], [ "getCoordinate", "classOpenSim_1_1BallJoint.html#ad47a83d91fa93614f5cd8b33fff47a2f", null ], [ "updCoordinate", "classOpenSim_1_1BallJoint.html#a37adcd019469b27e552be4c0cbcd0c67", null ], [ "Coord", "classOpenSim_1_1BallJoint.html#aeafdd72ac449bc072bd0760404c37e3b", [ [ "Rotation1X", "classOpenSim_1_1BallJoint.html#aeafdd72ac449bc072bd0760404c37e3ba8a46031bead7d82e8f009fabe55cb2e4", null ], [ "Rotation2Y", "classOpenSim_1_1BallJoint.html#aeafdd72ac449bc072bd0760404c37e3bad4e0c8d1378bf0690919c7fc0d17fcd7", null ], [ "Rotation3Z", "classOpenSim_1_1BallJoint.html#aeafdd72ac449bc072bd0760404c37e3ba9839309ced6214b8d9a5c5ef7c7db198", null ] ] ] ];
83.2
130
0.808494
0d912ab394cc413dfd0cfa23022d69c579b7848a
4,174
js
JavaScript
js/modules/Patient/Hospitalpatients/HospitalpatientsModel.js
ningxzx/HopeHis
7bfa70684f02854d229a5184a0fda99eeca81505
[ "MIT" ]
2
2016-08-29T16:12:12.000Z
2016-08-30T01:10:11.000Z
js/modules/Patient/Hospitalpatients/HospitalpatientsModel.js
ningxzx/HopeHis
7bfa70684f02854d229a5184a0fda99eeca81505
[ "MIT" ]
null
null
null
js/modules/Patient/Hospitalpatients/HospitalpatientsModel.js
ningxzx/HopeHis
7bfa70684f02854d229a5184a0fda99eeca81505
[ "MIT" ]
null
null
null
define(['jquery', "backbone", 'jctLibs'],function($, Backbone, jctLibs) { var rootUrl = "http://192.168.0.220:8081"; var HospitalpatientsModel = Backbone.Model.extend({ postHospital: function (data) { var that = this; var result = {}; var params={ patient_name: data.patient_name, patient_sex: data.patient_sex, patient_birth: data.patient_birth, marry_state: data.marry_state, card_id: data.card_id, patient_phone:data.patient_phone, patient_tel: data.patient_tel, patient_qq: data.patient_qq, patient_wechet: data.patient_wechet, patient_email:data.patient_email, nationaloty: data.nationaloty, province: data.province, city: data.city, area: data.area, addr: data.addr, next_of_kin: data.next_of_kin, next_of_kin_phone: data.next_of_kin_phone }; $.ajax({ type: "post", url: rootUrl + "/JetHis/Patch/patient", data: JSON.stringify(params) }).done(function (data) { result.errorNo = 0; //result.rows = jctLibs.listToObject(data, 'rows')['rows']; result.rows=data; that.trigger("postHospital", result); }).fail(function (error) { result.data = error; result.errorNo = -1; that.trigger("postHospital", result); }); }, getPatient: function (param) { var that = this; var result = { errorNo: 0,//0为正确的值,其余值为错误 errorInfo: "" }; $.ajax({ type: "get", url: rootUrl+'/jethis/PatientRecord/Persinalinfo', data:param }).done(function (res) { result.errorNo = 0; result.rows = res; that.trigger("getPatient", result); }).fail(function (err, response) { var responseText = $.parseJSON(err.responseText); result.errorNo = responseText.code; result.responseData = responseText.message; that.trigger("getPatient", result); }) }, patchPat:function (pat_id,data) { var that = this,param=data||{}; var result = {}; $.ajax({ type: "patch", url: rootUrl + '/jethis/registeration/patchPatientInfo/' + pat_id, data: JSON.stringify(param), success: function (res) { result= res; that.trigger("patchPatient", result); } }) }, getProvince:function () { var that = this,result = {}; $.ajax({ type: "get", url: rootUrl + '/jethis/registeration/getdictprovincebycountry', success: function (res) { result= res.rows; that.trigger("getProvince", result); } }) }, getCity:function (code) { var that = this,result = {}; $.ajax({ type: "get", url: rootUrl + '/jethis/registeration/getdictcitybyprovince?province_code=' + code, success: function (res) { result= res.rows; that.trigger("getCity", result); } }) }, getArea:function (code) { var that = this,result = {}; $.ajax({ type: "get", url: rootUrl + '/jethis/registeration/getdictdistrictbycity?city_code=' + code, success: function (res) { result= res.rows; that.trigger("getArea", result); } }) }, }); return HospitalpatientsModel; });
34.783333
99
0.459032
0d91e20c25ec3c0cf50e4c04d04f7ddf773b2d52
653
es6
JavaScript
src/shader/concat_mul/main.es6
zhongkai/Paddle.js-1
55ab5fb90eb684309121b50eaeff32060105f737
[ "Apache-2.0" ]
2
2021-05-14T23:03:15.000Z
2022-02-09T07:28:32.000Z
src/shader/concat_mul/main.es6
zhongkai/Paddle.js-1
55ab5fb90eb684309121b50eaeff32060105f737
[ "Apache-2.0" ]
null
null
null
src/shader/concat_mul/main.es6
zhongkai/Paddle.js-1
55ab5fb90eb684309121b50eaeff32060105f737
[ "Apache-2.0" ]
1
2022-01-26T09:41:53.000Z
2022-01-26T09:41:53.000Z
/* eslint-disable */ /** * @file concat主函数 * @author zhangjingyuan02 */ export default ` // start函数 void main(void) { ivec4 oPos = getOutputTensorPosLIMIT_OUT(); // 输出坐标转换为输入坐标 float o = 0.0; int dim_total = inputs_dim + append_num; if (oPos[dim] < inputs_dim - 1) { o = getValueFromTensorPosLIMIT_ORIGIN_origin(oPos.r, oPos.g, oPos.b, oPos.a); } else if (oPos[dim] < dim_total - 1) { o = getValueFromTensorPosLIMIT_COUNTER_counter(oPos.r, oPos.g, oPos.b, oPos.a); } else { o = getValueFromTensorPosLIMIT_APPENDER_appender(oPos.r, oPos.g, oPos.b, oPos.a); } setOutput(float(o)); } `;
25.115385
89
0.638591
0d91f3c7c62ab5b1d79e2b98401485798b8b41fe
2,088
js
JavaScript
Grokking The Coding Interview/MergeIntervals/MergeAllOverlappingIntervals.js
GokulRG/JSAlgos
d589332a40fddc7b3096b68035364833b652ac74
[ "MIT" ]
null
null
null
Grokking The Coding Interview/MergeIntervals/MergeAllOverlappingIntervals.js
GokulRG/JSAlgos
d589332a40fddc7b3096b68035364833b652ac74
[ "MIT" ]
null
null
null
Grokking The Coding Interview/MergeIntervals/MergeAllOverlappingIntervals.js
GokulRG/JSAlgos
d589332a40fddc7b3096b68035364833b652ac74
[ "MIT" ]
null
null
null
/** * Given a list of intervals, merge all the overlapping intervals to produce a list that has only mutually exclusive intervals. */ function mergeAllOverlappingIntervals(intervalArray) { if (!intervalArray || intervalArray.length < 2) { return intervalArray; } // First you sort the interval array in the order of start time intervalArray.sort(([startOne, _], [startTwo, __]) => { return startOne - startTwo; }); // From here - there are 4 possibilities between every consecutive interval // Since the array is sorted, it's given that a.start <= b.start // 1. Interval a can completely engulf interval b // 2. Interval b can completely engulf interval a // 3. There is a partial overlap of interval a and b where b ends after a // 4. There is no overlap between intervals a and b! // Let's merge the intervals by taking into consideration of all the above cases // So however you slice it and dice it, if there is an overlap of intervals the start point will be of the previous interval and the endpoint is the max(endpoint(previous), endpoint(current)) let mergedIntervals = []; let pointer = 1; let interval = intervalArray[0]; let previousStart = interval[0]; let previousEnd = interval[1]; while (pointer < intervalArray.length) { // Interval becomes current interval = intervalArray[pointer]; // there is overlap if (interval[0] <= previousEnd) { previousEnd = Math.max(previousEnd, interval[1]); } // No overlap else { mergedIntervals.push([previousStart, previousEnd]); previousStart = interval[0]; previousEnd= interval[1]; } pointer++; } // Add the last interval mergedIntervals.push([previousStart, previousEnd]); return mergedIntervals; } console.log(mergeAllOverlappingIntervals([[7,9],[1,4],[2,5]])); console.log(mergeAllOverlappingIntervals([[6,7], [2,4], [5,9]])); console.log(mergeAllOverlappingIntervals([[1,4], [2,6], [3,5]]));
37.285714
195
0.659483
0d933c700e0f8c794c8f48a8c0347fec9f8875a8
5,513
js
JavaScript
B2G/gecko/browser/devtools/styleinspector/test/browser_ruleview_734259_style_editor_link.js
wilebeast/FireFox-OS
43067f28711d78c429a1d6d58c77130f6899135f
[ "Apache-2.0" ]
3
2015-08-31T15:24:31.000Z
2020-04-24T20:31:29.000Z
B2G/gecko/browser/devtools/styleinspector/test/browser_ruleview_734259_style_editor_link.js
wilebeast/FireFox-OS
43067f28711d78c429a1d6d58c77130f6899135f
[ "Apache-2.0" ]
null
null
null
B2G/gecko/browser/devtools/styleinspector/test/browser_ruleview_734259_style_editor_link.js
wilebeast/FireFox-OS
43067f28711d78c429a1d6d58c77130f6899135f
[ "Apache-2.0" ]
3
2015-07-29T07:17:15.000Z
2020-11-04T06:55:37.000Z
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ let win; let doc; let contentWindow; let tempScope = {}; Cu.import("resource://gre/modules/Services.jsm", tempScope); let Services = tempScope.Services; function createDocument() { doc.body.innerHTML = '<style type="text/css"> ' + 'html { color: #000000; } ' + 'span { font-variant: small-caps; color: #000000; } ' + '.nomatches {color: #ff0000;}</style> <div id="first" style="margin: 10em; ' + 'font-size: 14pt; font-family: helvetica, sans-serif; color: #AAA">\n' + '<h1>Some header text</h1>\n' + '<p id="salutation" style="font-size: 12pt">hi.</p>\n' + '<p id="body" style="font-size: 12pt">I am a test-case. This text exists ' + 'solely to provide some things to <span style="color: yellow">' + 'highlight</span> and <span style="font-weight: bold">count</span> ' + 'style list-items in the box at right. If you are reading this, ' + 'you should go do something else instead. Maybe read a book. Or better ' + 'yet, write some test-cases for another bit of code. ' + '<span style="font-style: italic">some text</span></p>\n' + '<p id="closing">more text</p>\n' + '<p>even more text</p>' + '</div>'; doc.title = "Rule view style editor link test"; openInspector(); } function openInspector() { ok(window.InspectorUI, "InspectorUI variable exists"); ok(!InspectorUI.inspecting, "Inspector is not highlighting"); ok(InspectorUI.store.isEmpty(), "Inspector.store is empty"); Services.obs.addObserver(inspectorUIOpen, InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false); InspectorUI.openInspectorUI(); } function inspectorUIOpen() { Services.obs.removeObserver(inspectorUIOpen, InspectorUI.INSPECTOR_NOTIFICATIONS.OPENED, false); // Make sure the inspector is open. ok(InspectorUI.inspecting, "Inspector is highlighting"); ok(!InspectorUI.isSidebarOpen, "Inspector Sidebar is not open"); ok(!InspectorUI.store.isEmpty(), "InspectorUI.store is not empty"); is(InspectorUI.store.length, 1, "Inspector.store.length = 1"); // Highlight a node. let div = content.document.getElementsByTagName("div")[0]; InspectorUI.inspectNode(div); InspectorUI.stopInspecting(); is(InspectorUI.selection, div, "selection matches the div element"); InspectorUI.currentInspector.once("sidebaractivated-ruleview", testInlineStyle); InspectorUI.sidebar.show(); InspectorUI.sidebar.activatePanel("ruleview"); } function testInlineStyle() { executeSoon(function() { info("clicking an inline style"); Services.ww.registerNotification(function onWindow(aSubject, aTopic) { if (aTopic != "domwindowopened") { return; } win = aSubject.QueryInterface(Ci.nsIDOMWindow); win.addEventListener("load", function windowLoad() { win.removeEventListener("load", windowLoad); let windowType = win.document.documentElement.getAttribute("windowtype"); is(windowType, "navigator:view-source", "view source window is open"); win.close(); Services.ww.unregisterNotification(onWindow); testInlineStyleSheet(); }); }); EventUtils.synthesizeMouseAtCenter(getLinkByIndex(0), { }, contentWindow); }); } function testInlineStyleSheet() { info("clicking an inline stylesheet"); Services.ww.registerNotification(function onWindow(aSubject, aTopic) { if (aTopic != "domwindowopened") { return; } win = aSubject.QueryInterface(Ci.nsIDOMWindow); win.addEventListener("load", function windowLoad() { win.removeEventListener("load", windowLoad); let windowType = win.document.documentElement.getAttribute("windowtype"); is(windowType, "Tools:StyleEditor", "style editor window is open"); win.styleEditorChrome.addChromeListener({ onEditorAdded: function checkEditor(aChrome, aEditor) { if (!aEditor.sourceEditor) { aEditor.addActionListener({ onAttach: function (aEditor) { aEditor.removeActionListener(this); validateStyleEditorSheet(aEditor); } }); } else { validateStyleEditorSheet(aEditor); } } }); Services.ww.unregisterNotification(onWindow); }); }); EventUtils.synthesizeMouse(getLinkByIndex(1), 5, 5, { }, contentWindow); } function validateStyleEditorSheet(aEditor) { info("validating style editor stylesheet"); let sheet = doc.styleSheets[0]; is(aEditor.styleSheet, sheet, "loaded stylesheet matches document stylesheet"); win.close(); finishup(); } function getLinkByIndex(aIndex) { let contentDoc = ruleView().doc; contentWindow = contentDoc.defaultView; let links = contentDoc.querySelectorAll(".ruleview-rule-source"); return links[aIndex]; } function finishup() { InspectorUI.sidebar.hide(); InspectorUI.closeInspectorUI(); gBrowser.removeCurrentTab(); doc = contentWindow = win = null; finish(); } function test() { waitForExplicitFinish(); gBrowser.selectedTab = gBrowser.addTab(); gBrowser.selectedBrowser.addEventListener("load", function(evt) { gBrowser.selectedBrowser.removeEventListener(evt.type, arguments.callee, true); doc = content.document; waitForFocus(createDocument, content); }, true); content.location = "data:text/html,<p>Rule view style editor link test</p>"; }
31.323864
82
0.68275
0d936d3b9aaea278d58d1db2609f0c9bc741a35c
4,455
js
JavaScript
gramjs/events/NewMessage.js
4natoli/gramjs
5d5fa0ecab0d299be1be5d4266c2bfc66872d373
[ "MIT" ]
1
2020-12-05T16:23:43.000Z
2020-12-05T16:23:43.000Z
gramjs/events/NewMessage.js
4natoli/gramjs
5d5fa0ecab0d299be1be5d4266c2bfc66872d373
[ "MIT" ]
null
null
null
gramjs/events/NewMessage.js
4natoli/gramjs
5d5fa0ecab0d299be1be5d4266c2bfc66872d373
[ "MIT" ]
null
null
null
const { EventBuilder, EventCommon } = require('./common') const { types } = require('../tl') /** * This event occurs whenever a new text message, or a message * with media is received. */ class NewMessage extends EventBuilder { constructor({ outgoing = true, incoming = false, fromUsers = [], forwards = true, pattern = undefined, } = {}) { super() this.outgoing = outgoing this.incoming = incoming this.fromUsers = fromUsers this.forwards = forwards this.pattern = pattern if (!this.outgoing && !this.incoming) { throw new Error('one of incoming or outgoing must be true') } } async _resolve(client) { await super._resolve(client) // this.fromUsers = await _intoIdSet(client, this.fromUsers) } build(update, others = null, thisId = null) { let event if (!this.filter(update)) return if (update instanceof types.UpdateNewMessage || update instanceof types.UpdateNewChannelMessage) { event = new Event(update.message) } else if (update instanceof types.UpdateShortMessage) { event = new Event(new types.Message({ out: update.out || false, mentioned: update.mentioned, mediaUnread: update.mediaUnread, silent: update.silent, id: update.id, // Note that to_id/from_id complement each other in private // messages, depending on whether the message was outgoing. toId: new types.PeerUser(update.out ? update.userId : thisId), fromId: update.out ? thisId : update.userId, message: update.message, date: update.date, fwdFrom: update.fwdFrom, viaBotId: update.viaBotId, replyToMsgId: update.replyToMsgId, entities: update.entities || [], })) } else if (update instanceof types.UpdateShortChatMessage) { event = new this.Event(new types.Message({ out: update.out || false, mentioned: update.mentioned, mediaUnread: update.mediaUnread, silent: update.silent, id: update.id, toId: new types.PeerChat(update.chatId), fromId: update.fromId, message: update.message, date: update.date, fwdFrom: update.fwdFrom, viaBotId: update.viaBotId, replyToMsgId: update.replyToMsgId, entities: update.entities || [], })) } else { return } // Make messages sent to ourselves outgoing unless they're forwarded. // This makes it consistent with official client's appearance. const ori = event.message if (ori.toId instanceof types.PeerUser) { if (ori.fromId === ori.toId.userId && !ori.fwdFrom) { event.message.out = true } } return event } filter(update) { const message = update.message // Make sure this is a message object in the first place if (!(message instanceof types.Message)) { return false } // Check if the message is incoming or outgoing, and if // we want to accept whichever one it is if (message.out) { if (!this.outgoing) return false } else { if (!this.incoming) return false } // See if the message was sent by one of the `fromUsers` if (this.fromUsers.length > 0) { const valid = this.fromUsers.map((user) => { const id = 'id' in user ? user.id : user if (message.fromId === id) return true else return false }) if (!valid.includes(true)) return false } // Check if the message was forwarded if (message.fwdFrom && !this.forwards) return false // Finally check the message text against a pattern if (this.pattern) { if (!message.message.match(this.pattern)) return false } return true } } class Event extends EventCommon { constructor(message) { super() this.message = message } } module.exports = NewMessage
32.518248
106
0.550168
0d93b0c0c7d6ea04b537ffb72bcb2e96960044ac
296
js
JavaScript
source/js/popup.js
Max-im/senior-citizen-landing
23d2226bac19eb7529e08deb2b00f9d177aca17e
[ "Apache-2.0" ]
null
null
null
source/js/popup.js
Max-im/senior-citizen-landing
23d2226bac19eb7529e08deb2b00f9d177aca17e
[ "Apache-2.0" ]
null
null
null
source/js/popup.js
Max-im/senior-citizen-landing
23d2226bac19eb7529e08deb2b00f9d177aca17e
[ "Apache-2.0" ]
null
null
null
import $ from 'jquery'; import magnificPopup from 'magnific-popup'; const popupFunc = () => { $('.moment__btn').magnificPopup({ type: 'inline', preloader: false, }); $('.moment__plus').magnificPopup({ type: 'inline', preloader: false, }); } export default popupFunc;
16.444444
43
0.625
0d944eb8ddaf9b336eb50137f754769cc42c52ef
167
js
JavaScript
src/pack/resetPackDir/index.js
reuters-graphics/graphics-kit-publisher
3d2d6677eaa6032115cb0b776f1c39a5f26778dd
[ "MIT" ]
null
null
null
src/pack/resetPackDir/index.js
reuters-graphics/graphics-kit-publisher
3d2d6677eaa6032115cb0b776f1c39a5f26778dd
[ "MIT" ]
4
2022-03-17T21:42:22.000Z
2022-03-21T10:09:05.000Z
src/pack/resetPackDir/index.js
reuters-graphics/graphics-kit-publisher
3d2d6677eaa6032115cb0b776f1c39a5f26778dd
[ "MIT" ]
null
null
null
import fs from 'fs-extra'; import rimraf from 'rimraf'; export default { resetPackDir() { rimraf.sync(this.PACK_DIR); fs.mkdirpSync(this.PACK_DIR); }, };
16.7
33
0.670659
0d9454d808213d334fc0a5eea4b230361293ebd0
58
js
JavaScript
helper.js
bsmith1310/SVGnest
86b63f8481f4a702da413a9b64ad869d2c53c073
[ "MIT" ]
null
null
null
helper.js
bsmith1310/SVGnest
86b63f8481f4a702da413a9b64ad869d2c53c073
[ "MIT" ]
null
null
null
helper.js
bsmith1310/SVGnest
86b63f8481f4a702da413a9b64ad869d2c53c073
[ "MIT" ]
null
null
null
SayHi = function() { console.log('hello from helper'); }
19.333333
35
0.655172
0d9465e6df4e8723c0f538b4bad8d4f807d4b9f6
252
js
JavaScript
4.0.0/a01442.js
isabella232/tessapi
54e30298a42ca64562008bc093ae678de3752c30
[ "Apache-2.0" ]
8
2020-01-31T02:21:41.000Z
2022-02-09T09:39:21.000Z
4.0.0/a01442.js
tesseract-ocr/tessapi
54e607767038052bb5df70a1f092a21a85d89d06
[ "Apache-2.0" ]
1
2021-05-28T16:54:43.000Z
2021-05-28T16:58:02.000Z
4.0.0/a01442.js
isabella232/tessapi
54e30298a42ca64562008bc093ae678de3752c30
[ "Apache-2.0" ]
9
2021-01-25T01:17:47.000Z
2022-02-12T08:40:52.000Z
var a01442 = [ [ "INT_PARAM_FLAG", "a01442.html#a429ed345773a81846642de10d98cfcb6", null ], [ "main", "a01442.html#a3c04138a5bfe5d72780bb7e82a18e627", null ], [ "STRING_PARAM_FLAG", "a01442.html#acc19c2f63431912188deb4316bee5108", null ] ];
42
82
0.734127
0d951c4f54770c794c42b660fb5366b2d1ac44bb
583
js
JavaScript
examples/soma.test.js
ekalmentero/softwaretestin
4b9fce7856179181b4e9e3143901045806561859
[ "Apache-2.0" ]
1
2021-02-24T19:35:19.000Z
2021-02-24T19:35:19.000Z
examples/soma.test.js
ekalmentero/softwaretesting
4b9fce7856179181b4e9e3143901045806561859
[ "Apache-2.0" ]
null
null
null
examples/soma.test.js
ekalmentero/softwaretesting
4b9fce7856179181b4e9e3143901045806561859
[ "Apache-2.0" ]
null
null
null
//Exemplo JEST com múltiplos casos de teste const mat = require('./mat'); let casosDeTeste = [ { "entrada1":5, "entrada2":2, "saida":7 }, { "entrada1":8, "entrada2":2, "saida":10 }, { "entrada1":5, "entrada2":1, "saida":6 } ] casosDeTeste.forEach(function (casoTeste) { test('Soma ' + casoTeste.entrada1 + ' + ' + casoTeste.entrada2 + ' igual a ' + casoTeste.saida, () => { expect(mat.soma(casoTeste.entrada1, casoTeste.entrada2)).toBe(casoTeste.saida); }); });
19.433333
107
0.521441
0d97c15131df24bc9c416b4e82845fbfe6bf82b1
5,188
js
JavaScript
src/helper/crochetThreejsPaths.js
klaraseitz/LayerwiseCrochet
97240537a59b5261b805a09500fa4f8d5a339faa
[ "MIT" ]
null
null
null
src/helper/crochetThreejsPaths.js
klaraseitz/LayerwiseCrochet
97240537a59b5261b805a09500fa4f8d5a339faa
[ "MIT" ]
null
null
null
src/helper/crochetThreejsPaths.js
klaraseitz/LayerwiseCrochet
97240537a59b5261b805a09500fa4f8d5a339faa
[ "MIT" ]
null
null
null
import * as THREE from 'three'; export default class CrochetPaths { constructor(color) { this.color = color || 0x000000; } draw(stitch, color){ this.color = color || 0x000000; let x = 0; let y = 0; switch(stitch) { case 'slst': return this.drawSlipstitch(x, y); case 'sc': return this.drawSingleCrochet(x, y); case 'mr': return this.drawMagicRing(x, y); case 'ch': return this.drawChainStitch(x, y); case 'hdc': return this.drawHalfDoubleCrochet(x, y); case 'dc': return this.drawDoubleCrochet(x, y); case 'tr': return this.drawTrebleCrochet(x, y); case 'dtr': return this.drawDoubleTrebleCrochet(x, y); case 'hole': return this.drawHole(x, y); default: return false; } } lineMaterial() { return new THREE.LineBasicMaterial({ color: this.color }); } meshMaterial() { return new THREE.MeshBasicMaterial({ color: this.color }); } drawHole(x,y) { let material = new THREE.LineDashedMaterial( { color: this.color, linewidth: 1, scale: 1, dashSize: 2, gapSize: 2, } ); let circGeometry = new THREE.CircleGeometry( 5, 16 ); circGeometry.vertices.shift(); return new THREE.Line( circGeometry, material).computeLineDistances(); } drawMagicRing(x, y) { let path = new THREE.Path(); let radius = 0; let angle = 0; path.moveTo(x,y); for (let n = 0; n < 40; n++) { radius += 0.2; // make a complete circle every 50 iterations angle += (Math.PI * 2) / 20; let newX = x + radius * Math.cos(angle); let newY = y + radius * Math.sin(angle); path.lineTo(newX, newY); } let points = path.getPoints(); let geometry = new THREE.BufferGeometry().setFromPoints( points ); return new THREE.Line( geometry.rotateX(90), this.lineMaterial() ); } drawChainStitch(x, y) { let path = new THREE.Path(); path.absellipse(x, y, 4, 2, 0, 2*Math.PI, null, null); let points = path.getPoints(); let geometry = new THREE.BufferGeometry().setFromPoints( points ); return new THREE.Line( geometry, this.lineMaterial() ); } drawSlipstitch(x, y) { let geometry = new THREE.SphereGeometry( 2, 16, 16 ); return new THREE.Mesh( geometry, this.meshMaterial() ); } createLine(vec1, vec2) { let geometry = new THREE.Geometry(); geometry.vertices.push( vec1, vec2 ); return new THREE.Line( geometry, this.lineMaterial() ); } drawSingleCrochet(x, y) { let group = new THREE.Group(); let line1 = this.createLine(new THREE.Vector3( x-10, 0, y ), new THREE.Vector3( x+10, 0, y )); let line2 = this.createLine(new THREE.Vector3( x, 0, y-10 ), new THREE.Vector3( x, 0, y+10 )); group.add( line1, line2 ); return group; } tShape(group, x, y) { let line1 = this.createLine(new THREE.Vector3( x, 0, y-15 ), new THREE.Vector3( x, 0, y+15 )); let line2 = this.createLine(new THREE.Vector3( x-10, 0, y-15 ), new THREE.Vector3( x+10, 0, y-15 )); group.add(line1, line2); } drawHalfDoubleCrochet(x, y){ let group = new THREE.Group(); this.tShape(group, x, y); return group; } drawDoubleCrochet(x, y) { let group = new THREE.Group(); this.tShape(group, x, y); let middleSlash = this.createLine(new THREE.Vector3( x-5, 0, y+5 ), new THREE.Vector3( x+5, 0, y-5 )); group.add(middleSlash); return group; } drawTrebleCrochet(x, y) { let group = new THREE.Group(); this.tShape(group, x, y); let topSlash = this.createLine(new THREE.Vector3( x-5, 0, y ), new THREE.Vector3( x+5, 0, y-10 )); let bottomSlash = this.createLine(new THREE.Vector3( x-5, 0, y+10 ), new THREE.Vector3( x+5, 0, y )); group.add(topSlash, bottomSlash); return group; } drawDoubleTrebleCrochet(x, y) { let group = new THREE.Group(); this.tShape(group, x, y); let topSlash = this.createLine(new THREE.Vector3( x-5, 0, y ), new THREE.Vector3( x+5, 0, y-10 )); let middleSlash = this.createLine(new THREE.Vector3( x-5, 0, y+5 ), new THREE.Vector3( x+5, 0, y-5 )); let bottomSlash = this.createLine(new THREE.Vector3( x-5, 0, y+10 ), new THREE.Vector3( x+5, 0, y )); group.add(topSlash, middleSlash, bottomSlash); return group; } }
31.634146
78
0.512336
0d988c24c2194494f305a1ae06d7695c4cc606e2
1,623
js
JavaScript
src/components/Hero.js
himubb/Portfolio
02904552f798f4163672e7bf1fb0789fa1f6ce50
[ "MIT" ]
null
null
null
src/components/Hero.js
himubb/Portfolio
02904552f798f4163672e7bf1fb0789fa1f6ce50
[ "MIT" ]
null
null
null
src/components/Hero.js
himubb/Portfolio
02904552f798f4163672e7bf1fb0789fa1f6ce50
[ "MIT" ]
null
null
null
import React, { useEffect } from "react" import Image from "gatsby-image" import { Link } from "gatsby" import { graphql, useStaticQuery } from "gatsby" import SocialLinks from "../constants/socialLinks" import Typed from "typed.js" const query = graphql` { file(relativePath: { eq: "hero-img.png" }) { childImageSharp { fluid { ...GatsbyImageSharpFluid } } } } ` const Hero = () => { const { file: { childImageSharp: { fluid }, }, } = useStaticQuery(query) useEffect(() => { const options = { strings: [" I'm Himavanth Boddu ", " I'm Himu "], typeSpeed: 50, smartBackspace: true, backSpeed: 50, loop: true, loopCount: Infinity, showCursor: false, } // New Typed instance const typed = new Typed("#instruction", options) // Destroy Typed instance on unmounting the component to prevent memory leaks return () => { typed.destroy() } }, []) return ( <header className="hero"> <div className="section-center hero-center"> <article className="hero-info"> <div> <div-- className="underline"></div--> <div> <span className="nameTitle" id="instruction"></span> </div> <h4>Graduate Student at University of Florida</h4> <Link to="/contact" className="btn"> Contact Me </Link> <SocialLinks /> </div> </article> <Image fluid={fluid} className="hero-img" /> </div> </header> ) } export default Hero
23.521739
81
0.550832
0d99a1d76705ad4e99cd35855e290a1482eb17b4
1,447
js
JavaScript
src/components/header/Header.js
Wiiktor22/WeatherApp
7c52979c362179a30dd1a3acc96763aacd86cdb7
[ "MIT" ]
null
null
null
src/components/header/Header.js
Wiiktor22/WeatherApp
7c52979c362179a30dd1a3acc96763aacd86cdb7
[ "MIT" ]
null
null
null
src/components/header/Header.js
Wiiktor22/WeatherApp
7c52979c362179a30dd1a3acc96763aacd86cdb7
[ "MIT" ]
null
null
null
import React from 'react'; import styled, { css } from 'styled-components'; import Refresh from './../../assets/refresh.svg'; import BackIcon from './../../assets/back.png'; import { useLocation, useHistory } from 'react-router-dom'; const Wrapper = styled.header` position: relative; height: 5vh; width: 100%; `; const Title = styled.h1` position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 1.7rem; margin: 0 auto; font-weight: 300; `; const RefreshIcon = styled.img` position: absolute; top: 50%; right: 0; transform: translateY(-50%); height: 20px; width: 20px; ${({ left }) => ( left && css` light: 0; right: auto; ` )} `; const Header = () => { let location = useLocation(); let history = useHistory(); const handleRefresh = () => { switch (location.pathname) { case '/': return window.location.reload() case '/nextweek': return history.push('/') default: return } } return ( <Wrapper> {location.pathname === '/nextweek' && <RefreshIcon left src={BackIcon} onClick={() => history.push('/')}/>} <Title>Pogoda</Title> <RefreshIcon src={Refresh} onClick={handleRefresh}/> </Wrapper> ); } export default Header;
23.33871
119
0.533518
0d99a8779d461042978309ceae8e4a1fe2dbbc52
422
js
JavaScript
src/components/home.js
MCD-50/React-Electron
8a9547cf16a194e0de18f891b4405ccf13ab3eec
[ "MIT" ]
null
null
null
src/components/home.js
MCD-50/React-Electron
8a9547cf16a194e0de18f891b4405ccf13ab3eec
[ "MIT" ]
null
null
null
src/components/home.js
MCD-50/React-Electron
8a9547cf16a194e0de18f891b4405ccf13ab3eec
[ "MIT" ]
null
null
null
import React, { Component } from 'react'; const contextTypes = { // notes: React.PropTypes.array, // tasks: React.PropTypes.array, }; class Home extends Component { constructor(props) { super(props); } componentWillMount() { } componentWillUnmount() { } componentDidMount() { } render() { return ( <div> Home Page </div> ) } } Home.contextTypes = contextTypes; export default Home
10.820513
41
0.64218
0d99fb11ab4ca42bb9fce0a1075c673725d1abbe
161
js
JavaScript
containers/Banner/tests/store.test.js
mydearxym/coderplanets_admin
1eb68fbe336b95fb2a9bde1a57659d53dd2f3d4b
[ "Apache-2.0" ]
49
2018-07-19T13:17:07.000Z
2021-12-17T09:47:51.000Z
containers/Banner/tests/store.test.js
mydearxym/mastani_admin
1eb68fbe336b95fb2a9bde1a57659d53dd2f3d4b
[ "Apache-2.0" ]
4
2020-09-04T17:19:42.000Z
2021-08-13T02:15:01.000Z
containers/Banner/tests/store.test.js
mydearxym/mastani_admin
1eb68fbe336b95fb2a9bde1a57659d53dd2f3d4b
[ "Apache-2.0" ]
8
2019-01-27T11:47:52.000Z
2019-11-25T04:35:21.000Z
/* * BannerStore store test * */ // import R from 'ramda' // import BannerStore from '../index' it('BannerStore 1 + 1 = 2', () => { expect(1 + 1).toBe(2) })
13.416667
37
0.565217
0d9b9287dbbb8cd8bc373da7f18ce4f9e5d7f301
986
js
JavaScript
src/components/ImageMDX.js
dauntless-dev/gatsby-lms
aa5d981507a3db4d7dd86c0caa07d5fd5fb21d0c
[ "MIT" ]
null
null
null
src/components/ImageMDX.js
dauntless-dev/gatsby-lms
aa5d981507a3db4d7dd86c0caa07d5fd5fb21d0c
[ "MIT" ]
null
null
null
src/components/ImageMDX.js
dauntless-dev/gatsby-lms
aa5d981507a3db4d7dd86c0caa07d5fd5fb21d0c
[ "MIT" ]
null
null
null
import React, { Component } from "react" import styled from "styled-components" export function ImageMDX(props) { const isLeft = props.align === "left" const isCenter = props.align === "center" return ( <Figure style={{ float: props.align, margin: isLeft ? "0 20px 0 0" : isCenter ? "auto" : "0 0 0 20px", maxWidth: props.maxWidth, minWidth: props.minWidth }} > {props.children} <Caption>{props.caption}</Caption> </Figure> ) } ImageMDX.defaultProps = { float: "right", marginLeft: "20px", marginRight: "0", maxWidth: "300px", minWidth: "100px", caption: "", } const Figure = styled.figure` max-width: ${props => props.maxWidth}; min-width: ${props => props.minWidth}; @media only screen and (max-width: 600px) { max-width: 200px; min-width: 150px; } ` const Caption = styled.figcaption` color: #868686; font-family: Platform; text-align: center; margin-bottom: 1rem; `
21.434783
73
0.616633
0d9b94da11e052334b5b28d91d0df19bd109f254
289
js
JavaScript
client/src/contexts/DeleteAlertDialogContext.js
amonae/the-blog
f0215a94c5b26fa1d3682bfa1a4462f72c23c60f
[ "MIT" ]
null
null
null
client/src/contexts/DeleteAlertDialogContext.js
amonae/the-blog
f0215a94c5b26fa1d3682bfa1a4462f72c23c60f
[ "MIT" ]
1
2021-01-18T23:58:23.000Z
2021-01-30T13:21:00.000Z
client/src/contexts/DeleteAlertDialogContext.js
m0nae/writeon
f0215a94c5b26fa1d3682bfa1a4462f72c23c60f
[ "MIT" ]
null
null
null
import React, { createContext } from 'react'; export const DeleteAlertDialogContext = createContext(); export function DeleteAlertDialogProvider(props) { return ( <DeleteAlertDialogContext.Provider value={{}}> {props.children} </DeleteAlertDialogContext.Provider> ); }
24.083333
56
0.737024
0d9d56a6049b1e0af5102148ff8eb065d612231c
7,785
js
JavaScript
2.3.3/BigInt.js
feel-easy/myspider
dcc65032015d7dbd8bea78f846fd3cac7638c332
[ "Apache-2.0" ]
1
2019-02-28T10:16:00.000Z
2019-02-28T10:16:00.000Z
2.3.3/BigInt.js
wasalen/myspider
dcc65032015d7dbd8bea78f846fd3cac7638c332
[ "Apache-2.0" ]
null
null
null
2.3.3/BigInt.js
wasalen/myspider
dcc65032015d7dbd8bea78f846fd3cac7638c332
[ "Apache-2.0" ]
null
null
null
function setMaxDigits(i){maxDigits=i,ZERO_ARRAY=new Array(maxDigits);for(var t=0;t<ZERO_ARRAY.length;t++)ZERO_ARRAY[t]=0;bigZero=new BigInt,bigOne=new BigInt,bigOne.digits[0]=1}function BigInt(i){"boolean"==typeof i&&1==i?this.digits=null:this.digits=ZERO_ARRAY.slice(0),this.isNeg=!1}function biFromDecimal(i){for(var t,r="-"==i.charAt(0),e=r?1:0;e<i.length&&"0"==i.charAt(e);)++e;if(e==i.length)t=new BigInt;else{var g=i.length-e,s=g%dpl10;for(0==s&&(s=dpl10),t=biFromNumber(Number(i.substr(e,s))),e+=s;e<i.length;)t=biAdd(biMultiply(t,lr10),biFromNumber(Number(i.substr(e,dpl10)))),e+=dpl10;t.isNeg=r}return t}function biCopy(i){var t=new BigInt(!0);return t.digits=i.digits.slice(0),t.isNeg=i.isNeg,t}function biFromNumber(i){var t=new BigInt;t.isNeg=0>i,i=Math.abs(i);for(var r=0;i>0;)t.digits[r++]=i&maxDigitVal,i>>=biRadixBits;return t}function reverseStr(i){for(var t="",r=i.length-1;r>-1;--r)t+=i.charAt(r);return t}function biToString(i,t){var r=new BigInt;r.digits[0]=t;for(var e=biDivideModulo(i,r),g=hexatrigesimalToChar[e[1].digits[0]];1==biCompare(e[0],bigZero);)e=biDivideModulo(e[0],r),digit=e[1].digits[0],g+=hexatrigesimalToChar[e[1].digits[0]];return(i.isNeg?"-":"")+reverseStr(g)}function biToDecimal(i){var t=new BigInt;t.digits[0]=10;for(var r=biDivideModulo(i,t),e=String(r[1].digits[0]);1==biCompare(r[0],bigZero);)r=biDivideModulo(r[0],t),e+=String(r[1].digits[0]);return(i.isNeg?"-":"")+reverseStr(e)}function digitToHex(t){var r=15,e="";for(i=0;i<4;++i)e+=hexToChar[t&r],t>>>=4;return reverseStr(e)}function biToHex(i){for(var t="",r=(biHighIndex(i),biHighIndex(i));r>-1;--r)t+=digitToHex(i.digits[r]);return t}function charToHex(i){var t,r=48,e=r+9,g=97,s=g+25,n=65,d=90;return t=i>=r&&e>=i?i-r:i>=n&&d>=i?10+i-n:i>=g&&s>=i?10+i-g:0}function hexToDigit(i){for(var t=0,r=Math.min(i.length,4),e=0;r>e;++e)t<<=4,t|=charToHex(i.charCodeAt(e));return t}function biFromHex(i){for(var t=new BigInt,r=i.length,e=r,g=0;e>0;e-=4,++g)t.digits[g]=hexToDigit(i.substr(Math.max(e-4,0),Math.min(e,4)));return t}function biFromString(i,t){var r="-"==i.charAt(0),e=r?1:0,g=new BigInt,s=new BigInt;s.digits[0]=1;for(var n=i.length-1;n>=e;n--){var d=i.charCodeAt(n),a=charToHex(d),o=biMultiplyDigit(s,a);g=biAdd(g,o),s=biMultiplyDigit(s,t)}return g.isNeg=r,g}function biToBytes(i){for(var t="",r=biHighIndex(i);r>-1;--r)t+=digitToBytes(i.digits[r]);return t}function digitToBytes(i){var t=String.fromCharCode(255&i);i>>>=8;var r=String.fromCharCode(255&i);return r+t}function biDump(i){return(i.isNeg?"-":"")+i.digits.join(" ")}function biAdd(i,t){var r;if(i.isNeg!=t.isNeg)t.isNeg=!t.isNeg,r=biSubtract(i,t),t.isNeg=!t.isNeg;else{r=new BigInt;for(var e,g=0,s=0;s<i.digits.length;++s)e=i.digits[s]+t.digits[s]+g,r.digits[s]=65535&e,g=Number(e>=biRadix);r.isNeg=i.isNeg}return r}function biSubtract(i,t){var r;if(i.isNeg!=t.isNeg)t.isNeg=!t.isNeg,r=biAdd(i,t),t.isNeg=!t.isNeg;else{r=new BigInt;var e,g;g=0;for(var s=0;s<i.digits.length;++s)e=i.digits[s]-t.digits[s]+g,r.digits[s]=65535&e,r.digits[s]<0&&(r.digits[s]+=biRadix),g=0-Number(0>e);if(-1==g){g=0;for(var s=0;s<i.digits.length;++s)e=0-r.digits[s]+g,r.digits[s]=65535&e,r.digits[s]<0&&(r.digits[s]+=biRadix),g=0-Number(0>e);r.isNeg=!i.isNeg}else r.isNeg=i.isNeg}return r}function biHighIndex(i){for(var t=i.digits.length-1;t>0&&0==i.digits[t];)--t;return t}function biNumBits(i){var t,r=biHighIndex(i),e=i.digits[r],g=(r+1)*bitsPerDigit;for(t=g;t>g-bitsPerDigit&&0==(32768&e);--t)e<<=1;return t}function biMultiply(i,t){for(var r,e,g,s=new BigInt,n=biHighIndex(i),d=biHighIndex(t),a=0;d>=a;++a){for(r=0,g=a,j=0;j<=n;++j,++g)e=s.digits[g]+i.digits[j]*t.digits[a]+r,s.digits[g]=e&maxDigitVal,r=e>>>biRadixBits;s.digits[a+n+1]=r}return s.isNeg=i.isNeg!=t.isNeg,s}function biMultiplyDigit(i,t){var r,e,g;result=new BigInt,r=biHighIndex(i),e=0;for(var s=0;r>=s;++s)g=result.digits[s]+i.digits[s]*t+e,result.digits[s]=g&maxDigitVal,e=g>>>biRadixBits;return result.digits[1+r]=e,result}function arrayCopy(i,t,r,e,g){for(var s=Math.min(t+g,i.length),n=t,d=e;s>n;++n,++d)r[d]=i[n]}function biShiftLeft(i,t){var r=Math.floor(t/bitsPerDigit),e=new BigInt;arrayCopy(i.digits,0,e.digits,r,e.digits.length-r);for(var g=t%bitsPerDigit,s=bitsPerDigit-g,n=e.digits.length-1,d=n-1;n>0;--n,--d)e.digits[n]=e.digits[n]<<g&maxDigitVal|(e.digits[d]&highBitMasks[g])>>>s;return e.digits[0]=e.digits[n]<<g&maxDigitVal,e.isNeg=i.isNeg,e}function biShiftRight(i,t){var r=Math.floor(t/bitsPerDigit),e=new BigInt;arrayCopy(i.digits,r,e.digits,0,i.digits.length-r);for(var g=t%bitsPerDigit,s=bitsPerDigit-g,n=0,d=n+1;n<e.digits.length-1;++n,++d)e.digits[n]=e.digits[n]>>>g|(e.digits[d]&lowBitMasks[g])<<s;return e.digits[e.digits.length-1]>>>=g,e.isNeg=i.isNeg,e}function biMultiplyByRadixPower(i,t){var r=new BigInt;return arrayCopy(i.digits,0,r.digits,t,r.digits.length-t),r}function biDivideByRadixPower(i,t){var r=new BigInt;return arrayCopy(i.digits,t,r.digits,0,r.digits.length-t),r}function biModuloByRadixPower(i,t){var r=new BigInt;return arrayCopy(i.digits,0,r.digits,0,t),r}function biCompare(i,t){if(i.isNeg!=t.isNeg)return 1-2*Number(i.isNeg);for(var r=i.digits.length-1;r>=0;--r)if(i.digits[r]!=t.digits[r])return i.isNeg?1-2*Number(i.digits[r]>t.digits[r]):1-2*Number(i.digits[r]<t.digits[r]);return 0}function biDivideModulo(i,t){var r,e,g=biNumBits(i),s=biNumBits(t),n=t.isNeg;if(s>g)return i.isNeg?(r=biCopy(bigOne),r.isNeg=!t.isNeg,i.isNeg=!1,t.isNeg=!1,e=biSubtract(t,i),i.isNeg=!0,t.isNeg=n):(r=new BigInt,e=biCopy(i)),new Array(r,e);r=new BigInt,e=i;for(var d=Math.ceil(s/bitsPerDigit)-1,a=0;t.digits[d]<biHalfRadix;)t=biShiftLeft(t,1),++a,++s,d=Math.ceil(s/bitsPerDigit)-1;e=biShiftLeft(e,a),g+=a;for(var o=Math.ceil(g/bitsPerDigit)-1,b=biMultiplyByRadixPower(t,o-d);-1!=biCompare(e,b);)++r.digits[o-d],e=biSubtract(e,b);for(var u=o;u>d;--u){var l=u>=e.digits.length?0:e.digits[u],f=u-1>=e.digits.length?0:e.digits[u-1],h=u-2>=e.digits.length?0:e.digits[u-2],x=d>=t.digits.length?0:t.digits[d],v=d-1>=t.digits.length?0:t.digits[d-1];l==x?r.digits[u-d-1]=maxDigitVal:r.digits[u-d-1]=Math.floor((l*biRadix+f)/x);for(var N=r.digits[u-d-1]*(x*biRadix+v),c=l*biRadixSquared+(f*biRadix+h);N>c;)--r.digits[u-d-1],N=r.digits[u-d-1]*(x*biRadix|v),c=l*biRadix*biRadix+(f*biRadix+h);b=biMultiplyByRadixPower(t,u-d-1),e=biSubtract(e,biMultiplyDigit(b,r.digits[u-d-1])),e.isNeg&&(e=biAdd(e,b),--r.digits[u-d-1])}return e=biShiftRight(e,a),r.isNeg=i.isNeg!=n,i.isNeg&&(r=n?biAdd(r,bigOne):biSubtract(r,bigOne),t=biShiftRight(t,a),e=biSubtract(t,e)),0==e.digits[0]&&0==biHighIndex(e)&&(e.isNeg=!1),new Array(r,e)}function biDivide(i,t){return biDivideModulo(i,t)[0]}function biModulo(i,t){return biDivideModulo(i,t)[1]}function biMultiplyMod(i,t,r){return biModulo(biMultiply(i,t),r)}function biPow(i,t){for(var r=bigOne,e=i;;){if(0!=(1&t)&&(r=biMultiply(r,e)),t>>=1,0==t)break;e=biMultiply(e,e)}return r}function biPowMod(i,t,r){for(var e=bigOne,g=i,s=t;;){if(0!=(1&s.digits[0])&&(e=biMultiplyMod(e,g,r)),s=biShiftRight(s,1),0==s.digits[0]&&0==biHighIndex(s))break;g=biMultiplyMod(g,g,r)}return e}var biRadixBase=2,biRadixBits=16,bitsPerDigit=biRadixBits,biRadix=65536,biHalfRadix=biRadix>>>1,biRadixSquared=biRadix*biRadix,maxDigitVal=biRadix-1,maxInteger=9999999999999998,maxDigits,ZERO_ARRAY,bigZero,bigOne;setMaxDigits(20);var dpl10=15,lr10=biFromNumber(1e15),hexatrigesimalToChar=new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"),hexToChar=new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"),highBitMasks=new Array(0,32768,49152,57344,61440,63488,64512,65024,65280,65408,65472,65504,65520,65528,65532,65534,65535),lowBitMasks=new Array(0,1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767,65535);
7,785
7,785
0.699807
0d9e33389dd3f66e6d9f6a70aa80e63b89e8a54b
2,463
js
JavaScript
scrambler.js
rileywoo/Scramble-Generator-v1
be33237a520639b66a1cac2dd091cfe456c6815e
[ "MIT" ]
null
null
null
scrambler.js
rileywoo/Scramble-Generator-v1
be33237a520639b66a1cac2dd091cfe456c6815e
[ "MIT" ]
null
null
null
scrambler.js
rileywoo/Scramble-Generator-v1
be33237a520639b66a1cac2dd091cfe456c6815e
[ "MIT" ]
null
null
null
var scramble = document.getElementById("scramble"); var button = document.getElementById("button"); var selectedEvent = document.getElementById("selectedEvent"); button.addEventListener("click", function() { var newScramble = ''; var prevMove = ''; var prevPrevMove = ''; if (selectedEvent.options[ selectedEvent.selectedIndex ].value == "3x3") { var moves = ["U", "D", "R", "L", "F", "B", "U\'", "D\'", "R\'", "L\'", "F\'", "B\'", "U2", "D2", "R2", "L2", "F2", "B2"]; for (var i = 0; i < 20; i++) { var randomInt = Math.floor((Math.random() * moves.length)); move = moves[randomInt]; if (prevMove == 'U' & prevPrevMove != 'D' || prevMove == 'D' && prevPrevMove != 'U' || prevMove == 'L' && prevPrevMove != 'R' || prevMove == 'R' && prevPrevMove != 'L' || prevMove == 'F' && prevPrevMove != 'B' || prevMove == 'B' && prevPrevMove != 'F') { prevPrevMove = ''; } while (move.charAt(0) == prevMove || move.charAt(0) == prevPrevMove) { var randomInt = Math.floor((Math.random() * moves.length)); move = moves[randomInt]; } prevPrevMove = prevMove.charAt(0); prevMove = move.charAt(0); newScramble = newScramble + move + ' '; scramble.innerHTML = newScramble; } } else if (selectedEvent.options[ selectedEvent.selectedIndex ].value == "2x2") { var moves = ["U", "R", "F", "U\'", "R\'", "F\'", "U2", "R2", "F2"]; for (var i = 0; i < 11; i++) { var randomInt = Math.floor((Math.random() * moves.length)); move = moves[randomInt]; while (move.charAt(0) == prevMove) { var randomInt = Math.floor((Math.random() * moves.length)); move = moves[randomInt]; } prevMove = move.charAt(0); newScramble = newScramble + move + ' '; scramble.innerHTML = newScramble; } } else if (selectedEvent.options[ selectedEvent.selectedIndex ].value == "skewb") { scramble.innerHTML = "Why would you practice skewb"; } else { rMoves = ["R++ ", "R-- "]; dMoves = ["D++ ", "D-- "]; uMoves = ["U<br>", "U\'<br>"]; for (var i = 0; i < 7; i++) { for (var k = 0; k < 10; k++) { if (k % 2 == 0) { var randomInt = Math.floor((Math.random() * rMoves.length)); newScramble += rMoves[randomInt]; } else { var randomInt = Math.floor((Math.random() * dMoves.length)); newScramble += dMoves[randomInt]; } } var randomInt = Math.floor((Math.random() * uMoves.length)); newScramble += uMoves[randomInt]; } scramble.innerHTML = newScramble; } } );
35.695652
257
0.579781
0d9ea77bab228af2b89257a63a4034d94efaba33
426
js
JavaScript
resources/js/config/vuetify/vuetify.js
DmitryAlexandrovv/social
b5853c2d6eca0a0757dbd0ee642f4b49b7672db0
[ "MIT" ]
null
null
null
resources/js/config/vuetify/vuetify.js
DmitryAlexandrovv/social
b5853c2d6eca0a0757dbd0ee642f4b49b7672db0
[ "MIT" ]
null
null
null
resources/js/config/vuetify/vuetify.js
DmitryAlexandrovv/social
b5853c2d6eca0a0757dbd0ee642f4b49b7672db0
[ "MIT" ]
null
null
null
import Vue from "vue"; import Vuetify from "vuetify"; import '@mdi/font/css/materialdesignicons.css' Vue.use(Vuetify); export default new Vuetify({ icons: { iconfont: "md" // 'mdi' || 'mdiSvg' || 'md' || 'fa' || 'fa4' }, theme: { light: { primary: '#b689b0', secondary: '#b0bec5', accent: '#8c9eff', error: 'rgb(227, 38, 54)', }, } });
21.3
68
0.492958
0da08f19f72bb3a3d1735af8b3e148716479540b
170
js
JavaScript
docs/search/all_1.js
seaneastin/Physics-for-games-assessment
cfecb6fe2e44c5453aa895c0d5a64e272540fac7
[ "MIT" ]
null
null
null
docs/search/all_1.js
seaneastin/Physics-for-games-assessment
cfecb6fe2e44c5453aa895c0d5a64e272540fac7
[ "MIT" ]
null
null
null
docs/search/all_1.js
seaneastin/Physics-for-games-assessment
cfecb6fe2e44c5453aa895c0d5a64e272540fac7
[ "MIT" ]
null
null
null
var searchData= [ ['createspheresintriangle_2',['createSpheresintriangle',['../classphysics_scene_app.html#a6ed72ae2acc789817cffc2e4628567c0',1,'physicsSceneApp']]] ];
34
148
0.8
0da17a850cf90bcb7fe89a8b738fa2cadab53a8d
269
js
JavaScript
code/module/02.module.js
SimonCK666/NodeJS_Learning
ca9a79ec455127b785d86bf2376ea2a6c572b1db
[ "ISC" ]
null
null
null
code/module/02.module.js
SimonCK666/NodeJS_Learning
ca9a79ec455127b785d86bf2376ea2a6c572b1db
[ "ISC" ]
null
null
null
code/module/02.module.js
SimonCK666/NodeJS_Learning
ca9a79ec455127b785d86bf2376ea2a6c572b1db
[ "ISC" ]
null
null
null
/** * 02.module.js * @author bulbasaur * @description * @created 2020-09-02T10:42:21.484Z+08:00 * @copyright None * None * @last-modified 2020-09-02T10:51:42.084Z+08:00 */ console.log("I am module 2"); var x = 10; var y = 20; exports.txt = "I am export variable.";
16.8125
47
0.657993
0da1c8852d2ef5edaa1dfa8f70b93e296ae7796f
4,262
js
JavaScript
packages/sonnat-ui/src/styles/SonnatInitializer/SonnatInitializer.js
sonnat/sonnat-ui
ed16c530cc642d7b6e77674ddffd32ac9e29c1a9
[ "MIT" ]
59
2020-12-17T10:09:30.000Z
2022-03-16T10:06:11.000Z
packages/sonnat-ui/src/styles/SonnatInitializer/SonnatInitializer.js
sonnat/sonnat-ui
ed16c530cc642d7b6e77674ddffd32ac9e29c1a9
[ "MIT" ]
11
2021-07-26T10:50:46.000Z
2022-02-21T07:37:49.000Z
packages/sonnat-ui/src/styles/SonnatInitializer/SonnatInitializer.js
sonnat/sonnat-ui
ed16c530cc642d7b6e77674ddffd32ac9e29c1a9
[ "MIT" ]
4
2021-06-05T09:14:25.000Z
2022-02-15T20:28:53.000Z
import jss, { create } from "jss"; import PropTypes from "prop-types"; import React from "react"; import { JssProvider } from "react-jss"; import createGenerateClassName from "../createGenerateClassName"; import defaultTheme from "../defaultTheme"; import jssPreset from "../jssPreset"; import { ServerContext } from "../ServerStyleSheets/Provider"; import ThemeProvider from "../ThemeProvider"; let injectFirstNode; const isSsr = typeof window === "undefined"; const InitializerContext = React.createContext({ nested: false }); if (process.env.NODE_ENV !== "production") { InitializerContext.displayName = "InitializerContext"; } // Use a singleton or the provided one by the context. // // The counter-based approach doesn't tolerate any mistake. // It's much safer to use the same counter everywhere. const defaultGenerateClassName = createGenerateClassName(); // Default JSS instance. const defaultJss = create(jssPreset()); export default function SonnatInitializer(props) { const { children, theme = defaultTheme, generateClassName: localGenerateClassName, jss: jssOption, disableGeneration, injectFirst = false } = props; const { nested } = React.useContext(InitializerContext); const { generateServerClassName, sheetsRegistry } = React.useContext( ServerContext ); if (nested) { throw new Error( "[Sonnat]: You cannot use `<SonnatInitializer>` as a nested provider!" ); } if (!isSsr && generateServerClassName) { throw new Error( "[Sonnat]: You need to use the `ServerStyleSheets` API when rendering on the server." ); } if (isSsr && !generateServerClassName) { throw new Error( "[Sonnat]: There is no `generateServerClassName` function provided on the server!" ); } let jss = jssOption != null ? jssOption : defaultJss; const generateId = isSsr ? generateServerClassName : localGenerateClassName != null ? localGenerateClassName : defaultGenerateClassName; if (process.env.NODE_ENV !== "production") { if (jss.options.insertionPoint && injectFirst) { // eslint-disable-next-line no-console console.error( "Sonnat: You cannot use a custom `insertionPoint` and <StylesContext injectFirst> at the same time." ); } } if (process.env.NODE_ENV !== "production") { if (injectFirst && jssOption) { // eslint-disable-next-line no-console console.error( "Sonnat: You cannot use the `jss` and `injectFirst` props at the same time." ); } } if ( !jss.options.insertionPoint && injectFirst && typeof window !== "undefined" ) { if (!injectFirstNode) { injectFirstNode = document.createComment("sonnat-inject-first"); document.head.insertBefore(injectFirstNode, document.head.firstChild); } jss = create({ plugins: jssPreset().plugins, insertionPoint: injectFirstNode }); } return ( <InitializerContext.Provider value={{ nested: true }}> <JssProvider registry={sheetsRegistry} jss={jss} generateId={generateId} disableStylesGeneration={disableGeneration} > <ThemeProvider theme={theme}>{children}</ThemeProvider> </JssProvider> </InitializerContext.Provider> ); } SonnatInitializer.propTypes = { children: PropTypes.node.isRequired, /** Sonnat's theme object */ theme: PropTypes.oneOfType([PropTypes.object, PropTypes.func]), /** * You can disable the generation of the styles with this option. * It can be useful when traversing the React tree outside of the HTML * rendering step on the server. * Let's say you are using react-apollo to extract all * the queries made by the interface server-side - you can significantly speed up the traversal with this prop. */ disableGeneration: PropTypes.bool, /** JSS's class name generator. */ generateClassName: PropTypes.func, /** * By default, the styles are injected last in the <head> element of the page. * As a result, they gain more specificity than any other style sheet. * If you want to override Sonnat's styles, set this prop. */ injectFirst: PropTypes.bool, /** JSS's instance. */ jss: PropTypes.instanceOf(jss.constructor) };
30.22695
113
0.688644
0da224a2862010ffdc3da6ddb294d58c73f2fbcb
784
js
JavaScript
js/script.js
EmberShan/339portfolio-desktop
6ba19fa3e46c70936be3a6a02e23d1755789a704
[ "CC0-1.0" ]
null
null
null
js/script.js
EmberShan/339portfolio-desktop
6ba19fa3e46c70936be3a6a02e23d1755789a704
[ "CC0-1.0" ]
null
null
null
js/script.js
EmberShan/339portfolio-desktop
6ba19fa3e46c70936be3a6a02e23d1755789a704
[ "CC0-1.0" ]
null
null
null
const toggleButton = document.getElementsByClassName("hamburger-menu")[0] const Links = document.getElementsByClassName('navlinks')[0] toggleButton.addEventListener('click', () => { Links.classList.toggle('active') }) // impressionism scroll animation const mediaQuery = window.matchMedia("(prefers-reduced-motion: reduce)"); document.querySelectorAll('a[href^="#"]').forEach(anchor => { anchor.addEventListener('click', function (e) { // if reduced motion then don't perform the scroll animation if (!(!mediaQuery || mediaQuery.matches)){ e.preventDefault(); document.querySelector(this.getAttribute('href')).scrollIntoView({ behavior: 'smooth' }); } // console.log(mediaQuery) }); });
37.333333
78
0.654337
0da260cae6952c5a849eb7a677f3cb81d2ba6aec
1,209
js
JavaScript
public/js/controllers/usuario_administrador/news-add.js
JPasogias/Valencia_UPV
8e3babfbd140014237324d95ca45f0d534dd88c8
[ "Apache-2.0" ]
null
null
null
public/js/controllers/usuario_administrador/news-add.js
JPasogias/Valencia_UPV
8e3babfbd140014237324d95ca45f0d534dd88c8
[ "Apache-2.0" ]
null
null
null
public/js/controllers/usuario_administrador/news-add.js
JPasogias/Valencia_UPV
8e3babfbd140014237324d95ca45f0d534dd88c8
[ "Apache-2.0" ]
null
null
null
plantcoApp.controller('newsController', function ( $scope, $http, $window, newsService ) { $scope.toolbar = [ ['h1', 'h2', 'p', 'quote'], ['bold', 'italics', 'underline', 'ul', 'ol', 'redo', 'undo'], ['justifyLeft', 'justifyCenter', 'justifyRight', 'indent', 'outdent'], ]; $scope.msg = { header: '', content: '', type: 'NEWS', creationDate: new Date(), public: true, }; function serverError() { toastr.error("Error en el servidor"); } //DATEPICKER $scope.open = function () { if ($scope.msg.creationDate) { $scope.openDatePicker = true; } else { $scope.msg.creationDate = new Date(); $scope.openDatePicker = true; } }; $scope.formats = ['yyyy', 'dd MMMM yyyy', 'dd/MM/yyyy', 'yyyy/MM/dd', 'dd.MM.yyyy', 'shortDate']; $scope.format = $scope.formats[2]; $scope.dateOptions = { showWeeks: false, minMode: 'day', maxMode: 'year', startingDay: 0, yearRange: 120, minDate: null, maxDate: null, }; $scope.send = function () { newsService.sendNew($scope.msg) .then(function (data) { $window.location.reload(); }).catch(serverError); }; });
20.491525
99
0.559967
0da2e82549aa9acc1a3289f8f306bc55f2b4ce76
2,008
js
JavaScript
src/components/ListItem.js
simoneas02/dev-beers
64e7f858a0018fc740dc18ab2a0df6216b20cad1
[ "MIT" ]
2
2018-02-01T12:28:16.000Z
2018-05-05T18:31:50.000Z
src/components/ListItem.js
simoneas02/dev-beers
64e7f858a0018fc740dc18ab2a0df6216b20cad1
[ "MIT" ]
null
null
null
src/components/ListItem.js
simoneas02/dev-beers
64e7f858a0018fc740dc18ab2a0df6216b20cad1
[ "MIT" ]
null
null
null
import React, { Component } from 'react'; import { connect } from 'react-redux'; import { itemsFetchData, itemSelected } from '../actions'; import { Link } from 'react-router-dom'; import loading from '../assets/icon/loading.svg'; import beerFail from '../assets/img/beer-fail.jpg'; class ListItem extends Component { componentDidMount() { this.props.fetchData('https://api.punkapi.com/v2/beers/'); } render() { if (this.props.hasErrored) { return( <div className='beer-list-has-errored'> <img className='beer-list-has-errored__img' src={beerFail} alt='beer' /> <p className='beer-list-has-errored__text'>Ocorreu algum erro ao carregar os itens, por favor verifique sua conexão e tente acessar nossa página novamente!!!</p>; </div> ) } if (this.props.isLoading) { return( <div className='beer-list-loading'> <img className='beer-list-loading__img' src={loading} alt='loading' /> <p className='beer-list-loading__text'>Carregando...</p> </div> ) } return ( <ul className='beer-list'> {this.props.items.map((item) => ( <li className='beer-list__item' key={item.id} onClick= { () => this.props.selected(item) } > <Link className='beer-list__item__link' to='/detail-item'> <span className='beer-list__item__link__name'>{item.name}</span> <span className='beer-list__item__link__tagline'>{item.tagline}</span> </Link> </li> ))} </ul> ); } } const mapStateToProps = state => { return { items: state.items, hasErrored: state.itemsHasErrored, isLoading: state.itemsIsLoading }; }; const mapDispatchToProps = dispatch => { return { fetchData: url => dispatch(itemsFetchData(url)), selected: item => dispatch(itemSelected(item)) }; }; export default connect(mapStateToProps, mapDispatchToProps)(ListItem);
29.970149
172
0.613546
0da463050b9283afa1770f4391624e6d71420a9c
284
js
JavaScript
src/components/ProjectContainer/ProjectContainer.js
colbyfayock/50reactprojects.com
276225656bcb6e7d18793653960136daf618a988
[ "MIT" ]
5
2020-08-14T00:21:35.000Z
2022-01-11T20:16:14.000Z
src/components/ProjectContainer/ProjectContainer.js
colbyfayock/50reactprojects.com-md
df46cfd935eb8e0bd69494f17c15e4e7cc7278b2
[ "MIT" ]
7
2021-08-31T20:45:42.000Z
2022-01-11T03:06:02.000Z
src/components/ProjectContainer/ProjectContainer.js
colbyfayock/50reactprojects.com
276225656bcb6e7d18793653960136daf618a988
[ "MIT" ]
null
null
null
import Container from 'components/Container'; import styles from './ProjectContainer.module.scss'; const ProjectContainer = ({ children }) => { return ( <Container className={styles.projectContainer}> { children } </Container> ) } export default ProjectContainer;
21.846154
52
0.707746
0da4f546ba541676e6f000a7491539c6353d3d7d
2,141
js
JavaScript
force-app/main/default/lwc/Chartjs Base Component Recipe/trendChart/trendChart.js
cgjerow/my-lwc-recipes
26ff72cdc61a2ac79b9762ebe1b6541671cb5a1c
[ "MIT" ]
1
2020-05-14T15:08:51.000Z
2020-05-14T15:08:51.000Z
force-app/main/default/lwc/Chartjs Base Component Recipe/trendChart/trendChart.js
cgjerow/my-lwc-recipes
26ff72cdc61a2ac79b9762ebe1b6541671cb5a1c
[ "MIT" ]
null
null
null
force-app/main/default/lwc/Chartjs Base Component Recipe/trendChart/trendChart.js
cgjerow/my-lwc-recipes
26ff72cdc61a2ac79b9762ebe1b6541671cb5a1c
[ "MIT" ]
null
null
null
import { LightningElement, api, track } from 'lwc'; import ChartJs from 'c/chartJs'; export default class TrendChart extends ChartJs { @api label; @api borderColor = 'rgb(72,165,221)'; @api backgroundColor = 'rgba(72,165,221,.1)'; @api get dates() { return this._dates; } set dates(values) { this._dates = values; this.setupChart(); } _dates; @api get values() { return this._data; } set values(values) { this._data = values; this.setupChart(); } _data; get configuration() { return { type: 'line', data: { datasets: [{ label: this.label, backgroundColor: this.backgroundColor, borderColor: this.borderColor, data: this._buildDataObject(this._dates, this._data), }] }, options: { legend: { display: false, }, elements: { line: { tension: 0 } }, responsive:true, scales: { yAxes: [{ ticks: { beginAtZero: true, maxTicksLimit: 6, }, }], xAxes: [{ type:'time', unit: 'year', gridLines: { color: "rgba(0, 0, 0, 0)", }, }], }, tooltips: { intersect: false, } } }; } @api setupChart() { if (this.values && this.dates) this.initializeChart(this.configuration); } _buildDataObject() { let points = []; for (let i=0; i<this._dates.length; i++) points.push({ x: new Date(this._dates[i]), y: (i<this._data.length ? this._data[i] : null) }); return points; } }
27.805195
106
0.393274
0da5a4de1ecbaadbb917c01b797d95e972027faf
1,081
js
JavaScript
models/config/config_cdn.js
qq275499833/danyemoban
4fea178579fe97ce14d73beaf1c78510f66d25a8
[ "MIT" ]
null
null
null
models/config/config_cdn.js
qq275499833/danyemoban
4fea178579fe97ce14d73beaf1c78510f66d25a8
[ "MIT" ]
null
null
null
models/config/config_cdn.js
qq275499833/danyemoban
4fea178579fe97ce14d73beaf1c78510f66d25a8
[ "MIT" ]
null
null
null
"use strict"; module.exports = function (sequelize, DataTypes) { return sequelize.define( "CDNConfig", { id: { type: DataTypes.INTEGER(), allowNull: false, primaryKey: true, autoIncrement: true }, cdntype: { type: DataTypes.STRING(10), allowNull: true }, accesskey: { type: DataTypes.STRING(100), allowNull: true }, secretkey: { type: DataTypes.STRING(100), allowNull: true }, bucket: { type: DataTypes.STRING(100), allowNull: true }, region: { type: DataTypes.STRING(100), allowNull: true }, cdnbase: { type: DataTypes.STRING(100), allowNull: true } },{ freezeTableName:true, tableName:'ConfigCDN' }); };
27.717949
50
0.402405
0da5ad6fe8a55641fae330fa8880c1c8e7c9b91c
3,001
js
JavaScript
src/components/SettingsPage.js
edwardzhang5/the5letterwordgame
99364a4fe62721c3773f305e80859fc0ee7ee34d
[ "MIT" ]
null
null
null
src/components/SettingsPage.js
edwardzhang5/the5letterwordgame
99364a4fe62721c3773f305e80859fc0ee7ee34d
[ "MIT" ]
1
2022-02-06T21:46:05.000Z
2022-02-06T21:46:05.000Z
src/components/SettingsPage.js
edwardzhang5/the5letterwordgame
99364a4fe62721c3773f305e80859fc0ee7ee34d
[ "MIT" ]
null
null
null
import '../App.css' import React, { Component, useEffect, useState } from 'react' import { Form, Button, Alert } from 'react-bootstrap' import resetGameOnePlayer from '../const/resetOnePlayer' import resetGameTwoPlayer from '../const/resetTwoPlayer' import $ from 'jquery' function SettingsPage(props) { const [show, setShow] = useState(false); const closeSettings = () => { props.setSettingsTrigger(false) } const toggleDarkMode = () => { } const toggleHighContrastMode = () => { } const toggleHardMode = () => { props.setHard(!props.hard) } const toggleOnePlayerMode = () => { setShow(true) $("#custom-switch").prop("checked", !$("#custom-switch").prop("checked")); } const yesButton = () => { $("#custom-switch").prop("checked", !$("#custom-switch").prop("checked")); if (props.onePlayer) { resetGameTwoPlayer(props) setShow(true) } else { resetGameOnePlayer(props) setShow(true) } props.setOnePlayer(!props.onePlayer) setShow(false); } const noButton = () => { setShow(false); } return props.settingsTrigger ? ( <div className='SettingsPage'> <div className='Card'> <h1>Settings</h1> <Form className='settings-form'> <div className='settings-aligner'> {/* <Form.Group inline> */} <Form.Check type="switch" id="ting" label="Dark Mode" onChange={toggleDarkMode} checked={props.dark} /> <Form.Check type="switch" label="High Contrast Mode" id="customswitch" onChange={toggleHighContrastMode} checked={props.highContrast} /> {/* </Form.Group> */} {/* <Form.Group inline> */} <Form.Check type="switch" label="One Player Mode" id="custom-switch" onChange={toggleOnePlayerMode} checked={props.onePlayer} /> <Form.Check type="switch" label="Hard Mode" id="custom-switch" onChange={toggleHardMode} checked={props.hard} /> {/* </Form.Group> */} </div> </Form> <Alert show={show} transition= {false} variant="danger" id="a"> <p> This will end the current game. Are you sure you want to continue? </p> <div className="d-flex justify-content-center" > <Button onClick={yesButton} variant="normal"> Yep </Button> <Button onClick={noButton} variant="normal"> No :o </Button> </div> </Alert> <button className='btn btn-lrg btn-secondary' onClick={closeSettings}> Close </button> </div> </div> ) : ( '' ) } export default SettingsPage
27.036036
78
0.523159
0da5efbfacbec475ece9fd913632cd7af89a5f41
9,867
js
JavaScript
lib/toolbox-chrome.js
firebug/firebug.sdk
5828f529b0060485995476a53c2c20331f2c8940
[ "BSD-3-Clause" ]
9
2015-03-18T01:21:21.000Z
2021-05-23T08:07:03.000Z
lib/toolbox-chrome.js
firebug/firebug.sdk
5828f529b0060485995476a53c2c20331f2c8940
[ "BSD-3-Clause" ]
18
2015-03-09T19:00:46.000Z
2017-01-05T20:49:44.000Z
lib/toolbox-chrome.js
firebug/firebug.sdk
5828f529b0060485995476a53c2c20331f2c8940
[ "BSD-3-Clause" ]
9
2015-03-31T13:06:39.000Z
2021-05-23T08:07:06.000Z
/* See license.txt for terms of usage */ "use strict"; module.metadata = { "stability": "experimental" }; // Add-on SDK const { Cu, Ci } = require("chrome"); const { EventTarget } = require("sdk/event/target"); const { extend } = require("sdk/core/heritage"); const { defer, resolve } = require("sdk/core/promise"); const { emit } = require("sdk/event/core"); // Firebug SDK const { Trace, TraceError } = require("./core/trace.js").get(module.id); const { Context } = require("./context.js"); const { Dispatcher } = require("./dispatcher.js"); // DevTools const { gDevTools } = require("./core/devtools"); // Platform const { Services } = Cu.import("resource://gre/modules/Services.jsm", {}); /** * TODO docs */ var ToolboxChrome = extend(EventTarget.prototype, /** @lends ToolboxChrome */ { // Initialization initialize: function() { this.initialized = true; this.contexts = new Map(); this.registeredOverlays = new Map(); // Bind DevTools event handlers. this.onToolboxCreated = this.onToolboxCreated.bind(this); this.onToolboxReady = this.onToolboxReady.bind(this); this.onToolboxDestroy = this.onToolboxDestroy.bind(this); this.onToolboxClosed = this.onToolboxClosed.bind(this); this.onPrefChanged = this.onPrefChanged.bind(this); // Hook developer tools events. gDevTools.on("toolbox-created", this.onToolboxCreated); gDevTools.on("toolbox-ready", this.onToolboxReady); gDevTools.on("toolbox-destroy", this.onToolboxDestroy); gDevTools.on("toolbox-destroyed", this.onToolboxClosed); gDevTools.on("pref-changed", this.onPrefChanged); return Dispatcher.emit("initialize"); }, shutdown: function() { gDevTools.off("toolbox-created", this.onToolboxCreated); gDevTools.off("toolbox-ready", this.onToolboxReady); gDevTools.off("toolbox-destroy", this.onToolboxDestroy); gDevTools.off("toolbox-destroyed", this.onToolboxClosed); gDevTools.off("pref-changed", this.onPrefChanged); return Dispatcher.emit("shutdown"); }, // DevTools Event Handlers onToolboxCreated: function(eventId, toolbox) { Trace.sysout("ToolboxChrome.onToolboxCreated;", toolbox); // Make sure to create the toolbox context as soon as possible. // 'toolbox-created' has been introduced in Fx 39, so use // 'toolbox-ready' for previous versions. let context = this.getContext(toolbox); Dispatcher.emit("onToolboxCreated", arguments); }, onToolboxReady: function(event, toolbox) { Trace.sysout("ToolboxChrome.onToolboxReady; ", toolbox); // Make sure to create the toolbox context as soon as possible. let context = this.getContext(toolbox); Dispatcher.emit("onToolboxReady", arguments); }, onToolboxDestroy: function(eventId, target) { Trace.sysout("ToolboxChrome.onToolboxDestroy;", target); let context = this.contexts.get(target); if (!context) { Trace.sysout("ToolboxChrome.onToolboxDestroy; ERROR unknown target!", target); return; } Dispatcher.emit("onToolboxDestroy", arguments); this.contexts.delete(target); context.destroy(); }, onToolboxClosed: function(eventId, target) { Trace.sysout("ToolboxChrome.onToolboxClosed;", target); let context = this.contexts.get(target); if (!context) { Trace.sysout("ToolboxChrome.onToolboxClosed; ERROR unknown target!", target); return; } }, // Options onPrefChanged: function(eventType, data) { Trace.sysout("ToolboxChrome.onPrefChanged; ", data); if (data.pref == "devtools.theme") { emit(this, "theme-changed", data.newValue, data.oldValue); } }, getCurrentTheme: function() { return Services.prefs.getCharPref("devtools.theme"); }, isFirebugThemeActive: function() { return this.getCurrentTheme() == "firebug"; }, // Overlays registerPanelOverlay: function(overlay) { let overlayId = overlay.prototype.overlayId; let panelId = overlay.prototype.panelId; if (!panelId) { panelId = overlayId; } if (!panelId || !overlayId) { TraceError.sysout("ToolboxChrome.registerOverlay; ERROR " + "Missing overlay ID!"); return; } Trace.sysout("ToolboxChrome.registerOverlay; " + overlayId, overlay); // Listen for panel initialization event. let onApplyOverlay = (eventId, toolbox, panelFrame) => { Trace.sysout("ToolboxChrome.onApplyOverlay; " + overlayId, panelFrame); let context = this.getContext(toolbox); // Bail out if the overlay already exists for this context/toolbox. if (context.getOverlay(overlayId)) { return; } // Bail out if there is already an overlay for the panel. if (context.getPanelOverlay(panelId)) { TraceError.sysout("ToolboxChrome.initialize; There is already an " + "overlay for: " + panelId + " (overlay: " + overlayId + ")"); return; } try { // Create instance of an overlay let instance = new overlay({ panelFrame: panelFrame, toolbox: toolbox, chrome: this, id: overlay.id, context: context }); instance.panelId = panelId; context.overlays.set(overlayId, instance); // Register for 'build' event (panel instance created). toolbox.once(panelId + "-build", (eventId, panel) => { Trace.sysout("ToolboxChrome.applyOverlay; " + eventId, panel); instance.onBuild({toolbox: toolbox, panel: panel}); }); // Register for 'ready' event (panel frame loaded). toolbox.once(panelId + "-ready", (eventId, panel) => { Trace.sysout("ToolboxChrome.applyOverlay; " + eventId, panel); instance.onReady({toolbox: toolbox, panel: panel}); }); } catch (err) { TraceError.sysout("ToolboxChrome.initialize; Overlay for: " + overlay.id + " EXCEPTION " + err, err); } }; // Use 'on' (not 'once') listener since the '*-init' event is sent // every time the toolbox is closed and opened again. The listener // will be removed in destroyOverlay method when the extension is // destroyed. gDevTools.on(panelId + "-init", onApplyOverlay); this.registeredOverlays.set(overlayId, { ctor: overlay, creator: onApplyOverlay }) }, unregisterPanelOverlay: function(overlay) { let overlayId = overlay.prototype.overlayId; Trace.sysout("ToolboxChrome.unregisterOverlay; " + overlayId, overlay); let entry = this.registeredOverlays.get(overlayId); gDevTools.off(overlayId + "-init", entry.creator); this.registeredOverlays.delete(overlayId); }, registerToolboxOverlay: function(overlay) { let overlayId = overlay.prototype.overlayId; Trace.sysout("ToolboxChrome.registerToolboxOverlay; " + overlayId, overlay); let onApplyOverlay = (eventId, toolbox) => { Trace.sysout("ToolboxChrome.onApplyToolboxOverlay; " + overlayId, toolbox); let context = this.getContext(toolbox); // Bail out if the overlay already exists for this context/toolbox. if (context.getOverlay(overlayId)) { return; } try { // Create instance of an overlay let instance = new overlay({ toolbox: toolbox, chrome: this, context: context, }); context.overlays.set(overlayId, instance); Dispatcher.emit("onToolboxOverlay", [{ overlay: instance, toolbox }]) // Execute 'onReady' on the overlay instance when the toolbox // is ready. There are two options, (a) the toolbox is already // ready at this point (extension installed dynamically in the // middle of Firefox session), (b) the toolbox is not ready yet // and it's necessary to wait for the event. if (toolbox.isReady) { instance.onReady({toolbox: toolbox}); } else { gDevTools.once("toolbox-ready", () => { instance.onReady({toolbox: toolbox}); }); } } catch (err) { TraceError.sysout("ToolboxChrome.initialize; Overlay for: " + overlay.id + " EXCEPTION " + err, err); } }; // Use 'on' (not 'once') listener since the create event is sent // every time a toolbox is created (can be also on another browser tab). gDevTools.on("toolbox-created", onApplyOverlay); this.registeredOverlays.set(overlayId, { ctor: overlay, creator: onApplyOverlay }) // Apply the overlay on all existing toolboxes. Registered toolbox // overlays must be always instantiated before registered panel // overlays. for (let [target, toolbox] of gDevTools._toolboxes) { target.makeRemote().then(() => { onApplyOverlay(null, toolbox); }); } }, unregisterToolboxOverlay: function(overlay) { let overlayId = overlay.prototype.overlayId; Trace.sysout("ToolboxChrome.unregisterToolboxOverlay; " + overlayId, overlay); let entry = this.registeredOverlays.get(overlayId); gDevTools.off("toolbox-ready", entry.creator); this.registeredOverlays.delete(overlayId); }, getOverlay: function(toolbox, overlayId) { let context = this.getContext(toolbox); return context.getOverlay(overlayId); }, // Context getContext: function(toolbox) { let target = toolbox.target; let context = this.contexts.get(target); if (!context) { context = new Context(toolbox); this.contexts.set(target, context); } return context; }, }); function getToolboxWhenReady(toolId) { let deferred = defer(); showToolbox(toolId).then(toolbox => { deferred.resolve(toolbox); }); return deferred.promise; } // Exports from this module exports.ToolboxChrome = ToolboxChrome;
29.630631
77
0.652377
0da61e1b55bf44f6681cf16f0e9a5768aab897dd
2,201
js
JavaScript
forms-reactive-assignment-start/CourseProject/prj-observables-final/dist/out-tsc/app/recipes/recipe-list/recipe-list.component.js
AlbertJvR/angular4references
4073d126603c50f573e0c1f15ab163c28f9e751a
[ "MIT" ]
null
null
null
forms-reactive-assignment-start/CourseProject/prj-observables-final/dist/out-tsc/app/recipes/recipe-list/recipe-list.component.js
AlbertJvR/angular4references
4073d126603c50f573e0c1f15ab163c28f9e751a
[ "MIT" ]
null
null
null
forms-reactive-assignment-start/CourseProject/prj-observables-final/dist/out-tsc/app/recipes/recipe-list/recipe-list.component.js
AlbertJvR/angular4references
4073d126603c50f573e0c1f15ab163c28f9e751a
[ "MIT" ]
null
null
null
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; import { Component } from '@angular/core'; import { Router, ActivatedRoute } from '@angular/router'; import { RecipeService } from '../recipe.service'; var RecipeListComponent = (function () { function RecipeListComponent(recipeService, router, route) { this.recipeService = recipeService; this.router = router; this.route = route; } RecipeListComponent.prototype.ngOnInit = function () { var _this = this; this.recipes = this.recipeService.getRecipes(); this.subscription = this.recipeService.recipesChanged .subscribe(function (recipes) { _this.recipes = recipes; }); }; RecipeListComponent.prototype.ngOnDestroy = function () { this.subscription.unsubscribe(); }; RecipeListComponent.prototype.onNewRecipe = function () { this.router.navigate(['new'], { relativeTo: this.route }); }; return RecipeListComponent; }()); RecipeListComponent = __decorate([ Component({ selector: 'app-recipe-list', templateUrl: './recipe-list.component.html', styleUrls: ['./recipe-list.component.css'] }), __metadata("design:paramtypes", [RecipeService, Router, ActivatedRoute]) ], RecipeListComponent); export { RecipeListComponent }; //# sourceMappingURL=D:/Work/GitRepos/Angular4References/CourseProject/prj-observables-final/src/app/recipes/recipe-list/recipe-list.component.js.map
47.847826
150
0.652431
0da6a7f57132638a9e5496a15e8f0f5da98a9074
407
js
JavaScript
src/store/index.js
ACSG-64/Music-sharing_app
71cc1b45c4ff252cc258adeb7d367db8f1f6b152
[ "BSL-1.0" ]
null
null
null
src/store/index.js
ACSG-64/Music-sharing_app
71cc1b45c4ff252cc258adeb7d367db8f1f6b152
[ "BSL-1.0" ]
null
null
null
src/store/index.js
ACSG-64/Music-sharing_app
71cc1b45c4ff252cc258adeb7d367db8f1f6b152
[ "BSL-1.0" ]
null
null
null
import { createStore } from 'vuex'; import auth from './modules/auth'; import player from './modules/player'; export default createStore({ modules: {}, state: { ...auth.state, ...player.state, }, getters: { ...auth.getters, ...player.getters, }, mutations: { ...auth.mutations, ...player.mutations, }, actions: { ...auth.actions, ...player.actions, }, });
16.958333
38
0.574939
0da84ea49a210816fcc6b54b10fe0c226d3f339d
4,557
js
JavaScript
src/providers/Facebook.js
snapmaster-io/snapmaster
397a23c533381181a824e5e0ad7cc8ff7b1e6f7e
[ "Apache-2.0" ]
3
2020-04-16T20:50:15.000Z
2020-04-18T04:58:36.000Z
src/providers/Facebook.js
snapmaster-io/snapmaster
397a23c533381181a824e5e0ad7cc8ff7b1e6f7e
[ "Apache-2.0" ]
1
2020-04-22T21:50:26.000Z
2020-04-23T00:55:40.000Z
src/providers/Facebook.js
snapmaster-io/snapmaster
397a23c533381181a824e5e0ad7cc8ff7b1e6f7e
[ "Apache-2.0" ]
null
null
null
import React, { useState } from 'react' import { useApi } from '../utils/api' import BaseProvider from './BaseProvider' import CardDeck from 'react-bootstrap/CardDeck' import Card from 'react-bootstrap/Card' import HighlightCard from '../components/HighlightCard' import FilterTable from '../components/FilterTable' const FacebookPage = () => { const [data, setData] = useState(); return ( <BaseProvider pageTitle='Facebook pages' connectionName='facebook' endpoint='facebook' setData={setData}> <PageCards data={data} /> </BaseProvider> ) } const PageCards = ({data}) => { const { get } = useApi(); const [reviewsData, setReviewsData] = useState(); const [reviews, setReviews] = useState(); const [selected, setSelected] = useState(); const getPage = async (id, accessToken) => { // store the state associated with the selected page setSelected(id); const endpoint = `facebook/reviews/${id}`; const headers = { token: accessToken }; const [response, error] = await get(endpoint, headers); if (error || !response.ok) { setReviewsData(null); setReviews(null); return; } const items = await response.json(); if (items && items.map) { setReviewsData(items); const data = items.map(item => { return { page_id: id, created_time: item.created_time, date: new Date(item.created_time).toLocaleString(), type: item.recommendation_type, text: item.review_text } }); setReviews(data); } } const urlFormatter = (cell, row) => { const review = `https://www.facebook.com/${row.page_id}/reviews`; return <a href={review} target="_">{cell}</a> } const typeFormatter = (cell, row, rowIndex, formatExtraData) => { return ( <i className={ formatExtraData[cell] } /> ) } const columns = [{ dataField: 'date', text: 'Date', sort: true, headerStyle: (column, colIndex) => { return { width: '220px' }; } }, { dataField: 'type', text: 'Type', sort: true, headerStyle: (column, colIndex) => { return { width: '100px' }; }, align: 'center', formatter: typeFormatter, formatExtraData: { positive: 'fa fa-thumbs-up fa-2x text-success', neutral: 'fa fa-minus fa-2x text-warning', negative: 'fa fa-thumbs-down fa-2x text-danger' } }, { dataField: 'text', text: 'Text', formatter: urlFormatter }]; return ( <div> <div style={{ position: "fixed", background: "white", width: "100%", marginTop: "-1px", height: "151px", zIndex: 5 }}> <CardDeck> { data && data.map ? data.map((item, key) => { const { name, id, access_token} = item; const border = (id === selected) ? 'primary' : null; const displayName = name.length > 20 ? name.slice(0, 19) + '...' : name; const url = `https://www.facebook.com/${id}`; const imageUrl = `http://graph.facebook.com/${id}/picture?access_token=${access_token}`; const loadPageComments = () => { getPage(id, access_token); } return ( <HighlightCard className="text-center" onClick={loadPageComments} key={key} border={ border ? border : null } style={{ maxWidth: '200px' }}> <Card.Header> <Card.Link href={url} target="_blank">{displayName}</Card.Link> </Card.Header> <Card.Body> <Card.Img src={imageUrl} alt={displayName} style={{ maxHeight: 100, maxWidth: 100 }} /> </Card.Body> </HighlightCard> ) }) : <div/> } </CardDeck> </div> { reviewsData ? <div style={{ position: "fixed", top: 350 }}> <div style={{ position: "sticky", top: 0 }}> <h4>Reviews</h4> </div> <FilterTable data={reviewsData} setData={setReviewsData} dataRows={reviews} columns={columns} keyField="created_time" path={`facebook/reviews/${selected}`} maxHeight="calc(100vh - 460px)" /> </div> : <div/> } </div> ) } export default FacebookPage
27.125
105
0.53149
0da86b23a898f74506740aa44f14ace5eaf1a165
264
js
JavaScript
src/app/routes/main.js
himakargalipuri/express-template
9aedd141b39aec6588f4412a889d46de5b1b6329
[ "MIT" ]
null
null
null
src/app/routes/main.js
himakargalipuri/express-template
9aedd141b39aec6588f4412a889d46de5b1b6329
[ "MIT" ]
null
null
null
src/app/routes/main.js
himakargalipuri/express-template
9aedd141b39aec6588f4412a889d46de5b1b6329
[ "MIT" ]
null
null
null
const express = require('express') const router = express.Router() const indexRoutes = require('./index') const userRoutes = require('./user') // imports all routes to one file router.use('/', indexRoutes) router.use('/user', userRoutes) module.exports = router
26.4
38
0.723485
0dab5e7856817fbfad802e15288c03e0a226d7fa
3,302
js
JavaScript
public/template/js/header.js
bisend/feelandfly
f477158e80f2af9f91a124d99eb546885a476a59
[ "MIT" ]
null
null
null
public/template/js/header.js
bisend/feelandfly
f477158e80f2af9f91a124d99eb546885a476a59
[ "MIT" ]
null
null
null
public/template/js/header.js
bisend/feelandfly
f477158e80f2af9f91a124d99eb546885a476a59
[ "MIT" ]
null
null
null
/* left slide bar */ function openNav(e) { $('#mySidenav').animate({ marginLeft: '0px' }, 250, 'swing', function () { $('body').css('overflow-x', 'hidden'); $('body').css('overflow-y', 'hidden'); }); setTimeout(function () { $('.nav-sidebar-bg').fadeIn(150); }, 100); } function closeNav(e) { $('body').css('overflow-x', 'auto'); $('body').css('overflow-y', 'auto'); $('.nav-sidebar-bg').fadeOut(250); $('#mySidenav').animate({ marginLeft: '-290px' }, 250, 'swing'); } function fixedPositionBtnMenu(){ var parentLeft = $("[data-menu-open-link]").closest(".container").offset().left + 15; $("[data-menu-open-link]").css("left", parentLeft); } $(document).ready(function () { fixedPositionBtnMenu(); var menuOpenLink = '[data-menu-open-link]', menuCloseLink = '[data-menu-close-link]', isMenuOpened = false; $('body').on('click touchend', menuOpenLink, function (e) { e.stopPropagation(); openNav(e); isMenuOpened = true; }); $('body').on('click', menuCloseLink, function (e) { e.stopPropagation(); closeNav(e); isMenuOpened = false; }); $('body').on('click', '[data-close-sidebar-nav]', function (e) { closeNav(e); isMenuOpened = false; }); $(document).on('click', 'body', function (e) { var $target = $(e.target); if (isMenuOpened && ($target.attr('id') != 'mySidenav' && $target.closest('#mySidenav').length === 0)) { closeNav(e); isMenuOpened = false; } }); }); /* left slide bar END */ var SHOW_HEADER_TOP_BAR = false; /*--- SLICK NAVBAR ----*/ $(window).load(function() { if ($(window).width() > 991) { SHOW_HEADER_TOP_BAR = true; } else { $('.header-topbar').css('display', 'none'); } var objToStick = $(".header-main"); //Получаем нужный объект var topOfObjToStick = $(objToStick).offset().top; //Получаем начальное расположение нашего блока $(window).scroll(function () { var windowScroll = $(window).scrollTop(); //Получаем величину, показывающую на сколько прокручено окно if (SHOW_HEADER_TOP_BAR) { if (windowScroll > topOfObjToStick) { // Если прокрутили больше, чем расстояние до блока, то приклеиваем его $('.header-topbar').slideUp(200, function() { $(objToStick).addClass("topWindow"); }); } else { $('.header-topbar').slideDown(400); $(objToStick).removeClass("topWindow"); } } }); }); /*--- SLICK NAVBAR END ----*/ $(window).resize(function() { fixedPositionBtnMenu(); if ($(window).width() <= 991) { SHOW_HEADER_TOP_BAR = false; $('.header-topbar').css('display', 'none'); } else { SHOW_HEADER_TOP_BAR = true; $('.header-topbar').slideDown(400); $(".header-main").removeClass("topWindow"); } }); /*LANG header*/ $(document).ready(function() { $('.general-leng').click(function () { $('.ather-lang').stop(100,100).fadeToggle(100); }); }); /*LANG cart header END*/
25.015152
110
0.531496
0dabb4c6f00710e303ca939bedf0edbf07227907
704
js
JavaScript
src/search-box/styles.js
anchorchat/anchor-ui
d4e7e40a52fab016c3c42ac19872220390602cda
[ "MIT" ]
19
2017-02-17T08:13:30.000Z
2020-04-30T20:10:19.000Z
src/search-box/styles.js
anchorchat/anchor-ui
d4e7e40a52fab016c3c42ac19872220390602cda
[ "MIT" ]
368
2017-01-06T10:42:49.000Z
2020-05-26T22:46:31.000Z
src/search-box/styles.js
anchorchat/anchor-ui
d4e7e40a52fab016c3c42ac19872220390602cda
[ "MIT" ]
8
2017-03-13T10:42:30.000Z
2020-04-30T20:10:20.000Z
import colors from '../settings/colors'; export default { root: { height: '48px', width: '100%', position: 'relative' }, input: { appearance: 'none', border: '0', boxSizing: 'border-box', color: colors.icons, backgroundColor: colors.background, fontSize: '16px', lineHeight: '16px', paddingTop: '8px', paddingBottom: '8px', paddingLeft: '40px', paddingRight: '8px', width: '100%', height: '100%', fontWeight: 'inherit', fontFamily: 'inherit', ':focus': { outline: 'none' } }, icon: { position: 'absolute', top: '12px', left: '8px' }, placeholder: { color: colors.placeholderText } };
18.051282
40
0.56108
0dabcfabb1977f511dcc8f9570e1beb9b449082c
375
js
JavaScript
file/src/components/ContextProviderComp.js
Sukarnascience/React_Learning
023b6622707356680cfb061d2ea78a9f0c6bdb25
[ "MIT" ]
null
null
null
file/src/components/ContextProviderComp.js
Sukarnascience/React_Learning
023b6622707356680cfb061d2ea78a9f0c6bdb25
[ "MIT" ]
null
null
null
file/src/components/ContextProviderComp.js
Sukarnascience/React_Learning
023b6622707356680cfb061d2ea78a9f0c6bdb25
[ "MIT" ]
null
null
null
import React from 'react' import ContextConsume from './ContextConsumerComp' const UserContext = React.createContext() const UserProvider = UserContext.Provider export const UserConsumer = UserContext.Consumer function ContextPass(){ return( <UserProvider value = "Jana"> <ContextConsume/> </UserProvider> ) } export default ContextPass
23.4375
50
0.722667
0dabe26f99b35cd20c6440844147dab4dcfa83cf
432
js
JavaScript
test/auth-methods/TestUtils.js
advanced-rest-client/authorization
3094f44b984e1c1d26f4e0d8cb425e9cd95c40b5
[ "MIT" ]
1
2021-07-27T23:21:11.000Z
2021-07-27T23:21:11.000Z
test/auth-methods/TestUtils.js
advanced-rest-client/authorization
3094f44b984e1c1d26f4e0d8cb425e9cd95c40b5
[ "MIT" ]
2
2021-07-08T20:41:07.000Z
2021-09-01T00:05:08.000Z
test/auth-methods/TestUtils.js
advanced-rest-client/authorization
3094f44b984e1c1d26f4e0d8cb425e9cd95c40b5
[ "MIT" ]
1
2021-07-06T14:44:50.000Z
2021-07-06T14:44:50.000Z
import { assert } from '@open-wc/testing'; export const validateInput = (input, isRequired) => { assert.ok(input, 'input is rendered'); if (isRequired) { assert.isTrue(input.autoValidate, 'input is auto validate'); assert.isTrue(input.required, 'input is required'); assert.ok(input.invalidMessage, 'required input has invalid message'); } else { assert.notOk(input.required, 'input is not required'); } };
33.230769
74
0.69213
0dac41ca18476cc71af76d3dc8ec16e6b8bbbdd9
278
js
JavaScript
src/contentScripts/components/PivotalStory/Loading.js
bionikspoon/pivotal-github-ext
150e0380e9683856896049b11082e4e829f7d111
[ "MIT" ]
null
null
null
src/contentScripts/components/PivotalStory/Loading.js
bionikspoon/pivotal-github-ext
150e0380e9683856896049b11082e4e829f7d111
[ "MIT" ]
1
2020-12-06T18:02:11.000Z
2020-12-06T18:02:11.000Z
src/contentScripts/components/PivotalStory/Loading.js
bionikspoon/pivotal-github-ext
150e0380e9683856896049b11082e4e829f7d111
[ "MIT" ]
null
null
null
/* @flow */ import React from 'react' import LoadingSpinner from '../LoadingSpinner' import Well from '../Well' import './PivotalStory.css' export default function Loading() { return ( <Well className="PivotalStory__container"> <LoadingSpinner /> </Well> ) }
19.857143
46
0.679856
0dad395dee68b18ce53200bbfd5924ce957127b6
1,094
js
JavaScript
src/js/Game/game.js
remigodbille/stubborn-knight
39258a7be366f95cf83d6e309a8d064f73b9bef5
[ "MIT" ]
null
null
null
src/js/Game/game.js
remigodbille/stubborn-knight
39258a7be366f95cf83d6e309a8d064f73b9bef5
[ "MIT" ]
null
null
null
src/js/Game/game.js
remigodbille/stubborn-knight
39258a7be366f95cf83d6e309a8d064f73b9bef5
[ "MIT" ]
null
null
null
var characterArchetypes = {}; var mobArchetypes = {}; var mainCharacter = null; var city = null; /* Reads every Playable and Mob Archetypes from the config, creates a single instance for each of them and stores them. Don't recreate any other Archetype instances, use the objects containing them. Instianciates the hero as well as The City Binds an event to start adventuring */ my.init = function() { config.characterArchetypes.forEach(function(config) { var archetype = new Archetype(config.name, config.stats); characterArchetypes[archetype.name] = archetype; }); config.mobArchetypes.forEach(function(config) { var archetype = new Archetype(config.name, config.stats); mobArchetypes[archetype.name] = archetype; }); mainCharacter = new Character(characterArchetypes.knight, 1, "knight"); city = new Zone('the City', 0, false); mainCharacter.moveTo(city); App.Observer.on('buttonAdventureClicked', play); } /* Start adventuring on the first level of the road */ function play() { var road = new Zone('the Road', 1, true); mainCharacter.moveTo(road); }
35.290323
198
0.734918
0dae25e166c0e9737248472c205341ac9c35cc76
85
js
JavaScript
node_modules/ant-design-vue/es/date-picker/index.js
daothiem/source-base-webadmin
4382d28d17662530192213f4dd8525fbfda3bc88
[ "MIT" ]
null
null
null
node_modules/ant-design-vue/es/date-picker/index.js
daothiem/source-base-webadmin
4382d28d17662530192213f4dd8525fbfda3bc88
[ "MIT" ]
null
null
null
node_modules/ant-design-vue/es/date-picker/index.js
daothiem/source-base-webadmin
4382d28d17662530192213f4dd8525fbfda3bc88
[ "MIT" ]
null
null
null
import DatePicker from './dayjs'; export * from './dayjs'; export default DatePicker;
28.333333
33
0.741176
0dae32f88c2ff06e51296fbe9e85560211c4b3ae
1,425
js
JavaScript
src/group.js
nuintun/tween
d5bb4c83c2f2207044017480b79c2201a00fa03f
[ "MIT" ]
1
2020-07-28T13:47:57.000Z
2020-07-28T13:47:57.000Z
src/group.js
nuintun/tween
d5bb4c83c2f2207044017480b79c2201a00fa03f
[ "MIT" ]
2
2017-07-28T07:45:02.000Z
2019-05-16T03:22:47.000Z
src/group.js
nuintun/tween
d5bb4c83c2f2207044017480b79c2201a00fa03f
[ "MIT" ]
null
null
null
/** * @module group * @license MIT * @author nuintun */ import Tween from './tween'; import { now } from './now'; import * as Utils from './utils'; /** * @class Group * @constructor */ export default function Group() { this._tweens = []; } // Set prototype Group.prototype = { /** * @method items * @returns {Tween[]} */ items: function() { return this._tweens; }, /** * @method add * @param {Tween} tween */ add: function(tween) { var tweens = this._tweens; if (tween instanceof Tween && Utils.indexOf(tweens, tween) === -1) { tweens.push(tween); } }, /** * @method remove * @param {Tween} tween */ remove: function(tween) { var context = this; if (arguments.length === 0) { context._tweens = []; } else { var tweens = context._tweens; var index = Utils.indexOf(tweens, tween); Utils.remove(tweens, index); } }, /** * @method update * @param {number} time * @param {boolean} preserve * @returns {boolean} */ update: function(time, preserve) { var tweens = this._tweens; if (tweens.length === 0) { return false; } time = Utils.isNonNegative(time) ? time : now(); var i = 0; while (i < tweens.length) { if (tweens[i].update(time) || preserve) { i++; } else { Utils.remove(tweens, i); } } return true; } };
17.168675
72
0.541053
0dae549d1d901506f417401736de16e166ea1234
500
js
JavaScript
src/__tests__/Header.test.js
ReeganExE/news12
20298fff0e15e8d17a77d6869f9f43f80868d796
[ "MIT" ]
2
2018-11-03T09:35:17.000Z
2018-12-04T03:44:59.000Z
src/__tests__/Header.test.js
ReeganExE/news12
20298fff0e15e8d17a77d6869f9f43f80868d796
[ "MIT" ]
null
null
null
src/__tests__/Header.test.js
ReeganExE/news12
20298fff0e15e8d17a77d6869f9f43f80868d796
[ "MIT" ]
null
null
null
import React from 'react'; import { shallow } from 'enzyme'; import { HeaderComponent } from '../Header'; jest.mock('../topics', () => [ { key: 'thoi-su', text: 'thoi su', visible: true }, { key: 'kinh-te', text: 'thoi su' } ]); describe('<Header />', () => { const wrapper = shallow(<HeaderComponent />); it('should have words highlighted', () => { // 1 for Home, 1 for About & a visible one expect(wrapper.find('li.nav-item')).toHaveLength(3); }); });
19.230769
56
0.56
0daf47e4c74cb54865dce292a47f2f32ea404389
1,340
js
JavaScript
src/server/modules/photo.js
fuziwang/pleasing_growth
23310710366796ed698a1e9425d73acf9a99cdaa
[ "MIT" ]
2
2018-12-12T06:22:05.000Z
2019-12-09T07:50:24.000Z
project/src/server/modules/photo.js
fuziwang/software
633133dc65af0a757c7be76161fae9a7b22422c1
[ "MIT" ]
null
null
null
project/src/server/modules/photo.js
fuziwang/software
633133dc65af0a757c7be76161fae9a7b22422c1
[ "MIT" ]
3
2018-11-21T09:59:46.000Z
2019-03-11T09:03:05.000Z
const db = require('./database.js'); var Photo = function(){}; Photo.prototype.getAll = function(cb){ const sql = 'select pid,pname,ptype,plocal,ptime,pstatus from Photo'; db.query(sql,(err,result)=>{ if(err){ cb(true); return; } cb(false,result); }); } Photo.prototype.selectPhoto = function(content,cb){ const sql = 'select pid,pname,ptype,plocal,ptime,pstatus from Photo where pname like ?'; db.query(sql,['%' + content + '%'],(err,result)=>{ if(err){ cb(true); return; }else{ cb(false,result); } }); } Photo.prototype.deleteItem = function(id,cb){ const sql = 'delete from Photo where pid = ?'; db.query(sql,[id],(err,result)=>{ if(err){ cb(true); return; }else{ cb(false,result); } }); } Photo.prototype.updateItem = function(status,id,cb){ const sql = 'update Photo set pstatus = ? where pid = ?'; db.query(sql,[status,id],(err,result)=>{ if(err){ cb(true); return; } cb(false,result); }); } Photo.prototype.addItem = function(obj,cb){ const sql='insert into Photo values(?,?,?,?,?,?,?)'; db.query(sql,[obj.pid,obj.pname,obj.ptype,obj.plocal,Date().slice(0,24),1,obj.xid],(err,result)=>{ if(err){ cb(true); return; } cb(false,result); }); } module.exports = Photo;
21.269841
100
0.582836
0db10b77d4eb89f5a6be806aef0349f4435a5d36
1,225
js
JavaScript
src/js/date/components/details.js
ocamler/expense-www
626858f2c9edc902e80336e14ad9bc9e5789e6bd
[ "MIT" ]
2
2019-04-01T15:54:24.000Z
2019-05-03T07:23:20.000Z
src/js/date/components/details.js
ocamler/expense-www
626858f2c9edc902e80336e14ad9bc9e5789e6bd
[ "MIT" ]
1
2020-04-29T22:37:52.000Z
2020-04-29T22:37:52.000Z
src/js/date/components/details.js
ocamler/expense-www
626858f2c9edc902e80336e14ad9bc9e5789e6bd
[ "MIT" ]
null
null
null
import React, { Component } from 'react'; import { connect } from 'react-redux'; import { AmountItem } from './amount_item'; @connect( state => ({ details: state.details }) ) export default class extends Component { render() { const { method_payment, amounts } = this.props.details; const total = amounts.reduce((prevVal, i) => { return prevVal + parseFloat(i.amount); }, 0.00); return ( <div> <h4 className="text-center close-bottom"> <small>{'Payment Method:'}</small> {' '} {method_payment} </h4> <h4 className="text-center close-bottom"> <small>{'Items:'}</small> </h4> <ul className="expenseItemReview"> {amounts.map(i => ( <AmountItem key={i.id} id={i.id} amount={i.amount} cat_desc={i.cat_desc} isTaxd={i.isTaxd} /> ))} </ul> {amounts.length > 1 ? ( <p className="text-center"> <i>{'Total: $'}<b>{total}</b></i> </p> ) : ''} </div> ) } } // TODO: put all this info in a <table>
24.5
59
0.470204
0db17d593807e15949a46823ebbaa5a37e3551ad
9,827
js
JavaScript
public/js/commonFunction/residualEstirmate.js
AlfredYang1986/RO-Service
69688bd9e1ce43f756957a8c33180832d16008dd
[ "CC0-1.0" ]
null
null
null
public/js/commonFunction/residualEstirmate.js
AlfredYang1986/RO-Service
69688bd9e1ce43f756957a8c33180832d16008dd
[ "CC0-1.0" ]
null
null
null
public/js/commonFunction/residualEstirmate.js
AlfredYang1986/RO-Service
69688bd9e1ce43f756957a8c33180832d16008dd
[ "CC0-1.0" ]
null
null
null
/** * Created by clock on 2017/7/1. */ //切换tab动画 function resetTabs() { $("#content > div").hide(); //Hide all content $("#tabs a").attr("id", ""); //Reset id's } var myUrl = window.location.href; //get URL var myUrlTab = myUrl.substring(myUrl.indexOf("#")); // For localhost/tabs.html#tab2, myUrlTab = #tab2 var myUrlTabName = myUrlTab.substring(0, 4); // For the above example, myUrlTabName = #tab (function () { $("#content > div").hide(); // Initially hide all content $("#tabs li:first a").attr("id", "current"); // Activate first tab $("#content > div:first").fadeIn(); // Show first tab content $("#tabs a").on("click", function (e) { e.preventDefault(); if ($(this).attr("id") == "current") { //detection for current tab return } else { resetTabs(); $(this).attr("id", "current"); // Activate this $($(this).attr('name')).fadeIn(); // Show content for current tab } }); for (i = 1; i <= $("#tabs li").length; i++) { if (myUrlTab == myUrlTabName + i) { resetTabs(); $("a[name='" + myUrlTab + "']").attr("id", "current"); // Activate url tab $(myUrlTab).fadeIn(); // Show url tab content } } })() jQuery(document).ready(function () { jQuery('#table1').dataTable({"sPaginationType": "full_numbers"}); //加载数据 loadTable(); }); //提交并验证表单 function pushNaturalSales() { var productName = $("#productName").val(); var channelName = $("#channelName").val(); var gainRate = $("#gainRate").val(); if (productName == '') { $.tooltip('产品名称还没填呢...'); productName.focus(); return false; } else if (channelName == '') { $.tooltip('渠道名称还没填呢...'); channelName.focus(); return false; } else if (gainRate == '') { $.tooltip('信息传达率还没填呢...'); gainRate.focus(); return false; } else {//submit var d = JSON.stringify({ "token" : $.session.get('token'), "productName": productName, "channelName": channelName, "channelEffectiveScope": $("#channelEffectiveScope").val(), "competition": $("#competition").val(), "gainRate": gainRate, "channelInvestPercentage": $("#channelInvestPercentage").val(), "channelEffect": $("#channelEffect").val(), "investFloor": $("#investFloor").val(), "investCeiling": $("#investCeiling").val(), }); $.ajax({ contentType: "application/json,charset=utf-8", dataType: "json", type: "POST", data: d, url: "/common/residual/push", success: function (result) { if (result.status == "error") { $.tooltip('残留量录入失败'); } else { $.tooltip("残留量录入成功", 2000, true, function () { $.closeDialog(function () { window.location = "/common/residualEstirmate" }); }); } } }) } } function loadTable(){ var skip = arguments[0] ? arguments[0] : 0; var take = arguments[1] ? arguments[1] : 20; var d = JSON.stringify({ "token" : $.session.get('token'),//$.cookie("token") "skip" : skip, "take" : take }); $.ajax({ contentType: "application/json,charset=utf-8", type: "POST", data: d, url: "/common/residual/lst", success: function(data) { if(data.status == "error"){ $.tooltip('数据获取失败'); }else{ var result = data.result.result var htmlsb = ""; for (var i in result) { htmlsb += "<tr class='odd gradeX'>"; htmlsb += "<td class='center'>" + result[i].productName + "</td>"; htmlsb += "<td class='center'>" + result[i].channelName + "</td>"; htmlsb += "<td class='center'>" + result[i].channelEffectiveScope + "</td>"; htmlsb += "<td class='center'>" + result[i].competition + "</td>"; htmlsb += "<td class='center'>" + result[i].gainRate + "</td>"; htmlsb += "<td class='center'>" + result[i].channelInvestPercentage + "</td>"; htmlsb += "<td class='center'>" + result[i].channelEffect + "</td>"; htmlsb += "<td class='center'>" + result[i].investFloor + "</td>"; htmlsb += "<td class='center'>" + result[i].investCeiling + "</td>"; htmlsb += "<td class='center'>" + L2Date(result[i].createDate) + "</td>"; htmlsb += "<td class='center'>"; htmlsb += "<a href=\"javascript:editBut(\'"+ result[i].estimateId +"\');\"><i class=\"fa fa-edit\"></i></a>"; htmlsb += "<a href=\"javascript:delObject(\'"+ result[i].estimateId +"\');\" class=\"delete-row\"><i class=\"fa fa-trash-o\"></i></a>"; htmlsb += "</td>"; htmlsb += "</tr>"; } $('tbody[id="tbody"]').html(htmlsb); } } }) } function L2Date(l){ return new Date(parseInt(l)).toLocaleString().substr(0,9); } function editBut(id){ var d = JSON.stringify({ "token" : $.session.get('token'),//$.cookie("token") "estimateId" : id }); $.ajax({ contentType: "application/json,charset=utf-8", type: "POST", data: d, url: "/common/residual/lst", success: function (data) { if (data.status == "error") { $.tooltip('数据获取失败'); } else { var result = data.result.result if(result.length == 1){ $("#productName").val(result[0].productName); $("#channelName").val(result[0].channelName); $("#channelEffectiveScope").val(result[0].channelEffectiveScope); $("#competition").val(result[0].competition); $("#gainRate").val(result[0].gainRate); $("#channelInvestPercentage").val(result[0].channelInvestPercentage); $("#channelEffect").val(result[0].channelEffect); $("#investFloor").val(result[0].investFloor); $("#investCeiling").val(result[0].investCeiling); $("#createDate").val(result[0].createDate); $("#submitBtn").attr("onclick","editObject('"+ id +"')"); $("#tabs a").eq(0).click(); }else{ $.tooltip('数据获取出错'); } } } }); } function editObject(id) { var productName = $("#productName").val(); var channelName = $("#channelName").val(); var gainRate = $("#gainRate").val(); if (productName == '') { $.tooltip('产品名称还没填呢...'); productName.focus(); return false; } else if (channelName == '') { $.tooltip('渠道名称还没填呢...'); channelName.focus(); return false; } else if (gainRate == '') { $.tooltip('信息传达率还没填呢...'); gainRate.focus(); return false; } else {//submit var d = JSON.stringify({ "token" : $.session.get('token'), "estimateId" : id, "productName": productName, "channelName": channelName, "channelEffectiveScope": $("#channelEffectiveScope").val(), "competition": $("#competition").val(), "gainRate": gainRate, "channelInvestPercentage": $("#channelInvestPercentage").val(), "channelEffect": $("#channelEffect").val(), "investFloor": $("#investFloor").val(), "investCeiling": $("#investCeiling").val(), "createDate": parseInt($("#createDate").val()) }); $.ajax({ contentType: "application/json,charset=utf-8", dataType: "json", type: "POST", data: d, url: "/common/residual/update", success: function (result) { if (result.status == "error") { $.tooltip('数据修改失败'); } else { $.tooltip("数据修改成功", 2000, true, function () { $.closeDialog(function () { window.location = "/common/residualEstirmate" }); }); } } }); } } function delObject(id) { $.dialog('confirm', '提示', '您确认要删除么?', 0, function () { var d = JSON.stringify({ "token" : $.session.get('token'),//$.cookie("token") "estimateId" : id }); $.ajax({ contentType: "application/json,charset=utf-8", dataType: "json", type: "POST", data: d, url: "/common/residual/drop", success: function (result) { if (result.status == "error") { $.tooltip(result.statusMsg, 2000, true, function () { $.closeDialog(function () { }); }); return false; } else { $.tooltip("数据删除成功", 2000, true, function () { $.closeDialog(function () { window.location = "/common/residualEstirmate" }); }); } } }) }); }
36.396296
163
0.458736
0db21d012c845e871338508d2b4c10733917ff21
650
js
JavaScript
oney_collector.js
theDavidBarton/oneyplays-api
b4041dd88fbf4b59055661fd48a83bb8ece2dcd1
[ "MIT" ]
null
null
null
oney_collector.js
theDavidBarton/oneyplays-api
b4041dd88fbf4b59055661fd48a83bb8ece2dcd1
[ "MIT" ]
2
2020-01-26T18:46:44.000Z
2020-04-20T11:15:38.000Z
oney_collector.js
theDavidBarton/oneyplays-api
b4041dd88fbf4b59055661fd48a83bb8ece2dcd1
[ "MIT" ]
null
null
null
// run it via Google DevTools const length = $$('ytd-playlist-video-renderer > #content > a > #meta > h3').length const arr = [] for (let i = 0; i < length; i++) { const link = $$('ytd-playlist-video-renderer > #content > a')[i].href const [ytId] = link.match(/(?<=v=)(.*)(?=&list)/) const title = $$('ytd-playlist-video-renderer > #content > a > #meta > h3')[i].innerText console.log(ytId, title) let obj = { id: i + 1, title: title.replace('Oney Plays ', '').replace('(Complete Series)', ''), yt_id: ytId, yt_thumbnail: `https://i.ytimg.com/vi/${ytId}/mqdefault.jpg` } arr.push(obj) } console.log(JSON.stringify(arr))
36.111111
90
0.604615
0db2575bb0e0282028d5421e0a9ca4146fcaf56e
255
js
JavaScript
lib/sumArrayTo.js
rix1/roast-tracker
61a1e6a29cec47c94c631a8d88f63e2b82e21868
[ "MIT" ]
null
null
null
lib/sumArrayTo.js
rix1/roast-tracker
61a1e6a29cec47c94c631a8d88f63e2b82e21868
[ "MIT" ]
null
null
null
lib/sumArrayTo.js
rix1/roast-tracker
61a1e6a29cec47c94c631a8d88f63e2b82e21868
[ "MIT" ]
null
null
null
// @flow export const sumArrayTo = (arr: Array<number>, sumToIndex: number) => { const sumTo = sumToIndex || arr.length; return arr.reduce((prev, next, index) => { if (index < sumTo) { return prev + next; } return prev; }, 0); };
21.25
71
0.584314
0db285d829e9038d50ea403f0284c7e9d0c03702
620
js
JavaScript
store.js
dolchi21/cobranzas-io
bb71250994db5ab416b1c20bde799f13d0e2da67
[ "MIT" ]
null
null
null
store.js
dolchi21/cobranzas-io
bb71250994db5ab416b1c20bde799f13d0e2da67
[ "MIT" ]
null
null
null
store.js
dolchi21/cobranzas-io
bb71250994db5ab416b1c20bde799f13d0e2da67
[ "MIT" ]
null
null
null
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } var _redux = require('redux'); var _reduxThunk = require('redux-thunk'); var _reduxThunk2 = _interopRequireDefault(_reduxThunk); var _reducerJs = require('./reducer.js'); var _reducerJs2 = _interopRequireDefault(_reducerJs); var middleware = (0, _redux.applyMiddleware)(_reduxThunk2['default']); var store = (0, _redux.createStore)(_reducerJs2['default'], middleware); exports['default'] = store; module.exports = exports['default'];
25.833333
97
0.729032
0db468a37c88155de5bc024419cec2c89d90a61f
284
js
JavaScript
app/components/Notes/Notes.js
dezoxel/github-notetaker
6ffde6751c49578126dbf2bfdb310992f9115e6a
[ "MIT" ]
null
null
null
app/components/Notes/Notes.js
dezoxel/github-notetaker
6ffde6751c49578126dbf2bfdb310992f9115e6a
[ "MIT" ]
null
null
null
app/components/Notes/Notes.js
dezoxel/github-notetaker
6ffde6751c49578126dbf2bfdb310992f9115e6a
[ "MIT" ]
null
null
null
var React = require('react'); var Notes = React.createClass({ render: function() { return ( <div> <div>Notes</div> <div>Username: {this.props.username}</div> <div>Notes: {this.props.notes}</div> </div> ); } }); module.exports = Notes;
18.933333
50
0.545775
0db5a870ee98c744b262cb256a1ed2778dd7039b
255
js
JavaScript
src/viewer/diagram/LineDiagram.js
Artsdatabanken/ecomap
dacfd918e6d2aa805fa20719f6ac882092515654
[ "MIT" ]
3
2017-07-04T19:32:15.000Z
2018-05-05T02:35:26.000Z
src/viewer/diagram/LineDiagram.js
Artsdatabanken/ecomap
dacfd918e6d2aa805fa20719f6ac882092515654
[ "MIT" ]
147
2017-06-30T09:18:03.000Z
2018-05-09T23:40:03.000Z
src/viewer/diagram/LineDiagram.js
Artsdatabanken/ecomap
dacfd918e6d2aa805fa20719f6ac882092515654
[ "MIT" ]
3
2017-07-01T07:33:15.000Z
2017-07-06T16:42:09.000Z
import React from 'react' import { LineChart, Line } from 'recharts' const LineDiagram = ({data}) => <LineChart width={400} height={400} data={data}> <Line type='monotone' dataKey='uv' stroke='#8884d8' /> </LineChart> export default LineDiagram
25.5
58
0.686275
0db72f7e83c7e6048279a195d72d5c03ee9e8480
7,092
js
JavaScript
test/unit/lib/observable.test.js
dstreet/bento-box
45aefe2ea551f7f690136f1535a59be2856d75e3
[ "MIT" ]
1
2017-05-01T16:55:12.000Z
2017-05-01T16:55:12.000Z
test/unit/lib/observable.test.js
dstreet/bento-box
45aefe2ea551f7f690136f1535a59be2856d75e3
[ "MIT" ]
null
null
null
test/unit/lib/observable.test.js
dstreet/bento-box
45aefe2ea551f7f690136f1535a59be2856d75e3
[ "MIT" ]
null
null
null
var chai = require('chai') var expect = chai.expect var spies = require('chai-spies') var Observable = require('../../../lib/observable') chai.use(spies) describe('Observable', function() { describe('constructor', function() { it('should create a new observable instance', function() { var obs = new Observable() expect(obs).to.be.instanceof(Observable) }) }) describe('_actionMethod()', function() { var obs var fn var res beforeEach(function() { obs = new Observable('add') chai.spy.on(obs, '_drainQueue') fn = function() {} res = obs._actionMethod(fn, true) }) it('should append the list of responders', function() { expect(obs._responders).to.contain({ callback: fn, filter: true }) }) it('should call _drainQueue()', function() { expect(obs._drainQueue).to.have.been.called() }) it('should return the new responder', function() { expect(res).to.contain({ callback: fn, filter: true }) }) }) describe('_drainQueue()', function() { var obs beforeEach(function() { obs = new Observable('add') }) it('should emit every action to the responder', function() { obs.emit('item1') obs.emit('item2') obs.emit('item3') var items = [] var fn = chai.spy(function(item) { items.push(item) }) obs._actionMethod(fn) expect(fn).to.have.been.called.exactly(3) expect(items).to.eql(['item1', 'item2', 'item3']) }) it('should only emit the same data to responder callback and filter', function(done) { var data = { foo: 'bar' } obs.emit(data) obs._actionMethod(function(res) { expect(res).to.eql(data) done() }, function(res) { expect(res).to.eql(data) return true }) }) }) describe('_dataMatchesFilter', function() { var obs beforeEach(function() { obs = new Observable('remove') }) it('should pass the action data to the filter function', function() { var filter = chai.spy(function(data) {}) obs._dataMatchesFilter('item1', filter) expect(filter).to.have.been.called.with('item1') }) it('should return true if the filter function returns true', function() { var filter = chai.spy(function(data) { return true }) expect(obs._dataMatchesFilter('item1', filter)).to.be.true }) it('should return false if the filter function returns false', function() { var filter = chai.spy(function(data) { return false }) expect(obs._dataMatchesFilter('item1', filter)).to.be.false }) it('should return true if no filter is defined', function() { expect(obs._dataMatchesFilter('item1')).to.be.true expect(obs._dataMatchesFilter('item1', null)).to.be.true expect(obs._dataMatchesFilter('item1', undefined)).to.be.true }) it('should return true if a value-based filter exactly matches the data', function() { expect(obs._dataMatchesFilter('item1', 'item1')).to.be.true expect(obs._dataMatchesFilter(42, 42)).to.be.true expect(obs._dataMatchesFilter(this, this)).to.be.true }) it('should return false if a value-based filter does not exactly match the data', function() { expect(obs._dataMatchesFilter('item1', 'item2')).to.be.false expect(obs._dataMatchesFilter(['item1'], ['item1'])).to.be.false expect(obs._dataMatchesFilter({ item: 1 }, { item: 1 })).to.be.false }) it('should pass the same data to the filter as is passed to the responder callback', function() { var filterData var cb = chai.spy() var filter = chai.spy(function(data) { filterData = data; return true }) obs._actionMethod(cb, filter) obs.emit({foo: 'bar'}) expect(cb).to.have.been.called.with(filterData) obs.emit('foo', 'bar') expect(cb).to.have.been.called.with(filterData) }) }) describe('_dataWithKeyMatchesFilter()', function() { var obs beforeEach(function() { obs = new Observable('remove') }) it('should pass the action data to the filter function', function() { var filter = chai.spy(function(key, data) {}) obs._dataWithKeyMatchesFilter('items', 'item1', filter) expect(filter).to.have.been.called.with('items') expect(filter).to.have.been.called.with('item1') }) it('should return true if the filter function returns true', function() { var filter = chai.spy(function(data) { return true }) expect(obs._dataWithKeyMatchesFilter('items', 'item1', filter)).to.be.true }) it('should return false if the filter function returns false', function() { var filter = chai.spy(function(data) { return false }) expect(obs._dataWithKeyMatchesFilter('items', 'item1', filter)).to.be.false }) it('should return true if no filter is defined', function() { expect(obs._dataWithKeyMatchesFilter('items', 'item1')).to.be.true expect(obs._dataWithKeyMatchesFilter('items', 'item1', null)).to.be.true expect(obs._dataWithKeyMatchesFilter('items', 'item1', undefined)).to.be.true }) it('should return true if a value-based filter exactly matches the key', function() { expect(obs._dataWithKeyMatchesFilter('items', 'item1', 'items')).to.be.true expect(obs._dataWithKeyMatchesFilter(42, 42)).to.be.true expect(obs._dataWithKeyMatchesFilter(this, this)).to.be.true }) it('should return false if a value-based filter does not exactly match the data', function() { expect(obs._dataWithKeyMatchesFilter('items', 'item1', 'tests')).to.be.false }) }) describe('emit()', function() { var obs beforeEach(function() { obs = new Observable('remove') }) it('should push the data to the queue', function() { obs.emit('item1') expect(obs._q).to.have.length(1) obs.emit('item2') expect(obs._q).to.have.length(2) }) it('should call the callback of every matching responder', function() { var fn1 = chai.spy(function(item) {}) var fn2 = chai.spy(function(item) {}) obs._actionMethod(fn1) obs._actionMethod(fn2) obs.emit('item1') expect(fn1).to.have.been.called.once() expect(fn1).to.have.been.called.with('item1') expect(fn2).to.have.been.called.once() expect(fn2).to.have.been.called.with('item1') }) it('should not call the callback of a responder that does not match', function() { var fn = chai.spy(function(item) {}) obs._actionMethod(fn, function() { return false }) obs.emit('item1') expect(fn).to.not.have.been.called() }) }) describe('unsubscribe()', function() { var obs beforeEach(function() { obs = new Observable('remove') }) it('should remove the responder from the list of responders', function() { var fn = chai.spy(function() {}) obs._actionMethod(fn) obs.unsubscribe(fn) expect(obs._responders).to.have.length(0) obs.emit('item1') expect(fn).to.not.have.been.called() }) it('should only remove a responder if both the callback and filter match', function() { var fn = chai.spy(function() {}) obs._actionMethod(fn, 'item1') obs._actionMethod(fn, 'item2') obs.unsubscribe(fn, 'item1') expect(obs._responders).to.have.length(1) obs.emit('item1') obs.emit('item2') expect(fn).to.have.been.called.exactly(1) }) }) })
26.561798
99
0.666949
0db7ab31859860bd56aec38c04b089f24cf6649f
493
js
JavaScript
loadcss.js
kevinfjbecker/dnd-data
ce40cf1ac8bdbd28a501cb1d3827ea421c6c3385
[ "MIT" ]
null
null
null
loadcss.js
kevinfjbecker/dnd-data
ce40cf1ac8bdbd28a501cb1d3827ea421c6c3385
[ "MIT" ]
1
2021-06-07T22:28:07.000Z
2021-06-07T22:42:03.000Z
loadcss.js
kevinfjbecker/dnd-data
ce40cf1ac8bdbd28a501cb1d3827ea421c6c3385
[ "MIT" ]
null
null
null
// src: https://stackoverflow.com/questions/574944/ function LoadCss( cssUrl ) { // 'cssURL' is the stylesheet's URL, i.e. /css/styles.css return new Promise( function( resolve, reject ) { var link = document.createElement( 'link' ); link.rel = 'stylesheet'; link.href = cssUrl; document.head.appendChild( link ); link.onload = function() { resolve(); console.log( 'CSS has loaded!' ); }; } ); }
20.541667
61
0.553753
0db886d7c769ac62606538369445a44aed92b045
778
js
JavaScript
src/components/Card/CardWrap.js
breadadams/react-microlink
9709db552dfcb5d1a7db0120d494e0d84e5402f7
[ "MIT" ]
null
null
null
src/components/Card/CardWrap.js
breadadams/react-microlink
9709db552dfcb5d1a7db0120d494e0d84e5402f7
[ "MIT" ]
null
null
null
src/components/Card/CardWrap.js
breadadams/react-microlink
9709db552dfcb5d1a7db0120d494e0d84e5402f7
[ "MIT" ]
null
null
null
// @flow import styled from 'styled-components' const DEFAULT = { rounded: '.42857em', width: '500px', height: '125px' } const getValue = (props, name) => typeof props[name] === 'string' ? props[name] : DEFAULT[name] const CardWrap = styled.a` font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; background: #fff; color: #181919; max-width: ${props => getValue(props, 'width')}; border-radius: ${props => props.rounded ? getValue(props, 'rounded') : '0px'}; border: 1px solid #E1E8ED; overflow: hidden; display: flex; height: ${props => getValue(props, 'height')}; text-decoration: none; transition: background-color .15s ease-in-out,border-color .15s ease-in-out; &:hover { background: #F5F8FA; } ` export default CardWrap
23.575758
80
0.660668
0db99c0caf7137a730f6047b6a94e086f6879746
313
js
JavaScript
docs/structtman_1_1_input_event.js
LioQing/personal-utils
e24d1ea1510087797c6b85bae89a3801a2e77f3d
[ "Unlicense" ]
null
null
null
docs/structtman_1_1_input_event.js
LioQing/personal-utils
e24d1ea1510087797c6b85bae89a3801a2e77f3d
[ "Unlicense" ]
null
null
null
docs/structtman_1_1_input_event.js
LioQing/personal-utils
e24d1ea1510087797c6b85bae89a3801a2e77f3d
[ "Unlicense" ]
null
null
null
var structtman_1_1_input_event = [ [ "code", "structtman_1_1_input_event.html#a182fc052082acda4d4d3787aaea1fb48", null ], [ "is_alt", "structtman_1_1_input_event.html#a5c90419fd6c880b0c99859841bc2649c", null ], [ "is_esc", "structtman_1_1_input_event.html#a8efae8d7a81b4261f69b00dfef084d1a", null ] ];
52.166667
92
0.785942
0db9f2cd878cf59424bce77b9bedd565b4c7369c
3,498
js
JavaScript
Database/Movimientos.js
elmilo/soppe_ad
8fd50a58cd73b8cea353892728cb5b19e3b6abdc
[ "MIT" ]
null
null
null
Database/Movimientos.js
elmilo/soppe_ad
8fd50a58cd73b8cea353892728cb5b19e3b6abdc
[ "MIT" ]
null
null
null
Database/Movimientos.js
elmilo/soppe_ad
8fd50a58cd73b8cea353892728cb5b19e3b6abdc
[ "MIT" ]
null
null
null
import React from 'react'; import Moment from 'react-moment'; import moment from 'moment'; import * as SQLite from "expo-sqlite"; const db = SQLite.openDatabase("db2.db"); export function getMovimientosUltimoMes(user_id, successCallback) { const begin = moment().format("YYYY-MM-01"); const end = moment().format("YYYY-MM-") + moment().daysInMonth(); //console.log('Success getMovimientosUltimoMes: '); //const start = moment().add(-4, 'm'); db.transaction((tx) => { tx.executeSql( `SELECT 'Egreso' as origen, descripcion, monto, add_dttm as fecha FROM Egresos WHERE user_id = ? UNION SELECT 'Ingreso' as origen, descripcion, monto, add_dttm as fecha FROM Ingresos WHERE user_id = ? `, [user_id, user_id], (_, { rows }) => { //console.log('Success getMovimientosUltimoMes: ', rows._array); successCallback(rows._array); }, (_, error) => { console.log('error getMovimientosUltimoMes: ' + error); //errorCallback(error); } ); }); } /******************************************************************* */ /*export function getMovimientosYTD(user_id, successCallback) { const begin = moment().format("YYYY-01-01"); db.transaction((tx) => { tx.executeSql( `SELECT 'Egreso' as origen, descripcion, monto, add_dttm as fecha FROM Egresos WHERE user_id = ? AND add_dttm >= ? UNION SELECT 'Ingreso' as origen, descripcion, monto, add_dttm as fecha FROM Ingresos WHERE user_id = ? AND add_dttm >= ?`, [user_id, begin, user_id, begin], (_, { rows }) => { //console.log('Success getMovimientosUltimoMes: ', rows._array); successCallback(rows._array); }, (_, error) => { console.log('error getMovimientosUltimoMes: ' + error); //errorCallback(error); } ); }); }*/ /********************************************************** */ export function getMovimientosYTD(user_id, successCallback) { return callGetMovimientosYTD(user_id, successCallback) ; } async function callGetMovimientosYTD(user_id, successCallback) { const begin = moment().format("YYYY-01-01"); return new Promise(function(resolve, reject) { db.transaction((tx) => { tx.executeSql( `SELECT 'Egreso' as origen, descripcion, monto, add_dttm as fecha FROM Egresos WHERE user_id = ? AND add_dttm >= ? UNION SELECT 'Ingreso' as origen, descripcion, monto, add_dttm as fecha FROM Ingresos WHERE user_id = ? AND add_dttm >= ?`, [user_id, begin, user_id, begin], (_, { rows }) => { console.log('Success callGetMovimientosYTD: ', rows._array); successCallback(rows._array) resolve(true); }, (_, error) => { console.log('error callGetMovimientosYTD: ' + error); reject(false); } ); }); }); };
29.394958
74
0.491995
0dba0ca376025a0b3753969c99f3cecbf439f17f
976
js
JavaScript
packages/scripts/src/utils/validators.spec.js
TrigenSoftware/scripts
dd7e2be6b90f51e6b94a8ae177687be3c3bbdcdd
[ "MIT" ]
null
null
null
packages/scripts/src/utils/validators.spec.js
TrigenSoftware/scripts
dd7e2be6b90f51e6b94a8ae177687be3c3bbdcdd
[ "MIT" ]
367
2019-03-05T12:32:46.000Z
2021-12-20T11:40:44.000Z
packages/scripts/src/utils/validators.spec.js
TrigenSoftware/scripts
dd7e2be6b90f51e6b94a8ae177687be3c3bbdcdd
[ "MIT" ]
1
2021-04-22T12:32:35.000Z
2021-04-22T12:32:35.000Z
import { validateTasks, validateScript } from './validators.js' describe('scripts', () => { describe('utils', () => { describe('validateTasks', () => { it('should validate tasks', () => { validateTasks('test', 'script-name') validateTasks('test', [() => true, 'script-name']) }) it('should invalidate tasks', () => { expect(() => validateTasks('test', {})).toThrow(/Cant run/) expect(() => validateTasks('test', [123])).toThrow(/Cant run/) }) }) describe('validateScript', () => { it('should validate script', () => { validateScript('test', { run: ['test'] }) }) it('should invalidate script', () => { expect(() => validateScript('', [123])).toThrow(/Script name is required/) expect(() => validateScript('test', null)).toThrow(/Unknown script/) expect(() => validateScript('test', [123])).toThrow(/Cant run/) }) }) }) })
30.5
82
0.521516
0dba76abf1c1115e9388c497d01e94c921901918
16,889
js
JavaScript
public/2.d4281a370ce9d3ddf0a2.js
geodmina/OrdenPedido
80d435674a6e531e39c522287df2cb7578793711
[ "MIT" ]
null
null
null
public/2.d4281a370ce9d3ddf0a2.js
geodmina/OrdenPedido
80d435674a6e531e39c522287df2cb7578793711
[ "MIT" ]
null
null
null
public/2.d4281a370ce9d3ddf0a2.js
geodmina/OrdenPedido
80d435674a6e531e39c522287df2cb7578793711
[ "MIT" ]
null
null
null
(window.webpackJsonp=window.webpackJsonp||[]).push([[2],{NuRj:function(t,n,e){!function(t){"use strict";function n(t,n){return t(n={exports:{}},n.exports),n.exports}var e=n(function(t){var n=t.exports={version:"2.6.5"};"number"==typeof __e&&(__e=n)}),r=n(function(t){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)}),o=n(function(t){var n=r["__core-js_shared__"]||(r["__core-js_shared__"]={});(t.exports=function(t,e){return n[t]||(n[t]=void 0!==e?e:{})})("versions",[]).push({version:e.version,mode:"global",copyright:"\xa9 2019 Denis Pushkarev (zloirock.ru)"})}),i=0,u=Math.random(),c=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++i+u).toString(36))},a=n(function(t){var n=o("wks"),e=r.Symbol,i="function"==typeof e;(t.exports=function(t){return n[t]||(n[t]=i&&e[t]||(i?e:c)("Symbol."+t))}).store=n}),s=function(t){return"object"==typeof t?null!==t:"function"==typeof t},l=function(t){if(!s(t))throw TypeError(t+" is not an object!");return t},f=function(t){try{return!!t()}catch(n){return!0}},p=!f(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),g=r.document,h=s(g)&&s(g.createElement),d=function(t){return h?g.createElement(t):{}},v=!p&&!f(function(){return 7!=Object.defineProperty(d("div"),"a",{get:function(){return 7}}).a}),y=Object.defineProperty,b={f:p?Object.defineProperty:function(t,n,e){if(l(t),n=function(t,n){if(!s(t))return t;var e,r;if("function"==typeof(e=t.toString)&&!s(r=e.call(t)))return r;if("function"==typeof(e=t.valueOf)&&!s(r=e.call(t)))return r;throw TypeError("Can't convert object to primitive value")}(n),l(e),v)try{return y(t,n,e)}catch(r){}if("get"in e||"set"in e)throw TypeError("Accessors not supported!");return"value"in e&&(t[n]=e.value),t}},m=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}},x=p?function(t,n,e){return b.f(t,n,m(1,e))}:function(t,n,e){return t[n]=e,t},S=a("unscopables"),w=Array.prototype;null==w[S]&&x(w,S,{});var O=function(t){w[S][t]=!0},j=function(t,n){return{value:n,done:!!t}},E={},I={}.toString,k=function(t){return I.call(t).slice(8,-1)},T=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==k(t)?t.split(""):Object(t)},_=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},M=function(t){return T(_(t))},L={}.hasOwnProperty,R=function(t,n){return L.call(t,n)},P=o("native-function-to-string",Function.toString),A=n(function(t){var n=c("src"),o=(""+P).split("toString");e.inspectSource=function(t){return P.call(t)},(t.exports=function(t,e,i,u){var c="function"==typeof i;c&&(R(i,"name")||x(i,"name",e)),t[e]!==i&&(c&&(R(i,n)||x(i,n,t[e]?""+t[e]:o.join(String(e)))),t===r?t[e]=i:u?t[e]?t[e]=i:x(t,e,i):(delete t[e],x(t,e,i)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[n]||P.call(this)})}),C=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t},F=function(t,n,e){if(C(t),void 0===n)return t;switch(e){case 1:return function(e){return t.call(n,e)};case 2:return function(e,r){return t.call(n,e,r)};case 3:return function(e,r,o){return t.call(n,e,r,o)}}return function(){return t.apply(n,arguments)}},$=function(t,n,o){var i,u,c,a,s=t&$.F,l=t&$.G,f=t&$.P,p=t&$.B,g=l?r:t&$.S?r[n]||(r[n]={}):(r[n]||{}).prototype,h=l?e:e[n]||(e[n]={}),d=h.prototype||(h.prototype={});for(i in l&&(o=n),o)c=((u=!s&&g&&void 0!==g[i])?g:o)[i],a=p&&u?F(c,r):f&&"function"==typeof c?F(Function.call,c):c,g&&A(g,i,c,t&$.U),h[i]!=c&&x(h,i,a),f&&d[i]!=c&&(d[i]=c)};r.core=e,$.F=1,$.G=2,$.S=4,$.P=8,$.B=16,$.W=32,$.U=64,$.R=128;var G=$,H=Math.ceil,N=Math.floor,V=function(t){return isNaN(t=+t)?0:(t>0?N:H)(t)},B=Math.min,D=function(t){return t>0?B(V(t),9007199254740991):0},z=Math.max,U=Math.min,q=o("keys"),J=function(t){return q[t]||(q[t]=c(t))},W=function(t,n,e){for(var r=M(t),o=D(r.length),i=function(t,n){return(t=V(t))<0?z(t+n,0):U(t,n)}(e,o);o>i;i++)if(i in r&&r[i]===n)return i||0;return-1},K=J("IE_PROTO"),Q="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),X=Object.keys||function(t){return function(t,n){var e,r=M(t),o=0,i=[];for(e in r)e!=K&&R(r,e)&&i.push(e);for(;n.length>o;)R(r,e=n[o++])&&(~W(i,e)||i.push(e));return i}(t,Q)},Y=p?Object.defineProperties:function(t,n){l(t);for(var e,r=X(n),o=r.length,i=0;o>i;)b.f(t,e=r[i++],n[e]);return t},Z=r.document,tt=Z&&Z.documentElement,nt=J("IE_PROTO"),et=function(){},rt=function(){var t,n=d("iframe"),e=Q.length;for(n.style.display="none",tt.appendChild(n),n.src="javascript:",(t=n.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),rt=t.F;e--;)delete rt.prototype[Q[e]];return rt()},ot=Object.create||function(t,n){var e;return null!==t?(et.prototype=l(t),e=new et,et.prototype=null,e[nt]=t):e=rt(),void 0===n?e:Y(e,n)},it=b.f,ut=a("toStringTag"),ct=function(t,n,e){t&&!R(t=e?t:t.prototype,ut)&&it(t,ut,{configurable:!0,value:n})},at={};x(at,a("iterator"),function(){return this});var st=function(t,n,e){t.prototype=ot(at,{next:m(1,e)}),ct(t,n+" Iterator")},lt=function(t){return Object(_(t))},ft=J("IE_PROTO"),pt=Object.prototype,gt=Object.getPrototypeOf||function(t){return t=lt(t),R(t,ft)?t[ft]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?pt:null},ht=a("iterator"),dt=!([].keys&&"next"in[].keys()),vt=function(){return this},yt=function(t,n,e,r,o,i,u){st(e,"Array",function(){var t=this._t,n=this._k,e=this._i++;return!t||e>=t.length?(this._t=void 0,j(1)):j(0,"keys"==n?e:"values"==n?t[e]:[e,t[e]])});var c,a,s,l=function(t){if(!dt&&t in g)return g[t];switch(t){case"keys":case"values":return function(){return new e(this,t)}}return function(){return new e(this,t)}},f="Array Iterator",p=!1,g=t.prototype,h=g[ht]||g["@@iterator"]||g.values,d=h||l("values"),v=l("entries"),y=g.entries||h;if(y&&(s=gt(y.call(new t)))!==Object.prototype&&s.next&&(ct(s,f,!0),"function"!=typeof s[ht]&&x(s,ht,vt)),h&&"values"!==h.name&&(p=!0,d=function(){return h.call(this)}),(dt||p||!g[ht])&&x(g,ht,d),E.Array=d,E[f]=vt,void(c={values:d,keys:l("keys"),entries:v}))for(a in c)a in g||A(g,a,c[a]);else G(G.P+G.F*(dt||p),"Array",c);return c}(Array,0,function(t,n){this._t=M(t),this._i=0,this._k=n});E.Arguments=E.Array,O("keys"),O("values"),O("entries");for(var bt=a("iterator"),mt=a("toStringTag"),xt=E.Array,St={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},wt=X(St),Ot=0;Ot<wt.length;Ot++){var jt,Et=wt[Ot],It=St[Et],kt=r[Et],Tt=kt&&kt.prototype;if(Tt&&(Tt[bt]||x(Tt,bt,xt),Tt[mt]||x(Tt,mt,Et),E[Et]=xt,It))for(jt in yt)Tt[jt]||A(Tt,jt,yt[jt],!0)}var _t,Mt,Lt=a("toStringTag"),Rt="Arguments"==k(function(){return arguments}()),Pt=function(t){var n,e,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(e=function(t,n){try{return t[n]}catch(e){}}(n=Object(t),Lt))?e:Rt?k(n):"Object"==(r=k(n))&&"function"==typeof n.callee?"Arguments":r},At={};At[a("toStringTag")]="z",At+""!="[object z]"&&A(Object.prototype,"toString",function(){return"[object "+Pt(this)+"]"},!0),_t=(e.Object||{}).keys||Object.keys,(Mt={}).keys=function(t){return X(lt(t))},G(G.S+G.F*f(function(){_t(1)}),"Object",Mt);var Ct={f:Object.getOwnPropertySymbols},Ft={f:{}.propertyIsEnumerable},$t=Object.assign,Gt=!$t||f(function(){var t={},n={},e=Symbol(),r="abcdefghijklmnopqrst";return t[e]=7,r.split("").forEach(function(t){n[t]=t}),7!=$t({},t)[e]||Object.keys($t({},n)).join("")!=r})?function(t,n){for(var e=lt(t),r=arguments.length,o=1,i=Ct.f,u=Ft.f;r>o;)for(var c,a=T(arguments[o++]),s=i?X(a).concat(i(a)):X(a),l=s.length,f=0;l>f;)u.call(a,c=s[f++])&&(e[c]=a[c]);return e}:$t;G(G.S+G.F,"Object",{assign:Gt});var Ht,Nt,Vt=function(t,n,e){return n+(e?(r=t,o=n,c=String(_(r)),a=V(o),s=c.length,a<0||a>=s?"":(i=c.charCodeAt(a))<55296||i>56319||a+1===s||(u=c.charCodeAt(a+1))<56320||u>57343?c.charAt(a):c.slice(a,a+2)).length:1);var r,o,i,u,c,a,s},Bt=RegExp.prototype.exec,Dt=function(t,n){var e=t.exec;if("function"==typeof e){var r=e.call(t,n);if("object"!=typeof r)throw new TypeError("RegExp exec method returned something other than an Object or null");return r}if("RegExp"!==Pt(t))throw new TypeError("RegExp#exec called on incompatible receiver");return Bt.call(t,n)},zt=function(){var t=l(this),n="";return t.global&&(n+="g"),t.ignoreCase&&(n+="i"),t.multiline&&(n+="m"),t.unicode&&(n+="u"),t.sticky&&(n+="y"),n},Ut=RegExp.prototype.exec,qt=String.prototype.replace,Jt=Ut,Wt=(Nt=/b*/g,Ut.call(Ht=/a/,"a"),Ut.call(Nt,"a"),0!==Ht.lastIndex||0!==Nt.lastIndex),Kt=void 0!==/()??/.exec("")[1];(Wt||Kt)&&(Jt=function(t){var n,e,r,o,i=this;return Kt&&(e=new RegExp("^"+i.source+"$(?!\\s)",zt.call(i))),Wt&&(n=i.lastIndex),r=Ut.call(i,t),Wt&&r&&(i.lastIndex=i.global?r.index+r[0].length:n),Kt&&r&&r.length>1&&qt.call(r[0],e,function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(r[o]=void 0)}),r});var Qt=Jt;G({target:"RegExp",proto:!0,forced:Qt!==/./.exec},{exec:Qt});var Xt=a("species"),Yt=!f(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")}),Zt=function(){var t=/(?:)/,n=t.exec;t.exec=function(){return n.apply(this,arguments)};var e="ab".split(t);return 2===e.length&&"a"===e[0]&&"b"===e[1]}(),tn=function(t,n,e){var r=a(t),o=!f(function(){var n={};return n[r]=function(){return 7},7!=""[t](n)}),i=o?!f(function(){var n=!1,e=/a/;return e.exec=function(){return n=!0,null},"split"===t&&(e.constructor={},e.constructor[Xt]=function(){return e}),e[r](""),!n}):void 0;if(!o||!i||"replace"===t&&!Yt||"split"===t&&!Zt){var u=/./[r],c=e(_,r,""[t],function(t,n,e,r,i){return n.exec===Qt?o&&!i?{done:!0,value:u.call(n,e,r)}:{done:!0,value:t.call(e,n,r)}:{done:!1}}),s=c[1];A(String.prototype,t,c[0]),x(RegExp.prototype,r,2==n?function(t,n){return s.call(t,this,n)}:function(t){return s.call(t,this)})}},nn=Math.max,en=Math.min,rn=Math.floor,on=/\$([$&`']|\d\d?|<[^>]*>)/g,un=/\$([$&`']|\d\d?)/g;tn("replace",2,function(t,n,e,r){return[function(r,o){var i=t(this),u=null==r?void 0:r[n];return void 0!==u?u.call(r,i,o):e.call(String(i),r,o)},function(t,n){var i=r(e,t,this,n);if(i.done)return i.value;var u=l(t),c=String(this),a="function"==typeof n;a||(n=String(n));var s=u.global;if(s){var f=u.unicode;u.lastIndex=0}for(var p=[];;){var g=Dt(u,c);if(null===g)break;if(p.push(g),!s)break;""===String(g[0])&&(u.lastIndex=Vt(c,D(u.lastIndex),f))}for(var h,d="",v=0,y=0;y<p.length;y++){g=p[y];for(var b=String(g[0]),m=nn(en(V(g.index),c.length),0),x=[],S=1;S<g.length;S++)x.push(void 0===(h=g[S])?h:String(h));var w=g.groups;if(a){var O=[b].concat(x,m,c);void 0!==w&&O.push(w);var j=String(n.apply(void 0,O))}else j=o(b,c,m,x,w,n);m>=v&&(d+=c.slice(v,m)+j,v=m+b.length)}return d+c.slice(v)}];function o(t,n,r,o,i,u){var c=r+t.length,a=o.length,s=un;return void 0!==i&&(i=lt(i),s=on),e.call(u,s,function(e,u){var s;switch(u.charAt(0)){case"$":return"$";case"&":return t;case"`":return n.slice(0,r);case"'":return n.slice(c);case"<":s=i[u.slice(1,-1)];break;default:var l=+u;if(0===l)return e;if(l>a){var f=rn(l/10);return 0===f?e:f<=a?void 0===o[f-1]?u.charAt(1):o[f-1]+u.charAt(1):e}s=o[l-1]}return void 0===s?"":s})}}),tn("match",1,function(t,n,e,r){return[function(e){var r=t(this),o=null==e?void 0:e[n];return void 0!==o?o.call(e,r):new RegExp(e)[n](String(r))},function(t){var n=r(e,t,this);if(n.done)return n.value;var o=l(t),i=String(this);if(!o.global)return Dt(o,i);var u=o.unicode;o.lastIndex=0;for(var c,a=[],s=0;null!==(c=Dt(o,i));){var f=String(c[0]);a[s]=f,""===f&&(o.lastIndex=Vt(i,D(o.lastIndex),u)),s++}return 0===s?null:a}]});var cn=a("match"),an=a("species"),sn=Math.min,ln=[].push,fn=!f(function(){});tn("split",2,function(t,n,e,r){var o;return o="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(t,n){var r,o,i=String(this);if(void 0===t&&0===n)return[];if(!s(r=t)||(void 0!==(o=r[cn])?!o:"RegExp"!=k(r)))return e.call(i,t,n);for(var u,c,a,l=[],f=0,p=void 0===n?4294967295:n>>>0,g=new RegExp(t.source,(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":"")+"g");(u=Qt.call(g,i))&&!((c=g.lastIndex)>f&&(l.push(i.slice(f,u.index)),u.length>1&&u.index<i.length&&ln.apply(l,u.slice(1)),a=u[0].length,f=c,l.length>=p));)g.lastIndex===u.index&&g.lastIndex++;return f===i.length?!a&&g.test("")||l.push(""):l.push(i.slice(f)),l.length>p?l.slice(0,p):l}:"0".split(void 0,0).length?function(t,n){return void 0===t&&0===n?[]:e.call(this,t,n)}:e,[function(e,r){var i=t(this),u=null==e?void 0:e[n];return void 0!==u?u.call(e,i,r):o.call(String(i),e,r)},function(t,n){var i=r(o,t,this,n,o!==e);if(i.done)return i.value;var u=l(t),c=String(this),a=function(t,n){var e,r=l(u).constructor;return void 0===r||null==(e=l(r)[an])?n:C(e)}(0,RegExp),s=u.unicode,f=new a(fn?u:"^(?:"+u.source+")",(u.ignoreCase?"i":"")+(u.multiline?"m":"")+(u.unicode?"u":"")+(fn?"y":"g")),p=void 0===n?4294967295:n>>>0;if(0===p)return[];if(0===c.length)return null===Dt(f,c)?[c]:[];for(var g=0,h=0,d=[];h<c.length;){f.lastIndex=fn?h:0;var v,y=Dt(f,fn?c:c.slice(h));if(null===y||(v=sn(D(f.lastIndex+(fn?0:h)),c.length))===g)h=Vt(c,h,s);else{if(d.push(c.slice(g,h)),d.length===p)return d;for(var b=1;b<=y.length-1;b++)if(d.push(y[b]),d.length===p)return d;h=g=v}}return d.push(c.slice(g)),d}]});var pn=function(t,n){return void 0===n&&(n=document.body),function(t){return t.match(/^--.*/i)}(t)&&Boolean(document.documentMode)&&document.documentMode>=10?function(){for(var t={},n=document.styleSheets,e="",r=n.length-1;r>-1;r--){for(var o=n[r].cssRules,i=o.length-1;i>-1;i--)if(".ie-custom-properties"===o[i].selectorText){e=o[i].cssText;break}if(e)break}return(e=e.substring(e.lastIndexOf("{")+1,e.lastIndexOf("}"))).split(";").forEach(function(n){if(n){var e=n.split(": ")[0],r=n.split(": ")[1];e&&r&&(t["--"+e.trim()]=r.trim())}}),t}()[t]:window.getComputedStyle(n,null).getPropertyValue(t).replace(/^\s/,"")};p&&"g"!=/./g.flags&&b.f(RegExp.prototype,"flags",{configurable:!0,get:zt});var gn=/./.toString,hn=function(t){A(RegExp.prototype,"toString",t,!0)};f(function(){return"/a/b"!=gn.call({source:"a",flags:"b"})})?hn(function(){var t=l(this);return"/".concat(t.source,"/","flags"in t?t.flags:!p&&t instanceof RegExp?zt.call(t):void 0)}):"toString"!=gn.name&&hn(function(){return gn.call(this)}),t.asideMenuCssClasses=["aside-menu-show","aside-menu-sm-show","aside-menu-md-show","aside-menu-lg-show","aside-menu-xl-show"],t.checkBreakpoint=function(t,n){return n.indexOf(t)>-1},t.deepObjectsMerge=function t(n,e){for(var r=Object.keys(e),o=0;o<r.length;o++){var i=r[o];e[i]instanceof Object&&Object.assign(e[i],t(n[i],e[i]))}return Object.assign(n||{},e),n},t.getColor=function(t,n){return void 0===n&&(n=document.body),pn("--"+t,n)||t},t.getStyle=pn,t.hexToRgb=function(t){if(void 0===t)throw new Error("Hex color is not defined");var n,e,r;if(!t.match(/^#(?:[0-9a-f]{3}){1,2}$/i))throw new Error(t+" is not a valid hex color");return 7===t.length?(n=parseInt(t.substring(1,3),16),e=parseInt(t.substring(3,5),16),r=parseInt(t.substring(5,7),16)):(n=parseInt(t.substring(1,2),16),e=parseInt(t.substring(2,3),16),r=parseInt(t.substring(3,5),16)),"rgba("+n+", "+e+", "+r+")"},t.hexToRgba=function(t,n){if(void 0===n&&(n=100),void 0===t)throw new Error("Hex color is not defined");var e,r,o;if(!t.match(/^#(?:[0-9a-f]{3}){1,2}$/i))throw new Error(t+" is not a valid hex color");return 7===t.length?(e=parseInt(t.substring(1,3),16),r=parseInt(t.substring(3,5),16),o=parseInt(t.substring(5,7),16)):(e=parseInt(t.substring(1,2),16),r=parseInt(t.substring(2,3),16),o=parseInt(t.substring(3,5),16)),"rgba("+e+", "+r+", "+o+", "+n/100+")"},t.rgbToHex=function(t){if(void 0===t)throw new Error("Hex color is not defined");if("transparent"===t)return"#00000000";var n=t.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);if(!n)throw new Error(t+" is not a valid rgb color");var e="0"+parseInt(n[1],10).toString(16),r="0"+parseInt(n[2],10).toString(16),o="0"+parseInt(n[3],10).toString(16);return"#"+e.slice(-2)+r.slice(-2)+o.slice(-2)},t.sidebarCssClasses=["sidebar-show","sidebar-sm-show","sidebar-md-show","sidebar-lg-show","sidebar-xl-show"],t.validBreakpoints=["sm","md","lg","xl"],Object.defineProperty(t,"__esModule",{value:!0})}(n)}}]);
16,889
16,889
0.635739
0dba8e3f6908b3134ae811f56104b417fef34761
4,414
js
JavaScript
SDK-Test/test/modern/smoke/KitchenSink/Trees/TreeGrid/TreeGrid.js
CelestialSystem/SenchaTestDemo
4bd5085e5f874d6be6d080be1f7a29c4a667dbf0
[ "Apache-2.0" ]
22
2015-12-17T16:45:46.000Z
2019-02-16T19:21:49.000Z
SDK-Test/test/modern/smoke/KitchenSink/Trees/TreeGrid/TreeGrid.js
CelestialSystem/SenchaTestDemo
4bd5085e5f874d6be6d080be1f7a29c4a667dbf0
[ "Apache-2.0" ]
8
2016-02-16T21:28:07.000Z
2019-07-26T07:14:59.000Z
SDK-Test/test/modern/smoke/KitchenSink/Trees/TreeGrid/TreeGrid.js
CelestialSystem/SenchaTestDemo
4bd5085e5f874d6be6d080be1f7a29c4a667dbf0
[ "Apache-2.0" ]
43
2015-12-17T19:03:04.000Z
2021-07-26T04:44:35.000Z
/** * modern KS > Trees > TreeGrid * tested on: * desktop: * Chrome 52 * Firefox 45 * IE 11 * Edge 14 * Opera 39 * Safari 10 * tablet: * iOS(Safari) 9 * mobile: * iOS(Safari) 8 * Android 6 * Edge 14 * themes: * Triton * Material * Neptun * IOS * OS: * Windows 10 (desktop, mobile) * iOS (mobile, tablet, desktop) * Android * Sencha Test: * 1.0.4.3 */ describe("TreeGrid", function() { //------------------------------------------------variables-------------------------------------------------------// var toolbar = 'tree-grid toolbar'; var prefix = '#kitchensink-view-grid-tree-treegrid'; //------------------------------------------------functions-------------------------------------------------------// //copy of function from library because of checking panel content function selectAndCheckRowInGrid (grid, number) { var desc = 'Select ' + number + '. row in grid and check if selected.'; if(grid !== undefined){ desc += grid; } it(desc, function () { ST.grid(grid).rowAt(number).reveal().select().selected(); }); } //other functions in file libraryFunctions.js //------------------------------------------------navigation------------------------------------------------------// beforeAll(function() { Lib.beforeAll("#tree-grid", prefix); }); afterAll(function(){ Lib.afterAll(prefix); }); //------------------------------------------------tests-----------------------------------------------------------// describe('Check if treeGrid is rendered', function () { //from library, but it is not a panel - so panel is changed for component it('TreeGrid is visible and rendered', function () { ST.component('tree') .visible() .and(function (page) { expect(page.rendered).toBeTruthy(); }); }); }); describe('Select a row items and see if are selected', function(){ for (var i = 0; i < 4; i++) { selectAndCheckRowInGrid(prefix, i); } }); describe('Expand and Collapsed a few items and see if are expanded, collapsed', function(){ Lib.expandElement(4, 4, true, '>', prefix); Lib.expandElement(2, 2, true, '>', prefix); Lib.expandElement(1, 1, true, '>', prefix); Lib.expandElement(0, undefined, true, '>', prefix); }); describe('Expand hidden row, select item and see if is selected', function(){ beforeAll(function() { expandCollapse(ST.grid(prefix).rowAt(1).reveal().down('>> .x-treecell'), true); }); afterAll(function(){ expandCollapse(ST.grid(prefix).rowAt(1).reveal().down('>> .x-treecell'), true); }); Lib.expandElement(3, 3, true, '>', prefix); }); describe('Expand and Collapse all items and see if chosen items are correctly selected', function(){ beforeAll(function() { expandCollapse(ST.grid(prefix).rowAt(4).reveal().down('>> .x-treecell'), true); expandCollapse(ST.grid(prefix).rowAt(2).reveal().down('>> .x-treecell'), true); expandCollapse(ST.grid(prefix).rowAt(1).reveal().down('>> .x-treecell'), true); expandCollapse(ST.grid(prefix).rowAt(3).reveal().down('>> .x-treecell'), true); }); afterAll(function(){ expandCollapse(ST.grid(prefix).rowAt(3).reveal().down('>> .x-treecell'), true); expandCollapse(ST.grid(prefix).rowAt(1).reveal().down('>> .x-treecell'), true); expandCollapse(ST.grid(prefix).rowAt(2).reveal().down('>> .x-treecell'), true); expandCollapse(ST.grid(prefix).rowAt(4).reveal().down('>> .x-treecell'), true); }); selectAndCheckRowInGrid(prefix, 5); selectAndCheckRowInGrid(prefix, 10); selectAndCheckRowInGrid(prefix, 0); }); describe('Source code', function () { it('should open, check and close', function () { Lib.sourceClick('tree-grid'); }); }); });
36.180328
120
0.478251
0dbab0866cdffdfda83af65ea943825a03eb3390
1,256
js
JavaScript
src/pages/_app.js
nilkesede/hashtags
34f75134532f4627c02adf961cf8da182d84d39f
[ "MIT" ]
null
null
null
src/pages/_app.js
nilkesede/hashtags
34f75134532f4627c02adf961cf8da182d84d39f
[ "MIT" ]
null
null
null
src/pages/_app.js
nilkesede/hashtags
34f75134532f4627c02adf961cf8da182d84d39f
[ "MIT" ]
null
null
null
import App from 'next/app' import {Provider} from 'react-redux' import withRedux from 'next-redux-wrapper' import withReduxSaga from 'next-redux-saga' import {ThemeProvider} from 'styled-components' import '../styles/main.scss' import createStore from '../store' import {loadUserData, listenTagsON, listenTagsOFF} from '../store/actions' import {theme} from '../../config' class MyApp extends App { static async getInitialProps({Component, ctx}) { let pageProps = {} if (Component.getInitialProps) { pageProps = await Component.getInitialProps({ctx}) } const user = ctx.req && ctx.req.session ? ctx.req.session.user : null if (user) { ctx.store.dispatch(loadUserData(user)) } return {pageProps} } componentDidMount() { if (this.props.store.getState().user) { this.props.store.dispatch(listenTagsON()) } } componentWillUnmount() { this.props.store.dispatch(listenTagsOFF()) } render() { const {Component, pageProps, store} = this.props return ( <Provider store={store}> <ThemeProvider theme={theme}> <Component {...pageProps}/> </ThemeProvider> </Provider> ) } } export default withRedux(createStore)(withReduxSaga(MyApp))
24.153846
74
0.666401
0dbcb1eea25c06fecd30f1e3093b848e2480b4ae
101
js
JavaScript
config/default.js
jm-root/sms
e5758476ae4ae5c67fe99f4fc82d1b7b3aa565c6
[ "MIT" ]
null
null
null
config/default.js
jm-root/sms
e5758476ae4ae5c67fe99f4fc82d1b7b3aa565c6
[ "MIT" ]
null
null
null
config/default.js
jm-root/sms
e5758476ae4ae5c67fe99f4fc82d1b7b3aa565c6
[ "MIT" ]
null
null
null
module.exports = { lng: 'zh_CN', modules: { sms: { module: 'jm-sms-aliyun' } } }
11.222222
29
0.475248
0dbd75b00f432b6b1d37d5a3ab86eee490951e34
574
js
JavaScript
ui/password-reset/reducers.js
jneen/dj.jneen.net
d21daceacbaeedc977b327104d8d0359187afb06
[ "0BSD" ]
null
null
null
ui/password-reset/reducers.js
jneen/dj.jneen.net
d21daceacbaeedc977b327104d8d0359187afb06
[ "0BSD" ]
null
null
null
ui/password-reset/reducers.js
jneen/dj.jneen.net
d21daceacbaeedc977b327104d8d0359187afb06
[ "0BSD" ]
2
2017-07-06T23:26:04.000Z
2017-08-07T19:36:12.000Z
import { SET_RESET_KEY, SET_RESET_SUCCESS, } from './constants'; export auth from '../reducers/auth'; export config from '../reducers/config'; export errors from '../reducers/errors'; export theme from '../reducers/theme'; export function passwordReset(state = {}, action = {}) { if (action.error) return state; switch (action.type) { case SET_RESET_KEY: return { ...state, key: action.payload, }; case SET_RESET_SUCCESS: return { ...state, success: true, }; default: return state; } }
19.133333
56
0.602787
0dbe4da0ef64ca7b1822caa541ff8d0da79236c3
1,669
js
JavaScript
docs/html/interface_all_pawns_must_die_1_1_i_chess_board_view.js
manixaist/AllPawnsMustDie
182614d1362753e05ac30018a37965ff078f82fc
[ "MIT" ]
7
2018-03-25T02:32:04.000Z
2021-03-08T16:55:59.000Z
docs/html/interface_all_pawns_must_die_1_1_i_chess_board_view.js
manixaist/AllPawnsMustDie
182614d1362753e05ac30018a37965ff078f82fc
[ "MIT" ]
41
2017-09-11T10:09:02.000Z
2017-09-27T23:28:53.000Z
docs/html/interface_all_pawns_must_die_1_1_i_chess_board_view.js
manixaist/AllPawnsMustDie
182614d1362753e05ac30018a37965ff078f82fc
[ "MIT" ]
4
2019-06-25T15:43:21.000Z
2021-12-31T07:19:09.000Z
var interface_all_pawns_must_die_1_1_i_chess_board_view = [ [ "ChoosePromotionJob", "interface_all_pawns_must_die_1_1_i_chess_board_view.html#a1a921834d4fe990238f686a1a2841ddd", null ], [ "ClearHiglightedSquares", "interface_all_pawns_must_die_1_1_i_chess_board_view.html#a96a0a907e74c27eff6811a2ba8d764bf", null ], [ "GetPiece", "interface_all_pawns_must_die_1_1_i_chess_board_view.html#a20d80824510ef560762833063194fd3b", null ], [ "GetSquare", "interface_all_pawns_must_die_1_1_i_chess_board_view.html#a3a4062aa8b17b6526d06c29d668acbcd", null ], [ "HighlightSquare", "interface_all_pawns_must_die_1_1_i_chess_board_view.html#a82248d3601bb5ba789c0bb8028ecc997", null ], [ "HighlightSquares", "interface_all_pawns_must_die_1_1_i_chess_board_view.html#a76ecad36a37fc6b0e205517356dc0c8b", null ], [ "Invalidate", "interface_all_pawns_must_die_1_1_i_chess_board_view.html#aa5971cc3d54aa25e00aba06410a24e8e", null ], [ "Render", "interface_all_pawns_must_die_1_1_i_chess_board_view.html#ad3376a6d25c58f929b55ba89f97a5d65", null ], [ "SetBitmapImages", "interface_all_pawns_must_die_1_1_i_chess_board_view.html#a1e11f670979f23024b61cac0e04ba469", null ], [ "BoardRect", "interface_all_pawns_must_die_1_1_i_chess_board_view.html#a556562f4007b7ab878aef2bc307ec233", null ], [ "Dimensions", "interface_all_pawns_must_die_1_1_i_chess_board_view.html#a3f2d2cc8dc519f37a4a6c8e4b94cf6ab", null ], [ "Offset", "interface_all_pawns_must_die_1_1_i_chess_board_view.html#a1e6e30a7c79a34c7ef03778fc9d43857", null ], [ "ViewData", "interface_all_pawns_must_die_1_1_i_chess_board_view.html#ac057ec5542c74b8fb1f77363d143a863", null ] ];
104.3125
133
0.840024
0dbe5832969a6d1658f3d45ecfc3f2f43b8c4541
4,524
js
JavaScript
pages/index.js
carinebatista/alurakut
13c3ba0e2832d5948590a15bc7cbdbf93f5cc12b
[ "MIT" ]
null
null
null
pages/index.js
carinebatista/alurakut
13c3ba0e2832d5948590a15bc7cbdbf93f5cc12b
[ "MIT" ]
null
null
null
pages/index.js
carinebatista/alurakut
13c3ba0e2832d5948590a15bc7cbdbf93f5cc12b
[ "MIT" ]
null
null
null
import { useState, useEffect } from "react"; import MainGrid from "./../src/components/MainGrid"; import Box from "./../src/components/Box"; import { ProfileRelationsBoxWrapper } from "../src/components/ProfileRelations"; import { AlurakutMenu, OrkutNostalgicIconSet, AlurakutProfileSidebarMenuDefault, } from "../src/lib/AlurakutCommons"; // Components function ProfileSidebar({ githubUser }) { return ( <Box as="aside"> <img style={{ borderRadius: "8px" }} src={`https://github.com/${githubUser}.png`} /> <hr /> <a className="boxLink" href={`https://github.com/${githubUser}`}> @{githubUser} </a> <hr /> <AlurakutProfileSidebarMenuDefault /> </Box> ); } function DevsSidebar({ githubUser }) { const [follower, setFollower] = useState([]); useEffect(async () => { const url = `https://api.github.com/users/${githubUser}/followers`; const response = await fetch(url); setFollower(await response.json()); }, []); const followers = follower.slice(0, 6); return ( <ProfileRelationsBoxWrapper> <h2 className="smallTitle">Pessoas da Comunidade ({follower.length})</h2> <ul> {followers.map((follower) => { return ( <li key={follower.id}> <a href={follower.html_url}> <img src={`https://github.com/${follower.login}.png`} style={{ borderRadius: "8px" }} /> <span>{follower.login}</span> </a> </li> ); })} </ul> </ProfileRelationsBoxWrapper> ); } function ComunitySidebar({ comunidades }) { const comunidade = comunidades.slice(0, 6); return ( <ProfileRelationsBoxWrapper> <h2 className="smallTitle">Comunidades ({comunidades.length})</h2> <ul> {comunidade.map((comunidades) => { return ( <li key={comunidades.id}> <a href={`/users/${comunidades.title}`}> <img src={comunidades.image} /> <span> {comunidades.title} </span> </a> </li> ); })} </ul> </ProfileRelationsBoxWrapper> ); } // component Home export default function Home() { const githubUser = "carinebatista"; const [comunidades, setComunidades] = useState([ { id: "1234545446", title: "Eu odeio acordar cedo", image: "https://alurakut.vercel.app/capa-comunidade-01.jpg", }, ]); const pessoasFavoritas = [ "juunegreiros", "omariosouto", "peas", "rafaballerini", "marcobrunodev", "felipefialho", ]; function handleCreateComunidade(e) { e.preventDefault(); const dadosDoForm = new FormData(e.target); const comunidade = { id: new Date().toISOString(), title: dadosDoForm.get("title"), image: dadosDoForm.get("image"), }; const comunidadesAtualizadas = [...comunidades, comunidade]; setComunidades(comunidadesAtualizadas); } return ( <> <AlurakutMenu githubUser={githubUser} /> <MainGrid> <div className="profileArea" style={{ gridArea: "profileArea" }}> <ProfileSidebar githubUser={githubUser} /> </div> <div className="welcomeArea" style={{ gridArea: "welcomeArea" }}> <Box> <h1 className="title">Bem vindo(a)</h1> <OrkutNostalgicIconSet /> </Box> <Box> <h2 className="subTitle"> O que você deseja fazer?</h2> <form onSubmit={handleCreateComunidade}> <div> <input placeholder="Qual vai ser o nome da sua comunidade?" name="title" aria-label="Qual vai ser o nome da sua comunidade?" type="text" /> </div> <div> <input placeholder="Coloque uma URL para usarmos de capa" name="image" aria-label="Coloque uma URL para usarmos de capa" /> </div> <button>Criar comunidade</button> </form> </Box> </div> <div className="profileRelationsArea" style={{ gridArea: "profileRelationsArea" }} > <ComunitySidebar comunidades={comunidades} /> <DevsSidebar githubUser={githubUser} /> </div> </MainGrid> </> ); }
26.928571
80
0.54244
0dbe6198f57d783a1db1fb39eb6a95e447687030
3,708
js
JavaScript
template/src/plugins/aliftech-ui/mixins/directives/Mask.js
chollak/webpack-test
9510fa6522c8d5b9b748fa2464ca954ef38d979f
[ "MIT" ]
null
null
null
template/src/plugins/aliftech-ui/mixins/directives/Mask.js
chollak/webpack-test
9510fa6522c8d5b9b748fa2464ca954ef38d979f
[ "MIT" ]
null
null
null
template/src/plugins/aliftech-ui/mixins/directives/Mask.js
chollak/webpack-test
9510fa6522c8d5b9b748fa2464ca954ef38d979f
[ "MIT" ]
null
null
null
const tokens = { "#": { pattern: /\d/ }, X: { pattern: /[0-9a-zA-Z]/ }, S: { pattern: /[a-zA-Z]/ }, A: { pattern: /[a-zA-Z]/, transform: (v) => v.toLocaleUpperCase() }, a: { pattern: /[a-zA-Z]/, transform: (v) => v.toLocaleLowerCase() }, "!": { escape: true }, }; function maskit(value, mask, masked = true, tokens) { value = value || ""; mask = mask || ""; let iMask = 0; let iValue = 0; let output = ""; while (iMask < mask.length && iValue < value.length) { let cMask = mask[iMask]; const masker = tokens[cMask]; const cValue = value[iValue]; if (masker && !masker.escape) { if (masker.pattern.test(cValue)) { output += masker.transform ? masker.transform(cValue) : cValue; iMask++; } iValue++; } else { if (masker && masker.escape) { iMask++; cMask = mask[iMask]; } if (masked) output += cMask; if (cValue === cMask) iValue++; iMask++; } } let restOutput = ""; while (iMask < mask.length && masked) { const cMask = mask[iMask]; if (tokens[cMask]) { restOutput = ""; break; } restOutput += cMask; iMask++; } return output + restOutput; } function dynamicMask(maskit, masks, tokens) { masks = masks.sort((a, b) => a.length - b.length); return function (value, mask, masked = true) { let i = 0; while (i < masks.length) { const currentMask = masks[i]; i++; const nextMask = masks[i]; if ( !( nextMask && maskit(value, nextMask, true, tokens).length > currentMask.length ) ) { return maskit(value, currentMask, masked, tokens); } } return ""; }; } function masker(value, mask, masked = true, tokens) { return Array.isArray(mask) ? dynamicMask(maskit, mask, tokens)(value, mask, masked, tokens) : maskit(value, mask, masked, tokens); } function generateEvent(name) { if (typeof document !== "undefined") { try { const event = document.createEvent("Event"); event.initEvent(name, true, true); return event; } catch (e) { return undefined; } } return undefined; } function directive(el, binding) { const input = generateEvent("input"); if (input !== undefined) { let config = binding.value; if (Array.isArray(config) || typeof config === "string") { config = { mask: config, tokens: tokens, }; } if (el.tagName.toLocaleUpperCase() !== "INPUT") { const els = el.getElementsByTagName("input"); if (els.length !== 1) { throw new Error( "v-mask directive requires 1 input, found " + els.length ); } else { el = els[0]; } } el.oninput = function (evt) { const event = generateEvent("input"); if (event !== undefined) { if (!evt.isTrusted) return; let position = el.selectionEnd; const digit = el.value[position - 1]; el.value = masker(el.value, config.mask, true, config.tokens); while ( position < el.value.length && el.value.charAt(position - 1) !== digit ) { position++; } if (el === document.activeElement) { el.setSelectionRange(position, position); setTimeout(function () { el.setSelectionRange(position, position); }, 0); } el.dispatchEvent(event); } }; const newDisplay = masker(el.value, config.mask, true, config.tokens); if (newDisplay !== el.value) { el.value = newDisplay; el.dispatchEvent(input); } } } module.exports = { tokens, directive, masker, };
25.75
75
0.546117
0dbf2deea5513024e58250c5fbd63c25b644fb69
2,045
js
JavaScript
BeetleX.Blog/views/js/admin/ReadFileHandler.js
singlesword2021/XBlog
cb7ab4959a30619704c67f00dc2eff3f01b67b4d
[ "Apache-2.0" ]
153
2018-12-28T06:38:52.000Z
2020-12-06T16:46:51.000Z
BeetleX.Blog/views/js/admin/ReadFileHandler.js
1051324354/XBlog
ec3d8f488f6a833b658d43e77fc697fb14a32028
[ "Apache-2.0" ]
4
2018-12-30T01:46:59.000Z
2020-10-01T11:16:04.000Z
BeetleX.Blog/views/js/admin/ReadFileHandler.js
1051324354/XBlog
ec3d8f488f6a833b658d43e77fc697fb14a32028
[ "Apache-2.0" ]
48
2018-12-28T09:40:09.000Z
2020-11-09T13:04:34.000Z
var _uploadID = 0; function readFileHandler(file, blockSize) { this.file = file; this.size = file.size; this.readBytes = 0; this.id = ++_uploadID; this.index = 0; this.name = file.name; this.blockSize = 1024 * 8; if (blockSize) this.blockSize = blockSize; this.pages = parseInt(file.size / this.blockSize); if (file.size % this.blockSize > 0) this.pages++; this.reader = null; this.percent = 0; } readFileHandler.prototype.completed = function () { return this.pages == this.index; }; readFileHandler.prototype.read = function (callback) { var _this = this; var length = _this.size - this.readBytes; if (length > _this.blockSize) length = _this.blockSize; if (!_this.reader) _this.reader = new FileReader(); var result; _this.reader.onload = function (evt) { if (evt.target.readyState == FileReader.DONE) { var str = _this.toBase64(evt.target.result); result = { Eof: _this.completed(), Data: str, Name: _this.name }; if (callback) callback(result); } else { result = { errCode: 500, name: "load file error!" }; if (callback) callback(result); } }; _this.reader.onerror = function (evt) { result = { errCode: evt.target.error.errCode, name: evt.target.error.name }; if (callback) callback(result); }; var start = _this.index * _this.blockSize; var end = start + length; _this.index++; _this.readBytes += length; var blob = _this.file.slice(start, end); _this.reader.readAsArrayBuffer(blob); var p = this.index / this.pages * 100; this.percent = parseInt(p); }; readFileHandler.prototype.toBase64 = function (buffer) { var binary = ''; var bytes = new Uint8Array(buffer); var len = bytes.byteLength; for (var i = 0; i < len; i++) { binary += String.fromCharCode(bytes[i]); } return window.btoa(binary); };
30.073529
84
0.59022
0dbf30984dc7cb356575ca0f711797042324610c
27
js
JavaScript
test/fixtures/spm/pass-extradeps/sea-modules/b/1.1.0/index.js
sorrycc/father
ac1e4725ae30ab0077790311ee79b01236b37dbd
[ "MIT" ]
1
2020-07-07T03:33:05.000Z
2020-07-07T03:33:05.000Z
test/fixtures/spm/pass-extradeps/sea-modules/b/1.1.0/index.js
sorrycc/father
ac1e4725ae30ab0077790311ee79b01236b37dbd
[ "MIT" ]
null
null
null
test/fixtures/spm/pass-extradeps/sea-modules/b/1.1.0/index.js
sorrycc/father
ac1e4725ae30ab0077790311ee79b01236b37dbd
[ "MIT" ]
null
null
null
require('./b.handlebars');
13.5
26
0.666667