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
80553981c79c2c6832430d35f01be2dfa41c1ed3
43
js
JavaScript
src/views/Home/components/Customization/index.js
konichar/thefront-preview
ecef25925c5f653d30f26c01983997fa4714db0e
[ "MIT" ]
35
2020-11-18T14:49:31.000Z
2022-03-19T15:50:12.000Z
src/views/Home/components/Customization/index.js
konichar/thefront-preview
ecef25925c5f653d30f26c01983997fa4714db0e
[ "MIT" ]
null
null
null
src/views/Home/components/Customization/index.js
konichar/thefront-preview
ecef25925c5f653d30f26c01983997fa4714db0e
[ "MIT" ]
23
2020-11-22T05:39:27.000Z
2021-12-08T05:40:06.000Z
export { default } from './Customization';
21.5
42
0.697674
80555f7ae1adb74661e9000d8621112b13656004
9
js
JavaScript
16.Web-Applications-with-Node.js/Lectures/15. Node.js-tools-Grunt-Gulp-NPM-Bower-Debugging/Resources/07. Development-Tools/Demo/grunt-configure/app/scripts/main.js
VVoev/Telerik-Academy
ae26d7b0563c27102faef551ce5b9f08ecb62fe1
[ "MIT" ]
20
2016-11-12T18:13:31.000Z
2021-07-28T12:14:09.000Z
16.Web-Applications-with-Node.js/Lectures/15. Node.js-tools-Grunt-Gulp-NPM-Bower-Debugging/Resources/07. Development-Tools/Demo/grunt-configure/app/scripts/main.js
VVoev/Telerik-Academy
ae26d7b0563c27102faef551ce5b9f08ecb62fe1
[ "MIT" ]
1
2016-01-12T15:07:48.000Z
2016-01-12T17:33:35.000Z
16.Web-Applications-with-Node.js/Lectures/15. Node.js-tools-Grunt-Gulp-NPM-Bower-Debugging/Resources/07. Development-Tools/Demo/grunt-configure/app/scripts/main.js
VVoev/Telerik-Academy
ae26d7b0563c27102faef551ce5b9f08ecb62fe1
[ "MIT" ]
45
2016-11-16T01:54:23.000Z
2021-05-15T00:10:01.000Z
var q = q
9
9
0.555556
80559cbd383da20641af6cdbd45354b724972931
423
js
JavaScript
src/Video.js
oyvinmar/video-capture
e69b3b28a7ed289e4728d0e58ad96871eec7595f
[ "MIT" ]
1
2020-10-23T20:31:30.000Z
2020-10-23T20:31:30.000Z
src/Video.js
oyvinmar/video-capture
e69b3b28a7ed289e4728d0e58ad96871eec7595f
[ "MIT" ]
7
2021-03-09T15:45:10.000Z
2021-04-13T07:19:37.000Z
src/Video.js
oyvinmar/video-capture
e69b3b28a7ed289e4728d0e58ad96871eec7595f
[ "MIT" ]
null
null
null
import React from 'react'; import { Box } from 'rebass'; export function Video({ src, type }) { return ( <Box sx={{ my: 3, width: '100%', position: 'relative', overflow: 'hidden', '& > video': { width: '100%', }, }} > <video controls autoPlay playsInline muted> <source src={src} type={type} /> </video> </Box> ); }
18.391304
49
0.460993
805948e94e1e8ba39853aa140919a76c8edbb0fc
1,527
js
JavaScript
test/e2e/scenarios.js
o-n-e/feature-chooser
a04b26a80abeef08234a897b0a8c453090f077ab
[ "MIT" ]
null
null
null
test/e2e/scenarios.js
o-n-e/feature-chooser
a04b26a80abeef08234a897b0a8c453090f077ab
[ "MIT" ]
null
null
null
test/e2e/scenarios.js
o-n-e/feature-chooser
a04b26a80abeef08234a897b0a8c453090f077ab
[ "MIT" ]
null
null
null
'use strict'; /* http://docs.angularjs.org/guide/dev_guide.e2e-testing */ describe('featureChooser', function() { describe('Feature list view', function() { beforeEach(function() { browser.get('app/index.html'); }); it('should filter the available features list as a user types into the search box', function() { var allOptions = element.all(by.options('feature as feature.displayName for feature in availibleFeatures | filter:availableFeaturesQuery | orderBy:orderProp')); expect(allOptions.count()).toEqual(10); var firstOption = allOptions.first(); expect(firstOption.getText()).toEqual('Calculation Date'); var query = element(by.model('availableFeaturesQuery')); query.sendKeys('p'); expect(allOptions.count()).toEqual(1); expect(firstOption.getText()).toEqual('Price'); }); it('should be possible to control feature order via the drop down select box', function() { var allOptions = element.all(by.options('feature as feature.displayName for feature in availibleFeatures | filter:availableFeaturesQuery | orderBy:orderProp')); var query = element(by.model('availableFeaturesQuery')); query.sendKeys('s') var firstOption = allOptions.first(); expect(firstOption.getText()).toEqual('Symbol'); element(by.model('orderProp')).element(by.css('option[value="displayName"]')).click(); firstOption = allOptions.first(); expect(firstOption.getText()).toEqual('Size'); }); }); });
30.54
166
0.679109
8059889924e2f5a21a6a0982bdaa2170cb84ef0d
34
js
JavaScript
djaesy/webpack/app/theme.js
alan-fernandes/django-djaesy
bc95d65af8ad08a8bbe7275dbccabec581f4f2ac
[ "MIT" ]
1
2021-08-28T00:48:11.000Z
2021-08-28T00:48:11.000Z
djaesy/webpack/app/theme.js
alan-fernandes/django-djaesy
bc95d65af8ad08a8bbe7275dbccabec581f4f2ac
[ "MIT" ]
1
2020-10-30T21:10:01.000Z
2020-10-30T21:10:01.000Z
djaesy/webpack/app/theme.js
alan-fernandes/django-djaesy
bc95d65af8ad08a8bbe7275dbccabec581f4f2ac
[ "MIT" ]
1
2020-10-30T20:46:19.000Z
2020-10-30T20:46:19.000Z
import './assets/css/theme.scss'
11.333333
32
0.705882
805ae647dee71a549a4b60ec5636369d24c79eaa
388
js
JavaScript
2018/01/13/translate.js
jsdelivrbot/informal-essay
3335da9b5235c82642d6a54fbe938230645cf255
[ "MIT" ]
null
null
null
2018/01/13/translate.js
jsdelivrbot/informal-essay
3335da9b5235c82642d6a54fbe938230645cf255
[ "MIT" ]
null
null
null
2018/01/13/translate.js
jsdelivrbot/informal-essay
3335da9b5235c82642d6a54fbe938230645cf255
[ "MIT" ]
null
null
null
var fs = require('fs') const fileName = 'hlxq' var t = fs.readFileSync(`./${fileName}.json`, {encoding:'utf-8'}) var json = JSON.parse(t) var obj = { type: 'FeatureCollection', features: [] } for (let geometry of json.geometries) { obj.features.push({ type: 'Feature', geometry, properties: {} }) } fs.writeFile(`./${fileName}-translate.json`, JSON.stringify(obj))
19.4
65
0.636598
805b743375dec447b4f14ce27405f6fc414983ed
1,386
js
JavaScript
src/couchapps/WMStats/_attachments/js/Views/WMStats.CategoryMap.js
khurtado/WMCore
f74e252412e49189a92962945a94f93bec81cd1e
[ "Apache-2.0" ]
21
2015-11-19T16:18:45.000Z
2021-12-02T18:20:39.000Z
src/couchapps/WMStats/_attachments/js/Views/WMStats.CategoryMap.js
khurtado/WMCore
f74e252412e49189a92962945a94f93bec81cd1e
[ "Apache-2.0" ]
5,671
2015-01-06T14:38:52.000Z
2022-03-31T22:11:14.000Z
src/couchapps/WMStats/_attachments/js/Views/WMStats.CategoryMap.js
khurtado/WMCore
f74e252412e49189a92962945a94f93bec81cd1e
[ "Apache-2.0" ]
67
2015-01-21T15:55:38.000Z
2022-02-03T19:53:13.000Z
WMStats.namespace("CategorySummaryMap"); WMStats.namespace("CategoryTableMap"); WMStats.CategorySummaryMap = function(){ var summaryMap = {}; function add(category, summaryFunc) { summaryMap[category] = summaryFunc; } function get(category) { return summaryMap[category]; } return {add: add, get: get}; }(); WMStats.CategoryTableMap = function(){ var tableMap = {}; var vm = WMStats.ViewModel; function add(category, view) { tableMap[category] = view; } function get(category, view) { if (category === vm.RequestView.categoryName) { return tableMap[category][vm.RequestView.format().name()]; }else { return tableMap[category]; } } return {add: add, get: get}; }(); (function(vm){ //WMStats.CategoryTableMap.add(WMStats.Controls.requests, WMStats.ActiveRequestTableWithJob); // add controller vm.CategoryView.subscribe("data", function() { var view = WMStats.CategoryTableMap.get(vm.CategoryView.category().name()); view(vm.CategoryView.data(), vm.CategoryView.category().id()); }); vm.RequestView.subscribe("data", function() { var view = WMStats.CategoryTableMap.get(vm.RequestView.categoryName); view(vm.RequestView.data(), vm.RequestView.format().id()); }); })(WMStats.ViewModel);
30.130435
97
0.634199
805c18da4254fc6e2b8d533b3301382d578f04c2
879
js
JavaScript
shopify-fed-challenge.js
jfong701/Shopify-Front-End-Developer-Challenge
f397a32e863e73e454fb8b885bbaffe1ab82e61f
[ "MIT" ]
null
null
null
shopify-fed-challenge.js
jfong701/Shopify-Front-End-Developer-Challenge
f397a32e863e73e454fb8b885bbaffe1ab82e61f
[ "MIT" ]
null
null
null
shopify-fed-challenge.js
jfong701/Shopify-Front-End-Developer-Challenge
f397a32e863e73e454fb8b885bbaffe1ab82e61f
[ "MIT" ]
null
null
null
/** Executed when button "Sign up now" button is clicked */ function signUp() { var msg_prompt = document.getElementById("message"); var email_elem = document.getElementById("email"); var email = email_elem.value; if (!validEmail(email)) { msg_prompt.style.opacity = 1; } else { msg_prompt.style.opacity = 0; console.log(email, getSelectedInterest()); } } /** Helper function for email validation. Simple JS email validation from: https://stackoverflow.com/questions/46155/how-can-you-validate-an-email-address-in-javascript */ function validEmail(email) { var regex = /\S+@\S+\.\S+/; return regex.test(email); } /** Helper function that returns a string of what would be sent to the server. */ function getSelectedInterest() { var interests_elem = document.getElementById("interests"); return interests_elem.options[interests_elem.selectedIndex].value; }
25.852941
93
0.736064
805c7298d6e4cd1a6d911ea31c0684b6c6f66cff
512
js
JavaScript
static/js/states/jobArtifactList.js
bowlofstew/changes
ebd393520e0fdb07c240a8d4e8747281b6186e28
[ "Apache-2.0" ]
null
null
null
static/js/states/jobArtifactList.js
bowlofstew/changes
ebd393520e0fdb07c240a8d4e8747281b6186e28
[ "Apache-2.0" ]
null
null
null
static/js/states/jobArtifactList.js
bowlofstew/changes
ebd393520e0fdb07c240a8d4e8747281b6186e28
[ "Apache-2.0" ]
null
null
null
define([ 'app' ], function(app) { 'use strict'; return { parent: 'job_details', url: 'artifacts/', templateUrl: 'partials/job-artifact-list.html', controller: function($scope, $stateParams, Collection, Paginator) { var collection = new Collection(); var paginator = new Paginator('/api/0/jobs/' + $stateParams.job_id + '/artifacts/', { collection: collection }); $scope.artifactList = collection; $scope.artifactPaginator = paginator; } }; });
24.380952
91
0.619141
805ccc21d8e656e345a7d511fbfe0a44987023fc
458
js
JavaScript
docs/.vuepress/utils/repositories.js
Rixafy/website
5871eb71d74df57b91cab0b285fb28f3a3005548
[ "MIT" ]
null
null
null
docs/.vuepress/utils/repositories.js
Rixafy/website
5871eb71d74df57b91cab0b285fb28f3a3005548
[ "MIT" ]
null
null
null
docs/.vuepress/utils/repositories.js
Rixafy/website
5871eb71d74df57b91cab0b285fb28f3a3005548
[ "MIT" ]
null
null
null
import repositories from '../../../data/repositories'; import {filter, find} from 'lodash'; export function getEnabledRepositories() { return filter(repositories, r => r.enabled); } export function getRepository(repository) { return repositories[repository]; } export function isEnabledRepository(repository) { return getEnabledRepositories()[repository] !== undefined; } export function findRepository(args) { return find(repositories, args); }
24.105263
60
0.755459
805d533c993c7255b7bdf23c6e322b1cd3ceeec6
624
js
JavaScript
src/reducers/LocalData.js
aakashpunasiya21/BMICalculator
5d3186d6ee84bf91ed3ab69d1510f79411fb44d7
[ "MIT" ]
null
null
null
src/reducers/LocalData.js
aakashpunasiya21/BMICalculator
5d3186d6ee84bf91ed3ab69d1510f79411fb44d7
[ "MIT" ]
null
null
null
src/reducers/LocalData.js
aakashpunasiya21/BMICalculator
5d3186d6ee84bf91ed3ab69d1510f79411fb44d7
[ "MIT" ]
null
null
null
import { SET_LOCAL_DATA,SET_LOCAL_STATE } from "../action"; //import { getData, storeData } from '../../helpers/localStorage'; import { getData,storeData } from "../helpers/localStorage"; const initialState={ state:getData('data')||[], data:[], }; export const localData =(state-initialState,action) => { switch (action.type) { case SET_LOCAL_STATE: return{ ...state, } case SET_LOCAL_DATA: return{ ...state, data: action.payload } default: break; } }
24.96
66
0.511218
805d8a7345f6ac1c080edbd9208e5b29db8ce68f
1,222
js
JavaScript
touch/src/chart/axis/layout/Continuous.js
lorezyra/TouchDJ
7d0d9f7a790edec3d81140e106a4c0af5db0969e
[ "CC-BY-3.0" ]
18
2015-02-12T16:55:52.000Z
2021-04-15T19:08:36.000Z
www/TakePhoto/touch/src/chart/axis/layout/Continuous.js
DawidMyslak/native-vs-html5_android-performance
5644c63602391e2760858d72c56cb619376c93c2
[ "MIT" ]
2
2017-02-16T14:06:26.000Z
2018-03-16T19:14:33.000Z
www/TakePhoto/touch/src/chart/axis/layout/Continuous.js
DawidMyslak/native-vs-html5_android-performance
5644c63602391e2760858d72c56cb619376c93c2
[ "MIT" ]
14
2015-01-10T09:11:23.000Z
2021-09-28T10:31:50.000Z
/** * @class Ext.chart.axis.layout.Continuous * @extends Ext.chart.axis.layout.Layout * * Processor for axis data that can be interpolated. */ Ext.define("Ext.chart.axis.layout.Continuous", { extend: 'Ext.chart.axis.layout.Layout', alias: 'axisLayout.continuous', config: { adjustMinimumByMajorUnit: false, adjustMaximumByMajorUnit: false }, getCoordFor: function (value, field, idx, items) { return +value; }, //@inheritdoc snapEnds: function (context, min, max, estStepSize) { var segmenter = context.segmenter, out = context.segmenter.preferredStep(min, estStepSize), unit = out.unit, step = out.step, from = segmenter.align(min, step, unit), steps = segmenter.diff(min, max, unit) + 1; return { min: segmenter.from(min), max: segmenter.from(max), from: from, to: segmenter.add(from, steps * step, unit), step: step, steps: steps, unit: unit, get: function (current) { return segmenter.add(this.from, this.step * current, unit); } }; } });
30.55
75
0.560556
805e219bae4ffda05d02b0b736cb5fc83a3a95e2
1,087
js
JavaScript
src/app/components/organisms/productList/ProductList.js
Krishank/ecommerce-react-example
3e9c5edd9c2c2514c8c3f3b6dacff44fa7560829
[ "MIT" ]
null
null
null
src/app/components/organisms/productList/ProductList.js
Krishank/ecommerce-react-example
3e9c5edd9c2c2514c8c3f3b6dacff44fa7560829
[ "MIT" ]
null
null
null
src/app/components/organisms/productList/ProductList.js
Krishank/ecommerce-react-example
3e9c5edd9c2c2514c8c3f3b6dacff44fa7560829
[ "MIT" ]
null
null
null
import React from 'react' import PropTypes from 'prop-types' import ProductListStyled from './ProductList.styled' import { Product } from '../../molecules' /** * @desc Product List component is responsible for rendering multiple Products * this component manages its own whitlable style to ensure all product will reder as expected layout */ const genrateProducts = productsData => { return ( productsData && productsData.map(product => { const { index } = product return <Product key={index} productData={product} /> }) ) } const ProductList = React.memo(function ProductList(props) { const { products } = props return <ProductListStyled>{genrateProducts(products)}</ProductListStyled> }) ProductList.propTypes = { products: PropTypes.arrayOf( PropTypes.shape({ productImage: PropTypes.string.isRequired, productName: PropTypes.string.isRequired, price: PropTypes.string.isRequired, isExclusive: PropTypes.bool.isRequired, isSale: PropTypes.bool.isRequired, }) ).isRequired, } export default ProductList
27.871795
101
0.719411
805e8dbba2937675e8cd91c2578007f494c1f60a
366
js
JavaScript
JS Advanced/01.Syntax, Functions and Statements/02.StringLength.js
yovko93/JavaScript-Repo
7b63642fbaaff537632d1ac31fab3a9f39f4965d
[ "MIT" ]
null
null
null
JS Advanced/01.Syntax, Functions and Statements/02.StringLength.js
yovko93/JavaScript-Repo
7b63642fbaaff537632d1ac31fab3a9f39f4965d
[ "MIT" ]
null
null
null
JS Advanced/01.Syntax, Functions and Statements/02.StringLength.js
yovko93/JavaScript-Repo
7b63642fbaaff537632d1ac31fab3a9f39f4965d
[ "MIT" ]
null
null
null
function solve(first, second, third){ let firstLength = first.length; let secondLength = second.length; let thirdLength = third.length; let sumLength = firstLength + secondLength + thirdLength; let averageLength = Math.floor(sumLength / 3); console.log(sumLength); console.log(averageLength); } solve('chocolate', 'ice cream', 'cake');
28.153846
61
0.696721
805fdcb775adb3c82dfc500b5c26f4606621619b
1,418
js
JavaScript
app.js
Sazzo/discnergy
742b151a2fc41d1ac8ee3436ceacdee430d3b18c
[ "MIT" ]
2
2019-03-16T16:12:29.000Z
2021-04-06T01:58:54.000Z
app.js
Sazzo/discnergy
742b151a2fc41d1ac8ee3436ceacdee430d3b18c
[ "MIT" ]
5
2019-03-16T17:41:44.000Z
2019-03-19T22:11:12.000Z
app.js
Sazzo/Discnergy
742b151a2fc41d1ac8ee3436ceacdee430d3b18c
[ "MIT" ]
null
null
null
const Discord = require("discord.js"); const Enmap = require("enmap"); const fs = require("fs"); const client = new Discord.Client(); const config = require("./config.json"); // Essa config não está na github por conter informações secretas do bot. client.config = config; // Iniciando DataBase const firebase = require('firebase/app'); const FieldValue = require ('firebase-admin').firestore.FieldValue; const admin = require('firebase-admin'); const Account = require('./system/gearDBASEops.json') admin.initializeApp({ credential: admin.credential.cert(Account) }); let db = admin.firestore(); // Tudo isso é a Command Handler. fs.readdir("./events/", (err, files) => { if (err) return console.error(err); files.forEach(file => { const event = require(`./events/${file}`); let eventName = file.split(".")[0]; client.on(eventName, event.bind(null, client)); console.log(`Sistema: Evento enviado ${eventName}`) }); }); client.commands = new Enmap(); fs.readdir("./commands/", (err, files) => { if (err) return console.error(err); files.forEach(file => { if (!file.endsWith(".js")) return; let props = require(`./commands/${file}`); let commandName = file.split(".")[0]; console.log(`Sistema: Enviado ${commandName}`); client.commands.set(commandName, props); }); }); // Vai logar no bot. client.login(config.token)
30.826087
115
0.649506
806200fb4efdf86af1720d6f2e9549ae58e523d6
737
js
JavaScript
targets/DOCS/html/structrlc__am__control__pdu__info.js
brainliubo/openairstudy
8c1f64d00dcf0fbc6efb4e49d30ce2944f512c69
[ "Apache-2.0" ]
1
2020-07-08T03:56:32.000Z
2020-07-08T03:56:32.000Z
targets/DOCS/html/structrlc__am__control__pdu__info.js
brainliubo/openairstudy
8c1f64d00dcf0fbc6efb4e49d30ce2944f512c69
[ "Apache-2.0" ]
null
null
null
targets/DOCS/html/structrlc__am__control__pdu__info.js
brainliubo/openairstudy
8c1f64d00dcf0fbc6efb4e49d30ce2944f512c69
[ "Apache-2.0" ]
null
null
null
var structrlc__am__control__pdu__info = [ [ "d_c", "structrlc__am__control__pdu__info.html#a950c365539a85462efab8c6dc41f85e2", null ], [ "cpt", "structrlc__am__control__pdu__info.html#a5541a7734b35bece248cd0291c604b50", null ], [ "ack_sn", "structrlc__am__control__pdu__info.html#aba07ca51281c309869b4bf674329afda", null ], [ "e1", "structrlc__am__control__pdu__info.html#a8df35e279fd2b0efaa22be3b1a350b82", null ], [ "dummy", "structrlc__am__control__pdu__info.html#af5260434451020e482cac23092f2cfb5", null ], [ "num_nack", "structrlc__am__control__pdu__info.html#a4074d8be85189290d60d6068603d225e", null ], [ "nack_list", "structrlc__am__control__pdu__info.html#a0acdcb2d2f59519e0c5ad144cff217d2", null ] ];
73.7
101
0.800543
8063abd3d9611cea9fd62c0f7eb2d741723821dd
90
js
JavaScript
src/dev/component/Footer.js
Lucifier129/react-page-template
d1680b2912558baeb0b7b99a8835bd006310ef3a
[ "MIT" ]
7
2017-04-12T02:13:45.000Z
2019-07-15T04:23:13.000Z
src/test/component/Footer.js
Lucifier129/react-page-template
d1680b2912558baeb0b7b99a8835bd006310ef3a
[ "MIT" ]
1
2018-03-05T05:42:52.000Z
2018-03-05T05:42:52.000Z
src/test/component/Footer.js
Lucifier129/react-page-template
d1680b2912558baeb0b7b99a8835bd006310ef3a
[ "MIT" ]
null
null
null
import React from 'react' export default function Header () { return <h1>Footer</h1> }
15
35
0.7
8065c4a3908b4b8efe7b931c39c5ef241f1b8a40
1,417
js
JavaScript
blockchain/src/ethereum/index.js
lazurcavali/chunky
0428e04299a212c6e66737579e2a9ba374f8a1dd
[ "MIT" ]
null
null
null
blockchain/src/ethereum/index.js
lazurcavali/chunky
0428e04299a212c6e66737579e2a9ba374f8a1dd
[ "MIT" ]
null
null
null
blockchain/src/ethereum/index.js
lazurcavali/chunky
0428e04299a212c6e66737579e2a9ba374f8a1dd
[ "MIT" ]
null
null
null
import EOS from './eos' import InfuraFactory from './infura' export default class Ethereum { constructor (props) { this._accounts = [] this._props = props || {} this._infura = new InfuraFactory(props.infura) this._account = props.account this._load() } _load () { try { const Web3 = require('web3') this._provider = new Web3(this.props.provider || new Web3.providers.HttpProvider(this.infura.provider)) this._eos = new EOS({ ethereum: this }) } catch (e) { console.log(e) } } get infura () { return this._infura } get props () { return this._props } get accounts () { return this._accounts } get account () { return this._account } get provider () { return this._provider } get eos () { return this._eos } contract (abi, address) { if (!abi || !address || !this.provider) { return } return new this.provider.eth.Contract(abi, address) } refreshAccounts () { return new Promise((resolve, reject) => { if (!this.provider) { resolve([]) return } this.provider.eth.getAccounts((error, accounts) => { if (error || !accounts || accounts.length < 1) { resolve([]) return } this._accounts = [].concat(accounts) this._account = accounts[0] resolve(accounts) }) }) } }
19.148649
109
0.567396
80663578db0e702490bb3a82b53de4585b3d4c10
253
js
JavaScript
example/src/App.js
bnayae/hello-react-library
7787876ffc274e8dc8640057d19fc95e0c0eb36e
[ "MIT" ]
null
null
null
example/src/App.js
bnayae/hello-react-library
7787876ffc274e8dc8640057d19fc95e0c0eb36e
[ "MIT" ]
null
null
null
example/src/App.js
bnayae/hello-react-library
7787876ffc274e8dc8640057d19fc95e0c0eb36e
[ "MIT" ]
null
null
null
import React, { Component } from "react"; import { CompA, CompB } from "hello-react-library"; export default class App extends Component { render() { return ( <div> <CompA /> <CompB value="xyz" /> </div> ); } }
16.866667
51
0.549407
806768f2dbb038531e3509d5aaf70aa1492b7e9f
1,648
js
JavaScript
package/EditDiverInfo/EditDiverInfo.js
SilverTime/ChengYuan
0aed581470fc4f7d537fc98cf47c560f26f7cd54
[ "MIT" ]
null
null
null
package/EditDiverInfo/EditDiverInfo.js
SilverTime/ChengYuan
0aed581470fc4f7d537fc98cf47c560f26f7cd54
[ "MIT" ]
null
null
null
package/EditDiverInfo/EditDiverInfo.js
SilverTime/ChengYuan
0aed581470fc4f7d537fc98cf47c560f26f7cd54
[ "MIT" ]
null
null
null
/* 编辑司机信息 内在灵魂,沉稳坚毅 生成时间:Fri Nov 11 2016 破门狂人R2-D2为您服务! */ define('EditDiverInfo',[ 'avalon', 'text!../../package/EditDiverInfo/EditDiverInfo.html', 'css!../../package/EditDiverInfo/EditDiverInfo.css', 'dic', '../../obj/bridge/User' ], function (avalon, html, css,dic,User) { //构建基础字段 var base = {} avalon.mix(base, dic) base.info = User.obj var vm=avalon.define(avalon.mix({ $id:"EditDiverInfo", ready: function (i) { var obj='' if(obj!=""){ require(['../../obj/Management/'+obj+'.js'], function () { start() }) }else{ start() } function start(){ vm.reset(i) index.html=html //以及其他方法 vm.getOldInfo(i) } }, reset: function (i) { avalon.mix(vm,{ //要重置的东西最后都放回到这里 UID:i }) }, UID:0, //获取司机信息 getOldInfo: function (DID) { User.get(DID, function (res) { vm.info=res }) }, //提交编辑 save: function () { var data={ Name:vm.info.Name, Phone:vm.info.Phone, Sex:vm.info.Sex } if(data.Name==""){ tip.on('姓名不能为空') return } User.save(vm.UID,data, function (res) { goto('#!/DriverInfo/'+res.UID) }) } },base)) return window[vm.$id]=vm })
21.684211
74
0.404733
8069cca3b42c9fbd203c84dae518e34abbe447ca
463
js
JavaScript
Object/values.js
Stan-BK/oneDayPolyfill
c8affbe4c197451abe96332ca9d7ee149819d5d3
[ "MIT" ]
null
null
null
Object/values.js
Stan-BK/oneDayPolyfill
c8affbe4c197451abe96332ca9d7ee149819d5d3
[ "MIT" ]
null
null
null
Object/values.js
Stan-BK/oneDayPolyfill
c8affbe4c197451abe96332ca9d7ee149819d5d3
[ "MIT" ]
null
null
null
// Object.values ES2017 // 返回一个给定对象自身的所有可枚举属性值的数组,值的顺序与使用for...in循环的顺序相同 ( 区别在于 for-in 循环枚举原型链中的属性 )。 Object.Myvalues = function(obj) { if (obj == undefined) { throw new TypeError('Cannot convert undefined or null to object') } obj = Object(obj) var arr = [] for (var i in obj) { if (Object.prototype.hasOwnProperty.call(obj, i)) { arr.push(obj[i]) } } return arr } var obj = {a:1,[Symbol('b')]:2} console.log(Object.Myvalues(obj))
27.235294
77
0.654428
8069f72f780d8ae449c4f5f7413cb49725af2850
592
js
JavaScript
src/App.js
Drizzle-Technologies/webapp-front
03136665a3aba648a3cc1cce824e973340ef69a1
[ "MIT" ]
null
null
null
src/App.js
Drizzle-Technologies/webapp-front
03136665a3aba648a3cc1cce824e973340ef69a1
[ "MIT" ]
null
null
null
src/App.js
Drizzle-Technologies/webapp-front
03136665a3aba648a3cc1cce824e973340ef69a1
[ "MIT" ]
null
null
null
import "bootstrap/dist/css/bootstrap.min.css" import { createMuiTheme, ThemeProvider } from "@material-ui/core/styles"; import Routes from "./routes/routes" import { Provider } from "react-redux" import store from "./store" const theme = createMuiTheme({ palette: { primary: { main: "#7632DB", }, secondary: { main: "#FFEC51", }, }, }); function App() { return ( <ThemeProvider theme={theme}> <div className="App"> <Provider store={store}> <Routes /> </Provider> </div> </ThemeProvider> ); } export default App;
16.444444
73
0.601351
806a1087c543b9c5304cebd3b4caa03482b9f957
97
js
JavaScript
frontend/src/providers/IVSContext.js
Saayaman/amazon-ivs-virtual-qa-web-demo
82b19db29027f2b5a5ee76d6c198e4403cf35279
[ "MIT-0" ]
6
2021-07-18T10:15:59.000Z
2022-03-23T17:36:24.000Z
frontend/src/providers/IVSContext.js
Saayaman/amazon-ivs-virtual-qa-web-demo
82b19db29027f2b5a5ee76d6c198e4403cf35279
[ "MIT-0" ]
2
2021-12-10T18:23:52.000Z
2022-02-08T21:46:07.000Z
frontend/src/providers/IVSContext.js
Saayaman/amazon-ivs-virtual-qa-web-demo
82b19db29027f2b5a5ee76d6c198e4403cf35279
[ "MIT-0" ]
7
2021-06-10T18:54:07.000Z
2022-02-04T20:04:42.000Z
import React from 'react'; const IVSContext = React.createContext(); export default IVSContext;
19.4
41
0.783505
806b08d2d5cbb5743926080a91dab37f49c0ddf2
2,991
js
JavaScript
src/views/home.js
Akshantjain/cs422project
5c373f9233f0be19483afb909fa68f3ca77af97a
[ "MIT" ]
null
null
null
src/views/home.js
Akshantjain/cs422project
5c373f9233f0be19483afb909fa68f3ca77af97a
[ "MIT" ]
9
2021-09-22T08:14:36.000Z
2022-03-15T20:47:25.000Z
src/views/home.js
Akshantjain/cs422project
5c373f9233f0be19483afb909fa68f3ca77af97a
[ "MIT" ]
null
null
null
import React, { Component } from "react"; import { Button, Divider, IconButton } from "@material-ui/core"; import { HomeRounded } from "@material-ui/icons"; import { withStyles } from "@material-ui/core/styles"; const styles = (theme) => ({ root: { backgroundColor: "rgba(253, 242, 208, 1)", stroke: "rgba(112, 112, 112, 1)", filter: "drop-shadow(0px 3px 6px rgba(0, 0, 0, 0.161))", height: "306px", width: "406px", strokeWidth: "2px", borderRadius: "10px", fontFamily: "Helvetica Neue", fontStyle: "normal", fontWeight: 500, color: "rgba(112,112,112,1)", }, }); class Home extends Component { render() { const { classes } = this.props; return ( <div style={{marginTop: '8rem'}}> <h1> MY DAILY LIFE <span style={{fontSize: '16px', paddingLeft: '20px'}}>A Simpler way to manage your time</span> </h1> <div className="navRow" style={{marginTop: '3rem'}} > <Button className={classes.root} href="/overview" size="large" variant="outlined" > Overview </Button> <Button className={classes.root} href="/schedule" size="large" variant="outlined" > Schedule </Button> <Button className={classes.root} href="/goals" size="large" variant="outlined" > Goals </Button> <Button className={classes.root} href="checklists" size="large" variant="outlined" > Checklists </Button> </div> <div style={{ marginTop: '5rem' }} style={{ backgroundColor: 'rgba(242, 242, 242, 1)'}}> <Divider /> <h5>Tutorial: </h5> <p> The app allows the user to add, edit and delete meetings, reminders, goals and checklists. <br></br> In this protptype, there are many things which are not implemented yet, but you can have an idea what we are trying to do over here.<br></br> There are four sections in the app, namely, overview, schedule, goals and checklists. <br></br> There is hardcoded data in the app for now, but you can use the buttons to see how the interfaces look like for things like add, edit and delete.<br></br> Also, in the real-world implementation, we planned to provide the "GOTO TODAY DATE" and "IMPORT DATA" features as well.<br></br> Due to the lack of resources and time, we haven't implemented them in here yet. <br></br> You can go to different sections and places to see how the interfaces looks and how you can add, edit and delete the datas. <br></br> </p> </div> </div> ); } } export default withStyles(styles, { withTheme: true })(Home);
33.988636
166
0.550652
806be367efe3dbce73454811eb151c07d9efd1af
126
js
JavaScript
lang.js
mccreery/time-in-bank
747172030edae2c73f593a602db94dd64d5db39a
[ "MIT" ]
null
null
null
lang.js
mccreery/time-in-bank
747172030edae2c73f593a602db94dd64d5db39a
[ "MIT" ]
null
null
null
lang.js
mccreery/time-in-bank
747172030edae2c73f593a602db94dd64d5db39a
[ "MIT" ]
null
null
null
ModLanguage("EN", { "%1 month": [ "%1 month", "%1 months" ], "%1 year": [ "%1 year", "%1 years" ] });
11.454545
19
0.380952
806e1717bc4e3284d19884a6f1657fb5942986d3
1,088
js
JavaScript
weakmap.js
tengkuzulfadli/mapmethods
6e21fa6b73bc219347d9f90fdbd399b350940964
[ "MIT" ]
null
null
null
weakmap.js
tengkuzulfadli/mapmethods
6e21fa6b73bc219347d9f90fdbd399b350940964
[ "MIT" ]
null
null
null
weakmap.js
tengkuzulfadli/mapmethods
6e21fa6b73bc219347d9f90fdbd399b350940964
[ "MIT" ]
null
null
null
const newYork = {city: "New York"}; const nola = {city: "New Orleans"}; const chicago = {city: "Chicago"}; const losAngeles = {city: "Los Angeles"}; //Create a WeakMap using the provided variables as keys. //Set the value to whatever term you think of when you hear //those cities. The value can be anything. Hint: use set() const cities = new WeakMap(); cities.set(newYork, "Big Apple"); cities.set(nola, "Mardi Grass"); cities.set(chicago, "Windy city"); cities.set(losAngeles, "Hollywood"); //Get the value associated with the key: nola. const nolaValue = cities.get(nola); console.log("What is the value of the key Nola? ", nolaValue); //Get the value associated with the key: dallas. const dallas = {city: "Dallas"}; const dallasValue = cities.get(dallas); console.log("What is the value of the key Dallas? ", dallasValue); //Does this WeakMap have the key: newYork? const hasNewYork = cities.has(newYork); console.log("Does our key map has the key newYork?", hasNewYork); //Delete the following key from your WeakMap: chicago cities.delete(chicago);
37.517241
67
0.70864
806f39f827cab653a159020ff488a7faaad4a509
3,736
js
JavaScript
assets/src/dashboard/app/api/useTemplateApi.js
cvolzke4/web-stories-wp
7ac2aa402cdbcc191937d8dfb805bf69727ec92f
[ "Apache-2.0" ]
1
2020-04-22T03:10:13.000Z
2020-04-22T03:10:13.000Z
assets/src/dashboard/app/api/useTemplateApi.js
cvolzke4/web-stories-wp
7ac2aa402cdbcc191937d8dfb805bf69727ec92f
[ "Apache-2.0" ]
null
null
null
assets/src/dashboard/app/api/useTemplateApi.js
cvolzke4/web-stories-wp
7ac2aa402cdbcc191937d8dfb805bf69727ec92f
[ "Apache-2.0" ]
null
null
null
/* * Copyright 2020 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * External dependencies */ import { useState, useMemo, useCallback } from 'react'; import moment from 'moment'; /** * Internal dependencies */ import getAllTemplates from '../../templates'; import { APP_ROUTES } from '../../constants'; export function reshapeTemplateObject(isLocal) { return ({ id, title, modified, tags, colors, createdBy, description, pages, }) => ({ isLocal, id, title, createdBy, description, status: 'template', modified: moment(modified), tags, colors, pages, centerTargetAction: `#${APP_ROUTES.TEMPLATE_DETAIL}?id=${id}&isLocal=${isLocal}`, bottomTargetAction: () => {}, }); } // TODO: Remove this eslint rule once endpoints are working /* eslint-disable no-unused-vars */ const useTemplateApi = (dataAdapter, config) => { const [templates, setTemplates] = useState([]); const { pluginDir } = config; const createStoryFromTemplatePages = useCallback((pages) => { return Promise.resolve({ success: true, storyId: -1 }); }, []); const fetchSavedTemplates = useCallback((filters) => { // Saved Templates = Bookmarked Templates + My Templates setTemplates([]); return Promise.resolve([]); }, []); const fetchBookmarkedTemplates = useCallback((filters) => { setTemplates([]); return Promise.resolve([]); }, []); const fetchMyTemplates = useCallback((filters) => { setTemplates([]); return Promise.resolve([]); }, []); const fetchMyTemplateById = useCallback((templateId) => { return Promise.resolve({}); }, []); const fetchExternalTemplates = useCallback( (filters) => { const reshapedTemplates = getAllTemplates({ pluginDir }).map( reshapeTemplateObject(false) ); setTemplates(reshapedTemplates); return Promise.resolve(reshapedTemplates); }, [pluginDir] ); const fetchExternalTemplateById = useCallback( async (templateId) => { const fetchedTemplates = await fetchExternalTemplates(); return Promise.resolve( fetchedTemplates.find((template) => template.id === templateId) ); }, [fetchExternalTemplates] ); const bookmarkTemplateById = useCallback((templateId, shouldBookmark) => { if (shouldBookmark) { // api call to bookmark template return Promise.resolve({ success: true }); } else { // api call to remove bookmark from template return Promise.resolve({ success: true }); } }, []); const api = useMemo( () => ({ bookmarkTemplateById, createStoryFromTemplatePages, fetchBookmarkedTemplates, fetchSavedTemplates, fetchMyTemplates, fetchMyTemplateById, fetchExternalTemplates, fetchExternalTemplateById, }), [ bookmarkTemplateById, createStoryFromTemplatePages, fetchBookmarkedTemplates, fetchExternalTemplateById, fetchExternalTemplates, fetchMyTemplateById, fetchMyTemplates, fetchSavedTemplates, ] ); return { templates, api }; }; /* eslint-enable no-unused-vars */ export default useTemplateApi;
25.765517
85
0.661403
806f5656517b4aaa50e61578c8f78c964eb6a802
740
js
JavaScript
tests/runtime/js/lib/unsafe.js
keichinger/skip
e8831ebbea8e510e3fd5a4ca26c1abf6054a217c
[ "MIT" ]
1,836
2018-09-26T16:32:50.000Z
2022-03-28T12:04:19.000Z
tests/runtime/js/lib/unsafe.js
keichinger/skip
e8831ebbea8e510e3fd5a4ca26c1abf6054a217c
[ "MIT" ]
81
2018-09-26T18:47:22.000Z
2022-03-25T04:58:56.000Z
tests/runtime/js/lib/unsafe.js
keichinger/skip
e8831ebbea8e510e3fd5a4ca26c1abf6054a217c
[ "MIT" ]
83
2018-09-26T16:50:44.000Z
2022-03-04T14:17:14.000Z
/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ /** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ 'use strict'; module.exports = function(sk) { sk.__.defineGlobalFunction('Unsafe.array_make', function(size) { return sk.Array.unsafe_make(size); }); sk.__.defineGlobalFunction('Unsafe.array_get', function(v, i) { return v.unsafe_get(i); }); sk.__.defineGlobalFunction('Unsafe.array_set', function(v, i, x) { v.unsafe_set(i, x); }); }
26.428571
68
0.689189
806f7c0048bde4d697d7b25ebf4d41e362c761ca
2,735
js
JavaScript
src/Views/news/globalFeed.js
verynice-solutions/Firulais-fire-native
823550b782c1346377d31a82004d81cfb2922df9
[ "Apache-2.0" ]
1
2018-04-26T19:01:00.000Z
2018-04-26T19:01:00.000Z
src/Views/news/globalFeed.js
verynice-solutions/Firulais-fire-native
823550b782c1346377d31a82004d81cfb2922df9
[ "Apache-2.0" ]
18
2018-05-05T15:49:15.000Z
2018-05-30T18:59:04.000Z
src/Views/news/globalFeed.js
Jrocam/Firulais-fire-native
823550b782c1346377d31a82004d81cfb2922df9
[ "Apache-2.0" ]
null
null
null
import React, { Component } from 'react' import {connect} from 'react-redux' import { View, StyleSheet, TouchableOpacity, ScrollView, Image, ActivityIndicator } from 'react-native' import { TabNavigator } from 'react-navigation'; import { Container, Header, Content, List, ListItem, Thumbnail, Text, Body } from 'native-base'; import { Ionicons } from '@expo/vector-icons' import foundationsActions from '../../actions/foundationsActions' import usersActions from '../../actions/usersActions' import images from '../../../assets/images' class GlobalFeed extends React.Component { constructor(props) { super(props) this.state = { news: null, fetching: false } } componentDidMount() { this.setState({fetching:true}) usersActions.fetchNNews(10).then((val)=>{ this.setState({news: val,fetching:false}) }) } static navigationOptions = ({navigation}) => { const params = navigation.state.params || {}; return{ title: 'Noticias', tabBarLabel: 'GLOBALES', tabBarIcon: <Ionicons size={26} name='md-globe'/> } } render() { const { navigate } = this.props.navigation let news = this.state.news if(this.state.fetching){ return( <View style={{ flex:1, justifyContent: 'center' }} > <ActivityIndicator size='large' /> </View> ) }else{ return ( <View style={{flex:1}}> <ScrollView> <List> { news ?( Object.keys(news).map((i)=>{ let imgs = news[i].imageUrls return <ListItem key={i} onPress={ ()=> navigate('NewsView', { news: news[i] }) }> <Thumbnail rounded size={80} source={{ uri: imgs[Object.keys(imgs)[0]].url }} /> <Body> <Text>{news[i].title}</Text> <Text numberOfLines={2} note > { news[i].description } </Text> </Body> </ListItem> }) ):( <View style={{paddingTop:100, paddingHorizontal:30,justifyContent:'center',alignItems:'center'}}> <Image source={images.sherlock_kitty} resizeMode= 'contain' style={{height: 180, width: 180}}/> <Text style={{fontStyle:'italic',fontFamily:'Roboto-Bold', textAlign:'center',lineHeight:30, fontSize:18,marginTop:18}}>No hay noticias aún.</Text> </View> ) } </List> </ScrollView> </View> ); } } } function mapStateToProps({currentUser}) { return { currentUser: currentUser, } } export default connect(mapStateToProps)(GlobalFeed)
32.951807
167
0.559781
807013e6a5c2a84f7634c14239ee29888468dd3b
721
js
JavaScript
OMP2D/doc/html/namespaceOMP2D.js
simonsm1/OMP2D
8a0b7c291b0a8e5ad81e1c084a21b98007e5caa5
[ "Unlicense" ]
1
2016-02-14T15:21:47.000Z
2016-02-14T15:21:47.000Z
OMP2D/doc/html/namespaceOMP2D.js
simonsm1/OMP2D
8a0b7c291b0a8e5ad81e1c084a21b98007e5caa5
[ "Unlicense" ]
null
null
null
OMP2D/doc/html/namespaceOMP2D.js
simonsm1/OMP2D
8a0b7c291b0a8e5ad81e1c084a21b98007e5caa5
[ "Unlicense" ]
null
null
null
var namespaceOMP2D = [ [ "BadDimensionsException", "classOMP2D_1_1BadDimensionsException.html", "classOMP2D_1_1BadDimensionsException" ], [ "CleverPointer< V >", "classOMP2D_1_1CleverPointer_3_01V_01_4.html", "classOMP2D_1_1CleverPointer_3_01V_01_4" ], [ "CudaDirector", "classOMP2D_1_1CudaDirector.html", null ], [ "CudaMatrix", "classOMP2D_1_1CudaMatrix.html", "classOMP2D_1_1CudaMatrix" ], [ "DictionaryX", "classOMP2D_1_1DictionaryX.html", "classOMP2D_1_1DictionaryX" ], [ "DictionaryY", "classOMP2D_1_1DictionaryY.html", "classOMP2D_1_1DictionaryY" ], [ "Matrix", "classOMP2D_1_1Matrix.html", "classOMP2D_1_1Matrix" ], [ "OMP2D", "classOMP2D_1_1OMP2D.html", "classOMP2D_1_1OMP2D" ] ];
65.545455
118
0.754508
8070d7c18e6c1263cd7b073d24b8dd424ff904b7
549
js
JavaScript
ModulosJSEMS6/js/cliente.js
pablonolasco/Curso-JavaScript
30ae2043e238b667ddf5a30d7b560892af36ed1d
[ "MIT" ]
null
null
null
ModulosJSEMS6/js/cliente.js
pablonolasco/Curso-JavaScript
30ae2043e238b667ddf5a30d7b560892af36ed1d
[ "MIT" ]
null
null
null
ModulosJSEMS6/js/cliente.js
pablonolasco/Curso-JavaScript
30ae2043e238b667ddf5a30d7b560892af36ed1d
[ "MIT" ]
null
null
null
//Todo exportar variables export const nombreCliente='Juan'; export let ahorro=50; //Todo Exportar Funciones export function mostrarInformacion(nombreCliente,ahorro){ return `Cliente ${nombreCliente}- Ahorro ${ahorro}`; } export function mostrarNombre(nombreCliente){ return `Nombre del Cliente ${nombreCliente}`; } //Todo Exportar clases export class Cliente{ constructor(nombre,ahorro){ this.nombre=nombre; this.ahorro=ahorro; } mostrarNombre(){ return `Cliente ${this.nombre}`; } }
21.96
57
0.688525
8071e2b18ea05b43dd5886eb5c5b916a7e395cb6
2,213
js
JavaScript
source/jquery.ajp.zippy.js
jeffreyhi1/another-jquery-plugins
9ac47eba542d0456cd49b0c0b85e0818c2620e80
[ "MIT" ]
null
null
null
source/jquery.ajp.zippy.js
jeffreyhi1/another-jquery-plugins
9ac47eba542d0456cd49b0c0b85e0818c2620e80
[ "MIT" ]
null
null
null
source/jquery.ajp.zippy.js
jeffreyhi1/another-jquery-plugins
9ac47eba542d0456cd49b0c0b85e0818c2620e80
[ "MIT" ]
null
null
null
/* Copyright (c) 2011 Andrey O. Zbitnev (azbitnev@gmail.com) Licensed under the MIT License (LICENSE.txt). $Id$ */ (function ($) { if (!$.ajp) $.ajp = { } $.ajp.zippy = { version: '0.2pa' } $.fn.extend({ ajp$zippy: function (options) { var opts, defaults = { event: 'click', duration: 'fast', easing: 'linear', show: function ($c, $a) { $a.data('ajp-zippy-ready', false) var h, $cc = $c.children('div:eq(0)'), pt = $cc.css('padding-top'), pb = $cc.css('padding-bottom'), hfix = (/^[\.0]+(px|em|pt)?$/.test(pt) && /^[\.0]+(px|em|pt)$/.test(pb)) if (hfix) { h = $cc.css({ 'padding-top': '1px', 'padding-bottom': '1px' }).outerHeight() - 2 $cc.css({ 'padding-top': pt, 'padding-bottom': pb }) } else { h = $cc.outerHeight() } $c.scrollTop(h) .css({ visibility: 'visible' }) .animate({ height: '' + h + 'px', scrollTop: h }, opts.duration, opts.easing, function () { $a.data('ajp-zippy-ready', true) } ) }, hide: function ($c, $a) { $a.data('ajp-zippy-ready', false) var h = $c.children('div:eq(0)').outerHeight() $c.scrollTop(h).animate({ height: 0, scrollTop: h }, opts.duration, opts.easing, function () { $c.css({ visibility: 'hidden' }) $a.data('ajp-zippy-ready', true) }) } } opts = $.extend(defaults, options); return this.each(function(i, el) { var $a = $(el), $c = $a.next() $a.bind(opts.event, function (evt) { if ($a.data('ajp-zippy-ready')) { if ($a.hasClass('ajp-zippy-collapsed')) { $a.removeClass('ajp-zippy-collapsed') .addClass('ajp-zippy-expanded') opts.show($c, $a) } else { $a.removeClass('ajp-zippy-expanded') .addClass('ajp-zippy-collapsed') opts.hide($c, $a) } } evt.preventDefault() evt.stopPropagation() return false }) $a.data('ajp-zippy-ready', true) $c.css({ visibility: 'hidden', 'height': 0 }) }) } }) })(jQuery);
24.865169
100
0.485314
80721be40ce82b35ef09ea0ba280e5e9c44ef129
466
js
JavaScript
lib/node/dependency_map.js
icarito/steal-tools
d6a0a978e397c4c2b266b3f003bb7a3f702ba21d
[ "MIT" ]
57
2015-03-25T03:40:05.000Z
2021-06-13T20:14:14.000Z
lib/node/dependency_map.js
icarito/steal-tools
d6a0a978e397c4c2b266b3f003bb7a3f702ba21d
[ "MIT" ]
884
2015-03-11T16:43:49.000Z
2022-01-10T16:15:46.000Z
lib/node/dependency_map.js
icarito/steal-tools
d6a0a978e397c4c2b266b3f003bb7a3f702ba21d
[ "MIT" ]
22
2015-04-29T22:33:22.000Z
2020-06-06T16:28:01.000Z
/** * @method stealTools.node.dependencyMap * * Creating a mapping from pre-normalized dependency names to the normalized version. * Save the mapping as `dependencyMap` on the node itself. Transpile will use this * information. */ module.exports = function(node) { var deps = node.deps || []; var dependencies = node.dependencies || []; var map = {}; for(var i = 0, len = deps.length; i < len; i++) { map[deps[i]] = dependencies[i]; } return map; };
24.526316
85
0.667382
80724120f8e7e6bd4964a0f3d8cdc015904fdecb
346
js
JavaScript
test/spec/services/jobsData.js
DigitalMachinist/globalgamejam2015
bab168f8cfd67e2ad4e1d3e61e308d0df11ceec2
[ "MIT" ]
null
null
null
test/spec/services/jobsData.js
DigitalMachinist/globalgamejam2015
bab168f8cfd67e2ad4e1d3e61e308d0df11ceec2
[ "MIT" ]
null
null
null
test/spec/services/jobsData.js
DigitalMachinist/globalgamejam2015
bab168f8cfd67e2ad4e1d3e61e308d0df11ceec2
[ "MIT" ]
null
null
null
'use strict'; describe('Service: Jobsdata', function () { // load the service's module beforeEach(module('Globalgamejam2015App')); // instantiate service var Jobsdata; beforeEach(inject(function (_Jobsdata_) { Jobsdata = _Jobsdata_; })); it('should do something', function () { expect(!!Jobsdata).toBe(true); }); });
18.210526
45
0.656069
807263743bae8f32795f68563e38b2b7eda135f1
1,045
js
JavaScript
src/schemas/index.js
ingleonelrv/trailerVideosReact
f33784f367df61f507c61ff175d642e6361bc50a
[ "MIT" ]
null
null
null
src/schemas/index.js
ingleonelrv/trailerVideosReact
f33784f367df61f507c61ff175d642e6361bc50a
[ "MIT" ]
5
2021-03-09T00:47:02.000Z
2022-02-26T09:49:46.000Z
src/schemas/index.js
ingleonelrv/trailerVideosReact
f33784f367df61f507c61ff175d642e6361bc50a
[ "MIT" ]
null
null
null
import api from '../api.json' import {normalize, schema} from 'normalizr' //le pasamos como parametro la key para identificar todos los medias, definicion del schema por si quiero heredarlo y opciones //opciones: q key de media usare como id= ya tengo un key id usare ese const media = new schema.Entity('media',{},{ idAttribute:'id', // processStrategy: (mediaValue, parentValue, mediaKey)=> (return que datos quiero devolver de media) processStrategy: (value, parent, key)=>({...value, category: parent.id}) }) //le pasamos como parametro el key identificador y en este caso si voy a heredar la playlist y esta es un arreglo de medias const category = new schema.Entity('categories',{ playlist: new schema.Array(media) }) //en este caso hay 3 category, un arreglo que podemos ver en la api, igual las playlist //quiero retornar un objeto de categories, los key usados estan en la api const categories = {categories: new schema.Array(category)} const normalizedData= normalize(api, categories) export default normalizedData
45.434783
126
0.751196
8075275f9a8734fd9bfe0de9167cda0906a03eac
1,548
js
JavaScript
src/containers/bookList.js
Murray918/small-redux-tutorial
550a9247470c5d108201e20e5acc8b7cd7c35709
[ "MIT" ]
null
null
null
src/containers/bookList.js
Murray918/small-redux-tutorial
550a9247470c5d108201e20e5acc8b7cd7c35709
[ "MIT" ]
null
null
null
src/containers/bookList.js
Murray918/small-redux-tutorial
550a9247470c5d108201e20e5acc8b7cd7c35709
[ "MIT" ]
null
null
null
import React, { Component } from 'react'; // this connects this react component with redux essentially propmoting it into a container import { connect } from 'react-redux' //import this action import { selectBook } from '../actions/index'; //binds the action creatoe import { bindActionCreators } from 'redux' class BookList extends Component { renderList() { return this.props.books.map((book) => { return ( <li onClick = {() => this.props.selectBook(book)} key = {book.title} className = "list-group-item"> {book.title} </li> ) }) } render() { return ( <ul className="list-group col-sm-4"> {this.renderList()} </ul> ) } } function mapStateToProps(state) { // whatever gets returned here will show up as props inside of Booklist return { books: state.books } } // any thing returned throught this function will end up as props on the booklist container function mapDispatchToProps(dispatch) { // whenever selectBook is called, the result should be passed to all of out reducers return bindActionCreators({selectBook : selectBook}, dispatch) } // if the state changes for any reason this container will instantly rerender with the updated state and the object in the state function will be assigned as props to the component -it needs to know about this new dispatch method, selectBook. Make it available as a prop. export default connect(mapStateToProps, mapDispatchToProps)(BookList);
32.93617
271
0.677649
8075b9d32c9b7ed1821bf602e9aebf02b7e129bd
790
js
JavaScript
models/faqs.js
testVikran/CAPI
4b1fb7835b1896314d5a0c898bdfeea9494e1402
[ "MIT" ]
null
null
null
models/faqs.js
testVikran/CAPI
4b1fb7835b1896314d5a0c898bdfeea9494e1402
[ "MIT" ]
1
2021-05-09T23:46:46.000Z
2021-05-09T23:46:46.000Z
models/faqs.js
testVikran/CAPI
4b1fb7835b1896314d5a0c898bdfeea9494e1402
[ "MIT" ]
null
null
null
/* jshint indent: 2 */ module.exports = function(sequelize, DataTypes) { return sequelize.define('faqs', { id: { type: DataTypes.INTEGER(11).UNSIGNED, allowNull: false, primaryKey: true, autoIncrement: true, field: 'id' }, title: { type: DataTypes.STRING(200), allowNull: true, field: 'title' }, desc: { type: DataTypes.TEXT, allowNull: true, field: 'desc' }, videoUrl: { type: DataTypes.STRING(300), allowNull: true, field: 'video_url' }, tags: { type: DataTypes.STRING(200), allowNull: true, field: 'tags' }, type: { type: DataTypes.STRING(100), allowNull: true, field: 'type' } }, { tableName: 'faqs' }); };
19.268293
49
0.531646
8075d5512cdda39933753da4a05e96d2cd6bb4e3
1,684
js
JavaScript
src/EntityManager.js
jymfony/typeorm-bundle
0fbf0561095a434532441b38622a3990836a8310
[ "MIT" ]
1
2019-02-13T09:07:32.000Z
2019-02-13T09:07:32.000Z
src/EntityManager.js
jymfony/typeorm-bundle
0fbf0561095a434532441b38622a3990836a8310
[ "MIT" ]
null
null
null
src/EntityManager.js
jymfony/typeorm-bundle
0fbf0561095a434532441b38622a3990836a8310
[ "MIT" ]
null
null
null
import { EntityManager as Base } from 'typeorm'; const RepositoryNotFoundError = Jymfony.Bundle.TypeORMBundle.Exception.RepositoryNotFoundError; const RepositoryFactory = Jymfony.Bundle.TypeORMBundle.Repository.RepositoryFactory; /** * @memberOf Jymfony.Bundle.TypeORMBundle */ export default class EntityManager extends Base { constructor(connection, queryRunner = undefined) { super(connection, queryRunner); /** * @type {Jymfony.Bundle.TypeORMBundle.Repository.RepositoryFactory} * * @private */ this._repositoryFactory = undefined; } /** * @inheritdoc */ getRepository(target) { // Throw exception if there is no repository with this target registered if (! this.connection.hasMetadata(target)) { throw new RepositoryNotFoundError(this.connection.name, target); } const metadata = this.connection.getMetadata(target); const repository = this.repositories.find(repository => repository.metadata === metadata); if (repository) { return repository; } const repositoryInstance = this._getRepositoryFactory().create(this, metadata, this.queryRunner); this.repositories.push(repositoryInstance); return repositoryInstance; } /** * Gets a repository factory instance. * * @returns {Jymfony.Bundle.TypeORMBundle.Repository.RepositoryFactory} * * @private */ _getRepositoryFactory() { if (! this._repositoryFactory) { this._repositoryFactory = new RepositoryFactory(); } return this._repositoryFactory; } }
30.071429
105
0.658551
807746e6637ea1fdb4df11cda73e24c13251d9b9
305
js
JavaScript
electron/static/js/browser_windows/configWindow.js
cchesley2397/neht-graff
848af3d3c60e760a25ac103c7634c72781c749b2
[ "BSD-3-Clause-No-Nuclear-License-2014" ]
5
2019-10-21T22:54:29.000Z
2019-10-31T19:08:46.000Z
electron/static/js/browser_windows/configWindow.js
cchesley2397/neht-graff
848af3d3c60e760a25ac103c7634c72781c749b2
[ "BSD-3-Clause-No-Nuclear-License-2014" ]
2
2020-10-25T18:26:11.000Z
2022-03-25T18:54:46.000Z
electron/static/js/browser_windows/configWindow.js
cchesley2397/neht-graff
848af3d3c60e760a25ac103c7634c72781c749b2
[ "BSD-3-Clause-No-Nuclear-License-2014" ]
2
2019-11-20T01:02:39.000Z
2019-11-26T13:15:55.000Z
const { ipcRenderer } = require('electron'); document.querySelector('.configFormSubmit') .addEventListener('click', function () { let formData = { flaskAddress: document.getElementById('flaskAddress').value }; ipcRenderer.send('config_submit', formData); });
27.727273
71
0.639344
80777694992a3b44c747bf9d609cc6e30574bf3b
6,666
js
JavaScript
tests/products/products.spec.js
fire-cracker/Tienda
57f591f15360781dca8b421904de18f0965e8937
[ "MIT" ]
null
null
null
tests/products/products.spec.js
fire-cracker/Tienda
57f591f15360781dca8b421904de18f0965e8937
[ "MIT" ]
null
null
null
tests/products/products.spec.js
fire-cracker/Tienda
57f591f15360781dca8b421904de18f0965e8937
[ "MIT" ]
null
null
null
import fs from 'fs'; import path from 'path'; import chai, { expect } from 'chai'; import chaiHttp from 'chai-http'; import app from '../../index'; import { sequelize } from '../../server/model/index'; import { productKeys } from '../mocks/mockProducts'; import { errorFormat } from '../mocks/mockError'; chai.use(chaiHttp); describe('Tests for get Product', () => { before(async () => { const sql = await fs.promises.readFile(path.join(__dirname, '../../server/model/tshirtshop.sql'), 'utf8'); await sequelize.query(sql, { type: sequelize.QueryTypes.RAW }); }); describe('Tests to get all products', () => { it('should get all products', async () => { const res = await chai.request(app) .get('/products'); expect(res).to.have.status(200); expect(res.body).to.be.an('object'); expect(res.body.count > 0).to.equal(true); expect(res.body.count).to.be.a('number'); expect(res.body.rows.length > 0).to.equal(true); expect(res.body.rows).to.be.an('array'); }); it('should return error if parameters to get all products are incorrect', async () => { const res = await chai.request(app) .get('/products?description_length=30&limit=h&page=0'); expect(res).to.have.status(400); expect(res.body).to.be.an.instanceof(Object) .and.to.have.property('error') .that.includes.all.keys(errorFormat); }); }); describe('Tests to get all products of a category ', () => { it('it should get all products', async () => { const res = await chai.request(app) .get('/products/inCategory/2'); expect(res).to.have.status(200); expect(res.body).to.be.an('object'); expect(res.body.count > 0).to.equal(true); expect(res.body.count).to.be.a('number'); expect(res.body.rows.length > 0).to.equal(true); expect(res.body.rows).to.be.an('array'); }); it('it should return empty array if category does not have any product', async () => { const res = await chai.request(app) .get('/products/inCategory/8'); expect(res).to.have.status(200); expect(res.body).to.be.an('object'); expect(res.body.count).to.equal(0); expect(res.body.count).to.be.a('number'); expect(res.body.rows.length).to.equal(0); expect(res.body.rows).to.be.an('array'); }); it('should return error if any of parameters are incorrect', async () => { const res = await chai.request(app) .get('/products/inCategory/2?description_length=30&limit=h&page=0'); expect(res).to.have.status(400); expect(res.body).to.be.an.instanceof(Object) .and.to.have.property('error') .that.includes.all.keys(errorFormat); }); }); describe('Tests to get all products of a department ', () => { it('it should get all products', async () => { const res = await chai.request(app) .get('/products/inDepartment/2'); expect(res).to.have.status(200); expect(res.body).to.be.an('object'); expect(res.body.count > 0).to.equal(true); expect(res.body.count).to.be.a('number'); expect(res.body.rows.length > 0).to.equal(true); expect(res.body.rows).to.be.an('array'); }); it('it should return empty array if department does not have any product', async () => { const res = await chai.request(app) .get('/products/inDepartment/50'); expect(res).to.have.status(200); expect(res.body).to.be.an('object'); expect(res.body.count).to.equal(0); expect(res.body.count).to.be.a('number'); expect(res.body.rows.length).to.equal(0); expect(res.body.rows).to.be.an('array'); }); it('should return error if any of parameters are incorrect', async () => { const res = await chai.request(app) .get('/products/inDepartment/2?description_length=30&limit=h&page=0'); expect(res).to.have.status(400); expect(res.body).to.be.an.instanceof(Object) .and.to.have.property('error') .that.includes.all.keys(errorFormat); }); }); describe('Tests to search for products ', () => { it('it should get all products that have the search word', async () => { const res = await chai.request(app) .get('/products/search?query_string=peace'); expect(res).to.have.status(200); expect(res.body).to.be.an('object'); expect(res.body.count > 0).to.equal(true); expect(res.body.count).to.be.a('number'); expect(res.body.rows.length > 0).to.equal(true); expect(res.body.rows).to.be.an('array'); }); it('it should return empty array if no product has the search query', async () => { const res = await chai.request(app) .get('/products/search?query_string=serendipity'); expect(res).to.have.status(200); expect(res.body).to.be.an('object'); expect(res.body.count).to.equal(0); expect(res.body.count).to.be.a('number'); expect(res.body.rows.length).to.equal(0); expect(res.body.rows).to.be.an('array'); }); it('should return error if any of parameters are incorrect', async () => { const res = await chai.request(app) .get('/products/search?query_string=peace&description_length=30&limit=h&page=0'); expect(res).to.have.status(400); expect(res.body).to.be.an.instanceof(Object) .and.to.have.property('error') .that.includes.all.keys(errorFormat); }); }); describe('Tests to get a product', () => { it('should return a product with the details', async () => { const res = await chai.request(app) .get('/products/1/details'); expect(res).to.have.status(200); expect(res.body).to.be.an.instanceof(Object) .that.includes.all.keys(productKeys); }); it('should return error message if product does not exist', async () => { const res = await chai.request(app) .get('/products/500/details'); expect(res).to.have.status(404); expect(res.body.message).to.equal('Product does not exist'); expect(res.body.code).to.equal('PRO_01'); expect(res.body.field).to.equal('Product Id'); }); it('should return error if parameters to get all products are incorrect', async () => { const res = await chai.request(app) .get('/products/h/details'); expect(res).to.have.status(400); expect(res.body).to.be.an.instanceof(Object) .and.to.have.property('error') .that.includes.all.keys(errorFormat); expect(res.body.error.message).to.equal('"productId" must be a number'); expect(res.body.error.field).to.equal('productId'); }); }); });
39.916168
110
0.619112
8077d25dd7cc958cc3a8fdf6dfcc75d1a44dc0e3
3,704
js
JavaScript
React/ReactFamilyBucket/src/components/BookEditor.js
2284730142/My-learning-record
65f831138ed31568d8037d561f0e479893845afb
[ "MIT" ]
null
null
null
React/ReactFamilyBucket/src/components/BookEditor.js
2284730142/My-learning-record
65f831138ed31568d8037d561f0e479893845afb
[ "MIT" ]
null
null
null
React/ReactFamilyBucket/src/components/BookEditor.js
2284730142/My-learning-record
65f831138ed31568d8037d561f0e479893845afb
[ "MIT" ]
null
null
null
import React from 'react'; import PropTypes from 'prop-types'; import FormItem from '../components/FormItem'; import formProvider from '../utils/formProvider'; class BookEditor extends React.Component { constructor(props) { super(props); } static contextTypes = { router: React.PropTypes.object.isRequired }; componentWillMount() { const {editTarget, setFormValues} = this.props; if (editTarget) { setFormValues(editTarget); } } handleSubmit(e) { e.preventDefault(); const {form: {name, price, owner_id}, formValid, editTarget} = this.props; if (!formValid) { alert('请填写正确的信息后重试'); return; } let editType = '添加'; let apiUrl = 'http://localhost:3000/book'; let method = 'post'; if (editTarget) { editType = '编辑'; apiUrl += '/' + editTarget.id; method = 'put'; } fetch(apiUrl, { method, body: JSON.stringify({ name: name.value, price: price.value, owner_id: parseInt(owner_id.value) }), headers: { 'Content-Type': 'application/json' } }) .then((res) => res.json()) .then((res) => { if (res.id) { alert(editType + '图书成功'); this.context.router.history.push('/book/list'); return; } else { alert(editType + '失败'); } }) .catch((err) => console.error(err)); } render() { const {form: {name, price, owner_id}, onFormChange} = this.props; return ( <form onSubmit={(e) => this.handleSubmit(e)}> <FormItem label="图书名字:" valid={name.valid} error={name.error}> <input type="text" value={name.value} onChange={(e) => onFormChange('name', e.target.value)} /> </FormItem> <FormItem label="图书价格:" valid={price.valid} error={price.error}> <input type="number" value={price.value || ''} onChange={(e) => onFormChange('price', +e.target.value)} /> </FormItem> <FormItem label="所属人员id:" valid={owner_id.valid} error={owner_id.error}> <input value={owner_id.value} onChange={(e) => onFormChange('owner_id', e.target.value)} /> </FormItem> <br/> <input type="submit" value="提交"/> </form> ); } } BookEditor = formProvider({ name: { defaultValue: '', rules: [ { pattern: function (value) { return value.length > 0; }, error: '请输入图书名字' } ] }, price: { defaultValue: 0, rules: [ { pattern: function (value) { return value > 0; }, error: '请输入大于0的价格' } ] }, owner_id: { defaultValue: '', rules: [ { pattern: function (value) { return value.length > 0; }, error: '请输入拥有者id' } ] } })(BookEditor); export default BookEditor;
27.849624
88
0.420356
8077ec13bf07cd629815c44f65ae6403ebb50180
580
js
JavaScript
src/main.js
aburgd/results
9571104c942a47509145f0fb3d7547a756404cab
[ "MIT" ]
null
null
null
src/main.js
aburgd/results
9571104c942a47509145f0fb3d7547a756404cab
[ "MIT" ]
null
null
null
src/main.js
aburgd/results
9571104c942a47509145f0fb3d7547a756404cab
[ "MIT" ]
null
null
null
// @flow export type state = { message: string, bool: boolean } // noinspection JSUnusedGlobalSymbols export default function (title: string, ...statements: Array<state>) { console.log(title.toUpperCase()) const titleLength: number = title.length let div: string = '' for (let i = 0; i <= titleLength; i++) div += '=' console.log(div) statements.forEach((statement: state) => { let message: string = statement.message let bool: boolean = statement.bool let outMsg = message + ': ' + bool.toString() console.log(outMsg) }) console.log('\n') }
25.217391
70
0.656897
8078698ecb0b49ab9db2f15baf91f68da7717219
694
js
JavaScript
private/html/classv8_1_1debug_1_1_event_details.js
joshgav/v8docs
0518c2bd4927d7ffae467d9becd8bed3cec10882
[ "MIT" ]
null
null
null
private/html/classv8_1_1debug_1_1_event_details.js
joshgav/v8docs
0518c2bd4927d7ffae467d9becd8bed3cec10882
[ "MIT" ]
null
null
null
private/html/classv8_1_1debug_1_1_event_details.js
joshgav/v8docs
0518c2bd4927d7ffae467d9becd8bed3cec10882
[ "MIT" ]
null
null
null
var classv8_1_1debug_1_1_event_details = [ [ "~EventDetails", "classv8_1_1debug_1_1_event_details.html#a07bc44740a1f1d2ea2c2c80d8b9c4f61", null ], [ "GetCallbackData", "classv8_1_1debug_1_1_event_details.html#ae20afb48041f561dc043b299fb762f2f", null ], [ "GetEvent", "classv8_1_1debug_1_1_event_details.html#adcf383b51969a47938e31fece35d9d39", null ], [ "GetEventContext", "classv8_1_1debug_1_1_event_details.html#a769525041979a79d52fe69c96ac9e12c", null ], [ "GetEventData", "classv8_1_1debug_1_1_event_details.html#a4aa5324985d0d5d9e9ed55926dc35233", null ], [ "GetExecutionState", "classv8_1_1debug_1_1_event_details.html#a6efe375e6c1acc27036a8eec3aa035d1", null ] ];
77.111111
110
0.815562
8078d9d11322bc3a0f37704c8ab99bc2907b6efc
516
js
JavaScript
src/modules/data/wireGetContactListProvider/wireGetContactListProvider.js
autifyhq/lwc-recipes-oss
b1bccc8cde604eaf80ba617d7eea0defc06dad35
[ "CC0-1.0" ]
1
2022-01-28T01:33:25.000Z
2022-01-28T01:33:25.000Z
src/modules/data/wireGetContactListProvider/wireGetContactListProvider.js
cmagaldi79/lwc-recipes-oss
8c7d6c9f7f195123bece5fe3c5b5feed4652fc12
[ "CC0-1.0" ]
null
null
null
src/modules/data/wireGetContactListProvider/wireGetContactListProvider.js
cmagaldi79/lwc-recipes-oss
8c7d6c9f7f195123bece5fe3c5b5feed4652fc12
[ "CC0-1.0" ]
1
2022-03-11T08:38:37.000Z
2022-03-11T08:38:37.000Z
import { contacts } from 'data/contacts'; export default class getContactList { connected = false; constructor(dataCallback) { this.dataCallback = dataCallback; } connect() { this.connected = true; this.provideContactList(); } disconnect() { this.connected = false; } update() { this.provideContactList(); } provideContactList() { if (this.connected) { this.dataCallback({ data: contacts }); } } }
17.793103
50
0.562016
8078e59cb76da56c22affdc7ff5faad8be1dc657
7,742
js
JavaScript
public/frontend/assets/js/web/appointment0d32.js
Paulson05/Laravel-Hospital-managemet-system
78076cbfb1ab2e70bb2a81a7ad13124da18643d1
[ "MIT" ]
null
null
null
public/frontend/assets/js/web/appointment0d32.js
Paulson05/Laravel-Hospital-managemet-system
78076cbfb1ab2e70bb2a81a7ad13124da18643d1
[ "MIT" ]
null
null
null
public/frontend/assets/js/web/appointment0d32.js
Paulson05/Laravel-Hospital-managemet-system
78076cbfb1ab2e70bb2a81a7ad13124da18643d1
[ "MIT" ]
null
null
null
$(document).ready((function(){"use strict";var e;$("#patientId, #doctorId, #departmentId").select2({width:"100%"}),$("#opdDate").datetimepicker(DatetimepickerDefaults({format:"YYYY-MM-DD",sideBySide:!0,minDate:moment().subtract(1,"days"),useCurrent:!1})),$("#patientId").first().focus(),$("#departmentId").on("change",(function(){$(".error-message").css("display","none"),$("#opdDate").data("DateTimePicker").clear(),$.ajax({url:doctorDepartmentUrl,type:"get",dataType:"json",data:{id:$(this).val()},success:function(e){$("#doctorId").empty(),$("#doctorId").append($('<option value="">Select Doctor</option>')),$.each(e.data,(function(e,a){$("#doctorId").append($("<option></option>").attr("value",e).text(a))}))}})}));var a,t,o,s,i,r=!1;$("#doctorId").on("change",(function(){r&&($(".error-message").css("display","none"),$("#opdDate").data("DateTimePicker").clear(),r=!0),$(".error-message").css("display","none"),e=$(this).val(),r=!0})),$("#opdDate").on("dp.change",(function(){if($(".doctor-schedule").css("display","none"),$(".error-message").css("display","none"),$(".available-slot-heading").css("display","none"),$(".color-information").css("display","none"),$(".time-slot").remove(),""==$("#departmentId").val())return $("#validationErrorsBox").show().html("Please select Doctor Department"),$("#validationErrorsBox").delay(5e3).fadeOut(),$("#opdDate").val(""),$("#opdDate").data("DateTimePicker").clear(),!1;if(""==$("#doctorId").val())return $("#validationErrorsBox").show().html("Please select Doctor"),$("#validationErrorsBox").delay(5e3).fadeOut(),$("#opdDate").val(""),$("#opdDate").data("DateTimePicker").clear(),!1;var s=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][new Date($(this).val()).getDay()];if(a=$(this).val(),null==s||""==s)return!1;$.ajax({type:"GET",url:doctorScheduleList,data:{day_name:s,doctor_id:e},success:function(e){if(e.success&&""!=e.data)if(0!=e.data.scheduleDay.length){var o=a+" "+e.data.scheduleDay[0].available_from,s=a+" "+e.data.scheduleDay[0].available_to,i=e.data.perPatientTime[0].per_patient_time.split(":"),r=60*+i[0]+ +i[1],n=parseIn(o),d=parseIn(s);if((t=getTimeIntervals(n,d,r)).length>0){var l;$(".available-slot-heading").css("display","block"),$(".color-information").css("display","block");var c="";for(l=0;l<t.length;++l){var p=[{index:l,timeSlot:t[l]}];c+=prepareTemplateRender("#appointmentSlotTemplate",p)}$(".available-slot").append(c)}"00:00:00"!=e.data.scheduleDay[0].available_from&&"00:00:00"!=e.data.scheduleDay[0].available_to&&o!=s?($(".doctor-schedule").css("display","block"),$(".color-information").css("display","block"),$(".day-name").html(e.data.scheduleDay[0].available_on),$(".schedule-time").html("["+e.data.scheduleDay[0].available_from+" - "+e.data.scheduleDay[0].available_to+"]")):($(".doctor-schedule").css("display","none"),$(".color-information").css("display","none"),$(".error-message").css("display","block"),$(".error-message").html("Doctor Schedule not available this date."))}else $(".doctor-schedule").css("display","none"),$(".color-information").css("display","none"),$(".error-message").css("display","block"),$(".error-message").html("Doctor Schedule not available this date.")}}),(isCreate||isEdit)&&setTimeout((function(){if(isCreate)var s={editSelectedDate:a,doctor_id:e};else s={editSelectedDate:a,editId:appointmentEditId,doctor_id:e};$.ajax({url:getBookingSlot,type:"GET",data:s,success:function(e){o=e.data.bookingSlotArr,e.data.hasOwnProperty("onlyTime")?(e.data.bookingSlotArr.length>0&&(i=e.data.onlyTime.toString(),$.each(e.data.bookingSlotArr,(function(e,a){$.each(t,(function(e,t){a==t&&$(".time-interval").each((function(){$(this).data("id")==e&&$(this).html()!=i&&($(this).parent().css({"background-color":"#ffa721",border:"1px solid #ffa721",color:"#ffffff"}),$(this).parent().addClass("booked"),$(this).parent().children().prop("disabled",!0))}))}))}))),$(".time-interval").each((function(){$(this).html()==i&&e.data.bookingSlotArr.length>0&&($(this).parent().addClass("time-slot-book"),$(this).parent().removeClass("booked"),$(this).parent().children().prop("disabled",!1),$(this).click())}))):o.length>0&&$.each(o,(function(e,a){$.each(t,(function(e,t){a==t&&$(".time-interval").each((function(){$(this).data("id")==e&&($(this).parent().addClass("time-slot-book"),$(".time-slot-book").css({"background-color":"#ffa721",border:"1px solid #ffa721",color:"#ffffff"}),$(this).parent().addClass("booked"),$(this).parent().children().prop("disabled",!0))}))}))}))}})}),200)})),isEdit&&($("#doctorId").trigger("change",(function(a){e=$(this).val()})),$("#opdDate").trigger("dp.change",(function(){new Date($(this).val())}))),window.parseIn=function(e){var a=new Date;return a.setHours(e.substring(11,13)),a.setMinutes(e.substring(14,16)),a},window.getTimeIntervals=function(e,a,t){for(var o=[];e<a;)o.push(e.toTimeString().substring(0,5)),e.setMinutes(e.getMinutes()+t);return o},$(document).on("click",".time-interval",(function(e){var a=$(e.currentTarget).data("id");$(this).data("id")==a&&$(this).parent().hasClass("booked")&&$(".time-slot-book").css("background-color","#ffa0a0"),s=$(this).text(),$(".time-slot").removeClass("time-slot-book"),$(this).parent().addClass("time-slot-book")})),$(document).on("click",".time-interval",(function(){i=$(this).text()}));var n=!1;function d(){$("#overlay-screen-lock").addClass("d-none")}$(".new-patient-radio").change((function(){$(this).is(":checked")&&($(".old-patient").addClass("d-none"),$(".first-name-div").removeClass("d-none"),$(".last-name-div").removeClass("d-none"),$(".gender-div").removeClass("d-none"),$(".password-div").removeClass("d-none"),$(".confirm-password-div").removeClass("d-none"),$("#firstName").prop("required",!0),$("#lastName").prop("required",!0),$("#password").prop("required",!0),$("#confirmPassword").prop("required",!0),n=!1)})),$(".old-patient-radio").change((function(){$(this).is(":checked")&&($(".old-patient").removeClass("d-none"),$(".first-name-div").addClass("d-none"),$(".last-name-div").addClass("d-none"),$(".gender-div").addClass("d-none"),$(".password-div").addClass("d-none"),$(".confirm-password-div").addClass("d-none"),$("#firstName").prop("required",!1),$("#lastName").prop("required",!1),$("#password").prop("required",!1),$("#confirmPassword").prop("required",!1),n=!0)})),$(".old-patient-email").focusout((function(){var e=$(".old-patient-email").val();n&&!isEmpty(e)&&$.ajax({url:"appointments/"+e+"/patient-detail",type:"get",success:function(e){null!=e.data?($("#patient").empty(),$.each(e.data,(function(e,a){$("#patientName").val(a),$("#patient").val(e)}))):displayErrorMessage("Patient not exists or status is not active.")}})})),$("#appointmentForm").on("submit",(function(e){if(!(e.preventDefault(),$("#overlay-screen-lock").removeClass("d-none"),n||(a=$("#password").val(),t=$("#confirmPassword").val(),""==a||""==t?(displayErrorMessage("Please fill all the required fields."),0):a===t||(displayErrorMessage("Password and Confirm password not match."),0))))return d(),!1;var a,t;if(null==s||""==s)return displayErrorMessage("Please select appointment time slot"),d(),!1;var o=$(this).serialize()+"&time="+s;$.ajax({url:appointmentSaveUrl,type:"POST",dataType:"json",data:o,success:function(e){d(),displaySuccessMessage(e.message),setTimeout((function(){location.reload()}),4e3)},error:function(e){printErrorMessage("#validationErrorsBox",e),$(".alert").delay(5e3).slideUp(300),d()}})})),$("#reset").click((function(){$(this).closest("#appointmentForm").find("input[type=text], input[type=password], input[type=email], textarea").val(""),$("#patientId, #doctorId, #departmentId").val("").trigger("change.select2")})),$("#firstName, #lastName").keypress((function(e){if(32===e.which)return!1}))}));
7,742
7,742
0.661586
807991daabdcb10b57d80faf45e55b4eff6ab4b7
2,761
js
JavaScript
lib/woocommerce/js/outfitter-woocommerce.js
killermann/huesfitter
527a77a8e034a80cb3b0d4723662e1f1c2a9288a
[ "MIT" ]
null
null
null
lib/woocommerce/js/outfitter-woocommerce.js
killermann/huesfitter
527a77a8e034a80cb3b0d4723662e1f1c2a9288a
[ "MIT" ]
null
null
null
lib/woocommerce/js/outfitter-woocommerce.js
killermann/huesfitter
527a77a8e034a80cb3b0d4723662e1f1c2a9288a
[ "MIT" ]
null
null
null
/** * This script adds the WooCommerce jquery effects to the Outfitter Pro theme. * * @package Outfitter\JS * @author StudioPress * @license GPL-2.0+ */ ( function($) { var $body = $( 'body' ), $content = $( '.off-screen-cart' ), sOpen = false; $(document).ready(function() { // Toggles the off-screen cart content on click. $( document ).on( 'click', '.toggle-off-screen-cart', function() { __toggleOffscreenCartContent(); }); }); // Toggles the off-screen cart content. function __toggleOffscreenCartContent() { if (sOpen) { $content.fadeOut(); $body.toggleClass( 'no-scroll' ); sOpen = false; } else { $content.fadeIn(); $body.toggleClass( 'no-scroll' ); sOpen = true; } } // Toggles second product image. $( 'ul.products li.product-has-gallery' ).hover( function() { $( this ).find( '.wp-post-image' ).removeClass( 'fadeIn' ).addClass( 'fadeOut' ); $( this ).find( '.secondary-image' ).removeClass( 'fadeOut' ).addClass( 'fadeIn' ); }, function() { $( this ).find( '.wp-post-image' ).removeClass( 'fadeOut' ).addClass( 'fadeIn' ); $( this ).find( '.secondary-image' ).removeClass( 'fadeIn' ).addClass( 'fadeOut' ); }); // Show product details on mobile devices. $( '.woocommerce-LoopProduct-link' ).on( 'touchend orientationchange', function (e) { 'use strict'; var link = $(this); if ( link.hasClass( 'hover' ) ) { return true; } else { link.addClass( 'hover' ); link.find( '.wp-post-image' ).removeClass( 'fadeIn' ).addClass( 'fadeOut' ); link.find( '.secondary-image' ).removeClass( 'fadeOut' ).addClass( 'fadeIn' ); $( '.woocommerce-LoopProduct-link' ).not(this).removeClass( 'hover' ); $( '.woocommerce-LoopProduct-link' ).not(this).find( '.wp-post-image' ).removeClass( 'fadeOut' ).addClass( 'fadeIn' ); $( '.woocommerce-LoopProduct-link' ).not(this).find( '.secondary-image' ).removeClass( 'fadeIn' ).addClass( 'fadeOut' ); e.preventDefault(); return false; // Extra, and to make sure the function has consistent return points. } }); // Add Keyboard Accessibility to product focus. $( '.woocommerce ul.products *' ) .focus( function() { $(this).closest( '.product' ).addClass( 'focused' ); $(this).closest( '.product' ).find( '.wp-post-image' ).removeClass( 'fadeIn' ).addClass( 'fadeOut' ); $(this).closest( '.product' ).find( '.secondary-image' ).removeClass( 'fadeOut' ).addClass( 'fadeIn' ); }) .blur( function() { $(this).closest( '.product' ).removeClass( 'focused' ); $(this).closest( '.product' ).find( '.wp-post-image' ).removeClass( 'fadeOut' ).addClass( 'fadeIn' ); $(this).closest( '.product' ).find( '.secondary-image' ).removeClass( 'fadeIn' ).addClass( 'fadeOut' ); }); })(jQuery);
32.869048
123
0.62586
807a20119879ba4b69504fd7551f0291613e0bbd
268
js
JavaScript
src/actions/flights.js
2KHamed/acl-flight-reservation
1ab5508ba1a769c9b68ff9bd6c4d61192b4723b3
[ "MIT" ]
null
null
null
src/actions/flights.js
2KHamed/acl-flight-reservation
1ab5508ba1a769c9b68ff9bd6c4d61192b4723b3
[ "MIT" ]
null
null
null
src/actions/flights.js
2KHamed/acl-flight-reservation
1ab5508ba1a769c9b68ff9bd6c4d61192b4723b3
[ "MIT" ]
1
2021-12-20T00:11:29.000Z
2021-12-20T00:11:29.000Z
import * as api from '../api'; //action creators export const getFlights = () => async (dispatch)=> { try{ const{data} = await api.fetchFlights(); dispatch({type: 'FETCH_ALL',payload: data}); }catch(e){ console.log(e.message); } }
24.363636
53
0.574627
807c1d0bcecd58b5129fb2260f81a5f4773a0f5b
315
js
JavaScript
fuzzer_output/interesting/sample_1554095208042.js
patil215/v8
bb941b58df9ee1e4048b69a555a2ce819fb819ed
[ "BSD-3-Clause" ]
null
null
null
fuzzer_output/interesting/sample_1554095208042.js
patil215/v8
bb941b58df9ee1e4048b69a555a2ce819fb819ed
[ "BSD-3-Clause" ]
null
null
null
fuzzer_output/interesting/sample_1554095208042.js
patil215/v8
bb941b58df9ee1e4048b69a555a2ce819fb819ed
[ "BSD-3-Clause" ]
null
null
null
function main() { let v18 = 0; const v19 = v18 + 1; v18 = v19; const v26 = [1337,1337,1337,1337]; const v27 = [13.37]; const v28 = {parseInt:v26,fill:RegExp,length:"fromEntries",acos:"fromEntries"}; const v29 = {MIN_VALUE:"fromEntries",multiline:v28}; const v30 = v29 * v27; } %NeverOptimizeFunction(main); main();
24.230769
79
0.688889
807cb148f517a881c829a619700771bc46d4e987
1,349
js
JavaScript
tc/src/tc/js/contact.js
miriam-samuels/TasteClan
5d3fb5ad15e03f6ceedb9d2f78ea7b76c2eafbf9
[ "MIT" ]
1
2020-08-23T23:38:06.000Z
2020-08-23T23:38:06.000Z
tc/src/tc/js/contact.js
miriam-samuels/TasteClan
5d3fb5ad15e03f6ceedb9d2f78ea7b76c2eafbf9
[ "MIT" ]
null
null
null
tc/src/tc/js/contact.js
miriam-samuels/TasteClan
5d3fb5ad15e03f6ceedb9d2f78ea7b76c2eafbf9
[ "MIT" ]
null
null
null
import React from 'react' import Menubar from './menubar'; import Credits from './footer'; function contact() { return ( <div > <Menubar/> <div className="contact"> <div className="getintouch"> <h3>Get in Touch</h3> <p>Call us</p> <b>090xxxxxxxxxx, 080xxxxxxxxx, 081xxxxxxxxxxx, 070xxxxxxxxxx</b> <p>Email Us</p> <b>info.tasteclan@gmail.com</b><br/> <b>tasteclan@gmail.com</b> <p>Address</p> <b>blah blah blah blah blah blah blah blah blah blah blah blah </b> </div> <div className="msg"> <form> <label htmlFor="name">Name</label><br/> <input type="text" placeholder="enter your name" id="name"/> <br/> <label htmlFor="email">Email Address</label><br/> <input type="email" placeholder="enter your email address" id="email" /> <br/><label htmlFor="msg">Your Message</label><br/> <textarea placeholder="enter your message" rows="17" id="msg"></textarea> <button type="submit"> Submit</button> </form> </div> </div> <Credits/> </div> ) } export default contact
35.5
93
0.49444
807de5328a6d4f9324cd273eece03153f32696ad
1,708
js
JavaScript
public/javascripts/detail.js
superpower1/Movie_search_App
f9f5c90faaf69b9a3fa75b94a0c945c249e02ae0
[ "MIT" ]
2
2018-01-29T23:52:34.000Z
2018-02-01T21:53:45.000Z
public/javascripts/detail.js
superpower1/Movie_search_App
f9f5c90faaf69b9a3fa75b94a0c945c249e02ae0
[ "MIT" ]
null
null
null
public/javascripts/detail.js
superpower1/Movie_search_App
f9f5c90faaf69b9a3fa75b94a0c945c249e02ae0
[ "MIT" ]
null
null
null
const userId = $('main.container')[0].dataset.userId; const movieId = $('main.container')[0].dataset.movieId; $("#like-btn").click(function(){ $.ajax({ url:"/session", success: function(response){ const result = $.parseJSON(response); console.log(result.login); if (result.login) { sendRequest("/like"); if ($('#like-btn>i').hasClass('fa-heart')) { $('#like-btn>i').removeClass('fa-heart').addClass('fa-heart-o'); } else { $('#like-btn>i').removeClass('fa-heart-o').addClass('fa-heart'); } } else { showAlert(); } } }); }); $("#save-btn").click(function(){ $.ajax({ url:"/session", success: function(response){ const result = $.parseJSON(response); console.log(result.login); if (result.login) { sendRequest("/save"); if ($('#save-btn>i').hasClass('fa-bookmark')) { $('#save-btn>i').removeClass('fa-bookmark').addClass('fa-bookmark-o'); } else { $('#save-btn>i').removeClass('fa-bookmark-o').addClass('fa-bookmark'); } } else { showAlert(); } } }); }); $("#share-btn").click(function(){ }); $('.popup-close').click(function(e) { $('.popup-wrap').fadeOut(500); $('.popup-box').removeClass('transform-in').addClass('transform-out'); e.preventDefault(); }); showAlert = () => { $('.popup-wrap').fadeIn(250); $('.popup-box').removeClass('transform-out').addClass('transform-in'); } sendRequest = (url) => { $.ajax ({ type: "POST", url: url, data: {user_id: userId, movie_id: movieId}, success: function(response){ console.log(response); } }); }
24.753623
80
0.540984
807e5fb19310c93f7dab96c9081d906856bb321a
903
js
JavaScript
scripts/seedDB.js
seattletrade/richtrader
64b2194d199fbfc5aa41109f147e6a0800bfe97b
[ "MIT" ]
null
null
null
scripts/seedDB.js
seattletrade/richtrader
64b2194d199fbfc5aa41109f147e6a0800bfe97b
[ "MIT" ]
82
2021-02-06T20:42:20.000Z
2021-02-26T22:17:14.000Z
scripts/seedDB.js
congmul/gamestock-ver02
d6733781b26833f38dc0d7d07a2c35d336638b1d
[ "MIT" ]
1
2021-05-15T04:35:36.000Z
2021-05-15T04:35:36.000Z
const mongoose = require("mongoose"); const db = require("../models"); // This file empties the Books collection and inserts the books below mongoose.connect( process.env.MONGODB_URI || "mongodb://localhost/gamestock" ); const stockSeed = [ { user_email: "olya@test.com" , amount: 4 ,/// Schema.Types.Decimal128 symbol: "MSFT", price_initial: 100.00 }, { user_email: "olya@test.com" , amount: 2 ,/// Schema.Types.Decimal128 symbol: "AMZN", price_initial: 115.00 }, { user_email: "dima@test.com" , amount: 1 ,/// Schema.Types.Decimal128 symbol: "FB", price_initial: 250.00 }, ]; db.Stock .remove({}) .then(() => db.Stock.collection.insertMany(stockSeed)) .then(data => { console.log(data.result.n + " records inserted!"); process.exit(0); }) .catch(err => { console.error(err); process.exit(1); });
21
69
0.611296
807f1739dca4108216f0084d23e81c1bec604cd9
337
js
JavaScript
pilotly-coding-challenge/imports/ui/components/AddressForm/CoordinateInputs/styles.js
NGilreath0143/Pilotly-Coding-Challenge
4ed3f13350a367181c1cf44ebe752bf7b2edcf9c
[ "MIT" ]
null
null
null
pilotly-coding-challenge/imports/ui/components/AddressForm/CoordinateInputs/styles.js
NGilreath0143/Pilotly-Coding-Challenge
4ed3f13350a367181c1cf44ebe752bf7b2edcf9c
[ "MIT" ]
null
null
null
pilotly-coding-challenge/imports/ui/components/AddressForm/CoordinateInputs/styles.js
NGilreath0143/Pilotly-Coding-Challenge
4ed3f13350a367181c1cf44ebe752bf7b2edcf9c
[ "MIT" ]
null
null
null
import styled from "styled-components"; import { InputField } from '../styles'; export const CoordinateInputField = styled(InputField)` width: 156px; `; export const LatitudeInputField = styled(CoordinateInputField)` margin-left: 20px `; export const LongitudeInputField = styled(CoordinateInputField)` margin-left: 8px `;
24.071429
64
0.750742
807f2e9802e2ac8a5b583b25b4649d488949d74f
1,709
js
JavaScript
src/containers/Player.js
alvlinarez/videos
bcedff87b672c745f25102331309ee68f65b0c5e
[ "ISC" ]
null
null
null
src/containers/Player.js
alvlinarez/videos
bcedff87b672c745f25102331309ee68f65b0c5e
[ "ISC" ]
null
null
null
src/containers/Player.js
alvlinarez/videos
bcedff87b672c745f25102331309ee68f65b0c5e
[ "ISC" ]
null
null
null
import React, { useLayoutEffect, useState } from 'react'; import NotFound from './NotFound'; import '../assets/styles/components/Player.scss'; import { useDispatch, useSelector } from 'react-redux'; import { getPlayingMovieAction } from '../actions/moviesActions'; import Spinner from '../components/Spinner'; const Player = (props) => { const { id } = props.match.params; const dispatch = useDispatch(); const playing = useSelector((state) => state.movies.playing); // get movie loader from api const loading = useSelector((state) => state.movies.loading); // if movie exists or not const hasPlaying = Object.keys(playing).length > 0; // if movie is fully loaded loader const [movieLoading, setMovieLoading] = useState(true); useLayoutEffect(() => { dispatch(getPlayingMovieAction(id)); }, []); const handleBackButton = () => { props.history.goBack(); }; if (loading) { return ( <div className="player-spinner__container"> <Spinner /> </div> ); } return hasPlaying ? ( <> {movieLoading && ( <div className="player-spinner__container"> <Spinner /> </div> )} <div className="Player"> <video style={{ display: `${movieLoading ? 'none' : 'block'}` }} key={playing.source} src={playing.source} controls autoPlay onLoadedData={() => { setMovieLoading(false); }} /> <div className="Player-back"> <button type="button" onClick={handleBackButton}> Back </button> </div> </div> </> ) : ( <NotFound /> ); }; export default Player;
25.132353
67
0.583382
807f5a510b56e4c266e67e727dfad6cb13ca5d8f
2,280
js
JavaScript
optimal-price/src/components/UserLogin.js
bw-ft-airbnb-1/front-end
33b07ffacca0298e0a33a951483fbed79cf28b8d
[ "MIT" ]
null
null
null
optimal-price/src/components/UserLogin.js
bw-ft-airbnb-1/front-end
33b07ffacca0298e0a33a951483fbed79cf28b8d
[ "MIT" ]
2
2021-03-10T04:00:30.000Z
2022-02-26T22:10:57.000Z
optimal-price/src/components/UserLogin.js
bw-ft-airbnb-1/front-end
33b07ffacca0298e0a33a951483fbed79cf28b8d
[ "MIT" ]
null
null
null
import React, { useEffect, useContext } from 'react'; import { Jumbotron, Button } from 'reactstrap'; import { Field, Form, withFormik } from 'formik'; import * as Yup from 'yup'; import axios from 'axios'; import './UserLogin.css'; import Context from './../contexts/loginContext'; const UserLogin = ({values, errors, touched, status, handleSubmit,handleChange}) => { const {user, setUser} = useContext(Context); useEffect(() => { status && setUser(user => status) }) return( <div className="LoginForm"> <Jumbotron className="jumbotron"> <Form onSubmit = {handleSubmit}> <label htmlFor="email"> Email: <Field id="email" type="email" name="email" onChange = {handleChange} /> {touched.email && errors.email && (<p> {errors.email} </p>)} </label> <label htmlFor="password"> Password: <Field id="password" type="password" name="password" onChange = {handleChange} /> {touched.password && errors.password && (<p> {errors.password} </p>)} </label> <Button type="submit">Login</Button> </Form> </Jumbotron> </div> ) } const FormikUserLogin = withFormik({ mapPropsToValues({ email, password}) { return { email: email || '', password: password || '' } }, validationSchema: Yup.object().shape({ email: Yup.string() .email("Please enter a valid email address.") .required("This is a requird field."), password: Yup.string() .min(4) .required("This is a required field.") }), // history: useHistory(), handleSubmit (values, { props, setStatus}) { axios.post(`https://bw-ft-airbnb-1.herokuapp.com/api/v1/user/signin `, values) .then((response)=> { localStorage.setItem('token', response.data.token) setStatus(response.data.user); props.history.push('/dashboard'); }) .catch((error)=> { console.log("This is an async error:", error) }) } })(UserLogin) export default FormikUserLogin;
21.509434
85
0.542105
807f6e7475235e9dec19b104bd6e7d07ebd71b42
20,595
js
JavaScript
screens/main/StatisticsView.js
geonsangyoo/dailybear
69fd9ac046bb9edb146fea40e879bf5673ae054f
[ "MIT" ]
3
2022-01-08T15:27:47.000Z
2022-02-24T13:20:57.000Z
screens/main/StatisticsView.js
geonsangyoo/dailybear
69fd9ac046bb9edb146fea40e879bf5673ae054f
[ "MIT" ]
1
2022-01-09T05:39:15.000Z
2022-01-09T05:39:34.000Z
screens/main/StatisticsView.js
geonsangyoo/dailybear
69fd9ac046bb9edb146fea40e879bf5673ae054f
[ "MIT" ]
null
null
null
/* eslint-disable no-shadow */ /* eslint-disable radix */ /* eslint-disable react-native/no-inline-styles */ // Standard import React, {useState, useEffect, useRef, useCallback} from 'react'; import { View, StyleSheet, Text, StatusBar, Image, Animated, Dimensions, } from 'react-native'; import {useSelector, useDispatch} from 'react-redux'; import {SafeAreaView} from 'react-native-safe-area-context'; // Custom import Background from '../../components/layout/Background'; import Header from '../../components/layout/Header'; import Footer from '../../components/layout/Footer'; import * as calendarActions from '../../store/actions/Calendar'; import * as diaryActions from '../../store/actions/Diary'; import * as sayingActions from '../../store/actions/Saying'; import * as funcs from '../../helpers/funcs'; import * as calendarConsts from '../../constants/Calendar'; import SettingConstants from '../../constants/Setting'; import sayingConsts from '../../constants/Saying'; import Diary from '../../constants/Diary'; import Statistics from '../../constants/Statistics'; import Colors from '../../constants/Colors'; const marginFromTopVerticalRatio = calendarConsts.marginFromTopVerticalRatio; const StatisticsView = (props) => { // Statistic View Rendering const isDate = useSelector((state) => state.calendar.activeDate); const saying = useSelector((state) => state.saying.saying); const mode = useSelector((state) => state.saying.mode); const emotions = useSelector((state) => state.calendar.emotions); const fontNameSetting = useSelector((state) => state.settings.fontName); const maxDays = funcs.getMaxDays(isDate.getFullYear(), isDate.getMonth()); const [numberOfEmotions, setNumberOfEmotions] = useState([]); const [numberOfEmotionsSorted, setNumberOfEmotionsSorted] = useState([]); const [emotionLocation, setEmotionLocation] = useState([]); const [emotionDisplayed, setEmotionDisplayed] = useState(false); const dispatch = useDispatch(); // Animation const animationDelay = 80; const animationThreshold = Dimensions.get('screen').height / calendarConsts.animationThresholdRatio; const scrollY = useRef(new Animated.Value(0)).current; const yPositionMin = Dimensions.get('screen').height * -1; const yPositionMax = Dimensions.get('screen').height; const yPositionInit = new Animated.Value(0); useEffect(() => { let locRandom = [ Diary.emotionTitle.ANGRY, Diary.emotionTitle.CALM, Diary.emotionTitle.LOVELY, Diary.emotionTitle.GLOOMY, Diary.emotionTitle.SAD, Diary.emotionTitle.MELANCHOLY, ]; let res = []; if (numberOfEmotionsSorted.length > 0 && !emotionDisplayed) { locRandom.sort((x) => Math.random() - 0.5); for (let val in Diary.emotionTitle) { if (val === 'NONE') { continue; } let number = numberOfEmotions[Diary.emotionTitle[val]]; let top, left, width, height; // Decide where emotion figure is located top = Math.floor( locRandom.indexOf(Diary.emotionTitle[val]) * Statistics.emotionHeightRange, ); left = Math.floor(Math.random() * Statistics.emotionWidthRange); // Decide how big the scale of emotion figure is if ( Statistics.emotionSize.size1_min_number <= number && number <= Statistics.emotionSize.size1_max_number ) { width = Statistics.emotionSize.size1_width; height = Statistics.emotionSize.size1_height; } else if ( Statistics.emotionSize.size2_min_number <= number && number <= Statistics.emotionSize.size2_max_number ) { width = Statistics.emotionSize.size2_width; height = Statistics.emotionSize.size2_height; } else if ( Statistics.emotionSize.size3_min_number <= number && number <= Statistics.emotionSize.size3_max_number ) { width = Statistics.emotionSize.size3_width; height = Statistics.emotionSize.size3_height; } else if ( Statistics.emotionSize.size4_min_number <= number && number <= maxDays ) { width = Statistics.emotionSize.size4_width; height = Statistics.emotionSize.size4_height; } else { // No day is assigned width = 0; height = 0; } res.push({ top: top, left: left, width: width, height: height, }); } setEmotionLocation(res); setEmotionDisplayed(true); } }, [ emotionDisplayed, maxDays, numberOfEmotions, numberOfEmotionsSorted.length, ]); useEffect(() => { // Set number of emotions let angry = 0; let calm = 0; let lovely = 0; let gloomy = 0; let sad = 0; let melancholy = 0; let result; let resultArr; for (let i = 0; i < emotions.length; i++) { switch (emotions[i].emotion) { case Diary.emotionTitle.ANGRY: angry++; break; case Diary.emotionTitle.CALM: calm++; break; case Diary.emotionTitle.LOVELY: lovely++; break; case Diary.emotionTitle.GLOOMY: gloomy++; break; case Diary.emotionTitle.SAD: sad++; break; case Diary.emotionTitle.MELANCHOLY: melancholy++; break; default: break; } } result = [ { name: 'angry', number: angry, rank: -1, }, { name: 'calm', number: calm, rank: -1, }, { name: 'lovely', number: lovely, rank: -1, }, { name: 'gloomy', number: gloomy, rank: -1, }, { name: 'sad', number: sad, rank: -1, }, { name: 'melancholy', number: melancholy, rank: -1, }, ]; resultArr = JSON.parse(JSON.stringify(result)); resultArr.sort((obj1, obj2) => { return obj1.number - obj2.number; }); for (let i = resultArr.length - 1; i >= 0; i--) { if (i === resultArr.length - 1) { resultArr[i].rank = 1; } if (i < resultArr.length - 1) { if (resultArr[i].number === resultArr[i + 1].number) { resultArr[i].rank = resultArr[i + 1].rank; } else { resultArr[i].rank = resultArr[i + 1].rank + 1; } } } setNumberOfEmotionsSorted(resultArr); setNumberOfEmotions(result.map((obj) => obj.number)); }, [emotions]); useEffect(() => { mode === sayingConsts.randomMode && saying === '' ? dispatch( sayingActions.loadSayingFromOuter( isDate.getFullYear(), parseInt(isDate.getMonth()) + 1, ), ) : dispatch( sayingActions.loadSaying( isDate.getFullYear(), parseInt(isDate.getMonth()) + 1, ), ); }, [dispatch, isDate, mode, saying]); const diaryHandler = (year, month, date, day, emotion) => { dispatch(diaryActions.loadDiary(year, month, date, day)); if (emotion !== -1) { dispatch(calendarActions.setIsDiaryDetailed(true)); props.navigation.navigate('CalendarView'); } else { props.navigation.navigate('DiaryIntro'); } }; // const getEmotionRank = (emotionTitle) => { // let rank; // if (numberOfEmotionsSorted.length > 0) { // numberOfEmotionsSorted.forEach((val) => { // if (val.name === emotionTitle) { // rank = val.rank; // } // }); // } else { // rank = 1; // } // return rank; // }; const loadHandler = useCallback( (isDate) => { dispatch(calendarActions.setActiveDate(isDate)); }, [dispatch], ); const swipeUpAnimationAfter = () => { isDate.setMonth(isDate.getMonth() + 1); loadHandler(new Date(+isDate)); setEmotionDisplayed(false); scrollY.setValue(yPositionMax); Animated.spring(scrollY, { toValue: yPositionInit, speed: 20, bounciness: 2, useNativeDriver: true, }).start(); }; const swipeDownAnimationAfter = () => { isDate.setMonth(isDate.getMonth() - 1); loadHandler(new Date(+isDate)); setEmotionDisplayed(false); scrollY.setValue(yPositionMin); Animated.spring(scrollY, { toValue: yPositionInit, speed: 20, bounciness: 2, useNativeDriver: true, }).start(); }; return ( <View style={{flex: 1}}> <Background style={styles.container}> <SafeAreaView style={styles.container}> <View style={styles.mainContentContainer}> <Animated.ScrollView style={{transform: [{translateY: scrollY}]}} onScrollEndDrag={Animated.event( [{nativeEvent: {contentOffset: {y: scrollY}}}], { listener: (event) => { if ( event.nativeEvent.contentOffset.y > animationThreshold ) { scrollY.setValue(-1 * event.nativeEvent.contentOffset.y); Animated.spring(scrollY, { toValue: yPositionMin, speed: 20, bounciness: 2, useNativeDriver: true, }).start(); setTimeout(() => { scrollY.stopAnimation(swipeUpAnimationAfter); }, animationDelay); } else if ( event.nativeEvent.contentOffset.y < -1 * animationThreshold ) { scrollY.setValue(-1 * event.nativeEvent.contentOffset.y); Animated.spring(scrollY, { toValue: yPositionMax, speed: 20, bounciness: 2, useNativeDriver: true, }).start(); setTimeout(() => { scrollY.stopAnimation(swipeDownAnimationAfter); }, animationDelay); } else { // Back to the starting coord. scrollY.setValue(0); } }, useNativeDriver: true, }, )} scrollEventThrottle={1}> <StatusBar barStyle="dark-content" backgroundColor="transparent" translucent={true} /> <Header getDate={isDate} parentProps={props} saying={saying} mode={mode} /> <View style={styles.emotionNumberContainer}> <View style={styles.emotionNumberItem}> <View style={{ ...styles.emotionOvalShape, backgroundColor: Colors.EmotionOvalShape_angry, }} /> <Text style={{ ...styles.emotionNumberText, fontFamily: fontNameSetting ? fontNameSetting : SettingConstants.defaultFont, }}> {numberOfEmotions[Diary.emotionTitle.ANGRY]} </Text> </View> <View style={styles.emotionNumberItem}> <View style={{ ...styles.emotionOvalShape, backgroundColor: Colors.EmotionOvalShape_calm, }} /> <Text style={{ ...styles.emotionNumberText, fontFamily: fontNameSetting ? fontNameSetting : SettingConstants.defaultFont, }}> {numberOfEmotions[Diary.emotionTitle.CALM]} </Text> </View> <View style={styles.emotionNumberItem}> <View style={{ ...styles.emotionOvalShape, backgroundColor: Colors.EmotionOvalShape_lovely, }} /> <Text style={{ ...styles.emotionNumberText, fontFamily: fontNameSetting ? fontNameSetting : SettingConstants.defaultFont, }}> {numberOfEmotions[Diary.emotionTitle.LOVELY]} </Text> </View> <View style={styles.emotionNumberItem}> <View style={{ ...styles.emotionOvalShape, backgroundColor: Colors.EmotionOvalShape_gloomy, }} /> <Text style={{ ...styles.emotionNumberText, fontFamily: fontNameSetting ? fontNameSetting : SettingConstants.defaultFont, }}> {numberOfEmotions[Diary.emotionTitle.GLOOMY]} </Text> </View> <View style={styles.emotionNumberItem}> <View style={{ ...styles.emotionOvalShape, backgroundColor: Colors.EmotionOvalShape_sad, }} /> <Text style={{ ...styles.emotionNumberText, fontFamily: fontNameSetting ? fontNameSetting : SettingConstants.defaultFont, }}> {numberOfEmotions[Diary.emotionTitle.SAD]} </Text> </View> <View style={styles.emotionNumberItem}> <View style={{ ...styles.emotionOvalShape, backgroundColor: Colors.EmotionOvalShape_melancholy, }} /> <Text style={{ ...styles.emotionNumberText, fontFamily: fontNameSetting ? fontNameSetting : SettingConstants.defaultFont, }}> {numberOfEmotions[Diary.emotionTitle.MELANCHOLY]} </Text> </View> </View> {emotionLocation.length > 0 ? ( <View style={styles.imageContainer}> {numberOfEmotions[Diary.emotionTitle.ANGRY] > 0 ? ( <Image style={{ ...styles.image, top: emotionLocation[Diary.emotionTitle.ANGRY].top, left: emotionLocation[Diary.emotionTitle.ANGRY].left, width: emotionLocation[Diary.emotionTitle.ANGRY].width, height: emotionLocation[Diary.emotionTitle.ANGRY].height, }} source={ Diary.emotionBears[Diary.emotionTitle.ANGRY].imgPath } /> ) : null} {numberOfEmotions[Diary.emotionTitle.CALM] > 0 ? ( <Image style={{ ...styles.image, top: emotionLocation[Diary.emotionTitle.CALM].top, left: emotionLocation[Diary.emotionTitle.CALM].left, width: emotionLocation[Diary.emotionTitle.CALM].width, height: emotionLocation[Diary.emotionTitle.CALM].height, }} source={ Diary.emotionBears[Diary.emotionTitle.CALM].imgPath } /> ) : null} {numberOfEmotions[Diary.emotionTitle.LOVELY] > 0 ? ( <Image style={{ ...styles.image, top: emotionLocation[Diary.emotionTitle.LOVELY].top, left: emotionLocation[Diary.emotionTitle.LOVELY].left, width: emotionLocation[Diary.emotionTitle.LOVELY].width, height: emotionLocation[Diary.emotionTitle.LOVELY].height, }} source={ Diary.emotionBears[Diary.emotionTitle.LOVELY].imgPath } /> ) : null} {numberOfEmotions[Diary.emotionTitle.GLOOMY] > 0 ? ( <Image style={{ ...styles.image, top: emotionLocation[Diary.emotionTitle.GLOOMY].top, left: emotionLocation[Diary.emotionTitle.GLOOMY].left, width: emotionLocation[Diary.emotionTitle.GLOOMY].width, height: emotionLocation[Diary.emotionTitle.GLOOMY].height, }} source={ Diary.emotionBears[Diary.emotionTitle.GLOOMY].imgPath } /> ) : null} {numberOfEmotions[Diary.emotionTitle.SAD] > 0 ? ( <Image style={{ ...styles.image, top: emotionLocation[Diary.emotionTitle.SAD].top, left: emotionLocation[Diary.emotionTitle.SAD].left, width: emotionLocation[Diary.emotionTitle.SAD].width, height: emotionLocation[Diary.emotionTitle.SAD].height, }} source={ Diary.emotionBears[Diary.emotionTitle.SAD].imgPath } /> ) : null} {numberOfEmotions[Diary.emotionTitle.MELANCHOLY] > 0 ? ( <Image style={{ ...styles.image, top: emotionLocation[Diary.emotionTitle.MELANCHOLY].top, left: emotionLocation[Diary.emotionTitle.MELANCHOLY] .left, width: emotionLocation[Diary.emotionTitle.MELANCHOLY].width, height: emotionLocation[Diary.emotionTitle.MELANCHOLY].height, }} source={ Diary.emotionBears[Diary.emotionTitle.MELANCHOLY] .imgPath } /> ) : null} </View> ) : null} </Animated.ScrollView> </View> <Footer parentProps={props} parent={this} diaryHandler={diaryHandler} /> </SafeAreaView> </Background> </View> ); }; const styles = StyleSheet.create({ container: { flex: 1, overflow: 'hidden', }, mainContentContainer: { top: Dimensions.get('window').height / marginFromTopVerticalRatio, height: '80%', }, emotionNumberContainer: { flexDirection: 'column', marginLeft: '8%', marginTop: '20%', }, emotionNumberItem: { flexDirection: 'row', marginVertical: 12, }, emotionOvalShape: { width: 16, height: 16, borderRadius: 8, marginTop: 1, }, emotionNumberText: { fontStyle: 'normal', fontWeight: '400', marginLeft: 8, fontSize: 15, color: Colors.HeaderTitle_gray, }, imageContainer: { position: 'absolute', top: '50%', left: '30%', }, image: { position: 'absolute', width: 66, height: 60, margin: 20, }, }); export default StatisticsView;
34.041322
80
0.489148
80825cd8ed4187a2b1920af37b02582922adc8a8
314
js
JavaScript
.storybook/leaflet-react-theme.js
chickencoding123/leaflet-react-fibers
a983071072f1433a344db19a837b805f88d586c3
[ "MIT" ]
1
2022-01-12T11:04:47.000Z
2022-01-12T11:04:47.000Z
.storybook/leaflet-react-theme.js
IRoninCoder/leaflet-react-fibers
a983071072f1433a344db19a837b805f88d586c3
[ "MIT" ]
null
null
null
.storybook/leaflet-react-theme.js
IRoninCoder/leaflet-react-fibers
a983071072f1433a344db19a837b805f88d586c3
[ "MIT" ]
null
null
null
import { create } from '@storybook/theming'; let base = 'light' if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) { base = 'dark' } export default create({ base, brandTitle: 'leaflet-react-fibers', brandUrl: 'https://github.com/chickencoding123/leaflet-react-fibers' });
26.166667
85
0.707006
8084158017a90e5d341987d60f9f27acdf351dd2
44
js
JavaScript
tests/tsc-references/types/tuple/tupleElementTypes3/input.ts/es5.2.minified/output.js
swc-project/swc
d83bde8ca5be3536632a51c9143f414879aeaf13
[ "Apache-2.0", "MIT" ]
21,008
2017-04-01T04:06:55.000Z
2022-03-31T23:11:05.000Z
tests/tsc-references/types/tuple/tupleElementTypes3/input.ts/es5.2.minified/output.js
dsherret/swc
bf886bac73ad348ab7bc333e6eae824c96e9abde
[ "Apache-2.0", "MIT" ]
2,309
2018-01-14T05:54:44.000Z
2022-03-31T15:48:40.000Z
tests/tsc-references/types/tuple/tupleElementTypes3/input.ts/es5.2.minified/output.js
dsherret/swc
bf886bac73ad348ab7bc333e6eae824c96e9abde
[ "Apache-2.0", "MIT" ]
768
2018-01-14T05:15:43.000Z
2022-03-30T11:29:42.000Z
var ref = [ 0, void 0]; ref[0], ref[1];
11
15
0.454545
8084a944845d0c6474e22c535b491c3a97d1a302
1,067
js
JavaScript
node_modules/thinkjs/src/middleware/csrf.js
hwdpaley/ketang
9f726276662154a898d3fca6421f896276bd8d3a
[ "MIT" ]
null
null
null
node_modules/thinkjs/src/middleware/csrf.js
hwdpaley/ketang
9f726276662154a898d3fca6421f896276bd8d3a
[ "MIT" ]
null
null
null
node_modules/thinkjs/src/middleware/csrf.js
hwdpaley/ketang
9f726276662154a898d3fca6421f896276bd8d3a
[ "MIT" ]
null
null
null
'use strict'; /** * check csrf * @type {} */ export default class extends think.middleware.base { /** * run * @return {Promise} [] */ async run() { let csrf = this.config('csrf'); think.session(this.http); let session = this.http._session; let isGet = this.http.isGet(); let isPost = this.http.isPost(); let isAjax = this.http.isAjax(); let isJsonp = this.http.isJsonp(); if (isGet && !isAjax && !isJsonp) { let value = await session.get(csrf.session_name); if (!value) { value = think.uuid(32); await session.set(csrf.session_name, value); } this.http.view().assign(csrf.form_name, value); } else if (isPost || isAjax || isJsonp) { let value = await session.get(csrf.session_name); let formValue = this.http[isPost ? 'post' : 'param'](csrf.form_name); if(!formValue){ formValue = this.http.header('x-' + csrf.form_name); } if (!value || formValue !== value) { return this.http.fail(csrf.errno, csrf.errmsg); } } } }
28.078947
75
0.582006
80858324d8a2bb13450275fc87c41e63edfb05d5
350
js
JavaScript
src/store/reducers/SurahReducer.js
hgareeballa/quran
03d5f8e1383f3d396e81b2e46f788f6274637618
[ "MIT" ]
10
2020-01-14T07:53:42.000Z
2021-09-26T16:39:53.000Z
src/store/reducers/SurahReducer.js
hgareeballa/quran
03d5f8e1383f3d396e81b2e46f788f6274637618
[ "MIT" ]
1
2020-01-22T11:46:18.000Z
2020-01-29T09:26:00.000Z
src/store/reducers/SurahReducer.js
hgareeballa/quran
03d5f8e1383f3d396e81b2e46f788f6274637618
[ "MIT" ]
10
2020-01-18T18:29:41.000Z
2022-02-05T22:51:06.000Z
const initialState = { surah: 1 }; const SurahReducer = (state = initialState, action) => { // console.log("reducerSurah", state); // console.log("ActionSurah", action); switch (action.type) { case "SURAH": return { surah: action.surah }; default: return state; } }; export default SurahReducer;
17.5
56
0.591429
8085f724325f6432bd94bc23bf55f24430714a76
963
js
JavaScript
src/node/domain/marubatsu/usecases/InputMaruBatsu.js
inocop/marubatsu-vr
cc2f50a64fd156a255701a3bb5845a8f0e1f4e51
[ "MIT" ]
null
null
null
src/node/domain/marubatsu/usecases/InputMaruBatsu.js
inocop/marubatsu-vr
cc2f50a64fd156a255701a3bb5845a8f0e1f4e51
[ "MIT" ]
6
2021-03-09T02:48:05.000Z
2022-02-26T10:28:02.000Z
src/node/domain/marubatsu/usecases/InputMaruBatsu.js
inocop/marubatsu-vr
cc2f50a64fd156a255701a3bb5845a8f0e1f4e51
[ "MIT" ]
null
null
null
const Room = require('../entities/Room') module.exports = class InputMaruBatsu { constructor(room, socketId, data) { if (!(room instanceof Room)) { throw new TypeError() } this.room = room this.socketId = socketId this.data = data } exec() { return new Promise((resolve, reject) => { if (!this._validateInput()) { return } if (this.room.setPlayData(this.socketId, this.data)) { resolve() } }) } _validateInput() { // 2人いる状態でないと入力不可 if (!(this.room.player1 && this.room.player2)){ return false } // socketIdがplayer1 or player2と一致すること //if (![this.player1, this.player2].filter(p => p != null).includes(socketId)) if (!(this.socketId === this.room.player1 || this.socketId === this.room.player2)) { return false } // 連続での入力不可 if (this.room.lastInputPlayer === this.socketId) { return false } return true } }
20.489362
88
0.584631
8087d2e44357a479920069d6971ee30d9eb88aac
4,328
js
JavaScript
app/reducers/interaction.js
experimentalDataAesthetics/play-splom
dbc577db215ca6c8d5e669190a60869cfe55876b
[ "MIT" ]
22
2016-04-27T14:23:40.000Z
2022-02-22T06:46:12.000Z
app/reducers/interaction.js
experimentalDataAesthetics/play-splom
dbc577db215ca6c8d5e669190a60869cfe55876b
[ "MIT" ]
53
2016-06-27T13:49:36.000Z
2022-03-25T18:45:33.000Z
app/reducers/interaction.js
experimentalDataAesthetics/play-splom
dbc577db215ca6c8d5e669190a60869cfe55876b
[ "MIT" ]
2
2017-08-01T02:45:20.000Z
2020-01-31T17:22:04.000Z
import u from 'updeep'; import { xor, get } from 'lodash'; import { calcPointsEntering } from '../selectors/index'; const DEFAULT_LOOP_TIME = 10; export default { loopMode: { timeDimension: null } }; /** * setPointsUnderBrush - Action triggered by mouse move, * sets the current points inside the brush rectangle. * * @param {Object} state current state * @param {Object} action payload is {m n indices} * @return {Object} new state */ export function setPointsUnderBrush(state, action) { const differentBox = state.m !== action.payload.m || state.n !== action.payload.n; if ( differentBox || xor(state.pointsUnderBrush || [], action.payload.indices || []).length !== 0 ) { const prevPub = state.pointsUnderBrush || []; const pub = action.payload.indices || []; return u( { previousPointsUnderBrush: prevPub, pointsUnderBrush: pub, m: action.payload.m, n: action.payload.n, pointsEntering: calcPointsEntering(pub, prevPub) }, state ); } return state; } /** * _sameBox - is payload.m/n the same box as state.loopMode[key].m/n ? * * @param {Object} state current state * @param {Object} action payload is {m n indices} * @param {string} key='box' which key in current state to compare it to * @return {Boolean} the answer */ function _sameBox(state, payload, key = 'box') { if (get(state, `loopMode.${key}`)) { const m = get(state, `loopMode.${key}.m`); const n = get(state, `loopMode.${key}.n`); return m && n && m === payload.m && n === payload.n; } } /** * setLoopBox - toggles the SoundApp's loop mode on or off * * Updates state.interaction.loopMode * * If not currently looping then it starts looping that m@n box. * If you click on a different box then it changes the loop to that. * If you click on the currently playing box then it stops looping. * * @param {Object} state current state * @param {Object} action .payload is {m n} * @return {Object} new state */ export function setLoopBox(state, action) { const loopMode = { loopTime: get(state, 'loopMode.loopTime') || DEFAULT_LOOP_TIME }; // clicked the same box, toggle it to off if (_sameBox(state, action.payload, 'box')) { loopMode.lastBox = get(state, 'loopMode.box'); loopMode.box = null; loopMode.epoch = null; } else { loopMode.box = action.payload; // if not already playing then start the loop in 50ms if (!get(state, 'loopMode.epoch')) { loopMode.epoch = performance.now() + 0.05; } loopMode.lastBox = get(state, 'loopMode.box'); } return u({ loopMode }, state); } /** * toggleLoopMode - turn loop on or off * * If turning it on then it starts with the last looped box. * * @param {Object} state current state * @return {Object} new state */ export function toggleLoopMode(state /* , action*/) { const loopMode = {}; const box = get(state, 'loopMode.box'); if (box) { loopMode.lastBox = box; loopMode.box = null; loopMode.epoch = null; } else { // or last hovered const lastBox = get(state, 'loopMode.lastBox') || { m: 0, n: 0 }; return setLoopBox(state, { payload: lastBox }); } return u({ loopMode }, state); } /** * setLoopTime - set the loop time in seconds * * @param {Object} state current state * @param {Object} action .payload is {loopTime: int} * @return {Object} new state */ export function setLoopTime(state, action) { const loopMode = { loopTime: action.payload.loopTime || DEFAULT_LOOP_TIME }; return u({ loopMode }, state); } /** * setLoopTimeDimension - set the dimension to use for time in the loop * * @param {Object} state current state * @param {Object} action .payload is {index: int} * @return {Object} new state */ export function setLoopTimeDimension(state, action) { const loopMode = { timeDimension: action.payload.index }; return u({ loopMode }, state); } /** * Set timeDimension to 'x' any time the dataset is loaded. * * This prevents it from going out of bounds if dataset fields are less than the * previously loaded one */ export function setDataset(state /* , action*/) { return u({ loopMode: { timeDimension: null } }, state); }
27.05
84
0.636322
8087f87b75deabb0c2811da0a4b8190e760557bf
128
js
JavaScript
gui/node_modules/core-js/internals/to-string.js
AntoniosKalattas/Ping_rep
7285f44b87bfbd37baa1524be1ac18521d18c54c
[ "BSL-1.0" ]
null
null
null
gui/node_modules/core-js/internals/to-string.js
AntoniosKalattas/Ping_rep
7285f44b87bfbd37baa1524be1ac18521d18c54c
[ "BSL-1.0" ]
1
2022-03-25T19:20:50.000Z
2022-03-25T19:20:50.000Z
gui/node_modules/core-js/internals/to-string.js
AntoniosKalattas/Ping_rep
7285f44b87bfbd37baa1524be1ac18521d18c54c
[ "BSL-1.0" ]
null
null
null
version https://git-lfs.github.com/spec/v1 oid sha256:f853539077f679ec815eb884c5344ff06d00956766af0242ffbdfae36f8e3761 size 208
32
75
0.882813
80883e4dca533f2e4c9970f76f110c9496a6ac0e
2,577
js
JavaScript
node_modules/@redwoodjs/structure/dist/model/util/process_env.js
metanoiaweblabs/redwoodblog
34af42bb875538cb4edeb76df6e3cf93e02504f7
[ "MIT" ]
null
null
null
node_modules/@redwoodjs/structure/dist/model/util/process_env.js
metanoiaweblabs/redwoodblog
34af42bb875538cb4edeb76df6e3cf93e02504f7
[ "MIT" ]
null
null
null
node_modules/@redwoodjs/structure/dist/model/util/process_env.js
metanoiaweblabs/redwoodblog
34af42bb875538cb4edeb76df6e3cf93e02504f7
[ "MIT" ]
null
null
null
"use strict"; var _Object$defineProperty = require("@babel/runtime-corejs3/core-js/object/define-property"); var _interopRequireWildcard = require("@babel/runtime-corejs3/helpers/interopRequireWildcard").default; var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default; _Object$defineProperty(exports, "__esModule", { value: true }); exports.process_env_findAll = process_env_findAll; exports.process_env_findInFile = process_env_findInFile; exports.process_env_findInFile2 = process_env_findInFile2; var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/includes")); var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/instance/filter")); var _path = require("path"); var _fsExtra = require("fs-extra"); var _glob = _interopRequireDefault(require("glob")); var tsm = _interopRequireWildcard(require("ts-morph")); var _Array = require("../../x/Array"); var _tsMorph2 = require("../../x/ts-morph"); function process_env_findAll(dir) { return (0, _Array.iter)(function* () { for (const file of _glob.default.sync((0, _path.join)(dir, 'src/**/*.{js,ts,jsx,tsx}'))) { yield* process_env_findInFile(file, (0, _fsExtra.readFileSync)(file).toString()); } }); } function process_env_findInFile(filePath, text) { if (!(0, _includes.default)(text).call(text, 'process.env')) { return []; } try { return process_env_findInFile2((0, _tsMorph2.createTSMSourceFile_cached)(filePath, text)); } catch (e) { return []; } } function process_env_findInFile2(sf) { var _context; const penvs = (0, _filter.default)(_context = sf.getDescendantsOfKind(tsm.SyntaxKind.PropertyAccessExpression)).call(_context, is_process_env); return (0, _Array.iter)(function* () { for (const penv of penvs) { const node = penv.getParent(); if (!node) { continue; } if (tsm.Node.isPropertyAccessExpression(node)) { yield { key: node.getName(), node }; } else if (tsm.Node.isElementAccessExpression(node)) { const arg = node.getArgumentExpression(); if (!arg) { continue; } if (!tsm.Node.isStringLiteral(arg)) { continue; } yield { key: arg.getLiteralText(), node }; } } }); } function is_process_env(n) { if (!tsm.Node.isPropertyAccessExpression(n)) { return false; } return n.getExpression().getText() === 'process' && n.getName() === 'env'; }
26.84375
145
0.667055
8089b2261f1031eefd2eec8e97848df28d7fd340
296
js
JavaScript
.eslintrc.js
JacobPozaic/RSS-feed
14c42d7b62281fa68de1151c9ace2529f467b576
[ "MIT" ]
null
null
null
.eslintrc.js
JacobPozaic/RSS-feed
14c42d7b62281fa68de1151c9ace2529f467b576
[ "MIT" ]
null
null
null
.eslintrc.js
JacobPozaic/RSS-feed
14c42d7b62281fa68de1151c9ace2529f467b576
[ "MIT" ]
null
null
null
'use strict'; module.exports = { root: true, extends: 'airbnb', parser: 'babel-eslint', env: { es6: true, browser: true, }, rules: { 'no-plusplus': 'off', 'no-console': ['warn', { allow: ['error', 'warn'], }], 'react/jsx-filename-extension': 0, }, };
15.578947
38
0.513514
8089f38c736d26b0f73a49084064dee298f01c03
913
js
JavaScript
src/generators/html-generator.js
fairhopeweb/HackMyResume
ab6e7ee1a0f55608b531f4e644c298426291bb17
[ "MIT" ]
10,040
2015-12-22T15:32:40.000Z
2022-03-31T02:45:57.000Z
src/generators/html-generator.js
fairhopeweb/HackMyResume
ab6e7ee1a0f55608b531f4e644c298426291bb17
[ "MIT" ]
196
2015-12-23T23:13:43.000Z
2021-11-14T22:59:20.000Z
src/generators/html-generator.js
fairhopeweb/HackMyResume
ab6e7ee1a0f55608b531f4e644c298426291bb17
[ "MIT" ]
706
2015-12-19T17:48:57.000Z
2022-03-31T03:16:56.000Z
/* * decaffeinate suggestions: * DS102: Remove unnecessary code created because of implicit returns * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md */ /** Definition of the HTMLGenerator class. @module generators/html-generator @license MIT. See LICENSE.md for details. */ const TemplateGenerator = require('./template-generator'); const HTML = require('html'); require('string.prototype.endswith'); class HtmlGenerator extends TemplateGenerator { constructor() { super('html'); } /** Copy satellite CSS files to the destination and optionally pretty-print the HTML resume prior to saving. */ onBeforeSave( info ) { if (info.outputFile.endsWith('.css')) { return info.mk; } if (this.opts.prettify) { return HTML.prettyPrint(info.mk, this.opts.prettify); } else { return info.mk; } } } module.exports = HtmlGenerator;
22.825
90
0.711939
808a613222eab8331be14dfbeebc1125192f3ebf
3,124
js
JavaScript
js/main.js
forrana/ihan-valo-music
c123e0c49b6d0d0e54d9a03bb135f9dc466a1088
[ "CC0-1.0" ]
null
null
null
js/main.js
forrana/ihan-valo-music
c123e0c49b6d0d0e54d9a03bb135f9dc466a1088
[ "CC0-1.0" ]
null
null
null
js/main.js
forrana/ihan-valo-music
c123e0c49b6d0d0e54d9a03bb135f9dc466a1088
[ "CC0-1.0" ]
null
null
null
const numbersListRaw = [ { name: "Kalastus", participanst: "all", time: 0 }, { name: "Snake", participanst: "Ka, Ma, Os, To", time: 95 }, { name: "Keppi, Hyppis", participanst: "Ka, Al", time: 195 }, { name: "Magneetti-Isolaatio", participanst: "Os, To, Ma", time: 260 }, { name: "Poi", participanst: "Ka, Al", time: 400 }, { name: "Vanteet", participanst: "Ka, Ma, Os", time: 480 }, { name: "Miekka", participanst: "Ka, Al", time: 540 }, { name: "Dragon + Fanit", participanst: "Al, Ma, To", time: 610 }, { name: "Tupla", participanst: "To, Os, Ma", time: 685 }, { name: "Loppubileet", participanst: "Kaikki", time: 795 }, ] const numbersListProcessed = numbersListRaw.map((element, index, array) => { element.totalTime = array[index+1] ? array[index+1].time - element.time : 1251 - element.time; return element; }) function secondsToMMSS(seconds) { return new Date(seconds * 1000).toISOString().substr(14, 5); } const EventHandling = { data() { return { currentTime: 0, isPaused: true, isRepeatMode: false, timeDelta: 5, activeElementIndex: 0, isManualChangeInProcess: false, selectedForRepeat: null, } }, watch: { activeElementIndex(newIndex, oldIndex) { if(this.isManualChangeInProcess) { this.isManualChangeInProcess = false; return; } if(this.isRepeatMode) { let selectedIndex = this.numbersList.findIndex(({name}) => this.selectedForRepeat.name == name) if(newIndex != selectedIndex) { this.setNumberTime(this.selectedForRepeat); } } } }, methods: { setNumberTime(number, isManual) { if(isManual) this.selectedForRepeat = number; this.$refs.audio.currentTime = number.time; this.isManualChangeInProcess = isManual; }, play() { let audioElement = this.$refs.audio; audioElement.paused ? audioElement.play() : audioElement.pause(); this.isPaused = audioElement.paused; audioElement.addEventListener('timeupdate', () => { this.currentTime = audioElement.currentTime.toFixed(); this.activeElementIndex = this.numbersList.findIndex(({time, totalTime}) => this.currentTime >= time && this.currentTime < time+totalTime+this.timeDelta) }); }, toggleRepeat() { this.isRepeatMode = !this.isRepeatMode }, totalTime(number) { let totalTime = number.totalTime; return secondsToMMSS(totalTime); } }, computed: { numbersList() { return numbersListProcessed.map((element) => { element.time -= this.timeDelta; return element; }) }, timeLeft() { let startTime = this.numbersList[this.activeElementIndex].time + this.timeDelta; let totalTime = this.numbersList[this.activeElementIndex].totalTime; let timeLeft = startTime + totalTime - this.currentTime; return secondsToMMSS(timeLeft) } } } Vue.createApp(EventHandling).mount('#app')
24.030769
161
0.607554
808a768446d2919d1ce39d650cb2fa82420fe6aa
203
js
JavaScript
exercicios/ex011/index.js
CiceroWesley/curso-javascript
aab362e9329303c9812a5b34d8f9713d434b4c83
[ "MIT" ]
null
null
null
exercicios/ex011/index.js
CiceroWesley/curso-javascript
aab362e9329303c9812a5b34d8f9713d434b4c83
[ "MIT" ]
null
null
null
exercicios/ex011/index.js
CiceroWesley/curso-javascript
aab362e9329303c9812a5b34d8f9713d434b4c83
[ "MIT" ]
null
null
null
var idade = 6 if (idade < 16){ console.log('Menor de idade') } else{ if (idade < 18 || idade > 65){ console.log('Facultativo') } else { console.log('voto obrigatorio') } }
20.3
39
0.541872
808ae5f64729b55f3fe40c9a8d1dd4374a791315
6,929
js
JavaScript
addons/Snipe.js
BraketsHasGithub/eFex-bot
d1e1d246a44f2fabe360c01eee0c66f236440b0f
[ "Apache-2.0" ]
null
null
null
addons/Snipe.js
BraketsHasGithub/eFex-bot
d1e1d246a44f2fabe360c01eee0c66f236440b0f
[ "Apache-2.0" ]
null
null
null
addons/Snipe.js
BraketsHasGithub/eFex-bot
d1e1d246a44f2fabe360c01eee0c66f236440b0f
[ "Apache-2.0" ]
null
null
null
const _0x350c=['1430107eLSQEk','setupDatabase','ability\x20to\x20see\x20what\x20was\x20the\x20latest\x20deleted\x20message','cache','setupTable','set','../modules/handlers/EventHandler.js','bot','../modules/CustomConfig.js','INSERT\x20INTO\x20snipe\x20(channel,\x20user,\x20content,\x20image)VALUES(?,?,?,?)','snipe','7471zXyxvp','channel','exports','Sniped','No_Snipes','766899hBJYMV','194629eNnfYK','guild','target','snipe\x20(history)\x20(page-number)','find','image','log','45ZDPsip','content','proxyURL','toLowerCase','Addon\x20is\x20disabled\x20in\x20config.\x20Disabling\x20Addon\x20Features..\x20','ceil','{target-pfp}','attachments','Nothing\x20to\x20snipe','Snipes\x20[{currentPage}/{maxPage}]','setupEmbed','Enabled','./addon_configs/Snipe.yml','Messages','author','3455571AKogvz','../modules/handlers/CommandHandler','../modules/utils','{content}','all','messageDelete','SELECT\x20*\x20FROM\x20snipe\x20WHERE\x20channel=?','send','length','History','members','2mmRpTn','{target-tag}','userVariables','46pxiEJO','65320FhyFvo','30754jXAWWZ','user','infoPrefix','None'];const _0x501018=_0x2f41;(function(_0x48f1ab,_0x3bd86d){const _0x4c96ff=_0x2f41;while(!![]){try{const _0x3ae8f9=parseInt(_0x4c96ff(0x17c))+parseInt(_0x4c96ff(0x1a7))+parseInt(_0x4c96ff(0x1b2))*parseInt(_0x4c96ff(0x1a1))+-parseInt(_0x4c96ff(0x1a2))+-parseInt(_0x4c96ff(0x184))*-parseInt(_0x4c96ff(0x1a3))+parseInt(_0x4c96ff(0x17d))*parseInt(_0x4c96ff(0x19e))+-parseInt(_0x4c96ff(0x193));if(_0x3ae8f9===_0x3bd86d)break;else _0x48f1ab['push'](_0x48f1ab['shift']());}catch(_0x49c253){_0x48f1ab['push'](_0x48f1ab['shift']());}}}(_0x350c,0xc1989));function _0x2f41(_0x1c76c3,_0x5dc584){_0x1c76c3=_0x1c76c3-0x17c;let _0x350c61=_0x350c[_0x1c76c3];return _0x350c61;}const Utils=require(_0x501018(0x195)),ZUtils=require('../ZUtils'),CommandHandler=require(_0x501018(0x194)),EventHandler=require(_0x501018(0x1ad)),CustomConfig=require(_0x501018(0x1af)),ms=require('ms');module[_0x501018(0x1b4)]=async _0x4a3a33=>{const _0xb33496=_0x501018,_0x8cfca9=await ZUtils[_0xb33496(0x1a8)]();ZUtils[_0xb33496(0x1ab)](_0x8cfca9,_0xb33496(0x1b1),'channel,\x20user,\x20content,\x20image');const _0x58a379=new CustomConfig(_0xb33496(0x190),{'Enabled':!![],'Settings':{},'Messages':{'Sniped':{'Author':_0xb33496(0x19f),'AuthorIcon':_0xb33496(0x18a),'Description':_0xb33496(0x196),'Timestamp':!![]},'No_Snipes':{'Title':_0xb33496(0x18c),'Timestamp':!![]},'History':{'Title':_0xb33496(0x18d),'Description':_0xb33496(0x196),'Footer':_0xb33496(0x19f),'FooterIcon':_0xb33496(0x18a)}}},{'development':!![]});if(!_0x58a379[_0xb33496(0x18f)])return console[_0xb33496(0x183)](ZUtils[_0xb33496(0x1a5)],_0xb33496(0x188));EventHandler[_0xb33496(0x1ac)](_0xb33496(0x198),async(_0x54ae49,_0x54dd67)=>{const _0x37207f=_0xb33496;if(_0x54dd67[_0x37207f(0x192)][_0x37207f(0x1ae)])return;_0x8cfca9['prepare'](_0x37207f(0x1b0))['run'](_0x54dd67[_0x37207f(0x1b3)]['id'],_0x54dd67[_0x37207f(0x192)]['id'],_0x54dd67['content'],_0x54dd67[_0x37207f(0x18b)]['first']()?_0x54dd67['attachments']['first']()[_0x37207f(0x186)]:null);});function _0x42e5b0(_0x586d0f,_0x1364bb,_0x32a48c=0x1){const _0x2cf7b7=_0xb33496,_0x210c1a=Math[_0x2cf7b7(0x189)](_0x586d0f[_0x2cf7b7(0x19b)]/_0x1364bb);if(_0x32a48c<0x1||_0x32a48c>_0x210c1a)return null;return _0x586d0f['slice']((_0x32a48c-0x1)*_0x1364bb,_0x32a48c*_0x1364bb);}CommandHandler['set']({'name':_0xb33496(0x1b1),'run':async(_0x51a7fa,_0x56fa2d,_0x60efce,{prefixUsed:_0x425b03,commandUsed:_0x28b71f})=>{const _0x4505e1=_0xb33496,_0x4f6f48=_0x8cfca9['prepare'](_0x4505e1(0x199))[_0x4505e1(0x197)](_0x56fa2d[_0x4505e1(0x1b3)]['id']);if(!_0x4f6f48||_0x4f6f48[_0x4505e1(0x19b)]==0x0)return _0x56fa2d[_0x4505e1(0x1b3)]['send'](Utils[_0x4505e1(0x18e)]({'configPath':_0x58a379['Messages'][_0x4505e1(0x1b6)],'variables':[...Utils[_0x4505e1(0x1a0)](_0x56fa2d['member'],_0x4505e1(0x1a4))]}));let _0x2e672f;if(!_0x60efce[0x0]){_0x2e672f=_0x56fa2d['guild']['members'][_0x4505e1(0x1aa)]['find'](_0x4cc03b=>_0x4cc03b['id']==_0x4f6f48[_0x4f6f48[_0x4505e1(0x19b)]-0x1]['user']);if(_0x4f6f48[_0x4f6f48[_0x4505e1(0x19b)]-0x1][_0x4505e1(0x182)])return _0x56fa2d[_0x4505e1(0x1b3)][_0x4505e1(0x19a)](Utils['setupEmbed']({'configPath':_0x58a379[_0x4505e1(0x191)][_0x4505e1(0x1b5)],'image':_0x4f6f48[_0x4f6f48['length']-0x1][_0x4505e1(0x182)],'variables':[...Utils['userVariables'](_0x2e672f,'target'),{'searchFor':/{content}/g,'replaceWith':_0x4f6f48[_0x4f6f48[_0x4505e1(0x19b)]-0x1][_0x4505e1(0x185)]}]}));_0x56fa2d[_0x4505e1(0x1b3)][_0x4505e1(0x19a)](Utils['setupEmbed']({'configPath':_0x58a379[_0x4505e1(0x191)][_0x4505e1(0x1b5)],'variables':[...Utils[_0x4505e1(0x1a0)](_0x2e672f,_0x4505e1(0x17f)),{'searchFor':/{content}/g,'replaceWith':_0x4f6f48[_0x4f6f48[_0x4505e1(0x19b)]-0x1][_0x4505e1(0x185)]}]}));return;}switch(_0x60efce[0x0][_0x4505e1(0x187)]()){case'history':{const _0x5f0c7d=await _0x42e5b0(_0x4f6f48,0x1,_0x60efce[0x1]||0x1);let _0x43ed71=Math[_0x4505e1(0x189)](_0x4f6f48['length']/0x1);_0x2e672f=_0x56fa2d[_0x4505e1(0x17e)][_0x4505e1(0x19d)]['cache']['find'](_0x3997f4=>_0x3997f4['id']==_0x5f0c7d[0x0][_0x4505e1(0x1a4)]);_0x5f0c7d[0x0][_0x4505e1(0x182)]?_0x56fa2d[_0x4505e1(0x1b3)][_0x4505e1(0x19a)](Utils['setupEmbed']({'configPath':_0x58a379[_0x4505e1(0x191)][_0x4505e1(0x19c)],'image':_0x5f0c7d[0x0][_0x4505e1(0x182)],'variables':[...Utils[_0x4505e1(0x1a0)](_0x2e672f,'target'),{'searchFor':/{content}/g,'replaceWith':_0x5f0c7d[0x0]['content']||_0x4505e1(0x1a6)},{'searchFor':/{currentPage}/g,'replaceWith':_0x60efce[0x1]||0x1},{'searchFor':/{maxPage}/g,'replaceWith':_0x43ed71}]})):_0x56fa2d[_0x4505e1(0x1b3)][_0x4505e1(0x19a)](Utils[_0x4505e1(0x18e)]({'configPath':_0x58a379['Messages'][_0x4505e1(0x19c)],'variables':[...Utils[_0x4505e1(0x1a0)](_0x2e672f,_0x4505e1(0x17f)),{'searchFor':/{content}/g,'replaceWith':_0x5f0c7d[0x0]['content']||_0x4505e1(0x1a6)},{'searchFor':/{currentPage}/g,'replaceWith':_0x60efce[0x1]||0x1},{'searchFor':/{maxPage}/g,'replaceWith':_0x43ed71}]}));return;}default:{_0x2e672f=_0x56fa2d[_0x4505e1(0x17e)][_0x4505e1(0x19d)]['cache'][_0x4505e1(0x181)](_0x35d5c8=>_0x35d5c8['id']==_0x4f6f48[_0x4f6f48[_0x4505e1(0x19b)]-0x1][_0x4505e1(0x1a4)]);if(_0x4f6f48[_0x4f6f48[_0x4505e1(0x19b)]-0x1]['image'])return _0x56fa2d[_0x4505e1(0x1b3)]['send'](Utils[_0x4505e1(0x18e)]({'configPath':_0x58a379[_0x4505e1(0x191)][_0x4505e1(0x1b5)],'image':_0x4f6f48[_0x4f6f48['length']-0x1][_0x4505e1(0x182)],'variables':[...Utils['userVariables'](_0x2e672f,_0x4505e1(0x17f)),{'searchFor':/{content}/g,'replaceWith':_0x4f6f48[_0x4f6f48['length']-0x1]['content']}]}));_0x56fa2d[_0x4505e1(0x1b3)][_0x4505e1(0x19a)](Utils['setupEmbed']({'configPath':_0x58a379['Messages'][_0x4505e1(0x1b5)],'variables':[...Utils[_0x4505e1(0x1a0)](_0x2e672f,_0x4505e1(0x17f)),{'searchFor':/{content}/g,'replaceWith':_0x4f6f48[_0x4f6f48[_0x4505e1(0x19b)]-0x1][_0x4505e1(0x185)]}]}));return;}}},'description':_0xb33496(0x1a9),'usage':_0xb33496(0x180),'aliases':[],'type':'other'});};
6,929
6,929
0.759273
808aec1d3eec506d2723efb8646b24d490dbdfaf
1,720
js
JavaScript
src/server/model/user.model.js
dennis2k/keeper
c21d575e7a56a4088c123ac14248b6d29005cde1
[ "MIT" ]
null
null
null
src/server/model/user.model.js
dennis2k/keeper
c21d575e7a56a4088c123ac14248b6d29005cde1
[ "MIT" ]
null
null
null
src/server/model/user.model.js
dennis2k/keeper
c21d575e7a56a4088c123ac14248b6d29005cde1
[ "MIT" ]
null
null
null
'use strict' const mongoose = require('mongoose') var Schema = mongoose.Schema; var ObjectId = Schema.ObjectId; var bcrypt = require('bcryptjs'); var Promise = require('bluebird'); var account = require('./account.model').model; var userSchema = new Schema({ accountId: { type: ObjectId, required: true, ref: 'account' }, email: { type: String, lowercase: true }, password: { type: String, select: false }, displayName: String, picture: String, facebook: String, foursquare: String, google: String, github: String, linkedin: String, live: String, yahoo: String, twitter: String }) userSchema.pre('save', function (next) { var user = this; if (!user.isModified('password')) { return next(); } bcrypt.genSalt(10, (err, salt) => { bcrypt.hash(user.password, salt, (err, hash) => { user.password = hash; next(); }); }); }); userSchema.methods.comparePassword = (password, currentPassword) => { return new Promise((resolve, reject) => { bcrypt.compare(password, currentPassword, (err, isMatch) => { (err) ? reject(err) : resolve(isMatch) }); }); }; var model = mongoose.model('user', userSchema); var options = { preCreate: (req, res, next) => { account.create({}, (err, acc) => { req.body.accountId = acc._id; next(); }) }, onError: (err, req, res, next) => { const statusCode = req.erm.statusCode // 400 or 404 res.status(statusCode).json({ message: err.message }) } } exports.model = model; exports.options = options; exports.create = () => { return new model(); }
25.671642
69
0.581395
808c6f384c07159511b0b26c6bff00bfa35f4dab
156
js
JavaScript
config.js
paulcedrick/NoteMaker
f01ee32b20516e84a3d5ebf2d92f11c66ab49663
[ "MIT" ]
null
null
null
config.js
paulcedrick/NoteMaker
f01ee32b20516e84a3d5ebf2d92f11c66ab49663
[ "MIT" ]
null
null
null
config.js
paulcedrick/NoteMaker
f01ee32b20516e84a3d5ebf2d92f11c66ab49663
[ "MIT" ]
null
null
null
module.exports = { testing: { siteUrl: 'http://localhost:3000' }, development: { siteUrl: 'http://localhost:3000' }, production: { } }
13
36
0.570513
808c7e6f62c0ad274cc8208ef097bb688e170824
485
js
JavaScript
client/src/reducers/index.js
jlgoh/stockeer
305640c8f46cfc87c3df7b69d9e44200128bd513
[ "MIT" ]
null
null
null
client/src/reducers/index.js
jlgoh/stockeer
305640c8f46cfc87c3df7b69d9e44200128bd513
[ "MIT" ]
null
null
null
client/src/reducers/index.js
jlgoh/stockeer
305640c8f46cfc87c3df7b69d9e44200128bd513
[ "MIT" ]
null
null
null
import { combineReducers } from "redux"; import authReducer from "./authReducer"; import stockReducer from "./stockReducer"; import bookmarkReducer from "./bookmarkReducer"; import searchReducer from "./searchReducer"; export default combineReducers({ auth: authReducer, sidebar: (state = false, action) => { if (action.type === "TOGGLE_SIDEBAR") return action.payload; return state; }, stocks: stockReducer, bookmarks: bookmarkReducer, search: searchReducer, });
28.529412
64
0.731959
808d584c2d2392271b691cf8681dbe32a9f5d518
421
js
JavaScript
src/__tests__/helpers/images/fixtures.js
BHesseldieck/graphql-serverless-boilerplate
18427f73879e8faf7cd570cb4e9257d85bb0d748
[ "MIT" ]
null
null
null
src/__tests__/helpers/images/fixtures.js
BHesseldieck/graphql-serverless-boilerplate
18427f73879e8faf7cd570cb4e9257d85bb0d748
[ "MIT" ]
9
2019-07-21T04:19:24.000Z
2022-01-22T07:13:53.000Z
src/__tests__/helpers/images/fixtures.js
BHesseldieck/graphql-serverless-boilerplate
18427f73879e8faf7cd570cb4e9257d85bb0d748
[ "MIT" ]
null
null
null
import userFixtures from '../users/fixtures'; const { userStruct } = userFixtures.actuals; const imageStruct = { id: '5afd2b1b930adf00074d4de0', title: 'Beautiful Sundowner', uri: 'https://cdn.pixabay.com/photo/2019/05/29/20/01/sunset-4238445_1280.jpg', published: true, resolution: '1280x640', taggedUsers: [userStruct, userStruct, userStruct], }; module.exports = { actuals: { imageStruct, }, };
22.157895
80
0.703088
808d7d18926168141c5ce27a4e00084e045003d3
549
js
JavaScript
src/singleResult.test.js
MilosRasic/reunit
30a548eaf8ceae2442ef21d4b08baa4d0cb41a6c
[ "MIT" ]
2
2022-01-19T10:59:08.000Z
2022-01-19T12:32:56.000Z
src/singleResult.test.js
MilosRasic/reunit
30a548eaf8ceae2442ef21d4b08baa4d0cb41a6c
[ "MIT" ]
null
null
null
src/singleResult.test.js
MilosRasic/reunit
30a548eaf8ceae2442ef21d4b08baa4d0cb41a6c
[ "MIT" ]
null
null
null
const singleResult = require('./singleResult'); describe('singleResult', () => { it('returns the only element from an array with only one element', () => { const element = {}; const array = [element]; expect(singleResult(array)).to.equal(element); }); it('throws if the array does not have exactly one result', () => { const array = [{}, {}]; expect(() => singleResult(array)).to.throw(); }); it('throws if results is not an array', () => { const notAnArray = {}; expect(() => singleResult(notAnArray)).to.throw(); }); });
23.869565
75
0.615665
808f236fb11f71417815c3a60f8865ede419f934
632
js
JavaScript
src/cartridges/int_adyen_SFRA/cartridge/scripts/hooks/payment/processor/middlewares/posHandle.js
tagheuerhq/adyen-salesforce-commerce-cloud
3d1776ec6da554c72d0f5be405494a8980ff3c21
[ "MIT" ]
68
2017-02-10T08:29:38.000Z
2022-03-31T15:33:06.000Z
src/cartridges/int_adyen_SFRA/cartridge/scripts/hooks/payment/processor/middlewares/posHandle.js
tagheuerhq/adyen-salesforce-commerce-cloud
3d1776ec6da554c72d0f5be405494a8980ff3c21
[ "MIT" ]
223
2017-01-06T10:22:35.000Z
2022-03-11T09:43:26.000Z
src/cartridges/int_adyen_SFRA/cartridge/scripts/hooks/payment/processor/middlewares/posHandle.js
tagheuerhq/adyen-salesforce-commerce-cloud
3d1776ec6da554c72d0f5be405494a8980ff3c21
[ "MIT" ]
58
2016-11-28T14:01:53.000Z
2022-03-28T13:52:37.000Z
const Transaction = require('dw/system/Transaction'); const collections = require('*/cartridge/scripts/util/collections'); const constants = require('*/cartridge/adyenConstants/constants'); function posHandle(basket) { Transaction.wrap(() => { collections.forEach(basket.getPaymentInstruments(), (item) => { basket.removePaymentInstrument(item); }); const paymentInstrument = basket.createPaymentInstrument( constants.METHOD_ADYEN_POS, basket.totalGrossPrice, ); paymentInstrument.custom.adyenPaymentMethod = 'POS Terminal'; }); return { error: false }; } module.exports = posHandle;
28.727273
68
0.721519
808f8813d84bcb8bb1567b4a384c7627604936f5
393
js
JavaScript
src/models/simulator/simulator.model.js
Chia-Network/climate-warehouse
ef5ea06f854f8f33e7f65367c82f8379ae66be23
[ "Apache-2.0" ]
4
2022-03-11T08:52:13.000Z
2022-03-20T11:47:52.000Z
src/models/simulator/simulator.model.js
Chia-Network/climate-warehouse
ef5ea06f854f8f33e7f65367c82f8379ae66be23
[ "Apache-2.0" ]
34
2022-03-10T15:06:52.000Z
2022-03-30T10:48:16.000Z
src/models/simulator/simulator.model.js
Chia-Network/climate-warehouse
ef5ea06f854f8f33e7f65367c82f8379ae66be23
[ "Apache-2.0" ]
1
2022-03-10T19:23:31.000Z
2022-03-10T19:23:31.000Z
'use strict'; import Sequelize from 'sequelize'; const { Model } = Sequelize; import { sequelize } from '../../database'; import ModelTypes from './simulator.modeltypes.cjs'; class Simulator extends Model {} Simulator.init(ModelTypes, { sequelize, modelName: 'simulator', freezeTableName: true, timestamps: false, createdAt: false, updatedAt: false, }); export { Simulator };
18.714286
52
0.707379
80914e447687434eee552203651c3806d9bcd58b
2,412
js
JavaScript
src/odata-client/sfo-data-service/TimeManagementAlertRequestBuilder.js
robypag/sdk-gen-sfsf
ce9b613ee3e85dd8ed4e42ffe200df1a2decf835
[ "MIT" ]
null
null
null
src/odata-client/sfo-data-service/TimeManagementAlertRequestBuilder.js
robypag/sdk-gen-sfsf
ce9b613ee3e85dd8ed4e42ffe200df1a2decf835
[ "MIT" ]
null
null
null
src/odata-client/sfo-data-service/TimeManagementAlertRequestBuilder.js
robypag/sdk-gen-sfsf
ce9b613ee3e85dd8ed4e42ffe200df1a2decf835
[ "MIT" ]
null
null
null
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); /* * Copyright (c) 2020 SAP SE or an SAP affiliate company. All rights reserved. * * This is a generated file powered by the SAP Cloud SDK for JavaScript. */ var core_1 = require("@sap-cloud-sdk/core"); var TimeManagementAlert_1 = require("./TimeManagementAlert"); /** * Request builder class for operations supported on the [[TimeManagementAlert]] entity. */ var TimeManagementAlertRequestBuilder = /** @class */ (function (_super) { __extends(TimeManagementAlertRequestBuilder, _super); function TimeManagementAlertRequestBuilder() { return _super !== null && _super.apply(this, arguments) || this; } /** * Returns a request builder for retrieving one `TimeManagementAlert` entity based on its keys. * @param externalCode Key property. See [[TimeManagementAlert.externalCode]]. * @returns A request builder for creating requests to retrieve one `TimeManagementAlert` entity based on its keys. */ TimeManagementAlertRequestBuilder.prototype.getByKey = function (externalCode) { return new core_1.GetByKeyRequestBuilder(TimeManagementAlert_1.TimeManagementAlert, { externalCode: externalCode }); }; /** * Returns a request builder for querying all `TimeManagementAlert` entities. * @returns A request builder for creating requests to retrieve all `TimeManagementAlert` entities. */ TimeManagementAlertRequestBuilder.prototype.getAll = function () { return new core_1.GetAllRequestBuilder(TimeManagementAlert_1.TimeManagementAlert); }; return TimeManagementAlertRequestBuilder; }(core_1.RequestBuilder)); exports.TimeManagementAlertRequestBuilder = TimeManagementAlertRequestBuilder; //# sourceMappingURL=TimeManagementAlertRequestBuilder.js.map
49.22449
124
0.700249
80918b782f721379be8ac05b05efdeffb1d29329
2,000
js
JavaScript
JSBook-master/WebContent/c03/js/example.js
june20516/WebWorks
01ce151c59171b23dd222100ea46b389258aee5b
[ "Apache-2.0" ]
null
null
null
JSBook-master/WebContent/c03/js/example.js
june20516/WebWorks
01ce151c59171b23dd222100ea46b389258aee5b
[ "Apache-2.0" ]
7
2020-04-23T18:32:40.000Z
2021-12-09T22:43:27.000Z
JSBook-master/WebContent/c03/js/example.js
june20516/WebWorks
01ce151c59171b23dd222100ea46b389258aee5b
[ "Apache-2.0" ]
null
null
null
/* 이 스크립ㅌ는 변수의 범위를 보호하기 위해 즉시 호출 함수 표현식을 이용하여 작성되었다 */ (function() { // 첫 번째 부분: 호텔 객체를 생성하고 할인 행사에 대한 상세 정보를 출력한다. // 축약형 표기법을 이용하여 hotel 객체를 생성한다. var hotel = { name: 'Park', roomRate: 240, // 방의 가격 discount: 15, // 할인율 (%) offerPrice: function() { var offerRate = this.roomRate * ((100 - this.discount) / 100); return offerRate; } } // 호텔의 이름, 방의 가격, 할인 율 등을 출력한다. var hotelName, roomRate, specialRate; // 변수를 선언 hotelName = document.getElementById('hotelName'); // 값을 출력할 요소들를 찾는다. roomRate = document.getElementById('roomRate'); specialRate = document.getElementById('specialRate'); hotelName.textContent = hotel.name; // 호텔 이름 출력 roomRate.textContent = '$' + hotel.roomRate; // 방 가격 출력 specialRate.textContent = '$' + hotel.offerPrice().toFixed(2); // 할인된 가격 출력 // 두 번째 부분: 할이 행사 상세 정보를 계산하여 출력한다. var expiryMsg; // 사용자에게 보여질 메시지 var today; // 오늘 날짜 var elEnds; // 메시지를 출력할 요소 function offerExpires(today) { // 함수 내에 지역 변수를 선언한다. var weekFromToday, day, date, month, year, dayNames, monthNames; // 날짜에 7일을 더한다 (7일에 해당하는 밀리 초를 더한다). weekFromToday = new Date(today.getTime() + 7 * 24 * 60 * 60 * 1000); // 요일과 월 이름을 저장하는 배열을 선언 dayNames = ['일요일', '월요일', '화요일', '수요일', '목요일', '금요일', '토요일']; monthNames = ['1월', '2월', '3월', '4월', '5월', '6월', '7월', '8월', '9월', '10월', '11월', '12월']; // 페이지에 날짜를 출력하기 위해 날짜의 각 부분 값을 가져온다. day = dayNames[weekFromToday.getDay()]; date = weekFromToday.getDate(); month = monthNames[weekFromToday.getMonth()]; year = weekFromToday.getFullYear(); // 메시지를 생성 expiryMsg = '할인 행사는 '; expiryMsg += day + ' 에 마감됩니다.<br />(' + year + '년 ' + month + ' ' + date + '일)'; return expiryMsg; } today = new Date(); // 오늘 날짜를 변수에 저장한다. elEnds = document.getElementById('offerEnds'); // 요소를 첮는다. elEnds.innerHTML = offerExpires(today); // 행사 마감 메시지를 출력한다. // 즉시 호출 함수 표현식을 마무리한다. }());
31.746032
91
0.5895
80923d2c3ac18a7136072514e06926011bd9ff4c
2,072
js
JavaScript
packages/maq-metadata-dojo/src/dojox/grid/TreeGridCreateTool.js
skylark-integration/skylark-maqetta
2a1799f3910717ab000af6dc6813fd1dc40e8276
[ "MIT" ]
null
null
null
packages/maq-metadata-dojo/src/dojox/grid/TreeGridCreateTool.js
skylark-integration/skylark-maqetta
2a1799f3910717ab000af6dc6813fd1dc40e8276
[ "MIT" ]
null
null
null
packages/maq-metadata-dojo/src/dojox/grid/TreeGridCreateTool.js
skylark-integration/skylark-maqetta
2a1799f3910717ab000af6dc6813fd1dc40e8276
[ "MIT" ]
null
null
null
//>>built define("maq-metadata-dojo/dojox/grid/TreeGridCreateTool",["dojo/_base/declare","davinci/ve/tools/CreateTool","davinci/ve/widget","davinci/commands/CompoundCommand","davinci/ve/commands/AddCommand","davinci/ve/commands/MoveCommand","davinci/ve/commands/ResizeCommand","davinci/ve/commands/StyleCommand","dojo/promise/all"],function(_1,_2,_3,_4,_5,_6,_7,_8,_9){ return _1(_2,{constructor:function(_a){ this._resizable="both"; },_create:function(_b){ if(this._data.length!==2){ return; } var _c=this._data[0],_d=this._data[1]; _9([this._context.loadRequires(_c.type,true),this._context.loadRequires(_d.type,true)]).then(function(){ var _e=_3.getUniqueObjectId(_c.type,this._context.getDocument()); if(!_c.properties){ _c.properties={}; } _c.properties.jsId=_e; _c.properties.id=_e; _c.context=this._context; var _f=_c.properties.data; var _10=_f.items; var _11=dojo.hitch(this,function(_12){ var win=this._context.getGlobal(); var _13=win.eval("[]"); for(var i=0;i<_12.length;i++){ var _14=_12[i]; var _15=win.eval("new Object()"); var _16=this._context.getDojo().mixin(_15,_14); _13.push(_16); if(_16.children){ _16.children=_11(_16.children); } } return _13; }); _f.items=_11(_10); var _17=_3.getUniqueObjectId(_d.type,this._context.getDocument()); if(!_d.properties){ _d.properties={}; } _d.context=this._context; var _18,_19; var dj=this._context.getDojo(); dojo.withDoc(this._context.getDocument(),function(){ _18=_3.createWidget(_c); _d.properties.store=dj.getObject(_e); _19=_3.createWidget(_d); }); if(!_18||!_19){ return; } var _1a=new _4(); var _1b=_b.index; _1a.add(new _5(_18,_b.parent,_1b)); _1b=(_1b!==undefined&&_1b>=0?_1b+1:undefined); _1a.add(new _5(_19,_b.parent,_1b)); if(_b.position){ var _1c=this._context.getPreference("absoluteWidgetsZindex"); _1a.add(new _8(_19,[{position:"absolute"},{"z-index":_1c}])); _1a.add(new _6(_19,_b.position.x,_b.position.y)); } _b.size=this._getInitialSize(_19,_b); if(_b.size){ _1a.add(new _7(_19,_b.size.w,_b.size.h)); } this._context.getCommandStack().execute(_1a); this._select(_19); }.bind(this)); }}); });
30.028986
359
0.730695
809266cb0e51f9a280c1f074732fa0a03914e564
704
js
JavaScript
src/App.js
Vitorrrocha/ReactJS-Star-Wars
f2bf53a8252424471b295f96ca1f01e3b6d9eb17
[ "MIT" ]
null
null
null
src/App.js
Vitorrrocha/ReactJS-Star-Wars
f2bf53a8252424471b295f96ca1f01e3b6d9eb17
[ "MIT" ]
4
2021-09-02T11:56:58.000Z
2022-02-27T05:46:42.000Z
src/App.js
Vitorrrocha/ReactJS-Star-Wars
f2bf53a8252424471b295f96ca1f01e3b6d9eb17
[ "MIT" ]
null
null
null
import React, { Component } from 'react'; import Axios from 'axios'; import List from './List'; import './App.css'; class App extends Component{ constructor(props){ super(props); this.state = { films: [], } this.getFilms = this.getFilms.bind(this) } getFilms(){ return Axios.get("https://swapi.dev/api/films/?callback=foo") .then((response) => { console.log(response.data.results); this.setState( {films: response.data.results}) }) } componentDidMount(){ this.getFilms() } render(){ const {films} = this.state; return ( <div className="App"> <List films={films} /> </div> ) } } export default App;
18.051282
65
0.588068
809266d515b47637274efac9ec86be357fe78ac4
773
js
JavaScript
src/pages/admin/stats/index.js
phillipthelen/freesewing.org
79c5b15b29accf6efa74808a3ef5be0397bca9f6
[ "MIT" ]
26
2019-07-04T10:33:15.000Z
2022-01-14T00:31:27.000Z
src/pages/admin/stats/index.js
phillipthelen/freesewing.org
79c5b15b29accf6efa74808a3ef5be0397bca9f6
[ "MIT" ]
1,112
2019-08-02T09:12:38.000Z
2022-03-29T04:28:41.000Z
src/pages/admin/stats/index.js
nataliabarnhart/freesewing.org
a2f157b1837c83b5529373810dcd4e0b330cdb02
[ "MIT" ]
23
2019-08-02T12:23:34.000Z
2022-02-04T23:24:04.000Z
import React, { useEffect, useState } from 'react' import useApp from '../../../hooks/useApp' import AppWrapper from '../../../components/app/wrapper' import AuthRequired from '../../../components/auth-required' const Page = (props) => { const app = useApp() const [stats, setStats] = useState([]) // Effects useEffect(() => { app.backend .adminStats(app.token) .then((res) => { if (res.status === 200) setStats(res.data) }) .catch((err) => console.log(err)) }, []) return ( <AppWrapper app={app} title="Administration" active="account"> <AuthRequired app={app} admin> <h2>Stats</h2> <pre>{JSON.stringify(stats, null, 2)}</pre> </AuthRequired> </AppWrapper> ) } export default Page
24.15625
66
0.591203
80931f3ef4575f66d6badd40251e66ecbfd56f53
1,478
js
JavaScript
importJasonDynamo/app.js
DobrePetrushev/AlexaBot
37376347e67fa2d59dfa5b1bae07c79348afbe5b
[ "MIT" ]
null
null
null
importJasonDynamo/app.js
DobrePetrushev/AlexaBot
37376347e67fa2d59dfa5b1bae07c79348afbe5b
[ "MIT" ]
null
null
null
importJasonDynamo/app.js
DobrePetrushev/AlexaBot
37376347e67fa2d59dfa5b1bae07c79348afbe5b
[ "MIT" ]
null
null
null
/********************************* Simple Demo for loading files into DynamoDB. **********************************/ //package to read json files var jsonfile = require('jsonfile'); //AWS node sdk var AWS = require('aws-sdk'); //need to update region in config AWS.config.update({ region: "us-east-1" }); //create a doc client to allow using JSON directly var docClient = new AWS.DynamoDB.DocumentClient(); //prepared JSON file //[{ ... }, { ... }] var factFile = "data/cf.json"; var factArray = jsonfile.readFileSync(factFile); //utility function to create a single put request function getFact(index){ return { TableName: 'cannabis_facts', Item: factArray[index] }; } function saveFacts(index){ if(index == factArray.length){ console.log("saved all."); return; } var params = getFact(index); //spit out what we are saving for sanity console.log(JSON.stringify(params)); //use the client to execute put request. docClient.put(params, function(err, data) { if (err) { console.log(err); }else{ console.log("saved Place item "+index); index += 1; //save the next place on the list //with half a second delay setTimeout(function(){ saveFacts(index); }, 500); } }); } //start saving from index - 0 saveFacts(0);
25.482759
52
0.550068
80937355f0599c9c81cf041239cd431ed2086fbe
1,593
js
JavaScript
index.js
commenthol/turndown-cli
0e5da81479d0d24cd47e9bdc24f116e74e5065cf
[ "MIT" ]
null
null
null
index.js
commenthol/turndown-cli
0e5da81479d0d24cd47e9bdc24f116e74e5065cf
[ "MIT" ]
null
null
null
index.js
commenthol/turndown-cli
0e5da81479d0d24cd47e9bdc24f116e74e5065cf
[ "MIT" ]
null
null
null
const fsp = require('fs/promises') const TurndownService = require('turndown') const turndownPluginGfm = require('./turndown-plugin-gfm.js') const turndownPluginConfluenceToGfm = require('turndown-plugin-confluence-to-gfm') const { gfm, tables, strikethrough } = turndownPluginGfm const DEFAULTS = { headingStyle: 'atx', hr: '-', bulletListMarker: '-', codeBlockStyle: 'fenced', fence: '`', emDelimiter: '_', strongDelimiter: '**', linkStyle: 'inlined', linkReferenceStyle: 'full', preformattedCode: 'false' } const readStdin = () => new Promise((resolve, reject) => { const {stdin} = process let buff = '' stdin.setEncoding('utf8') stdin.on('data', function (data) { buff += data }) stdin.on('error', reject) stdin.on('end', function () { resolve(buff) }) stdin.resume() }) const main = async (opts) => { const { sourcePath, targetPath } = opts const turndownOpts = { ...DEFAULTS, ...opts?.turndown } const turndownService = new TurndownService(turndownOpts) turndownService.use(gfm) turndownService.use(tables) turndownService.use(strikethrough) turndownPluginConfluenceToGfm.confluenceGfm(turndownService) const html = sourcePath ? await fsp.readFile(sourcePath, 'utf8') : await readStdin() const markdown = turndownService.turndown(html) if (!!markdown) { if (targetPath) { await fsp.writeFile(targetPath, markdown, 'utf8') console.log(` Saved at path\n Absolute: ${targetPath}`) } else { console.log(markdown) } } } main.DEFAULTS = DEFAULTS module.exports = main
23.086957
82
0.677338
80945cea320c53a65a00408a4b95b5b79a522e84
432
js
JavaScript
e2e-properties.js
higorlaf12/Protractor-Base
138210eea46650d46ec9ce873873ded9de3eb91e
[ "MIT" ]
null
null
null
e2e-properties.js
higorlaf12/Protractor-Base
138210eea46650d46ec9ce873873ded9de3eb91e
[ "MIT" ]
null
null
null
e2e-properties.js
higorlaf12/Protractor-Base
138210eea46650d46ec9ce873873ded9de3eb91e
[ "MIT" ]
null
null
null
exports.Url = ''; exports.Register = ''; exports.seleniumAddress = 'http://localhost:4444/wd/hub'; exports.username = ''; exports.password = ''; // Fica as outras varias que são usadas exports.userAlias=''; exports.userName=''; exports.userPhone=''; exports.userEmail=''; exports.userSimultaneous=''; exports.password1 =''; exports.password2=''; exports.likeUser ='';
19.636364
61
0.606481
8094ce7a036fc6c3ef96d726cf8c135b729aa5fe
1,907
js
JavaScript
js/menu_pr.js
lancaster-esl/insurgent-dynamics
92fc6ddb43d15c6ea14afa7938a28eeb9a1cb56f
[ "MIT" ]
null
null
null
js/menu_pr.js
lancaster-esl/insurgent-dynamics
92fc6ddb43d15c6ea14afa7938a28eeb9a1cb56f
[ "MIT" ]
null
null
null
js/menu_pr.js
lancaster-esl/insurgent-dynamics
92fc6ddb43d15c6ea14afa7938a28eeb9a1cb56f
[ "MIT" ]
null
null
null
function makeScrollable(wrapper, scrollable){ // Get jQuery elements var wrapper = $(wrapper), scrollable = $(scrollable); // Hide images until they are not loaded scrollable.hide(); var loading = $('<div class="loading">Loading...</div>').appendTo(wrapper); // Set function that will check if all images are loaded var interval = setInterval(function(){ var images = scrollable.find('img'); var completed = 0; // Counts number of images that are succesfully loaded images.each(function(){ if (this.complete) completed++; }); if (completed == images.length){ clearInterval(interval); // Timeout added to fix problem with Chrome setTimeout(function(){ loading.hide(); // Remove scrollbars wrapper.css({overflow: 'hidden'}); scrollable.slideDown('slow', function(){ enable(); }); }, 1000); } }, 100); function enable(){ // height of area at the top at bottom, that don't respond to mousemove var inactiveMargin = 100; // Cache for performance var wrapperWidth = wrapper.width(); var wrapperHeight = wrapper.height(); // Using outer height to include padding too var scrollableHeight = scrollable.outerHeight() + 2*inactiveMargin; // Do not cache wrapperOffset, because it can change when user resizes window // We could use onresize event, but it's just not worth doing that // var wrapperOffset = wrapper.offset(); var lastTarget; //When user move mouse over menu wrapper.mousemove(function(e){ // Save target lastTarget = e.target; var wrapperOffset = wrapper.offset(); // Scroll menu var top = (e.pageY - wrapperOffset.top) * (scrollableHeight - wrapperHeight) / wrapperHeight - inactiveMargin; if (top < 0){ top = 0; } wrapper.scrollTop(top); }); } } $(function(){ makeScrollable("div.sc_menu_wrapper", "div.sc_menu"); });
28.462687
114
0.662297
809531dc565a3ae862dead80aab1b75140ff2460
1,475
js
JavaScript
app/server/models/inventory.js
MScallion/nr-mals
5807e9bd4774bf7a8cf4e677b748fb7cb46e6d6c
[ "Apache-2.0" ]
null
null
null
app/server/models/inventory.js
MScallion/nr-mals
5807e9bd4774bf7a8cf4e677b748fb7cb46e6d6c
[ "Apache-2.0" ]
10
2020-06-23T19:30:38.000Z
2022-02-28T20:44:37.000Z
app/server/models/inventory.js
MScallion/nr-mals
5807e9bd4774bf7a8cf4e677b748fb7cb46e6d6c
[ "Apache-2.0" ]
31
2020-07-09T20:27:27.000Z
2022-03-31T23:16:09.000Z
const { formatDate } = require("../utilities/formatting"); const { parseAsInt, parseAsFloat } = require("../utilities/parsing"); const { populateAuditColumnsCreate, populateAuditColumnsUpdate, } = require("../utilities/auditing"); const constants = require("../utilities/constants"); function convertToLogicalModel(input) { const output = { id: input.id, licenceId: input.licence_id, speciesSubCodeId: input.species_sub_code_id, date: formatDate(input.recorded_date), value: input.recorded_value === 0 ? null : input.recorded_value, }; return output; } function convertToPhysicalModel(input, update, licenceTypeId) { const output = { mal_licence: { connect: { id: input.licenceId }, }, mal_licence_species_sub_code_lu: { connect: { id: parseAsInt(input.speciesSubCodeId) }, }, recorded_date: input.date, recorded_value: input.value === null ? 0 : input.value, create_userid: input.createdBy, create_timestamp: input.createdOn, update_userid: input.updatedBy, update_timestamp: input.updatedOn, }; return output; } function convertToUpdatePhysicalModel(input, date, licenceTypeId) { const output = { where: { id: input.id }, data: convertToPhysicalModel( populateAuditColumnsUpdate(input, date), true, licenceTypeId ), }; return output; } module.exports = { convertToPhysicalModel, convertToLogicalModel, convertToUpdatePhysicalModel, };
25
69
0.701695
8099d7b0f2c24bfddf1d0717256c48bac7ac5a65
10,766
js
JavaScript
src/scripts/ripple.js
Metwas/chameleon-graphs
7e5bf699b9bcc1a88517ee3d2cfaf290f785c245
[ "MIT" ]
null
null
null
src/scripts/ripple.js
Metwas/chameleon-graphs
7e5bf699b9bcc1a88517ee3d2cfaf290f785c245
[ "MIT" ]
null
null
null
src/scripts/ripple.js
Metwas/chameleon-graphs
7e5bf699b9bcc1a88517ee3d2cfaf290f785c245
[ "MIT" ]
null
null
null
/* MIT License Copyright (c) Metwas Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ //======================== Imports ========================// // import utilities const { utils, math } = require("broadleaf"); //======================== End Imports ========================// /** * Water ripple effect * * @author Metwas * * @param {HTMLCanvasElement} canvas * @param {CanvasRenderingContext2D} ctx * @param {Object} options */ module.exports = function (canvas, ctx, options) { let height = 0; let width = 0; let current = []; let previous = []; // ripple damping let damping = 0.88; let fishes = []; let fishCount = 1; let useNoise = false; let simplex = null; let fish_radius = 1; let fish_speed = 0.1; let angle = 0; let factor = 0.12; /** * Vector argument validator * * @param {Any} arg * @param {Number} length */ const isValidVecArgs = function (arg, length) { return utils.isInstanceOf(arg, math.Vector2) && arguments.length >= length; }; /** * Fish model to disturb the water * * @param {Number | math.Vector2} x * @param {Number} y */ function fish(x, y, radius, speed) { /** * Radius of this @see fish instance * * @type {Number} */ this.radius = isValidVecArgs(x, 3) ? (radius || 1) : (y || 1); /** * Cartesian coordinate for a @see fish * * @type {math.Vector2} */ this.position = isValidVecArgs(x, 1) ? x : new math.Vector2(x, y); /** * Sets a target for the @see fish e.g food * * @type {math.Vector2} */ this.target = new math.Vector2(this.position.x, this.position.y); /** * Speed of this @see fish instance * * @type {Number} */ this.speed = isValidVecArgs(x, 4) ? (speed || 0.5) : (radius || 0.5); } /** * Define @see fish prototype */ fish.prototype = { /** * Moves the @see fish to the specified point in a given time (in seconds) * * @param {Number} x * @param {Number} y */ moveTo: function (x, y) { this.target.setX(x); this.target.setY(y); }, /** * Updates the set pixels based on the @see fish instance properties * * @param {Number} time * @param {Buffer} buffer */ update: function (time, buffer) { // default time to 1 seond time = time || 1; const target_x = this.target.x; const target_y = this.target.y; this.position.setX(math.lerp(this.position.x, target_x, (time * this.speed))); this.position.setY(math.lerp(this.position.y, target_y, (time * this.speed))); for (let index = 0; index < this.radius; index++) { buffer[Math.round(this.position.y + index)][Math.round(this.position.x + index)] = 255; } }, }; /** * Catesian coordinate to index helper function * * @param {Number} x * @param {Number} y * @param {Array} array * @returns {Any} */ const getIndexedValue = function (x, y, width, array, rgb) { const index = (y * width + x); // handle the one-dimensional spread accross the rgb space e.g Pixel 1: (255, 255, 255) Pixel 2 (0, 0, 0) if (rgb === true) { // return as 'pixel object' return { red: array[index], green: array[index + 1], blue: array[index + 2] }; } return array[index]; }; /** * Two dimensional array creation helper * * @param {Number} width * @param {Number} height * @param {Number | Array | Buffer | Image} value * @returns {Array} */ const create2DBuffer = function (width, height, value) { const temp = []; // setup buffers for (let y = 0; y < height; y++) { temp[y] = []; for (let x = 0; x < width; x++) { // attempt to get value from argument const n_value = Array.isArray(value) ? getIndexedValue(x, y, width, value, false) : value; temp[y][x] = n_value; } } return temp; }; /** * Helper for assigning the state buffers ( @see current & @see previous ) * * @param {Array | Image | Buffer} value * @param {Number} width * @param {Number} height */ const setupBuffers = function (value, width, height) { current = create2DBuffer(width, height, value); previous = create2DBuffer(width, height, value); }; /** * Periodically creates a raindrop effect * * @param {Number} delay */ const raindrop = function (delay) { const rndWidth = Math.floor(math.random(20, width - 20)); const rndHeight = Math.floor(math.random(20, height - 20)); // assign a value to a random index current[rndHeight][rndWidth] = 255; // re-initialize timer setTimeout(raindrop.bind(this), delay, delay); }; /** * Periodically steers the fishies * * @param {Number} delay */ const fishy = function (delay) { const length = fishes.length; let index = 0; // update damping for (; index < length; index++) { const fish = fishes[index]; let x = 0; let y = 0; // update fish position based either on noise or random values if (useNoise === true) { const n = simplex.noise(fish.position.x, fish.target.y); const n2 = simplex.noise(fish.position.y, fish.target.x); x = math.map(n, -1, 1, 0, width); y = math.map(n2, -1, 1, 0, height); } else { x = Math.floor(math.random(fish_radius + 1, width - fish_radius - 1)); y = Math.floor(math.random(fish_radius + 1, height - fish_radius - 1)); } fish.moveTo(x, y); } // re-initialize timer setTimeout(fishy.bind(this), delay, delay); }; /** * Return chameleon sketch template */ return { /** * Setup entry point * * @param {HTMLCanvasElement} canvas * @param {CanvasRenderingContext2D} ctx * @param {Object} options */ setup: function (canvas, options) { console.log("Setup initialized"); // add canvas mouse-move event listener canvas.onmousemove = function (event) { mouseX = event.offsetX || event.layerX; mouseY = event.offsetY || event.layerY; // update current current[mouseY][mouseX] = 255; }; width = canvas.width; height = canvas.height; // setup buffers setupBuffers(0, width, height); for (let index = 0; index < fishCount; index++) { let fish_x = Math.floor(math.random(fish_radius + 1, width - fish_radius - 1) * index); let fish_y = Math.floor(math.random(fish_radius + 1, height - fish_radius - 1) * index); fishes.push(new fish(math.Vector2(fish_x, fish_y), fish_radius, fish_speed)); } if (useNoise === true) { // setup simplex noise simplex = math.createNoise(); } // setup fishy timer fishy(550); // setup raindrop effect raindrop(550); }, /** * Main loop * * @param {HTMLCanvasElement} canvas * @param {CanvasRenderingContext2D} ctx * @param {Object} options */ loop: function (canvas, ctx, options) { ctx.fillStyle = "black"; ctx.fillRect(0, 0, canvas.width, canvas.height); angle = (angle + 1) * factor; const length = fishes.length; let index = 0; // update fishes for (; index < length; index++) { fishes[index].update(angle, current); } // get current image data from the canvas const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height); const data = imageData.data; // map out buffers into pixel array for the canvas to load for (let y = 1; y < height - 1; y++) { for (let x = 1; x < width - 1; x++) { current[y][x] = ((previous[y - 1][x] + previous[y + 1][x] + previous[y][x - 1] + previous[y][x + 1]) / 2) - current[y][x]; // add damping current[y][x] = current[y][x] * damping; // get current index as one-dimensional const index = (y * width + x) * 4; // add to image buffer data[index] = current[y][x] * 255; data[index + 1] = current[y][x] * 255; data[index + 2] = current[y][x] * 255; data[index + 3] = 255; } } // update canvas with new modified image data ctx.putImageData(imageData, 0, 0); // swap buffers let temp = previous; previous = current; current = temp; } }; };
27.186869
142
0.514676
809bdc8ab1cec14c87ff75ae322fbb81517785c1
675
js
JavaScript
qml/urlParams.js
florianwittmann/gitlovr
07aaed4c36dd3ac1639773e41080bedfdf2c8f9a
[ "MIT" ]
null
null
null
qml/urlParams.js
florianwittmann/gitlovr
07aaed4c36dd3ac1639773e41080bedfdf2c8f9a
[ "MIT" ]
9
2015-08-29T14:35:22.000Z
2015-08-29T14:43:36.000Z
qml/urlParams.js
florianwittmann/gitlovr
07aaed4c36dd3ac1639773e41080bedfdf2c8f9a
[ "MIT" ]
null
null
null
.pragma library function get_params(search_string) { var parse = function(params, pairs) { var pair = pairs[0]; var parts = pair.split('='); var key = decodeURIComponent(parts[0]); var value = decodeURIComponent(parts.slice(1).join('=')); // Handle multiple parameters of the same name if (typeof params[key] === "undefined") { params[key] = value; } else { params[key] = [].concat(params[key], value); } return pairs.length == 1 ? params : parse(params, pairs.slice(1)) } // Get rid of leading ? return search_string.length == 0 ? {} : parse({}, search_string.substr(search_string.indexOf('?')+1).split('&')); }
27
115
0.620741
809bf778b691ec4eb4b117561ca4c3701274255d
6,008
js
JavaScript
src/main/webapp/scripts/miniui/source/debug/TimeSpinner.js
xsls/jquery-miniui
ce452196c54b8b4affd17ebfc1d40c2844f83f1b
[ "Apache-2.0" ]
1
2019-10-17T08:25:46.000Z
2019-10-17T08:25:46.000Z
src/main/webapp/scripts/miniui/source/debug/TimeSpinner.js
xsls/jquery-miniui
ce452196c54b8b4affd17ebfc1d40c2844f83f1b
[ "Apache-2.0" ]
null
null
null
src/main/webapp/scripts/miniui/source/debug/TimeSpinner.js
xsls/jquery-miniui
ce452196c54b8b4affd17ebfc1d40c2844f83f1b
[ "Apache-2.0" ]
3
2020-06-30T09:41:09.000Z
2022-01-26T13:35:24.000Z
/** * 时间输入框。 * * @example * &lt;input id="tsp1" class="mini-timespinner" format="H:mm" /&gt; * * @class * @extends mini.ButtonEdit * @constructor */ mini.TimeSpinner = function() { mini.TimeSpinner.superclass.constructor.call(this); this.setValue("00:00:00") }; mini.extend(mini.TimeSpinner, mini.ButtonEdit, { value : null, format : "H:mm:ss", uiCls : "mini-timespinner", _getButtonHtml : function() { var a = "onmouseover=\"mini.addClass(this, '" + this._buttonHoverCls + "');\" onmouseout=\"mini.removeClass(this, '" + this._buttonHoverCls + "');\""; return '<span class="mini-buttonedit-button" ' + a + '><span class="mini-buttonedit-up"><span></span></span><span class="mini-buttonedit-down"><span></span></span></span>' }, _initEvents : function() { mini.TimeSpinner.superclass._initEvents.call(this); mini._BindEvents(function() { this.on("buttonmousedown", this.__OnButtonMouseDown, this); mini.on(this.el, "mousewheel", this.__OnMousewheel, this); mini.on(this._textEl, "keydown", this.__OnKeyDown, this) }, this) }, /** * * function setFormat(format) * @member mini.TimeSpinner * @param {String} format * */ setFormat : function(b) { if (typeof b != "string") { return } var a = [ "H:mm:ss", "HH:mm:ss", "H:mm", "HH:mm", "H", "HH", "mm:ss" ]; if (this.format != b) { this.format = b; this.text = this._textEl.value = this .getFormattedValue() } }, /** * * function getFormat() * @member mini.TimeSpinner * @returns {String} * */ getFormat : function() { return this.format }, /** * 设置值<br/> * function setValue(value) * @member mini.TimeSpinner * @param value * */ setValue : function(a) { a = mini.parseTime(a, this.format); if (!a) { a = null } if (mini.isDate(a)) { a = new Date(a.getTime()) } this.value = a; this.text = this._textEl.value = this .getFormattedValue(); this._valueEl.value = this.getFormValue() }, /** * 获取值<br/> * function getValue() * @member mini.TimeSpinner * */ getValue : function() { return this.value == null ? null : new Date(this.value .getTime()) }, /** * 获取表单值<br/> * function getFormValue() * @member mini.TimeSpinner * @returns {String} * */ getFormValue : function() { if (!this.value) { return "" } return mini.formatDate(this.value, this.format) }, /** * 获取格式化后的值<br/> * function getFormattedValue() * @member mini.TimeSpinner * @returns {String} * */ getFormattedValue : function() { if (!this.value) { return "" } return mini.formatDate(this.value, this.format) }, _ChangeValue : function(a, e) { var d = this.getValue(); if (d) { switch (e) { case "hours": var b = d.getHours() + a; if (b > 23) { b = 23 } if (b < 0) { b = 0 } d.setHours(b); break; case "minutes": var c = d.getMinutes() + a; if (c > 59) { c = 59 } if (c < 0) { c = 0 } d.setMinutes(c); break; case "seconds": var f = d.getSeconds() + a; if (f > 59) { f = 59 } if (f < 0) { f = 0 } d.setSeconds(f); break } } else { d = "00:00:00" } this.setValue(d) }, _SpinTimer : null, _StartSpin : function(a, f, e) { this._StopSpin(); this._ChangeValue(a, this._timeType); var d = this; var c = e; var b = new Date(); this._SpinTimer = setInterval(function() { d._ChangeValue(a, d._timeType); e--; if (e == 0 && f > 50) { d._StartSpin(a, f - 100, c + 3) } var g = new Date(); if (g - b > 500) { d._StopSpin() } b = g }, f); mini.on(document, "mouseup", this._OnDocumentMouseUp, this) }, _StopSpin : function() { clearInterval(this._SpinTimer); this._SpinTimer = null }, __OnButtonMouseDown : function(a) { this._DownValue = this.getFormValue(); this._timeType = "hours"; if (a.spinType == "up") { this._StartSpin(1, 230, 2) } else { this._StartSpin(-1, 230, 2) } }, _OnDocumentMouseUp : function(a) { this._StopSpin(); mini.un(document, "mouseup", this._OnDocumentMouseUp, this); if (this._DownValue != this.getFormValue()) { this._OnValueChanged() } }, __OnInputTextChanged : function(b) { var a = this.getFormValue(); this.setValue(this._textEl.value); if (a != this.getFormValue()) { this._OnValueChanged() } }, getAttrs : function(b) { var a = mini.TimeSpinner.superclass.getAttrs.call(this, b); mini._ParseString(b, a, [ "format" ]); return a } }); mini.regClass(mini.TimeSpinner, "timespinner");
27.18552
136
0.448735
809c04631ea761d0755aa9cda12b8a440e8348c7
1,085
js
JavaScript
CS305/W3d3/passwords.js
chadia12/chadia12.github.io
39e3200e0613705b7850371a06e9b243ee57e56c
[ "CC-BY-3.0" ]
null
null
null
CS305/W3d3/passwords.js
chadia12/chadia12.github.io
39e3200e0613705b7850371a06e9b243ee57e56c
[ "CC-BY-3.0" ]
null
null
null
CS305/W3d3/passwords.js
chadia12/chadia12.github.io
39e3200e0613705b7850371a06e9b243ee57e56c
[ "CC-BY-3.0" ]
null
null
null
"use strict"; /* exports at end of file since exporting an object, which can only be referenced after definition */ /* eslint-disable */ function askPassword(ok, fail, password) { if (password == "rockstar") { return ok(); } else { return fail(); } } let user = { name: 'John', loginOk() { return this.name + " logged in"; }, loginFail() { return this.name + " failed to log in"; }, }; function askPassword2(ok, fail, password) { if (password == "rockstar") { return ok(); } else { return fail(); } } let user2 = { name: 'John', login(result) { return this.name + (result ? ' logged in' : ' failed to log in') ; } }; //askPassword2(user2.login.bind(user2, true), user2.login.bind(user2, false) ); /* You need the module.exports when testing in node. Comment it out when you send your file to the browser */ // module.exports = {askPassword, user, askPassword2, user2 }; //add all of your function names here that you need for the node mocha tests
17.786885
139
0.592627
809cc458a284f4e9030d3917884d0ddb622776bc
2,163
js
JavaScript
renderer/screens/contacts/components/contact-info.js
serdrdoor/idena-desktop
b38436a089e6d142c09097c8deeb4c53d9c07287
[ "MIT" ]
1
2021-05-14T01:14:05.000Z
2021-05-14T01:14:05.000Z
renderer/screens/contacts/components/contact-info.js
serdrdoor/idena-desktop
b38436a089e6d142c09097c8deeb4c53d9c07287
[ "MIT" ]
null
null
null
renderer/screens/contacts/components/contact-info.js
serdrdoor/idena-desktop
b38436a089e6d142c09097c8deeb4c53d9c07287
[ "MIT" ]
null
null
null
import React from 'react' import PropTypes from 'prop-types' import {margin, padding, borderRadius, backgrounds} from 'polished' import {useTranslation} from 'react-i18next' import {SubHeading, FormGroup, Text, Box} from '../../../shared/components' import theme, {rem} from '../../../shared/theme' import Flex from '../../../shared/components/flex' import Avatar from '../../../shared/components/avatar' import useUsername from '../../../shared/hooks/use-username' import useFullName from '../../../shared/hooks/use-full-name' function ContactInfo({address, firstName, lastName, mining, showMining}) { const {t} = useTranslation() const fullName = useFullName({firstName, lastName}) const username = useUsername({address}) return ( <Flex align="center" css={{ ...margin(rem(theme.spacings.medium24), 0), }} > <Avatar username={username} /> <Box my={rem(theme.spacings.medium24)}> <SubHeading>{fullName || username}</SubHeading> <Box> <Text color={theme.colors.muted} css={{wordBreak: 'break-all'}}> {address} </Text> {showMining && ( <> <FormGroup css={margin(rem(theme.spacings.medium24), 0, 0)}> <Status mined={!mining}> {' '} {!mining ? t('Mined') : t('Mining...')}{' '} </Status> </FormGroup> </> )} </Box> </Box> </Flex> ) } ContactInfo.propTypes = { address: PropTypes.string, firstName: PropTypes.string, lastName: PropTypes.string, mining: PropTypes.bool, showMining: PropTypes.bool, } // eslint-disable-next-line react/prop-types function Status({mined, ...props}) { return ( <Text css={{ ...backgrounds( mined ? theme.colors.success02 : 'rgba(255, 163, 102, 0.12)' ), ...borderRadius('top', rem(12)), ...borderRadius('bottom', rem(12)), color: mined ? 'rgb(15, 205, 110)' : 'rgb(255, 163, 102)', ...padding(rem(theme.spacings.small8)), }} {...props} /> ) } export default ContactInfo
28.090909
75
0.570042
809d43671c899283c0f4bec04077b7b04cfafafb
416
js
JavaScript
app/containers/ProfileInfoPage/data.js
phong2397/ReactBoilerplate
c4dc17430a29d5244e4d74061d2dee5b1513fcbb
[ "MIT" ]
null
null
null
app/containers/ProfileInfoPage/data.js
phong2397/ReactBoilerplate
c4dc17430a29d5244e4d74061d2dee5b1513fcbb
[ "MIT" ]
null
null
null
app/containers/ProfileInfoPage/data.js
phong2397/ReactBoilerplate
c4dc17430a29d5244e4d74061d2dee5b1513fcbb
[ "MIT" ]
null
null
null
export const tileData = [ { img: 'https://viknews.com/vi/wp-content/uploads/2019/04/lam-lai-cmnd5.jpg', title: 'Chững minh nhân dân (mặt trước)', author: 'author', }, { img: 'https://cms.luatvietnam.vn/uploaded/Images/Original/2019/10/25/tay-not-ruoi-xoa-seo-co-phai-lam-lai-chung-minh-nhan-dan_2510140542.jpg', title: 'Chững minh nhân dân (mặt sau)', author: 'author 2', }, ];
29.714286
143
0.644231
809ec13fd69d54171264c9f709e7ac6acdfbc798
1,203
js
JavaScript
bin/cli.js
aid-lo/node-instant-http
123dc5e010d6839271e62fc9ecd35f2fa3c5dec9
[ "MIT" ]
1
2022-02-16T19:38:38.000Z
2022-02-16T19:38:38.000Z
bin/cli.js
aid-lo/xpress
123dc5e010d6839271e62fc9ecd35f2fa3c5dec9
[ "MIT" ]
null
null
null
bin/cli.js
aid-lo/xpress
123dc5e010d6839271e62fc9ecd35f2fa3c5dec9
[ "MIT" ]
null
null
null
#!/usr/bin/env node const config = { views: {} }; for (let i = 2; i < process.argv.length; i++) { switch (process.argv[i]) { case "-h": case "--handler": config.handler = process.argv[++i]; break; case "-k": case "--sslkey": config.key = process.argv[++i]; break; case "-c": case "--sslcert": config.cert = process.argv[++i]; break; case "--sslfolder": let folder = process.argv[++i]; if (!folder.endsWith("/")) folder += "/"; config.key = folder + "ssl.key"; config.cert = folder + "ssl.cert"; break; case "--view-engine": config.views.engine = process.argv[++i]; break; case "--views-directory": config.views.directory = process.argv[++i]; break; case "--trust-proxy": config.trustProxy = true; break; case "--bcrypt-bench": config.bcryptBench = true; break; case "--dotenv": config.dotenv = true; break; } } require("../index")(config);
26.152174
55
0.449709
d0e8d618c9a9e8c10430ab5da6d404db17b06c5f
2,154
js
JavaScript
public/assets/js/app.js
AndreyLuka/php-mvc
61deedd63f071cc8ac0f938b7787d7441a81dc7d
[ "MIT" ]
null
null
null
public/assets/js/app.js
AndreyLuka/php-mvc
61deedd63f071cc8ac0f938b7787d7441a81dc7d
[ "MIT" ]
null
null
null
public/assets/js/app.js
AndreyLuka/php-mvc
61deedd63f071cc8ac0f938b7787d7441a81dc7d
[ "MIT" ]
null
null
null
(function () { /** * Task Form. */ if (document.getElementById('taskPreview')) { var TaskForm = { username: document.getElementById('taskFormUsername'), email: document.getElementById('taskFormEmail'), text: document.getElementById('taskFormText'), image: document.getElementById('taskFormImage'), status: document.getElementById('taskFormStatus'), btnPreview: document.getElementById('taskFormBtnPreview'), previewId: document.getElementById('taskPreviewId'), previewUsername: document.getElementById('taskPreviewUsername'), previewEmail: document.getElementById('taskPreviewEmail'), previewText: document.getElementById('taskPreviewText'), previewImage: document.getElementById('taskPreviewImage'), previewStatus: document.getElementById('taskPreviewStatus'), init: function () { this.btnPreview.addEventListener('click', function () { this.preview(); }.bind(this)); }, previewFile: function (input, previewElement, width) { if (input.files && input.files[0]) { var fileReader = new FileReader(); fileReader.onload = function (e) { previewElement.style.width = width; previewElement.src = e.target.result; }; fileReader.readAsDataURL(input.files[0]); } }, preview: function () { this.previewId.innerText = '1'; this.previewUsername.innerText = this.username.value; this.previewEmail.innerText = this.email.value; this.previewText.innerText = this.text.value; this.previewFile(this.image, this.previewImage, '320px'); if (this.status) { this.previewStatus.innerText = this.status.checked ? 'Done' : 'Not Done'; } } }; TaskForm.init(); } })();
41.423077
93
0.549675
d0e9a22579ba01238bbd21a0ee015f44176ecda8
2,390
js
JavaScript
src/components/WorkExp.js
NateSGH/cv-project
c24b19c7f7d5872a162d7df51f1e40870991c774
[ "MIT" ]
null
null
null
src/components/WorkExp.js
NateSGH/cv-project
c24b19c7f7d5872a162d7df51f1e40870991c774
[ "MIT" ]
null
null
null
src/components/WorkExp.js
NateSGH/cv-project
c24b19c7f7d5872a162d7df51f1e40870991c774
[ "MIT" ]
null
null
null
import React from 'react'; class WorkExp extends React.Component { constructor(props) { super(props); this.state = { companyName: '', positionTitle: '', workFrom: '', workTo: '', }; this.handleInputChange = this.handleInputChange.bind(this); this.handleDeletion = this.handleDeletion.bind(this); } handleInputChange = (event) => { console.log(event.target); const target = event.target; const value = target.value; const name = target.name; this.setState({ [name]: value, }); }; handleDeletion = () => { this.props.delete('work', this.props.id); }; render() { if (this.props.submitted) { return ( <div className="work-exp"> <div className="work-info-submitted"> <p className="work-period"> {this.state.workFrom}–{this.state.workTo} </p> <p className="position-title">{this.state.positionTitle}</p> <p className="company-name">{this.state.companyName}</p> </div> </div> ); } return ( <div className="work-exp"> <label htmlFor="comp-name">Company Name:</label> <input id="comp-name" name="companyName" type="text" value={this.state.companyName} placeholder="Enter your company name" onChange={this.handleInputChange} ></input> <label htmlFor="pos-title">Position Title:</label> <input id="pos-title" name="positionTitle" type="text" value={this.state.positionTitle} placeholder="Enter your position title" onChange={this.handleInputChange} ></input> <label htmlFor="work-from">From:</label> <input id="work-from" name="workFrom" type="text" value={this.state.workFrom} onChange={this.handleInputChange} ></input> <label htmlFor="work-to">To:</label> <input id="work-to" name="workTo" type="text" value={this.state.workTo} onChange={this.handleInputChange} ></input> <button type="button" className="delete-position-btn" onClick={this.handleDeletion}> Delete </button> </div> ); } } export default WorkExp;
24.895833
92
0.548117
d0eaaa5f147a46b41d9690c5638bfcfcc754822c
2,572
js
JavaScript
manager/src/main/webapp/resources/js/group-user-menu.js
efbiz/ability-exam
e6a988fe89439df0d20c714ae0b8a01e55806e5b
[ "MIT" ]
null
null
null
manager/src/main/webapp/resources/js/group-user-menu.js
efbiz/ability-exam
e6a988fe89439df0d20c714ae0b8a01e55806e5b
[ "MIT" ]
null
null
null
manager/src/main/webapp/resources/js/group-user-menu.js
efbiz/ability-exam
e6a988fe89439df0d20c714ae0b8a01e55806e5b
[ "MIT" ]
null
null
null
$(function() { $(".jstree li a").contextMenu(user_menu.menu, { theme : 'vista' }); }); var user_menu = { menu : [{ '添加用户' : function(menuItem, menu) { user_menu.add_user(); $("#group-code").val($(this).text()); $("#group-code").data("id", $(this).parent().data("id")); } }, // $.contextMenu.separator, { '设置管理员' : function(menuItem, menu) { user_menu.grant_manager($(this).parent().data("id")); } }, { '添加组' : function(menuItem, menu) { user_menu.add_group(); $("#parent-group-code").val($(this).text()); $("#parent-group-code").data("id", $(this).parent().data("id")); } }, { '删除该组' : function(menuItem, menu) { user_menu.delete_group($(this).parent().data("id")); } },{ '查看id' : function(menuItem, menu){ alert($(this).parent().data("id")); } } ], add_user : function add_user() { $("#add-user-modal").modal(); }, add_group : function add_group() { $("#add-group-modal").modal(); }, delete_group : function delete_group(group_id) { if (confirm("确认要删除吗?")) { var request = $.ajax({ headers : { 'Accept' : 'application/json', 'Content-Type' : 'application/json' }, type : "GET", url : util.getCurrentRole() + "/delete-group/" + group_id }); request.done(function(message, tst, jqXHR) { if (!util.checkSessionOut(jqXHR)) return false; if (message.result == "success") { util.success("删除成功"); document.location.href = document.getElementsByTagName('base')[0].href + util.getCurrentRole() + '/group-user'; } else { util.error("操作失败请稍后尝试:" + message.result); } }); request.fail(function(jqXHR, textStatus) { util.error("操作失败请稍后尝试"); }); } }, grant_manager : function grant_manager(group_id) { var manager_name = prompt("输入管理员账号", ""); if ("" == manager_name ||null == manager_name|| manager_name.length > 10) return false; var request = $.ajax({ headers : { 'Accept' : 'application/json', 'Content-Type' : 'application/json' }, type : "GET", url : util.getCurrentRole() + "/grant-manager/" + group_id + "/" + manager_name }); request.done(function(message, tst, jqXHR) { if (!util.checkSessionOut(jqXHR)) return false; if (message.result == "success") { util.success("授权成功"); document.location.href = document.getElementsByTagName('base')[0].href + util.getCurrentRole() + '/group-user'; } else { util.error("操作失败请稍后尝试:" + message.result); } }); request.fail(function(jqXHR, textStatus) { util.error("操作失败请稍后尝试"); }); } };
24.037383
116
0.592535
d0ebe5b8916877db53251122afd4bebf4872a0d2
3,752
js
JavaScript
public/imageimporter/cluster.js
RanceZero/mipui
e0e8c1864f3b9ffcf7776f2447426c9acc314b69
[ "MIT" ]
96
2017-06-07T17:59:11.000Z
2022-03-28T12:40:18.000Z
public/imageimporter/cluster.js
RanceZero/mipui
e0e8c1864f3b9ffcf7776f2447426c9acc314b69
[ "MIT" ]
188
2017-06-15T03:08:45.000Z
2020-10-23T04:48:23.000Z
public/imageimporter/cluster.js
RanceZero/mipui
e0e8c1864f3b9ffcf7776f2447426c9acc314b69
[ "MIT" ]
28
2017-06-07T18:18:25.000Z
2021-11-29T18:53:26.000Z
class Cluster { constructor(cells, parent, idCallback) { this.cells_ = cells; this.parent = parent; this.idCallback_ = idCallback; this.id = idCallback(this, parent); } get size() { return this.cells.length; } get cells() { return this.cells_; } getTopClusters(k) { const clusters = this.split(k).sort((c1, c2) => c2.size - c1.size); // Split the first as long as it's guaranteed to contain a sub-cluster // larger than the second. while (clusters[0].size > 1 && clusters[0].size / k > clusters[1].size) { const numClustersBeforeSplit = clusters.length; const top = clusters.shift(); this.insertSorted_(clusters, top.split(k)); if (numClustersBeforeSplit == clusters.length) break; } return clusters; } insertSorted_(into, from) { from.forEach(fromElem => { let index = into.findIndex(intoElem => intoElem.size < fromElem.size); if (index == -1) index = into.length; into.splice(index, 0, fromElem); }); } split(k) { return this.kmeans_(k, Cluster.distances_.euclidean) .filter(x => !!x) .map((cells, index) => new Cluster(cells, this, this.idCallback_)); } // k-means implementation adapted from https://gist.github.com/tarunc/3141694 static get distances_() { return { euclidean: (v1, v2) => { let total = 0; for (let i = 0; i < v1.length; i++) { total += Math.pow(v2[i] - v1[i], 2); } return Math.sqrt(total); }, manhattan: (v1, v2) => { let total = 0; for (let i = 0; i < v1.length ; i++) { total += Math.abs(v2[i] - v1[i]); } return total; }, max: (v1, v2) => { let max = 0; for (let i = 0; i < v1.length; i++) { max = Math.max(max, Math.abs(v2[i] - v1[i])); } return max; }, }; } randomCentroids_(points, k) { const centroids = points.slice(0); // copy //centroids.sort(() => Math.round(Math.random()) - 0.5); return centroids.slice(0, k); } closestCentroid_(point, centroids, distance) { let min = Infinity; let index = 0; for (let i = 0; i < centroids.length; i++) { const dist = distance(point, centroids[i]); if (dist < min) { min = dist; index = i; } } return index; } kmeans_(k, distance) { const points = this.cells.map(obj => obj.data); const centroids = this.randomCentroids_(points, k); const assignment = new Array(points.length); const clusters = new Array(k); let movement = true; while (movement) { // update point-to-centroid assignments for (let i = 0; i < points.length; i++) { assignment[i] = this.closestCentroid_(points[i], centroids, distance); } // update location of each centroid movement = false; for (let j = 0; j < k; j++) { const assigned = []; for (let i = 0; i < assignment.length; i++) { if (assignment[i] == j) { assigned.push(this.cells[i]); } } if (!assigned.length) { continue; } const centroid = centroids[j]; const newCentroid = new Array(centroid.length); for (let g = 0; g < centroid.length; g++) { let sum = 0; for (let i = 0; i < assigned.length; i++) { sum += assigned[i].data[g]; } newCentroid[g] = sum / assigned.length; if (newCentroid[g] != centroid[g]) { movement = true; } } centroids[j] = newCentroid; clusters[j] = assigned; } } return clusters; } toString() { return this.id; } }
26.609929
79
0.537846
d0ebedcd6263d22c9e53736b501a9e27373a2568
2,718
js
JavaScript
gatsby-config.js
jeslage/pelican-bar
3b0ec4c47b97e07486301fc16a91e1af3047610c
[ "MIT" ]
1
2019-07-30T19:30:51.000Z
2019-07-30T19:30:51.000Z
gatsby-config.js
jeslage/pelican-bar
3b0ec4c47b97e07486301fc16a91e1af3047610c
[ "MIT" ]
5
2021-08-31T19:19:48.000Z
2022-02-27T10:46:41.000Z
gatsby-config.js
jeslage/pelican-bar
3b0ec4c47b97e07486301fc16a91e1af3047610c
[ "MIT" ]
null
null
null
module.exports = { plugins: [ { resolve: 'gatsby-plugin-manifest', options: { name: 'Pelican Bar', short_name: 'Pelican', start_url: '/', background_color: '#f7f0eb', theme_color: '#a2466c', display: 'standalone', icons: [ { src: `/icons/icon-72x72.png`, sizes: `72x72`, type: `image/png` }, { src: `/icons/icon-96x96.png`, sizes: `96x96`, type: `image/png` }, { src: `/icons/icon-128x128.png`, sizes: `128x128`, type: `image/png` }, { src: `/icons/icon-144x144.png`, sizes: `144x144`, type: `image/png` }, { src: `/icons/icon-152x152.png`, sizes: `152x152`, type: `image/png` }, { src: `/icons/icon-192x192.png`, sizes: `192x192`, type: `image/png` }, { src: `/icons/icon-384x384.png`, sizes: `384x384`, type: `image/png` }, { src: `/icons/icon-512x512.png`, sizes: `512x512`, type: `image/png` } ], include_favicon: true } }, { resolve: `gatsby-plugin-netlify-cms`, options: { modulePath: `${__dirname}/src/cms/cms.js` } }, { resolve: 'gatsby-source-filesystem', options: { path: `${__dirname}/static/images`, name: 'uploads' } }, { resolve: 'gatsby-source-filesystem', options: { path: `${__dirname}/src/pages/`, name: 'markdown-pages' } }, { resolve: 'gatsby-source-filesystem', options: { path: `${__dirname}/src/images`, name: 'images' } }, 'gatsby-plugin-styled-components', 'gatsby-plugin-react-helmet', 'gatsby-remark-images', 'gatsby-transformer-sharp', 'gatsby-plugin-sharp', { resolve: `gatsby-transformer-remark`, options: { plugins: [ { resolve: 'gatsby-remark-relative-images', options: { name: 'uploads' } }, { resolve: `gatsby-remark-images`, options: { maxWidth: 1120, backgroundColor: 'transparent' } }, { resolve: 'gatsby-remark-copy-linked-files', options: { destinationDir: 'static' } } ] } } ] };
22.840336
55
0.422369
d0ec1fa89f604d0aef4ed69949644099958dc36d
583
js
JavaScript
clients/web/app/js/controllers.js
panyam/msglib
d9d72d23d074b8edbd27350883504f3cae31900d
[ "Apache-2.0" ]
null
null
null
clients/web/app/js/controllers.js
panyam/msglib
d9d72d23d074b8edbd27350883504f3cae31900d
[ "Apache-2.0" ]
null
null
null
clients/web/app/js/controllers.js
panyam/msglib
d9d72d23d074b8edbd27350883504f3cae31900d
[ "Apache-2.0" ]
null
null
null
var slackAppControllers = angular.module("slackAppControllers", []); slackAppControllers.controller("ChannelListCtrl", ["$scope", "Channel", function($scope, Channel) { $scope.channels = Channel.query(); }]); slackAppControllers.controller("ChannelDetailsCtrl", ["$scope", "$routeParams", "Channel", function($scope, Channel) { $scope.Channel = Channel.get({channelId: $routeParams.channelId}, function(channel) { }); }]); slackAppControllers.controller("MessageListCtrl", ["$scope", "Channel", function($scope, Channel) { $scope.channels = []; // Channel.query(); }]);
34.294118
118
0.70669
d0ec3e0275cae7db776b279a0508c1e1a16c1596
504
js
JavaScript
node_modules/purescript-psa/output/Partial.Unsafe/index.js
smaccoun/smaccoun.github.io
92c6c0e4c7a254063d3d29989fe6fa697a43cd18
[ "Apache-2.0" ]
1
2018-07-18T08:40:50.000Z
2018-07-18T08:40:50.000Z
node_modules/purescript-psa/output/Partial.Unsafe/index.js
smaccoun/smaccoun.github.io
92c6c0e4c7a254063d3d29989fe6fa697a43cd18
[ "Apache-2.0" ]
null
null
null
node_modules/purescript-psa/output/Partial.Unsafe/index.js
smaccoun/smaccoun.github.io
92c6c0e4c7a254063d3d29989fe6fa697a43cd18
[ "Apache-2.0" ]
null
null
null
// Generated by psc version 0.10.7 // | Utilities for working with partial functions. "use strict"; var $foreign = require("./foreign"); var Partial = require("../Partial"); // | A function which crashes with the specified error message. var unsafeCrashWith = function (msg) { return $foreign.unsafePartial(function (dictPartial) { return Partial.crashWith(dictPartial)(msg); }); }; module.exports = { unsafeCrashWith: unsafeCrashWith, unsafePartial: $foreign.unsafePartial };
28
63
0.706349
d0ed4a42324246ffb087fad986ef90be51771bde
769
js
JavaScript
Practicas/Practica-6/Codigos/PROC_SEG_ModSecu_relI/documentacio/html/search/files_3.js
carlotacb/ACAP
4b1fd693f67cee47ab4cc3ac72707dbc2d1fd5b8
[ "MIT" ]
null
null
null
Practicas/Practica-6/Codigos/PROC_SEG_ModSecu_relI/documentacio/html/search/files_3.js
carlotacb/ACAP
4b1fd693f67cee47ab4cc3ac72707dbc2d1fd5b8
[ "MIT" ]
null
null
null
Practicas/Practica-6/Codigos/PROC_SEG_ModSecu_relI/documentacio/html/search/files_3.js
carlotacb/ACAP
4b1fd693f67cee47ab4cc3ac72707dbc2d1fd5b8
[ "MIT" ]
null
null
null
var searchData= [ ['deco_5fexcep_2evhd',['deco_excep.vhd',['../deco__excep_8vhd.html',1,'']]], ['decocamino_5fmodsecu_5freli_2evhd',['decocamino_ModSecu_relI.vhd',['../decocamino__ModSecu__relI_8vhd.html',1,'']]], ['decodificador_5fmodsecu_5freli_2evhd',['decodificador_ModSecu_relI.vhd',['../decodificador__ModSecu__relI_8vhd.html',1,'']]], ['decoopalu_2evhd',['decoopALU.vhd',['../decoopALU_8vhd.html',1,'']]], ['decoopmd_2evhd',['decoopMD.vhd',['../decoopMD_8vhd.html',1,'']]], ['decoopsec_5freli_2evhd',['decoopSEC_relI.vhd',['../decoopSEC__relI_8vhd.html',1,'']]], ['decopbropsec_5fmodsecu_5freli_2evhd',['decoPBRopSEC_ModSecu_relI.vhd',['../decoPBRopSEC__ModSecu__relI_8vhd.html',1,'']]], ['decs_2evhd',['DECS.vhd',['../DECS_8vhd.html',1,'']]] ];
64.083333
129
0.710013