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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c18a0202eb74f4e4df865dee6e2e00c8fbc4fa03 | 2,413 | js | JavaScript | Superbadge/force-app/main/default/lwc/boatAddReviewForm/boatAddReviewForm.js | 75asa/lwcSuperBadgeTrail | 9187c65da56779d9365fbcd05252dbeaa713869a | [
"MIT"
] | null | null | null | Superbadge/force-app/main/default/lwc/boatAddReviewForm/boatAddReviewForm.js | 75asa/lwcSuperBadgeTrail | 9187c65da56779d9365fbcd05252dbeaa713869a | [
"MIT"
] | null | null | null | Superbadge/force-app/main/default/lwc/boatAddReviewForm/boatAddReviewForm.js | 75asa/lwcSuperBadgeTrail | 9187c65da56779d9365fbcd05252dbeaa713869a | [
"MIT"
] | null | null | null | import { api, LightningElement } from 'lwc';
// imports
import BOAT_REVIEW_OBJECT from '@salesforce/schema/BoatReview__c';
import NAME_FIELD from '@salesforce/schema/BoatReview__c.Name';
import COMMENT_FIELD from '@salesforce/schema/BoatReview__c.Comment__c';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
const SUCCESS_TITLE = 'Review Created!';
const SUCCESS_VARIANT = 'success';
export default class BoatAddReviewForm extends LightningElement {
// Private
boatId;
rating;
boatReviewObject = BOAT_REVIEW_OBJECT;
nameField = NAME_FIELD;
commentField = COMMENT_FIELD;
labelSubject = 'Review Subject';
labelRating = 'Rating';
// Public Getter and Setter to allow for logic to run on recordId change
@api
get recordId() {
return this.boatId;
}
set recordId(value) {
//sets boatId attribute
this.setAttribute('boatId', value);
//sets boatId assignment
this.boatId = value;
}
// Gets user rating input from stars component
handleRatingChanged(event) {
this.rating = event.detail.rating;
}
// Custom submission handler to properly set Rating
// This function must prevent the anchor element from navigating to a URL.
// form to be submitted: lightning-record-edit-form
handleSubmit(event) {
event.preventDefault();
const fields = event.detail.fields;
fields.Rating__c = this.rating;
fields.Boat__c = this.boatId;
this.template.querySelector('lightning-record-edit-form').submit(fields);
}
// Shows a toast message once form is submitted successfully
// Dispatches event when a review is created
handleSuccess() {
// TODO: dispatch the custom event and show the success message
const toast = new ShowToastEvent({
title: SUCCESS_TITLE,
variant: SUCCESS_VARIANT,
});
this.dispatchEvent(toast);
this.handleReset();
const createReviewEvent = new CustomEvent('createreview');
this.dispatchEvent(createReviewEvent);
}
// Clears form data upon submission
// TODO: it must reset each lightning-input-field
handleReset() {
const inputFields = this.template.querySelectorAll('lightning-input-field');
if (inputFields) {
inputFields.forEach(field => { field.reset(); });
}
}
}
| 33.054795 | 84 | 0.673436 |
c18baedb00f9a907ecd0327a45fb6c48447f7a67 | 248 | js | JavaScript | src/components/dashboard/mainContent/staffDuty.js | bankoleoye/DecamealFrontend | a6f69108063fc6af858386a5bde3b87d55eb0f7d | [
"MIT"
] | null | null | null | src/components/dashboard/mainContent/staffDuty.js | bankoleoye/DecamealFrontend | a6f69108063fc6af858386a5bde3b87d55eb0f7d | [
"MIT"
] | null | null | null | src/components/dashboard/mainContent/staffDuty.js | bankoleoye/DecamealFrontend | a6f69108063fc6af858386a5bde3b87d55eb0f7d | [
"MIT"
] | null | null | null | import { Box } from "@mui/material";
const StaffDuty = () => {
return (
<Box
style={{
display: "flex",
padding: "1em",
backgroundColor: "yellow",
}}
>STAFFDUTY</Box>
);
};
export default StaffDuty;
| 15.5 | 36 | 0.516129 |
c18bd1452224fa1b5dafd0ff997b6aa31752ce7e | 131 | js | JavaScript | client/music.js | carlosbkm/bukisync-starter | aa3391e2ffe7c9b1a4f35f893ef5db92c89e7c7d | [
"MIT"
] | null | null | null | client/music.js | carlosbkm/bukisync-starter | aa3391e2ffe7c9b1a4f35f893ef5db92c89e7c7d | [
"MIT"
] | null | null | null | client/music.js | carlosbkm/bukisync-starter | aa3391e2ffe7c9b1a4f35f893ef5db92c89e7c7d | [
"MIT"
] | null | null | null | // Polymer body fixes
Meteor.startup(function() {
$('body').attr('class', 'fullbleed layout vertical');
});
var app = $('#app'); | 21.833333 | 55 | 0.625954 |
c18c52a90a388770b3ff2a2e3f2b4f76c9990372 | 5,519 | js | JavaScript | index.js | akoskm/eslint-config-shyp | c7ada6eb7f496721a62b3ee9eabc975baf87b28c | [
"MIT"
] | null | null | null | index.js | akoskm/eslint-config-shyp | c7ada6eb7f496721a62b3ee9eabc975baf87b28c | [
"MIT"
] | 8 | 2016-02-08T23:24:50.000Z | 2018-03-12T21:18:56.000Z | index.js | akoskm/eslint-config-shyp | c7ada6eb7f496721a62b3ee9eabc975baf87b28c | [
"MIT"
] | 4 | 2015-11-27T21:17:50.000Z | 2018-06-03T09:31:31.000Z | // Rules are grouped by the same sections as http://eslint.org/docs/rules/
const possibleErrors = {
// Disallow the use of `console`
'no-console': 2,
// Ensure objects do not contain duplicate keys
'no-dupe-keys': 2,
// No multiline statements that look like separate statements
'no-unexpected-multiline': 2
};
const bestPractices = {
// Require curly braces around multi-line blocks
curly: [2, 'multi-line'],
// Use dot notation wherever possible
'dot-notation': 2,
// Use === and !== in all cases
eqeqeq: 2,
// Do not use arguments.caller / arguments.callee
'no-caller': 2,
// Disallow lexical declarations in case clauses
'no-case-declarations': 2,
// Do not use `eval`
'no-eval': 2,
// Empty Block Statements
'no-empty': 2,
// Do not extend native/builtin objects
'no-extend-native': 2,
// Do not use `bind` unnecessarily
'no-extra-bind': 2,
// Allow the use of fallthrough in switch statements
'no-fallthrough': 0,
// No leading or trailing decimal points in numeric literals
'no-floating-decimal': 2,
// No short-notation coercion (e.g. with `~` or `!!`)
'no-implicit-coercion': 2,
// No siblings of `eval` (e.g. `new Function('..')`)
'no-implied-eval': 2,
// No multiple spaces (except indentation)
'no-multi-spaces': 2,
// No reassigning native/builtin objects
'no-native-reassign': 2,
// No unused expressions (e.g. `"Hello world";` )
'no-unused-expressions': [2, { allowShortCircuit: true, allowTernary: true }],
// No `with` statements
'no-with': 2
};
const strict = {
strict: [2, 'global']
};
const variables = {
// No deleting variables
'no-delete-var': 2,
// No shadowing restricted names (e.g. `arguments`)
'no-shadow-restricted-names': 2,
// No shadowing variables declared in the outer scope
'no-shadow': 2,
// No initializing variables to `undefined
'no-undef-init': 2,
// No using variables before they're defined, except function declarations
'no-use-before-define': [2, 'nofunc']
};
const node = {
};
const stylistic = {
// Avoid leading/trailing spaces in arrays
'array-bracket-spacing': 2,
// Use leading/trailing spaces within blocks
'block-spacing': 2,
// Use One True Brace Style, with single-line blocks allowed
'brace-style': [2, '1tbs', { allowSingleLine: true }],
// Use camelCase variable naming
camelcase: 2,
// Use spaces after commas, not before
'comma-spacing': 2,
// Use commas are at the end of the line, not the beginning
'comma-style': 2,
// Use a line terminator at the end of every file
'eol-last': 2,
// Two-space indentation, always
indent: [2, 2, {SwitchCase: 1}],
// Use whitespace after colons in object keys
'key-spacing': 2,
// Disallow `continue`
'no-continue': 2,
// Disallow `if` as the only statement in an `else` block
'no-lonely-if': 2,
// No mixing tabs and spaces
'no-mixed-spaces-and-tabs': 2,
// No spaces in function calls
'no-spaced-func': 2,
// No trailing spaces at the end of the line
'no-trailing-spaces': 2,
// Allow dangling underscores
'no-underscore-dangle': 0,
// Always use spaces inside of curly braces
'object-curly-spacing': [2, 'always'],
// No combining `var` declarations
'one-var': [2, 'never'],
// No quotes around keys when unnecessary
'quote-props': [2, 'as-needed'],
// Strings are single-quoted, unless doing so would require escaping
quotes: [2, 'single', 'avoid-escape'],
// No spaces before semicolons; always spaces after
'semi-spacing': 2,
// Always use semicolons
semi: 2,
// Always use a space before and after keywords
'keyword-spacing': [2, { 'before': true, 'after': true, 'overrides': {
'return': { 'after': true },
'throw': { 'after': true },
'case': { 'after': true }
}}],
// Disallow space before function parentheses
'space-before-function-paren': [2, 'never'],
// Never use leading/trailing spaces in parentheses
'space-in-parens': 2,
// Use spaces around infix operators
'space-infix-ops': 2,
// Use spaces following unary operators (e.g. `new`)
'space-unary-ops': 2,
// No trailing/dangling commas on multi-line objects and arrays
'comma-dangle': [2, 'never']
};
const es6 = {
// Use spaces around arrows
'arrow-spacing': 2,
// Require parentheses around arrow-function arguments
'arrow-parens': 2,
// Ensure `super()` is used in subclasses
'constructor-super': 2,
// Ensure the generator asterisk is after the space
'generator-star-spacing': 2,
// Do not overwrite class definitions
'no-class-assign': 2,
// Do not modify variables declared with `const`
'no-const-assign': 2,
// Don't duplicate class members
'no-dupe-class-members': 2,
// Don't refer to `this` before calling `super()` in constructors
'no-this-before-super': 2,
// Always use object shorthand whevener possible
'object-shorthand': [2, 'always'],
// Use `const` whenever a variable is not modified
'prefer-const': 2,
// Don't use `apply` where the spread operator could be used instead
'prefer-spread': 2,
// Do not use `var`
'no-var': 2
};
const cruft = {
// don't allow `.only` in tests
'mocha/no-exclusive-tests': 2
};
module.exports = {
extends: ['eslint:recommended'],
env: {
browser: true,
node: true,
jasmine: true,
es6: true
},
plugins: [
'mocha'
],
rules: Object.assign({}, possibleErrors, bestPractices, strict, variables, stylistic, node, es6, cruft)
};
| 22.618852 | 105 | 0.653379 |
c18d3e6a599994de96f3a776818d65d9d5f1cc4d | 142 | js | JavaScript | packages/project-utils/bundling/function/index.js | bluengreen/webiny-js | 11c9c4ee50f739604a4488b9ce189d2af92bca5b | [
"MIT"
] | 6 | 2021-12-29T06:57:33.000Z | 2022-03-16T10:21:42.000Z | packages/project-utils/bundling/function/index.js | bluengreen/webiny-js | 11c9c4ee50f739604a4488b9ce189d2af92bca5b | [
"MIT"
] | 1 | 2022-01-05T00:56:15.000Z | 2022-01-05T00:56:35.000Z | packages/project-utils/bundling/function/index.js | bluengreen/webiny-js | 11c9c4ee50f739604a4488b9ce189d2af92bca5b | [
"MIT"
] | 1 | 2022-02-17T08:20:40.000Z | 2022-02-17T08:20:40.000Z | module.exports.createBuildFunction = require("./createBuildFunction");
module.exports.createWatchFunction = require("./createWatchFunction");
| 47.333333 | 70 | 0.816901 |
c18e23e89d4ba51e8243c371effd5ea0284ef95d | 951 | js | JavaScript | src/components/Header.js | weeb-anime/weeb-front-end | d8e79f302bfdb34825b33392ddfbb284a10ef704 | [
"MIT"
] | null | null | null | src/components/Header.js | weeb-anime/weeb-front-end | d8e79f302bfdb34825b33392ddfbb284a10ef704 | [
"MIT"
] | 8 | 2021-10-05T05:07:34.000Z | 2021-10-08T16:46:11.000Z | src/components/Header.js | weeb-anime/weeb-front-end | d8e79f302bfdb34825b33392ddfbb284a10ef704 | [
"MIT"
] | null | null | null | import { Component } from 'react';
import Navbar from 'react-bootstrap/Navbar';
import NavItem from 'react-bootstrap/NavItem';
import { Link } from 'react-router-dom';
import Container from 'react-bootstrap/Container';
import LogoutButton from './LogoutButton';
import './SuggestAnime.css'
class Header extends Component {
render() {
return (
<Navbar bg="dark" variant="dark">
<Container>
<NavItem>
<Link to="/" className="nav-link">
Home
</Link>
</NavItem>
<NavItem>
<Link to="/profile" className="nav-link">
Profile
</Link>
</NavItem>
<NavItem>
<Link to="/about" className="nav-link">
About
</Link>
</NavItem>
<NavItem>
<LogoutButton />
</NavItem>
</Container>
</Navbar>
);
}
}
export default Header;
| 24.384615 | 53 | 0.527865 |
c18f0ea17389c000d9c7737fd0a37d1f4aa9ce80 | 703 | js | JavaScript | packages/babel-helper-create-class-features-plugin/src/typescript.js | wuweiweiwu/babel | 296d8ce179cac84f981933efcd892ec0c6e2a93b | [
"MIT"
] | 15 | 2021-04-05T23:08:24.000Z | 2022-03-30T08:17:02.000Z | packages/babel-helper-create-class-features-plugin/src/typescript.js | wuweiweiwu/babel | 296d8ce179cac84f981933efcd892ec0c6e2a93b | [
"MIT"
] | 137 | 2018-12-15T21:01:14.000Z | 2020-06-09T01:19:19.000Z | packages/babel-helper-create-class-features-plugin/src/typescript.js | wuweiweiwu/babel | 296d8ce179cac84f981933efcd892ec0c6e2a93b | [
"MIT"
] | 7 | 2019-10-16T21:49:49.000Z | 2021-05-21T09:48:59.000Z | // @flow
import type { NodePath } from "@babel/traverse";
export function assertFieldTransformed(path: NodePath) {
// TODO (Babel 8): Also check path.node.definite
if (path.node.declare) {
throw path.buildCodeFrameError(
`TypeScript 'declare' fields must first be transformed by ` +
`@babel/plugin-transform-typescript.\n` +
`If you have already enabled that plugin (or '@babel/preset-typescript'), make sure ` +
`that it runs before any plugin related to additional class features:\n` +
` - @babel/plugin-proposal-class-properties\n` +
` - @babel/plugin-proposal-private-methods\n` +
` - @babel/plugin-proposal-decorators`,
);
}
}
| 35.15 | 95 | 0.661451 |
c190797ff5777788dea74564baf82859986b9363 | 1,023 | js | JavaScript | src/components/buttonLink.js | dattran1999/the-daily-consults-blog | a2236e29699e09bfd3e4dab1775920b528ec8683 | [
"RSA-MD"
] | null | null | null | src/components/buttonLink.js | dattran1999/the-daily-consults-blog | a2236e29699e09bfd3e4dab1775920b528ec8683 | [
"RSA-MD"
] | null | null | null | src/components/buttonLink.js | dattran1999/the-daily-consults-blog | a2236e29699e09bfd3e4dab1775920b528ec8683 | [
"RSA-MD"
] | null | null | null | import React from 'react';
import styled from 'styled-components';
import { colors } from '../theme';
const ButtonLink = ({ children, type, ...rest }) => {
return (
<a {...rest}>
<Button type={type} colors={colors}>
{children}
</Button>
</a>
)
}
const Button = styled.div`
/* width: 200px; */
height: 40px;
border-radius: 5px;
padding: 10px 25px;
white-space: nowrap;
display: flex;
justify-content: center;
align-items: center;
background-color: ${props =>
(props.type === 'attention' && 'var(--orange)') ||
(props.type === 'primary' && props.colors.yellow) ||
(props.type === 'secondary' && props.colors.black)
};
color: ${props =>
(props.type === 'attention' && 'var(--black)') ||
(props.type === 'primary' && props.colors.black) ||
(props.type === 'secondary' && props.colors.white)
};
font-weight: ${props => props.type === 'attention' && 'var(--fontWeight-bold)'};
:hover {
cursor: pointer;
}
`;
export default ButtonLink;
| 24.357143 | 82 | 0.5826 |
c19127706f64423875c7c1c12b8141c0e2f5e1bc | 600 | js | JavaScript | src/syntax/operator.js | ChizoDev/Keiryo | 0873fb49e975d3952e26399f0ea0ad6c976004a7 | [
"MIT"
] | null | null | null | src/syntax/operator.js | ChizoDev/Keiryo | 0873fb49e975d3952e26399f0ea0ad6c976004a7 | [
"MIT"
] | null | null | null | src/syntax/operator.js | ChizoDev/Keiryo | 0873fb49e975d3952e26399f0ea0ad6c976004a7 | [
"MIT"
] | null | null | null | /* Operators */
export const operator = new Map([
['~', 'Tilde'],
['!', 'Not'],
['@', 'At'],
['$', 'Dollar'],
['%', 'Percent'],
['^', 'Caret'],
['&', 'And'],
['*', 'Star'],
['(', 'ParenL'],
[')', 'ParenR'],
['-', 'Minus'],
['+', 'Plus'],
['=', 'Equal'],
['{', 'CurlyL'],
['}', 'CurlyR'],
['[', 'SquareL'],
[']', 'SquareR'],
['|', 'Pipe'],
[':', 'Colon'],
[';', 'Semi'],
['<', 'Less'],
['>', 'More'],
[',', 'Comma'],
['.', 'Dot'],
['?', 'Question'],
['/', 'SlashF']
]); | 20.689655 | 34 | 0.273333 |
c1913998d5ab5633fd24887e295a6f0954a0fd63 | 372 | js | JavaScript | api/test/pretest/reset_collections.js | RobinJayaswal/18w-si32 | e5ae486c916e356d187b74a97ab4d8a6072cfba6 | [
"MIT"
] | 3 | 2018-02-24T06:33:50.000Z | 2018-04-26T20:14:19.000Z | api/test/pretest/reset_collections.js | RobinJayaswal/18w-si32 | e5ae486c916e356d187b74a97ab4d8a6072cfba6 | [
"MIT"
] | 199 | 2018-02-22T22:58:04.000Z | 2022-03-25T18:25:05.000Z | api/test/pretest/reset_collections.js | dartmouth-cs98/18w-si32 | e5ae486c916e356d187b74a97ab4d8a6072cfba6 | [
"MIT"
] | 1 | 2020-04-26T02:57:26.000Z | 2020-04-26T02:57:26.000Z | const models = require("../../app/models");
const Promise = require("bluebird");
module.exports = function() {
/***** DROP ALL COLLECTIONS ******/
return Promise.map(Object.keys(models), model => {
return new Promise((resolve, reject) => {
models[model].remove({}, function(err) {
if (err) reject(err);
resolve();
});
});
});
};
| 24.8 | 52 | 0.55914 |
c1915aad9cbdbfa77f3cfaae8e02aa2f5656342c | 551 | js | JavaScript | components/Paragraph/Paragraph.js | packedmess/chillicode | 0dcb613f7280776137ae48715c1c8fd0cac5f38c | [
"MIT"
] | 1 | 2022-03-09T00:04:46.000Z | 2022-03-09T00:04:46.000Z | components/Paragraph/Paragraph.js | packedmess/chillicode | 0dcb613f7280776137ae48715c1c8fd0cac5f38c | [
"MIT"
] | null | null | null | components/Paragraph/Paragraph.js | packedmess/chillicode | 0dcb613f7280776137ae48715c1c8fd0cac5f38c | [
"MIT"
] | null | null | null | // Vendor
import PropTypes from 'prop-types';
import cn from 'classnames';
// Internals
import style from './style.module.scss';
function Paragraph({children, gutterBottom, ...props}) {
const classes = cn({
[style.Paragraph]: true,
[style.gutterBottom]: gutterBottom,
});
return (
<p className={classes} {...props}>
{children}
</p>
);
}
Paragraph.defaultProps = {
gutterBottom: false,
};
Paragraph.propTypes = {
children: PropTypes.string.isRequired,
gutterBottom: PropTypes.bool,
};
export default Paragraph;
| 18.366667 | 56 | 0.673321 |
c191e25e4aeb820d5ac853ced60c6348b5420522 | 958 | js | JavaScript | SPAWithAngularJS/module2/module2-solution/js/app.shoppingListCheckOffService.js | var-bin/angularjs-training | 47761cb29be9487e3198b90bcf91ca5a1cf98aa0 | [
"MIT"
] | 1 | 2018-09-25T01:05:15.000Z | 2018-09-25T01:05:15.000Z | SPAWithAngularJS/module2/module2-solution/js/app.shoppingListCheckOffService.js | var-bin/angularjs-training | 47761cb29be9487e3198b90bcf91ca5a1cf98aa0 | [
"MIT"
] | 1 | 2017-06-26T11:08:31.000Z | 2017-06-26T11:10:29.000Z | SPAWithAngularJS/module2/module2-solution/js/app.shoppingListCheckOffService.js | var-bin/angularjs-training | 47761cb29be9487e3198b90bcf91ca5a1cf98aa0 | [
"MIT"
] | null | null | null | // app.shoppingListCheckOffService.js
(function() {
"use strict";
angular.module("ShoppingListCheckOff")
.service("ShoppingListCheckOffService", ShoppingListCheckOffService);
function ShoppingListCheckOffService() {
let service = this;
let toBuyItems = [
{
name: "cookies",
quantity: 10
},
{
name: "sugar drinks",
quantity: 5
},
{
name: "chips",
quantity: 3
}
];
let boughtItems = [];
service.getToBuyItems = getToBuyItems;
service.bought = bought;
service.addToBoughtItems = addToBoughtItems;
service.getBoughtItems = getBoughtItems;
function getToBuyItems() {
return toBuyItems;
}
function bought(itemIndex) {
toBuyItems.splice(itemIndex, 1);
}
function addToBoughtItems(item) {
boughtItems.push(item);
}
function getBoughtItems() {
return boughtItems;
}
}
})();
| 19.16 | 73 | 0.605428 |
c1931fa8b8191e9442ac1263dc29bfe45fecef17 | 2,478 | js | JavaScript | src/components/Navigation.js | goleedev/ohsung-realestate | 0a8f6018e238259546ebc562e69763b224f2d633 | [
"MIT"
] | null | null | null | src/components/Navigation.js | goleedev/ohsung-realestate | 0a8f6018e238259546ebc562e69763b224f2d633 | [
"MIT"
] | null | null | null | src/components/Navigation.js | goleedev/ohsung-realestate | 0a8f6018e238259546ebc562e69763b224f2d633 | [
"MIT"
] | null | null | null | import React from 'react'
import { Link } from 'react-router-dom';
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faPhoneVolume } from "@fortawesome/free-solid-svg-icons";
import { Nav } from "react-bootstrap";
import './Navigation.css';
const Navigation = () => {
function openNav() {
document.getElementById("mySidenav").style.width = "300px";
document.getElementById("main").style.marginLeft = "300px";
};
function closeNav() {
document.getElementById("mySidenav").style.width = "0";
document.getElementById("main").style.marginLeft= "0";
};
return (
<div className="container">
<a className="navbar-brand" href="/">
<h1>오성 부동산</h1>
</a>
<Nav className="nav-items">
<Nav.Item>
<Link className="nav-link" to="/about">오성부동산 소개</Link>
</Nav.Item>
<Nav.Item>
<Link className="nav-link" to="/youtube">오성TV</Link>
</Nav.Item>
<Nav.Item>
<Link className="nav-link" to="/search">매물검색</Link>
</Nav.Item>
<Nav.Item>
<Link className="nav-link" to="/contact">문의하기</Link>
</Nav.Item>
<Nav.Item>
<a href="tel:0415233303" className="nav-link nav-phone">
<FontAwesomeIcon icon={faPhoneVolume} />
<span>041-523-3303</span>
</a>
</Nav.Item>
</Nav>
<div id="mySidenav" className="sidenav">
{/* // eslint-disable-next-line */}
<a className="nav-link" href="javascript:void(0)" className="closebtn" onClick={closeNav}>×</a>
<Link className="nav-link" to="/about">오성부동산 소개</Link>
<Link className="nav-link" to="/youtube">오성TV</Link>
<Link className="nav-link" to="/search">매물검색</Link>
<Link className="nav-link" to="/contact">문의하기</Link>
<a href="tel:0415233303" className="nav-link nav-phone">
<FontAwesomeIcon icon={faPhoneVolume} />
<span>041-523-3303</span>
</a>
</div>
<div id="main">
<span onClick={openNav}>☰</span>
</div>
</div>
);
};
export default Navigation;
| 39.967742 | 111 | 0.5 |
c1944bb8b9fa9745c32d167937e7445efb6c7bf4 | 620 | js | JavaScript | src/firebase.js | stackbit-projects/school-amadodedios-b2ff2 | 345abde333e5223f4ec148e4f77af814943863f7 | [
"MIT"
] | null | null | null | src/firebase.js | stackbit-projects/school-amadodedios-b2ff2 | 345abde333e5223f4ec148e4f77af814943863f7 | [
"MIT"
] | 1 | 2021-02-18T03:21:18.000Z | 2021-02-18T03:21:18.000Z | src/firebase.js | stackbit-projects/school-amadodedios-b2ff2 | 345abde333e5223f4ec148e4f77af814943863f7 | [
"MIT"
] | null | null | null | import firebase from "firebase/app";
import 'firebase/firestore'
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseConfig = {
apiKey: "AIzaSyCUZjzSGs66N4YIKksu-z-hX28nkLVAuig",
authDomain: "amado-de-dios.firebaseapp.com",
databaseURL: "https://amado-de-dios.firebaseio.com",
projectId: "amado-de-dios",
storageBucket: "amado-de-dios.appspot.com",
messagingSenderId: "172807138150",
appId: "1:172807138150:web:d22e34f2d811123f05f6a7",
measurementId: "G-DHW76HZGBS"
};
const fb = firebase.initializeApp(firebaseConfig);
export const db = fb.firestore(); | 36.470588 | 67 | 0.737097 |
c1950b53be31b12009aa0e6420cf4bc50ad389fb | 2,640 | js | JavaScript | app.js | Ssysshy/garage-back | 28aa979ba75b2ffca52d637d53c0363369e25554 | [
"MIT"
] | null | null | null | app.js | Ssysshy/garage-back | 28aa979ba75b2ffca52d637d53c0363369e25554 | [
"MIT"
] | null | null | null | app.js | Ssysshy/garage-back | 28aa979ba75b2ffca52d637d53c0363369e25554 | [
"MIT"
] | null | null | null | const express = require('express');
const createError = require('http-errors');
const path = require('path');
// 日志记录
const logger = require('morgan');
const fs = require('fs');
const FileStreamRotator = require('file-stream-rotator');
// cookie储存
const cookieParser = require('cookie-parser');
const bodyParser = require('body-parser');
const index = require('./routes/index');
const users = require('./routes/users');
const news = require('./routes/news');
const cate = require('./routes/cate');
const comment = require('./routes/comment');
const upload = require('./routes/upload');
const product = require('./routes/product');
const occupy = require('./routes/occupy');
const disk = require('./routes/disk');
import './plugin/mongodbClient';
const app = express();
// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.engine('html', require('ejs').__express);
app.set('view engine', 'ejs');
// uncomment after placing your favicon in /public
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'static')));
app.use(express.static(path.join(__dirname, 'uploads')));
// logger path set
const logDirectory = __dirname + '/logs';
// ensure log directory exists
fs.existsSync(logDirectory) || fs.mkdirSync(logDirectory)
// create a rotating write stream
const accessLogStream = FileStreamRotator.getStream({
filename: logDirectory + '/access-%DATE%.log',
frequency: 'daily',
verbose: false
});
// setup the logger
app.use(logger('combined', {stream: accessLogStream}));
app.all('*', function (req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
//Access-Control-Allow-Headers ,可根据浏览器的F12查看,把对应的粘贴在这里就行
res.header('Access-Control-Allow-Headers', 'Content-Type');
res.header('Access-Control-Allow-Methods', '*');
res.header('Content-Type', 'application/json;charset=utf-8');
next();
});
app.use('/', index);
app.use('/users', users);
app.use('/news', news);
app.use('/cate', cate);
app.use('/comment', comment);
app.use('/upload', upload);
app.use('/product', product);
app.use('/occupy', occupy);
app.use('/disk', disk);
// catch 404 and forward to error handler
app.use(function(req, res, next) {
next(createError(404));
});
// error handler
app.use(function(err, req, res, next) {
// set locals, only providing error in development
res.locals.message = err.message;
res.locals.error = req.app.get('env') === 'development' ? err : {};
// render the error page
res.status(err.status || 500);
res.render('error');
});
module.exports = app;
| 29.333333 | 69 | 0.691667 |
c195dc360d746e56a941572c7ff6db4776c2564c | 315 | js | JavaScript | Oasis.js | civ-clone/base-terrain-feature-oasis | e7d7c83fe8017dfb8adea30d974167189ced66a3 | [
"MIT"
] | null | null | null | Oasis.js | civ-clone/base-terrain-feature-oasis | e7d7c83fe8017dfb8adea30d974167189ced66a3 | [
"MIT"
] | null | null | null | Oasis.js | civ-clone/base-terrain-feature-oasis | e7d7c83fe8017dfb8adea30d974167189ced66a3 | [
"MIT"
] | null | null | null | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Oasis = void 0;
const TerrainFeature_1 = require("@civ-clone/core-terrain-feature/TerrainFeature");
class Oasis extends TerrainFeature_1.default {
}
exports.Oasis = Oasis;
exports.default = Oasis;
//# sourceMappingURL=Oasis.js.map | 35 | 83 | 0.768254 |
c19651b5dfab4b382ba23906eea4aae00cabe45d | 18,838 | js | JavaScript | app/scenes/checkoutScreen/container/index.js | Freediees/tractogo | 901f43b5287406cb331334ee567f340656fc27a9 | [
"MIT"
] | null | null | null | app/scenes/checkoutScreen/container/index.js | Freediees/tractogo | 901f43b5287406cb331334ee567f340656fc27a9 | [
"MIT"
] | null | null | null | app/scenes/checkoutScreen/container/index.js | Freediees/tractogo | 901f43b5287406cb331334ee567f340656fc27a9 | [
"MIT"
] | null | null | null | /* eslint-disable react/prop-types */
import React, { useState, useEffect, useCallback } from 'react'
import { connect } from 'react-redux'
import { PropTypes } from 'prop-types'
import I18n from 'react-native-i18n'
import Moment from 'moment'
import { Alert } from 'react-native'
import CheckoutScreenActions from 'scenes/checkoutScreen/store/actions'
import CartScreenActions from 'scenes/cartScreen/store/actions'
import Checkout from 'components/organism/checkOutScreen'
import AsyncStorage from '@react-native-community/async-storage'
import {
saveFilterFunc,
saveFilterObject,
getFilterObject,
pad,
getUserProfileObject,
} from 'function'
import {
CAR_RENTAL,
AIRPORT_TRANSFER,
BUS_RENTAL,
SERVICE_ID_SELF_DRIVE,
SERVICE_ID_WITH_DRIVER,
RENTAL_TIMEBASE,
} from 'config'
export function useForceUpdate() {
const [, setTick] = useState(0)
const update = useCallback(() => {
setTick((tick) => tick + 1)
}, [])
return update
}
const CheckoutScreen = ({
navigation,
postCheckout,
postCheckoutIsLoading,
postCheckoutErrorMessage,
postCheckoutSuccessMessage,
postCheckoutWithoutCart,
postCheckoutWithoutCartIsLoading,
postCheckoutWithoutCartErrorMessage,
postCheckoutWithoutCartSuccessMessage,
paymentMethods,
paymentMethodsIsLoading,
paymentMethodsErrorMessage,
fetchPaymentMethods,
selectedPayment,
changeSelectedPayment,
cartItems,
changeCartItems,
checkoutValidationIsLoading,
checkoutValidationErrorMessage,
checkoutValidation,
checkVoucher,
checkVoucherIsLoading,
checkVoucherErrorMessage,
checkVoucherSuccessMessage,
paymentDetailItems,
paymentDetailItemsTemp,
changePaymentDetailItems,
changePaymentDetailItemsTemp,
checkVoucherFailure,
resetVoucher,
total,
changeTotal,
}) => {
const forceUpdate = useForceUpdate()
const { checkout, cartItem } = navigation.state.params
const [voucherValue, changeVoucherValue] = useState('')
const [totalAmount, changeTotalAmount] = useState(0)
const [voucherParam, changeVoucherParam] = useState(null)
const [paymentDetailsScreen, changePaymentDetailsScreen] = useState(null)
const [termsChecked, changeChecked] = useState(false)
useEffect(() => {
async function initialize() {
changeSelectedPayment(null)
changePaymentDetailItems(null)
changePaymentDetailItemsTemp(null)
resetVoucher()
const tempDetailPayment = []
let voucherParam = {}
let totalAmount = 0
if (typeof checkout !== 'undefined' && checkout) {
console.log(checkout)
if (checkout.ReservationDetail && checkout.ReservationDetail[0]) {
const item = checkout.ReservationDetail[0]
totalAmount = parseInt(item.SubTotal) || item.Price
voucherParam.business_unit_id = checkout.BusinessUnitId
voucherParam.product_id = item.MsProductId
voucherParam.product_service_id = item.MsProductServiceId
let cartTitle = ''
let carRentalLabel = ''
if (item.MsProductId === CAR_RENTAL) {
carRentalLabel = 'Car Rental'
} else if (item.MsProductId === AIRPORT_TRANSFER) {
carRentalLabel = 'Airport Transfer'
} else if (item.MsProductId === BUS_RENTAL) {
carRentalLabel = 'Sewa Bus'
}
let rentalDriverLabel = ''
if (item.MsProductServiceId === SERVICE_ID_WITH_DRIVER) {
rentalDriverLabel = 'With Driver'
} else if (item.MsProductServiceId === SERVICE_ID_SELF_DRIVE) {
rentalDriverLabel = 'Self Drive'
}
if (rentalDriverLabel !== '') {
cartTitle = `${carRentalLabel} - ${rentalDriverLabel}`
} else {
cartTitle = carRentalLabel
}
const newItem = {
cardTitle: item.UnitTypeName,
startDate: item.StartDate[0],
endDate: item.EndDate[item.EndDate.length - 1],
totalAmount: item.SubTotal,
rentHour: item.MsProductId === AIRPORT_TRANSFER ? '' : item.Duration,
rentHourSuffix: item.MsProductId === AIRPORT_TRANSFER ? '' : 'Hours',
city: item.CityName,
cartTitle: cartTitle,
errors: [],
}
const newArr = []
newArr.push(newItem)
changeCartItems(newArr)
tempDetailPayment.push({
name: newItem.cardTitle,
total: newItem.totalAmount,
})
if (item.PriceExtras !== '0' && item.PriceExtras !== 0) {
tempDetailPayment.push({
name: 'Additional Items',
total: item.PriceExtras,
})
}
if (item.PriceExpedition !== '0' && item.PriceExpedition !== 0) {
tempDetailPayment.push({
name: 'Expedition Price',
total: item.PriceExpedition,
})
}
if (item.PriceDiscount !== '0' && item.PriceDiscount !== 0) {
tempDetailPayment.push({
name: 'Discount Price',
total: item.PriceDiscount,
})
}
}
} else if (typeof cartItem !== 'undefined' && cartItem) {
voucherParam.business_unit_id = cartItem.BusinessUnitId
voucherParam.product_id = cartItem.CartDetail[0].MsProductId
voucherParam.product_service_id = cartItem.CartDetail[0].MsProductServiceId
if (cartItem.CartDetail && cartItem.CartDetail) {
const newArr = []
cartItem.CartDetail.forEach((item) => {
totalAmount = parseInt(totalAmount) + parseInt(item.SubTotal) || item.Price
let cartTitle = ''
let carRentalLabel = ''
if (item.MsProductId === CAR_RENTAL) {
carRentalLabel = 'Car Rental'
} else if (item.MsProductId === AIRPORT_TRANSFER) {
carRentalLabel = 'Airport Transfer'
} else if (item.MsProductId === BUS_RENTAL) {
carRentalLabel = 'Sewa Bus'
}
let rentalDriverLabel = ''
if (item.MsProductServiceId === SERVICE_ID_WITH_DRIVER) {
rentalDriverLabel = 'With Driver'
} else if (item.MsProductServiceId === SERVICE_ID_SELF_DRIVE) {
rentalDriverLabel = 'Self Drive'
}
if (rentalDriverLabel !== '') {
cartTitle = `${carRentalLabel} - ${rentalDriverLabel}`
} else {
cartTitle = carRentalLabel
}
const newItem = {
cardTitle: item.UnitTypeName,
startDate: item.StartDate[0],
endDate: item.EndDate[item.EndDate.length - 1],
totalAmount: item.SubTotal,
rentHour: item.MsProductId === AIRPORT_TRANSFER ? '' : item.Duration,
rentHourSuffix: item.MsProductId === AIRPORT_TRANSFER ? '' : 'Hours',
city: item.CityName,
cartTitle: cartTitle,
errors: [],
}
newArr.push(newItem)
tempDetailPayment.push({
name: newItem.cardTitle,
total: newItem.totalAmount,
})
if (item.PriceExtras !== '0' && item.PriceExtras !== 0) {
tempDetailPayment.push({
name: 'Additional Items',
total: item.PriceExtras,
})
}
if (item.PriceExpedition !== '0' && item.PriceExpedition !== 0) {
tempDetailPayment.push({
name: 'Expedition Price',
total: item.PriceExpedition,
})
}
if (item.PriceDiscount !== '0' && item.PriceDiscount !== 0) {
tempDetailPayment.push({
name: 'Discount Price',
total: item.PriceDiscount,
})
}
})
changeCartItems(newArr)
}
}
const user = await getUserProfileObject()
voucherParam.user_id = user.Id
console.log(tempDetailPayment)
changeTotal(totalAmount)
changeVoucherParam(voucherParam)
changePaymentDetailItems(tempDetailPayment)
changePaymentDetailItemsTemp(tempDetailPayment)
changePaymentDetailsScreen(tempDetailPayment)
// fetchPaymentMethods()
}
initialize()
console.log('postCheckoutIsLoading', postCheckoutIsLoading)
console.log('postCheckoutWithoutCartIsLoading', postCheckoutWithoutCartIsLoading)
}, [])
const changePayment = (payload) => {
changeSelectedPayment(payload)
forceUpdate()
}
const paymentPress = async () => {
if (!selectedPayment) {
Alert.alert('Please choose payment method')
} else {
if (!termsChecked) {
Alert.alert('Please read the terms and conditions, and check before proceed.')
return
}
if (checkout) {
console.log(checkout)
const newPayload = checkout
checkout.CartDetail = newPayload.ReservationDetail
await checkoutValidation(checkout)
console.log('after validation')
} else {
const payload = await AsyncStorage.getItem('cartInfos')
await checkoutValidation(payload)
console.log('after validation')
}
if (!checkoutValidationIsLoading && checkoutValidationErrorMessage) {
console.log('invalid')
Alert.alert('Invalid Cart, Please Edit the Cart before continue')
const tempCarts = cartItems
if (checkoutValidationErrorMessage.backDateError) {
const error = checkoutValidationErrorMessage.backDateError
if (error && error.length > 0) {
error.forEach((v) => {
if (!tempCarts[v.index].errors.includes(v.message)) {
tempCarts[v.index].errors.push(v.message)
}
})
}
}
if (checkoutValidationErrorMessage.discountError) {
const error = checkoutValidationErrorMessage.discountError
if (error && error.length > 0) {
error.forEach((v) => {
if (!tempCarts[v.index].errors.includes(v.message)) {
tempCarts[v.index].errors.push(v.message)
}
})
}
}
if (checkoutValidationErrorMessage.priceError) {
const error = checkoutValidationErrorMessage.priceError
if (error && error.length > 0) {
error.forEach((v) => {
if (!tempCarts[v.index].errors.includes(v.message)) {
tempCarts[v.index].errors.push(v.message)
}
})
}
}
if (checkoutValidationErrorMessage.stockError) {
const error = checkoutValidationErrorMessage.stockError
if (error && error.length > 0) {
error.forEach((v) => {
if (!tempCarts[v.index].errors.includes(v.message)) {
tempCarts[v.index].errors.push(v.message)
}
})
}
}
changeCartItems(tempCarts)
forceUpdate()
// navigateToCheckout()
} else if (!checkoutValidationIsLoading && checkoutValidationErrorMessage === null) {
const voucherArr = []
if (checkVoucherSuccessMessage) {
voucherArr.push(checkVoucherSuccessMessage)
}
console.log('after validate')
console.log(checkout)
if (checkout) {
if (checkVoucherSuccessMessage) {
console.log('voucher')
console.log(checkVoucherSuccessMessage)
checkout.ReservationDetail[0].ReservationPromo.push(checkVoucherSuccessMessage)
}
if (selectedPayment.PaymentMethodId === 'PYM-0002') {
let cardInfo = selectedPayment
cardInfo.totalAmount = total
console.log(checkout)
navigation.navigate('CreditCardScreen', {
creditCardInfo: cardInfo,
checkout: checkout,
cartItem: null,
reservationPromo: null,
})
} else {
const payload = checkout
payload.PaymentMethod = {
PaymentMethodId: selectedPayment.PaymentMethodId,
MsBankId: selectedPayment.MsBankId,
}
payload.image = selectedPayment.imageUri
postCheckoutWithoutCart(payload)
}
} else {
if (selectedPayment.PaymentMethodId === 'PYM-0002') {
let cardInfo = selectedPayment
cardInfo.totalAmount = total
navigation.navigate('CreditCardScreen', {
creditCardInfo: cardInfo,
checkout: null,
cartItem: cartItem,
reservationPromo: voucherArr,
})
} else {
const payload = {
PaymentMethod: selectedPayment,
ReservationPromo: voucherArr,
}
payload.PaymentMethod = {
PaymentMethodId: selectedPayment.PaymentMethodId,
MsBankId: selectedPayment.MsBankId,
}
console.log(payload)
payload.image = selectedPayment.imageUri
postCheckout(payload)
}
}
// buat payload di sini
// post checkout
// navigateToCheckout()
}
}
}
const checkVoucherPress = () => {
console.log('voucher press')
console.log(paymentDetailItemsTemp)
if (voucherValue && voucherValue !== '') {
const payload = {
payload: {
voucher: voucherValue,
params: voucherParam,
},
checkout: checkout,
cartItem: cartItem,
paymentItems: paymentDetailItemsTemp,
}
checkVoucher(payload)
} else {
alert('Voucher is empty')
}
}
return (
<Checkout
onPaymentSelectPress={() =>
navigation.navigate('PaymentScreen', {
selectedPayment: selectedPayment,
changeSelectedPayment: changePayment,
})
}
paymentType={
selectedPayment && selectedPayment.PaymentMethodName
? selectedPayment.PaymentMethodName
: null
}
uriImagePaymentType={
selectedPayment && selectedPayment.imageUri ? selectedPayment.imageUri : null
}
checkVoucherPress={checkVoucherPress}
paymentDetailItems={paymentDetailItems}
paymentPress={paymentPress}
onIconLeftPress={() => navigation.goBack()}
voucherValue={voucherValue}
onVoucherChange={changeVoucherValue}
totalAmount={total}
items={cartItems}
voucherError={checkVoucherErrorMessage}
isLoadingVoucher={checkVoucherIsLoading}
isLoadingCheckout={postCheckoutIsLoading}
isLoadingValidation={checkoutValidationIsLoading}
termsChecked={termsChecked}
changeChecked={changeChecked}
/>
)
}
CheckoutScreen.defaultProps = {}
CheckoutScreen.propTypes = {
postCheckout: PropTypes.func,
postCheckoutIsLoading: PropTypes.bool,
postCheckoutErrorMessage: PropTypes.any,
postCheckoutSuccessMessage: PropTypes.string,
paymentMethods: PropTypes.arrayOf(PropTypes.shape({})),
paymentMethodsIsLoading: PropTypes.bool,
paymentMethodsErrorMessage: PropTypes.string,
fetchPaymentMethods: PropTypes.func,
cartItems: PropTypes.arrayOf(PropTypes.shape({})),
changeCartItems: PropTypes.func,
checkoutValidation: PropTypes.func,
checkoutValidationIsLoading: PropTypes.bool,
checkoutValidationErrorMessage: PropTypes.arrayOf(PropTypes.shape({})),
checkVoucher: PropTypes.func,
checkVoucherErrorMessage: PropTypes.string,
checkVoucherIsLoading: PropTypes.bool,
checkVoucherSuccessMessage: PropTypes.shape({}),
paymentDetailItems: PropTypes.arrayOf(PropTypes.shape({})),
changePaymentDetailItems: PropTypes.func,
changePaymentDetailItemsTemp: PropTypes.func,
resetVoucher: PropTypes.func,
checkVoucherFailure: PropTypes.func,
paymentDetailItemsTemp: PropTypes.arrayOf(PropTypes.shape({})),
total: PropTypes.number,
changeTotal: PropTypes.func,
postCheckoutWithoutCart: PropTypes.func,
postCheckoutWithoutCartIsLoading: PropTypes.bool,
postCheckoutWithoutCartErrorMessage: PropTypes.string,
postCheckoutWithoutCartSuccessMessage: PropTypes.string,
}
const mapStateToProps = (state) => ({
postCheckoutIsLoading: state.checkout.postCheckoutIsLoading,
postCheckoutErrorMessage: state.checkout.postCheckoutErrorMessage,
postCheckoutSuccessMessage: state.checkout.postCheckoutSuccessMessage,
postCheckoutWithoutCartIsLoading: state.checkout.postCheckoutWithoutCartIsLoading,
postCheckoutWithoutCartErrorMessage: state.checkout.postCheckoutWithoutCartErrorMessage,
postCheckoutWithoutCartSuccessMessage: state.checkout.postCheckoutWithoutCartSuccessMessage,
paymentMethods: state.checkout.paymentMethods,
paymentMethodsIsLoading: state.checkout.paymentMethodsIsLoading,
paymentMethodsErrorMessage: state.checkout.paymentMethodsErrorMessage,
selectedPayment: state.checkout.selectedPayment,
cartItems: state.checkout.cartItems,
checkoutValidationIsLoading: state.cartScreen.checkoutValidationIsLoading,
checkoutValidationErrorMessage: state.cartScreen.checkoutValidationErrorMessage,
checkVoucherIsLoading: state.checkout.checkVoucherIsLoading,
checkVoucherErrorMessage: state.checkout.checkVoucherErrorMessage,
checkVoucherSuccessMessage: state.checkout.checkVoucherSuccessMessage,
paymentDetailItems: state.checkout.paymentDetailItems,
paymentDetailItemsTemp: state.checkout.paymentDetailItemsTemp,
total: state.checkout.total,
})
const mapDispatchToProps = (dispatch) => ({
postCheckout: (payload) => dispatch(CheckoutScreenActions.postCheckout(payload)),
postCheckoutWithoutCart: (payload) =>
dispatch(CheckoutScreenActions.postCheckoutWithoutCart(payload)),
fetchPaymentMethods: () => dispatch(CheckoutScreenActions.fetchPaymentMethods()),
changeSelectedPayment: (payload) =>
dispatch(CheckoutScreenActions.changeSelectedPayment(payload)),
changeCartItems: (payload) => dispatch(CheckoutScreenActions.changeCartItems(payload)),
checkoutValidation: (payload) => dispatch(CartScreenActions.checkoutValidation(payload)),
checkVoucher: (payload) => dispatch(CheckoutScreenActions.checkVoucher(payload)),
changePaymentDetailItems: (payload) =>
dispatch(CheckoutScreenActions.changePaymentDetailItems(payload)),
changePaymentDetailItemsTemp: (payload) =>
dispatch(CheckoutScreenActions.changePaymentDetailItemsTemp(payload)),
checkVoucherFailure: (payload) => dispatch(CheckoutScreenActions.checkVoucherFailure(payload)),
resetVoucher: (payload) => dispatch(CheckoutScreenActions.resetVoucher(payload)),
changeTotal: (payload) => dispatch(CheckoutScreenActions.changeTotal(payload)),
})
export default connect(
mapStateToProps,
mapDispatchToProps
)(CheckoutScreen)
| 37.30297 | 97 | 0.648901 |
c19734172c3ccb0ed57507487624a7f797be178d | 1,335 | js | JavaScript | coms/basic/queue.js | yunxu1019/efront | b30398485e702785ae7360190e50fe329addcfb3 | [
"MIT"
] | 1 | 2019-04-26T02:56:54.000Z | 2019-04-26T02:56:54.000Z | coms/basic/queue.js | yunxu1019/efront | b30398485e702785ae7360190e50fe329addcfb3 | [
"MIT"
] | 3 | 2019-06-10T02:59:29.000Z | 2021-06-06T01:09:58.000Z | coms/basic/queue.js | yunxu1019/efront | b30398485e702785ae7360190e50fe329addcfb3 | [
"MIT"
] | 1 | 2020-08-16T03:19:29.000Z | 2020-08-16T03:19:29.000Z | "use strict";
function queue(list, count = 1, context = null) {
var f = this;
if (list instanceof Function) {
f = list;
list = this;
}
if (count instanceof Object) {
let temp = count;
count = context || temp;
context = temp;
}
return new Promise(function (ok, oh) {
var cx = 0;
var result = [];
var loaded_count = 0;
var error_count = 0;
var reject = function (e) {
error_count++;
oh(e);
};
var next = function () {
loaded_count++;
run();
};
var run = function () {
if (error_count && count === 1) return;
if (cx >= list.length) return Promise.all(result).then(ok, oh);
var saved_cx = cx;
var args = list[cx];
try {
result[saved_cx] = f.call(context, args, cx++, list);
} catch (e) {
oh(e);
return;
}
Promise.resolve(result[saved_cx]).then(next, reject);
};
if (count > list.length >> 1) {
count = list.length >> 1;
}
if (!(count >= 1)) {
count = 1;
}
while (cx < count) {
run();
}
});
}
module.exports = queue; | 26.7 | 75 | 0.428464 |
c1973839d90e4a69e3ad25fa1dc579e989b6dae2 | 348 | js | JavaScript | api/notifications/badge.create.owner/notification.js | BCDevOps/openopps-platform | fe48b19563e044c9363564c2e9eea62867fe67c2 | [
"CC0-1.0"
] | 34 | 2015-11-25T21:35:08.000Z | 2017-03-25T22:56:23.000Z | api/notifications/badge.create.owner/notification.js | BCDevOps/openopps-platform | fe48b19563e044c9363564c2e9eea62867fe67c2 | [
"CC0-1.0"
] | 176 | 2015-11-18T15:01:43.000Z | 2016-11-21T18:22:26.000Z | api/notifications/badge.create.owner/notification.js | BCDevOps/openopps-platform | fe48b19563e044c9363564c2e9eea62867fe67c2 | [
"CC0-1.0"
] | 25 | 2015-11-28T08:58:28.000Z | 2021-02-14T11:42:28.000Z | module.exports = {
subject: 'You earned a new badge',
to: '<%= user.username %>',
/*
* Prepares the data object to render templates
* @param {Notification} notification model
* @param {function} callback called with err, data
* data.globals defaults to sails.config
*/
data: function(data, done) {
done(null, data);
}
};
| 20.470588 | 52 | 0.649425 |
c1999188b40b9ed30026a1ea3a939ad036cf796d | 2,093 | js | JavaScript | public/show-password.js | bakunya/laravel-blog | 02ab621d3b3729f694c6886f212420ae3345b4d0 | [
"MIT"
] | 1 | 2022-01-09T12:02:47.000Z | 2022-01-09T12:02:47.000Z | public/show-password.js | bakunya/laravel-blog | 02ab621d3b3729f694c6886f212420ae3345b4d0 | [
"MIT"
] | null | null | null | public/show-password.js | bakunya/laravel-blog | 02ab621d3b3729f694c6886f212420ae3345b4d0 | [
"MIT"
] | null | null | null | window.addEventListener('DOMContentLoaded', () => {
const passwordGroup = document.getElementById('password-group')
const eye = `
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-eye" viewBox="0 0 16 16">
<path d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8zM1.173 8a13.133 13.133 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.133 13.133 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5c-2.12 0-3.879-1.168-5.168-2.457A13.134 13.134 0 0 1 1.172 8z"/>
<path d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5zM4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0z"/>
</svg>
`
const eyeSlash = `
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-eye-slash" viewBox="0 0 16 16">
<path d="M13.359 11.238C15.06 9.72 16 8 16 8s-3-5.5-8-5.5a7.028 7.028 0 0 0-2.79.588l.77.771A5.944 5.944 0 0 1 8 3.5c2.12 0 3.879 1.168 5.168 2.457A13.134 13.134 0 0 1 14.828 8c-.058.087-.122.183-.195.288-.335.48-.83 1.12-1.465 1.755-.165.165-.337.328-.517.486l.708.709z"/>
<path d="M11.297 9.176a3.5 3.5 0 0 0-4.474-4.474l.823.823a2.5 2.5 0 0 1 2.829 2.829l.822.822zm-2.943 1.299.822.822a3.5 3.5 0 0 1-4.474-4.474l.823.823a2.5 2.5 0 0 0 2.829 2.829z"/>
<path d="M3.35 5.47c-.18.16-.353.322-.518.487A13.134 13.134 0 0 0 1.172 8l.195.288c.335.48.83 1.12 1.465 1.755C4.121 11.332 5.881 12.5 8 12.5c.716 0 1.39-.133 2.02-.36l.77.772A7.029 7.029 0 0 1 8 13.5C3 13.5 0 8 0 8s.939-1.721 2.641-3.238l.708.709zm10.296 8.884-12-12 .708-.708 12 12-.708.708z"/>
</svg>
`
passwordGroup.querySelector('.icon-button').addEventListener('click', (e) => {
const input = passwordGroup.querySelector('input')
if(input?.type === 'password') {
e.target.innerHTML = eye
input.setAttribute('type', 'text')
} else if(input?.type === 'text') {
e.target.innerHTML = eyeSlash
input.setAttribute('type', 'password')
}
})
}) | 77.518519 | 345 | 0.616818 |
c19a647c6f81cf7e74d29d81cb448274e1007323 | 390 | js | JavaScript | client/src/components/App.js | narodain/react-express-mongo-ecommerce | 7ecc2b5ffa6f7a5b56bd1319da335cc7847bc309 | [
"MIT"
] | 32 | 2019-04-22T06:28:37.000Z | 2022-03-06T03:30:38.000Z | client/src/components/App.js | narodain/react-express-mongo-ecommerce | 7ecc2b5ffa6f7a5b56bd1319da335cc7847bc309 | [
"MIT"
] | 5 | 2020-04-05T12:15:41.000Z | 2022-02-27T23:15:54.000Z | client/src/components/App.js | narodain/react-express-mongo-ecommerce | 7ecc2b5ffa6f7a5b56bd1319da335cc7847bc309 | [
"MIT"
] | 26 | 2019-11-13T20:09:00.000Z | 2022-02-16T16:44:05.000Z | import React from 'react';
import Header from './layout/header/Header';
import Footer from './layout/footer/Footer';
import FloatButton from '../components/layout/header/nav/FloatButton';
import './App.css';
const App = props => (
<div className="container">
<div>
<Header />
{props.children}
</div>
<FloatButton />
<Footer />
</div>
)
export default App;
| 20.526316 | 70 | 0.646154 |
c19ad5ab78f71542e380e1dbe748c8cf2f6c8cfc | 276 | js | JavaScript | server/parts/fireblast-core/app/core/00_logger.js | mindfreakthemon-archive/revolt | 11c6e4117c09ed637f43129c5cee9b9d15f36176 | [
"MIT"
] | null | null | null | server/parts/fireblast-core/app/core/00_logger.js | mindfreakthemon-archive/revolt | 11c6e4117c09ed637f43129c5cee9b9d15f36176 | [
"MIT"
] | null | null | null | server/parts/fireblast-core/app/core/00_logger.js | mindfreakthemon-archive/revolt | 11c6e4117c09ed637f43129c5cee9b9d15f36176 | [
"MIT"
] | null | null | null | import winston from 'winston';
export default function () {
var app = this;
app.logger = winston;
winston.remove(winston.transports.Console);
winston.add(winston.transports.Console, {
colorize: true,
level: 'debug'
});
app.logger.debug('initialized logged');
}
| 16.235294 | 44 | 0.706522 |
c19addbc32408e717ff5adb66f23428bebc4f5f6 | 565 | js | JavaScript | __tests__/Manager.test.js | MiernickiElijah/Warlock | 33a06a59702016cddcb61a2a5a7760d4b79a39df | [
"MIT"
] | 1 | 2021-06-23T00:34:06.000Z | 2021-06-23T00:34:06.000Z | __tests__/Manager.test.js | MiernickiElijah/Warlock | 33a06a59702016cddcb61a2a5a7760d4b79a39df | [
"MIT"
] | null | null | null | __tests__/Manager.test.js | MiernickiElijah/Warlock | 33a06a59702016cddcb61a2a5a7760d4b79a39df | [
"MIT"
] | null | null | null | const Manager = require('../lib/Manager');
test("can getRole() retrieve Manager", () => {
const flurp = "Manager";
const e = new Manager("Me", 1, "me@me", "myofficeNum");
expect(e.getRole()).toBe(flurp);
});
test("can set officeNum", () => {
const officeNum = 2;
const e = new Manager("Me", 1, "me@me", officeNum);
expect(e.officeNum).toBe(officeNum);
});
test("can getOffice() retrieve officeNum", () => {
const officeNum = 2;
const e = new Manager("Me", 1, "me@me", officeNum);
expect(e.getOfficeNum()) === (officeNum);
}); | 28.25 | 59 | 0.59292 |
c19de5bbbff170259e4375065d8c6893218a27c3 | 733 | js | JavaScript | pages/index.js | srestrepoee/bogogames | 89506e650f079a663cf4262f05c9cf6649b9cd78 | [
"MIT"
] | null | null | null | pages/index.js | srestrepoee/bogogames | 89506e650f079a663cf4262f05c9cf6649b9cd78 | [
"MIT"
] | null | null | null | pages/index.js | srestrepoee/bogogames | 89506e650f079a663cf4262f05c9cf6649b9cd78 | [
"MIT"
] | null | null | null | import Layout from '../components/layouts/default'
import { getSortedPostsData } from '../lib/posts'
export async function getStaticProps() {
const allPostsData = getSortedPostsData()
return {
props: {
allPostsData
}
}
}
const Posts = ({allPostsData}) =>
<ul className="">
{allPostsData.map(({ id, date, title }) => (
<li key={id}>
{title}
<br />
{id}
<br />
{date}
</li>
))}
</ul>
export default function Home({ allPostsData }) {
return (
<Layout>
<main>
<h1>
Welcome to <a href="https://nextjs.org">BogoGames!</a>
</h1>
<Posts allPostsData={allPostsData} />
</main>
</Layout>
)
}
| 17.046512 | 64 | 0.526603 |
c19efe1b0b0d7d510dcdace7a371c35f46be291c | 395 | js | JavaScript | models/vehicle.js | zegilooo/testvirtuo | 62aef0718d8db3fc103100104b2294c70db3eac0 | [
"MIT"
] | null | null | null | models/vehicle.js | zegilooo/testvirtuo | 62aef0718d8db3fc103100104b2294c70db3eac0 | [
"MIT"
] | null | null | null | models/vehicle.js | zegilooo/testvirtuo | 62aef0718d8db3fc103100104b2294c70db3eac0 | [
"MIT"
] | null | null | null | import mongoose from 'mongoose'
const vehicleSchema = new mongoose.Schema ({
'plate': { type: String, required: true, trim: true },
'mileage': Number,
'fuel': Number,
'gps': {
'latitude': Number,
'longitude': Number
},
'capture_at': { type: Date, default: Date.now }
})
const vehicleModule = mongoose.model('vehicle',vehicleSchema,'vehicle')
export default vehicleModule
| 23.235294 | 71 | 0.675949 |
c19f227aa590f6ad5d2d6119bd0af66bd1fdcbf8 | 22,361 | js | JavaScript | aristotle/static/scripts/cc.js | jermnelson/Discover-Aristotle | cc1ff79915d715801890a3a8642099304916adfa | [
"Apache-2.0"
] | 7 | 2015-03-13T09:56:16.000Z | 2021-05-03T13:39:05.000Z | aristotle/static/scripts/cc.js | jermnelson/Discover-Aristotle | cc1ff79915d715801890a3a8642099304916adfa | [
"Apache-2.0"
] | 1 | 2021-04-06T16:30:00.000Z | 2021-04-06T16:43:57.000Z | aristotle/static/scripts/cc.js | jermnelson/Discover-Aristotle | cc1ff79915d715801890a3a8642099304916adfa | [
"Apache-2.0"
] | 2 | 2015-12-18T16:51:07.000Z | 2016-02-26T09:56:42.000Z | /**
* Colorado College
* by White Whale Web Services
* http://whitewhale.net
*/
var dotBulletsAvailable = 3,
homepageTimeout,
homepageFired = false,
openNav = false;
$(document).ready(function() {
addCalendarIcons();
addRandomSubnavigationBullets();
startNavigationCollapse();
startPlaceholder();
startLeftScrapbookScatter();
startIECSSFixes();
startWebFontFix();
startSlideshows();
startHomepage();
startQuickAccess();
startVideoPlayer();
startBlockTextFitting();
startBlockFeatureFeature();
startProgramBrowser();
startLightboxes();
startLibrarySearchBoxes();
});
function startWebFontFix() {
// Chrome on Windows cannot handle the web font because in its version,
// it is missing an apostrophe — rather than showing it as the default
// font, it shows the entire line as the default font, not cool; to fix
// this, we're replacing apostrophes with a non-web-font version
if (BrowserDetect.browser == 'Chrome' && BrowserDetect.OS == 'Windows') {
$('*')
.filter(function() {
return /neofill/i.test($(this).css('font-family')) && $(this).parents('#main-navigation').length == 0;
})
.each(function() {
// replace apostrophes
$(this).html($(this).html().replace(/([^>])(?:'|’)([^<])/ig, '$1<span class="no-web-fonts">’</span>$2'));
});
}
if (BrowserDetect.browser == 'Opera') {
$('*')
.filter(function() {
return /neofill/i.test($(this).css('font-family')) && $(this).parents('#main-navigation').length == 0;
})
.each(function() {
// replace apostrophes
$(this).html($(this).html().replace(/([^>])(?:'|’)([^<])/ig, '$1<span class="no-web-fonts">’</span>$2'));
// replace brackets
$(this).html($(this).html().replace(/(?:{)/ig, '('));
$(this).html($(this).html().replace(/(?:})/ig, ')'));
});
}
}
/**
* Adds calendar icons to calendar sidebar items
*/
function addCalendarIcons() {
var day;
// sidebar
$('.calendar li')
.each(function(n) {
// parse for the date
day = $(this).find('em').eq(0).text().match(/([0-9]{1,2})(?:st|nd|rd|th)/i)[1];
// only add icon if we found the day
if (day) {
$(this)
.prepend('<span class="date">' + day + '</span>')
.addClass('with-icon');
}
});
// event-detail header
$('#events.details #content header')
.each(function(n) {
// parse for the date
day = $(this).find('time').eq(0).text().match(/([0-9]{1,2})(?:, [0-9]{4})/i)[1];
if (day) {
$('<span>' + day + '</span>').insertBefore($(this).find('hgroup'));
$(this).addClass('with-icon');
}
});
}
/**
* Adds randomized hand-drawn bullets to subnavigation calendar items
*/
function addRandomSubnavigationBullets() {
var random, previousRandom = 0;
if ($('#subnavigation').length) {
$('#subnavigation li')
.each(function(n) {
// make a random number in the allowed range
random = Math.round((Math.random() * (dotBulletsAvailable - 1)) + 1);
// to ensure we don't get the same bullet twice in a row
while (dotBulletsAvailable > 1 && random == previousRandom) {
random = Math.round((Math.random() * (dotBulletsAvailable - 1)) + 1);
}
previousRandom = random;
$(this).addClass('dot' + random);
});
}
}
/**
* Collapses the navigation if appropriate, adds triggers to expand
*/
function startNavigationCollapse() {
var header = $('#header'),
navList = $('#header ul li ul'),
openNav = $('#openNav').val();
if (!$('header.collapsed').length) { return; } // this page is not a collapsed page
// initiate collapse CSS
// header.css('height', '78px').data('nav-is-collapsed', true);
// navList.css('top', '160px');
if (openNav == "true") {
header.css('height', '209px').data('nav-is-collapsed', false);
navList.css('top', '0px');
} else {
header.css('height', '78px').data('nav-is-collapsed', true);
navList.css('top', '160px');
}
$('#header h5')
.bind('click', function() {
// $('#header').data('nav-is-collapsed') is a state-holder
// for the navigation, we can't use .toggle() since the click
// events are spread between many ULs
if (header.data('nav-is-collapsed')) {
// already collapsed, expand
header
.data('nav-is-collapsed', false)
.stop()
.animate({'height': '209px'}, 400, 'easeOutBack');
$('#header h5').css('cursor', 'default');
navList.each(function(n) {
// the delay here sets up a fan-like animation
$(this).stop().delay(50 * n).animate({'top': 0}, 600, 'easeOutBack');
});
} else {
header
.data('nav-is-collapsed', true)
.stop()
.animate({'height': '78px'}, 700, 'easeInOutBack');
$('#header h5').css('cursor', 'pointer');
navList.each(function(n) {
$(this).stop().delay(50 * n).animate({'top': '160px'}, 600, 'easeOutQuad');
});
}
})
.css('cursor', 'pointer'); // usability cue
}
/**
* Starts placeholder on all input boxes
*/
function startPlaceholder() {
$('input[type="text"]').placeholder();
}
/**
* Scatters left-scrapbook photos a little
*/
function startLeftScrapbookScatter() {
var basePositions = [ 0, 17, 34 ].shuffle();
$('.left-scrapbook img').each(function(n) {
var nudge = Math.round(Math.random() * 12) - 6, // ±6px
basePosition = parseInt(basePositions[n % basePositions.length], 10),
newMarginRight = basePosition + Math.round(nudge);
$(this).css('margin-right', newMarginRight + 'px');
});
}
/**
* Applies styles to certain elements that can't comprehend CSS3
*/
function startIECSSFixes() {
$('aside.left-scrapbook img:nth-child(6n-4)').addClass('ie-bring-to-front');
$('aside.scrunched img:nth-child(6n-4)').removeClass('ie-bring-to-front');
$('aside.scrunched img:first-child').addClass('ie-bring-to-front');
$('#block-feature .block-selector li:nth-child(4n)').addClass('ie-remove-margin');
}
/**
* Sets up and starts Flowplayer
*/
function startVideoPlayer() {
$('aside.video a, #homepage a.video').each(function(e) {
// check for a youtube link
if ($(this).attr('href').match(/youtube\.com/i)) {
$(this)
.fancybox({
type: 'iframe',
href: 'http://www.youtube.com/embed/' + $(this).attr('href').match(/v=([0-9a-zA-Z_\-]+)&?/i)[1],
height: 349,
width: 425,
transitionIn: 'elastic',
transitionOut: 'elastic',
centerOnScroll: true,
overlayColor: '#292c34',
overlayOpacity: 0.6,
padding: 6
});
// check for a vimeo link
} else if ($(this).attr('href').match(/vimeo\.com/i)) {
$(this)
.fancybox({
type: 'iframe',
href: 'http://player.vimeo.com/video/' + $(this).attr('href').match(/com\/([0-9]+)\??/i)[1] + '?title=0&portrait=0&color=ffffff',
height: 300,
width: 400,
transitionIn: 'elastic',
transitionOut: 'elastic',
centerOnScroll: true,
overlayColor: '#292c34',
overlayOpacity: 0.6,
padding: 6
});
// this is a normal, uploaded video, use the local player
} else {
$(this)
.fancybox({
type: 'iframe',
href: '/assets/player.php?video=' + $(this).attr('href'),
scrolling: 'no',
transitionIn: 'elastic',
transitionOut: 'elastic',
centerOnScroll: true,
overlayColor: '#292c34',
overlayOpacity: 0.6,
padding: 6
});
}
});
}
/**
* Mimics placeholder in browsers that don't support it
*/
$.fn.extend({ // add plugins
placeholder: function(options) { // bootstrap HTML5 placeholder attributes for browsers that don't support it
options = options || {};
var s = {
style:options.style || 'placeholder', // the class to add when the element is operating as a placeholder
clear:options.clear || false // the elements which, when clicked, should wipe the placeholder
};
return this.each(function() { // with each matched element
var self = $(this);
if (this.placeholder && 'placeholder' in document.createElement(this.tagName)) return; // if the browser supports placeholders for this element, abort
if (self.data('placeholder')) { // if a placeholder has already been set on this element
return; // abort to avoid double-binding
}
self.data('placeholder',true); // flag this element as having a placeholder, so we'll never double-bind
var placeholder = self.attr('placeholder') || '',
clear = function() { // to clear the placeholder
if (self.val()==placeholder) { // if the text is the placeholder
self.removeClass(s.style).val(''); // blank the text and remove the placeholder style
}
};
self
.focus(clear)
.blur(function() {
var val = self.val();
if (!val||val==placeholder) { // if there's no text, or the text is the placeholder
self.addClass(s.style).val(placeholder); // set the text to the placeholder and add the style
}
}).blur(); // and do it now
self.parents('form').submit(clear);
$(s.clear).click(clear);
});
}
});
/**
* Slideshows
*/
function startSlideshows() {
$('aside.slideshow')
.find('a.more-info')
.css('display', 'block')
.click(function(e) {
e.preventDefault();
e.stopPropagation();
})
.end()
.each(function(i) {
var items = $(this).find('li'),
list = $(this).find('ul'),
areaWidth = list.width(),
areaHeight = list.height(),
ranges = {
'moveLeft': {
'top': {
'start': ((areaHeight/2) * -1) - 30,
'end': ((areaHeight/2) * -1) - 10
},
'left': {
'start': ((areaWidth/2) * -1) - 30,
'end': ((areaWidth/2) * -1) - 10
},
'rotate': {
'start': -30,
'end': -10
}
},
'moveRight': {
'top': {
'start': ((areaHeight/2) * -1) - 30,
'end': ((areaHeight/2) * -1) - 10
},
'left': {
'start': (areaWidth/2) + 10,
'end': (areaWidth/2) + 30
},
'rotate': {
'start': 10,
'end': 30
}
}
};
list.data('lowest-z-index', 50000);
list.data('ranges', ranges);
items.each(function(n) {
var item = $(this),
itemWidth = item.width(),
itemHeight = item.height(),
newZIndex = 50000 - n,
newLeft = Math.round((areaWidth - itemWidth) / 2),
newTop = Math.round((areaHeight - itemHeight) / 2);
list.data('lowest-z-index', newZIndex);
$(this)
.css('left', newLeft)
.css('top', newTop)
.data('order', n)
.data('returnLeftValue', newLeft)
.data('returnTopValue', newTop)
.css('z-index', newZIndex); // way up
});
});
$('aside.slideshow ul')
.css('cursor', 'pointer')
.each(function(k) {
$(this)
.click(function(e) {
var items = $(this).find('li'),
highestZIndex = 0,
currentItem,
range,
useLeft,
useTop,
useRotate;
items.each(function(n) {
if ($(this).css('z-index') > highestZIndex) {
highestZIndex = $(this).css('z-index');
currentItem = $(this);
}
});
// move front-most pic
range = (currentItem.css('z-index') % 2) ? $(this).data('ranges').moveLeft : $(this).data('ranges').moveRight;
useLeft = range.left.start + (Math.random() * (Math.abs(range.left.start - range.left.end))),
useTop = range.top.start + (Math.random() * (Math.abs(range.top.start - range.top.end))),
useRotate = (BrowserDetect.browser == 'Chrome' || BrowserDetect.browser == 'Safari') ? 0 : range.rotate.start + (Math.random() * (Math.abs(range.rotate.start - range.rotate.end)));
currentItem
.animate({
'top': useTop,
'left': useLeft,
'rotate': useRotate
}, 215, 'easeOutCubic', function() {
var updateZIndex = $(this).parents('ul').data('lowest-z-index') - 1;
$(this).parents('ul').data('lowest-z-index', updateZIndex);
$(this).css('z-index', updateZIndex);
$(this)
.animate({
'top': $(this).data('returnTopValue'),
'left': $(this).data('returnLeftValue'),
'rotate': 0
}, 255, 'easeInQuad');
});
})
.dblclick(function(e) {
e.preventDefault();
return false;
});
});
}
/**
* Homepage picture moving
*/
function startHomepage() {
if (!$('#homepage').length) {
return;
}
// animation
// -------------------------------------------------------------------------
$('a.left, a.right')
.each(function(n) {
$(this)
.data('startingLeft', $(this).css('left'))
.data('startingTop', $(this).css('top'));
});
homepageTimeout = setTimeout(function() {
moveHomepageImages();
}, 3000);
$('a.image, a.video').mouseenter(function() {
clearTimeout(homepageTimeout);
moveHomepageImages();
});
// captions
// -------------------------------------------------------------------------
$('#homepage a.left, #homepage a.right')
.fancybox({
titlePosition: 'over',
cyclic: true,
transitionIn: 'elastic',
transitionOut: 'elastic',
centerOnScroll: true,
overlayColor: '#292c34',
overlayOpacity: 0.6,
padding: 6
});
}
/**
* Turning on QuickAccess
*/
function startQuickAccess() {
$('aside.quick-search input.quick-search, #gateway .quick-search input')
.quickaccess({
links: '.quick-links a',
maxResults: 5
});
// position qa_results
positionPageQA();
$(window).resize(function() {
positionPageQA();
});
$('#header form .text-box input')
.quickaccess({
links: '.quick-links a',
maxResults: 5,
results: '#page_qa_results'
});
}
/**
* Positions the page-level QuickAccess
*/
function positionPageQA() {
$('#page_qa_results')
.css('top', parseInt($('#header form .text-box input').offset().top, 10) + $('#header form .text-box input').height() + 10)
.css('right', $(window).width() - parseInt($('#header form .text-box input').offset().left, 10) - $('#header form .text-box input').width() - 8);
}
/**
* Triggers the homepage images to move
*/
function moveHomepageImages() {
if (homepageFired) {
return;
}
homepageFired = true;
$('.left.position-ne').animate({'left': '-=260' }, 500, 'easeOutCirc');
$('.left.position-nw').animate({'left': '-=60' }, 500, 'easeOutCirc');
$('.left.position-sw').animate({'left': '-=140' }, 500, 'easeOutCirc');
$('.left.position-se').animate({'left': '-=190' }, 500, 'easeOutCirc');
$('.right.position-ne').animate({'left': '+=80' }, 500, 'easeOutCirc');
$('.right.position-nw').animate({'left': '+=190' }, 500, 'easeOutCirc');
$('.right.position-sw').animate({'left': '+=257' }, 500, 'easeOutCirc');
$('.right.position-se').animate({'left': '+=100' }, 500, 'easeOutCirc');
}
/**
* Attempts to fit the block text onto one line
*/
function startBlockTextFitting() {
var currentBlock = $('#block .current-block'),
blockText = currentBlock.text();
currentBlock.css('visibility', 'hidden').prepend('<span>' + blockText + '</span>');
// adjusts text to fit as large as possible but be on one line
do {
currentBlock
.css('font-size', parseInt(currentBlock.css('font-size'), 10) - 1);
} while (currentBlock.height() > parseInt(currentBlock.css('font-size'), 10) * 1.1);
currentBlock
.css('font-size', parseInt(currentBlock.css('font-size'), 10) * 0.9)
.css('visibility', 'visible');
}
/**
* Makes the feature section for block feature page
*/
function startBlockFeatureFeature() {
if (!$('#block-feature').length) {
return;
}
var tabs = $('<ul id="tabs"></ul>'),
visuals = $('<ul id="visuals"></ul>'),
featuredCourseList = $('<div id="featured-courses"><h4>Featured Courses</h4></div>');
// create a playground for tab area
$('.block-highlights hgroup')
.after('<div id="feature-highlights"></div>');
// create tabs
$('ul.featured-courses')
.children('li')
.each(function(i) {
var visualItem = $('<li></li>'),
tabItem = $('<li></li>')
backgroundImage = $(this).children('img').attr('src');
// visuals
visualItem
.css('background-image', 'url(' + backgroundImage + ')')
.append('<div class="description">' + $(this).children('.description').html() + '</div>')
.attr('id', 'visual-' + i);
visuals.append(visualItem);
// tabs
tabItem
.html('<a href="#">' + $(this).children('h3').html() + '</a>')
.data('trigger-id', i);
tabs.append(tabItem);
featuredCourseList.append(tabs);
});
$('#feature-highlights')
.append(visuals)
.append(featuredCourseList)
.append('<span class="clear"></span>');
$('.featured-courses').css('display', 'none');
// we need a reference point for swapping z-indexes
$('#feature-highlights #tabs').data('tabsLastZIndex', 10);
$('#feature-highlights #tabs a')
.click(function(e) {
var index = $(this).parent().data('trigger-id'),
newZIndex = $('#feature-highlights #tabs').data('tabsLastZIndex');
$('#feature-highlights #tabs').data('tabsLastZIndex', newZIndex + 1);
$('#feature-highlights #tabs li')
.each(function(i) {
if ($(this).data('trigger-id') == index) {
$(this).addClass('on');
$('#visual-' + $(this).data('trigger-id')).stop().fadeTo(600, 1).css('z-index', newZIndex);
} else {
$(this).removeClass('on');
$('#visual-' + $(this).data('trigger-id')).stop().fadeTo(600, 0);
}
});
return false;
});
$('#feature-highlights #tabs li:first-child a').click();
}
/**
* Drop-down action for the program browser
*/
function startProgramBrowser() {
$('#program-browser p')
.toggle(
function(e) {
$(this)
.parents('#program-browser')
.find('.programs')
.slideDown(500, 'easeOutCubic');
},
function(e) {
$(this)
.parents('#program-browser')
.find('.programs')
.slideUp(500, 'easeOutCubic');
}
);
}
/**
* Adds fancybox lightbox to all links with the class "lightbox"
*/
function startLightboxes() {
$('a.lightbox').fancybox({
titlePosition: 'over',
cyclic: true,
transitionIn: 'elastic',
transitionOut: 'elastic',
centerOnScroll: true,
overlayColor: '#292c34',
overlayOpacity: 0.6,
padding: 6
});
}
/**
* Starts the library drop downs
*/
function startLibrarySearchBoxes() {
if (!$('#search-library, #searchbox').length) { return; }
$('input[type="button"]')
.click(function() {
var searchForm = $(this).parents('form');
var searchBox = searchForm.find('.search-types');
searchBox.css('display', (searchBox.css('display') == 'block') ? 'none' : 'block');
})
.each(function(i) {
positionSearchTypeDropDown($(this));
});
$('.search-types a')
.click(function(e) {
e.preventDefault();
$(this)
.parents('form') // update search button value
.find('input[type="submit"]').val('Search ' + $(this).text())
.end()
.find('.search-types') // hide drop down
.css('display', 'none')
.end()
.find('input[name="search-type"]')
.val($(this).data('searchtype'));
positionSearchTypeDropDown($(this).parents('form').find('input[type="button"]'));
return false;
});
}
/**
* Positions the search type drop down on library pages
*/
function positionSearchTypeDropDown(el) {
var formWidth = el.parents('form').width();
el
.parents('form')
.find('.search-types')
.css({
top: parseInt(el.position().top, 10) + el.height() + 17,
right: formWidth - (parseInt(el.position().left, 10) + el.width() + parseInt(el.css('padding-right'), 10) + parseInt(el.css('padding-left'), 10) + 2)
});
}
/**
* Browser detection, used to fix web fonts unfortunately
* source: http://www.quirksmode.org/js/detect.html
*/
var BrowserDetect = {
init: function () {
this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
this.version = this.searchVersion(navigator.userAgent)
|| this.searchVersion(navigator.appVersion)
|| "an unknown version";
this.OS = this.searchString(this.dataOS) || "an unknown OS";
},
searchString: function (data) {
for (var i=0;i<data.length;i++) {
var dataString = data[i].string;
var dataProp = data[i].prop;
this.versionSearchString = data[i].versionSearch || data[i].identity;
if (dataString) {
if (dataString.indexOf(data[i].subString) != -1)
return data[i].identity;
}
else if (dataProp)
return data[i].identity;
}
},
searchVersion: function (dataString) {
var index = dataString.indexOf(this.versionSearchString);
if (index == -1) return;
return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
},
dataBrowser: [
{
string: navigator.userAgent,
subString: "Chrome",
identity: "Chrome"
},
{ string: navigator.userAgent,
subString: "OmniWeb",
versionSearch: "OmniWeb/",
identity: "OmniWeb"
},
{
string: navigator.vendor,
subString: "Apple",
identity: "Safari",
versionSearch: "Version"
},
{
prop: window.opera,
identity: "Opera"
},
{
string: navigator.vendor,
subString: "iCab",
identity: "iCab"
},
{
string: navigator.vendor,
subString: "KDE",
identity: "Konqueror"
},
{
string: navigator.userAgent,
subString: "Firefox",
identity: "Firefox"
},
{
string: navigator.vendor,
subString: "Camino",
identity: "Camino"
},
{ // for newer Netscapes (6+)
string: navigator.userAgent,
subString: "Netscape",
identity: "Netscape"
},
{
string: navigator.userAgent,
subString: "MSIE",
identity: "Explorer",
versionSearch: "MSIE"
},
{
string: navigator.userAgent,
subString: "Gecko",
identity: "Mozilla",
versionSearch: "rv"
},
{ // for older Netscapes (4-)
string: navigator.userAgent,
subString: "Mozilla",
identity: "Netscape",
versionSearch: "Mozilla"
}
],
dataOS : [
{
string: navigator.platform,
subString: "Win",
identity: "Windows"
},
{
string: navigator.platform,
subString: "Mac",
identity: "Mac"
},
{
string: navigator.userAgent,
subString: "iPhone",
identity: "iPhone/iPod"
},
{
string: navigator.platform,
subString: "Linux",
identity: "Linux"
}
]
};
BrowserDetect.init();
/**
* Adds shuffle functionality to Arrays
* source: http://javascript.about.com/library/blshuffle.htm
*/
Array.prototype.shuffle = function() {
var s = [];
while (this.length) {
s.push(this.splice(Math.random() * this.length, 1));
}
while (s.length) {
this.push(s.pop());
}
return this;
} | 26.092182 | 187 | 0.593981 |
c19f2f3be4857b065e96c0f6fcebc2013422d16a | 10,447 | js | JavaScript | joi/lib/validator.js | Johannesduvenage/dragon | 4e4f347765c24787c68033bd4208a43359c5fdb9 | [
"MIT"
] | null | null | null | joi/lib/validator.js | Johannesduvenage/dragon | 4e4f347765c24787c68033bd4208a43359c5fdb9 | [
"MIT"
] | 12 | 2020-09-16T08:15:26.000Z | 2022-01-06T10:02:02.000Z | joi/lib/validator.js | Johannesduvenage/dragon | 4e4f347765c24787c68033bd4208a43359c5fdb9 | [
"MIT"
] | 1 | 2022-03-15T22:57:07.000Z | 2022-03-15T22:57:07.000Z | 'use strict';
const Hoek = require('@hapi/hoek');
const Common = require('./common');
const Errors = require('./errors');
const internals = {};
exports.entry = function (value, schema, prefs) {
if (prefs) {
schema.checkPreferences(prefs);
}
const mainstay = {};
const settings = Common.preferences(Common.defaults, prefs);
const state = schema._stateEntry({ mainstay });
const result = exports.validate(value, schema, state, settings);
const errors = Errors.process(result.errors, value);
return new internals.Promise(result.value, errors);
};
exports.validate = function (value, schema, state, prefs) {
// Setup state and settings
state = schema._state(state.key, state.path, state.ancestors, state);
prefs = internals.prefs(schema, prefs);
const original = value;
// Type coercion
if (schema._coerce &&
prefs.convert &&
(!schema._coerce.type || typeof value === schema._coerce.type)) {
const coerced = schema._coerce(value, state, prefs);
if (coerced) {
if (coerced.errors) {
return internals.finalize(coerced.value, schema, original, [].concat(coerced.errors), state, prefs); // Coerced error always aborts early
}
value = coerced.value;
}
}
// Empty value
if (schema._flags.empty) {
const entryState = schema._flags.empty._stateEntry(state);
if (schema._flags.empty._match(internals.trim(value, schema), entryState, Common.defaults)) {
value = undefined;
}
}
// Presence requirements (required, optional, forbidden)
const presence = schema._flags.presence || prefs.presence;
if (value === undefined) {
if (presence === 'forbidden') {
return internals.finalize(value, schema, original, null, state, prefs);
}
if (presence === 'required') {
return internals.finalize(value, schema, original, [schema.createError('any.required', value, null, state, prefs)], state, prefs);
}
if (presence === 'optional') {
if (schema._type !== 'object' ||
schema._flags.default !== Common.symbols.deepDefault) {
return internals.finalize(value, schema, original, null, state, prefs);
}
value = {};
}
}
else if (presence === 'forbidden') {
return internals.finalize(value, schema, original, [schema.createError('any.unknown', value, null, state, prefs)], state, prefs);
}
// Allowed values
const errors = [];
if (schema._valids) {
const match = schema._valids.get(value, state, prefs, schema._flags.insensitive);
if (match) {
if (prefs.convert) {
value = match.value;
}
return internals.finalize(value, schema, original, null, state, prefs);
}
if (schema._flags.allowOnly) {
const report = schema.createError('any.allowOnly', value, { valids: schema._valids.values({ stripUndefined: true }) }, state, prefs);
if (prefs.abortEarly) {
return internals.finalize(value, schema, original, [report], state, prefs);
}
errors.push(report);
}
}
// Denied values
if (schema._invalids) {
if (schema._invalids.has(value, state, prefs, schema._flags.insensitive)) {
const report = schema.createError(value === '' ? 'any.empty' : 'any.invalid', value, { invalids: schema._invalids.values({ stripUndefined: true }) }, state, prefs);
if (prefs.abortEarly) {
return internals.finalize(value, schema, original, [report], state, prefs);
}
errors.push(report);
}
}
// Base type
if (schema._base) {
const base = schema._base(value, state, prefs);
if (base) {
value = base.value;
if (base.errors) {
if (!Array.isArray(base.errors)) {
errors.push(base.errors);
return internals.finalize(value, schema, original, errors, state, prefs); // Base error always aborts early
}
if (base.errors.length) {
errors.push(...base.errors);
return internals.finalize(value, schema, original, errors, state, prefs); // Base error always aborts early
}
}
}
}
// Validate tests
if (!schema._tests.length) {
return internals.finalize(value, schema, original, errors, state, prefs);
}
const helpers = {
prefs,
schema,
state,
error: (code, local, localState) => schema.createError(code, value, local, localState || state, prefs)
};
for (const test of schema._tests) {
const { func, rule } = test;
let ret;
if (func) {
ret = func.call(schema, value, state, prefs);
}
else {
// Skip rules that are also applied in coerce step
if (rule.convert &&
prefs.convert) {
continue;
}
// Resolve references
let args = rule.args;
if (rule.resolve.length) {
args = Object.assign({}, args); // Shallow copy
for (const key of rule.resolve) {
const resolver = rule.refs[key];
const resolved = args[key].resolve(value, state, prefs);
const normalized = resolver.normalize ? resolver.normalize(resolved) : resolved;
if (!resolver.assert(normalized)) {
ret = schema.createError(resolver.code, resolved, { ref: args[key] }, state, prefs);
break;
}
args[key] = normalized;
}
}
// Test rule (if reference didn't error)
ret = ret || schema._rules[rule.rule](value, helpers, args, rule); // Use ret if already set to error
}
if (ret instanceof Errors.Report) {
internals.error(ret, test);
if (prefs.abortEarly) {
return internals.finalize(value, schema, original, [ret], state, prefs);
}
errors.push(ret);
}
else if (Array.isArray(ret) && // Array implies not abortEarly
ret[0] instanceof Errors.Report) {
ret.forEach((report) => internals.error(report, test));
errors.push(...ret);
}
else {
value = ret;
}
}
return internals.finalize(value, schema, original, errors, state, prefs);
};
internals.error = function (report, { message }) {
if (message) {
report._setTemplate(message);
}
return report;
};
internals.finalize = function (value, schema, original, errors, state, prefs) {
errors = errors || [];
// Failover value
if (errors.length) {
const failover = internals.default('failover', undefined, schema, errors, state, prefs);
if (failover !== undefined) {
value = failover;
errors = [];
}
}
// Error override
if (errors.length &&
schema._flags.error) {
errors = [typeof schema._flags.error === 'function' ? schema._flags.error(errors) : schema._flags.error];
}
// Default
if (value === undefined) {
value = internals.default('default', value, schema, errors, state, prefs);
}
// Cast
if (schema._flags.cast &&
value !== undefined &&
(!schema._casts[Common.symbols.castFrom] || schema._casts[Common.symbols.castFrom](value))) {
value = schema._casts[schema._flags.cast](value, { original, schema, state, prefs });
}
return {
errors: errors.length ? errors : null,
outcome: value,
value: schema._flags.strip ? undefined : value
};
};
internals.prefs = function (schema, prefs) {
if (schema._preferences) {
const isDefaultOptions = prefs === Common.defaults;
if (isDefaultOptions &&
schema._preferences[Common.symbols.prefs]) {
return schema._preferences[Common.symbols.prefs];
}
prefs = Common.preferences(schema._messages ? Common.preferences({ messages: schema._messages }, prefs) : prefs, schema._preferences);
if (isDefaultOptions) {
schema._preferences[Common.symbols.prefs] = prefs;
}
return prefs;
}
if (schema._messages) {
return Common.preferences({ messages: schema._messages }, prefs);
}
return prefs;
};
internals.default = function (flag, value, schema, errors, state, prefs) {
if (prefs.noDefaults) {
return value;
}
const source = schema._flags[flag];
if (source === undefined) {
return value;
}
if (Common.isResolvable(source)) {
return source.resolve(value, state, prefs);
}
if (typeof source === 'function' &&
!(schema._flags.func && !source.description)) {
const args = source.length > 0 ? [Hoek.clone(state.ancestors[0]), prefs] : [];
try {
return source(...args);
}
catch (err) {
errors.push(schema.createError(`any.${flag}`, null, { error: err }, state, prefs));
return;
}
}
if (source !== Common.symbols.deepDefault) {
return Hoek.clone(source);
}
return value;
};
internals.trim = function (value, schema) {
if (typeof value !== 'string') {
return value;
}
const trim = schema._uniqueRules.get('trim');
if (trim &&
trim.args.enabled) {
value = value.trim();
}
return value;
};
internals.Promise = class {
constructor(value, errors) {
this.value = value;
this.error = errors;
}
then(resolve, reject) {
if (this.error) {
return Promise.reject(this.error).catch(reject);
}
return Promise.resolve(this.value).then(resolve);
}
catch(reject) {
if (this.error) {
return Promise.reject(this.error).catch(reject);
}
return Promise.resolve(this.value);
}
};
| 27.205729 | 180 | 0.552407 |
c1a106e695f9e8fd9cbb6aa916f357762266a567 | 1,103 | js | JavaScript | lib/constants.js | raincatcher-beta/raincatcher-workflow-angular | 1d58641fc9a08ef096a867713e1ead247a2f43fe | [
"MIT"
] | null | null | null | lib/constants.js | raincatcher-beta/raincatcher-workflow-angular | 1d58641fc9a08ef096a867713e1ead247a2f43fe | [
"MIT"
] | 1 | 2017-11-09T08:19:19.000Z | 2017-11-09T08:19:19.000Z | lib/constants.js | raincatcher-beta/raincatcher-workflow-angular | 1d58641fc9a08ef096a867713e1ead247a2f43fe | [
"MIT"
] | null | null | null | module.exports = {
WORKFLOW_MODULE_ID: "wfm.workflow",
WORKFLOW_DIRECTIVE_MODULE: "wfm.workflow.directives",
WORKFLOWS_ENTITY_NAME: "workflows",
WORKORDER_ENTITY_NAME: "workorders",
WORKFLOW_UI_TOPIC_PREFIX: "wfm:ui",
RESULTS_ENTITY_NAME: "results",
SYNC_TOPIC_PREFIX: "wfm:sync",
USERS_ENTITY_NAME: "users",
STEPS_ENTITY_NAME: "step",
WORKFLOW: "workflow",
WORKFLOW_PREFIX: "wfm:workflows",
TOPIC_TIMEOUT: 1000,
TOPIC_PREFIX: "wfm",
DONE_PREFIX: "done",
ERROR_PREFIX: "error",
TOPICS: {
CREATE: "create",
UPDATE: "update",
LIST: "list",
REMOVE: "remove",
READ: "read",
START: "start",
STOP: "stop",
FORCE_SYNC: "force_sync",
SYNC_COMPLETE: "sync_complete",
READ_PROFILE: "read_profile",
SELECTED: "selected",
BEGIN: "begin",
SUMMARY: "summary",
NEXT: "next",
PREVIOUS: "previous",
COMPLETE: "complete"
},
STATUS: {
COMPLETE: "complete",
COMPLETE_DISPLAY: "Complete",
PENDING: "pending",
PENDING_DISPLAY: "In Progress",
NEW_DISPLAY: "New",
UNASSIGNED_DISPLAY: "Unassigned"
}
}; | 25.651163 | 55 | 0.662738 |
c1a19a1d9647b0fc948fb60e04120ff829a075b8 | 500 | js | JavaScript | backend/config/db.config.js | cpainterwakefield/fs-team-assembler | f22268bd1a3038a735ab6fc9216d3641c261cadf | [
"Apache-2.0"
] | 2 | 2020-05-18T18:00:47.000Z | 2020-05-20T03:18:31.000Z | backend/config/db.config.js | cpainterwakefield/fs-team-assembler | f22268bd1a3038a735ab6fc9216d3641c261cadf | [
"Apache-2.0"
] | null | null | null | backend/config/db.config.js | cpainterwakefield/fs-team-assembler | f22268bd1a3038a735ab6fc9216d3641c261cadf | [
"Apache-2.0"
] | null | null | null | module.exports = {
HOST: "127.0.0.1",
USER: "postgres",
PASSWORD: "UwU",
DB: "somedb",
dialect: "postgres",
pool:{
//Max num of connections in pool
max: 69,
//Min num of connections in pool
min: 0,
//Max time in milliseconds that pool will try to get connection before an error
//is thrown
aquire: 30000,
//max time in milliseconds that a connection can be idle before being released
idle: 10000
}
} | 26.315789 | 87 | 0.576 |
c1a361f6d8234039584e7d3de9814aff58d98448 | 322 | js | JavaScript | src/components/logo/Logo.js | habedi71/react-face-detection | a48d927323859c845df3a5272b81fb87f593c25b | [
"MIT"
] | null | null | null | src/components/logo/Logo.js | habedi71/react-face-detection | a48d927323859c845df3a5272b81fb87f593c25b | [
"MIT"
] | null | null | null | src/components/logo/Logo.js | habedi71/react-face-detection | a48d927323859c845df3a5272b81fb87f593c25b | [
"MIT"
] | null | null | null | import React from "react";
import brain from "./brain.png";
import "./logo.css";
const Logo = () => {
return (
<div className="row">
<div className="bg-primary">
<img src={brain} alt="Brain Logo" style={{ width: "100px", height: "100px" }} />{" "}
</div>
</div>
);
};
export default Logo;
| 20.125 | 90 | 0.555901 |
c1a3a26aa91f2bddb89f6e5152278c3f23be5ad1 | 3,314 | js | JavaScript | awesome/liangqing/static/js/pages-my-about.aea4934a.js | zhouyu1993/zhouyu1993.github.io | 6c72cdfbd54c4182c6bd715011e632ce949eaad1 | [
"MIT"
] | 7 | 2017-09-28T14:13:29.000Z | 2019-11-07T14:56:08.000Z | awesome/liangqing/static/js/pages-my-about.aea4934a.js | zhouyu1993/zhouyu1993.github.io | 6c72cdfbd54c4182c6bd715011e632ce949eaad1 | [
"MIT"
] | null | null | null | awesome/liangqing/static/js/pages-my-about.aea4934a.js | zhouyu1993/zhouyu1993.github.io | 6c72cdfbd54c4182c6bd715011e632ce949eaad1 | [
"MIT"
] | null | null | null | (window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["pages-my-about"],{"0551":function(t,e,n){e=t.exports=n("2350")(!1),e.push([t.i,'@charset "UTF-8";\n/**\n * 这里是uni-app内置的常用样式变量\n *\n * uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量\n * 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App\n *\n */\n/**\n * 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能\n *\n * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件\n */\n/* 颜色变量 */\n/* 行为相关颜色 */\n/* 文字基本颜色 */\n/* 背景颜色 */\n/* 边框颜色 */\n/* 尺寸变量 */\n/* 文字尺寸 */\n/* 图片尺寸 */\n/* Border Radius */\n/* 水平间距 */\n/* 垂直间距 */\n/* 透明度 */\n/* 文章场景相关 */uni-page-body[data-v-e12b7440]{width:100%;height:100%;background-color:#f5f5f5;padding-top:%?1?%;box-sizing:border-box}.content[data-v-e12b7440]{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column;-webkit-box-pack:justify;-webkit-justify-content:space-between;justify-content:space-between;width:100%;height:100%;background-color:#fff}.logo-wrap[data-v-e12b7440]{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;-webkit-box-align:center;-webkit-align-items:center;align-items:center;margin-top:%?200?%}.logo-wrap uni-image[data-v-e12b7440]{width:%?160?%;height:%?160?%}.logo-wrap uni-text[data-v-e12b7440]{font-size:%?36?%;color:#333;margin-top:%?10?%}.copyright[data-v-e12b7440]{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;-webkit-box-align:center;-webkit-align-items:center;align-items:center;padding:%?50?% 0}.copyright uni-text[data-v-e12b7440]{font-size:%?24?%;color:#666}body.?%PAGE?%[data-v-e12b7440]{background-color:#f5f5f5}',""])},3493:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var i={data:function(){return{appname:"相亲"}},onLoad:function(){},onReady:function(){},methods:{}};e.default=i},"37be":function(t,e,n){var i=n("0551");"string"===typeof i&&(i=[[t.i,i,""]]),i.locals&&(t.exports=i.locals);var o=n("4f06").default;o("772113de",i,!0,{sourceMap:!1,shadowMode:!1})},"4fe9":function(t,e,n){"use strict";var i=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("v-uni-view",{staticClass:"content"},[n("v-uni-view",{staticClass:"logo-wrap"},[n("v-uni-image",{attrs:{src:"/static/logo.png",mode:""}}),n("v-uni-text",[t._v("相亲")])],1),n("v-uni-view",{staticClass:"copyright"},[n("v-uni-text",[t._v("青岛喜宴科技有限公司")])],1)],1)},o=[];n.d(e,"a",function(){return i}),n.d(e,"b",function(){return o})},"72e1":function(t,e,n){"use strict";n.r(e);var i=n("3493"),o=n.n(i);for(var a in i)"default"!==a&&function(t){n.d(e,t,function(){return i[t]})}(a);e["default"]=o.a},a69b:function(t,e,n){"use strict";var i=n("37be"),o=n.n(i);o.a},c2d4:function(t,e,n){"use strict";n.r(e);var i=n("4fe9"),o=n("72e1");for(var a in o)"default"!==a&&function(t){n.d(e,t,function(){return o[t]})}(a);n("a69b");var c=n("f0c5"),r=Object(c["a"])(o["default"],i["a"],i["b"],!1,null,"e12b7440",null);e["default"]=r.exports}}]); | 3,314 | 3,314 | 0.694327 |
c1a4fad7b16ad1438548c48f7836504dc0bb97f3 | 9,541 | js | JavaScript | secure-local-storage.js | BosNaufal/secure-local-storage | ed6f32edc88d78b75ec91b347e808ed3954abdf2 | [
"MIT"
] | 34 | 2016-03-21T03:17:25.000Z | 2020-05-09T12:25:35.000Z | secure-local-storage.js | BosNaufal/secure-local-storage | ed6f32edc88d78b75ec91b347e808ed3954abdf2 | [
"MIT"
] | 4 | 2016-03-21T06:13:06.000Z | 2017-10-05T06:35:31.000Z | secure-local-storage.js | BosNaufal/secure-local-storage | ed6f32edc88d78b75ec91b347e808ed3954abdf2 | [
"MIT"
] | 7 | 2016-03-21T09:14:26.000Z | 2022-02-23T11:14:54.000Z | /*! Copyright (c) 2016 Naufal Rabbani (https://github.com/BosNaufal)
* Licensed Under MIT (http://opensource.org/licenses/MIT)
*
* Secure Local Storage - Version 1.0.0
*
*/
(function(root){
var root = this;
var alphabet = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','0','1','2','3','4','5','6','7','8','9'];
/**
ENCRYPT and DECRYPT some value
@param {String} action
@param {String} unsafeString
@param {String} password
@return {String}
*/
var secure = function(action,unsafeString,password){
// Password to array
var objPassword = password.split('');
// split the unsafeString to array
var obj = unsafeString.split('');
/**
calculations of the password
Make every single char of password become a number
depend on its order on alphabet array
then put it on number variable
*/
var number = 0;
for (var i = 0; i < objPassword.length; i++) {
for (var j = 0; j < alphabet.length; j++) {
if( objPassword[i] == alphabet[j] ) number += j;
}
}
/**
ENCRYPT function
will convert every single char of unsafeString become a number
depend on its order on alphabet array
then increase them with the num (calculations of the password char)
the total of it will decrease by alphabet.length if they are more than alphabet.length
after meet the perfect number ( not more than alphabet.length ) find a alphabet depend on that
then push it to secure string
return encoded URI Component of secure string
*/
// ENCRYPT IT!
if(action == 'encrypt'){
var encryptIt = function(alpha){
for (var j = 0; j < alphabet.length; j++) {
if( alpha == alphabet[j] ){
var outOfRange = function(num){
if(num > alphabet.length){
num -= alphabet.length;
return outOfRange(num);
} else{
return num;
}
};
return alphabet[outOfRange(j+number)]; // encrypting depend on password calculations
}
}
return alpha;
}
var secure = [];
for (var i = 0; i < obj.length; i++) {
var encrypt = encryptIt(obj[i]);
secure.push(encrypt);
}
// encrypted string
return secure.join('');
}
/**
DECRYPT function
encode URI Component the unsafeString params then...
will convert every single char of unsafeString become a number
depend on its order on alphabet array
then decrease them with the num (calculations of the password char)
the total of it will increase by alphabet.length if they are less than alphabet.length
after meet the perfect number ( not less than alphabet.length ) find a alphabet depend on that
then push it to original string
return original string
*/
// DECRYPT IT!
if(action == 'decrypt'){
var decryptIt = function(alpha){
for (var j = 0; j < alphabet.length; j++) {
if( alpha == alphabet[j] ){
var minusOne = function(num){
if(num < 0){
num += alphabet.length;
return minusOne(num);
} else{
return num;
}
};
return alphabet[minusOne(j-number)];
}
}
return alpha;
}
var original = [];
for (var i = 0; i < obj.length; i++) {
var decrypt = decryptIt(obj[i]);
original.push(decrypt);
}
// decrypted string
return original.join('');
}
};
// Secure Local Storage Configuration
var config = function secureStorageConfig(){
root.__SECURE_LOCAL_STORAGE_PASS__ = "";
// Get number indicator from localStorage
var nums = window.localStorage.getItem('secureLocalStorageNums');
// If it isn't length
if(nums === null){
// Make internal password indicator become Random
this.num1 = Math.floor(Math.random() * 5);
this.num2 = Math.floor(Math.random() * 7);
} else {
// get it!
this.num1 = parseFloat(nums.substr(0,1));
this.num2 = parseFloat(nums.substr(1,1));
}
};
/**
Setting the global password of secure local Storage
@param {String} pass
*/
config.prototype.setPassword = function (pass) {
// Make an encrypted password
var pass = secure('encrypt',pass,alphabet[this.num2]+'secureStorageInternalPassword'+alphabet[this.num1]);
root.__SECURE_LOCAL_STORAGE_PASS__ = pass;
// set the random nums to secureStorage
window.localStorage.setItem('secureLocalStorageNums',this.num1.toString()+this.num1.toString());
};
// Initialize
var storage = function secureStorage(){
var me = this;
// Make a new config()
this.config = new config();
this.all = {};
// if localStorage is not empty
if(window.localStorage.getItem('secureLocalStorage') !== null){
// get it
this.all = JSON.parse(decodeURIComponent(window.localStorage.getItem('secureLocalStorage')));
}
return this;
};
/**
Shortcut to setting the password
@param {String} pass
*/
storage.prototype.setPassword = function (pass) {
this.config.setPassword(pass);
};
/**
Get the Original Password
@return {Object}
*/
function getPassword(){
var originalPass = secure('decrypt', root.__SECURE_LOCAL_STORAGE_PASS__, alphabet[this.num2]+'secureStorageInternalPassword'+alphabet[this.num1]);
return originalPass;
}
/**
ENCRYPT / DECRYPT Secure Object
*- Limitation -*
Only Non Nested Object
@param {Object} obj
@return {Object}
*/
function secureObject(obj,decrypt){
var keys = Object.keys(obj);
var me = this;
var action = decrypt ? 'decrypt' : 'encrypt';
var pass = getPassword.call(me.config);
var secureObject = {};
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
secureObject[secure(action,key,pass)] = secure(action,obj[key],pass);
}
return secureObject;
};
/**
Set the item of localStorage
@param {Mixed} index
@param {String} val
@return {storage}
*/
storage.prototype.set = function(index,val){
var me = this;
if(root.__SECURE_LOCAL_STORAGE_PASS__ === ""){
console.warn('[Secure Local Storage]: You need to set the password');
return false;
}
var secure = {};
if(typeof index === 'string'){
var obj = {};
obj[index] = val;
secure = secureObject.call(me.secureStorage,obj);
}
if(typeof index === 'object'){
secure = secureObject.call(me.secureStorage,index);
}
// Put it on localStorage
var keys = Object.keys(secure);
for (var i = 0; i < keys.length; i++) {
var key = keys[i];
me.all[key] = secure[key];
}
return window.localStorage.setItem('secureLocalStorage',encodeURIComponent(JSON.stringify(me.all)));
};
/**
Get the item from localStorage
@param {String} index
@return {String}
*/
storage.prototype.get = function(index){
var me = this;
if(window.localStorage.getItem('secureLocalStorage') === null){
console.warn('[Secure Local Storage]: Your storage Is Empty!');
return false;
}
if(root.__SECURE_LOCAL_STORAGE_PASS__ === ""){
console.warn('[Secure Local Storage]: You need to set the password');
return false;
}
var storageObj = JSON.parse(decodeURIComponent(window.localStorage.getItem('secureLocalStorage')));
var originalObj = secureObject.call(me.secureStorage,storageObj, true);
return originalObj[index];
};
/**
Remove the item from localStorage
@param {String} index
@return {storage}
*/
storage.prototype.remove = function(index){
var me = this;
if(window.localStorage.getItem('secureLocalStorage') === null){
console.warn('[Secure Local Storage]: Your storage Is Empty!');
return false;
}
if(root.__SECURE_LOCAL_STORAGE_PASS__ === ""){
console.warn('[Secure Local Storage]: You need to set the password');
return false;
}
function getPassword(){
var originalPass = secure('decrypt', root.__SECURE_LOCAL_STORAGE_PASS__, alphabet[me.config.num2]+'secureStorageInternalPassword'+alphabet[me.config.num1]);
return originalPass;
}
var encryptedIndex = secure('encrypt',index,getPassword());
delete me.all[encryptedIndex];
// Put it on localStorage
return window.localStorage.setItem('secureLocalStorage',encodeURIComponent(JSON.stringify(me.all)));
};
/**
Reset the localStorage
*/
storage.prototype.reset = function(){
this.all = {};
window.localStorage.removeItem('secureLocalStorageNums');
return window.localStorage.removeItem('secureLocalStorage');
};
// Make a new secureStorage()
var secureStorage = new storage();
// If support node / ES6 module
if( typeof module === 'object' && module.exports ){
module.exports = secureStorage;
}
// if using require (AMD) js
else if (typeof define === 'function' && define.amd) {
define(function (){ return secureStorage; });
}
// if script loaded by script tag in HTML file
else if (typeof window !== undefined) {
window.secureStorage = secureStorage;
}
})(this);
| 25.174142 | 267 | 0.607903 |
c1a53387e4d5dae7c7fe38313693ebf7ad5111b4 | 495 | js | JavaScript | code/doxygen/html/namespaceshoot__anything.js | mitchellurgero/illacceptanything | b063e73dbc522f782b957bf51a42171bf14e951a | [
"MIT"
] | 1 | 2017-08-21T19:15:43.000Z | 2017-08-21T19:15:43.000Z | code/doxygen/html/namespaceshoot__anything.js | mitchellurgero/illacceptanything | b063e73dbc522f782b957bf51a42171bf14e951a | [
"MIT"
] | null | null | null | code/doxygen/html/namespaceshoot__anything.js | mitchellurgero/illacceptanything | b063e73dbc522f782b957bf51a42171bf14e951a | [
"MIT"
] | 1 | 2018-10-26T23:46:06.000Z | 2018-10-26T23:46:06.000Z | var namespaceshoot__anything =
[
[ "Bullet", "classshoot__anything_1_1Bullet.html", "classshoot__anything_1_1Bullet" ],
[ "Enemy", "classshoot__anything_1_1Enemy.html", "classshoot__anything_1_1Enemy" ],
[ "GameObject", "classshoot__anything_1_1GameObject.html", "classshoot__anything_1_1GameObject" ],
[ "Ship", "classshoot__anything_1_1Ship.html", "classshoot__anything_1_1Ship" ],
[ "Vector2", "classshoot__anything_1_1Vector2.html", "classshoot__anything_1_1Vector2" ]
]; | 61.875 | 102 | 0.773737 |
c1a546c219b80a443e974d86b006418cad86d47b | 100 | js | JavaScript | src/components/shopify/imageGallery/imageThumbnail/styles.js | zachatkinson/rockhound-mama | b910e3642b8a4951661c0540b1ac0a302d1d5e94 | [
"RSA-MD"
] | null | null | null | src/components/shopify/imageGallery/imageThumbnail/styles.js | zachatkinson/rockhound-mama | b910e3642b8a4951661c0540b1ac0a302d1d5e94 | [
"RSA-MD"
] | null | null | null | src/components/shopify/imageGallery/imageThumbnail/styles.js | zachatkinson/rockhound-mama | b910e3642b8a4951661c0540b1ac0a302d1d5e94 | [
"RSA-MD"
] | null | null | null | import styled from "styled-components"
export const ThumbWrap = styled.div`
cursor: pointer;
`
| 16.666667 | 38 | 0.74 |
c1a69b034781531c236dd5f326b8383aeef47f6c | 1,447 | js | JavaScript | lib/log/Logger.js | caribewave/mambo-cron | 1228f531b9eb987148c0b37cd5d6eeaa48993580 | [
"Apache-2.0"
] | null | null | null | lib/log/Logger.js | caribewave/mambo-cron | 1228f531b9eb987148c0b37cd5d6eeaa48993580 | [
"Apache-2.0"
] | null | null | null | lib/log/Logger.js | caribewave/mambo-cron | 1228f531b9eb987148c0b37cd5d6eeaa48993580 | [
"Apache-2.0"
] | null | null | null | const ora = require('ora');
const chalk = require('chalk');
const spinner = ora();
class Logger {
constructor(className) {
this.debugLog = console.debug;
this.log = console.log;
this.errorLog = console.error;
this.className = className ? (className + '-') : '';
this.errorPrefix = '[' + this.className + 'E] ';
this.warnPrefix = '[' + this.className + 'W] ';
this.infoPrefix = '[' + this.className + 'I] ';
this.debugPrefix = '[' + this.className + 'D] ';
}
error(msg) {
this.errorLog(' ' + this.errorPrefix + chalk.bold.red(msg));
}
warning(msg) {
this.log(' ' + this.warnPrefix + chalk.bold.orange(msg));
}
info(msg) {
this.log(' ' + this.infoPrefix + msg);
}
debug(msg) {
this.debugLog(' ' + this.debugPrefix + chalk.yellow(msg));
}
spinner() {
const self = this;
return {
start: (text) => {
return spinner.start(text ? (self.infoPrefix + text) : undefined);
},
text: (text) => {
spinner.text = self.infoPrefix + text;
},
fail: (text) => {
return spinner.fail(text ? (self.infoPrefix + chalk.red(text)) : undefined);
},
succeed: (text) => {
return spinner.succeed(text ? (self.infoPrefix + chalk.green(text)) : undefined);
},
clear: () => {
return spinner.clear();
}
}
}
}
module.exports = (className) => {return new Logger(className);};
| 24.948276 | 89 | 0.553559 |
c1a6dcfe09e01249d2e0a3e3b325d9b7decfef90 | 687 | js | JavaScript | socket/index.js | VNNam/teatime | f8d55b20eefb9ae4bf07929a7955a9a56e844a48 | [
"MIT"
] | null | null | null | socket/index.js | VNNam/teatime | f8d55b20eefb9ae4bf07929a7955a9a56e844a48 | [
"MIT"
] | null | null | null | socket/index.js | VNNam/teatime | f8d55b20eefb9ae4bf07929a7955a9a56e844a48 | [
"MIT"
] | 1 | 2022-01-24T09:23:33.000Z | 2022-01-24T09:23:33.000Z | var socket_io = require('socket.io');
var io = socket_io();
var Events = require('./events');
io.on(Events.SOCKET_CONNECT, function (socket) {
console.log('A user connected');
socket.on(Events.GROUP_CONNECT, ({ groupId }) => {
socket.join(groupId);
});
socket.on(Events.USER_IS_TYPING, ({ groupId, username }) => {
socket.broadcast.to(groupId).emit(Events.USER_IS_TYPING, { username });
});
});
function boardcardToGroup(groupId, { message, userId }) {
io.to(groupId).emit(Events.MESSAGE_ADD, { message, userId });
}
function boardcardAll(message) {
io.sockets.emit(Events.MESSAGE_ADD, { message });
}
module.exports = { io, boardcardAll, boardcardToGroup };
| 26.423077 | 75 | 0.68559 |
c1a797afae5e7a2d35345b735fc42c35c655a7d8 | 713 | js | JavaScript | documentation/_pad_layer_8cpp.js | elenita1221/ComputeLibrary | 3d2d44ef55ab6b08afda8be48301ce3c55c7bc67 | [
"MIT"
] | null | null | null | documentation/_pad_layer_8cpp.js | elenita1221/ComputeLibrary | 3d2d44ef55ab6b08afda8be48301ce3c55c7bc67 | [
"MIT"
] | null | null | null | documentation/_pad_layer_8cpp.js | elenita1221/ComputeLibrary | 3d2d44ef55ab6b08afda8be48301ce3c55c7bc67 | [
"MIT"
] | 1 | 2020-05-06T16:31:28.000Z | 2020-05-06T16:31:28.000Z | var _pad_layer_8cpp =
[
[ "pad_layer", "_pad_layer_8cpp.xhtml#a7be2d9cf603602726bd476d9fc37c0d5", null ],
[ "pad_layer", "_pad_layer_8cpp.xhtml#ae1575bcb3cc7ff34f62acef928edb1c5", null ],
[ "pad_layer", "_pad_layer_8cpp.xhtml#abb0d7c0bc41b65699c1fe34a2eb04a00", null ],
[ "pad_layer", "_pad_layer_8cpp.xhtml#a25cda1cefa7ae2a09715f3ffb6a5d576", null ],
[ "pad_layer", "_pad_layer_8cpp.xhtml#a921f72063e0ccace6659b21efc9c0863", null ],
[ "pad_layer", "_pad_layer_8cpp.xhtml#ae53b60f9018a60c6ca6600396d3c6908", null ],
[ "pad_layer", "_pad_layer_8cpp.xhtml#a39e82a98cb963a3853c12151850212fe", null ],
[ "pad_layer", "_pad_layer_8cpp.xhtml#a2fe9174b604a76046782abf86a688fff", null ]
]; | 64.818182 | 85 | 0.765778 |
c1a8141f7b982db911a2b71c56eed0c4c21ae741 | 10,514 | js | JavaScript | index.js | Pzkane/web_dev_1sem_exam | 92b17a9c335b75d3e517b76e8163efdaeefeadca | [
"MIT"
] | null | null | null | index.js | Pzkane/web_dev_1sem_exam | 92b17a9c335b75d3e517b76e8163efdaeefeadca | [
"MIT"
] | null | null | null | index.js | Pzkane/web_dev_1sem_exam | 92b17a9c335b75d3e517b76e8163efdaeefeadca | [
"MIT"
] | null | null | null | window.addEventListener("load", () => {
let input = false;
let credsBlock = document.querySelector(".creds-block");
let loginBtn = document.getElementById("login-btn");
loginBtn.addEventListener("click", () => {
credsBlock.style.display = "block";
setTimeout(() => {
credsBlock.classList.add("reveal");
}, 100);
});
let usrLogin = document.getElementById("usr_login");
let usrPass = document.getElementById("usr_pass");
let confirmLogin = document.querySelector(".creds-block button");
usrLogin.addEventListener("input", () => {
if (usrLogin.value && usrPass.value && !input)
{
input = true;
confirmLogin.style.display = "block";
setTimeout(() => {
confirmLogin.style.transform = "scaleY(1)";
}, 100);
}
if (!usrLogin.value || !usrPass.value)
{
input = false;
confirmLogin.style.transform = "scaleY(0)";
setTimeout(() => {
confirmLogin.style.display = "none";
}, 500);
}
});
usrPass.addEventListener("input", () => {
if (usrLogin.value && usrPass.value && !input)
{
input = true;
confirmLogin.style.display = "block";
setTimeout(() => {
confirmLogin.style.transform = "scaleY(1)";
}, 100);
}
if (!usrLogin.value || !usrPass.value)
{
input = false;
confirmLogin.style.transform = "scaleY(0)";
setTimeout(() => {
confirmLogin.style.display = "none";
}, 500);
}
});
confirmLogin.addEventListener("click", () => {
if (usrLogin.value == CREDENTIALS.login && usrPass.value == CREDENTIALS.pass)
pass();
else
obliterate();
});
function obliterate() {
$("body *").css("display", "none");
$("#doom").css("display", "block");
$("#doom").attr("src", "https://cdnb.artstation.com/p/assets/images/images/010/143/107/original/nadezhda-odinokova-explosion-1.gif?1522796555");
setTimeout(() => {
$("#doom").css("display", "none");
}, 3000);
}
function pass() {
document.querySelector(".intro").style.display = "none";
let controlArticle = document.getElementById("control");
controlArticle.style.display = "block";
function wrapText() {
let textWrapper = document.querySelector("#control p:nth-of-type(1)");
textWrapper.innerHTML = textWrapper.textContent.replace(/\S/g, "<span class='letter'>$&</span>");
anime({
targets: '.letter',
opacity: [0,1],
delay: (el, i) => 20 * (i+1),
duration: 30,
})
_blink('#dash');
}
wrapText();
let mainArticle = document.querySelector("#control article");
let expandArticleBtn = document.querySelector("#control > div button");
expandArticleBtn.addEventListener("click", () => {
expandArticleBtn.style.display = "none";
mainArticle.style.display = "block";
// img clearing to satisfy html validation
if (document.querySelector("#img-container img").getAttribute("src") == "src")
document.querySelector("#img-container img").style.display = "none";
});
let todoApp = document.getElementById("todo");
let input = document.getElementById("input-task");
let addTaskBtn = document.getElementById("add-task");
let todoTasks = [];
let count = -1;
addTaskBtn.addEventListener("click", () => {
if (input.value)
{
todoTasks.push({
id: ++count,
done: false,
description: input.value,
});
input.value = "";
todoApp.innerHTML = "";
for (const task of todoTasks) {
let li = document.createElement("li");
li.setAttribute("name", "_todo_id_"+task.id)
let chkBox = document.createElement("input");
chkBox.setAttribute("type", "checkbox");
chkBox.addEventListener("change", () => {
if (chkBox.checked)
{
li.classList.add("done");
task.done = true;
}
else
{
li.classList.remove("done");
task.done = false;
}
});
li.innerHTML = task.description + " id:" + task.id;
li.appendChild(chkBox);
todoApp.appendChild(li);
}
// set class
let rows = document.querySelectorAll("li[name*='_todo_id_']");
for (const row of rows) {
let idValue = row.getAttribute("name");
idValue = idValue.match(/[0-9]+/)[0];
task = todoTasks.find(task => task.id == idValue);
let box = row.getElementsByTagName("input")[0];
if (task.done)
{
box.checked = true;
row.classList.add("done");
}
else
{
box.checked = false;
row.classList.remove("done");
}
}
}
else
alert("Input is empty!");
});
let fileUpload = document.getElementById("file-input");
fileUpload.addEventListener("change", () => {
if (fileUpload.files && fileUpload.files[0])
{
let img = document.querySelector("#img-container img");
img.style.display = "inline";
img.style.maxWidth = "100%";
img.style.maxHeight = "100%";
img.src = URL.createObjectURL(fileUpload.files[0]);
img.onload = () => {
document.getElementById("color-info-container").style.display = "block";
let ul = document.querySelector("#color-info-container ul");
let label = document.querySelector("#color-info-container p");
ul.innerHTML = "";
label.className = "";
img.style.display = "block";
if (img.width > 500 || img.height > 500)
{
label.innerHTML = "Error! Image size is over 500x500px!";
label.classList.add("error");
img.style.display = "none";
}
else
{
let canvas = document.createElement("canvas");
canvas.width = img.width;
canvas.height = img.height;
console.log("Width: " + img.width);
console.log("Height: " + img.height);
canvas.getContext("2d").drawImage(img, 0, 0, img.width, img.height);
let colorMap = [];
for (let x = -img.width; x < img.width; ++x)
for (let y = -img.height; y < img.height; ++y)
{
let pixelData = canvas.getContext("2d").getImageData(x, y, 1, 1).data;
let rgba = [
pixelData[0], //r
pixelData[1], //g
pixelData[2], //b
pixelData[3], //a
]
let exist = false;
for (const color of colorMap) {
if (arraysEqual(color, rgba))
{
exist = true;
break;
}
}
if (!exist)
colorMap.push(rgba);
}
console.log(colorMap);
// create color list
label.innerHTML = "Number of colors: " + colorMap.length + ". Colors:";
for (const color of colorMap) {
let li = document.createElement("li");
li.style.margin = "40px 0";
let colorSquare = document.createElement("div");
colorSquare.classList.add("color-square")
colorSquare.style.backgroundColor = "rgba("+color[0]+", "+color[1]+", "+color[2]+", "+color[3]+")";
colorSquare.style.border = "dashed 2px #149414";
let textNode = document.createTextNode(`(${color[0]}, ${color[1]}, ${color[2]}, ${color[3]})`);
li.appendChild(colorSquare);
li.appendChild(textNode);
ul.appendChild(li);
}
}
};
}
});
// from validation
$("#submit").on("click", () => {
let fname = $("#firstname").val();
let lname = $("#lastname").val();
let email = $("#email").val();
let submitIsValid = true;
const LENGTH = 24;
$("#fname-error").text("");
$("#lname-error").text("");
$("#email-error").text("");
if (!validLength(fname, LENGTH))
{
$("#fname-error").text(`Input cannot be more than ${LENGTH} characters!`);
submitIsValid = false;
}
if (!validCommonNoun(fname))
{
$("#fname-error").text("Input is not a name - only accepts letters!");
submitIsValid = false;
}
if (!fname.length)
{
$("#fname-error").text("Field cannot be empty!");
submitIsValid = false;
}
if (!validLength(lname, LENGTH + 4))
{
$("#lname-error").text(`Input cannot be more than ${LENGTH + 4} characters!`);
submitIsValid = false;
}
if (!validCommonNoun(lname))
{
$("#lname-error").text("Input is not a name - only accepts letters!");
submitIsValid = false;
}
if (!lname.length)
{
$("#lname-error").text("Field cannot be empty!");
submitIsValid = false;
}
if (!validEmail(email))
{
$("#email-error").text(`Input is not an email - format : xxx@xxx.xxx!`);
submitIsValid = false;
}
if (!email.length)
{
$("#email-error").text("Field cannot be empty!");
submitIsValid = false;
}
if (submitIsValid)
{
$("#firstname").val(fname.toLowerCase());
$("#lastname").val(lname.toLowerCase());
$("#email").val(email.toLowerCase());
$("form")[0].submit();
}
});
}
});
function _blink(selector, delay = 500, duration = 500) {
anime({
targets: selector,
opacity: [0,1],
delay: (el, i) => delay * (i+1),
duration: duration,
loop: true,
})
}
function arraysEqual(a, b) {
if (a === b) return true;
if (a == null || b == null) return false;
if (a.length !== b.length) return false;
for (var i = 0; i < a.length; ++i) {
if (a[i] !== b[i]) return false;
}
return true;
}
function validLength(string, maxLength) {
if (string.length > maxLength)
return false;
return true;
}
function validCommonNoun(string) {
if (string)
if (string.match(/^[a-zA-Z]+$/))
return true;
return false;
}
function validEmail(email) {
if (email.match(/^.[^@]+\@[^\@\\\/\[\]\;\'\"\?\>\<\,\+\=\*]+\..+$/))
return true;
return false;
}
| 30.653061 | 148 | 0.524539 |
c1a85782ce38c8d361c8ff63c46f14213697c74e | 677 | js | JavaScript | vendor/hooks-drum-machine/src/useStart.js | react4j/react4j-drumloop | 09d9fbe316c06ac9fb87e5160da94b7ee88cdc29 | [
"Apache-2.0"
] | null | null | null | vendor/hooks-drum-machine/src/useStart.js | react4j/react4j-drumloop | 09d9fbe316c06ac9fb87e5160da94b7ee88cdc29 | [
"Apache-2.0"
] | null | null | null | vendor/hooks-drum-machine/src/useStart.js | react4j/react4j-drumloop | 09d9fbe316c06ac9fb87e5160da94b7ee88cdc29 | [
"Apache-2.0"
] | null | null | null | import React, { useState } from 'react';
import styled from 'styled-components';
const Start = styled.button`
color: ${props => (props.on === false ? '#25CCF7' : '#FD7272')};
border: 2px solid ${props => (props.on === false ? '#25CCF7' : '#FD7272')};
background: none;
font-family: 'Righteous', cursive;
padding: 10px;
font-size: 18px;
border-radius: 2;
margin: 2px 4px;
margin-right: 20px;
align-self: center;
min-width: 100px;
`;
export default function useStart() {
const [on, set] = useState(false);
const togglePlay = () => set(!on);
return [
on,
<Start on={on} onClick={togglePlay}>
{on ? 'Stop' : 'Play'}
</Start>,
];
}
| 24.178571 | 77 | 0.60709 |
c1a9ababaafc57255dcaa89c25cc3ed9804b7c09 | 1,624 | js | JavaScript | src/site/stages/build/process-cms-exports/transformers/node-press_release.js | bkjohnson/vets-website-content-build | 7932002cfb9a0ebd0f488a709eb238fba9c2da50 | [
"CC0-1.0"
] | 1 | 2020-09-16T17:54:58.000Z | 2020-09-16T17:54:58.000Z | src/site/stages/build/process-cms-exports/transformers/node-press_release.js | bkjohnson/vets-website-content-build | 7932002cfb9a0ebd0f488a709eb238fba9c2da50 | [
"CC0-1.0"
] | null | null | null | src/site/stages/build/process-cms-exports/transformers/node-press_release.js | bkjohnson/vets-website-content-build | 7932002cfb9a0ebd0f488a709eb238fba9c2da50 | [
"CC0-1.0"
] | null | null | null | const moment = require('moment');
const { mapKeys, camelCase } = require('lodash');
const {
createMetaTagArray,
getDrupalValue,
getWysiwygString,
isPublished,
} = require('./helpers');
const transform = entity => ({
entityType: 'node',
entityBundle: 'press_release',
title: getDrupalValue(entity.title),
entityMetatags: createMetaTagArray(entity.metatag.value),
entityUrl: {
path: entity.path[0].alias,
},
fieldAddress: entity.fieldAddress[0]
? mapKeys(entity.fieldAddress[0], (v, k) => camelCase(k))
: null,
fieldIntroText: getDrupalValue(entity.fieldIntroText),
fieldOffice: entity.fieldOffice[0],
fieldPdfVersion: entity.fieldPdfVersion[0] || null,
fieldPressReleaseContact: entity.fieldPressReleaseContact[0]
? [{ entity: entity.fieldPressReleaseContact[0] }]
: [],
fieldPressReleaseDownloads: entity.fieldPressReleaseDownloads,
fieldPressReleaseFulltext: {
processed: getWysiwygString(
getDrupalValue(entity.fieldPressReleaseFulltext),
),
},
fieldReleaseDate: {
value: getDrupalValue(entity.fieldReleaseDate),
date: moment
.utc(getDrupalValue(entity.fieldReleaseDate))
.format('YYYY-MM-DD HH:mm:ss z'),
},
entityPublished: isPublished(getDrupalValue(entity.moderationState)),
});
module.exports = {
filter: [
'title',
'metatag',
'path',
'field_address',
'field_intro_text',
'field_office',
'field_pdf_version',
'field_press_release_contact',
'field_press_release_downloads',
'field_press_release_fulltext',
'field_release_date',
'moderation_state',
],
transform,
};
| 27.066667 | 71 | 0.706897 |
c1aa65cc82d69fd915ff8f13134fd014164da7b4 | 1,714 | js | JavaScript | controllers/home-routes.js | RiveraDenisse/high-five | 0e590b51596e217e2434930ea737cbf9f27a3501 | [
"ISC"
] | 2 | 2021-08-11T13:49:27.000Z | 2021-08-13T23:50:27.000Z | controllers/home-routes.js | RiveraDenisse/high-five | 0e590b51596e217e2434930ea737cbf9f27a3501 | [
"ISC"
] | 11 | 2021-08-14T16:35:46.000Z | 2021-08-21T20:16:31.000Z | controllers/home-routes.js | RiveraDenisse/high-five | 0e590b51596e217e2434930ea737cbf9f27a3501 | [
"ISC"
] | 2 | 2021-08-23T02:33:41.000Z | 2021-08-23T05:21:54.000Z | const router = require('express').Router();
const sequelize = require('../config/connection');
const {
User,
// Post,
// Comment,
// Likes,
Interest,
UserInterest,
} = require('../models');
// this will render the login page
router.get('/', (req, res) => {
res.render('layouts/homepage');
});
// routes to user-feed if they have account
// // get all users for user-feed page
// router.get('/users', (req, res) => {
// User.findAll({
// attributes: ['id', 'username'],
// })
// .then((userData) => {
// const users = userData.map((user) => user.get({ plain: true }));
// console.log(users);
// res.render('user-feed', {
// users,
// loggedIn: req.session.loggedIn,
// });
// console.log(users);
// })
// .catch((err) => {
// console.log(err);
// res.status(500).json(err);
// });
// });
// get all users for user-feed page
router.get('/users', (req, res) => {
UserInterest.findAll({
attributes: ['id', 'user_id', 'interest_id'],
include: [
{
// include users interests (interest model)
model: Interest,
attributes: ['Interest_Category'],
},
{
// include users interests (interest model)
model: UserInterest,
attributes: ['Interest_Category'],
},
],
})
.then((userData) => {
const users = userData.map((user) => user.get({ plain: true }));
console.log(users);
res.render('user-feed', {
users,
loggedIn: req.session.loggedIn,
});
console.log(users);
})
.catch((err) => {
console.log(err);
res.status(500).json(err);
});
});
// user will be routed to the sign-up page if they choose sign-up
router.get('/sign-up', (req, res) => {
res.render('sign-up');
});
module.exports = router;
| 22.552632 | 70 | 0.584014 |
c1aa7be850982744382daf656fcd68e1490c715e | 5,365 | js | JavaScript | src/node/minutedock/minutedockApi.js | EqualExperts/minutedock | a09af7d75402e05b103418478a9dc7dd915e6532 | [
"MIT"
] | 1 | 2019-01-02T08:54:31.000Z | 2019-01-02T08:54:31.000Z | src/node/minutedock/minutedockApi.js | EqualExperts/minutedock | a09af7d75402e05b103418478a9dc7dd915e6532 | [
"MIT"
] | 13 | 2015-06-16T07:29:08.000Z | 2017-12-04T08:57:25.000Z | src/node/minutedock/minutedockApi.js | EqualExperts/minutedock | a09af7d75402e05b103418478a9dc7dd915e6532 | [
"MIT"
] | 5 | 2015-06-16T06:13:58.000Z | 2020-03-05T04:23:56.000Z | var request = require('request');
var Q = require('q');
var config = require('config');
var Minutedock = function (apiKey) {
var self = this;
this.apiKey = apiKey;
this.api = {
accounts:{
all:function () {
return self.request('accounts.json', "GET");
},
active:function () {
return self.request('accounts/current.json', "GET");
}
},
users:{
all:function (accountID) {
var data = { account_id:accountID }
return self.request('users.json', "GET", data);
}
},
entries:{
current:function () {
return self.request('entries/current.json', "GET");
},
update:function (id, data) {
var form_data = { entry:data };
return self.request('entries/' + id + '.json', "PUT", form_data);
},
start:function () {
return self.request('entries/current/start.json', "POST");
},
pause:function () {
return self.request('entries/current/pause.json', "POST");
},
log:function () {
return self.request('entries/current/log.json', "POST");
},
new:function (accountID, data) {
var form_data = {
entry:data,
account_id:accountID
};
return self.request('entries.json', "POST", form_data);
},
search:function (data) {
return self.request('entries.json', "GET", data);
},
delete:function (entryId) {
return self.request('entries/' + entryId + '.json', "DELETE");
}
},
contacts:{
all:function (accountID) {
var data = { account_id:accountID };
return self.request('contacts.json', "GET", data);
},
new:function (accountID, data) {
var form_data = {
contact:data,
account_id:accountID
};
return self.request('contacts.json', "POST", form_data);
},
update:function (id, data) {
var form_data = { contact:data };
return self.request('contacts/' + id + '.json', "PUT", form_data);
}
},
tasks:{
all:function (accountID) {
var data = {account_id:accountID };
return self.request('tasks.json', "GET", data);
},
new:function (accountID, data) {
var form_data = {
task:data,
account_id:accountID
};
return self.request('tasks.json', "POST", form_data);
},
update:function (id, data) {
var form_data = { task:data };
return self.request('tasks/' + id + '.json', "PUT", form_data);
},
delete:function (id) {
return self.request('tasks/' + id + '.json', "DELETE");
},
archive:function (id) {
return self.request('tasks/' + id + '/archive.json', "POST");
}
},
projects:{
all:function (accountID) {
var data = { account_id:accountID };
return self.request('projects.json', "GET", data);
},
new:function (accountID, data) {
var form_data = {
project:data,
account_id:accountID
};
return self.request('projects.json', "POST", form_data);
},
update:function (id, data) {
var form_data = { project:data };
return self.request('projects/' + id + '.json', "PUT", form_data);
},
delete:function (id) {
return self.request('projects/' + id + '.json', "DELETE");
},
archive:function (id) {
return self.request('projects/' + id + '/archive.json', "POST");
}
}
};
return this.api;
};
Minutedock.prototype.request = function (path, method, form_data) {
var data = form_data || {};
data["api_key"] = this.apiKey;
var options = {
"uri" : config["minutedock.base.uri"] + path,
"method":method
};
if(method === "POST" || method === "PUT"){
options.json = data;
} else {
options.json = {};
options.qs = data;
}
var deferred = Q.defer();
request(options, function (error, res, body) {
if(error){
console.error('Request error: ' + error + ' ' + options.uri);
deferred.reject({'status':res.statusCode});
return;
}
if (res.statusCode != 200) {
console.error('MinuteDock API error: ' + res.statusCode + ' ' + options.uri);
deferred.reject({'status':res.statusCode});
return;
}
deferred.resolve(body);
});
return deferred.promise;
};
module.exports = Minutedock; | 33.955696 | 89 | 0.450513 |
c1aafee509148433db76af94ec2cd98f567696d6 | 1,324 | js | JavaScript | 15-puzzle/index/canvas.js | vivaxy/game | 24e402fae9f1f84bb56e5655fa4ab2209a667fbe | [
"MIT"
] | 3 | 2015-08-19T09:52:56.000Z | 2021-10-12T08:46:50.000Z | 15-puzzle/index/canvas.js | vivaxy/game | 24e402fae9f1f84bb56e5655fa4ab2209a667fbe | [
"MIT"
] | 15 | 2018-01-26T06:13:06.000Z | 2022-03-24T13:41:47.000Z | 15-puzzle/index/canvas.js | vivaxy/game | 24e402fae9f1f84bb56e5655fa4ab2209a667fbe | [
"MIT"
] | null | null | null | import { canvasHeight, canvasWidth } from './configs.js';
export default class Canvas {
constructor() {
const canvas = document.querySelector('.js-canvas');
this.canvas = canvas;
this.ctx = canvas.getContext('2d');
this.width = canvasWidth;
this.height = canvasHeight;
canvas.width = canvasWidth;
canvas.height = canvasHeight;
this.styles = {
width: window.innerWidth,
height: window.innerHeight,
top: 0,
left: 0,
};
this.updatePosition();
}
updatePosition() {
const { canvas, width, height, styles } = this;
if (width / height > window.innerWidth / window.innerHeight) {
// canvas is much wider, fit canvas width to window width
styles.width = window.innerWidth;
styles.height = window.innerWidth * height / width;
} else {
styles.height = window.innerHeight;
styles.width = window.innerHeight * width / height;
}
styles.top = (window.innerHeight - styles.height) / 2;
styles.left = (window.innerWidth - styles.width) / 2;
Object.keys(styles).forEach((styleKey) => {
canvas.style[styleKey] = styles[styleKey] + 'px';
});
}
getCtx() {
return this.ctx;
}
getCanvas() {
return this.canvas;
}
clear() {
this.ctx.clearRect(0, 0, this.width, this.height);
}
}
| 26.48 | 66 | 0.626888 |
c1ac7094d8068fb94e2ab9aea2dd420124035ef1 | 2,406 | js | JavaScript | webofneeds/won-owner-webapp/src/main/webapp/app/redux/selectors/process-selectors.js | Schlizohr/webofneeds | e96cd9ab12ca70213f29c3d9423cdac8e1654311 | [
"Apache-2.0"
] | null | null | null | webofneeds/won-owner-webapp/src/main/webapp/app/redux/selectors/process-selectors.js | Schlizohr/webofneeds | e96cd9ab12ca70213f29c3d9423cdac8e1654311 | [
"Apache-2.0"
] | 10 | 2020-02-06T12:10:45.000Z | 2022-01-27T16:20:42.000Z | webofneeds/won-owner-webapp/src/main/webapp/app/redux/selectors/process-selectors.js | Schlizohr/webofneeds | e96cd9ab12ca70213f29c3d9423cdac8e1654311 | [
"Apache-2.0"
] | null | null | null | /**
* Created by quasarchimaere on 21.01.2019.
*/
import { get, getIn } from "../../utils.js";
import * as processUtils from "../utils/process-utils.js";
/**
* Check if anything in the state sub-map of process is currently marked as loading
* @param state (full redux-state)
* @returns true if anything is currently loading
*/
export function isLoading(state) {
const process = get(state, "process");
return (
processUtils.isProcessingInitialLoad(process) ||
processUtils.isProcessingWhatsAround(process) ||
processUtils.isProcessingMetaAtoms(process) ||
processUtils.isProcessingWhatsNew(process) ||
processUtils.isProcessingLogin(process) ||
processUtils.isProcessingLogout(process) ||
processUtils.isProcessingPublish(process) ||
processUtils.isProcessingAcceptTermsOfService(process) ||
processUtils.isProcessingVerifyEmailAddress(process) ||
processUtils.isProcessingResendVerificationEmail(process) ||
processUtils.isProcessingSendAnonymousLinkEmail(process) ||
processUtils.isAnyAtomLoading(process) ||
processUtils.isAnyConnectionLoading(process, true) ||
processUtils.isAnyMessageLoading(process)
);
}
export function isProcessingWhatsNew(state) {
return processUtils.isProcessingWhatsNew(get(state, "process"));
}
export function isProcessingPublish(state) {
return processUtils.isProcessingPublish(get(state, "process"));
}
export function isProcessingAcceptTermsOfService(state) {
return processUtils.isProcessingAcceptTermsOfService(get(state, "process"));
}
export function isProcessingVerifyEmailAddress(state) {
return processUtils.isProcessingVerifyEmailAddress(get(state, "process"));
}
export function isProcessingResendVerificationEmail(state) {
return processUtils.isProcessingResendVerificationEmail(
get(state, "process")
);
}
export function isProcessingSendAnonymousLinkEmail(state) {
return processUtils.isProcessingSendAnonymousLinkEmail(get(state, "process"));
}
export function isAtomLoading(state, atomUri) {
return processUtils.isAtomLoading(get(state, "process"), atomUri);
}
export function isAtomToLoad(state, atomUri) {
return (
!getIn(state, ["atoms", atomUri]) ||
processUtils.isAtomToLoad(get(state, "process"), atomUri)
);
}
export function hasAtomFailedToLoad(state, atomUri) {
return processUtils.hasAtomFailedToLoad(get(state, "process"), atomUri);
}
| 32.958904 | 83 | 0.768911 |
c1ae1eaea8d886a08918f279fde3bc266101f36a | 6,382 | js | JavaScript | pages/resume.js | torijacarlos/personal-spa | b00465aee2c2c9f865ff8f38cb1ea81730dd369d | [
"MIT"
] | null | null | null | pages/resume.js | torijacarlos/personal-spa | b00465aee2c2c9f865ff8f38cb1ea81730dd369d | [
"MIT"
] | 8 | 2021-01-27T20:12:33.000Z | 2022-03-25T01:26:06.000Z | pages/resume.js | torijacarlos/personal-spa | b00465aee2c2c9f865ff8f38cb1ea81730dd369d | [
"MIT"
] | null | null | null | import Layout from "../components/layout"
import Experience from "../components/experience"
import styles from "./resume.module.scss"
export default function Resume() {
return (
<Layout title="Resume">
<div className={styles.layout}>
<div>
<div className={styles.name}>Carlos Alejandro Torija Bravo</div>
<div className={styles.title}>Solutions Architect</div>
<hr className={styles.separator} />
{experienceData.map((e) => {
return <Experience key={e.company+e.role} {...e} companyLink={companyLinks[e.company]}></Experience>
})}
</div>
<div>
<div className={styles.additional}>
<hr className={styles.separator} />
<p>hi@torijacarlos.com</p>
<p>mexico city</p>
<hr className={styles.separator} />
<a href="https://www.linkedin.com/in/torijacarlos/">
<img src="/aws-solarchitect-associate-2020.png"></img>
<img src="/aws-developer-associate-2020.png"></img>
<img src="/aws-sysopadmin-associate-2020.png"></img>
</a>
</div>
</div>
</div>
</Layout>
)
}
const companyLinks = {
"fondeadora": "https://fondeadora.com",
"konfío": "https://konfio.mx",
"netsoft": "https://netsoft.com"
};
const experienceData = [
{
company: "konfío",
role: "Sr. Solutions Architect",
startDate: new Date(2021, 4, 1),
description: "Design and develop tools and solutions that helps us scale our ever growing operation",
responsibilities: [
],
},
{
company: "fondeadora",
role: "VP of Engineering",
startDate: new Date(2020, 6, 1),
endDate: new Date(2021, 3, 15),
description: "Enable the engineering team's growth",
responsibilities: [
"Create, structure and mentor the Data Engineering team that handles the organization's analytics and governance of data",
"Define and implement IT and Security processes, as well as building a Shared services team to align these projects in the organization",
"Manage and align compliance efforts and concerns across the organization",
"Establish organizational structure and refine processes for the engineering team",
],
},
{
company: "konfío",
role: "Lead Architect",
startDate: new Date(2019, 1, 1),
endDate: new Date(2020, 5, 31),
description: "Bring Konfio to an stage in which we can provide our services in a Bank as a service (BaaS) model",
responsibilities: [
"Outline how a multiproduct ecosystem will work within our systems, leaning towards a bank as a service future",
"Establish the architecture of the platform that supports the business operation and growth",
"Design of procedures and standards that make more efficient the execution of the engineering teams",
"Technical mentorship and training of the engineering team",
"Creation and design of tools that improve the developer's efficiency by abstracting the complexity of services and environment setups while providing a smoother learning curve for Konfio's tech environment.",
],
},
{
company: "konfío",
role: "Tech Lead of Internal Tools",
startDate: new Date(2017, 10, 1),
endDate: new Date(2018, 12, 31),
description: "My focus is to scale engineering teams with reliable metrics, structure and processes.",
responsibilities: [
"Redesign of the main in-house ERP/CRM that handles the transactions and history of the customers while providing the required reporting for finance, compliance and collections.",
"Architecture design and implementation of the internal tools that function as a Platform for every team in the company",
"Design of the event-based architecture that allows us to improve the experience of the customer by removing synchronous processes and creates a better tracking of the history of a client",
"Automatization of manual processes that created uncertainty and friction in the customers journey.",
"Design of the architecture required to handle facilities that gives us an easier way to allocate debt while improving reporting",
"Project management across teams covering finance, collections, verification, sales, payments and platform.",
"Technical mentorship and training of the engineering team",
],
},
{
company: "konfío",
role: "Software Engineer",
startDate: new Date(2016, 8, 8),
endDate: new Date(2017, 9, 30),
description: "The objective was to design and implement the systems that would allow the company to have a better understanding of the financial and operational aspects of the company",
responsibilities: [
"Implementation of a standard reporting package for financial analysis based on acquisition numbers, and vintage losses",
"Development of the module that handles the verification process of a customer from approval to disbursement",
"Integration with an external invoicing provider for customer invoices generation",
],
},
{
company: "netsoft",
role: "Software Engineer",
startDate: new Date(2012, 9, 1),
endDate: new Date(2016, 8, 1),
description: "We created customizations for the ERP/CRM that would allow customers improve their operational efficiency",
responsibilities: [
"Creation of a system that would track inventory levels and sales orders to manage work orders for missing manufactured goods",
"Development of a system that would help keep track of physical inventory against inventory registered in the system",
"Implementation of proration algorithms for cost of goods",
"Implementation of a POS system that would work across Panama with integration with an external invoicing provider",
],
},
]
| 52.743802 | 219 | 0.635381 |
c1ae401ad6b6e7a9248dcd7c98b5a413d14681b3 | 80 | js | JavaScript | src/index.js | clementf/dies | 3d891270aacd2defba621088157b8a2f1ce1aabd | [
"MIT"
] | null | null | null | src/index.js | clementf/dies | 3d891270aacd2defba621088157b8a2f1ce1aabd | [
"MIT"
] | null | null | null | src/index.js | clementf/dies | 3d891270aacd2defba621088157b8a2f1ce1aabd | [
"MIT"
] | null | null | null | import './styles.css'
import Dies from './Component.svelte';
export { Dies }
| 11.428571 | 38 | 0.675 |
c1af3732837784690735249ca3ef92c6672834ce | 655 | js | JavaScript | src/elements/paginationElements.js | urgosxd/Blog-CC | 8fcf48f059a40463f558b31c378825ab8623282f | [
"MIT"
] | null | null | null | src/elements/paginationElements.js | urgosxd/Blog-CC | 8fcf48f059a40463f558b31c378825ab8623282f | [
"MIT"
] | null | null | null | src/elements/paginationElements.js | urgosxd/Blog-CC | 8fcf48f059a40463f558b31c378825ab8623282f | [
"MIT"
] | null | null | null | import React from "react"
import tw, { styled } from "twin.macro"
import { Link } from "gatsby"
export const PaginationWrapper = styled.div`
grid-column:2/ span 12;
a:nth-child(1){
${props => (props.isFirts ? tw`text-gray-800` : tw`text-gray-400`)}
pointer-events:${props => (props.isFirts ? "none" : "auto")};
cursor: ${props => (props.isFirts ? "default" : "pointer")};
}
a:nth-child(2){
${props => (props.isLast ? tw`text-gray-800` : tw`text-gray-400`)}
pointer-events:${props => (props.isLast ? "none" : "auto")};
cursor: ${props => (props.isLast ? "default" : "pointer")};
}
`
| 29.772727 | 75 | 0.570992 |
38add19410a20cf7fed87bc539f2bbafb7a34cd2 | 2,355 | js | JavaScript | src/parsers/generic.js | parkmycloud/aws-to-slack | 807cbda7975fb1b21b45f36af8af387fe60d03d8 | [
"MIT"
] | 1 | 2020-02-24T13:59:08.000Z | 2020-02-24T13:59:08.000Z | src/parsers/generic.js | parkmycloud/aws-to-slack | 807cbda7975fb1b21b45f36af8af387fe60d03d8 | [
"MIT"
] | null | null | null | src/parsers/generic.js | parkmycloud/aws-to-slack | 807cbda7975fb1b21b45f36af8af387fe60d03d8 | [
"MIT"
] | 1 | 2021-03-22T10:43:38.000Z | 2021-03-22T10:43:38.000Z | /* eslint lodash/prefer-lodash-method:0 */
"use strict";
const _ = require("lodash"),
SNSParser = require("./sns"),
Slack = require("../slack");
class GenericParser extends SNSParser {
async parse(event) {
try {
// Attempt to treat as JSON-based SNS message
const resp = await super.parse(event);
if (resp) {
return resp;
}
}
catch (err) {
// do nothing
}
// Clone object so we can delete known keys
const fallback = JSON.stringify(event, null, 2);
event = _.clone(event);
let title = "Raw Event",
author_name = "<unknown>",
ts = new Date();
if (event.source) {
let t = [];
if (event.region) {
t.push(event.region);
delete event.region;
}
if (event.account) {
t.push(event.account);
delete event.account;
}
t = t.length ? ` (${t.join(" - ")})` : "";
author_name = `${event.source}${t}`;
delete event.source;
}
if (event["detail-type"]) {
title = event["detail-type"];
delete event["detail-type"];
}
if (event.time) {
try {
ts = new Date(event.time);
delete event.time;
}
catch (err) {
// do nothing
}
}
// Serialize the whole event data
const fields = this.objectToFields(event);
const text = fields ? undefined
: JSON.stringify(event, null, 2)
.replace(/^{\n/, "")
.replace(/\n}\n?$/, "");
return {
attachments: [{
color: Slack.COLORS.neutral,
ts: Slack.toEpochTime(ts),
fallback,
author_name,
title,
text,
fields,
}]
};
}
handleMessage(message) {
const title = this.getSubject();
const time = new Date(this.getTimestamp());
const fields = this.objectToFields(message);
const fallback = JSON.stringify(message);
const text = fields ? undefined : fallback;
return {
attachments: [{
color: Slack.COLORS.neutral,
ts: Slack.toEpochTime(time || new Date()),
fields,
title,
text,
fallback,
}]
};
}
objectToFields(obj) {
let fields;
const keys = _.keys(obj);
if (0 < keys.length && keys.length <= 8) {
fields = [];
for (const i in keys) {
const key = keys[i];
let val = obj[key];
if (!_.isString(val)) {
val = JSON.stringify(val);
}
fields.push({
title: key,
value: val,
short: val.length < 40,
});
}
}
return fields;
}
}
module.exports = GenericParser;
| 19.303279 | 50 | 0.58259 |
38b04072b4959920f410dc789e40c72ea465c489 | 631 | js | JavaScript | es/PictureInPicture.js | eugeneilyin/mdi-norm | e9ee50f99aafa1f4dd77ffbe8c06fbdc49ec58f4 | [
"MIT"
] | 3 | 2018-11-11T01:48:20.000Z | 2019-12-02T06:13:14.000Z | es/PictureInPicture.js | eugeneilyin/mdi-norm | e9ee50f99aafa1f4dd77ffbe8c06fbdc49ec58f4 | [
"MIT"
] | 1 | 2019-02-21T05:59:35.000Z | 2019-02-21T21:57:57.000Z | es/PictureInPicture.js | eugeneilyin/mdi-norm | e9ee50f99aafa1f4dd77ffbe8c06fbdc49ec58f4 | [
"MIT"
] | null | null | null | import { createThemedIcon } from './utils/createThemedIcon';
import { FilledPictureInPicture } from './FilledPictureInPicture';
import { OutlinePictureInPicture } from './OutlinePictureInPicture';
import { RoundPictureInPicture } from './RoundPictureInPicture';
import { SharpPictureInPicture } from './SharpPictureInPicture';
import { TwoTonePictureInPicture } from './TwoTonePictureInPicture';
export var PictureInPicture =
/*#__PURE__*/
function PictureInPicture(props) {
return createThemedIcon(props, FilledPictureInPicture, OutlinePictureInPicture, RoundPictureInPicture, SharpPictureInPicture, TwoTonePictureInPicture);
}; | 57.363636 | 153 | 0.81775 |
38b069cd5a61e156ea7807dc9cc0f70fe27c562d | 18,430 | js | JavaScript | oferle/src/admin/Cms/HowItWorks/CmsHowItWorks.js | RameshChauhanExpert/secret | 3fcb023a0948568f21cb52f5a5f148701abd0827 | [
"MIT"
] | null | null | null | oferle/src/admin/Cms/HowItWorks/CmsHowItWorks.js | RameshChauhanExpert/secret | 3fcb023a0948568f21cb52f5a5f148701abd0827 | [
"MIT"
] | null | null | null | oferle/src/admin/Cms/HowItWorks/CmsHowItWorks.js | RameshChauhanExpert/secret | 3fcb023a0948568f21cb52f5a5f148701abd0827 | [
"MIT"
] | null | null | null | import React,{ Component } from "react";
import { TextField, FormControl,InputLabel,Typography, MenuItem, Button,Select,connect,withRouter} from "../../../utilities"
import { Editor } from 'react-draft-wysiwyg';
import { cms_home_fetch, cms_home_submit ,cms_home_state_update} from "../../../action";
import { EditorState } from 'draft-js';
import $ from "jquery";
import PropTypes from 'prop-types';
import CKEditor from 'ckeditor4-react';
//import { Loader, CommanSnackBar } from "../../../components";
import { constant } from "../../../config";
// core components
// material-ui
import withStyles from "@material-ui/core/styles/withStyles";
// @material-ui/icons
import Language from "@material-ui/icons/Language";
import GridContainer from "../../../components/Grid/GridContainer.jsx";
import GridItem from "../../../components/Grid/GridItem.jsx";
import Card from "../../../components/Card/Card.jsx";
import CardBody from "../../../components/Card/CardBody.jsx";
import CardHeader from "../../../components/Card/CardHeader.jsx";
import CardIcon from "../../../components/Card/CardIcon.jsx";
import FadeSnackbar from '../../../components/SnackBar/SnackBar.js';
import Loader from '../../../components/loader/loader.js';
import "../Cms.css";
export default class CmsHowItWorks extends React.Component {
constructor(props){
super(props);
this.state = {
id:'',
image: null,
main_title: '',
content: '',
title: '',
description: '',
step1_title: '',
step1_desc: '',
step1_image: null,
step2_title: '',
step2_desc: '',
step2_image: null,
step3_title: '',
step3_desc: '',
step3_image: null,
step4_title: '',
step4_desc: '',
step4_image: null,
step5_title: '',
step5_desc: '',
step5_image: null,
snackbar_open: false,
api_message: '',
isLoading: false,
}
this.handleChange=this.handleChange.bind(this);
this.handleSubmit=this.handleSubmit.bind(this);
//this.imageAction=this.imageAction.bind(this);
this.onFileChangeHandler=this.onFileChangeHandler.bind(this);
//this.fileUpload=this.fileUpload.bind(this);
//this.createImage=this.createImage.bind(this);
}
handleChange(e){
this.setState({ [e.target.name]: e.target.value});
}
componentWillMount(){
this.setState({ isLoading: true })
fetch(constant.base_url+constant.server_url.cms_how_it_works_fetch,{
method:"GET",
headers:{
'Accept': 'application/json',
"Content-type": "application/x-www-form-urlencoded; charset=UTF-8",
},
})
.then((response) => response.json())
.then((responseJson) => {
if(responseJson.status==200)
{
//console.log(responseJson.data[0].title);
this.setState({
id: responseJson.data[0].id,
image : responseJson.data[0].image,
main_title: responseJson.data[0].main_title,
content: responseJson.data[0].content,
title: responseJson.data[0].title,
description: responseJson.data[0].description,
step1_title: responseJson.data[0].step1_title,
step1_desc: responseJson.data[0].step1_desc,
step1_image: responseJson.data[0].step1_image,
step2_title: responseJson.data[0].step2_title,
step2_desc: responseJson.data[0].step2_desc,
step2_image: responseJson.data[0].step2_image,
step3_title: responseJson.data[0].step3_title,
step3_desc: responseJson.data[0].step3_desc,
step3_image: responseJson.data[0].step3_image,
step4_title: responseJson.data[0].step4_title,
step4_desc: responseJson.data[0].step4_desc,
step4_image: responseJson.data[0].step4_image,
step5_title: responseJson.data[0].step5_title,
step5_desc: responseJson.data[0].step5_desc,
step5_image: responseJson.data[0].step5_image,
});
this.setState({ isLoading: false })
}
})
.catch((error) => {
console.error(error);
this.setState({ isLoading: false })
});
}
onFileChangeHandler(event){
console.log(event.target.files[0]);
this.setState({[event.target.name]:event.target.files[0]});
}
handleSubmit(e){
this.setState({ isLoading: true })
e.preventDefault();
console.log("state data",this.state);
fetch(constant.base_url+constant.server_url.cms_how_it_works_update,{
method:"POST",
headers:{
'Accept': 'application/json',
"Content-type": "application/x-www-form-urlencoded; charset=UTF-8; multipart/form-data",
},
body:"Data="+JSON.stringify(this.state)
})
.then(res=>res.json())
.then(response=>{ console.log(response);
if(response.status==200)
{
this.setState({ isLoading: false })
this.setState({snackbar_open: true, api_message: response.message})
setTimeout(() => {this.setState({snackbar_open: false, api_message: ''})},4000)
console.log(response.status);
}
else if(response.status==401){
this.setState({ isLoading: false })
this.setState({snackbar_open: true, api_message: response.message})
setTimeout(() => {this.setState({snackbar_open: false, api_message: ''})},4000)
console.log(response.status);
}
})
.catch(error=>{
this.setState({ isLoading: false })
console.error(error);
})
}
render() {
return (
<div className="page-edit-wrapper">
{this.state.isLoading ? <Loader /> : null}
<form id="cms_home" onSubmit = {this.handleSubmit}>
<GridContainer>
<GridItem xs={12} sm={12} md={6}>
<Card>
<CardHeader style={{background:"#20dacb"}}>
<h4 className="cardTitle">How It Works Main Content</h4>
</CardHeader>
<CardBody>
<div className="page-title">
<Typography variant="title" gutterBottom>Main Title</Typography>
<input type="text" placeholder="Main Title" name="main_title" margin="normal" color="primary" variant="outlined" className="input-conrtol formField" onChange = {this.handleChange} defaultValue={this.state.main_title} />
</div>
<div className="page-title">
<Typography variant="title" gutterBottom>Image</Typography>
<input name="image" accept="image/*" type="file" onChange={this.onFileChangeHandler} id="edit-label" className="input-conrtol" />
<img className="existingFile" src={ (this.state.image!=null &&this.state.image!=undefined && this.state.image!="" && typeof this.state.image === "string")?constant.file_url+this.state.image:''} alt="" height="50px" width="50px" />
</div>
<div className="page-html">
<Typography variant="title" gutterBottom>Content</Typography>
<CKEditor
name="content"
data={this.state.content} onChange={evt => this.setState( { content: evt.editor.getData() } )}
/>
<label>
<input name="content" className="hidden" type="text" />
</label>
</div>
</CardBody>
</Card>
</GridItem>
<GridItem xs={12} sm={12} md={6}>
<Card>
<CardHeader style={{background:"#20dacb"}}>
<h4 className="cardTitle">Page Content</h4>
</CardHeader>
<CardBody>
<div className="page-title">
<Typography variant="title" gutterBottom>Main Title</Typography>
<input type="text" placeholder="Main Title" name="title" margin="normal" color="primary" variant="outlined" className="input-conrtol formField" onChange = {this.handleChange} defaultValue={this.state.title}/>
</div>
<div className="page-html">
<Typography variant="title" gutterBottom>Main Description</Typography>
<CKEditor
name="description"
data={this.state.description} onChange={evt => this.setState( { description: evt.editor.getData() } )}
/>
<label>
<input name="description" className="hidden" type="text" />
</label>
</div>
</CardBody>
</Card>
</GridItem>
<GridItem xs={12} sm={12} md={6}>
<Card>
<CardHeader className="card" style={{background:"#20dacb",width: "100px"}} icon>
<h4 className="cardTitle">Step 01</h4>
</CardHeader>
<CardBody>
<div className="page-title">
<Typography variant="title" gutterBottom>Step 1 Title</Typography>
<input type="text" placeholder="Step 1 Title" name="step1_title" margin="normal" color="primary" variant="outlined" className="input-conrtol formField" onChange = {this.handleChange} defaultValue={this.state.step1_title}/>
</div>
<div className="page-html">
<Typography variant="title" gutterBottom>Step 1 Description</Typography>
<CKEditor
name="step1_desc"
data={this.state.step1_desc} onChange={evt => this.setState( { step1_desc: evt.editor.getData() } )}
/>
<label>
<input name="step1_desc" className="hidden" type="text" />
</label>
</div>
<div className="page-title">
<Typography variant="title" gutterBottom>Step 1 Image</Typography>
<input name="step1_image" accept="image/*" type="file" onChange={this.onFileChangeHandler} id="edit-label" className="input-conrtol" />
<img className="existingFile" src={ (this.state.step1_image!=null &&this.state.step1_image!=undefined && this.state.step1_image!="" && typeof this.state.step1_image === "string")?constant.file_url+this.state.step1_image:''} alt="" height="50px" width="50px" />
</div>
</CardBody>
</Card>
</GridItem>
<GridItem xs={12} sm={12} md={6}>
<Card>
<CardHeader className="card" style={{background:"#20dacb",width: "100px"}} icon>
<h4 className="cardTitle">Step 02</h4>
</CardHeader>
<CardBody>
<div className="page-title">
<Typography variant="title" gutterBottom>Step 2 Title</Typography>
<input type="text" placeholder="Step 2 Title" name="step2_title" margin="normal" color="primary" variant="outlined" className="input-conrtol formField" onChange = {this.handleChange} defaultValue={this.state.step2_title} />
</div>
<div className="page-html">
<Typography variant="title" gutterBottom>Step 2 Description</Typography>
<CKEditor
name="step2_desc"
data={this.state.step2_desc} onChange={evt => this.setState( { step2_desc: evt.editor.getData() } )}
/>
<label>
<input name="step2_desc" className="hidden" type="text" />
</label>
</div>
<div className="page-title">
<Typography variant="title" gutterBottom>Step 2 Image</Typography>
<input name="step2_image" accept="image/x-png,image/jpeg" type="file" onChange={event => this.setState( { step2_image: event.target.files[0] } )} id="edit-label" className="input-conrtol" />
<img className="existingFile" src={ (this.state.step2_image!=null && this.state.step2_image!=undefined && this.state.step2_image!="" && typeof this.state.step2_image === "string")?constant.file_url+this.state.step2_image:''} alt="" height="50px" width="50px" />
</div>
</CardBody>
</Card>
</GridItem>
<GridItem xs={12} sm={12} md={6}>
<Card>
<CardHeader className="card" style={{background:"#20dacb",width: "100px"}} icon>
<h4 className="cardTitle">Step 03</h4>
</CardHeader>
<CardBody>
<div className="page-title">
<Typography variant="title" gutterBottom>Step 3 Title</Typography>
<input type="text" placeholder="Step 3 Title" name="step3_title" margin="normal" color="primary" variant="outlined" className="input-conrtol formField" onChange = {this.handleChange} defaultValue={this.state.step3_title} />
</div>
<div className="page-html">
<Typography variant="title" gutterBottom>Step 3 Description</Typography>
<CKEditor
name="step3_desc"
data={this.state.step3_desc} onChange={evt => this.setState( { step3_desc: evt.editor.getData() } )}
/>
<label>
<input name="step3_desc" className="hidden" type="text" />
</label>
</div>
<div className="page-title">
<Typography variant="title" gutterBottom>Step 3 Image</Typography>
<input name="step3_image" accept="image/x-png,image/jpeg" type="file" onChange={event => this.setState( { step3_image: event.target.files[0] } )} id="edit-label" className="input-conrtol" />
<img className="existingFile" src={ (this.state.step3_image!=null && this.state.step3_image!=undefined && this.state.step3_image!="" && typeof this.state.step3_image === "string")?constant.file_url+this.state.step3_image:''} alt="" height="50px" width="50px" />
</div>
</CardBody>
</Card>
</GridItem>
<GridItem xs={12} sm={12} md={6}>
<Card>
<CardHeader className="card" style={{background:"#20dacb",width: "100px"}} icon>
<h4 className="cardTitle">Step 04</h4>
</CardHeader>
<CardBody>
<div className="page-title">
<Typography variant="title" gutterBottom>Step 4 Title</Typography>
<input type="text" placeholder="Step 4 Title" name="step4_title" margin="normal" color="primary" variant="outlined" className="input-conrtol formField" onChange = {this.handleChange} defaultValue={this.state.step4_title} />
</div>
<div className="page-html">
<Typography variant="title" gutterBottom>Step 4 Description</Typography>
<CKEditor
name="step4_desc"
data={this.state.step4_desc} onChange={evt => this.setState( { step4_desc: evt.editor.getData() } )}
/>
<label>
<input name="step4_desc" className="hidden" type="text" />
</label>
</div>
<div className="page-title">
<Typography variant="title" gutterBottom>Step 4 Image</Typography>
<input name="step4_image" accept="image/x-png,image/jpeg" type="file" onChange={event => this.setState( { step4_image: event.target.files[0] } )} id="edit-label" className="input-conrtol" />
<img className="existingFile" src={ (this.state.step4_image!=null && this.state.step4_image!=undefined && this.state.step4_image!="" && typeof this.state.step4_image === "string")?constant.file_url+this.state.step4_image:''} alt="" height="50px" width="50px" />
</div>
</CardBody>
</Card>
</GridItem>
<GridItem xs={12} sm={12} md={6}>
<Card>
<CardHeader className="card" style={{background:"#20dacb",width: "100px"}} icon>
<h4 className="cardTitle">Step 05</h4>
</CardHeader>
<CardBody>
<div className="page-title">
<Typography variant="title" gutterBottom>Step 5 Title</Typography>
<input type="text" placeholder="Step 5 Title" name="step5_title" margin="normal" color="primary" variant="outlined" className="input-conrtol formField" onChange = {this.handleChange} defaultValue={this.state.step5_title} />
</div>
<div className="page-html">
<Typography variant="title" gutterBottom>Step 5 Description</Typography>
<CKEditor
name="step5_desc"
data={this.state.step5_desc} onChange={evt => this.setState( { step5_desc: evt.editor.getData() } )}
/>
<label>
<input name="step5_desc" className="hidden" type="text" />
</label>
</div>
<div className="page-title">
<Typography variant="title" gutterBottom>Step 5 Image</Typography>
<input name="step5_image" accept="image/x-png,image/jpeg" type="file" onChange={event => this.setState( { step5_image: event.target.files[0] } )} id="edit-label" className="input-conrtol" />
<img className="existingFile" src={ (this.state.step5_image!=null && this.state.step5_image!=undefined && this.state.step5_image!="" && typeof this.state.step5_image === "string")?constant.file_url+this.state.step5_image:''} alt="" height="50px" width="50px" />
</div>
</CardBody>
</Card>
</GridItem>
</GridContainer>
<div className="action-button">
<input type="submit" className="btn btn-primary pull-right" name="submit" value="Submit"/>
</div>
</form>
<FadeSnackbar
snackbar = {{show: this.state.snackbar_open, message: this.state.api_message}}
//duration = {4000}
/>
</div>
)
}
}
| 48.885942 | 278 | 0.567878 |
38b095bce1e91dbfe0ec358e3f39e04f9e5da30b | 170 | js | JavaScript | src/utils.js | kalos-framework/kalos | 8e49ee1d17a2c9fbcae4dd49011d32bb306a23ea | [
"MIT"
] | 1 | 2019-08-08T05:19:28.000Z | 2019-08-08T05:19:28.000Z | src/utils.js | kalos-framework/kalos | 8e49ee1d17a2c9fbcae4dd49011d32bb306a23ea | [
"MIT"
] | 4 | 2019-08-08T02:57:55.000Z | 2019-08-10T20:03:40.000Z | src/utils.js | kalos-framework/kalos | 8e49ee1d17a2c9fbcae4dd49011d32bb306a23ea | [
"MIT"
] | null | null | null | export function trimslashes(s) {
if (s.length > 1 && s.indexOf('/', s.length - 1 - '/'.length) !== -1) {
s = s.substr(0, s.length - 1);
}
return s;
}
| 24.285714 | 75 | 0.488235 |
38b1f26764d106da3c1e8eff6acc930dd1c7282a | 560 | js | JavaScript | src/main.js | RainedX/vue3-admin | cb825b35f9c4229c5fab2caba422c256199a74fa | [
"MIT"
] | null | null | null | src/main.js | RainedX/vue3-admin | cb825b35f9c4229c5fab2caba422c256199a74fa | [
"MIT"
] | null | null | null | src/main.js | RainedX/vue3-admin | cb825b35f9c4229c5fab2caba422c256199a74fa | [
"MIT"
] | null | null | null | import { createApp } from "vue";
import App from "./App.vue";
import router from "@/router";
import store from "@/store";
import { components } from "@/config/element";
import "element-plus/lib/theme-chalk/index.css";
// 全局样式引入
import "@/styles/index.scss";
import "./permission.js";
// 指令
import permission from "@/directive/permission";
const app = createApp(App);
components.forEach((component) => {
app.component(component.name, component);
});
app.directive("permission", permission);
app
.use(store)
.use(router)
.mount("#app");
// 按钮权限
// 面包蟹 | 22.4 | 48 | 0.691071 |
38b218a3408b32397b11059178a20f5c9818fe42 | 858 | js | JavaScript | receivedFrom.js | davidweisss/iHodLWeb | fb5308484127e218a78886bb89163ac26d352650 | [
"MIT"
] | 3 | 2019-11-14T19:31:35.000Z | 2020-04-09T20:24:59.000Z | receivedFrom.js | davidweisss/iHodLWeb | fb5308484127e218a78886bb89163ac26d352650 | [
"MIT"
] | null | null | null | receivedFrom.js | davidweisss/iHodLWeb | fb5308484127e218a78886bb89163ac26d352650 | [
"MIT"
] | null | null | null | let receivedFrom = async (client, to, from) => {
console.log('checking for payment to:', to, '/n from:', from)
let txs = await client.listTransactions()
let addresses = txs.map(x => x.address)
let idx = addresses.indexOf(to)
if(idx<0){
return(0)
}else{
let tx = txs[idx]
console.log('tx',tx)
let txid = tx.txid
let rawtx = await client.getTransaction(tx.txid)
let decodedtx = await client.decodeRawTransaction(rawtx.hex)
// assume only one input [0]
upstreamtxid = decodedtx.vin[0].txid
rawupstreamtx = await client.getTransaction(upstreamtxid)
upstreamtx = await client.decodeRawTransaction(rawupstreamtx.hex)
let hit = upstreamtx.vout.map(x=>x.scriptPubKey.addresses[0] === from).reduce((v,w)=>v+w)
console.log('hit', hit)
return(hit)
}
}
module.exports = { receivedFrom: receivedFrom }
| 33 | 93 | 0.675991 |
38b2e7f71374eaae3a4e91e9124bc57bc8aeed9f | 2,356 | js | JavaScript | lib/Touches.js | danielgindi/dom-utils | e92c35445870cec56440019998d254b292a7cdad | [
"MIT"
] | null | null | null | lib/Touches.js | danielgindi/dom-utils | e92c35445870cec56440019998d254b292a7cdad | [
"MIT"
] | null | null | null | lib/Touches.js | danielgindi/dom-utils | e92c35445870cec56440019998d254b292a7cdad | [
"MIT"
] | null | null | null | /**
* @param {Element} el
* @param {Object} [options]
* @param {number|undefined} [options.distance=9]
* @param {function(event: TouchEvent)} [options.handler]
* @returns {{ unbind: Function }}
*/
const bindTouchTap = function (el, options) {
let currentTouchId = null;
let downPos = null;
const startHandler = evt => {
if (currentTouchId !== null) return;
let touch = evt.changedTouches[0];
currentTouchId = touch.identifier;
downPos = touch
? { x: touch.pageX, y: touch.pageY }
: { x: evt.pageX, y: evt.pageY };
el.addEventListener('touchend', endHandler);
el.addEventListener('touchcancel', cancelHandler);
};
const endHandler = evt => {
if (currentTouchId === null) return;
let touch = null;
if (evt.changedTouches) {
if (currentTouchId != null) {
for (let item of evt.changedTouches) {
if (item.identifier === currentTouchId) {
touch = item;
break;
}
}
}
if (!touch) {
touch = evt.changedTouches[0];
}
}
let currentPos = touch
? { x: touch.pageX, y: touch.pageY }
: { x: evt.pageX, y: evt.pageY };
let startPos = downPos;
currentTouchId = null;
downPos = null;
if (options.distance !== null) {
let distanceThreshold = options.distance || 1;
let distanceTravelled = Math.hypot(Math.abs(currentPos.x - startPos.x), Math.abs(currentPos.y - startPos.y));
if (distanceTravelled >= distanceThreshold) return false;
}
options.handler && options.handler(evt);
};
const cancelHandler = () => {
currentTouchId = null;
downPos = null;
el.removeEventListener('touchend', endHandler);
el.removeEventListener('touchcancel', cancelHandler);
};
el.addEventListener('touchstart', startHandler);
return {
unbind: () => {
el.removeEventListener('touchstart', startHandler);
el.removeEventListener('touchend', endHandler);
el.removeEventListener('touchcancel', cancelHandler);
},
};
};
export {
bindTouchTap,
};
| 27.717647 | 121 | 0.543294 |
38b396349fa192d444b3325346d314f6b3347949 | 39,800 | js | JavaScript | flow-types/types/chocolatechipjs_vx.x.x/flow_v0.25.x-/chocolatechipjs.js | goodmind/FlowDefinitelyTyped | 9b2bf8af438bf10f6a375f441301109be02ef876 | [
"MIT"
] | 15 | 2019-02-09T07:05:17.000Z | 2021-04-04T14:30:00.000Z | flow-types/types/chocolatechipjs_vx.x.x/flow_v0.25.x-/chocolatechipjs.js | goodmind/FlowDefinitelyTyped | 9b2bf8af438bf10f6a375f441301109be02ef876 | [
"MIT"
] | 1 | 2021-05-08T04:00:43.000Z | 2021-05-08T04:00:43.000Z | flow-types/types/chocolatechipjs_vx.x.x/flow_v0.25.x-/chocolatechipjs.js | goodmind/FlowDefinitelyTyped | 9b2bf8af438bf10f6a375f441301109be02ef876 | [
"MIT"
] | 4 | 2019-03-21T14:39:18.000Z | 2020-11-04T07:42:28.000Z | declare module "chocolatechipjs" {
declare interface ChocolateChipStatic {
/**
* Accepts a string containing a CSS selector which is then used to match a set of elements.
* @param selector A string containing a selector expression
* @param context A DOM HTMLElement to use as context
*/
(
selector: string | HTMLElement | Document,
context?: HTMLElement | ChocolateChipElementArray
): ChocolateChipElementArray;
/**
* Binds a function to be executed when the DOM has finished loading.
* @param callback A function to execute after the DOM is ready.
*/
(callback: () => any): void;
/**
* Accepts a string containing a CSS selector which is then used to match a set of elements.
* @param element A DOM element to wrap in an array.
*/
(element: HTMLElement): ChocolateChipElementArray;
/**
* Accepts a string containing a CSS selector which is then used to match a set of elements.
* @param elementArray An array of DOM elements to convert into a ChocolateChip Collection.
*/
(elementArray: ChocolateChipElementArray): ChocolateChipElementArray;
/**
* Accepts the document element and returns it wrapped in an array.
* @param document The document object.
*/
(document: Document): Document[];
/**
* If no argument is provided, return the document as a ChocolateChipElementArray.
*/
(): Document[];
/**
* Extend the ChocolateChipJS object itself with the provided object.
* @param object The object to add to ChocolateChipJS.
* @return The ChocolateChipJS object.
*/
extend(object: Object): Object;
/**
* Extend a target object with another object.
* @param target An object to extend.
* @param object The object to add to the target.
* @return The extended object.
*/
extend(target: Object, object: Object): Object;
/**
* The base for extending ChocolateChipJS collections, which are arrays of elements.
*/
fn: {
/**
* This method adds the provided object to the Array prototype to make it available to all arrays of HTML elements.
* @param object And object to add to element arrays.
* @return The extended array of elements.
*/
extend(object: Object): HTMLElement[]
};
/**
* Contains the version of ChocolateChipJS in use.
*/
version: string;
/**
* Contains the name of the library (ChocolateChip).
*/
libraryName: string;
/**
* An empty function.
*/
noop(): void;
/**
* Uuid number.
*/
uuid: number;
/**
* Create a random number to use as a uuid.
*/
uuidNum(): number;
/**
* Creates a uuid using uuidNum().
*/
makeUuid(): string;
/**
* Create a ChocolateChip collection object by creating elements from an HTML string.
*/
make(selector: string): ChocolateChipElementArray;
/**
* Create a ChocolateChip collection object by creating elements from an HTML string. This is an alias for $.make.
*/
html(selector: string): ChocolateChipElementArray;
/**
* Replace one element with another.
* @return {HTMLElement[]}
*/
replace(
newElement: ChocolateChipElementArray,
oldElement: ChocolateChipElementArray
): void;
/**
* Load a JavaScript file from a url, then execute it.
* @param url A string containing the URL where the script resides.
* @param callback A callback function that is executed after the script loads.
* @return {void}
*/
require(url: string, callback: Function): Function;
/**
* Process JavaScript returned by Ajax request. An optional name can be used to create a custom variable name by which the data is exposed, otherwise it is exposed with the variable "data".
* @param url A string containing the URL where the script resides.
* @param callback A callback function that is executed after the script loads.
* @return {Function}
*/
processJSON(json: string, name?: string): any;
/**
* This method takes a referenced form and serializes its element names and values, which it returns as a string. This is required if you want to send form data.
* @param element A string, HTML element or ChocolateChipElementArray containing a reference to a from.
* @return An encode string form element names and values.
*/
serialize(element: any): string;
/**
* Parse the data in a Promise response as JSON.
* @param response The response from a Promise.
*/
json(reponse: Response): JSON;
/**
* This method will defer the execution of a function until the call stack is clear.
* @param callback A function to execute.
* @param duration The number of milliseconds to delay execution.
*/
delay(callback: Function, duration?: number): any;
/**
* The method will defer the execution of its callback until the call stack is clear.
* @param callback A callback to execute after a delay.
*/
defer(callback: Function): Function;
/**
* This method makes sure a method always returns an array.
* If no values are available to return, it returns and empty array.
* This is to make sure that methods that expect a chainable array will not throw and exception.
* @param result The result of a method to test if it can be returned in an array.
* @return An array holding the results of a method, otherwise an empty array.
*/
returnResult(result: HTMLElement[]): any[];
/**
* This method allows you to execute a callback on each item in an array of elements.
* @param array An array of elements.
* @param callback A callback to execute on each element. This has two parameters: the context, followed by the index of the current iteration.
*/
each<T>(array: T[], callback: (ctx: T, idx: number) => any): any;
/**
* This method will concatenate strings or values as a cleaner alternative to using the '+' operator.
* @param {string | number} A comma separated series of strings to concatenate.
*/
concat(...string: string[]): string;
/**
* This method takes a space-delimited string of words and returns it as an array where the individual words are indices.
* @param Any string with values separated by spaces.
*/
w(string: string): string[];
/**
* This method converts a string of hyphenated tokens into a camel cased string.
* @param string A string of hyphenated tokens.
*/
camelize(string: string): string;
/**
* This method converts a camel case string into lowercase with hyphens.
* @param string A camel case string.
*/
deCamelize(string: string): string;
/**
* This method capitalizes the first letter of a string.
*/
capitalize(string: string, boolean?: boolean): string;
/**
* Determine whether the argument is a string.
* @param obj Object to test whether or not it is a string.
*/
isString(obj: any): boolean;
/**
* Determine whether the argument is an array.
* @param obj Object to test whether or not it is an array.
*/
isArray(obj: any): boolean;
/**
* Determine whether the argument is a function.
* @param obj Object to test whether or not it is an function.
*/
isFunction(obj: any): boolean;
/**
* Determine whether the argument is an object.
* @param obj Object to test whether or not it is an object.
*/
isObject(obj: any): boolean;
/**
* Determine whether the argument is an empty object.
* @param obj Object to test whether or not it is an empty object.
* @return boolean
*/
isEmptyObject(obj: any): boolean;
/**
* Determine whether the argument is an empty object.
* @param obj Object to test whether or not it is an empty object.
*/
isEmptyObject(obj: any): boolean;
/**
* Determine whether the argument is a number.
* @param obj Object to test whether or not it is a number.
*/
isNumber(obj: any): boolean;
/**
* Determine whether the argument is an integer.
* @param obj Object to test whether or not it is an integer.
*/
isInteger(obj: any): boolean;
/**
* Determine whether the argument is a float.
* @param obj Object to test whether or not it is a float.
*/
isFloat(obj: any): boolean;
/**
* Whether device is iPhone.
*/
isiPhone: boolean;
/**
* Whether device is iPad.
*/
isiPad: boolean;
/**
* Whether device is iPod.
*/
isiPod: boolean;
/**
* Whether OS is iOS.
*/
isiOS: boolean;
/**
* Whether OS is Android
*/
isAndroid: boolean;
/**
* Whether OS is WebOS.
*/
isWebOS: boolean;
/**
* Whether OS is Blackberry.
*/
isBlackberry: boolean;
/**
* Whether OS supports touch events.
*/
isTouchEnabled: boolean;
/**
* Whether there is a network connection.
*/
isOnline: boolean;
/**
* Whether app is running in stanalone mode.
*/
isStandalone: boolean;
/**
* Whether OS is iOS 6.
*/
isiOS6: boolean;
/**
* Whether OS i iOS 7.
*/
isiOS7: boolean;
/**
* Whether OS is Windows.
*/
isWin: boolean;
/**
* Whether device is Windows Phone.
*/
isWinPhone: boolean;
/**
* Whether browser is IE10.
*/
isIE10: boolean;
/**
* Whether browser is IE11.
*/
isIE11: boolean;
/**
* Whether browser is Webkit based.
*/
isWebkit: boolean;
/**
* Whether browser is running on mobile device.
*/
isMobile: boolean;
/**
* Whether browser is running on desktop.
*/
isDesktop: boolean;
/**
* Whether browser is Safari.
*/
isSafari: boolean;
/**
* Whether browser is Chrome.
*/
isChrome: boolean;
/**
* Is native Android browser (not mobile Chrome).
*/
isNativeAndroid: boolean;
/**
* Serialize
*/
serialize(form: HTMLFormElement | ChocolateChipElementArray): string;
/**
* Grabs values from a form and converts them into a JSON object.
* @param rootNode : A form whose values you want to convert to JSON.
* @param delimiter A delimiter to namespace your form values. The default is "."
You use the form input's name to set up the namespace structure for your JSON, e.g. name="newUser.name.first".
*/
form2JSON(rootNode: string | HTMLElement, delimiter: string): Object;
/**
* Subscribe to a publication. You provide the topic you want to subscribe to, as well as a callback to execute when a publication occurs.
* Any data passed by the publisher is exposed to the callback as its second parameter. The callback's first parameter is the published topic.
* @param topic A topic to subscribe to. This can be a single term, or any type of namespaced term with delimiters.
* @param callback You can receive any type: string, number, array, object, etc.
*/
subscribe(
topic: string,
callback: (topic: string, data: any) => any
): boolean;
/**
* Unsubscribe from a topic. Pass this the topic you wish to unsubscribe from. The subscription will be terminated immediately.
* @param topic The name of the topic to unsubscribe from.
*/
unsubscribe(topic: string): void;
/**
* Publish a topic with data for the topic's subscribers to receive.
* @param topic The topic you wish to publish.
* @param data The data to send with the publication. This can be of any type: string, number, array, object, etc.
* @return {void}
*/
publish(topic: string, data: any): string;
/**
* Object used to store string templates and parsed templates.
* @param {strin} A string defining the template.
* @param {string} A label used to access an object's properties in the template. If none is provided it defaults to "data": [[= data.name]].
* @return {void}
*/
templates: Object;
/**
* This method returns a parsed template.
*/
template: {
/**
* This method parses a string and an optoinal variable name and returns a parsed template in the form of a function. You can then pass this function data to get rendered nodes.
* @param template A string of markup to use as a template.
* @param variable An option name to use in the template. If it were "myData": [[= myData.name]]. Otherwise it defaults to "data": [[= data.name]].
*/
(template: string, variable?: string): Function,
/**
* The repeater method used to rendering iterable template data.
*/
repeater: {
/**
* Use this method to render declarative temlate repeaters. This expects a "data-repeater" attribute whose value points to data stored on $.template.data.
*/
(): void,
/**
* A method to repeated output a template.
* @param element The target container into which the content will be inserted.
* @param template A string of markup.
* @param data The iterable data the template will consume.
*/
(element: ChocolateChipElementArray, template: string, data: any): void
},
/**
* An object that holds the reference to the controller for a repeater.
* This is used to cache the data that a repeater uses. After the repeater is rendered, the reference is deleted from this object.
* Example: $.template.data["myRepeater"] = [{name: "Joe"}, {name: "Sue"}];
*/
data: any,
/**
* Use this value to output an index value in a template repeater.
*/
index: number
};
/**
* ATENTION: DO NOT TOUCH!
* This is the ChocolateChipJS cache.
* This is used to store details about registered events and data.
* You should not touch any of these values, even though they are exposed, as this can seriously impair the behavior of your app.
*
* data: this is used by $(element).data() to store data.
* events: this is used by the event system.
*/
chch_cache: {
/**
* DO NOT TOUCH! This hold data stored by $(element).data().
*/
data: {},
/**
* DO NOT TOUCH! This stores information about registered events.
*/
events: {
keys: any[],
values: any[],
set: Function,
hasKey: Function,
_delete: Function
}
};
/**
* A cache to hold callbacks execute by the response from a JSONP request.
* This is an array of strings.
* By default these values get purged when the callback execute and exposes the data returned by the request.
*/
JSONPCallbacks: string[];
/**
* Method to perform JSONP request.
* @param url A string defining the url to target.
* @param options And object literal of properties: {timeout? number, callbackName?: string, clear?: boolean}
*/
jsonp(
url: string,
options?: {
/**
* A number representing milliseconds to express when to refect a JSONP request.
*/
timeout?: number,
/**
* The optional name for the callback when the server response will execute.
* The default value is "callback".
* However some sites may use a different name for their JSONP function.
* Consult the documentation on the site to ascertain the correct value for this callback.
*/
callbackName?: string,
/**
* This value determines whether the callbacks and script associate with JSONP persist or are purged after the request returns. By default this is set to true, meaning that they will be purged.
*/
clear?: boolean
}
): any;
}
/**
* Interface for ChocolateChipJS Element Collections.
*/
declare type ChocolateChipElementArray = {
/**
* Iterate over an Array object, executing a function for each matched element.
*/
each(func: (ctx: any, idx: number) => void): void,
/**
* Sorts an array and removes duplicates before returning it.
*/
unique(): ChocolateChipElementArray,
/**
* This method returns the element at the position in the array indicated by the argument. This is a zero-based number.
* When dealing with document nodes, this allows you to cherry pick a node from its collection based on its
* position amongst its siblings.
* @param index Value indicating the node you wish to access from a collection. This is zero-based.
*/
eq(index: number): ChocolateChipElementArray,
/**
* Search for a given element from among the matched elements on a collection.
* This method returns the index value as an integer.
*/
index(): number,
/**
* Search for a given element from among the matched elements on a collection.
* This method returns the index value as an integer.
* @param selector A selector representing an element to look for in a collection of elements.
*/
index(selector: string | HTMLElement[]): number,
/**
* Check the current matched set of elements against a selector or element and return it
* if it matches the given arguments.
* @param selector A string containing a selector expression to match elements against.
*/
is(selector: string): ChocolateChipElementArray,
/**
* Check the current matched set of elements against a selector or element and return it
* if it matches the given arguments.
* @param elements One or more elements to match the current set of elements against.
*/
is(element: any): ChocolateChipElementArray,
/**
* Check the current matched set of elements against a selector or element and return it
* if it does not match the given arguments.
* @param selector A string containing a selector expression to match elements against.
*/
isnt(selector: string): ChocolateChipElementArray,
/**
* Check the current matched set of elements against a selector or element and return it
* if it does not match the given arguments.
* @param elements One or more elements to match the current set of elements against.
*/
isnt(element: any): ChocolateChipElementArray,
/**
* Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element.
* @param selector A string containing a selector expression to match elements against.
*/
has(selector: string): ChocolateChipElementArray,
/**
* Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element.
* @param contained A DOM element to match elements against.
*/
has(contained: HTMLElement): ChocolateChipElementArray,
/**
* Reduce the set of matched elements to those that have a descendant that does not match the selector or DOM element.
* @param selector A string containing a selector expression to match elements against.
* @ return HTMLElement[]
*/
hasnt(selector: string): ChocolateChipElementArray,
/**
* Reduce the set of matched elements to those that have a descendant that does not match the selector or DOM element.
* @param contained A DOM element to match elements against.
*/
hasnt(contained: HTMLElement): ChocolateChipElementArray,
/**
* Same overload as is present in the base type
*/
find(
predicate: (
value: HTMLElement,
index: number,
obj: HTMLElement[]
) => boolean,
thisArg?: any
): HTMLElement,
/**
* Get the descendants of each element in the current set of matched elements, filtered by a selector or element.
* @param selector A string containing a selector expression to match elements against.
*/
find(selector: string): ChocolateChipElementArray,
/**
* Get the descendants of each element in the current set of matched elements, filtered by a selector or element.
* @param element An element to match elements against.
*/
find(element: HTMLElement): ChocolateChipElementArray,
/**
* Get the immediately preceding sibling of each element in the set of matched elements.
*/
prev(): ChocolateChipElementArray,
/**
* Get the immediately following sibling of each element in the set of matched elements.
*/
next(): ChocolateChipElementArray,
/**
* Reduce the set of matched elements to the first in the set.
*/
first(): ChocolateChipElementArray,
/**
* Reduce the set of matched elements to the last in the set.
*/
last(): ChocolateChipElementArray,
/**
* Get the children of each element in the set of matched elements, optionally filtered by a selector.
* @param selector A string containing a selector expression to match elements against.
*/
children(selector?: string): ChocolateChipElementArray,
/**
* Get the parent of each element in the current set of matched elements, optionally filtered by a selector.
* If multiple elements have the same parent, only one instance of the parent is returned.
* @param selector A string containing a selector expression to match elements against.
*/
parent(selector?: string): ChocolateChipElementArray,
/**
* For each element in the set, get the first element that matches the selector by testing the element
* itself and traversing up through its ancestors in the DOM tree, or, if a number is provided,
* retrieving that ancestor based on its distance from the element.
* @param selector A string containing a selector expression to match elements against.
*/
ancestor(selector: string | number): ChocolateChipElementArray,
/**
* For each element in the set, get the first element that matches the selector by testing the element
* itself and traversing up through its ancestors in the DOM tree.
* @param selector A string containing a selector expression to match elements against.
*/
closest(selector: string | number): ChocolateChipElementArray,
/**
* Get the siblings of each element in the set of matched elements, optionally filtered by a selector.
* @param selector A string containing a selector expression to match elements against.
*/
siblings(selector?: string): ChocolateChipElementArray,
/**
* Get the HTML contents of the first element in the set of matched elements.
*/
html(): ChocolateChipElementArray,
/**
* Set the HTML contents of each element in the set of matched elements.
* @param htmlString A string of HTML to set as the content of each matched element.
*/
html(htmlString: string): ChocolateChipElementArray,
/**
* Get the value of style properties for the first element in the set of matched elements.
* @param propertyName A CSS property.
*/
css(propertyName: string): string,
/**
* Set one or more CSS properties for the set of matched elements using a quoted string.
* @param propertyName A CSS property name.
* @param value A value to set for the property.
*/
css(propertyName: string, value: string): ChocolateChipElementArray,
/**
* Set one or more CSS properties for the set of matched elements.
* @param properties An object of property-value pairs to set.
*/
css(properties: Object): ChocolateChipElementArray,
/**
* Get the value of an attribute for the first element in the set of matched elements.
* @param attributeName The name of the attribute to get.
* @return string
*/
attr(attributeName: string): string,
/**
* Set an attribute for the set of matched elements.
* @param attributeName A string indicating the attribute to set.
* @param value A string indicating the value to set the attribute to.
*/
attr(attributeName: string, value: string): ChocolateChipElementArray,
/**
* Remove an attribute from a node.
* @param attributeName A string indicating the attribute to remove.
*/
removeAttr(attributeName: string): ChocolateChipElementArray,
/**
* Return any of the matched elements that have the given attribute.
* @param className The class name to search for.
*/
hasAttr(attributeName: string): ChocolateChipElementArray,
/**
* Test whether an attribute exists on the first element in the set of matched elements. The value returned is a boolean.
* @param attributeName The name of the attribute to get.
*/
prop(propertyName: string): boolean,
/**
* Set an property for the set of matched elements.
* @param propertyName A string indicating the property to set.
* @param value A string indicating the value to set the property to.
*/
prop(propertyName: string, value: any | boolean): ChocolateChipElementArray,
/**
* Remove an element property.
* @param property The property to remove.
*/
removeProp(property: string): ChocolateChipElementArray,
/**
* Adds the specified class(es) to each of the set of matched elements.
* @param className One or more space-separated classes to be added to the class attribute of each matched element.
*/
addClass(className: string): ChocolateChipElementArray,
/**
* Remove a single class or multiple classes from each element in the set of matched elements.
* @param className One or more space-separated classes to be removed from the class attribute of each matched element.
*/
removeClass(className?: string): ChocolateChipElementArray,
/**
* Add or remove a classe from each element in the set of matched elements, depending on whether the class is present or not.
* @param className One or more class names (separated by spaces) to be toggled for each element in the matched set.
*/
toggleClass(className: string, swtch?: boolean): ChocolateChipElementArray,
/**
* Return any of the matched elements that have the given class.
* @param className The class name to search for.
*/
hasClass(className: string): ChocolateChipElementArray,
/**
* Store arbitrary data associated with the matched elements.
* @param key A string naming the piece of data to set.
* @param value The new data value; it can be any Javascript type including Array or Object.
*/
data(key: string, value: any): ChocolateChipElementArray,
/**
* Return the value at the named data store for the first element in the element collection, as set by
* data(name).
* @param key Name of the data stored.
*/
data(key: string): any,
/**
* Remove the value at the named data store for the first element in the element collection, as set by data(name, value).
* @param key Name of the data stored.
*/
removeData(key?: string): any,
/**
* Store string data associated with the matched elements.
* @param key A string naming the piece of data to set.
* @param value The new data value; it must be a string. You can convert JSON into a string to use with this.
*/
dataset(key: string, value: any): ChocolateChipElementArray,
/**
* Retrieve a dataset key's value for the first element in the element collection.
* @param key A string naming the piece of data to set.
*/
dataset(key: string): ChocolateChipElementArray,
/**
* Return the value at the named data store for the first element in the element collection, as set by data(name, value).
* @param key Name of the data stored.
*/
data(key: string): any,
/**
* Store arbitrary data associated with the matched element.
* @param key A string naming the piece of data to set.
* @param value The new data value; it can be any Javascript type including Array or Object.
*/
data(key: string, value?: any): ChocolateChipElementArray,
/**
* Get the current value of the first element in the set of matched elements.
*/
val(): any,
/**
* Set the value of each element in the set of matched elements.
* @param value A string of text or an array of strings corresponding to the value of each matched element
to set as selected/checked.
*/
val(value: string): ChocolateChipElementArray,
/**
* Set the property of an element to enabled by removing the "disabled" attribute.
*/
enable(): ChocolateChipElementArray,
/**
* Set the property of an element to "disabled".
*/
disable(): ChocolateChipElementArray,
/**
* Display the matched elements.
* @param speed A string or number determining how long the animation will run.
* @param callback A function to call once the animation is complete.
*/
show(
duration?: number | string,
callback?: Function
): ChocolateChipElementArray,
/**
* Hide the matched elements.
* @param duration A string or number determining how long the animation will run.
* @param callback A function to call once the animation is complete.
*/
hide(
duration?: number | string,
callback?: Function
): ChocolateChipElementArray,
/**
* Insert content, specified by the parameter, before each element in the set of matched elements.
* @param content HTML string, DOM element, array of elements to insert before each element in the set of matched elements.
*/
before(
content: ChocolateChipElementArray | HTMLElement | string
): ChocolateChipElementArray,
/**
* Insert content, specified by the parameter, after each element in the set of matched elements.
* @param content HTML string, DOM element, array of elements to insert after each element in the set of matched elements.
*/
after(
content: ChocolateChipElementArray | HTMLElement | string
): ChocolateChipElementArray,
/**
* Insert content, specified by the parameter, to the end of each element in the set of matched elements.
* @param content DOM element, array of elements, or HTML string to insert at the end of each element in the set
of matched elements.
*/
append(
content: ChocolateChipElementArray | HTMLElement | Text | string
): ChocolateChipElementArray,
/**
* Insert content, specified by the parameter, at the beginning of each element in the set of matched elements.
* @param content DOM element, array of elements, or HTML string to insert at the beginning of each element in the set of matched elements.
*/
prepend(
content: ChocolateChipElementArray | HTMLElement | Text | string
): ChocolateChipElementArray,
/**
* Insert every element in the set of matched elements to the beginning of the target.
* @param target A selector, element, or HTML string. The matched set of elements will be inserted at the beginning of the element specified by this parameter.
*/
prependTo(target: any[] | HTMLElement | string): ChocolateChipElementArray,
/**
* Insert every element in the set of matched elements to the end of the target.
* @param target A selector, element, or HTML string. The matched set of elements will be inserted at the end of the element specified by this parameter.
If no position value is provided it will simply append the content to the target.
*/
appendTo(target: any[] | HTMLElement | string): ChocolateChipElementArray,
/**
* Insert element(s) into the target element.
*/
insert(
content: string,
position?: number | string
): ChocolateChipElementArray,
/**
* Create a copy of the set of matched elements.
* @param value A Boolean indicating whether to copy the element(s) with their children. A true value copies the children.
*/
clone(value?: boolean): ChocolateChipElementArray,
/**
* Wrap an HTML structure around each element in the set of matched elements.
* @param wrappingElement A selector or HTML string specifying the structure to wrap around the matched elements.
*/
wrap(wrappingElement: string): ChocolateChipElementArray,
/**
* Remove the parents of the set of matched elements from the DOM, leaving the matched elements in their place.
*/
unwrap(): ChocolateChipElementArray,
/**
* Remove the set of matched elements from the DOM. If there are any attached events, this will remove them to prevent memory leaks.
* @param selector A selector expression that filters the set of matched elements to be removed.
*/
remove(selector?: string): ChocolateChipElementArray,
/**
* Remove all child nodes of the set of matched elements from the DOM.
*/
empty(): ChocolateChipElementArray,
/**
* Get an object of the current coordinates of the first element in the set of matched elements, relative to the document.
* These are: top, left, bottom and right. The values are numbers representing pixel values.
*/
offset(): {
top: number,
bottom: number,
left: number,
right: number
},
/**
* Get the current computed width for the first element in the set of matched elements,
* including padding but excluding borders.
*/
width(): number,
/**
* Get the current computed height for the first element in the set of matched elements,
* including padding but excluding borders.
*/
height(): number,
/**
* Get the combined text contents of each element in the set of matched elements, including their descendants
*/
text(): string,
/**
* Set the content of each element in the set of matched elements to the specified text.
* @param text The text to set as the content of each matched element.
When Number is supplied, it will be converted to a String representation.
To delete text, use ChocolateChipElementArray.empty() or ChocolateChipElementArray.remove().
*/
text(text: string | number): HTMLElement,
/**
* A method to animate DOM nodes using CSS. This uses CSS transitions.
* @param options And object of key value pairs define the CSS properties and values to animate.
* @param duration A string representing the time. Should have a time identifier: "200s", "200ms", etc.
* @param easing A string indicating the easing for the animation, such as "ease-out", "ease-in", "ease-in-out".
*/
animate(options: Object, duration?: string, easing?: string): void,
/**
* Attach a handler to an event for the elements.
* @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
* @param handler A function to execute each time the event is triggered.
* @param useCapture Setting the third argument to true will trigger event bubbling. The default is false.
*/
bind(
eventType: string,
handler: (eventObject: Event) => any,
useCapture?: boolean
): ChocolateChipStatic,
/**
* Remove a handler for an event from the elements.
* @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
* @param handler A function to execute each time the event is triggered.
* @param useCapture Setting the third argument to true will trigger event bubbling. The default is false.
*/
unbind(
eventType?: string,
handler?: (eventObject: Event) => any,
useCapture?: boolean
): ChocolateChipStatic,
/**
* Add a delegated event to listen for the provided event on the descendant elements.
* @param selector A string defining the descendant elements to listen on for the designated event.
* @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
* @param handler A function to execute each time the event is triggered. The keyword "this" will refer
to the element receiving the event.
* @param useCapture Setting the third argument to true will trigger event bubbling. The default is false.
*/
delegate(
selector: any,
eventType: string,
handler: (eventObject: Event) => any,
useCapture?: boolean
): ChocolateChipStatic,
/**
* Add a delegated event to listen for the provided event on the descendant elements.
* @param selector A string defining the descendant elements are listening for the event.
* @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
* @param handler A function handler assigned to this event.
* @param useCapture Setting the third argument to true will trigger event bubbling. The default is false.
*/
undelegate(
selector?: any,
eventType?: string,
handler?: (eventObject: Event) => any,
useCapture?: boolean
): ChocolateChipStatic,
/**
* Add a handler to an event for elements. If a selector is provided as the second argument, this implements a delegated event.
* @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
* @param selector A string defining the descendant elements are listening for the event.
* @param handler A function handler assigned to this event.
* @param useCapture Setting the third argument to true will trigger event bubbling. The default is false.
*/
on(
eventType: string,
selector: any,
handler?: (eventObject: Event) => any,
capturePhase?: boolean
): ChocolateChipStatic,
/**
* Remove a handler for an event from the elements. If the second argument is a selector, it tries to undelegate the event.
* If no arugments are provided, it removes all events from the element(s).
* @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
* @param selector A string defining the descendant elements are listening for the event.
* @param handler A function handler assigned to this event.
* @param useCapture Setting the third argument to true will trigger event bubbling. The default is false.
*/
off(
eventType?: string,
selector?: any,
handler?: (eventObject: Event) => any,
capturePhase?: boolean
): ChocolateChipStatic,
/**
* Trigger an event on an element.
* @param eventType The event to trigger.
*/
trigger(eventType: string): void
} & Array<HTMLElement>;
declare type DOMString = string;
declare type OpenEndedDictionary = Object;
/**
* Headers Interface. This defines the methods exposed by the Headers object.
*/
declare interface Headers {
(headers?: any): void;
append(name: string, value: string): void;
delete(name: string): any;
get(name: string): any;
getAll(name: string): any;
has(name: string): any;
set(name: string, value: string): any;
forEach(callback: Function, thisArg: any): any;
}
declare interface RequestInit {
timeout?: number;
}
declare interface Window {
chocolatechipjs: ChocolateChipStatic;
$: ChocolateChipStatic;
jsonp: any;
}
declare var $: ChocolateChipStatic;
declare var chocolatechipjs: ChocolateChipStatic;
}
| 35.663082 | 201 | 0.665101 |
38b464fcafdfd95a698085597920175b592869e9 | 1,297 | js | JavaScript | icons/standard/skill_requirement.js | leifg/design-system-react | d5c325a9905a76c423452604017b6f4a4b1450be | [
"BSD-3-Clause"
] | 846 | 2017-10-18T20:02:31.000Z | 2022-03-31T00:53:43.000Z | icons/standard/skill_requirement.js | leifg/design-system-react | d5c325a9905a76c423452604017b6f4a4b1450be | [
"BSD-3-Clause"
] | 1,653 | 2017-10-19T17:58:18.000Z | 2022-03-29T20:14:28.000Z | icons/standard/skill_requirement.js | leifg/design-system-react | d5c325a9905a76c423452604017b6f4a4b1450be | [
"BSD-3-Clause"
] | 420 | 2017-10-18T21:02:20.000Z | 2022-03-25T15:30:08.000Z | /* Copyright (c) 2015-present, salesforce.com, inc. All rights reserved */
/* Licensed under BSD 3-Clause - see LICENSE.txt or git.io/sfdc-license */
export default {"viewBox":"0 0 100 100","xmlns":"http://www.w3.org/2000/svg","path":[{"d":"M50.08 57.86a6.77 6.77 0 116.63-6.77 6.71 6.71 0 01-6.63 6.77z","fill-rule":"evenodd"},{"d":"M80.79 46.64h-5.57V26.7a6.8 6.8 0 00-6.69-6.7H31.47a6.8 6.8 0 00-6.69 6.71v19.93h-5.57a3.36 3.36 0 000 6.71h5.57V73.3a6.8 6.8 0 006.69 6.7h37.06a6.8 6.8 0 006.69-6.71V53.36h5.57a3.36 3.36 0 000-6.71zm-14.07 12.8l-1.17 2a2.67 2.67 0 01-2.15 1.19 2.8 2.8 0 01-.88-.2l-3.22-1.29a14 14 0 01-4.68 2.79L54 67.6a2.52 2.52 0 01-2.44 2.09h-2.4a2.52 2.52 0 01-2.44-2.09l-.59-3.68a12.07 12.07 0 01-4.49-2.59l-3.41 1.29a2.8 2.8 0 01-.88.2 2.53 2.53 0 01-2.15-1.29L34 59.44a2.52 2.52 0 01.59-3.19l2.83-2.39a13.32 13.32 0 01-.29-2.69 12.39 12.39 0 01.29-2.59l-2.79-2.38A2.5 2.5 0 0134 43l1.17-2.09a2.42 2.42 0 012.15-1.29 2.8 2.8 0 01.88.2l3.41 1.29a13.88 13.88 0 014.49-2.69l.62-3.42a2.34 2.34 0 012.44-2h2.44a2.35 2.35 0 012.4 1.85l.59 3.58A13.6 13.6 0 0159.11 41l3.41-1.29a2.8 2.8 0 01.88-.2 2.53 2.53 0 012.15 1.29l1.17 2.09a2.65 2.65 0 01-.59 3.19l-2.83 2.39a12.59 12.59 0 01.29 2.69 12.39 12.39 0 01-.29 2.59l2.83 2.39a2.63 2.63 0 01.59 3.3z","fill-rule":"evenodd"}]};
| 216.166667 | 1,144 | 0.653816 |
38b59b007527f14e59563a54ce7123166e803861 | 1,135 | js | JavaScript | src/context/MailContext.js | AmanSharma4419/Library | c628775818b2f129324e8517fe4a707d4bb2718d | [
"MIT"
] | null | null | null | src/context/MailContext.js | AmanSharma4419/Library | c628775818b2f129324e8517fe4a707d4bb2718d | [
"MIT"
] | null | null | null | src/context/MailContext.js | AmanSharma4419/Library | c628775818b2f129324e8517fe4a707d4bb2718d | [
"MIT"
] | null | null | null | import React, { useState, createContext } from "react";
export const MaildataContext = createContext();
export const MailProviter = props => {
// const {
// mail: initialMail,
// selectedMail: initialSelectedMail,
// children
// } = props;
// Use State to keep the values
const [mail, setMails] = useState([]);
// const [selectedMail, setSelectedMail] = useState(initialSelectedMail);
// const addOutBox = data => {
// console.log('addoutbox', data);
// setMails(mail.concat([data]));
// }
// make the context object:
// const mailesContext = {
// mail,
// setMails,
// selectedMail,
// setSelectedMail,
// addOutBox
// }
// pass the value in provider and return
return (
<MaildataContext.Provider value={[mail, setMails]}>{props.children}</MaildataContext.Provider>
);
};
// export const { Consumer } = Context;
// Proviter.propTypes = {
// mail: propTypes.array,
// selectedMail: propTypes.object
// };
// Proviter.defaultProps = {
// mail: [],
// selectedMail: {}
// };
| 23.645833 | 98 | 0.585903 |
38b5b135d0a05805ac6c06ca3d72592da702f7df | 564 | js | JavaScript | actions/index.js | stefanscherzer/reactnd-UdaciCards | bfd7075505a2f7712fa47228b02da5ae123ef2a4 | [
"MIT"
] | null | null | null | actions/index.js | stefanscherzer/reactnd-UdaciCards | bfd7075505a2f7712fa47228b02da5ae123ef2a4 | [
"MIT"
] | null | null | null | actions/index.js | stefanscherzer/reactnd-UdaciCards | bfd7075505a2f7712fa47228b02da5ae123ef2a4 | [
"MIT"
] | null | null | null | // actions/index.js
export const GET_DECKS = 'GET_DECKS'
export const GET_DECK = 'GET_DECK'
export const SAVE_DECK_TITLE = 'SAVE_DECK_TITLE'
export const ADD_CARD_TO_DECK = 'ADD_CARD_TO_DECK'
export function getDecks (decks) {
return {
type: GET_DECKS,
decks,
}
}
export function getDeck (deck) {
return {
type: GET_DECK,
deck,
}
}
export function saveDeckTitle (deck) {
return {
type: SAVE_DECK_TITLE,
deck,
}
}
export function addCardToDeck (deck, card) {
return {
type: ADD_CARD_TO_DECK,
deck,
card,
}
}
| 15.666667 | 50 | 0.675532 |
38b6b9dc9e10fe3342833d06c7bb042a4cae2b88 | 590 | js | JavaScript | Completed/JavaScript/807.js | zainkai/LeetCodeChallenges | 60645b895437bc1b56b88c48cdf22c38027285ec | [
"MIT"
] | 1 | 2020-07-01T05:33:30.000Z | 2020-07-01T05:33:30.000Z | Completed/JavaScript/807.js | zainkai/LeetCodeChallenges | 60645b895437bc1b56b88c48cdf22c38027285ec | [
"MIT"
] | null | null | null | Completed/JavaScript/807.js | zainkai/LeetCodeChallenges | 60645b895437bc1b56b88c48cdf22c38027285ec | [
"MIT"
] | null | null | null | /**
* @param {number[][]} grid
* @return {number}
*/
var maxIncreaseKeepingSkyline = function(grid) {
let tb = new Array(grid.length).fill(0)
let lr = new Array(grid.length).fill(0)
for(let a = 0; a < grid.length;a++) {
for(let b = 0; b < grid[a].length;b++) {
tb[a] = Math.max(tb[a], grid[a][b])
lr[b] = Math.max(lr[b], grid[a][b])
}
}
let res = 0
for(let a = 0; a < grid.length;a++) {
for(let b = 0; b < grid[a].length;b++) {
let diff = Math.min(tb[a], lr[b])
res += diff - grid[a][b]
}
}
return res
}; | 25.652174 | 48 | 0.494915 |
38b7786a369c004314163a0f51effdf248704522 | 1,165 | js | JavaScript | src/pages/weaponproperties.js | MrLeebo/dnd-5e | 6611d56005d7bef8d9c74104f73617af63174cc3 | [
"MIT"
] | 3 | 2019-10-10T22:43:55.000Z | 2021-08-20T01:58:35.000Z | src/pages/weaponproperties.js | MrLeebo/dnd-5e | 6611d56005d7bef8d9c74104f73617af63174cc3 | [
"MIT"
] | null | null | null | src/pages/weaponproperties.js | MrLeebo/dnd-5e | 6611d56005d7bef8d9c74104f73617af63174cc3 | [
"MIT"
] | null | null | null | import React from "react"
import PropTypes from "prop-types"
import { graphql } from "gatsby"
import { Breadcrumb } from "../components/breadcrumbs"
WeaponPropertiesPage.propTypes = {
data: PropTypes.object.isRequired,
location: PropTypes.object.isRequired,
}
export default function WeaponPropertiesPage({ data, location }) {
return (
<>
<h1 className="resource-page-header">Weapon Properties</h1>
<Breadcrumb location={location} title="Weapon Properties" />
<dl>
{data.allWeaponProperties.edges.map(({ node }, index) => (
<React.Fragment key={index}>
<dt className="text-red-600">{node.name}</dt>
<dd className="mb-3">
{Array.isArray(node.desc)
? node.desc.map((desc, index) => <p key={index}>{desc}</p>)
: node.desc}
</dd>
</React.Fragment>
))}
</dl>
</>
)
}
export const query = graphql`
query {
allWeaponProperties(sort: { fields: [name], order: ASC }) {
edges {
node {
name
desc
fields {
slug
}
}
}
}
}
`
| 24.270833 | 75 | 0.548498 |
38b7c0f714ff6b47331516a86712b33e04fbe8a8 | 2,982 | js | JavaScript | src/sections/home/Logos.js | BOTUNA-TANDA/site-Padbusiness | 114d5f6c22a02395f26097936bfd362ddbb7da29 | [
"RSA-MD"
] | null | null | null | src/sections/home/Logos.js | BOTUNA-TANDA/site-Padbusiness | 114d5f6c22a02395f26097936bfd362ddbb7da29 | [
"RSA-MD"
] | null | null | null | src/sections/home/Logos.js | BOTUNA-TANDA/site-Padbusiness | 114d5f6c22a02395f26097936bfd362ddbb7da29 | [
"RSA-MD"
] | null | null | null | import React, {useEffect, useState} from "react"
import styled, {withTheme} from "styled-components";
import PartnersList from "../../data/partenaires.json"
import {motion, useAnimation} from "framer-motion";
import {useInView} from "react-intersection-observer";
import {containerAnim, fadeInUp} from "../../animation";
import _ from "lodash"
import Text from "../../components/Text";
import {breakPoints} from "../../app-config";
const Logos = (props) => {
const animation = useAnimation();
const [partners, setPartner] = useState(null);
const [contentRef, inView] = useInView({
rootMargin: "-100px",
})
useEffect(() => {
setPartner(PartnersList);
if (inView) {
animation.start("animate")
}
}, [animation, inView])
return (
<Container
ref={contentRef}
animate={animation}
initial='initial'
variants={containerAnim}
>
<Wrapper>
{_.map(partners, (partner, index) => (
<PartnerItem variants={fadeInUp} key={partner.text + index}>
<WrapperImage>
<Image size={partner.size} src={require("../../images/logos/" + partner.image + ".png")}
alt={partners.image + "logo"}/>
</WrapperImage>
<Text
marginTop={16}
fontWeight={300}
size={0.4}
color={props.theme.blue}
>{partner.text}</Text>
</PartnerItem>
))}
</Wrapper>
</Container>
)
}
export default withTheme(Logos)
const Container = styled(motion.div)`
overflow: hidden;
justify-content: center;
padding-top: 50px;
padding-bottom: 50px;
@media (min-width: ${breakPoints.lg}) {
min-height: 0vh;
}
`
const Wrapper = styled(motion.div)`
display: grid;
position: relative;
@media (max-width: ${breakPoints.sm}) {
display: flex;
flex-wrap: wrap;
justify-content: center;
max-width: 420px;
}
@media (min-width: ${breakPoints.sm}) and (max-width: ${breakPoints.md}) {
position: relative;
display: grid;
grid-template-columns: 1fr 1fr 1fr;
}
@media (min-width: ${breakPoints.md}) {
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
margin: 0 auto;
max-width: 1500px;
}
@media (min-width: ${breakPoints.lg}) {
max-width: 1500px;
height: 200px;
}
`
const PartnerItem = styled(motion.div)`
max-width: 160px;
`
const WrapperImage = styled(motion.div)`
height: 100px;
width: 200px;
display: flex;
justify-content: center;
align-content: center;
overflow: hidden;
`
const Image = styled(motion.img)`
width: ${props => props.size ? props.size : '50%'};
align-self: center;
`
| 25.706897 | 116 | 0.557344 |
38b8f20037f21218a4435ee1b1f8f3dcf7559e83 | 881 | js | JavaScript | scripts/validateArea.js | AlexandrosKal/EAM | d5c01992b9129e80464ff0b61ea84c2d554e9357 | [
"MIT"
] | null | null | null | scripts/validateArea.js | AlexandrosKal/EAM | d5c01992b9129e80464ff0b61ea84c2d554e9357 | [
"MIT"
] | null | null | null | scripts/validateArea.js | AlexandrosKal/EAM | d5c01992b9129e80464ff0b61ea84c2d554e9357 | [
"MIT"
] | null | null | null | function validateArea(areaForm, area, displayOnErrorArea)
{
var input = document.getElementById(area).value;
var inputArray = input.split(" ");
var regex =/((^([Α-Ω]|[ΆΈΉΊΌΎΏΪΫ])[α-ω]*([ϊϋ]?[α-ω]*[άέήόίύώ]?|[ΐΰ]?)[α-ω]*\s?$|^[A-Z][a-z]*\s?$)|^([Α-Ω]*[ΪΫ]?[Α-Ω]*|[A-Z]*)$)/;
for(var i=0; i<inputArray.length; i++)
{
if( !regex.test(inputArray[i]) )
{
document.getElementById(areaForm).className = "form-group";
document.getElementById(areaForm).className += " has-error";
document.getElementById(displayOnErrorArea).innerHTML = "<li class='text-danger'> Η περιοχή που εισάγετε δεν ειναι έγκυρη.";
break;
}
else
{
document.getElementById(areaForm).className = "form-group";
document.getElementById(areaForm).className += " has-success";
document.getElementById(displayOnErrorArea).innerHTML = "";
}
}
}
| 35.24 | 131 | 0.634506 |
38b9176ad7b27cec0e90d6d12ee142bee5d960e0 | 11,205 | js | JavaScript | Airy.js | jlettvin/gaze | f0d54d62df487edfd2f938158ef3f72d663d603d | [
"MIT"
] | null | null | null | Airy.js | jlettvin/gaze | f0d54d62df487edfd2f938158ef3f72d663d603d | [
"MIT"
] | null | null | null | Airy.js | jlettvin/gaze | f0d54d62df487edfd2f938158ef3f72d663d603d | [
"MIT"
] | null | null | null | /* This module saves calculating Bessel functions at all points in an image.
* Precalculate a single find-grained Bessel function into an array.
* Calculate the index into this array by a radius and coefficient.
* Calculate the coefficient by a wavelength, aperture, and granularity.
*
* var coefficient = this.coefficient(wavelength, aperture);
* var amplitude = this.amplitude(radius, coefficient);
*
* NOTE: coefficient only needs to be called once per wavelength/aperture.
* NOTE: amplitude is calculated by radius, so depends on coordinates.
*
* TODO: Generate a vector containing (x,y) and amplitude and
* Add the amplitude at each (x,y) rather than convolving.
*
* The amplitude is the wave function amplitude for that combination of
* radius, wavelength, and aperture.
*/
"use strict";
//console.log("AIRY: get");
var AIRY = ({
//CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
// CONSTANTS CONSTANTS CONSTANTS CONSTANTS CONSTANTS CONSTANTS CONSTANTS
//CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
Zr : 1.2196698912665045, // constant normalizing first zero
wavelength : {
IR : 790e-9, // Infrared limit of visual spectrum
RED : 566e-9, // Peak absorption of L cones
GREEN : 533e-9, // Peak absorption of M cones
CYAN : 498e-9, // Peak absorption of rods
BLUE : 433e-9, // Peak absorption of S cones
UV : 390e-9 // Ultraviolet limit of visual spectrum
},
//-------------------------------------------------------------------------
generate: function(parameter) {
// Zero indexing is normalized to an 8mm pupil for the BLUE peak.
// Defaults
var verbose = parameter.verbose;
var verbose = (verbose === "undefined") ? false : verbose;
var epsilon = parameter.epsilon || 5e-4;
var wavelength = parameter.wavelength || "BLUE";
var aperture = parameter.aperture || 8e-3;
// Initialize
this.used = { }; // parameters used to calculate
this.used.verbose = verbose;
this.used.epsilon = epsilon;
this.used.pupil = { constricted: 1e-3, dilated: 8e-3};
this.used.wavelength = this.wavelength[wavelength];
this.used.aperture = aperture;
this.used.granularity = 1000; // increment count to first zero
this.used.threshold = 1 / 255; // Max amplitude before last zero
this.used.unit = this.used.wavelength / this.used.aperture;
this.used.almost1 = 1 - this.used.epsilon;
// Make and fill containers
this.made = { }; // calculated data
this.made.wave = [1]; // Peak at r==0
this.made.zero = [ ]; // stored zeros
this.made.peak = [ ]; // stored peaks
this.made.ratio= {
RED : this.wavelength.RED / this.wavelength[wavelength],
GREEN : this.wavelength.GREEN / this.wavelength[wavelength],
BLUE : this.wavelength.BLUE / this.wavelength[wavelength]
};
this.used.verbose && console.log(this.used);
this.used.verbose && console.log(this.made);
// three is a view of the last calculated intensities.
// a peak is discovered when the 2nd value is greater than 1st or 3rd.
// a zero is discovered when the 2nd value is less than 1st or 3rd.
// When a peak is discovered not greater than the limit
// calculation terminates at the next zero.
// end is used to detect the final peak and to terminate at the zero.
// Indices for peaks and zeros are stored for later use
var three = [0, 0, this.made.wave[0]];
var end = false;
// dr is the incremental radius.
// For granularity * dr giving the first zero
// the bessel function parameter is scaled by a constant
// approximated by 1.22 named Zr
var u0 = Math.PI * this.Zr;
var r, dr = 1/this.used.granularity;
for (r = dr; r <= 10; r += dr) {
var N = this.made.wave.length; // Not wavelength; count of values.
var u = u0 * r; // Bessel parameter
// A is the normalized wave amplitude for parameter u
// I is the intensity for that wave amplitude
var A = 2*BESSEL.besselj(u,1)/u;
var I = A*A;
// Store the amplitude for use in superposition
this.made.wave.push(A);
// Slide the peak/zero calculation window
three.shift();
three.push(I);
// Calculate the differences from center for the previous intensity
var dn = three[1] - three[0];
var dp = three[1] - three[2];
// If at a peak and the peak, store it and
// if the peak is below the chosen intensity
// trigger termination on discovery of the next zero
if (dn > 0 && dp > 0) {
this.made.peak.push(N-1);
end = (three[1] < this.limit);
}
// If at a zero, store it and
// if termination is flagged, terminate the loop
if (dn < 0 && dp < 0) {
if (end) break;
// If the last datum was not last zero, store this datum.
// Otherwise DO NOT STORE IT!
this.made.zero.push(N-1);
}
}
// Show the discovered peaks and zeros.
this.used.verbose && console.log("peaks", this.made.peak);
this.used.verbose && console.log("zeros", this.made.zero);
return this;
},
//-------------------------------------------------------------------------
coefficient: function(wavelength, aperture) {
// index will have a first zero at radius 1 with aperture 8e-3.
if (
(
this.wavelength.IR < wavelength ||
this.wavelength.UV > wavelength ||
this.used.pupil.constricted > aperture ||
this.used.pupil.dilated < aperture
)
)
{
console.log(heredoc(function(){/*
either the wavelength is not visible
or the pupil size is not in the human range
*/}));
return 0;
}
var unit = this.used.unit; // used.wavelength / used.aperture
var index = wavelength / aperture;
return Math.floor(
this.used.granularity * (1e-9 + unit) /
index);
},
//-------------------------------------------------------------------------
amplitude: function(radius, coefficient, mean=false) {
// coefficient is the index of the first zero
var index = Math.floor(1e6 * radius * coefficient + this.used.almost1);
var ret;
if (radius == 0.0) { ret = 1; }
else if (index >= this.made.wave.length) { ret = 0; }
else if (mean) {
var wing = Math.floor(coefficient * 2 / 3);
var indlo = Math.abs(index - wing); // could be less than 0
var indhi = (index + wing);
// Calculate average over 2 or 3 evenly spaced in the interval
ret = this.made.wave[index]; // known good
ret += this.made.wave[indlo]; // known good
// include upper wing if it is within range.
if (indhi >= this.made.wave.length) ret /= 2;
else ret = (ret + this.made.wave[indhi]) / 3;
}
else { ret = this.made.wave[index]; }
return ret;
},
//-------------------------------------------------------------------------
mask: function(wavelength, aperture) {
// TODO: Generate a map from legal [x,y] values to radii.
var data = [ ]; // [[x0,y0,a0],[x1,y1,a1],...[xn,yn,an]]
var coefficient = this.coefficient(wavelength, aperture);
var spread = function(x, y, a) {
var ne = true;
var nw = (x != 0);
var se = (y != 0);
var sw = (se && nw);
ne && data.push([ x, y,a]);
nw && data.push([-x, y,a]);
se && data.push([ x,-y,a]);
sw && data.push([-x,-y,a]);
}
return data;
},
//TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
// UNIT TESTS UNIT TESTS UNIT TESTS UNIT TESTS UNIT TESTS UNIT TESTS UNIT
//TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
test : function (aperture, color) {
var wavelength = this.wavelength[color]; // i.e. 433e-9
var norm = 8e-3 / aperture; // i.e. 8e-3
var zero = this.made.ratio[color] * norm * 1e-6; // i.e. 1e-6
var zero2 = zero * this.made.zero[1] / this.made.zero[0];
var zero3 = zero * this.made.zero[2] / this.made.zero[0];
var radii = {
"(0,0)": {radius: 0 , expect: 1.00000 },
half : {radius: zero/2, expect: 0.60623 },
zero1 : {radius: zero , expect: 1.03554e-11},
zero2 : {radius: zero2 , expect: 1.00000e-5 },
zero3 : {radius: zero3 , expect: 1.00000e-5 }
};
var coefficient = this.coefficient(wavelength, aperture);
var test = 0;
var pass = 0;
for (var key in radii) {
var radius = radii[key].radius;
var expect = radii[key].expect;
var val = this.amplitude(radius, coefficient);
test += 1;
pass += FAILPASS.almost(val, expect, this.used.epsilon, sprintf(
"color: %5s key: %5s zero: %2.2e calculated amplitude",
color, key, zero));
}
this.used.verbose && console.log(sprintf(
" %d/%d PASS/FAIL", pass, test - pass));
},
//TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
unittest : function() {
console.log(HEREDOC(function(){/*
-------------------------------------------------------------------------------
Airy.js precalculates a fine-grained Bessel function as a wave amplitude array.
For a granularity, and wavelength/aperture ratio a coefficient can be generated.
The coefficient is used to index wave amplitudes.
This test parameterizes by wavelength and aperture to compare
the values at different radii to ensure that the mechanism
for requestion amplitudes for a radius and coefficient are properly fetched.
-------------------------------------------------------------------------------
*/}));
this.test(8e-3, "BLUE" );
this.test(8e-3, "GREEN");
this.test(8e-3, "RED" );
this.test(1e-3, "BLUE" );
this.test(1e-3, "GREEN");
this.test(1e-3, "RED" );
}
//TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT
}).generate({aperture: 8e-3, wavelength: "BLUE", verbose: false});
//console.log("AIRY: ran");
| 42.283019 | 80 | 0.543686 |
38b9e1e02eb61e68abcc9831ab6e22806410b2b3 | 675 | js | JavaScript | docs/html/namespaceCatch_1_1Matchers.js | IonThruster/ClockSim | 768cbc26f5728ad33507b8fc4b21a31e6a35a40a | [
"MIT"
] | null | null | null | docs/html/namespaceCatch_1_1Matchers.js | IonThruster/ClockSim | 768cbc26f5728ad33507b8fc4b21a31e6a35a40a | [
"MIT"
] | null | null | null | docs/html/namespaceCatch_1_1Matchers.js | IonThruster/ClockSim | 768cbc26f5728ad33507b8fc4b21a31e6a35a40a | [
"MIT"
] | null | null | null | var namespaceCatch_1_1Matchers =
[
[ "Exception", "namespaceCatch_1_1Matchers_1_1Exception.html", "namespaceCatch_1_1Matchers_1_1Exception" ],
[ "Floating", "namespaceCatch_1_1Matchers_1_1Floating.html", "namespaceCatch_1_1Matchers_1_1Floating" ],
[ "Generic", "namespaceCatch_1_1Matchers_1_1Generic.html", "namespaceCatch_1_1Matchers_1_1Generic" ],
[ "Impl", "namespaceCatch_1_1Matchers_1_1Impl.html", "namespaceCatch_1_1Matchers_1_1Impl" ],
[ "StdString", "namespaceCatch_1_1Matchers_1_1StdString.html", "namespaceCatch_1_1Matchers_1_1StdString" ],
[ "Vector", "namespaceCatch_1_1Matchers_1_1Vector.html", "namespaceCatch_1_1Matchers_1_1Vector" ]
]; | 75 | 111 | 0.802963 |
38b9f2def1bc0756b653178c6aafa7d97ac67ae8 | 47 | js | JavaScript | libs/processor/config.js | homobel/makebird-node | 07f9621883a2247e538fb8d8e3824a403b5154b7 | [
"MIT"
] | 4 | 2015-02-22T22:08:52.000Z | 2018-05-12T18:08:21.000Z | libs/processor/config.js | homobel/makebird-node | 07f9621883a2247e538fb8d8e3824a403b5154b7 | [
"MIT"
] | null | null | null | libs/processor/config.js | homobel/makebird-node | 07f9621883a2247e538fb8d8e3824a403b5154b7 | [
"MIT"
] | null | null | null |
module.exports = {
includeOnlyUsed: false
};
| 9.4 | 23 | 0.702128 |
38b9f4fb53735840a6141af67185684573809498 | 23,448 | js | JavaScript | catalog/view/javascript/so_onepagecheckout/js/so_onepagecheckout.js | Dannyyoung20/Ecommerce-website-with-heroku | 411e50f5f48b4f476cd06ca19248728f0ec57072 | [
"MIT"
] | 1 | 2017-11-20T00:04:45.000Z | 2017-11-20T00:04:45.000Z | catalog/view/javascript/so_onepagecheckout/js/so_onepagecheckout.js | theghostyced/Ecommerce-website-with-heroku | 411e50f5f48b4f476cd06ca19248728f0ec57072 | [
"MIT"
] | null | null | null | catalog/view/javascript/so_onepagecheckout/js/so_onepagecheckout.js | theghostyced/Ecommerce-website-with-heroku | 411e50f5f48b4f476cd06ca19248728f0ec57072 | [
"MIT"
] | 1 | 2018-08-15T21:46:09.000Z | 2018-08-15T21:46:09.000Z | jQuery(document).delegate('input[name="shipping_address"]', 'change', function(){
var $this=jQuery(this);
if($this.is(':checked')){
jQuery('#shipping-address').hide();
$this.val(1);
jQuery(document).trigger('so_checkout_address_changed','payment');
}else{
jQuery('#shipping-address').show().find('input[type="text"]').val('');
jQuery(document).trigger('so_checkout_address_changed','payment');
jQuery(document).trigger('so_checkout_address_changed','shipping');
$this.val(0);
}
});
$(document).delegate('input[name="account"]', 'change', function(){
if(this.value==='login'){
$('.checkout-login').slideDown(300);
$('.checkout-register').parent().addClass('login-mobile');
}else{
$('.checkout-login').slideUp(300);
$('.checkout-register').parent().removeClass('login-mobile');
if(this.value==='register'){
$('#password').slideDown(300);
}else{
$('#password').slideUp(300);
}
}
$(document).trigger('so_checkout_coupon_voucher_reward_changed', this.value);
$('html').removeClass('checkout-type-login checkout-type-register checkout-type-guest').addClass('checkout-type-'+this.value);
});
$(document).on('so_checkout_coupon_voucher_reward_changed',function(e, value){
$.ajax({
url:'index.php?route=checkout/checkout/change_coupon_voucher_reward',
type:'post',
data:{so_checkout_account:value},
dataType:'html',
success:function(html){
$('.so-onepagecheckout .section-right #coupon_voucher_reward').html(html);
},
error:function(xhr,ajaxOptions,thrownError){
alert(thrownError+"\r\n"+xhr.statusText+"\r\n"+xhr.responseText);
}
});
});
jQuery(document).ready(function($) {
$('form.form-shipping input[name="shipping_address"]').change(function(){
if(this.value=='new' || this.value=='1'){
$('#shipping-existing').hide();
$('#shipping-new').show().find('input[type="text"]').val('');
}else{
$('#shipping-existing').show();
$('#shipping-new').hide();
}
$(document).trigger('so_checkout_address_changed','shipping');
});
});
jQuery(document).ready(function($) {
var default_zone_id = $('#default_zone_id').val();
$('form.form-shipping select[name=\'shipping_country_id\']').on('change',function(e,first){
if(!this.value) return;
$.ajax({
url:'index.php?route=checkout/checkout/country&country_id='+this.value,
dataType:'json',
beforeSend:function(){
$('form.form-shipping select[name=\'shipping_country_id\']').after(' <i class="fa fa-circle-o-notch fa-spin"></i>');
},
complete:function(){
$('.fa-spin').remove();
},
success:function(json){
$('.fa-spin').remove();
if(json['postcode_required']=='1'){
$('form.form-shipping input[name=\'shipping_postcode\']').parent().addClass('required');
}else{
$('form.form-shipping input[name=\'shipping_postcode\']').parent().removeClass('required');
}
html='<option value=""> --- Please Select --- </option>';
if(json['zone']!=''){
for(i=0;i<json['zone'].length;i++){
html+='<option value="'+json['zone'][i]['zone_id']+'"';
if(json['zone'][i]['zone_id']==default_zone_id){
html+=' selected="selected"';
}
html+='>'+json['zone'][i]['name']+'</option>';
}
}else{
html+='<option value="0" selected="selected"> --- None --- </option>';
}
$('form.form-shipping select[name=\'shipping_zone_id\']').html(html);
if(!first){
$(document).trigger('so_checkout_address_changed','shipping');
}
},
error:function(xhr,ajaxOptions,thrownError){
alert(thrownError+"\r\n"+xhr.statusText+"\r\n"+xhr.responseText);
}
});
}).trigger('change',true);
})
jQuery('form.form-shipping select[name=\'shipping_zone_id\']').on('change',function(){
jQuery(document).trigger('so_checkout_address_changed','shipping');
});
jQuery('form.form-shipping select[name=\'shipping_address_id\']').on('change',function(){
$(document).trigger('so_checkout_address_changed','shipping');
});
var timeout_shipping=null;
jQuery('form.form-shipping input[name=\'shipping_postcode\']').on('keydown',function(){
if(timeout_shipping){clearTimeout(timeout_shipping);}
timeout_shipping=setTimeout(function(){
jQuery(document).trigger('so_checkout_address_changed','shipping');
},500);
});
jQuery('.checkout-shipping-form .form-group[data-sort]').detach().each(function(){
if(jQuery(this).attr('data-sort')>=0 && jQuery(this).attr('data-sort')<=jQuery('.checkout-shipping-form .form-group').length){
jQuery('.checkout-shipping-form .form-group').eq(jQuery(this).attr('data-sort')).before(this);
}
if(jQuery(this).attr('data-sort')>jQuery('.checkout-shipping-form .form-group').length){
jQuery('.checkout-shipping-form .form-group:last').after(this);
}
if(jQuery(this).attr('data-sort')<-jQuery('.checkout-shipping-form .form-group').length){
jQuery('.checkout-shipping-form .form-group:first').before(this);
}
});
jQuery(document).ready(function($) {
$('.so-onepagecheckout .date').datetimepicker({pickTime:false});
$('.so-onepagecheckout .time').datetimepicker({pickDate:false});
$('.so-onepagecheckout .datetime').datetimepicker({pickDate:true,pickTime:true});
})
jQuery(document).delegate('input[name="customer_group_id"]','change',function(){
jQuery(document).trigger('so_checkout_customer_group_changed',this.value);
});
jQuery('#account .form-group[data-sort]').detach().each(function(){
if(jQuery(this).attr('data-sort')>=0 && jQuery(this).attr('data-sort')<=jQuery('#account .form-group').length){
jQuery('#account .form-group').eq(jQuery(this).attr('data-sort')).before(this);
}
if(jQuery(this).attr('data-sort')>jQuery('#account .form-group').length){
jQuery('#account .form-group:last').after(this);
}
if(jQuery(this).attr('data-sort')<-jQuery('#account .form-group').length){
jQuery('#account .form-group:first').before(this);
}
});
jQuery('#button-confirm').on('click',function($){
$.ajax({
type:'get',
url:'index.php?route=extension/payment/cod/confirm',
cache:false,
beforeSend:function(){
$('#button-confirm').button('loading');
},
complete:function(){
$('#button-confirm').button('reset');
},
success:function(){
location='index.php?route=checkout/success';
}
});
});
jQuery(document).ready(function($) {
$('form.form-payment input[name="payment_address"]').change(function(){
if(this.value=='new' || this.value=='1'){
$('#payment-existing').hide();
$('#payment-new').show().find('input[type="text"]').val('');
}else{
$('#payment-existing').show();
$('#payment-new').hide();
}
$(document).trigger('so_checkout_address_changed','payment');
});
});
jQuery(document).ready(function($) {
var default_zone_id = $('#default_zone_id').val();
$('form.form-payment select[name=\'payment_country_id\']').on('change',function(e,first){
if(!this.value)return;
$.ajax({
url:'index.php?route=checkout/checkout/country&country_id='+this.value,
dataType:'json',
beforeSend:function(){
$('form.form-payment select[name=\'payment_country_id\']').after(' <i class="fa fa-circle-o-notch fa-spin"></i>');
},
complete:function(){
$('.fa-spin').remove();
},
success:function(json){
$('.fa-spin').remove();
if(json['postcode_required']=='1'){
$('form.form-payment input[name=\'payment_postcode\']').parent().addClass('required');
}else{
$('form.form-payment input[name=\'payment_postcode\']').parent().removeClass('required');
}
html='<option value=""> --- Please Select --- </option>';
if(json['zone']!=''){
for(i=0;i<json['zone'].length;i++){
html+='<option value="'+json['zone'][i]['zone_id']+'"';
if(json['zone'][i]['zone_id']==default_zone_id){
html+=' selected="selected"';
}
html+='>'+json['zone'][i]['name']+'</option>';
}
}else{
html+='<option value="0" selected="selected"> --- None --- </option>';
}
$('form.form-payment select[name=\'payment_zone_id\']').html(html);
if(!first){
$(document).trigger('so_checkout_address_changed','payment');
}
},
error:function(xhr,ajaxOptions,thrownError){
alert(thrownError+"\r\n"+xhr.statusText+"\r\n"+xhr.responseText);
}
});
}).trigger('change',true);
})
jQuery('form.form-payment select[name=\'payment_zone_id\']').on('change',function(){
$(document).trigger('so_checkout_address_changed','payment');
});
jQuery('form.form-payment select[name=\'payment_address_id\']').on('change',function(){
$(document).trigger('so_checkout_address_changed','payment');
});
var timeout_payment=null;
$('form.form-payment input[name=\'payment_postcode\']').on('keydown',function(){
if(timeout_payment){
clearTimeout(timeout_payment);
}
timeout_payment=setTimeout(function(){$(document).trigger('so_checkout_address_changed','payment');}, 500);
});
window['so_account_status']=0;
$(document).delegate('input[name="shipping_method"]','change',function(){
$(document).trigger('so_checkout_shipping_changed',this.value);
});
$(document).delegate('input[name="payment_method"]','change',function(){
$(document).trigger('so_checkout_payment_changed',this.value);
});
$(document).delegate('#input-login_email, #input-login_password, #button-login','keydown',function(e){
if(e.keyCode==13){
_do_login();
}
});
$(document).delegate('#button-login','click',function(){
_do_login();
});
function _do_login(){
$.ajax({
url:'index.php?route=checkout/checkout/login',
type:'post',
data:{email:$('input[name="login_email"]').val(),password:$('input[name="login_password"]').val()},
dataType:'json',
beforeSend:function(){
triggerLoadingOn();
$('#button-login').button('loading');
},
complete:function(){
triggerLoadingOff();
$('#button-login').button('reset');
},
success:function(json){
if(json['error']&&json['error']['warning']){
alert(json['error']['warning']);
}
if(json['redirect']){
location=json['redirect'];
}
},
error:function(xhr,ajaxOptions,thrownError){
alert(thrownError+"\r\n"+xhr.statusText+"\r\n"+xhr.responseText);
}
});
}
jQuery(document).delegate('.so-onepagecheckout .confirm-button','click',function(){
var data={};
$('.so-onepagecheckout input[type="text"], .so-onepagecheckout input[type="number"], .so-onepagecheckout input[type="password"], .so-onepagecheckout select, .so-onepagecheckout input:checked, .so-onepagecheckout textarea[name="comment"]').each(function(){
data[$(this).attr('name')]=$(this).val();
});
$.ajax({
url:'index.php?route=checkout/checkout/confirm',
type:'post',
data:data,
dataType:'json',
beforeSend:function(){
triggerLoadingOn();
},
success:function(json){
console.log(json);
$('.text-danger').remove();
$('.has-error').removeClass('has-error');
if(json['redirect_cart']){
location=json['redirect_cart'];return;
}
window['so_current_account_status']=json['account_status'];
if(json['errors']){
$.each(json['errors'],function(k,v){
if(k==='shipping_method'||k==='payment_method'){
return;
}
if($.inArray(k,['payment_country','payment_zone','shipping_country','shipping_zone'])!==-1){
k+='_id';
}else if(k.indexOf('custom_field')===0){
k=k.replace('custom_field','');
k='custom_field['+k+']';
}else if(k.indexOf('payment_custom_field')===0){
k=k.replace('payment_custom_field','');
k='payment_custom_field['+k+']';
}else if(k.indexOf('shipping_custom_field')===0){
k=k.replace('shipping_custom_field','');
k='shipping_custom_field['+k+']';
}
var $element=$('.so-onepagecheckout [name="'+k+'"]');
$element.closest('.form-group').addClass('has-error');
if ($element.closest('label').length)
$element.closest('label').after('<div class="text-danger">'+v+'</div>');
else
$element.after('<div class="text-danger">'+v+'</div>');
});
triggerLoadingOff();
try{
$('html, body').animate({scrollTop:$('.has-error').offset().top},'slow');
}catch(e){
if (json['errors']['account'][0]) alert(json['errors']['account'][0]);
}
return false;
}
else if(json['redirect']){
location=json['redirect'];
}else{
var $btn=$('#payment-confirm-button input[type="button"], #payment-confirm-button input[type="submit"], #payment-confirm-button .pull-right a, #payment-confirm-button .right a, #payment-confirm-button a.button, #button-confirm, #button-pay, #payment-confirm-button.payment-iyzico_checkout_installment .submitButton, #stripe-confirm').first();
if($btn.attr('href')){
location=$btn.attr('href');
}else{
$btn.trigger('click');
}
}
},
error:function(xhr,ajaxOptions,thrownError){
alert(thrownError+"\r\n"+xhr.statusText+"\r\n"+xhr.responseText);
}
});
});
$(document).on('so_checkout_customer_group_changed',function(e,value){
$.ajax({
url:'index.php?route=checkout/checkout',
type:'get',
data:{customer_group_id:value},
beforeSend:function(){
triggerLoadingOn();
$('#account, #address').addClass('checkout-loading');
},
complete:function(){
triggerLoadingOff();
$('#account, #address').removeClass('checkout-loading');
},
success:function(html){
var $html=$(html);
$('#account').html($html.find('#account'));
$('#address').html($html.find('#address'));
$('#password').html($html.find('#password'));
$('#account .form-group[data-sort]').detach().each(function(){
if($(this).attr('data-sort')>=0 && $(this).attr('data-sort')<=$('#account .form-group').length){
$('#account .form-group').eq($(this).attr('data-sort')).before(this);
}
if($(this).attr('data-sort')>$('#account .form-group').length){
$('#account .form-group:last').after(this);
}
if($(this).attr('data-sort')<-$('#account .form-group').length){
$('#account .form-group:first').before(this);
}
});
$(document).trigger('so_checkout_reload_payment');
if($('input[name="shipping_address"]').is(':checked')){
$(document).trigger('so_checkout_reload_shipping');
}
},
error:function(xhr,ajaxOptions,thrownError){
alert(thrownError+"\r\n"+xhr.statusText+"\r\n"+xhr.responseText);
}
});
});
$(document).on('so_checkout_address_changed',function(e,type){
var data={};
if($('input[name="'+type+'_address"]:checked').val()==='existing'){
data[type+'_address_id']=$('select[name="'+type+'_address_id"]').val();
}else{
data[type+'_country_id']=$('select[name="'+type+'_country_id"]').val();
data[type+'_postcode']=$('input[name="'+type+'_postcode"]').val();
data[type+'_zone_id']=$('select[name="'+type+'_zone_id"]').val();
if(type==='payment'&&$('input[name="shipping_address"]').is(":checked")){
data['shipping_country_id']=$('select[name="'+type+'_country_id"]').val();
data['shipping_postcode']=$('input[name="'+type+'_postcode"]').val();
data['shipping_zone_id']=$('select[name="'+type+'_zone_id"]').val();
}
}
$.ajax({
url:'index.php?route=checkout/checkout/save',
type:'post',
data:data,
dataType:'json',
success:function(json){
$(document).trigger('so_checkout_reload_'+type);
if(type==='payment'&&$('input[name="shipping_address"]').is(':checked')){
$(document).trigger('so_checkout_reload_shipping');
}
},
error:function(xhr,ajaxOptions,thrownError){
alert(thrownError+"\r\n"+xhr.statusText+"\r\n"+xhr.responseText);
}
});
});
$(document).on('so_checkout_shipping_changed',function(e,value){
$.ajax({
url:'index.php?route=checkout/checkout/save',
type:'post',
data:{shipping_method:value},
dataType:'json',
success:function(){
$.ajax({
url:'index.php?route=checkout/checkout/cart_update',
type:'post',
dataType:'json',
success:function(json){
setTimeout(function(){
$('#cart-total').html(json['total']);
},100);
$('#cart ul').load('index.php?route=common/cart/info ul li');
}
});
$(document).trigger('so_checkout_reload_payment');
$(document).trigger('so_checkout_reload_cart');
},
error:function(xhr,ajaxOptions,thrownError){
alert(thrownError+"\r\n"+xhr.statusText+"\r\n"+xhr.responseText);
}
});
});
$(document).on('so_checkout_payment_changed',function(e,value){
$.ajax({url:'index.php?route=checkout/checkout/save',
type:'post',
data:{payment_method:value},
dataType:'json',
success:function(){
$(document).trigger('so_checkout_reload_cart');
},
error:function(xhr,ajaxOptions,thrownError){
alert(thrownError+"\r\n"+xhr.statusText+"\r\n"+xhr.responseText);
}
});
});
$(document).on('so_checkout_reload_shipping',function(){
$.ajax({
url:'index.php?route=checkout/checkout/shipping',
type:'get',
dataType:'html',
beforeSend:function(){
triggerLoadingOn();
$('.checkout-shipping-methods').addClass('checkout-loading');
},
complete:function(){
triggerLoadingOff();
$('.checkout-shipping-methods').removeClass('checkout-loading');
},
success:function(html){
$('.checkout-shipping-methods').replaceWith(html);
$(document).trigger('so_checkout_reload_cart');
},
error:function(xhr,ajaxOptions,thrownError){
alert(thrownError+"\r\n"+xhr.statusText+"\r\n"+xhr.responseText);
}
});
});
$(document).on('so_checkout_reload_payment',function(){
$.ajax({
url:'index.php?route=checkout/checkout/payment',
type:'get',
dataType:'html',
beforeSend:function(){
triggerLoadingOn();
$('.checkout-payment-methods').addClass('checkout-loading');
},
complete:function(){
triggerLoadingOff();
$('.checkout-payment-methods').removeClass('checkout-loading');
},
success:function(html){
// console.log(html);
$('.checkout-payment-methods').replaceWith(html);
$(document).trigger('so_checkout_reload_cart');
},
error:function(xhr,ajaxOptions,thrownError){
alert(thrownError+"\r\n"+xhr.statusText+"\r\n"+xhr.responseText);
}
});
});
$(document).on('so_checkout_reload_cart',function(e,first){
$.ajax({
url:'index.php?route=checkout/checkout/cart',
type:'get',
dataType:'html',
beforeSend:function(){
if(!first){
triggerLoadingOn();
$('.checkout-cart').addClass('checkout-loading');
}
},
complete:function(){
if(!first){
triggerLoadingOff();
$('.checkout-cart').removeClass('checkout-loading');
}
},
success:function(html){
$('.checkout-cart').replaceWith(html);
},
error:function(xhr,ajaxOptions,thrownError){
alert(thrownError+"\r\n"+xhr.statusText+"\r\n"+xhr.responseText);
}
});
});
$(document).delegate('.checkout-product .input-group .btn-update','click',function(){
var key=$(this).attr('data-product-key');
var qty=$('input[name="quantity['+key+']"]').val();
$.ajax({
url:'index.php?route=checkout/checkout/cart_update',
type:'post',
data:{key:key,quantity:qty},
dataType:'json',
beforeSend:function(){
triggerLoadingOn();
$('#cart > button > a > span').button('loading');
$('.checkout-cart').addClass('checkout-loading');
},
complete:function(){
triggerLoadingOff();
$('#cart > button > a > span').button('reset');
},
success:function(json){
setTimeout(function(){
$('#cart-total').html(json['total']);
},100);
if(json['redirect']){
location=json['redirect'];
}else{
$('#cart ul').load('index.php?route=common/cart/info ul li');
$(document).trigger('so_checkout_reload_payment');
$(document).trigger('so_checkout_reload_shipping');
}
}
});
});
$(document).delegate('.checkout-product .input-group .btn-delete','click',function(){
var key=$(this).attr('data-product-key');
$.ajax({
url:'index.php?route=checkout/checkout/cart_delete',
type:'post',
data:{key:key},
dataType:'json',
beforeSend:function(){
triggerLoadingOn();
$('#cart > button > a > span').button('loading');
$('.checkout-cart').addClass('checkout-loading');
},
complete:function(){
triggerLoadingOff();
$('#cart > button > a > span').button('reset');
},
success:function(json){
setTimeout(function(){
$('#cart-total').html(json['total']);
},100);
if(json['redirect']){
location=json['redirect'];
}else{
$('#cart ul').load('index.php?route=common/cart/info ul li');
$(document).trigger('so_checkout_reload_payment');
$(document).trigger('so_checkout_reload_shipping');
}
}
});
});
$(document).delegate('#button-voucher','click',function(){
$.ajax({
url:'index.php?route=extension/total/voucher/voucher',
type:'post',
data:'voucher='+encodeURIComponent($('input[name=\'voucher\']').val()),
dataType:'json',
beforeSend:function(){
triggerLoadingOn();
$('#button-voucher').button('loading');
},
complete:function(){
triggerLoadingOff();
$('#button-voucher').button('reset');
},
success:function(json){
if(json['error']){
alert(json['error']);
}else{
$('#cart ul').load('index.php?route=common/cart/info ul li');
$(document).trigger('so_checkout_reload_payment');
$(document).trigger('so_checkout_reload_shipping');
}
}
});
});
$(document).delegate('#button-coupon','click',function(){
$.ajax({
url:'index.php?route=extension/total/coupon/coupon',
type:'post',
data:'coupon='+encodeURIComponent($('input[name=\'coupon\']').val()),
dataType:'json',
beforeSend:function(){
triggerLoadingOn();
$('#button-coupon').button('loading');
},
complete:function(){
triggerLoadingOff();
$('#button-coupon').button('reset');
},
success:function(json){
if(json['error']){
alert(json['error']);
}else{
$('#cart ul').load('index.php?route=common/cart/info ul li');
$(document).trigger('so_checkout_reload_payment');
$(document).trigger('so_checkout_reload_shipping');
}
}
});
});
$(document).delegate('#button-reward','click',function(){
$.ajax({
url:'index.php?route=extension/total/reward/reward',
type:'post',data:'reward='+encodeURIComponent($('input[name=\'reward\']').val()),
dataType:'json',
beforeSend:function(){
triggerLoadingOn();
$('#button-reward').button('loading');
},
complete:function(){
triggerLoadingOff();
$('#button-reward').button('reset');
},
success:function(json){
if(json['error']){
alert(json['error']);
}else{
$('#cart ul').load('index.php?route=common/cart/info ul li');
$(document).trigger('so_checkout_reload_payment');
$(document).trigger('so_checkout_reload_shipping');
}
}
});
});
var ajax_calls=0;
function triggerLoadingOn(){
$('body > .tooltip').remove();
ajax_calls++;
if(ajax_calls===1){
$('#so-checkout-confirm-button').button('loading');
$('#so-checkout-confirm-button, .checkout-register, .checkout-payment-form, .checkout-shipping-form, .checkout-cart, .confirm-section, .checkout-shipping-methods, .checkout-payment-methods, .coupon-voucher').addClass('checkout-loading');
}
}
function triggerLoadingOff(){
ajax_calls--;
if(ajax_calls===0){
$('#so-checkout-confirm-button').button('reset');
$('#so-checkout-confirm-button, .checkout-register, .checkout-payment-form, .checkout-shipping-form, .checkout-cart, .confirm-section, .checkout-shipping-methods, .checkout-payment-methods, .coupon-voucher').removeClass('checkout-loading');
}
}
jQuery(document).ready(function($) {
if ($('input[name="account"]:checked').length) {
$('input[name="account"]:checked').trigger('change', true);
}
$('input[name="payment_method"]:checked').trigger('change', true);
$('input[name="shipping_method"]:checked').trigger('change', true);
$(document).trigger('so_checkout_reload_cart',true);
}) | 32.748603 | 346 | 0.650759 |
38bc37563414b99e07d16b558bb80ebaafb43274 | 119 | js | JavaScript | src/import/errorNoCli.js | m0hq/json2graphql | b40bece03f6963518ccdc763dffc27263b54aa77 | [
"MIT"
] | null | null | null | src/import/errorNoCli.js | m0hq/json2graphql | b40bece03f6963518ccdc763dffc27263b54aa77 | [
"MIT"
] | null | null | null | src/import/errorNoCli.js | m0hq/json2graphql | b40bece03f6963518ccdc763dffc27263b54aa77 | [
"MIT"
] | null | null | null | const {cli} = require('cli-ux');
module.exports = message => {
console.log(message);
throw new Error(message);
};
| 17 | 32 | 0.647059 |
38bdc88410ae9132f26cf310f5ebac3dc0923be8 | 155 | js | JavaScript | templates/fragment/components/component.js | cagataycali/micro-fun | d68f5cc3a53105722f59a5b683f767db2da87da8 | [
"MIT"
] | 58 | 2021-03-24T21:42:38.000Z | 2022-01-31T20:53:56.000Z | templates/fragment/components/component.js | cagataycali/micro-fun-rick-and-morty | e6b6a8830ed8da6897b7f0acd4fa38db03fab7f1 | [
"MIT"
] | 1 | 2021-03-25T20:10:39.000Z | 2021-03-25T20:10:39.000Z | templates/fragment/components/component.js | cagataycali/micro-fun-rick-and-morty | e6b6a8830ed8da6897b7f0acd4fa38db03fab7f1 | [
"MIT"
] | 4 | 2021-03-24T21:42:54.000Z | 2021-04-24T10:52:36.000Z | import * as React from 'react';
const #FUN_FRAGMENT_NAME = () => {
return (
<h1>#FUN_FRAGMENT_NAME</h1>
);
};
export default #FUN_FRAGMENT_NAME;
| 15.5 | 34 | 0.651613 |
38bf3a4de3463e9e3c4f7696018b4d3ce616d604 | 177 | js | JavaScript | src/mapBy.js | nickjohnson-dev/liszt | ce99027adbd14e98575e06019a576819b33f8c74 | [
"MIT"
] | null | null | null | src/mapBy.js | nickjohnson-dev/liszt | ce99027adbd14e98575e06019a576819b33f8c74 | [
"MIT"
] | null | null | null | src/mapBy.js | nickjohnson-dev/liszt | ce99027adbd14e98575e06019a576819b33f8c74 | [
"MIT"
] | null | null | null | import curry from 'lodash/fp/curry';
import map from 'lodash/fp/map';
export default curry((predicate, iteratee, xs) => map(
x => (predicate(x) ? iteratee(x) : x),
xs,
));
| 22.125 | 54 | 0.649718 |
38c11489080b22e0ba7965da3ae846e6685a41e8 | 310 | js | JavaScript | webDevModerno/fudamentos/loopLetVar1.js | ThiagoMilhomens/WebDev-Studies | e12a1564bb089394ce37bfbf735b7bb96d1c8c2e | [
"MIT"
] | 1 | 2020-08-20T15:20:43.000Z | 2020-08-20T15:20:43.000Z | webDevModerno/fudamentos/loopLetVar1.js | ThiagoMilhomens/WebDev-Studies | e12a1564bb089394ce37bfbf735b7bb96d1c8c2e | [
"MIT"
] | null | null | null | webDevModerno/fudamentos/loopLetVar1.js | ThiagoMilhomens/WebDev-Studies | e12a1564bb089394ce37bfbf735b7bb96d1c8c2e | [
"MIT"
] | null | null | null | for (var i = 0; i < 10; i++) {
console.log(i)
}
console.log('i =', i)
/*
0
1
2
3
4
5
6
7
8
9
i = 10
*/
for (let i = 0; i < 10; i++) {
console.log(i)
}
console.log('i =', i) // Ñ consegue buscar i pq i está dentro do escopo e foi atribuído como let
/*
1
2
...
8
9
ReferenceError: i is not defined
*/
| 10.333333 | 96 | 0.551613 |
38c1e903f54eefb3b46290e16fe81608906a1e98 | 3,467 | js | JavaScript | .nuxt/dist/client/3616b4c.js | xhostcom/vue-nuxt-ecommerce-template | b242efc25cae1a7fc8ef2d889ec7e4bb0108bd68 | [
"MIT"
] | 3 | 2021-07-15T17:30:57.000Z | 2021-11-16T08:54:16.000Z | .nuxt/dist/client/3616b4c.js | xhostcom/vue-nuxt-ecommerce-firebase | b242efc25cae1a7fc8ef2d889ec7e4bb0108bd68 | [
"MIT"
] | 13 | 2021-07-15T17:30:34.000Z | 2022-02-13T11:00:51.000Z | .nuxt/dist/client/3616b4c.js | xhostcom/vue-nuxt-ecommerce-template | b242efc25cae1a7fc8ef2d889ec7e4bb0108bd68 | [
"MIT"
] | 1 | 2021-01-10T05:50:47.000Z | 2021-01-10T05:50:47.000Z | (window.webpackJsonp=window.webpackJsonp||[]).push([[11],{462:function(t,e,n){"use strict";n.r(e);var r={name:"Banner"},c=n(17),l=Object(c.a)(r,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"main-banner main-banner-three item-bg4"},[n("div",{staticClass:"d-table"},[n("div",{staticClass:"d-table-cell"},[n("div",{staticClass:"container"},[n("div",{staticClass:"main-banner-content white-color"},[n("span",[t._v("New Inspiration 2019")]),t._v(" "),n("h1",[t._v("Clothing made for you!")]),t._v(" "),n("p",[t._v("Meet our weekly new arrivals")]),t._v(" "),n("nuxt-link",{staticClass:"btn btn-primary",attrs:{to:"#"}},[t._v("Shop Women's")])],1)])])])])}),[],!1,null,null,null).exports,o=n(422),d=(n(1),n(386)),v=n(74),_=n(385),f={components:{QuckView:d.a,ProductItem:_.a},methods:{toggle:function(){v.a.toggleQuickView()}},computed:{products:function(){return this.$store.state.products.all.filter((function(t){return!0===t.trending}))}}},m=Object(c.a)(f,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("section",{staticClass:"trending-products-area ptb-60"},[n("div",{staticClass:"container"},[t._m(0),t._v(" "),n("div",{staticClass:"row"},t._l(t.products,(function(e){return n("ProductItem",{key:e.id,attrs:{product:e,className:"col-lg-3 col-md-6 col-sm-6"},on:{clicked:t.toggle}})})),1)])]),t._v(" "),n("QuckView")],1)}),[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"section-title without-bg"},[n("h2",[n("span",{staticClass:"dot"}),t._v(" Trending Products")])])}],!1,null,null,null).exports,h={components:{QuckView:d.a,ProductItem:_.a},methods:{toggle:function(){v.a.toggleQuickView()}},computed:{products:function(){return this.$store.state.products.all.filter((function(t){return!0===t.bestSellers}))}}},w=Object(c.a)(h,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("section",{staticClass:"best-sellers-area pb-60"},[n("div",{staticClass:"container"},[t._m(0),t._v(" "),n("div",{staticClass:"row"},t._l(t.products,(function(e){return n("ProductItem",{key:e.id,attrs:{product:e,className:"col-lg-3 col-md-6 col-sm-6"},on:{clicked:t.toggle}})})),1)])]),t._v(" "),n("QuckView")],1)}),[function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"section-title without-bg"},[n("h2",[n("span",{staticClass:"dot"}),t._v(" Best Sellers")])])}],!1,null,null,null).exports,C={name:"Offer"},k=Object(c.a)(C,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("section",{staticClass:"products-offer-area ptb-60"},[n("div",{staticClass:"container"},[n("div",{staticClass:"products-offer-content"},[n("span",[t._v("Limited Time Offer")]),t._v(" "),n("h1",[t._v("-40% Off")]),t._v(" "),n("p",[t._v("Get The Best Deals Now")]),t._v(" "),n("nuxt-link",{staticClass:"btn btn-primary",attrs:{to:"/products"}},[t._v("Discover Now")])],1)])])}),[],!1,null,null,null).exports,P=n(423),O=n(397),$=n(399),y=n(398),x={components:{Banner:l,Facility:o.a,TrendingProducts:m,BestSellers:w,Offer:k,News:P.a,Subscribe:O.a,Partner:$.a,InstagramPhotos:y.a}},B=Object(c.a)(x,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",[n("Banner"),t._v(" "),n("Facility"),t._v(" "),n("TrendingProducts"),t._v(" "),n("BestSellers"),t._v(" "),n("Offer"),t._v(" "),n("News"),t._v(" "),n("Subscribe"),t._v(" "),n("Partner"),t._v(" "),n("InstagramPhotos")],1)}),[],!1,null,null,null);e.default=B.exports}}]); | 3,467 | 3,467 | 0.653303 |
38c3c0033d47a7b2aa6ca6d8f894c4f824d29e18 | 4,574 | js | JavaScript | plugins/wp-seopress/assets/js/seopress-tabs.js | propernounco/pn_base_wp_theme | 0be40555792bb406533fe7f76b42b20a85e7b8cf | [
"W3C"
] | 1 | 2020-05-03T01:46:47.000Z | 2020-05-03T01:46:47.000Z | plugins/wp-seopress/assets/js/seopress-tabs.js | propernounco/pn_base_wp_theme | 0be40555792bb406533fe7f76b42b20a85e7b8cf | [
"W3C"
] | null | null | null | plugins/wp-seopress/assets/js/seopress-tabs.js | propernounco/pn_base_wp_theme | 0be40555792bb406533fe7f76b42b20a85e7b8cf | [
"W3C"
] | null | null | null | jQuery(document).ready(function($) {
if(typeof sessionStorage!='undefined') {
var seopress_tab_session_storage = sessionStorage.getItem("seopress_titles_tab");
if (seopress_tab_session_storage) {
$('#seopress-tabs').find('.nav-tab.nav-tab-active').removeClass("nav-tab-active");
$('#seopress-tabs').find('.seopress-tab.active').removeClass("active");
$('#'+seopress_tab_session_storage+'-tab').addClass("nav-tab-active");
$('#'+seopress_tab_session_storage).addClass("active");
} else {
//Default TAB
$('#tab_seopress_titles_home-tab').addClass("nav-tab-active");
$('#tab_seopress_titles_home').addClass("active");
}
};
$("#seopress-tabs").find("a.nav-tab").click(function(e){
e.preventDefault();
var hash = $(this).attr('href').split('#tab=')[1];
$('#seopress-tabs').find('.nav-tab.nav-tab-active').removeClass("nav-tab-active");
$('#'+hash+'-tab').addClass("nav-tab-active");
sessionStorage.setItem("seopress_titles_tab", hash);
$('#seopress-tabs').find('.seopress-tab.active').removeClass("active");
$('#'+hash).addClass("active");
});
$('#seopress-tag-site-title').click(function() {
$("#seopress_titles_home_site_title").val($("#seopress_titles_home_site_title").val() + ' ' + $('#seopress-tag-site-title').attr('data-tag'));
});
$('#seopress-tag-site-title-author').click(function() {
$("#seopress_titles_archive_post_author").val($("#seopress_titles_archive_post_author").val() + ' ' + $('#seopress-tag-site-title-author').attr('data-tag'));
});
$('#seopress-tag-site-title-date').click(function() {
$("#seopress_titles_archives_date_title").val($("#seopress_titles_archives_date_title").val() + ' ' + $('#seopress-tag-site-title-date').attr('data-tag'));
});
$('#seopress-tag-site-title-search').click(function() {
$("#seopress_titles_archives_search_title").val($("#seopress_titles_archives_search_title").val() + ' ' + $('#seopress-tag-site-title-search').attr('data-tag'));
});
$('#seopress-tag-site-title-404').click(function() {
$("#seopress_titles_archives_404_title").val($("#seopress_titles_archives_404_title").val() + ' ' + $('#seopress-tag-site-title-404').attr('data-tag'));
});
$('#seopress-tag-site-desc').click(function() {
$("#seopress_titles_home_site_title").val($("#seopress_titles_home_site_title").val() + ' ' + $('#seopress-tag-site-desc').attr('data-tag'));
});
$('#seopress-tag-meta-desc').click(function() {
$("#seopress_titles_home_site_desc").val($("#seopress_titles_home_site_desc").val() + ' ' + $('#seopress-tag-meta-desc').attr('data-tag'));
});
$('#seopress-tag-post-author').click(function() {
$("#seopress_titles_archive_post_author").val($("#seopress_titles_archive_post_author").val() + ' ' + $('#seopress-tag-post-author').attr('data-tag'));
});
$('#seopress-tag-archive-date').click(function() {
$("#seopress_titles_archives_date_title").val($("#seopress_titles_archives_date_title").val() + ' ' + $('#seopress-tag-archive-date').attr('data-tag'));
});
$('#seopress-tag-search-keywords').click(function() {
$("#seopress_titles_archives_search_title").val($("#seopress_titles_archives_search_title").val() + ' ' + $('#seopress-tag-search-keywords').attr('data-tag'));
});
$('#seopress-tag-site-sep').click(function() {
$("#seopress_titles_home_site_title").val($("#seopress_titles_home_site_title").val() + ' ' + $('#seopress-tag-site-sep').attr('data-tag'));
});
$('#seopress-tag-sep-author').click(function() {
$("#seopress_titles_archive_post_author").val($("#seopress_titles_archive_post_author").val() + ' ' + $('#seopress-tag-sep-author').attr('data-tag'));
});
$('#seopress-tag-sep-date').click(function() {
$("#seopress_titles_archives_date_title").val($("#seopress_titles_archives_date_title").val() + ' ' + $('#seopress-tag-sep-date').attr('data-tag'));
});
$('#seopress-tag-sep-search').click(function() {
$("#seopress_titles_archives_search_title").val($("#seopress_titles_archives_search_title").val() + ' ' + $('#seopress-tag-sep-search').attr('data-tag'));
});
$('#seopress-tag-sep-404').click(function() {
$("#seopress_titles_archives_404_title").val($("#seopress_titles_archives_404_title").val() + ' ' + $('#seopress-tag-sep-404').attr('data-tag'));
});
$('.more-tags').click(function() {
$('#contextual-help-link').click();
});
}); | 59.402597 | 169 | 0.631395 |
38c3fc1107b4a30c376c6eaf1ffcf5d3b3f7053e | 124 | js | JavaScript | src/utils/mergeArraysOnProperty.js | teamleadercrm/sdk-js | 17c47e11f218f83f0f5e06751506be00462491c9 | [
"MIT"
] | 5 | 2019-06-06T13:53:38.000Z | 2022-03-28T09:39:48.000Z | src/utils/mergeArraysOnProperty.js | teamleadercrm/sdk-js | 17c47e11f218f83f0f5e06751506be00462491c9 | [
"MIT"
] | 46 | 2018-02-15T13:05:12.000Z | 2021-12-23T14:17:39.000Z | src/utils/mergeArraysOnProperty.js | teamleadercrm/sdk-js | 17c47e11f218f83f0f5e06751506be00462491c9 | [
"MIT"
] | null | null | null | export default (property, ...objects) =>
objects.reduce((arr, object = {}) => [...arr, ...(object[property] || [])], []);
| 41.333333 | 82 | 0.540323 |
38c4ce2cbbc214c4216295d48af27d188498382c | 906 | js | JavaScript | config.js | ExplorerUTT/explorer | c952b741de841f1f578efba1d8b46f87b2b05b13 | [
"MIT"
] | 5 | 2016-01-14T16:25:29.000Z | 2016-02-12T16:24:55.000Z | config.js | ExplorerUTT/explorer | c952b741de841f1f578efba1d8b46f87b2b05b13 | [
"MIT"
] | 5 | 2016-01-14T23:16:56.000Z | 2016-02-08T22:13:50.000Z | config.js | ExplorerUTT/explorer | c952b741de841f1f578efba1d8b46f87b2b05b13 | [
"MIT"
] | null | null | null | 'use strict';
var config;
switch (process.env.NODE_ENV) {
case 'development':
config = {
APP_PORT: 3000,
database: {
couch: {
host: 'http://127.0.0.1',
port: 5984,
options: {}
}
}
};
break;
case 'production':
config = {
APP_PORT: 3000,
database: {
couch: {
host: '',
port: 5984,
options: {
}
}
}
};
break;
default:
config = {
APP_PORT: 3000,
database: {
couch: {
host: 'http://127.0.0.1',
port: 5984,
options: {
}
}
}
};
}
module.exports = config;
| 20.133333 | 45 | 0.30574 |
38c4eabe7c8b1445305346325fd7a340ca01b772 | 613 | js | JavaScript | src/routes/response.routes.js | jodeperezlo/platzi-nodejs-websockets | b7cfef30202f68321dda9b2c8082361979227b2a | [
"MIT"
] | null | null | null | src/routes/response.routes.js | jodeperezlo/platzi-nodejs-websockets | b7cfef30202f68321dda9b2c8082361979227b2a | [
"MIT"
] | null | null | null | src/routes/response.routes.js | jodeperezlo/platzi-nodejs-websockets | b7cfef30202f68321dda9b2c8082361979227b2a | [
"MIT"
] | null | null | null | // Copyright (c) 2022 Jorge de Jesus Perez Lopez
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
// Copyright (c) 2022 Jorge de Jesus Perez Lopez
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
exports.succes = (req, res, status, message) => {
res.status(status || 200).json({
status: 'success',
body: message,
});
};
exports.error = (req, res, status, message, details) => {
console.error(`[response error] ${details || message}`);
res.status(status || 500).json({
status: 'error',
body: message,
});
};
| 25.541667 | 57 | 0.66721 |
38c51f1ee2422ff329f72fda93c565b0c0144362 | 1,061 | js | JavaScript | themes/material/dashboard/app/modules/common/services/commonFactory.js | anurag-singh2001/brush | cd48e61f9c6f513184bab1945837e2a1a20e8afc | [
"MIT"
] | 9 | 2017-03-04T20:38:19.000Z | 2018-05-23T04:40:38.000Z | themes/material/dashboard/app/modules/common/services/commonFactory.js | anurag-singh2001/brush | cd48e61f9c6f513184bab1945837e2a1a20e8afc | [
"MIT"
] | null | null | null | themes/material/dashboard/app/modules/common/services/commonFactory.js | anurag-singh2001/brush | cd48e61f9c6f513184bab1945837e2a1a20e8afc | [
"MIT"
] | 6 | 2015-10-25T04:30:31.000Z | 2015-12-03T17:49:58.000Z | (function() {
'use strict';
app.factory('commonFactory', ['api', 'localStorageService','url','$mdToast',
function(api,localStorageService, url,$mdToast) {
var getReferenceData = function(config,success){
api.executeCall(config,success);
};
return {
getRoles: function(success) {
getReferenceData({url: url.reference.roles},success);
},
getAdminRoles: function(success) {
getReferenceData({url: url.admin.roles},success);
},
getUser: function(){
return localStorageService.get('user');
},
showMessage: function(message){
var toast = $mdToast.simple()
.textContent(message)
.highlightClass('md-accent bold')
.position('top right')
.hideDelay(3000);
$mdToast.show(toast).then(function(response) {});
}
};
}]);
})();
| 36.586207 | 80 | 0.491046 |
38c54610a493db58cd7d0fa33e4f5b785b955359 | 1,972 | js | JavaScript | public/app/services/counterPicksService.js | bxyoung89/dota2picker | 0167de6053309c14127480237a93e92271df0389 | [
"MIT"
] | 4 | 2016-02-23T21:01:45.000Z | 2019-07-11T01:39:38.000Z | public/app/services/counterPicksService.js | bxyoung89/dota2picker | 0167de6053309c14127480237a93e92271df0389 | [
"MIT"
] | null | null | null | public/app/services/counterPicksService.js | bxyoung89/dota2picker | 0167de6053309c14127480237a93e92271df0389 | [
"MIT"
] | 2 | 2016-10-01T19:43:05.000Z | 2020-06-09T14:45:10.000Z | angular.module("WalrusPunch").service("counterPicksService", [
"heroService",
"dataSourceService",
function (heroService, dataSourceService) {
function CounterPicksService() {
}
CounterPicksService.prototype.updateCounterPickData = function(enemyTeam){
updateEnemyTeamCounterPickData(enemyTeam);
updateOtherHeroesCounterPickData(enemyTeam);
};
function updateEnemyTeamCounterPickData(enemyTeam){
enemyTeam.forEach(function(hero){
hero.counterPickAdvantage = 0;
hero.overallAdvantage = 0;
});
}
function updateOtherHeroesCounterPickData(enemyTeam){
var otherHeroes = getOtherHeroes(enemyTeam);
getCounterPickAdvantage(otherHeroes, enemyTeam);
getAdvantageIndex(otherHeroes);
}
function getCounterPickAdvantage(heroes, enemyTeam){
if(heroes[0].advantages === undefined){
heroes.forEach(function(hero){
hero.counterPickAdvantage = 0;
});
return;
}
heroes.forEach(function(hero){
var teamAdvantage = enemyTeam.average(function(enemy){
var advantage = dataSourceService.getAdvantages(hero).find(function(advantage){
return advantage.id === enemy.id;
});
if(!advantage){
return 0;
}
return advantage.a;
});
hero.counterPickAdvantage = (Math.round(teamAdvantage * 1000) / 1000).toFixed(3);
});
heroService.updateHeroesWithCounterPickAdvantage(heroes);
}
function getAdvantageIndex(heroes){
var sortedCounterPicks = heroes.sort(function(hero1, hero2){
return hero1.counterPickAdvantage - hero2.counterPickAdvantage;
});
sortedCounterPicks.forEach(function(hero, index){
hero.advantageIndex = index;
});
}
function getOtherHeroes(enemyTeam){
return heroService.getTranslatedHeroes().filter(function(hero){
return !enemyTeam.any(function(enemy){
return enemy.id === hero.id;
});
});
}
return new CounterPicksService();
}]); | 29 | 86 | 0.694219 |
38c79f34ff4e134e79230115abf92a49a4418fc3 | 3,510 | js | JavaScript | build/translations/sv.js | vndywhat/ckeditor5-build-classic-base64upload-spoiler | bd376c83b27811ec1ae3f7a0f9ab17c214055232 | [
"MIT"
] | null | null | null | build/translations/sv.js | vndywhat/ckeditor5-build-classic-base64upload-spoiler | bd376c83b27811ec1ae3f7a0f9ab17c214055232 | [
"MIT"
] | null | null | null | build/translations/sv.js | vndywhat/ckeditor5-build-classic-base64upload-spoiler | bd376c83b27811ec1ae3f7a0f9ab17c214055232 | [
"MIT"
] | null | null | null | (function(d){d['sv']=Object.assign(d['sv']||{},{a:"Kan inte ladda upp fil:",b:"Image toolbar",c:"Table toolbar",d:"Upload in progress",e:"Kursiv",f:"Genomstruken",g:"Fet",h:"Upphöjda tecken",i:"Nedsänkta tecken",j:"Understrykning",k:"Increase indent",l:"Decrease indent",m:"Blockcitat",n:"Horizontal line",o:"Välj rubrik",p:"Rubrik",q:"Fyll i bildtext",r:"image widget",s:"Insert image or file",t:"Bild i full storlek",u:"Kantbild",v:"Vänsterjusterad bild",w:"Centrerad bild",x:"Högerjusterad bild",y:"Infoga bild",z:"media widget",aa:"Widget toolbar",ab:"Vänsterjustera",ac:"Högerjustera",ad:"Centrera",ae:"Justera till marginaler",af:"Textjustering",ag:"Text alignment toolbar",ah:"Numrerad lista",ai:"Punktlista",aj:"Gul markering",ak:"Grön markering",al:"Rosa markering",am:"Blå markering",an:"Röd penna",ao:"Grön penna",ap:"Ta bort markering",aq:"Markera",ar:"Text highlight toolbar",as:"Table properties",at:"Cell properties",au:"Lägg in tabell",av:"Header column",aw:"Insert column left",ax:"Insert column right",ay:"Ta bort kolumn",az:"Kolumn",ba:"Header row",bb:"Insert row below",bc:"Insert row above",bd:"Ta bort rad",be:"Rad",bf:"Merge cell up",bg:"Merge cell right",bh:"Merge cell down",bi:"Merge cell left",bj:"Split cell vertically",bk:"Split cell horizontally",bl:"Merge cells",bm:"Lägg in media",bn:"The URL must not be empty.",bo:"This media URL is not supported.",bp:"Länk",bq:"Insert code block",br:"Could not obtain resized image URL.",bs:"Selecting resized image failed",bt:"Could not insert image at the current position.",bu:"Inserting image failed",bv:"Ändra bildens alternativa text",bw:"Rich Text-editor",bx:"Ångra",by:"Gör om",bz:"Font Background Color",ca:"Font Color",cb:"Teckenstorlek",cc:"Standard",cd:"Mycket liten",ce:"Liten",cf:"Stor",cg:"Enorm",ch:"Spara",ci:"Avbryt",cj:"Paste the media URL in the input.",ck:"Tip: Paste the URL into the content to embed faster.",cl:"Media URL",cm:"Dropdown toolbar",cn:"Black",co:"Dim grey",cp:"Grey",cq:"Light grey",cr:"White",cs:"Red",ct:"Orange",cu:"Yellow",cv:"Light green",cw:"Green",cx:"Aquamarine",cy:"Turquoise",cz:"Light blue",da:"Blue",db:"Purple",dc:"Typsnitt",dd:"None",de:"Solid",df:"Dotted",dg:"Dashed",dh:"Double",di:"Groove",dj:"Ridge",dk:"Inset",dl:"Outset",dm:"The color is invalid. Try \"#FF0000\" or \"rgb(255,0,0)\" or \"red\".",dn:"The value is invalid. Try \"10px\" or \"2em\" or simply \"2\".",do:"Border",dp:"Style",dq:"Width",dr:"Color",ds:"Background",dt:"Dimensions",du:"Height",dv:"Padding",dw:"Table cell text alignment",dx:"Horizontal text alignment toolbar",dy:"Vertical text alignment toolbar",dz:"Align cell text to the left",ea:"Align cell text to the center",eb:"Align cell text to the right",ec:"Justify cell text",ed:"Align cell text to the top",ee:"Align cell text to the middle",ef:"Align cell text to the bottom",eg:"%0 of %1",eh:"Previous",ei:"Next",ej:"Plain text",ek:"Alternativ text",el:"Open in a new tab",em:"Downloadable",en:"Länkens URL",eo:"Ta bort länk",ep:"Redigera länk",eq:"Öppna länk i ny flik",er:"Denna länk saknar URL",es:"Remove color",et:"Document colors",eu:"Editor toolbar",ev:"Show more items",ew:"Alignment",ex:"Table alignment toolbar",ey:"Align table to the left",ez:"Center table",fa:"Align table to the right",fb:"Spoiler",fc:"Paragraf",fd:"Rubrik 1",fe:"Rubrik 2",ff:"Rubrik 3",fg:"Rubrik 4",fh:"Rubrik 5",fi:"Rubrik 6",fj:"Radera formatering",fk:"Uppladdning misslyckades",fl:"Rich Text-editor, %0"})})(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})); | 3,510 | 3,510 | 0.716239 |
38c7e203231df3bfbbc81f5421a28a11b6bdef3c | 10,100 | js | JavaScript | node_modules/@cypress/schema-tools/dist/api.js | sutlac26/sutlacCypress26 | 74074d5666b7dbbd47621260442eb484ea47414d | [
"MIT"
] | null | null | null | node_modules/@cypress/schema-tools/dist/api.js | sutlac26/sutlacCypress26 | 74074d5666b7dbbd47621260442eb484ea47414d | [
"MIT"
] | null | null | null | node_modules/@cypress/schema-tools/dist/api.js | sutlac26/sutlacCypress26 | 74074d5666b7dbbd47621260442eb484ea47414d | [
"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 __());
};
})();
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.bind = exports.assertSchema = exports.assertBySchema = exports.SchemaError = exports.validate = exports.validateBySchema = exports.getExample = exports.getSchemaVersions = exports.schemaNames = exports.hasSchema = exports.getObjectSchema = exports.getVersionedSchema = void 0;
var is_my_json_valid_1 = __importDefault(require("@bahmutov/is-my-json-valid"));
var debug_1 = __importDefault(require("debug"));
var json_stable_stringify_1 = __importDefault(require("json-stable-stringify"));
var lodash_get_1 = __importDefault(require("lodash.get"));
var lodash_set_1 = __importDefault(require("lodash.set"));
var ramda_1 = require("ramda");
var fill_1 = require("./fill");
var formats_1 = require("./formats");
var sanitize_1 = require("./sanitize");
var trim_1 = require("./trim");
var utils = __importStar(require("./utils"));
var debug = debug_1.default('schema-tools');
exports.getVersionedSchema = function (schemas) { return function (name) {
name = utils.normalizeName(name);
return schemas[name];
}; };
var _getObjectSchema = function (schemas, schemaName, version) {
schemaName = utils.normalizeName(schemaName);
var namedSchemas = schemas[schemaName];
if (!namedSchemas) {
debug('missing schema %s', schemaName);
return;
}
return namedSchemas[version];
};
exports.getObjectSchema = ramda_1.curry(_getObjectSchema);
var _hasSchema = function (schemas, schemaName, version) { return Boolean(_getObjectSchema(schemas, schemaName, version)); };
exports.hasSchema = ramda_1.curry(_hasSchema);
exports.schemaNames = function (schemas) {
return Object.keys(schemas).sort();
};
exports.getSchemaVersions = function (schemas) { return function (schemaName) {
schemaName = utils.normalizeName(schemaName);
if (schemas[schemaName]) {
return Object.keys(schemas[schemaName]);
}
return [];
}; };
exports.getExample = ramda_1.curry(function (schemas, schemaName, version) {
var o = exports.getObjectSchema(schemas)(schemaName)(version);
if (!o) {
debug('could not find object schema %s@%s', schemaName, version);
return;
}
return o.example;
});
var dataHasAdditionalPropertiesValidationError = {
field: 'data',
message: 'has additional properties',
};
var findDataHasAdditionalProperties = ramda_1.find(ramda_1.whereEq(dataHasAdditionalPropertiesValidationError));
var includesDataHasAdditionalPropertiesError = function (errors) { return findDataHasAdditionalProperties(errors) !== undefined; };
var errorToString = function (error) {
return error.field + " " + error.message;
};
var errorsToStrings = function (errors) {
return errors.map(errorToString);
};
exports.validateBySchema = function (schema, formats, greedy) {
if (greedy === void 0) { greedy = true; }
return function (object) {
var validate = is_my_json_valid_1.default(schema, { formats: formats, greedy: greedy });
if (validate(object)) {
return true;
}
var uniqueErrors = ramda_1.uniqBy(errorToString, validate.errors);
if (includesDataHasAdditionalPropertiesError(uniqueErrors) &&
ramda_1.keys(schema.properties).length) {
var hasData = findDataHasAdditionalProperties(uniqueErrors);
var additionalProperties = ramda_1.difference(ramda_1.keys(object), ramda_1.keys(schema.properties));
hasData.message += ': ' + additionalProperties.join(', ');
}
var errors = ramda_1.uniq(errorsToStrings(uniqueErrors));
return errors;
};
};
exports.validate = function (schemas, formats, greedy) {
if (greedy === void 0) { greedy = true; }
return function (schemaName, version) { return function (object) {
schemaName = utils.normalizeName(schemaName);
var namedSchemas = schemas[schemaName];
if (!namedSchemas) {
return ["Missing schema " + schemaName];
}
var aSchema = namedSchemas[version];
if (!aSchema) {
return ["Missing schema " + schemaName + "@" + version];
}
return exports.validateBySchema(aSchema.schema, formats, greedy)(object);
}; };
};
var SchemaError = (function (_super) {
__extends(SchemaError, _super);
function SchemaError(message, errors, object, example, schemaName, schemaVersion) {
var _newTarget = this.constructor;
var _this = _super.call(this, message) || this;
Object.setPrototypeOf(_this, _newTarget.prototype);
_this.errors = errors;
_this.object = object;
_this.example = example;
_this.schemaName = schemaName;
if (schemaVersion) {
_this.schemaVersion = schemaVersion;
}
return _this;
}
return SchemaError;
}(Error));
exports.SchemaError = SchemaError;
var AssertBySchemaDefaults = {
greedy: true,
substitutions: [],
omit: {
errors: false,
object: false,
example: false,
},
};
exports.assertBySchema = function (schema, example, options, label, formats, schemaVersion) {
if (example === void 0) { example = {}; }
return function (object) {
var allOptions = ramda_1.mergeDeepLeft(options || AssertBySchemaDefaults, AssertBySchemaDefaults);
var replace = function () {
var cloned = ramda_1.clone(object);
allOptions.substitutions.forEach(function (property) {
var value = lodash_get_1.default(example, property);
lodash_set_1.default(cloned, property, value);
});
return cloned;
};
var replaced = allOptions.substitutions.length ? replace() : object;
var result = exports.validateBySchema(schema, formats, allOptions.greedy)(replaced);
if (result === true) {
return object;
}
var title = label ? "Schema " + label + " violated" : 'Schema violated';
var emptyLine = '';
var parts = [title];
if (!allOptions.omit.errors) {
parts = parts.concat([emptyLine, 'Errors:']).concat(result);
}
if (!allOptions.omit.object) {
var objectString = json_stable_stringify_1.default(replaced, { space: ' ' });
parts = parts.concat([emptyLine, 'Current object:', objectString]);
}
if (!allOptions.omit.example) {
var exampleString = json_stable_stringify_1.default(example, { space: ' ' });
parts = parts.concat([
emptyLine,
'Expected object like this:',
exampleString,
]);
}
var message = parts.join('\n');
throw new SchemaError(message, result, replaced, example, schema.title, schemaVersion);
};
};
exports.assertSchema = function (schemas, formats) { return function (name, version, options) { return function (object) {
var example = exports.getExample(schemas)(name)(version);
var schema = exports.getObjectSchema(schemas)(name)(version);
if (!schema) {
throw new Error("Could not find schema " + name + "@" + version);
}
var label = name + "@" + version;
return exports.assertBySchema(schema.schema, example, options, label, formats, utils.semverToString(schema.version))(object);
}; }; };
var mergeSchemas = function (schemas) {
return ramda_1.mergeAll(schemas);
};
var mergeFormats = function (formats) {
return ramda_1.mergeAll(formats);
};
var exists = function (x) { return Boolean(x); };
exports.bind = function () {
var options = [];
for (var _i = 0; _i < arguments.length; _i++) {
options[_i] = arguments[_i];
}
var allSchemas = ramda_1.map(ramda_1.prop('schemas'), options);
var schemas = mergeSchemas(allSchemas);
var allFormats = ramda_1.filter(exists, ramda_1.map(ramda_1.prop('formats'), options));
var formats = mergeFormats(allFormats);
var formatDetectors = formats_1.detectors(formats);
var defaults = formats_1.getDefaults(formats);
var api = {
assertSchema: exports.assertSchema(schemas, formatDetectors),
schemaNames: exports.schemaNames(schemas),
getExample: exports.getExample(schemas),
sanitize: sanitize_1.sanitize(schemas, defaults),
validate: exports.validate(schemas),
trim: trim_1.trim(schemas),
hasSchema: exports.hasSchema(schemas),
fill: fill_1.fill(schemas),
};
return api;
};
//# sourceMappingURL=api.js.map | 42.978723 | 284 | 0.647822 |
38c7e5055626f270aaab954bec84f22092def18d | 380 | js | JavaScript | src/js/ui/visualizations/setTotalamounts.js | dmcshehan/monthly-statement | f9de68a9fb04ff75eb80c88f75a77cf388d752f2 | [
"MIT"
] | null | null | null | src/js/ui/visualizations/setTotalamounts.js | dmcshehan/monthly-statement | f9de68a9fb04ff75eb80c88f75a77cf388d752f2 | [
"MIT"
] | 5 | 2021-05-11T11:20:50.000Z | 2022-02-27T06:38:58.000Z | src/js/ui/visualizations/setTotalamounts.js | dmcshehan/monthly-statement | f9de68a9fb04ff75eb80c88f75a77cf388d752f2 | [
"MIT"
] | null | null | null | import { thousandsSeparators } from 'currency-thousand-separator';
export default (totalExpenses, totalIncomes) => {
var exepnsesEl = document.querySelector('#total-expenses .amount');
var incomesEl = document.querySelector('#total-incomes .amount');
exepnsesEl.textContent = thousandsSeparators(totalExpenses);
incomesEl.textContent = thousandsSeparators(totalIncomes);
};
| 38 | 68 | 0.789474 |
38c8ec45f32f546a3514c84ab90fa03cd361016b | 367 | js | JavaScript | src/pages/contacts.js | itsmdsameerkhan/gatsby-project | 79cea1fe719578c735dad84170e38ef9af9a691c | [
"MIT"
] | null | null | null | src/pages/contacts.js | itsmdsameerkhan/gatsby-project | 79cea1fe719578c735dad84170e38ef9af9a691c | [
"MIT"
] | null | null | null | src/pages/contacts.js | itsmdsameerkhan/gatsby-project | 79cea1fe719578c735dad84170e38ef9af9a691c | [
"MIT"
] | null | null | null | import React from "react"
import Content from "../components/body"
import Header from "../components/header"
import { Link } from "gatsby"
const Contacts = () => (
<div>
<Link to="/">Home</Link>
<Link to="/about/">About</Link>
<Header header="This is contact" />
<Content body="I am the contact page. Hello!" />
</div>
)
export default Contacts
| 22.9375 | 52 | 0.640327 |
38c9f0dfad96121c2a49ccf64f416ed8716a335d | 553 | js | JavaScript | dist/precache-manifest.3cc5f61634034025d127bfa10417339f.js | wre232114/brightblogback | add45dfec87ee366dd715a03fc83c273e6b86e13 | [
"MIT"
] | null | null | null | dist/precache-manifest.3cc5f61634034025d127bfa10417339f.js | wre232114/brightblogback | add45dfec87ee366dd715a03fc83c273e6b86e13 | [
"MIT"
] | 6 | 2020-12-04T18:36:08.000Z | 2022-02-18T07:15:20.000Z | dist/precache-manifest.3cc5f61634034025d127bfa10417339f.js | wre232114/brightblogback | add45dfec87ee366dd715a03fc83c273e6b86e13 | [
"MIT"
] | null | null | null | self.__precacheManifest = [
{
"revision": "b6216d61c03e6ce0c9aea6ca7808f7ca",
"url": "/robots.txt"
},
{
"revision": "9ceff6f40c843448517c",
"url": "/js/chunk-vendors.53ed5523.js"
},
{
"revision": "d5c118efa2cd75ba64dd",
"url": "/js/app.cdb43166.js"
},
{
"revision": "5784639ee1647e823240b24fa135ded3",
"url": "/index.html"
},
{
"revision": "9ceff6f40c843448517c",
"url": "/css/chunk-vendors.391ed6f9.css"
},
{
"revision": "d5c118efa2cd75ba64dd",
"url": "/css/app.2c60e254.css"
}
]; | 21.269231 | 51 | 0.600362 |
38ca06fe12659c271aaa785821d87ab6877210ee | 4,063 | js | JavaScript | client/src/_designsystem/_packages/_tests/VariableDrawer.test.js | dennis8844/flash-sendgrid-react-docker-nginx | 123e7e968f1f03e441724cbbaf7fff6bd5b616ae | [
"MIT"
] | null | null | null | client/src/_designsystem/_packages/_tests/VariableDrawer.test.js | dennis8844/flash-sendgrid-react-docker-nginx | 123e7e968f1f03e441724cbbaf7fff6bd5b616ae | [
"MIT"
] | null | null | null | client/src/_designsystem/_packages/_tests/VariableDrawer.test.js | dennis8844/flash-sendgrid-react-docker-nginx | 123e7e968f1f03e441724cbbaf7fff6bd5b616ae | [
"MIT"
] | null | null | null | import React from 'react';
import { render, cleanup } from '@testing-library/react';
import { mouseClick } from "./custom_test_utils";
import {
getByLabelText,
getByText,
getByTestId,
queryByTestId,
} from '@testing-library/dom';
import '@testing-library/jest-dom'
import '@testing-library/jest-dom/extend-expect'
import userEvent from '@testing-library/user-event'
import VariableDrawer from "../components/VariableDrawer/VariableDrawer";
import {
generatePreviewData,
generateTemplateValues,
} from "../utils/functions";
import { initialState } from "../utils/appReducer";
const varData = generateTemplateValues(initialState.inputVariables);
const data = generatePreviewData(initialState.inputVariables, varData);
let initTestProps = {
open: true,
onClose: null,
data,
fetching: false,
onSendTestEmail: null
}, inputLabels = [],
inputNames = [],
testProps = {};
beforeEach(() => { //the most powerful function in jest
testProps = {...initTestProps};
inputLabels = [];
inputNames = [];
testProps = {};
initTestProps.variables.forEach(variable => {
if (variable.inDrawer) {
inputLabels.push(variable.label);
inputNames.push(variable.name)
}
});
});
afterEach(cleanup);
describe("It renders correctly", () => {
it("renders correctly", () => {
const { queryByTestId } = render(<VariableDrawer {...testProps} />);
expect(queryByTestId("variable-drawer").toBeInTheDocument();
expect(queryByTestId("variable-drawer").not.toBeEmpty();
});
it("has all the inputs labels" , ()=> {
inputLabels.forEach(inputName => {
const VD = shallow(<VariableDrawer {...testProps}/>);
const foundInput = VD.find(`input[${inputName}]`);
expect(foundInput).toBeInTheDocument();
expect(foundInput).toHaveLength(1);
foundInput.simulate('click');
expect(foundInput).toHaveFocus();
});
});
it("has all the input names" , ()=> {
inputLabels.forEach(showingLabel => {
const VD = render(<VariableDrawer {...testProps}/>);
const label = getByLabelText(VD, showingLabel);
expect(label).toBeInTheDocument();
expect(label).not.toBeEmpty();
});
});
it("registers the click correctly", () => {
const clickMock = jest.fn(),
newProps = {
...testProps,
onClose: clickMock,
};
const VD = render(<VariableDrawer {...newProps} />);
queryByTestId(VD, "close-drawer-button").click();
expect(clickMock).toHaveBeenCalledTimes(1);
});
it(`Able to focus on the input`, () => {
inputNames.forEach(inputName => {
const clickMock = jest.fn(),
inputKeyMock = jest.fn(),
newProps = {
...testProps,
onVariableChange: inputKeyMock,
onClose: clickMock,
};
const VD = shallow(<VariableDrawer {...newProps}/>);
const foundInput = VD.find(`input[${inputName}]`);
fireEvent(foundInput), mouseClick);
expect(clickMock).toHaveBeenCalledTimes(1);
expect(foundInput).toHaveFocus();
});
});
});
describe("It handles input events correctly", () => {
inputNames.forEach(inputName => {
it(`Able to set a key event on ${inputName} input`, () => {
const inputKeyMock = jest.fn(),
newProps = {
...testProps,
onVariableChange: inputKeyMock
};
const VD = shallow(<VariableDrawer {...newProps}/>);;
const foundInput = VD.find(`input[${inputName}]`)[0];
const keyToPress = "K";
const currentValue = foundInput.value;
fireEvent(foundInput, onkeydown());
expect(inputKeyMock).toHaveBeenCalled(1);
expect(foundInput.value).not.toEqual(currentValue);
expect(foundInput).toHaveFocus();
})
})
})
| 30.780303 | 76 | 0.590943 |
38ca17cdbb30bcc2d861d3ba2fdfcd39849be343 | 705 | js | JavaScript | src/models/rooms/cell-doors-1.js | egillespie/super-vector-dungeon | 7065428d1cb5898f15de96738e33b9463f55f2c1 | [
"MIT"
] | null | null | null | src/models/rooms/cell-doors-1.js | egillespie/super-vector-dungeon | 7065428d1cb5898f15de96738e33b9463f55f2c1 | [
"MIT"
] | 1 | 2021-05-08T06:34:49.000Z | 2021-05-08T06:34:49.000Z | src/models/rooms/cell-doors-1.js | egillespie/super-vector-dungeon | 7065428d1cb5898f15de96738e33b9463f55f2c1 | [
"MIT"
] | null | null | null | import { fromJS } from 'immutable'
import horizontalWall from '../walls/wall-horizontal'
import verticalWall from '../walls/wall-vertical'
import line from '../line'
// Creates a 10x10 cell with one door starting at (0, 0)
//
// ##########
// DDD #
// D D #
// D D #
// D D #
// D D #
// D D #
// D D #
// DDD #
// ##########
//
// <path d="M 0,0 h 10 M 10,0 v 10 M 0,10 h 10"/>
export default () => {
return fromJS({
x: 0,
y: 0,
height: 10,
width: 10,
walls: [
horizontalWall({ x: 0, y: 0 }),
verticalWall({ x: 10, y: 0 }),
horizontalWall({ x: 0, y: 10 })
],
exits: [
line(0, 0, 0, 10)
]
})
}
| 19.583333 | 56 | 0.460993 |
38cacfa1ea57e8a20d8cc454a709bc5fcf20b459 | 3,473 | js | JavaScript | dist/components/SearchInput.js | OllieFordandCo/react-search-autocomplete | 199c06df3d481a499c231162e841c25e014f8ee2 | [
"MIT"
] | null | null | null | dist/components/SearchInput.js | OllieFordandCo/react-search-autocomplete | 199c06df3d481a499c231162e841c25e014f8ee2 | [
"MIT"
] | null | null | null | dist/components/SearchInput.js | OllieFordandCo/react-search-autocomplete | 199c06df3d481a499c231162e841c25e014f8ee2 | [
"MIT"
] | null | null | null | "use strict";function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=SearchInput;var _templateObject,_react=_interopRequireWildcard(require("react")),_propTypes=_interopRequireDefault(require("prop-types")),_SearchIcon=require("./SearchIcon"),_styledComponents=_interopRequireDefault(require("styled-components")),_ClearIcon=require("./ClearIcon");function _interopRequireDefault(a){return a&&a.__esModule?a:{default:a}}function _getRequireWildcardCache(a){if("function"!=typeof WeakMap)return null;var b=new WeakMap,c=new WeakMap;return(_getRequireWildcardCache=function(a){return a?c:b})(a)}function _interopRequireWildcard(a,b){if(!b&&a&&a.__esModule)return a;if(null===a||"object"!==_typeof(a)&&"function"!=typeof a)return{default:a};var c=_getRequireWildcardCache(b);if(c&&c.has(a))return c.get(a);var d={},e=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in a)if("default"!=f&&Object.prototype.hasOwnProperty.call(a,f)){var g=e?Object.getOwnPropertyDescriptor(a,f):null;g&&(g.get||g.set)?Object.defineProperty(d,f,g):d[f]=a[f]}return d.default=a,c&&c.set(a,d),d}function _taggedTemplateLiteral(a,b){return b||(b=a.slice(0)),Object.freeze(Object.defineProperties(a,{raw:{value:Object.freeze(b)}}))}function SearchInput(a){var b=a.searchString,c=a.setSearchString,d=a.autoFocus,e=a.onBlur,f=a.onFocus,g=a.onClear,h=a.placeholder,i=a.showIcon,j=a.showClear,k=(0,_react.useRef)(),l=!0;return _react.default.createElement(StyledSearchInput,null,_react.default.createElement(_SearchIcon.SearchIcon,{showIcon:i}),_react.default.createElement("input",{ref:k,spellCheck:!1,value:b,onInput:c,onBlur:e,onFocus:function(){l&&f()},placeholder:h,autoFocus:d}),_react.default.createElement(_ClearIcon.ClearIcon,{showClear:j,setSearchString:c,searchString:b,onClear:g,setFocus:function(){l=!1,k.current.focus(),l=!0}}))}SearchInput.defaultProps={showIcon:!0,showClear:!0},SearchInput.propTypes={searchString:_propTypes.default.string.isRequired,setSearchString:_propTypes.default.func.isRequired,autoFocus:_propTypes.default.bool,onBlur:_propTypes.default.func.isRequired,onFocus:_propTypes.default.func,onClear:_propTypes.default.func,placeholder:_propTypes.default.string,showIcon:_propTypes.default.bool,showClear:_propTypes.default.bool};var StyledSearchInput=_styledComponents.default.div(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n height: ",";\n width: 100%;\n\n display: flex;\n align-items: center;\n\n > input {\n width: 100%;\n\n padding: 0 0 0 13px;\n\n border: none;\n outline: none;\n\n background-color: rgba(0, 0, 0, 0);\n font-size: inherit;\n font-family: inherit;\n\n color: ",";\n\n ::placeholder {\n /* Chrome, Firefox, Opera, Safari 10.1+ */\n color: ",";\n opacity: 1; /* Firefox */\n }\n\n :-ms-input-placeholder {\n /* Internet Explorer 10-11 */\n color: ",";\n }\n\n ::-ms-input-placeholder {\n /* Microsoft Edge */\n color: ",";\n }\n }\n"])),function(a){return a.theme.height},function(a){return a.theme.color},function(a){return a.theme.placeholderColor},function(a){return a.theme.placeholderColor},function(a){return a.theme.placeholderColor}); | 3,473 | 3,473 | 0.75036 |
38caddb5c05571a7e40e426da9ed9393977de74b | 176 | js | JavaScript | 01-Variables-Data-Types-Basic-Operators/5-operators/logical.js | LukeSamkharadze/js-practices | 015637cde142b40909d36cd8fdbe45809f327115 | [
"MIT"
] | 1 | 2021-09-27T15:51:31.000Z | 2021-09-27T15:51:31.000Z | 01-Variables-Data-Types-Basic-Operators/5-operators/logical.js | LukeSamkharadze/js-practices | 015637cde142b40909d36cd8fdbe45809f327115 | [
"MIT"
] | null | null | null | 01-Variables-Data-Types-Basic-Operators/5-operators/logical.js | LukeSamkharadze/js-practices | 015637cde142b40909d36cd8fdbe45809f327115 | [
"MIT"
] | 1 | 2021-11-02T16:37:28.000Z | 2021-11-02T16:37:28.000Z | // && || ! | &
function Do() {
console.log('doing something');
return false;
}
if (true | Do()){
console.log('YES')
}
if (false & Do()){
console.log('YES')
} | 12.571429 | 35 | 0.5 |
38caef4ffbd66e57753c244da4a8e41b31a128a7 | 619 | js | JavaScript | build/translations/pl.js | SbYNH/ckeditor5-build-markdown | f8b866275660bf8bcf0ca5a4b73539c387b4a22d | [
"MIT"
] | null | null | null | build/translations/pl.js | SbYNH/ckeditor5-build-markdown | f8b866275660bf8bcf0ca5a4b73539c387b4a22d | [
"MIT"
] | null | null | null | build/translations/pl.js | SbYNH/ckeditor5-build-markdown | f8b866275660bf8bcf0ca5a4b73539c387b4a22d | [
"MIT"
] | null | null | null | (function(d){d['pl']=Object.assign(d['pl']||{},{a:"Pogrubienie",b:"Kursywa",c:"Wybierz nagłówek",d:"Nagłówek",e:"Wstaw odnośnik",f:"Akapit",g:"Nagłówek 1",h:"Nagłówek 2",i:"Nagłówek 3",j:"Nagłówek 4",k:"Nagłówek 5",l:"Nagłówek 6",m:"Otwórz w nowej zakładce",n:"Do pobrania",o:"Usuń odnośnik",p:"Edytuj odnośnik",q:"Otwórz odnośnik w nowym oknie",r:"Nie podano adresu URL odnośnika",s:"Cofnij",t:"Ponów",u:"Edytor tekstu sformatowanego, %0",v:"Edytor tekstu sformatowanego",w:"Zapisz",x:"Anuluj",y:"Adres URL",z:"%0 z %1",aa:"Poprzedni",ab:"Następny"})})(window.CKEDITOR_TRANSLATIONS||(window.CKEDITOR_TRANSLATIONS={})); | 619 | 619 | 0.705977 |
38cbfbfb4be1c4dfa8ef3fc8da6709afc4eec7b5 | 439 | js | JavaScript | test/689_maximum-sum-of-3-non-overlapping-subarrays.test.js | wayxzz/leet-code-questions | 275a3b5dfeef3078b258e89ca8b7396ab0eab02f | [
"MIT"
] | null | null | null | test/689_maximum-sum-of-3-non-overlapping-subarrays.test.js | wayxzz/leet-code-questions | 275a3b5dfeef3078b258e89ca8b7396ab0eab02f | [
"MIT"
] | null | null | null | test/689_maximum-sum-of-3-non-overlapping-subarrays.test.js | wayxzz/leet-code-questions | 275a3b5dfeef3078b258e89ca8b7396ab0eab02f | [
"MIT"
] | null | null | null | /*
*
* 给定数组 nums 由正整数组成,找到三个互不重叠的子数组的最大和。
*
* 每个子数组的长度为k,我们要使这3*k个项的和最大化。
*
* 返回每个区间起始索引的列表(索引从 0 开始)。如果有多个结果,返回字典序最小的一个。
*
* 示例:
*
*
* 输入: [1,2,1,2,6,7,5,1], 2
* 输出: [0, 3, 5]
* 解释: 子数组 [1, 2], [2, 6], [7, 5] 对应的起始索引为 [0, 3, 5]。
* 我们也可以取 [2, 1], 但是结果 [1, 3, 5] 在字典序上更大。
*
*
* 注意:
*
*
* nums.length的范围在[1, 20000]之间。
* nums[i]的范围在[1, 65535]之间。
* k的范围在[1, floor(nums.length / 3)]之间。
*
*
*
*/ | 16.259259 | 53 | 0.512528 |
38ccb7634deb70d85573544aef5899fe9b8bde9b | 694 | js | JavaScript | p5-projects/2.5.3 Rainbow Paintbrush/sketch.js | jht1493/p5js-repo | 587153d8362ddb489ad9a939b0e4788ebb9cd2e4 | [
"MIT"
] | null | null | null | p5-projects/2.5.3 Rainbow Paintbrush/sketch.js | jht1493/p5js-repo | 587153d8362ddb489ad9a939b0e4788ebb9cd2e4 | [
"MIT"
] | null | null | null | p5-projects/2.5.3 Rainbow Paintbrush/sketch.js | jht1493/p5js-repo | 587153d8362ddb489ad9a939b0e4788ebb9cd2e4 | [
"MIT"
] | null | null | null | let a_hue;
function setup() {
// createCanvas(windowWidth, windowHeight);
createCanvas(400, 200);
background(0);
a_hue = 0;
}
function draw() {
// background(220);
}
function mouseDragged() {
// if (a_hue > 360) {
// a_hue = 0;
// } else {
// a_hue += 10;
// }
a_hue = (a_hue + 10) % 360;
colorMode(HSL, 360);
noStroke();
fill(a_hue, 200, 200);
ellipse(mouseX, mouseY, 25, 25);
}
function keyPressed() {
if (keyCode == 82) {
a_hue = 0;
}
}
// https://editor.p5js.org/jht1493/sketches/9aYZcF6DM
// 2.5 Rainbow Paintbrush
// https://medium.com/@kellylougheed/rainbow-paintbrush-in-p5-js-e452d5540b25
// Rainbow Paintbrush in p5.js by Kelly Lougheed | 18.756757 | 77 | 0.626801 |
38ce39bc570bb41916a78bb19c1d5ab8b7e3b539 | 8,371 | js | JavaScript | src/Data/Characters/Qiqi/data.test.js | SohumB/genshin-optimizer | c8ef602fcee84418c0439dbcc212bc8969daf9ed | [
"MIT"
] | null | null | null | src/Data/Characters/Qiqi/data.test.js | SohumB/genshin-optimizer | c8ef602fcee84418c0439dbcc212bc8969daf9ed | [
"MIT"
] | null | null | null | src/Data/Characters/Qiqi/data.test.js | SohumB/genshin-optimizer | c8ef602fcee84418c0439dbcc212bc8969daf9ed | [
"MIT"
] | null | null | null | import formula from "./data"
import { applyArtifacts, computeAllStats, createProxiedStats } from "../TestUtils"
let setupStats = {}
// Discord ID: 822861794544582686
describe("Test Qiqi's formulas (Camelva#7085)", () => {
beforeEach(() => {
setupStats = createProxiedStats({
characterHP: 10050, characterATK: 580 - 347, characterDEF: 749,
characterEle: "cryo", characterLevel: 70,
weaponType: "sword", weaponATK: 347,
heal_: 16.6,
enemyLevel: 92, physical_enemyRes_: 70, // Ruin Guard
tlvl: Object.freeze({ auto: 1 - 1, skill: 5 - 1, burst: 6 - 1 }),
})
})
describe("with artifacts", () => {
beforeEach(() => applyArtifacts(setupStats, [
{ hp: 3967, critDMG_: 14.0, eleMas: 21, critRate_: 9.3, atk: 19, }, // Flower of Life
{ atk: 311, critRate_: 7.8, def: 53, atk_: 11.7, enerRech_: 4.5 }, // Plume of Death
{ atk_: 38.7, eleMas: 56, def: 42, hp_: 4.7, enerRech_: 6.5, }, // Sands of Eon
{ physical_dmg_: 58.3, enerRech_: 11.0, critRate_: 7.4, eleMas: 40, atk: 53, }, // Goblet of Eonothem
{ hp_: 7, atk_: 5.3, critDMG_: 7.0, enerRech_: 5.2, atk: 18, }, // Circlet of Logos
{ atk_: 18 }, // 2 Gladiator's Finale
]))
test("overall stats", () => {
const stats = computeAllStats(setupStats)
expect(stats.finalHP).toApproximate(15188)
expect(stats.finalATK).toApproximate(1407)
expect(stats.finalDEF).toApproximate(844)
expect(stats.eleMas).toApproximate(117)
expect(stats.critRate_).toApproximate(29.5)
expect(stats.critDMG_).toApproximate(71.0)
expect(stats.heal_).toApproximate(16.6)
expect(stats.physical_dmg_).toApproximate(58.3)
})
describe("no crit", () => {
beforeEach(() => setupStats.hitMode = "hit")
test("hits", () => {
const stats = computeAllStats(setupStats)
expect(formula.normal[0](stats)[0](stats)).toApproximate(118)
expect(formula.normal[1](stats)[0](stats)).toApproximate(121)
expect(formula.normal[2](stats)[0](stats)).toApproximate(75 * 2)
expect(formula.normal[3](stats)[0](stats)).toApproximate(77 * 2)
expect(formula.normal[4](stats)[0](stats)).toApproximate(197)
expect(formula.charged.hit(stats)[0](stats)).toApproximate(201)
expect(formula.skill.hit(stats)[0](stats)).toApproximate(756)
expect(formula.skill.herald(stats)[0](stats)).toApproximate(283)
expect(formula.skill.hitregen(stats)[0](stats)).toApproximate(343)
expect(formula.skill.continuousregen(stats)[0](stats)).toApproximate(2275)
expect(formula.burst.dmg(stats)[0](stats)).toApproximate(2371)
expect(formula.burst.healing(stats)[0](stats)).toApproximate(3133)
})
})
describe("crit", () => {
beforeEach(() => setupStats.hitMode = "critHit")
test("hits", () => {
const stats = computeAllStats(setupStats), { skill } = stats.tlvl
expect(formula.normal[0](stats)[0](stats)).toApproximate(202)
expect(formula.normal[1](stats)[0](stats)).toApproximate(208)
expect(formula.normal[2](stats)[0](stats)).toApproximate(129 * 2)
expect(formula.normal[3](stats)[0](stats)).toApproximate(132 * 2)
expect(formula.normal[4](stats)[0](stats)).toApproximate(338)
expect(formula.charged.hit(stats)[0](stats)).toApproximate(345)
expect(formula.skill.hit(stats)[0](stats)).toApproximate(1293)
expect(formula.skill.herald(stats)[0](stats)).toApproximate(485)
})
})
})
})
// Discord ID: 822576356146544691
describe("Test Qiqi's formulas (Arby3#1371)", () => {
beforeEach(() => {
setupStats = createProxiedStats({
characterHP: 10050, characterATK: 233, characterDEF: 749,
characterEle: "cryo", characterLevel: 70,
weaponType: "sword", weaponATK: 401,
healing_: 16.6, enerRech_: 100 + 55.9,
enemyLevel: 85, physical_enemyRes_: 70, // Ruin Guard
tlvl: Object.freeze({ auto: 6 - 1, skill: 6 - 1, burst: 9 - 1 }),
})
})
describe("with artifacts", () => {
beforeEach(() => applyArtifacts(setupStats, [
{ hp: 4780, enerRech_: 5.2, critRate_: 3.1, def_: 22.6, atk_: 13.4 }, // Flower of Life
{ atk: 311, critRate_: 6.6, critDMG_: 17.1, def_: 5.8, atk_: 11.7 }, // Plume of Death
{ atk_: 46.6, hp: 627, critDMG_: 14, atk: 35, critRate_: 3.1 }, // Sands of Eon
{ cryo_dmg_: 46.6, critDMG_: 15.5, eleMas: 19, atk: 47, critRate_: 7.4 }, // Goblet of Eonothem
{ critRate_: 31.1, def: 42, def_: 20.4, critDMG_: 17.9, atk_: 5.3 }, // Circlet of Logos
{ pyro_dmg_: 15 }, // 2 Crimson Witch of Flames
]))
test("overall stats", () => {
const stats = computeAllStats(setupStats)
expect(stats.finalHP).toApproximate(15457)
expect(stats.finalATK).toApproximate(1514)
expect(stats.finalDEF).toApproximate(1157)
expect(stats.eleMas).toApproximate(19)
expect(stats.critRate_).toApproximate(56.3)
expect(stats.critDMG_).toApproximate(114.5)
expect(stats.healing_).toApproximate(16.6)
})
describe("no crit", () => {
beforeEach(() => setupStats.hitMode = "hit")
test("hits", () => {
const stats = computeAllStats(setupStats)
expect(formula.normal[0](stats)[0](stats)).toApproximate(119)
expect(formula.normal[1](stats)[0](stats)).toApproximate(122)
expect(formula.normal[2](stats)[0](stats)).toApproximate(76 * 2)
expect(formula.normal[3](stats)[0](stats)).toApproximate(78 * 2)
expect(formula.normal[4](stats)[0](stats)).toApproximate(199)
expect(formula.charged.hit(stats)[0](stats)).toApproximate(203)
expect(formula.skill.hit(stats)[0](stats)).toApproximate(1285)
expect(formula.skill.herald(stats)[0](stats)).toApproximate(482)
})
})
describe("crit", () => {
beforeEach(() => setupStats.hitMode = "critHit")
test("hits", () => {
const stats = computeAllStats(setupStats)
expect(formula.normal[0](stats)[0](stats)).toApproximate(256)
expect(formula.normal[1](stats)[0](stats)).toApproximate(263)
expect(formula.normal[2](stats)[0](stats)).toApproximate(163 * 2)
expect(formula.normal[3](stats)[0](stats)).toApproximate(167 * 2)
expect(formula.normal[4](stats)[0](stats)).toApproximate(427)
expect(formula.charged.hit(stats)[0](stats)).toApproximate(436)
expect(formula.skill.hit(stats)[0](stats)).toApproximate(2757)
expect(formula.skill.herald(stats)[0](stats)).toApproximate(1034)
})
})
describe("C2", () => {
beforeEach(() => {
setupStats.normal_dmg_ += 15
setupStats.charged_dmg_ += 15
})
describe("no crit", () => {
beforeEach(() => setupStats.hitMode = "hit")
test("hits", () => {
const stats = computeAllStats(setupStats)
expect(formula.normal[0](stats)[0](stats)).toApproximate(137)
expect(formula.normal[1](stats)[0](stats)).toApproximate(141)
expect(formula.normal[2](stats)[0](stats)).toApproximate(87 * 2)
expect(formula.normal[3](stats)[0](stats)).toApproximate(89 * 2)
expect(formula.normal[4](stats)[0](stats)).toApproximate(229)
expect(formula.charged.hit(stats)[0](stats)).toApproximate(233)
expect(formula.skill.hit(stats)[0](stats)).toApproximate(1285)
expect(formula.skill.herald(stats)[0](stats)).toApproximate(482)
})
})
describe("crit", () => {
beforeEach(() => setupStats.hitMode = "critHit")
test("hits", () => {
const stats = computeAllStats(setupStats)
expect(formula.normal[0](stats)[0](stats)).toApproximate(294)
expect(formula.normal[1](stats)[0](stats)).toApproximate(303)
expect(formula.normal[2](stats)[0](stats)).toApproximate(188 * 2)
expect(formula.normal[3](stats)[0](stats)).toApproximate(192 * 2)
expect(formula.normal[4](stats)[0](stats)).toApproximate(491)
expect(formula.charged.hit(stats)[0](stats)).toApproximate(501)
expect(formula.skill.hit(stats)[0](stats)).toApproximate(2757)
expect(formula.skill.herald(stats)[0](stats)).toApproximate(1034)
expect(formula.burst.dmg(stats)[0](stats)).toApproximate(9934)
})
})
})
})
})
| 43.598958 | 107 | 0.624895 |
38ce6b6ec6dbd108eca04d95ce7920375615b43a | 184 | js | JavaScript | src/store/configureStore.js | sylvaindethier/redux-todomvc | 4a3bcd30c3f65768eb3421c48d5d660e25abb042 | [
"MIT"
] | null | null | null | src/store/configureStore.js | sylvaindethier/redux-todomvc | 4a3bcd30c3f65768eb3421c48d5d660e25abb042 | [
"MIT"
] | null | null | null | src/store/configureStore.js | sylvaindethier/redux-todomvc | 4a3bcd30c3f65768eb3421c48d5d660e25abb042 | [
"MIT"
] | null | null | null | // export configureStore
const suffix = process.env.NODE_ENV === 'production' ? '.prod' : '.dev';
module.exports = require('./configureStore' + suffix);
export default module.exports;
| 36.8 | 72 | 0.717391 |
38d48a472e9973fc0dec1ff317585add0bd230c4 | 306 | js | JavaScript | server/handlers/index.js | Ericchow97/giftit | f733a576229c43e3783bc44f3becfc39178d86f8 | [
"MIT"
] | null | null | null | server/handlers/index.js | Ericchow97/giftit | f733a576229c43e3783bc44f3becfc39178d86f8 | [
"MIT"
] | null | null | null | server/handlers/index.js | Ericchow97/giftit | f733a576229c43e3783bc44f3becfc39178d86f8 | [
"MIT"
] | null | null | null | import { createClient } from "./client";
import { getOneTimeUrl } from "./mutations/get-one-time-url";
import { getSubscriptionUrl } from "./mutations/get-subscription-url";
import * as giftitFunctions from "./giftit-functions"
export { createClient, getOneTimeUrl, getSubscriptionUrl, giftitFunctions };
| 43.714286 | 76 | 0.764706 |
38d5332d1e810476e8d5551a24420fe10bbd18f2 | 1,354 | js | JavaScript | src/components/search/SearchPage.js | ajames72/MovieDBReact | 7bbe24f9c6e87c64a7d5c71768eedfd2ed1c3d06 | [
"MIT"
] | null | null | null | src/components/search/SearchPage.js | ajames72/MovieDBReact | 7bbe24f9c6e87c64a7d5c71768eedfd2ed1c3d06 | [
"MIT"
] | null | null | null | src/components/search/SearchPage.js | ajames72/MovieDBReact | 7bbe24f9c6e87c64a7d5c71768eedfd2ed1c3d06 | [
"MIT"
] | null | null | null | /**
* @file SearchPage component
* @description Higer Order Component for Search landing pages
* @author Andrew James
* @version 0.1
*/
import React, {PropTypes} from 'react';
import Search from '../common/search/Search';
import Results from '../results/Results';
export default function SearchPage() {
class SearchComponent extends React.Component {
constructor(props) {
super(props);
this.sectionTitle;
this.path;
}
componentDidMount() {
this.props.clearSearchResults();
//The properties are going to be displayed in more than 1 component
//so we'll have to call an action to set the attributes
this.props.setSectionAttributes({'title': this.props.sectionTitle, 'section': this.props.path});
}
render() {
const {searchAction} = this.props;
return (
<div className="row">
<div className="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<Search search={searchAction}/>
<Results />
</div>
</div>
);
}
}
SearchComponent.propTypes = {
searchAction: PropTypes.func.isRequired,
clearSearchResults: PropTypes.func.isRequired,
setSectionAttributes: PropTypes.func.isRequired,
sectionTitle: PropTypes.string.isRequired,
path: PropTypes.string.isRequired
};
return SearchComponent;
}
| 26.038462 | 102 | 0.65805 |
38d6038cdafd007c7659a499083e429dfe810723 | 910 | js | JavaScript | src/components/Home/Home.js | ks093/frappe-react-example | 90401330c6b92368e0e11d67157b985917daedc3 | [
"MIT"
] | null | null | null | src/components/Home/Home.js | ks093/frappe-react-example | 90401330c6b92368e0e11d67157b985917daedc3 | [
"MIT"
] | null | null | null | src/components/Home/Home.js | ks093/frappe-react-example | 90401330c6b92368e0e11d67157b985917daedc3 | [
"MIT"
] | null | null | null | import React,{ useState } from 'react';
import { withRouter } from 'react-router-dom';
import { API_BASE_URL } from '../../constants/apiConstants';
function Home(props) {
const [state , setState] = useState({
response: null
})
let myHeaders = new Headers();
myHeaders.append("Authorization", `Bearer ${localStorage.getItem('accessToken')}`);
let requestOptions = {
method: 'GET',
headers: myHeaders,
};
if(!state.response){
fetch(`${API_BASE_URL}/api/resource/User/${localStorage.getItem('email')}`, requestOptions)
.then(res => res.json())
.then(function (response) {
console.log(response);
})
.catch(function (error) {
console.log(error);
});
}
return(
<div className="mt-2">
Home page content
</div>
)
}
export default withRouter(Home); | 27.575758 | 99 | 0.575824 |
38d8a8c718a31143ae0679714e7dc4250b5a76a7 | 857 | js | JavaScript | webpack.config.js | STDSuperman/RxJS-Learn | 1a1db8ba4cec0802d39a25354f9f4489c33ec18a | [
"MIT"
] | null | null | null | webpack.config.js | STDSuperman/RxJS-Learn | 1a1db8ba4cec0802d39a25354f9f4489c33ec18a | [
"MIT"
] | null | null | null | webpack.config.js | STDSuperman/RxJS-Learn | 1a1db8ba4cec0802d39a25354f9f4489c33ec18a | [
"MIT"
] | null | null | null | const path = require('path');
const webpack = require('webpack')
const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
mode: 'development',
entry: {
index: ['webpack-hot-middleware/client?http://localhost:3000', path.resolve(__dirname, 'src/index.ts')]
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'build'),
publicPath: '/build/'
},
devtool: 'source-map',
module: {
rules: [
{
test: /\.ts$/,
enforce: 'pre',
use: ['ts-loader', 'tslint-loader']
}
]
},
plugins: [new webpack.HotModuleReplacementPlugin(), new webpack.NoEmitOnErrorsPlugin(), new HtmlWebpackPlugin({
title: 'Hello RxJS'
})],
resolve: {
extensions: ['.ts', '.js']
}
} | 27.645161 | 115 | 0.537923 |
38d9107c7101251bf572aa18035713bb23c9022e | 3,137 | js | JavaScript | frontend/src/components/Modals/CreateGameModal.js | ScoTonyField/Kahoo-liked-app | db7f52ac1da49631655338fb83fe121287d04634 | [
"MIT"
] | null | null | null | frontend/src/components/Modals/CreateGameModal.js | ScoTonyField/Kahoo-liked-app | db7f52ac1da49631655338fb83fe121287d04634 | [
"MIT"
] | null | null | null | frontend/src/components/Modals/CreateGameModal.js | ScoTonyField/Kahoo-liked-app | db7f52ac1da49631655338fb83fe121287d04634 | [
"MIT"
] | null | null | null | import React from 'react';
import {
Button,
TextField,
Dialog,
DialogActions,
DialogContent,
DialogContentText,
DialogTitle
} from '@material-ui/core';
import { useTheme } from '@material-ui/core/styles';
import PropTypes from 'prop-types';
import makeAPIRequest from '../../Api';
import useMediaQuery from '@material-ui/core/useMediaQuery';
const CreateGameModal = ({ games, setGames }) => {
const [open, setOpen] = React.useState(false);
const [name, setName] = React.useState('');
const [errorText, setErrorText] = React.useState();
const theme = useTheme();
const fullScreen = useMediaQuery(theme.breakpoints.down('sm'));
// Handler for opening the 'create new game' modal
const handleClickOpen = () => {
setErrorText();
setOpen(true);
};
// Handler for closing the 'create new game' modal
const handleClose = () => {
setOpen(false);
};
// Handler for submitting the name to the new game
const handleSubmit = () => {
// Empty name is not allowed
if (!name) {
setErrorText('Quiz name cannot be empty.')
} else {
createNewGame(name);
setOpen(false);
}
}
const createNewGame = (value) => {
const body = JSON.stringify({
name: value
})
makeAPIRequest('admin/quiz/new', 'POST', localStorage.getItem('token'), null, body)
.then((res) => {
alert('Successfully create a new quiz!');
return res;
}).then((res) => setGames([...games, parseInt(res.quizId)])
).catch(err => {
const errMsg = 'ERROR: Fail to create new quiz: ';
if (err.status === 400) {
alert(errMsg + 'Invalid input');
} else if (err.status === 403) {
alert(errMsg + 'Invalid token');
} else {
alert(errMsg + err);
}
});
}
return (
<div>
<Button
onClick={handleClickOpen}
variant="outlined"
color="primary"
>
Create a new quiz
</Button>
{/* XXX: accessibility: labelledby: https://material-ui.com/zh/components/modal/ */}
<Dialog
open={open}
onClose={handleClose}
fullScreen={fullScreen}
aria-labelledby="create-new-quiz-title"
>
<DialogTitle id="create-new-quiz-title">Create a new quiz</DialogTitle>
<DialogContent>
<DialogContentText>
To make a new quiz, please enter the name of the new game.
</DialogContentText>
<TextField
autoFocus
required
label="Quiz Name"
fullWidth
error={Boolean(errorText)}
helperText={errorText}
onChange={e => setName(e.target.value)}
/>
</DialogContent>
<DialogActions>
<Button onClick={handleClose} color="primary">
Cancel
</Button>
<Button onClick={handleSubmit} color="primary">
Confirm
</Button>
</DialogActions>
</Dialog>
</div>
);
}
CreateGameModal.propTypes = {
setGames: PropTypes.func,
games: PropTypes.array,
};
export default CreateGameModal;
| 27.043103 | 92 | 0.58336 |
38da5c18a4f860993bc22ccd05f420b9fb4b3b1b | 86 | js | JavaScript | gulpfile.babel.js | rthor/blai-naglinn | 1bf698023fe41dedd0b5f3a4326669dfb64bd845 | [
"Unlicense",
"MIT"
] | null | null | null | gulpfile.babel.js | rthor/blai-naglinn | 1bf698023fe41dedd0b5f3a4326669dfb64bd845 | [
"Unlicense",
"MIT"
] | null | null | null | gulpfile.babel.js | rthor/blai-naglinn | 1bf698023fe41dedd0b5f3a4326669dfb64bd845 | [
"Unlicense",
"MIT"
] | null | null | null | import {sync} from 'glob';
sync('./gulp/tasks/*.js').forEach(task => require(task));
| 21.5 | 57 | 0.639535 |
38dc66b46f0d054437dfc81757ca41e82150ddd2 | 448 | js | JavaScript | _components/src/stories/Banners/index.js | blairanderson/tachyonstemplates | 35d554476567c35371fa343e93455a56c860f617 | [
"CC-BY-3.0"
] | 21 | 2017-11-24T02:37:50.000Z | 2020-08-28T16:36:39.000Z | _components/src/stories/Banners/index.js | blairanderson/tachyonstemplates | 35d554476567c35371fa343e93455a56c860f617 | [
"CC-BY-3.0"
] | 14 | 2017-07-27T21:33:33.000Z | 2022-03-08T22:39:44.000Z | _components/src/stories/Banners/index.js | blairanderson/tachyonstemplates | 35d554476567c35371fa343e93455a56c860f617 | [
"CC-BY-3.0"
] | 7 | 2017-10-27T06:48:21.000Z | 2021-11-06T03:23:09.000Z | /* eslint-disable import/no-extraneous-dependencies, import/no-unresolved, import/extensions */
import React from 'react';
import { storiesOf } from '@storybook/react';
import Basic from './Basic.js';
import Info from './Info.js';
import SingleCta from './SingleCta.js';
storiesOf('Banners')
.addWithInfo('Basic', Basic, { inline: true })
.addWithInfo('Info', Info, { inline: true })
.addWithInfo('Singlecta', SingleCta, { inline: true });
| 34.461538 | 95 | 0.707589 |
38de14bf89a8411229058d6d91d7cac54177208b | 426 | js | JavaScript | src/components/EmptyFavoritesMoviesList/index.js | eltonlazzarin/movies-react-app | ce58b16d41145fbfd7cf9ed7326aff01596471f0 | [
"MIT"
] | null | null | null | src/components/EmptyFavoritesMoviesList/index.js | eltonlazzarin/movies-react-app | ce58b16d41145fbfd7cf9ed7326aff01596471f0 | [
"MIT"
] | null | null | null | src/components/EmptyFavoritesMoviesList/index.js | eltonlazzarin/movies-react-app | ce58b16d41145fbfd7cf9ed7326aff01596471f0 | [
"MIT"
] | null | null | null | import React from 'react';
import { Link } from 'react-router-dom';
import logo from '../../assets/logo.png';
import { Container } from './styles';
export default function EmptyFavoritesMoviesList() {
return (
<Container>
<span>
<img src={logo} alt="Movie Logo" />
<h4>No favorites movies to show</h4>
<Link to="/">Search and favorite movies</Link>
</span>
</Container>
);
}
| 22.421053 | 54 | 0.607981 |
385c695c141618e7e2a59d547a29c97ca5ec97f7 | 894 | js | JavaScript | scripts/module.js | bwakeland/PF2E-Combat-Automation | 00d83a524f15229c61f5d4a6f579e4c469ac7d49 | [
"MIT"
] | null | null | null | scripts/module.js | bwakeland/PF2E-Combat-Automation | 00d83a524f15229c61f5d4a6f579e4c469ac7d49 | [
"MIT"
] | 1 | 2021-06-01T07:12:58.000Z | 2021-06-01T07:12:58.000Z | scripts/module.js | bwakeland/PF2E-Combat-Automation | 00d83a524f15229c61f5d4a6f579e4c469ac7d49 | [
"MIT"
] | null | null | null | import {parseAttack} from "./lib/parse-attack.js";
import {xpPopup} from "./lib/xp-popup.js";
import {vexingTumble} from "./lib/vexing-tumble.js";
import {parseSkill} from "./lib/parse-skill.js";
Hooks.once('init', async function () {
});
Hooks.once('ready', async function () {
game['PF2ECombatAutomation'] = {
xpPopup: xpPopup,
vexingTumble: vexingTumble,
}
});
Hooks.on("createChatMessage", (message) => {
if ((message.data.flags.pf2e != null) && (message.data.flags.pf2e.context != null)) {
if (((message.data.flags.pf2e.context.type === "spell-attack-roll") ||
(message.data.flags.pf2e.context.type === "attack-roll")) &&
game.user.isGM) {
parseAttack(message);
} else if (((message.data.flags.pf2e.context.type === "skill-check") && game.user.isGM)) {
parseSkill(message);
}
}
}); | 33.111111 | 98 | 0.60179 |