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
9963bec0b3b7ed6fbccb4ed07d20e09d4d9d7ac2
472
js
JavaScript
src/renderer/components/ExternalLinkButton.js
pitpite/ledger-live-desktop
e7c6f16a5ff31971665a6510104a4ce8ba5c8ad6
[ "MIT" ]
1,003
2018-04-30T14:59:56.000Z
2022-03-29T22:21:50.000Z
src/renderer/components/ExternalLinkButton.js
pitpite/ledger-live-desktop
e7c6f16a5ff31971665a6510104a4ce8ba5c8ad6
[ "MIT" ]
2,540
2018-04-20T09:59:28.000Z
2022-03-31T16:44:52.000Z
src/renderer/components/ExternalLinkButton.js
JunichiSugiura/ledger-live-desktop
d9eeca50b22777f412036ec85a121d5fced9aae0
[ "MIT" ]
354
2018-04-20T14:59:59.000Z
2022-03-27T14:57:37.000Z
// @flow import React from "react"; import { openURL } from "~/renderer/linking"; import Button from "~/renderer/components/Button"; import type { Props as ButtonProps } from "~/renderer/components/Button"; export function ExternalLinkButton({ label, url, ...props }: { ...ButtonProps, label: React$Node, url: string, }) { return ( <Button onClick={() => openURL(url)} {...props}> {label} </Button> ); } export default ExternalLinkButton;
18.88
73
0.650424
9963fbd17206b25288f6033acd3f4b7480de1a72
1,843
js
JavaScript
packages/notion/lib/notion.js
Tomyail/omnifocus-extension
5d6a6b6734e5884493fd5f600bfb682b2d2ada58
[ "MIT" ]
1
2021-05-27T04:56:58.000Z
2021-05-27T04:56:58.000Z
packages/notion/lib/notion.js
Tomyail/omnifocus-extension
5d6a6b6734e5884493fd5f600bfb682b2d2ada58
[ "MIT" ]
4
2020-05-26T14:35:12.000Z
2021-10-19T00:31:51.000Z
packages/notion/lib/notion.js
Tomyail/omnifocus-extension
5d6a6b6734e5884493fd5f600bfb682b2d2ada58
[ "MIT" ]
null
null
null
const { Client } = require("@notionhq/client"); const { get, kebabCase } = require("lodash"); // Initializing a client const notion = new Client({ auth: process.env.NOTION_TOKEN, }); const getLink = (title, id) => { //其实有没有 title 都生效 if (title) { const kebabTitle = kebabCase(title.replace(/[^a-zA-Z-\/:]/g, "")); if (kebabTitle.length) { return `${kebabTitle}-${id.replace(/-/g, "")}`; } return id.replace(/-/g, ""); } return id.replace(/-/g, ""); }; (async () => { const listUsersResponse = await notion.users.list(); const user = listUsersResponse.results.find((user) => user.type === "person"); console.log(user); const userId = "tomyail"; //when searchResult not include the database you expected, make sure the api bot you made have the permission to access it const searchResult = await notion.search({ filter: { value: "database", property: "object" }, page_size: 100, }); const nestResult = await Promise.all( searchResult.results.map(async (res) => { const pages = await notion.databases.query({ database_id: res.id }); debugger; return { id: res.id, createAt: res.created_time, updateAt: res.last_edited_time, title: get(res, "title[0].plain_text"), pages: pages.results.map((page) => { const title = get(page, "properties.Name.title[0].plain_text"); return { title: title, id: page.id, createAt: page.created_time, updateAt: page.last_edited_time, archived: page.archived, link: `https://www.notion.so/${userId}/${getLink(title, page.id)}`, }; }), }; }) ); console.log(nestResult); console.log(nestResult[0].pages); // console.log(JSON.stringify(searchResult,null,2)); })();
29.253968
124
0.597396
9964b8a4d9d91fc3617d94d8e65d97587766b6d5
1,400
js
JavaScript
test/index.js
onebytecode/musicConnects-web
fd562c27c140eabea1b42818f17d7effcbc30bdf
[ "Apache-2.0" ]
null
null
null
test/index.js
onebytecode/musicConnects-web
fd562c27c140eabea1b42818f17d7effcbc30bdf
[ "Apache-2.0" ]
null
null
null
test/index.js
onebytecode/musicConnects-web
fd562c27c140eabea1b42818f17d7effcbc30bdf
[ "Apache-2.0" ]
null
null
null
const server = require('../server') const models = server.models const controllers = server.controllers const db = server.db const config = server.config const chai = require('chai') const chai_http = require('chai-http') const should = chai.should() const expect = chai.expect const assert = chai.assert const Promise = require('bluebird') const drop_db = require('../scripts/drop_db') const seed = require('../scripts/seed') chai.use(chai_http) describe('Testing config', () => { require('./config')(config, expect) }) describe('Testing Routes', () => { require('./routes')(server, chai, should, expect, config) }) describe('Testing db', () => { require('./db')(db, should) }) describe('Testing models', () => { require('./models')(db, expect, should) after(async () => { await drop_db(db.mongoose, { silent: true }) }) }) describe('Testing controllers', () => { require('./controllers')(controllers, db.mongoose, should, expect) after( async () => { await drop_db(db.mongoose, { silent: true }) }) }) describe('Testing graphql', () => { before (async () => { await seed(db.mongoose, { silent: true, amount: { bands: 10, users: 10, artists: 10 } }) }) require('./graphql')(server, chai, expect, assert) after (async () => { await drop_db(db.mongoose, { silent: true }) }) })
29.166667
92
0.609286
9964c7e966e9cf42888bd6760b6fc00ae6190e62
2,254
js
JavaScript
src/templates/index-page/index-hero.js
dfuruya/gatsby-starter-netlify-cms
6714297f521b1394f5f2ec04482ff13f7e042bc5
[ "MIT" ]
null
null
null
src/templates/index-page/index-hero.js
dfuruya/gatsby-starter-netlify-cms
6714297f521b1394f5f2ec04482ff13f7e042bc5
[ "MIT" ]
null
null
null
src/templates/index-page/index-hero.js
dfuruya/gatsby-starter-netlify-cms
6714297f521b1394f5f2ec04482ff13f7e042bc5
[ "MIT" ]
null
null
null
import React from 'react'; // import PropTypes from 'prop-types'; const IndexHero = ({ image, title, subheading, }) => { return ( <div className="full-width-image margin-top-0" style={{ backgroundImage: `url(${!!image.childImageSharp ? image.childImageSharp.fluid.src : image })`, backgroundPosition: `top left`, backgroundAttachment: `fixed`, }} > <div style={{ display: 'flex', height: '150px', lineHeight: '1', justifyContent: 'space-around', alignItems: 'left', flexDirection: 'column', }} > <h1 className="has-text-weight-bold is-size-3-mobile is-size-2-tablet is-size-1-widescreen" style={{ boxShadow: 'rgb(255, 68, 0) 0.5rem 0px 0px, rgb(255, 68, 0) -0.5rem 0px 0px', backgroundColor: 'rgb(255, 68, 0)', color: 'white', lineHeight: '1', padding: '0.25em', }} > {title} </h1> <h3 className="has-text-weight-bold is-size-5-mobile is-size-5-tablet is-size-4-widescreen" style={{ boxShadow: 'rgb(255, 68, 0) 0.5rem 0px 0px, rgb(255, 68, 0) -0.5rem 0px 0px', backgroundColor: 'rgb(255, 68, 0)', color: 'white', lineHeight: '1', padding: '0.25em', }} > {subheading} </h3> </div> </div> ) } // IndexHero.propTypes = { // someObjc: PropTypes.object, // someNumb: PropTypes.number, // someBool: PropTypes.bool, // someArry: PropTypes.array, // someFunc: PropTypes.func.isRequired, // children: PropTypes.node, // }; export default IndexHero
32.2
107
0.40772
9964fd1e3eab4c07e1d4ebc5d3c0d2175cc726b9
736
js
JavaScript
fp-class/natural/1.js
tarasowski/frontend-masters-functional-js-brain
0a329288fde7154ebd1220fd00c84fa46f507007
[ "MIT" ]
1
2020-03-21T07:48:50.000Z
2020-03-21T07:48:50.000Z
fp-class/natural/1.js
tarasowski/functional-js-2020
0a329288fde7154ebd1220fd00c84fa46f507007
[ "MIT" ]
5
2021-03-10T13:54:55.000Z
2022-02-13T10:19:09.000Z
fp-class/natural/1.js
tarasowski/frontend-masters-functional-js-brain
0a329288fde7154ebd1220fd00c84fa46f507007
[ "MIT" ]
null
null
null
const { Right, Left } = require('../either') const Box = require('../box') const Task = require('data.task') // nt(a.map(f)) == nt(a).map(f) const eitherToTask = e => e.fold(Task.rejected, Task.of) const fake = id => ({id: id, name: 'user1', best_friend_id: id + 1}) const Db = ({ find: id => new Task((rej, res) => setTimeout(() => res(id > 2 ? Right(fake(id)) : Left('not found')), 100)) }) const send = (code, json) => console.log(`sending ${code}: ${JSON.stringify(json)}`) Db.find(1) .chain(eu => eu.fold(e => Task.of(eu), u => Db.find(u.best_friend_id))) .fork(error => send(500, {error}), eu => eu.fold(error => send(404, {error}), x => send(200, x)))
24.533333
58
0.535326
9964fe54deb576b56ae1bab81fbc7958c8cb0fd3
13,093
js
JavaScript
src/sap.ui.core/test/testsuite/js/testfwk.js
Etignis/openui5
b9ed6bd2f685e669c1fb67d33fe3b9438d674fbf
[ "Apache-2.0" ]
1
2022-02-02T01:39:20.000Z
2022-02-02T01:39:20.000Z
src/sap.ui.core/test/testsuite/js/testfwk.js
Etignis/openui5
b9ed6bd2f685e669c1fb67d33fe3b9438d674fbf
[ "Apache-2.0" ]
null
null
null
src/sap.ui.core/test/testsuite/js/testfwk.js
Etignis/openui5
b9ed6bd2f685e669c1fb67d33fe3b9438d674fbf
[ "Apache-2.0" ]
1
2022-02-02T01:39:21.000Z
2022-02-02T01:39:21.000Z
/*! * ${copyright} */ // Provides helper functions for the testsuite jQuery.sap.declare("testsuite.js.testfwk", false); function setCookie(name,value,days) { var expires = ""; if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); expires = "; expires="+date.toGMTString(); } document.cookie = name+"="+value+expires+"; path=/"; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') { c = c.substring(1,c.length); } if (c.indexOf(nameEQ) == 0) { return c.substring(nameEQ.length,c.length); } } return null; } function eraseCookie(name) { setCookie(name,"",-1); } if ( !window.sap ) { sap = {}; } if ( !sap.ui ) { sap.ui = {}; } if ( !sap.ui.testfwk ) { sap.ui.testfwk = {}; } sap.ui.testfwk.TestFWK = { sLanguage : (navigator.languages && navigator.languages[0]) || navigator.language || navigator.userLanguage, sTheme : "sap_belize", bContrastMode: false, bRTL : false, bAccessibilityMode: true, bSimulateTouch: false }; sap.ui.testfwk.TestFWK.LANGUAGES = { "en_US" : "English (US)", "de" : "Deutsch" }; sap.ui.testfwk.TestFWK.THEMES = { "base" : "Base", "sap_belize" : "Belize", "sap_belize_plus" : "Belize Plus", "sap_belize_hcb" : "Belize High Contrast Black", "sap_belize_hcw" : "Belize High Contrast White", "sap_bluecrystal" : "Blue Crystal", "sap_goldreflection" : "Gold Reflection", "sap_hcb" : "High Contrast Black", "sap_platinum" : "Platinum", "sap_ux" : "Ux Target Design", "edding" : "Edding (EXPERIMENTAL!)" }; // the themes supported by each library sap.ui.testfwk.TestFWK.LIBRARY_THEMES = { "sap.m" : {"default":"sap_belize", "supports":["sap_bluecrystal","sap_belize","sap_belize_plus","sap_belize_hcb","sap_belize_hcw","sap_hcb"]}, "sap.me" : {"default":"sap_belize", "supports":["sap_bluecrystal","sap_hcb"]}, "sap.service.visualization" : {"default":"sap_bluecrystal", "supports":["sap_bluecrystal","sap_goldreflection","sap_hcb","sap_platinum"]}, "sap.ui.commons" : {"default":"sap_bluecrystal", "supports":["sap_bluecrystal","sap_goldreflection","sap_hcb","sap_platinum","sap_ux","edding"]}, "sap.ui.composite" : {"default":"sap_bluecrystal", "supports":["sap_bluecrystal","sap_goldreflection","sap_hcb","sap_platinum","sap_ux","edding"]}, "sap.ui.dev" : {"default":"sap_bluecrystal", "supports":["sap_bluecrystal","sap_goldreflection","sap_hcb","sap_platinum","sap_ux","edding"]}, "sap.ui.richtexteditor" : {"default":"sap_bluecrystal", "supports":["sap_bluecrystal","sap_goldreflection","sap_hcb","sap_platinum","sap_ux","edding"]}, "sap.ui.suite" : {"default":"sap_goldreflection", "supports":["sap_goldreflection","sap_hcb","sap_bluecrystal"]}, "sap.ui.ux3" : {"default":"sap_bluecrystal", "supports":["sap_bluecrystal","sap_goldreflection","sap_hcb"]}, "all" : {"default":"sap_belize", "supports":["sap_bluecrystal","sap_belize","sap_belize_plus","sap_belize_hcb","sap_belize_hcw","sap_goldreflection","sap_hcb","sap_platinum","sap_ux","edding"]} }; sap.ui.testfwk.TestFWK.init = function(oContentWindow) { this.oContentWindow = oContentWindow; this.oThemeConstraints = null; this.updateContent(); }; sap.ui.testfwk.TestFWK.getAllowedThemes = function() { if (!this.oThemeConstraints) { return this.THEMES; } else { var result = {}; var aThemeNames = this.oThemeConstraints.supports, l = aThemeNames.length; for (var i = 0; i < l; i++) { result[aThemeNames[i]] = this.THEMES[aThemeNames[i]]; } return result; } }; sap.ui.testfwk.TestFWK.getContentURL = function() { return this.sContentURL; }; /** * Sets a new URL as content, using the current settings, but considering the given constraints for the theme. * If this causes a theme change, the themeConfigurationChanged event will be fired. * * @private * * @param sURL * @param oThemeConstraints optional * @param sLibName optional * @returns {sap.ui.testfwk.TestFWK.setContentURL} */ sap.ui.testfwk.TestFWK.setContentURL = function(sURL, oThemeConstraints, sLibName) { this.sContentURL = sURL; var newTheme = this.getEffectiveTheme(this.sTheme, oThemeConstraints); var bSomethingChanged = false; if (this.sTheme !== newTheme) { this.sTheme = newTheme; bSomethingChanged = true; } if (!jQuery.sap.equal(oThemeConstraints, this.oThemeConstraints)) { this.oThemeConstraints = oThemeConstraints; bSomethingChanged = true; } // update settings ComboBox and selection in this ComboBox if (bSomethingChanged) { this.fireThemeConfigurationChanged(); } this.updateContent(sLibName); }; /** * Updates the content according to the current settings * * @private * * @param sLibName optional */ sap.ui.testfwk.TestFWK.updateContent = function(sLibName) { if ( !this.oContentWindow || !this.sContentURL ) { return; } this.fireContentWillChange(sLibName); var sURL = this.addSettingsToURL(this.sContentURL); this.oContentWindow.document.location.href = sURL; }; sap.ui.testfwk.TestFWK.getLanguage = function() { return this.sLanguage; }; sap.ui.testfwk.TestFWK.setLanguage = function(sLanguage) { if ( this.sLanguage !== sLanguage ) { this.sLanguage = sLanguage; this.applySettings(); } }; sap.ui.testfwk.TestFWK.getTheme = function() { return this.sTheme; }; sap.ui.testfwk.TestFWK.setTheme = function(sTheme) { if ( this.sTheme !== sTheme ) { this.sTheme = sTheme; if ( this.oContentWindow && this.oContentWindow.sap && this.oContentWindow.sap.ui && this.oContentWindow.sap.ui.getCore ) { this.oContentWindow.sap.ui.getCore().applyTheme(sTheme); return; } this.applySettings(); } }; sap.ui.testfwk.TestFWK.getRTL = function() { return this.bRTL; }; sap.ui.testfwk.TestFWK.setRTL = function(bRTL) { if ( this.bRTL !== bRTL ) { this.bRTL = bRTL; this.applySettings(); } }; sap.ui.testfwk.TestFWK.getAccessibilityMode = function() { return this.bAccessibilityMode; }; sap.ui.testfwk.TestFWK.setAccessibilityMode = function(bAccessibilityMode) { if ( this.bAccessibilityMode !== bAccessibilityMode ) { this.bAccessibilityMode = bAccessibilityMode; this.applySettings(); } }; sap.ui.testfwk.TestFWK.getSimulateTouch = function() { return this.bSimulateTouch; }; sap.ui.testfwk.TestFWK.setSimulateTouch = function(bSimulateTouch) { if ( this.bSimulateTouch !== bSimulateTouch ) { this.bSimulateTouch = bSimulateTouch; this.applySettings(); } }; sap.ui.testfwk.TestFWK.getContrastMode = function() { return this.bContrastMode; }; sap.ui.testfwk.TestFWK.setContrastMode = function(bContrastMode) { if ( this.bContrastMode !== bContrastMode ) { var frameDocument = $('frame[name="sap-ui-ContentWindow"]'); var frameDocumentBody = frameDocument.contents().find("body"); frameDocumentBody.removeClass("sapContrast"); frameDocumentBody.removeClass("sapContrastPlus"); if (this.sTheme == "sap_belize" && bContrastMode) { frameDocumentBody.addClass("sapContrast"); } else if (this.sTheme == "sap_belize_plus" && bContrastMode) { frameDocumentBody.addClass("sapContrastPlus"); } this.bContrastMode = bContrastMode; } }; /** * Returns the appropriate theme, considering the requested theme and the configuration of allowed themes. * If allowed, the requested theme will be returned, otherwise the default theme will be returned. * If either parameter is null, the other will be returned; if both are null, null will be returned. * * @private * @param sRequestedTheme * @param oThemeConstraints * @returns */ sap.ui.testfwk.TestFWK.getEffectiveTheme = function(sRequestedTheme, oThemeConstraints) { if (sRequestedTheme) { // let's check whether this theme is okay if (oThemeConstraints) { for (var i = 0; i < oThemeConstraints.supports.length; i++) { if (oThemeConstraints.supports[i] === sRequestedTheme) { // theme is among the allowed ones, so return it return sRequestedTheme; } } return oThemeConstraints["default"]; // requested theme is not allowed, return the default one } else { return sRequestedTheme; // no constraints configuration given, so it's okay to use the requested theme } } else { // no theme requested: return the default from the configuration, if available return oThemeConstraints ? oThemeConstraints["default"] : null; } }; sap.ui.testfwk.TestFWK.applySettings = function() { this.fireSettingsChanged(); this.updateContent(); }; sap.ui.testfwk.TestFWK.addSettingsToURL = function(sURL, oThemeConstraints) { // hash rewriting currently doesn't work with webkit browsers and framesets if ( !sap.ui.Device.browser.webkit ) { top.window.location.hash = sURL.replace(/\?/g, "_"); } function add(sParam, vValue) { if (sURL.indexOf("?")!=-1) { sURL += "&"; } else { sURL += "?"; } sURL += sParam + "=" + vValue; } add("sap-ui-debug", true); if ( this.sLanguage ) { add("sap-ui-language", this.sLanguage); } var theme = this.getEffectiveTheme(this.sTheme, oThemeConstraints); if ( theme ) { add("sap-ui-theme", theme); } if ( this.bRTL ) { add("sap-ui-rtl", this.bRTL); } if ( this.bSimulateTouch ) { add("sap-ui-xx-test-mobile", this.bSimulateTouch); } add("sap-ui-accessibility", this.bAccessibilityMode); return sURL; }; sap.ui.testfwk.TestFWK.onContentLoad = function() { // this.injectDebug(); }; //// if not present, adds the debug.js script to the content page and initializes the debug mode in core //sap.ui.testfwk.TestFWK.injectDebug = function() { // // if ( !this.oContentWindow ) // return; // // var oContentWindow = this.oContentWindow; // // // the following check relies on the fact that injectDebug() is called earliest in the onload event handler // var bDebugExists = oContentWindow.sap && oContentWindow.sap.ui && oContentWindow.sap.ui.debug && oContentWindow.sap.ui.debug.DebugEnv; // /* alternatively, the following code could be used // var allScripts = contentDocument.getElementsByTagName("script"); // var bDebugExists = false; // for (var i = 0; i < allScripts.length; i++) { // var oneScript = allScripts[i]; // if (oneScript.getAttribute("src") && (oneScript.getAttribute("src").indexOf("/debug.js") > -1)) { // bDebugExists = true; // break; // } // }*/ // // if (!bDebugExists && oContentWindow.document && // oContentWindow.jQuery && oContentWindow.jQuery.sap && // oContentWindow.jQuery.sap.getModulePath ) { // var scriptTag = oContentWindow.document.createElement("script"); // scriptTag.setAttribute("type", "text/javascript"); // var sDebugJsUrl = oContentWindow.jQuery.sap.getModulePath("", "/") + "sap-ui-debug.js";//normalizeResourceUrl(contentDocument.location.href, "sap.ui.core/js/debug.js"); // scriptTag.setAttribute("src", sDebugJsUrl); // oContentWindow.document.getElementsByTagName("head")[0].appendChild(scriptTag); // } //}; // ---- sap.ui.testfwk.TestFWK.mSettingsListeners = []; sap.ui.testfwk.TestFWK.attachSettingsChanged = function(fnCallback) { this.mSettingsListeners.push(fnCallback); }; sap.ui.testfwk.TestFWK.detachSettingsChanged = function(fnCallback) { for(var i=0; i<this.mSettingsListeners.length; ) { if ( this.mSettingsListeners[i] === fnCallback ) { this.mSettingsListeners.splice(i,1); } else { i++; }; } }; sap.ui.testfwk.TestFWK.fireSettingsChanged = function() { for(var i=0; i<this.mSettingsListeners.length; i++) { this.mSettingsListeners[i](); } }; //---- sap.ui.testfwk.TestFWK.mThemeConfigListeners = []; sap.ui.testfwk.TestFWK.attachThemeConfigurationChanged = function(fnCallback) { this.mThemeConfigListeners.push(fnCallback); }; sap.ui.testfwk.TestFWK.detachThemeConfigurationChanged = function(fnCallback) { for(var i=0; i<this.mThemeConfigListeners.length; ) { if ( this.mThemeConfigListeners[i] === fnCallback ) { this.mThemeConfigListeners.splice(i,1); } else { i++; }; } }; sap.ui.testfwk.TestFWK.fireThemeConfigurationChanged = function() { // this is also called by testframe.html! for(var i=0; i<this.mThemeConfigListeners.length; i++) { this.mThemeConfigListeners[i](); } }; // ---- sap.ui.testfwk.TestFWK.mContentListeners = []; sap.ui.testfwk.TestFWK.attachContentWillChange = function(fnCallback) { this.mContentListeners.push(fnCallback); }; sap.ui.testfwk.TestFWK.detachContentWillChange = function(fnCallback) { for(var i=0; i<this.mContentListeners.length; ) { if ( this.mContentListeners[i] === fnCallback ) { this.mContentListeners.splice(i,1); } else { i++; }; }}; sap.ui.testfwk.TestFWK.fireContentWillChange = function(sLibName) { for(var i=0; i<this.mContentListeners.length; i++) { try { this.mContentListeners[i](this.getContentURL(), this.getTheme(), sLibName); // sLibName may be null if library is not known } catch (ex) { // somehow the settings registers twice // to prevent errors we catch them! } } }; /* * layout * libraries=[...] * customTests=[string,...] * customThemes[string,...] * selectedTheme:string * trace toolbar expanded * trace selected tab * traceFilter * traceLevel * selected test case */
29.756818
194
0.704269
9965129b8dfa3008de4e77606d87eef113481ed3
329
js
JavaScript
app/helpers/on-value.js
dennoa/whereami
bacfc24e80853d31a306237aae4b568e7a664c5d
[ "MIT" ]
null
null
null
app/helpers/on-value.js
dennoa/whereami
bacfc24e80853d31a306237aae4b568e7a664c5d
[ "MIT" ]
null
null
null
app/helpers/on-value.js
dennoa/whereami
bacfc24e80853d31a306237aae4b568e7a664c5d
[ "MIT" ]
null
null
null
import firebase from 'firebase' const refs = {} function clearRef(path) { if (typeof refs[path] !== 'undefined') { refs[path].off('value') } } export default function onValue(path, handler) { clearRef(path) refs[path] = firebase.database().ref(path) refs[path].on('value', snapshot => handler(snapshot.val())) }
20.5625
61
0.665653
996603eed268138f19978d4a5c7bdce50b65b756
416
js
JavaScript
backend/config/database.js
dami-laare/shopIT
2bf7ce9c2d4f35a197fca4377311bf1bef88fa63
[ "MIT" ]
null
null
null
backend/config/database.js
dami-laare/shopIT
2bf7ce9c2d4f35a197fca4377311bf1bef88fa63
[ "MIT" ]
null
null
null
backend/config/database.js
dami-laare/shopIT
2bf7ce9c2d4f35a197fca4377311bf1bef88fa63
[ "MIT" ]
null
null
null
const mongoose = require('mongoose'); const connectDatabase = () => { mongoose.connect( `${process.env.DB_LOCAL_URI}`, { useNewUrlParser: true, useUnifiedTopology: true, } ).then(con => { console.log(`MongoDB Database connected with HOST: ${con.connection.host}`) }).catch(err => { console.log(err) }) }; module.exports = connectDatabase;
24.470588
83
0.579327
996661cc18f862da5a865bb6a4edb487e563ae82
532
js
JavaScript
webpack.config.js
alexbabashov/animals
1e725327a4f8315ec1db704c544d6a2d1b81d365
[ "MIT" ]
null
null
null
webpack.config.js
alexbabashov/animals
1e725327a4f8315ec1db704c544d6a2d1b81d365
[ "MIT" ]
null
null
null
webpack.config.js
alexbabashov/animals
1e725327a4f8315ec1db704c544d6a2d1b81d365
[ "MIT" ]
null
null
null
console.log('Start webpack mode: ' + process.env.NODE_ENV); module.exports = () => { let config = require('./webpack.common.js'); if(process.env.NODE_ENV != 'undefined') { const fs = require("fs"); let path = `./webpack.${process.env.NODE_ENV}.js`; if ( fs.existsSync(path) ) { const { merge } = require('webpack-merge'); //const envConfig = require(path); config = merge( require('./webpack.common.js'), require(path)); } } return config; };
26.6
75
0.554511
996680b87f7bff7ba2c5973a59747eb4cb68b1fb
2,993
js
JavaScript
test/jobController.js
priyankag048/distributed_scheduler
88f61d96a791996e3803344ec8e308b83968208e
[ "MIT" ]
1
2017-08-26T09:06:43.000Z
2017-08-26T09:06:43.000Z
test/jobController.js
priyankag048/distributed_scheduler
88f61d96a791996e3803344ec8e308b83968208e
[ "MIT" ]
2
2020-07-18T19:12:42.000Z
2021-05-10T19:28:02.000Z
test/jobController.js
PriyankaTheCoder/distributed_scheduler
88f61d96a791996e3803344ec8e308b83968208e
[ "MIT" ]
null
null
null
const JobController = require("../lib/dbConnections/jobController"); const queryString = require("./constants/queryString"); const jobController = new JobController(queryString); const chai = require("chai"); const expect = chai.expect; const query = require("./constants/query"); var startTimeStamp, startdate, job; describe("job controller : add, update, read and delete from database", () => { beforeEach((done) => { startTimeStamp = new Date(); startdate = `${startTimeStamp.getDate()}-${startTimeStamp.getMonth()}-${startTimeStamp.getFullYear()} ${startTimeStamp.getHours()}:${startTimeStamp.getMinutes()}:${startTimeStamp.getSeconds()}`; job = { id : 1, name: "job1", description: "job1", frequency: 5, startdate: startdate, script: "var a = 5;", repeat: true }; query("BEGIN", "", done); }); it("should add to job test table", (done) => { query(queryString.delete_all_rows, "", (err, res) => { jobController.createJob(job.name, job.description, job.frequency, job.script, job.repeat) .then(result => { query(queryString.get_all_rows, "", (err, rows) => { expect(result.status).to.equal(201); expect(result.message).to.equal(`Record has been successfully created with id ${rows[0].id}`); expect(rows.length).to.equal(1); done(); }); }); }); }); it("should get job based on id", (done) => { query(queryString.delete_all_rows, "", (err, res) => { query(queryString.create_row, [job.name, job.description, job.frequency, job.startdate, job.script, job.repeat], (err, result) => { var id = result[0].id; jobController.getJob(id) .then(result => { expect(result.data.id).to.equal(id); expect(result.message).to.equal(`Found job with id ${id}`); expect(result.status).to.equal(200); done(); }); }); }); }); it("should get all jobs", (done) => { query(queryString.delete_all_rows, "", (err, res) => { query(queryString.create_row, [job.name, job.description, job.frequency, job.startdate, job.script, job.repeat], (err, result) => { jobController.getAllJobs() .then(result => { let jobName = result.data[0].name; jobName = jobName.trim(); expect(result.message).to.equal("Found jobs"); expect(result.status).to.equal(200); expect(jobName).to.equal(job.name); done(); }); }); }); }); });
41.569444
203
0.507183
9966f282b26a3e90809844ded0a1548f1477af89
2,042
js
JavaScript
webpack.client.production.config.js
rezo-labs/ura-infrastructure
b8951607fa74ce52d46461141ddc0bab871a76c5
[ "MIT" ]
null
null
null
webpack.client.production.config.js
rezo-labs/ura-infrastructure
b8951607fa74ce52d46461141ddc0bab871a76c5
[ "MIT" ]
null
null
null
webpack.client.production.config.js
rezo-labs/ura-infrastructure
b8951607fa74ce52d46461141ddc0bab871a76c5
[ "MIT" ]
null
null
null
const chalk = require('chalk'); const logSymbols = require('log-symbols'); const path = require('path'); const webpack = require('webpack'); const merge = require('webpack-merge'); const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer'); const UglifyJSPlugin = require('uglifyjs-webpack-plugin'); const CleanWebpackPlugin = require('clean-webpack-plugin'); const CopyWebpackPlugin = require('copy-webpack-plugin'); const constants = require('./constants.js'); // Get common config const { client } = require('./webpack.common.config.js'); const { config } = constants; const commonConfig = config.webpack && config.webpack.client && config.webpack.client.common; const prodConfig = config.webpack && config.webpack.client && config.webpack.client.prod; // Production mode console.log(logSymbols.info, chalk.green.bold('PRODUCTION MODE')); module.exports = ({ SSR = true, openAnalyzer = false }) => merge(client, { mode: 'production', output: { filename: '[name].bundle.[hash].js', chunkFilename: '[name].bundle.[hash].js', }, optimization: { splitChunks: { cacheGroups: { default: false, vendors: false, }, }, }, plugins: [ new webpack.DefinePlugin(Object.assign({}, constants.GLOBALS, { 'process.env': { NODE_ENV: JSON.stringify('production'), SSR, }, })), new UglifyJSPlugin(), new CleanWebpackPlugin([constants.PUBLIC_DIR], { root: constants.WORK_DIR, exclude: ['.gitkeep'], }), new CopyWebpackPlugin([{ from: constants.STATIC_DIR, to: constants.PUBLIC_DIR, ignore: ['*.development.*', 'README.md'], }]), new BundleAnalyzerPlugin({ analyzerMode: 'static', openAnalyzer, reportFilename: path.resolve(constants.DIST_DIR, 'bundle-report.html'), }), ], }, commonConfig, prodConfig);
31.90625
93
0.60382
9967864212e5ee036297cda737491eaf80f27d94
2,756
js
JavaScript
src/views/udm/share/Share.js
wl4g/super-cloudops-view
3940eb40fdc26f59f42977511d5b29faed0dcffd
[ "Apache-2.0" ]
2
2021-04-27T02:51:44.000Z
2021-04-27T02:51:45.000Z
src/views/udm/share/Share.js
wl4g/super-devops-view
3940eb40fdc26f59f42977511d5b29faed0dcffd
[ "Apache-2.0" ]
3
2021-03-25T03:13:10.000Z
2022-02-12T11:01:33.000Z
src/views/udm/share/Share.js
wl4g/super-cloudops-view
3940eb40fdc26f59f42977511d5b29faed0dcffd
[ "Apache-2.0" ]
1
2019-12-25T08:33:58.000Z
2019-12-25T08:33:58.000Z
import global from "../../../common/global_variable"; export default { name: 'share', data() { return { //查询条件 searchParams: { name: '', }, //分页信息 total: 0, pageNum: 1, pageSize: 10, tableData: [], browseUrl: global.getBaseUrl(global.cmdb,false)+'/view/index.html', } }, mounted() { this.getData(); }, methods: { onSubmit() { this.getData(); }, currentChange(i) { this.pageNum = i; this.getData(); }, // 获取列表数据 getData() { this.loading = true; this.$$api_udm_shareList({ data: { name: this.searchParams.name, pageNum: this.pageNum, pageSize: this.pageSize, }, fn: json => { this.loading = false; this.total = json.data.total; this.tableData = json.data.records; }, errFn: () => { this.loading = false; } }) }, cancelShare(row) { if (!row.id) { return; } this.$confirm('Confirm?', 'warning', { confirmButtonText: 'OK', cancelButtonText: 'Cancel', type: 'warning' }).then(() => { this.$$api_udm_cancelShare({ data: { id: row.id, }, fn: json => { this.$message({ message: '取消分享成功', type: 'success' }); this.getData(); }, }) }).catch(() => { //do nothing }); }, getShareText(row){ let shareText = '链接:'+this.browseUrl+"?code="+row.shareCode; if(row.passwd){ shareText = shareText + ' 密码:' + row.passwd; } return shareText; }, onCopySuccess(){ this.$message({ message: '复制成功', type: 'success' }); }, rowClick(row, event, column){ this.$refs.tableDate.toggleRowExpansion(row); }, formatExpireTime(row, column, cellValue, index){ if(row.expireType===1){ return '永久'; }else{ return row.expireTime; } }, } }
23.159664
79
0.355951
99678e137cac0e83228ccdf372eecc251eb33a33
709
js
JavaScript
lab8/client/src/components/Search/index.js
BrookeEden/DIG4503-Spring2021
6b74738d3d54b07e8763741dec84c2e645671250
[ "MIT" ]
null
null
null
lab8/client/src/components/Search/index.js
BrookeEden/DIG4503-Spring2021
6b74738d3d54b07e8763741dec84c2e645671250
[ "MIT" ]
null
null
null
lab8/client/src/components/Search/index.js
BrookeEden/DIG4503-Spring2021
6b74738d3d54b07e8763741dec84c2e645671250
[ "MIT" ]
null
null
null
import Axios from 'axios'; import {useState } from 'react' function Search() { const [search, setSearch] = useState(""); function Search2() { Axios.get("http://localhost:45030/people/" + search) .then((response) => { console.log(response.data) }) .catch((error) => { console.log("The error was " + error); }) } return ( <div> <p>Search for someone</p> <input type="text" onChange={(event) => { setSearch(event.target.value); }} /> <button onClick={() => Search2() }>Search </button> { <p>Searched: {search}</p> } </div> ) } export default Search
22.15625
53
0.502116
99680209dc9868922ccf83b2bbf92e8121faac9a
157
js
JavaScript
cal.web/src/components/calselect-state/calselect-state-test.js
bdurrer/calendarizator
721ad1c3ad29cd7a47ca5b4e441d26177057174c
[ "MIT" ]
1
2016-05-03T06:32:57.000Z
2016-05-03T06:32:57.000Z
cal.web/src/components/calselect-state/calselect-state-test.js
bdurrer/calendarizator
721ad1c3ad29cd7a47ca5b4e441d26177057174c
[ "MIT" ]
null
null
null
cal.web/src/components/calselect-state/calselect-state-test.js
bdurrer/calendarizator
721ad1c3ad29cd7a47ca5b4e441d26177057174c
[ "MIT" ]
null
null
null
describe('Calselect State', () => { it('should pass the dummy test to verify the protractor setup', () => { expect(true).toBe(true); }); });
26.166667
75
0.573248
99688068bc54cd795a81a78766b8423a13c72507
435
js
JavaScript
src/screens/DashBoard/service.js
Quocanhtp/React-Course-List-Eclazz-Demo
f4b4150db2df10e27a847cd3bbde8dab1911e3d7
[ "MIT" ]
1
2020-11-27T04:10:00.000Z
2020-11-27T04:10:00.000Z
src/screens/DashBoard/service.js
Quocanhtp/React-Course-List-Eclazz-Demo
f4b4150db2df10e27a847cd3bbde8dab1911e3d7
[ "MIT" ]
null
null
null
src/screens/DashBoard/service.js
Quocanhtp/React-Course-List-Eclazz-Demo
f4b4150db2df10e27a847cd3bbde8dab1911e3d7
[ "MIT" ]
null
null
null
import { patchAsync, deleteAsync } from "helper/request"; const API_URL = process.env.REACT_APP_API_URL; export async function cancelCourse(options = {}) { const { id } = options; if (!id) return; let url = API_URL + `/courses/${id}` return await patchAsync(url, { state: 'CANCELED' }); } export async function deleteCourse(id) { const url = API_URL + `/courses/${id}` return await deleteAsync(url) }
27.1875
57
0.657471
996913c9c185e2267e34d02a351da0bf5d5271cd
507
js
JavaScript
url.js
TanyaPanich/express_serverURLparameters
35d7dea43d85dcf29a72a7118427f691b3dfddab
[ "MIT" ]
null
null
null
url.js
TanyaPanich/express_serverURLparameters
35d7dea43d85dcf29a72a7118427f691b3dfddab
[ "MIT" ]
null
null
null
url.js
TanyaPanich/express_serverURLparameters
35d7dea43d85dcf29a72a7118427f691b3dfddab
[ "MIT" ]
null
null
null
'use strict'; var express = require('express'); var app = express(); var port = process.env.PORT || 8000; app.disable('x-powered-by'); app.get("/hello/:name", function (req, res) { res.send( "Hello, " + req.params.name ); }); app.get("/hi", function (req, res) { var name = req.query.name; res.send("Hello, " + name); }); //go to http://localhost:3000/hi?name=Nina app.use(function(req, res) { res.sendStatus(404); }); app.listen(port, function() { console.log('Listening on port', port); });
21.125
45
0.629191
9969664f11e2c7f5cad86e17a38e3a745ea514c2
590
js
JavaScript
lib/errors/connection.js
rankingcoach/elasticsearch-odm
2d45a97cb2a80da98b223e47c57bf9c5aa65ee69
[ "MIT" ]
null
null
null
lib/errors/connection.js
rankingcoach/elasticsearch-odm
2d45a97cb2a80da98b223e47c57bf9c5aa65ee69
[ "MIT" ]
null
null
null
lib/errors/connection.js
rankingcoach/elasticsearch-odm
2d45a97cb2a80da98b223e47c57bf9c5aa65ee69
[ "MIT" ]
null
null
null
'use-strict'; let ElasticsearchError = require('../errors.js'), utils = require('../utils'); function ConnectionError(host){ let message; if(host){ message = 'No connection can be established to Elasticsearch at ' + host; }else{ message = 'No connection has been established to Elasticsearch.'; } ElasticsearchError.call(this, message); if(Error.captureStackTrace) Error.captureStackTrace(this, arguments.callee); this.name = 'ConnectionError'; this.host = host || ''; } utils.inherits(ConnectionError, ElasticsearchError); module.exports = ConnectionError;
26.818182
78
0.718644
9969bfc0fc4dfaae5114bd5ccbb29e70d6afaa2e
3,270
js
JavaScript
tests/unit/organizer/index.test.js
douglasgreyling/light-service.js
99c7f314dcbc25fd52ea5b5bc70f2e25df58a6e8
[ "MIT" ]
1
2021-09-07T14:48:01.000Z
2021-09-07T14:48:01.000Z
tests/unit/organizer/index.test.js
douglasgreyling/light-service.js
99c7f314dcbc25fd52ea5b5bc70f2e25df58a6e8
[ "MIT" ]
null
null
null
tests/unit/organizer/index.test.js
douglasgreyling/light-service.js
99c7f314dcbc25fd52ea5b5bc70f2e25df58a6e8
[ "MIT" ]
null
null
null
const Valid = require("../../fixtures/organizers/Valid.js"); const SkipActions = require("../../fixtures/organizers/SkipActions.js"); const FailContext = require("../../fixtures/organizers/FailContext.js"); const FailContextAndReturns = require("../../fixtures/organizers/FailContextAndReturns.js"); const SkipRemaining = require("../../fixtures/organizers/SkipRemaining.js"); const Rollback = require("../../fixtures/organizers/Rollback.js"); const RollbackWithNoHandler = require("../../fixtures/organizers/RollbackWithNoHandler.js"); const OrganizerMetadata = require("../../fixtures/organizers/OrganizerMetadata.js"); const Alias = require("../../fixtures/organizers/Alias.js"); const AroundHooks = require("../../fixtures/organizers/AroundHooks.js"); const BeforeHooks = require("../../fixtures/organizers/BeforeHooks.js"); const AfterHooks = require("../../fixtures/organizers/AfterHooks.js"); const AllHooks = require("../../fixtures/organizers/AllHooks.js"); test("executes valids actions", async () => { const result = await Valid.call(1); expect(result.number).toEqual(3); }); test("does not execute following actions once context is failed", async () => { const result = await FailContext.call(1); expect(result.failure()).toBe(true); expect(result.number).toEqual(3); }); test("executes actions whilst skipping actions where necessary", async () => { const result = await SkipActions.call(1); expect(result.number).toEqual(4); }); test("executes actions until the context is failed and returned", async () => { const result = await FailContextAndReturns.call(1); expect(result.number).toEqual(2); }); test("executes actions until the context is marked to skip remaining actions", async () => { const result = await SkipRemaining.call(1); expect(result.number).toEqual(3); }); test("executes rollbacks correctly", async () => { const result = await Rollback.call(1); expect(result.number).toEqual(1); }); test("executes rollbacks correctly when actions do not have rollback handlers", async () => { const result = await RollbackWithNoHandler.call(1); expect(result.number).toEqual(2); }); test("sets the organizer metadata for the actions", async () => { const result = await OrganizerMetadata.call(); expect(result.action).toEqual("OrganizerMetadataAction"); expect(result.organizer).toEqual("OrganizerMetadata"); }); test("registers aliases for actions to use", async () => { const result = await Alias.call(1); expect(result.number).toEqual(3); }); test("executes around hook before and after executed step", async () => { const result = await AroundHooks.call([]); expect(result.order).toEqual(["around", "executed", "around"]); }); test("executes before hook before executed step", async () => { const result = await BeforeHooks.call([]); expect(result.order).toEqual(["before", "executed"]); }); test("executes after hook after executed step", async () => { const result = await AfterHooks.call([]); expect(result.order).toEqual(["executed", "after"]); }); test("executes all hooks in the correct order", async () => { const result = await AllHooks.call([]); expect(result.order).toEqual([ "around", "before", "executed", "after", "around", ]); });
32.7
93
0.700612
9969dae66824be0fb73542219ea0c4adb18125d4
1,618
js
JavaScript
examples/simple/components/SpringScrollbars/SpringScrollbars.js
phattranky/awesome-react-scrollbars
ec1f8d317154805b521c624b9c9b57f15fbd8af0
[ "MIT" ]
null
null
null
examples/simple/components/SpringScrollbars/SpringScrollbars.js
phattranky/awesome-react-scrollbars
ec1f8d317154805b521c624b9c9b57f15fbd8af0
[ "MIT" ]
null
null
null
examples/simple/components/SpringScrollbars/SpringScrollbars.js
phattranky/awesome-react-scrollbars
ec1f8d317154805b521c624b9c9b57f15fbd8af0
[ "MIT" ]
null
null
null
import React, { createClass } from 'react'; import { Scrollbars } from 'react-custom-scrollbars'; import { SpringSystem, MathUtil } from 'rebound'; export default createClass({ displayName: 'SpringScrollbars', componentDidMount() { this.springSystem = new SpringSystem(); this.spring = this.springSystem.createSpring(); this.spring.addListener({ onSpringUpdate: this.handleSpringUpdate }); }, componentWillUnmount() { this.springSystem.deregisterSpring(this.spring); this.springSystem.removeAllListeners(); this.springSystem = undefined; this.spring.destroy(); this.spring = undefined; }, getScrollTop() { return this.refs.scrollbars.getScrollTop(); }, getScrollHeight() { return this.refs.scrollbars.getScrollHeight(); }, getHeight() { return this.refs.scrollbars.getHeight(); }, scrollTop(top) { const { scrollbars } = this.refs; const scrollTop = scrollbars.getScrollTop(); const scrollHeight = scrollbars.getScrollHeight(); const val = MathUtil.mapValueInRange(top, 0, scrollHeight, scrollHeight * 0.2, scrollHeight * 0.8); this.spring.setCurrentValue(scrollTop).setAtRest(); this.spring.setEndValue(val); }, handleSpringUpdate(spring) { const { scrollbars } = this.refs; const val = spring.getCurrentValue(); scrollbars.scrollTop(val); }, render() { return ( <Scrollbars {...this.props} ref="scrollbars"/> ); } });
27.896552
107
0.618665
9969f7534d5bd52df187c59884a72c6811161c30
482
js
JavaScript
public/component---src-pages-page-2-js-c04cfee4f272c634de54.js
demersaj/my-portfolio
8dcd38e7fa6e5fdcec72a4d921850263f0dc5c0a
[ "MIT" ]
1
2019-06-02T22:14:51.000Z
2019-06-02T22:14:51.000Z
public/component---src-pages-page-2-js-c04cfee4f272c634de54.js
demersaj/my-portfolio
8dcd38e7fa6e5fdcec72a4d921850263f0dc5c0a
[ "MIT" ]
null
null
null
public/component---src-pages-page-2-js-c04cfee4f272c634de54.js
demersaj/my-portfolio
8dcd38e7fa6e5fdcec72a4d921850263f0dc5c0a
[ "MIT" ]
null
null
null
"use strict";(self.webpackChunkgatsby_starter_dimension_v2=self.webpackChunkgatsby_starter_dimension_v2||[]).push([[617],{9863:function(e,t,n){n.r(t);var a=n(7294),l=n(5444),r=n(7198);t.default=function(){return a.createElement(r.Z,null,a.createElement("h1",null,"Hi from the second page"),a.createElement("p",null,"Welcome to page 2"),a.createElement(l.Link,{to:"/"},"Go back to the homepage"))}}}]); //# sourceMappingURL=component---src-pages-page-2-js-c04cfee4f272c634de54.js.map
241
401
0.746888
996a0fa15001f0067aab976a54d03caff5f57030
675
js
JavaScript
pages/docs/index.js
gumgum/design-system
608729969ae4dba4441181bcc23e4447e5f5bba2
[ "MIT" ]
2
2021-08-02T20:26:07.000Z
2021-09-07T23:09:44.000Z
pages/docs/index.js
gumgum/design-system
608729969ae4dba4441181bcc23e4447e5f5bba2
[ "MIT" ]
15
2020-11-05T21:46:28.000Z
2022-03-10T17:35:53.000Z
pages/docs/index.js
gumgum/design-system
608729969ae4dba4441181bcc23e4447e5f5bba2
[ "MIT" ]
1
2022-03-28T10:31:31.000Z
2022-03-28T10:31:31.000Z
import Link from "next/link"; import PageTitle from "../../components/common/title/pageTitle"; import { getSortedDocsData } from "../../utils/docs"; export async function getStaticProps() { const allPostsData = getSortedDocsData(); return { props: { allPostsData, }, }; } export default function AllDocsPage({ allPostsData }) { return ( <section> <PageTitle title="All Items" /> <ul> {allPostsData.map(({ id, title }) => ( <li key={id}> <Link href={`/docs/${id}`}> <a className="gds-button--link">{title}</a> </Link> </li> ))} </ul> </section> ); }
22.5
64
0.540741
996a207813c05bc0c4ece51cdf032ca715a52e34
1,718
js
JavaScript
packages/react-relay/classic/store/RelayChangeTracker.js
zmbush/relay
aca48cd634cc1defa489d9361ee2acd057eda882
[ "MIT" ]
null
null
null
packages/react-relay/classic/store/RelayChangeTracker.js
zmbush/relay
aca48cd634cc1defa489d9361ee2acd057eda882
[ "MIT" ]
null
null
null
packages/react-relay/classic/store/RelayChangeTracker.js
zmbush/relay
aca48cd634cc1defa489d9361ee2acd057eda882
[ "MIT" ]
null
null
null
/** * Copyright (c) 2013-present, Facebook, Inc. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @flow * @format */ 'use strict'; import type {DataID} from '../tools/RelayInternalTypes'; type ChangeMap = {[key: string]: boolean}; export type ChangeSet = { created: ChangeMap, updated: ChangeMap, }; /** * @internal * * Keeps track of records that have been created or updated; used primarily to * record changes during the course of a `write` operation. */ class RelayChangeTracker { _created: ChangeMap; _updated: ChangeMap; constructor() { this._created = {}; this._updated = {}; } /** * Record the creation of a record. */ createID(recordID: DataID): void { this._created[recordID] = true; } /** * Record an update to a record. */ updateID(recordID: DataID): void { if (!this._created.hasOwnProperty(recordID)) { this._updated[recordID] = true; } } /** * Determine if the record has any changes (was created or updated). */ hasChange(recordID: DataID): boolean { return !!(this._updated[recordID] || this._created[recordID]); } /** * Determine if the record was created. */ isNewRecord(recordID: DataID): boolean { return !!this._created[recordID]; } /** * Get the ids of records that were created/updated. */ getChangeSet(): ChangeSet { if (__DEV__) { return { created: Object.freeze(this._created), updated: Object.freeze(this._updated), }; } return { created: this._created, updated: this._updated, }; } } module.exports = RelayChangeTracker;
20.211765
78
0.635623
996a7806ddba5c9f46f3a9366bd93080b3e8efda
391
js
JavaScript
backend/build/app/routes/user.routes.js
SFedyanov/devopstest
b20e00b5540bd4bb03e8ce10044fd59cc747404a
[ "MIT" ]
null
null
null
backend/build/app/routes/user.routes.js
SFedyanov/devopstest
b20e00b5540bd4bb03e8ce10044fd59cc747404a
[ "MIT" ]
null
null
null
backend/build/app/routes/user.routes.js
SFedyanov/devopstest
b20e00b5540bd4bb03e8ce10044fd59cc747404a
[ "MIT" ]
1
2022-03-25T10:38:03.000Z
2022-03-25T10:38:03.000Z
module.exports = app => { const users = require("../controllers/user.controller.js"); var router = require("express").Router(); // Create a new User router.post("/createUser", users.create); // Retrieve all Users router.get("/users", users.findAll); // Delete a User with id router.delete("/deleteUser/:id", users.delete); app.use("/api", router); };
23
62
0.621483
996b16c54cbe22a4f37cc3248ff4a1916c6901a3
476
js
JavaScript
src/index.js
hananils/kirby-meta-knight
72fc85ade535628be347b3e49b4294684242d371
[ "MIT" ]
83
2020-12-01T15:31:31.000Z
2022-03-31T21:01:35.000Z
src/index.js
hananils/kirby-meta-knight
72fc85ade535628be347b3e49b4294684242d371
[ "MIT" ]
30
2020-12-01T16:13:57.000Z
2022-02-14T09:10:55.000Z
src/index.js
hananils/kirby-meta-knight
72fc85ade535628be347b3e49b4294684242d371
[ "MIT" ]
15
2020-12-01T16:54:56.000Z
2022-03-23T11:53:07.000Z
import googleSearchPreview from "./components/sections/google_search_preview.vue"; import facebookSharingPreview from "./components/sections/facebook_sharing_preview.vue"; import twitterCardPreview from "./components/sections/twitter_card_preview.vue"; panel.plugin("diesdasdigital/kirby-meta-knight", { sections: { google_search_preview: googleSearchPreview, facebook_sharing_preview: facebookSharingPreview, twitter_card_preview: twitterCardPreview, }, });
39.666667
88
0.817227
996b4694f7dc2ef1a4ce701184038e94683c71a9
1,897
js
JavaScript
packages/radio/src/radio.js
wishfirstyl/my-vxe-table
ef29de742c46b050ae5e0eaa12be8af2d853753e
[ "MIT" ]
null
null
null
packages/radio/src/radio.js
wishfirstyl/my-vxe-table
ef29de742c46b050ae5e0eaa12be8af2d853753e
[ "MIT" ]
null
null
null
packages/radio/src/radio.js
wishfirstyl/my-vxe-table
ef29de742c46b050ae5e0eaa12be8af2d853753e
[ "MIT" ]
null
null
null
import { UtilTools } from '../../tools' import GlobalConfig from '../../conf' export default { name: 'VxeRadio', props: { value: [String, Number], label: [String, Number], title: [String, Number], content: [String, Number], disabled: Boolean, name: String, size: { type: String, default: () => GlobalConfig.radio.size || GlobalConfig.size } }, inject: { $xegroup: { default: null } }, computed: { vSize () { return this.size || this.$parent.size || this.$parent.vSize }, isGroup () { return this.$xegroup }, isDisabled () { return this.disabled || (this.isGroup && this.$xegroup.disabled) } }, render (h) { const { $slots, $xegroup, isGroup, isDisabled, title, vSize, value, label, name, content } = this const attrs = {} if (title) { attrs.title = title } return h('label', { class: ['vxe-radio', { [`size--${vSize}`]: vSize, 'is--disabled': isDisabled }], attrs }, [ h('input', { class: 'vxe-radio--input', attrs: { type: 'radio', name: isGroup ? $xegroup.name : name, disabled: isDisabled }, domProps: { checked: isGroup ? $xegroup.value === label : value === label }, on: { change: evnt => { if (!isDisabled) { const params = { label, $event: evnt } if (isGroup) { $xegroup.handleChecked(params, evnt) } else { this.$emit('input', label) this.$emit('change', params, evnt) } } } } }), h('span', { class: 'vxe-radio--icon' }), h('span', { class: 'vxe-radio--label' }, $slots.default || [UtilTools.getFuncText(content)]) ]) } }
24.636364
101
0.482868
996c112d18cf8da23fa046d39b655898e78cca52
539
js
JavaScript
packages/core/input/src/__tests__/unit/index.js
varijkapil13/atlaskit
655fb6a8edaff9db07211803f788ae0995f3862b
[ "Apache-2.0" ]
7
2020-05-12T11:46:06.000Z
2021-05-12T02:10:34.000Z
packages/core/input/src/__tests__/unit/index.js
varijkapil13/atlaskit
655fb6a8edaff9db07211803f788ae0995f3862b
[ "Apache-2.0" ]
1
2019-05-08T06:48:30.000Z
2019-05-08T06:48:30.000Z
packages/core/input/src/__tests__/unit/index.js
varijkapil13/atlaskit
655fb6a8edaff9db07211803f788ae0995f3862b
[ "Apache-2.0" ]
1
2020-04-30T09:40:37.000Z
2020-04-30T09:40:37.000Z
// @flow import React from 'react'; import { mount } from 'enzyme'; import Input from '../..'; import { name } from '../../../package.json'; describe(name, () => { it('selects the input when select() is called', () => { const value = 'my-value'; const wrapper = mount( <Input isEditing onChange={() => {}} value={value} />, ); wrapper.instance().select(); const input = wrapper.find('input').instance(); expect(input.selectionStart).toBe(0); expect(input.selectionEnd).toBe(value.length); }); });
24.5
60
0.595547
996c214e6c72b94c463797613b237645153c6bb7
731
js
JavaScript
template/src/components/App.js
gthomas-appfolio/preact-template-apm
d34f082f1ca13a93745f2fe50f4a3673ac196b5c
[ "MIT" ]
null
null
null
template/src/components/App.js
gthomas-appfolio/preact-template-apm
d34f082f1ca13a93745f2fe50f4a3673ac196b5c
[ "MIT" ]
2
2018-02-27T18:58:18.000Z
2018-02-28T02:23:22.000Z
template/src/components/App.js
gthomas-appfolio/preact-template-apm
d34f082f1ca13a93745f2fe50f4a3673ac196b5c
[ "MIT" ]
null
null
null
import React from 'react'; import { Container } from 'react-gears'; import { Router } from 'preact-router'; import Header from './Header.js'; import Home from './Home.js'; import Profile from './Profile.js'; // import Home from 'async!./Home.js'; // import Profile from 'async!./Profile.js'; export default class App extends React.Component { handleRoute = (e) => { this.currentUrl = e.url; } render() { return ( <div id="app"> <Header /> <Container> <Router onChange={this.handleRoute}> <Home path="/" /> <Profile path="/profile/" user="me" /> <Profile path="/profile/:user" /> </Router> </Container> </div> ); } }
23.580645
50
0.562244
996c52b77b1a65c4e7d2db72606cfd4514e3338b
5,663
js
JavaScript
node_modules/_@umijs_test@3.2.19@@umijs/test/lib/index.js
littlewulei/nodeModule
acce489d7a9d702b5dce3104ca277cb5a83324db
[ "MIT" ]
null
null
null
node_modules/_@umijs_test@3.2.19@@umijs/test/lib/index.js
littlewulei/nodeModule
acce489d7a9d702b5dce3104ca277cb5a83324db
[ "MIT" ]
null
null
null
node_modules/_@umijs_test@3.2.19@@umijs/test/lib/index.js
littlewulei/nodeModule
acce489d7a9d702b5dce3104ca277cb5a83324db
[ "MIT" ]
null
null
null
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _exportNames = {}; exports.default = _default; function _react() { const data = _interopRequireDefault(require("react")); _react = function _react() { return data; }; return data; } function _jest() { const data = require("jest"); _jest = function _jest() { return data; }; return data; } function _utils() { const data = require("@umijs/utils"); _utils = function _utils() { return data; }; return data; } function _args() { const data = require("jest-cli/build/cli/args"); _args = function _args() { return data; }; return data; } function _assert() { const data = _interopRequireDefault(require("assert")); _assert = function _assert() { return data; }; return data; } function _path() { const data = require("path"); _path = function _path() { return data; }; return data; } function _fs() { const data = require("fs"); _fs = function _fs() { return data; }; return data; } var _createDefaultConfig = _interopRequireDefault(require("./createDefaultConfig/createDefaultConfig")); var _utils2 = require("./utils"); Object.keys(_utils2).forEach(function (key) { if (key === "default" || key === "__esModule") return; if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; Object.defineProperty(exports, key, { enumerable: true, get: function get() { return _utils2[key]; } }); }); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } const debug = (0, _utils().createDebug)('umi:test'); function _default(_x) { return _ref.apply(this, arguments); } function _ref() { _ref = _asyncToGenerator(function* (args) { process.env.NODE_ENV = 'test'; if (args.debug) { _utils().createDebug.enable('umi:test'); } debug(`args: ${JSON.stringify(args)}`); // Print related versions if (args.version) { console.log(`umi-test@${require('../package.json').version}`); console.log(`jest@${require('jest/package.json').version}`); return; } const cwd = args.cwd || process.cwd(); // Read config from cwd/jest.config.js const userJestConfigFile = (0, _path().join)(cwd, 'jest.config.js'); const userJestConfig = (0, _fs().existsSync)(userJestConfigFile) && require(userJestConfigFile); debug(`config from jest.config.js: ${JSON.stringify(userJestConfig)}`); // Read jest config from package.json const packageJSONPath = (0, _path().join)(cwd, 'package.json'); const packageJestConfig = (0, _fs().existsSync)(packageJSONPath) && require(packageJSONPath).jest; debug(`jest config from package.json: ${JSON.stringify(packageJestConfig)}`); // Merge configs // user config and args config could have value function for modification const config = (0, _utils().mergeConfig)((0, _createDefaultConfig.default)(cwd, args), packageJestConfig, userJestConfig); debug(`final config: ${JSON.stringify(config)}`); // Generate jest options const argsConfig = Object.keys(_args().options).reduce((prev, name) => { if (args[name]) prev[name] = args[name]; // Convert alias args into real one const alias = _args().options[name].alias; if (alias && args[alias]) prev[name] = args[alias]; return prev; }, {}); debug(`config from args: ${JSON.stringify(argsConfig)}`); // Run jest const result = yield (0, _jest().runCLI)(_objectSpread({ // @ts-ignore _: args._ || [], // @ts-ignore $0: args.$0 || '', // 必须是单独的 config 配置,值为 string,否则不生效 // @ts-ignore config: JSON.stringify(config) }, argsConfig), [cwd]); debug(result); // Throw error when run failed (0, _assert().default)(result.results.success, `Test with jest failed`); }); return _ref.apply(this, arguments); }
33.311765
534
0.667844
996d1f31b4d4ce7f2e6432177a79b22df72e054c
499
js
JavaScript
tests/helpers/destroy-app.js
daimaqiao/Ghost-Admin-Bridge
cde525f182745547cff9e0676265039bf43a86a0
[ "MIT" ]
null
null
null
tests/helpers/destroy-app.js
daimaqiao/Ghost-Admin-Bridge
cde525f182745547cff9e0676265039bf43a86a0
[ "MIT" ]
null
null
null
tests/helpers/destroy-app.js
daimaqiao/Ghost-Admin-Bridge
cde525f182745547cff9e0676265039bf43a86a0
[ "MIT" ]
null
null
null
import run from 'ember-runloop'; import $ from 'jquery'; export default function destroyApp(application) { // this is required to fix "second Pretender instance" warnings if (server) { server.shutdown(); } // this is required because it gets injected during acceptance tests but // not removed meaning that the integration tests grab this element rather // than their rendered content $('.liquid-target-container').remove(); run(application, 'destroy'); }
29.352941
78
0.695391
996e111e5c4b8d33621f58e7b68e14bd3026f0c1
478
js
JavaScript
src/components/Form/Input/StyledInput.js
thegrinder/basic-styled-uikit
3705ea75f5924f8bfeec17ae51b430382b872bd0
[ "MIT" ]
4
2018-02-22T16:20:07.000Z
2019-02-16T21:14:45.000Z
src/components/Form/Input/StyledInput.js
thegrinder/basic-styled-uikit
3705ea75f5924f8bfeec17ae51b430382b872bd0
[ "MIT" ]
11
2019-02-24T22:39:01.000Z
2022-02-26T02:26:48.000Z
src/components/Form/Input/StyledInput.js
thegrinder/basic-styled-uikit
3705ea75f5924f8bfeec17ae51b430382b872bd0
[ "MIT" ]
3
2018-04-21T12:31:28.000Z
2021-04-12T02:39:32.000Z
import styled from 'styled-components'; import { bool } from 'prop-types'; import { commonInputStyles } from '../commonFormStyles'; import { rem } from '../../../theme/typography'; const propTypes = { invalid: bool.isRequired, }; const StyledInput = styled.input` ${commonInputStyles} vertical-align: middle; display: inline-block; height: ${rem(40)}; padding: 0 ${rem(10)}; overflow: visible; `; StyledInput.propTypes = propTypes; export default StyledInput;
21.727273
56
0.698745
996f20a8ad60e8ec7daefbf2a9862aa1f8e2c606
232
js
JavaScript
test/utils.js
tomsutton1984/generator-react-firebase
4605436e3215fd4413c04b863a6e65ba05aa8d36
[ "MIT" ]
333
2016-06-09T04:46:04.000Z
2022-03-19T17:06:09.000Z
test/utils.js
tomsutton1984/generator-react-firebase
4605436e3215fd4413c04b863a6e65ba05aa8d36
[ "MIT" ]
530
2016-06-07T03:57:52.000Z
2022-03-31T14:00:29.000Z
test/utils.js
tomsutton1984/generator-react-firebase
4605436e3215fd4413c04b863a6e65ba05aa8d36
[ "MIT" ]
80
2016-06-07T03:52:56.000Z
2021-12-30T13:25:15.000Z
import assert from 'yeoman-assert' export function checkForEachFile(files, nameRemove) { return describe('creates file', () => files.forEach((item) => it(item.replace(nameRemove, ''), () => assert.file([item])) )) }
29
65
0.650862
996fec7b9f0fb1d59ff561d896911893134de126
6,156
js
JavaScript
internal/utils.js
simon-ourmachinery/tmbuild-action
19da965e215d94185318ec46a4f19f8af4e7178c
[ "CC0-1.0" ]
null
null
null
internal/utils.js
simon-ourmachinery/tmbuild-action
19da965e215d94185318ec46a4f19f8af4e7178c
[ "CC0-1.0" ]
1
2020-12-16T18:12:13.000Z
2021-07-08T13:24:19.000Z
internal/utils.js
simon-ourmachinery/tmbuild-action
19da965e215d94185318ec46a4f19f8af4e7178c
[ "CC0-1.0" ]
1
2021-08-12T08:39:52.000Z
2021-08-12T08:39:52.000Z
const core = require('@actions/core'); const exec = require('@actions/exec'); const os = require('os'); const fs = require('fs'); const yaml = require('js-yaml'); function info(msg) { core.info(`[tmbuild-action] ${msg}`); } exports.info = info; function debug(msg) { core.debug(`[tmbuild-action] ${msg}`); } exports.debug = debug; function error(msg) { core.error(`[tmbuild-action] ${msg}`); } exports.error = error; function warning(msg) { core.warning(`[tmbuild-action] ${msg}`); } exports.error = warning; async function cp(src, dest) { core.startGroup(`[tmbuild-action] copy files src: ${src} dest: ${dest}`); if (os.platform() == "win32") { await exec.exec(`powershell.exe New-Item -Path "${dest}" -ItemType Directory -Force`) await exec.exec(`powershell.exe Copy-Item -Path "${src}" -Destination "${dest}" -Recurse -Force`) } else { await exec.exec(`mkdir -p ${dest}`) await exec.exec(`cp -avp ${src} ${dest}`) } core.endGroup(); } exports.cp = cp; function seg_fault(str) { const regex = /Segmentation fault \(core dumped\)/gm; let m; while ((m = regex.exec(str)) !== null) { // This is necessary to avoid infinite loops with zero-width matches if (m.index === regex.lastIndex) { regex.lastIndex++; } if (m.length >= 2) { return true; } } return false; } function parseForError(content) { try { let result = ""; const has_seg_fault = seg_fault(content); if (content.includes("tmbuild:") && !content.includes("tmbuild: [delete-dirs] Folder")) { if (!content.includes("tmbuild: No unit-test executable found.")) { // tmbuild error: const regex_tm = /^tmbuild:(.*)$/gm; while ((m = regex_tm.exec(content)) !== null) { // This is necessary to avoid infinite loops with zero-width matches if (m.index === regex_tm.lastIndex) { regex_tm.lastIndex++; } if (m.length >= 2) { core.error(m[0].trim()); result += `${m[0].trim()}\n` } else { result += "tmbuild: failed\n"; } } } } if (content.includes("docgen:")) { // docgen error: const regex_doc = /docgen:(.*)cannot resolve(.*)$/gm; while ((m = regex_doc.exec(content)) !== null) { if (m.index === regex_doc.lastIndex) { regex_doc.lastIndex++; } if (m.length >= 2) { core.error(m[0].trim()); result += `error: ${m[0].trim()}\n` } else { result += "docgen: failed\n"; } } const regex_docgen_missing = /docgen:(.*)missing(.*)$/gm; while ((m = regex_docgen_missing.exec(content)) !== null) { if (m.index === regex_docgen_missing.lastIndex) { regex_docgen_missing.lastIndex++; } if (m.length >= 2) { core.warning(m[0].trim()); result += `warning: ${m[0].trim()}\n` } else { result += "docgen: failed\n"; } } } const regex_err = /error [aA-zZ][0-9]+:(.*)|(.*)error:(.*)|(.*)Error:(.*)|(.*)error :(.*)|(.*)Error :(.*)/gm; while ((m = regex_err.exec(content)) !== null) { // This is necessary to avoid infinite loops with zero-width matches if (m.index === regex_err.lastIndex) { regex_err.lastIndex++; } if (m[1] != undefined && m[2] != undefined) { core.error(`file:${m[1].trim()}\nerror: ${m[2].trim()}\n`) result += `file:\`${m[1].trim()}\`error: \`${m[2].trim()}\`\n` } else { core.error(`${m[0].trim()}\n`) result += `error:${m[0].trim()}\n` } } return result; } catch { return "[tmbuild-action] error parsing error!\n"; } } exports.parseForError = parseForError; function parseForWarnings(content) { try { let result = ""; const regex_war = /warning [aA-zZ][0-9]+:(.*)|(.*)warning:(.*)|(.*)Warning:(.*)|(.*)warning :(.*)|(.*)Warning :(.*)/gm; while ((m = regex_war.exec(content)) !== null) { // This is necessary to avoid infinite loops with zero-width matches if (m.index === regex_war.lastIndex) { regex_war.lastIndex++; } if (m[1] != undefined && m[2] != undefined) { core.warning(`file:${m[1].trim()}\nwarning: ${m[2].trim()}\n`); result += `file:\`${m[1].trim()}\`warning: \`${m[2].trim()}\`\n` } else { core.warning(`${m[0].trim()}\n`) result += `warning:${m[0].trim()}\n`; } } return result; } catch { return "[tmbuild-action] error parsing warnings!\n"; } } exports.parseForWarnings = parseForWarnings; async function hash(file) { let myOutput = ''; let myError = ''; const options = {}; options.listeners = { stdout: (data) => { myOutput += data.toString(); }, stderr: (data) => { myError += data.toString(); } }; options.silent = !core.isDebug(); try { if (!fs.existsSync(file)) throw new Error(`Error: Could not find ${file}`); await exec.exec(`git hash-object ${file}`, [], options); return myOutput; } catch (e) { core.warning(`[tmbuild-action] There was an error with git hash-object ${file}`); throw new Error(e.message); } } exports.hash = hash;
34.977273
128
0.467836
9970fafbb27ca4ff9dcc4b44185482139e3d9a45
4,057
js
JavaScript
src/commands/moderation/ModerationsCommand.js
Alex0622/modbot
414de619ea157d34013be2a0c916b7754b2857f8
[ "MIT" ]
1
2021-11-24T14:47:06.000Z
2021-11-24T14:47:06.000Z
src/commands/moderation/ModerationsCommand.js
ItzDolfiz/modbot
f6d0fc79d12e3222394b2e567ce05ab72b13f221
[ "MIT" ]
null
null
null
src/commands/moderation/ModerationsCommand.js
ItzDolfiz/modbot
f6d0fc79d12e3222394b2e567ce05ab72b13f221
[ "MIT" ]
null
null
null
const Command = require('../../Command'); const {MessageEmbed} = require('discord.js'); const util = require('../../util'); const User = require('../../User'); const Moderation = require('../../Moderation'); /** * number of moderations that will be displayed on a single page. (3-25) * @type {number} */ const moderationsPerPage = 20; class ModerationsCommand extends Command { static description = 'List all moderations for a user'; static usage = '<@user|userId>'; static names = ['moderations','modlog','modlogs']; static userPerms = ['VIEW_AUDIT_LOG']; static modCommand = true; static supportsSlashCommands = true; static supportedContextMenus = { USER: true } async execute() { let user, userID; if (this.source.isInteraction) { user = this.options.getUser('user', false); userID = user.id; } else { userID = this.options.getString('userID', false); if (!userID) { return this.sendUsage(); } user = await (new User(userID, this.bot)).fetchUser(); if (!user) { return this.sendUsage(); } } const moderations = await this.database.queryAll('SELECT * FROM moderations WHERE userid = ? AND guildid = ?', [userID, this.source.getGuild().id]); if (moderations.length === 0) { return this.reply({ ephemeral: !(this.options.getBoolean('public-reply') ?? false) }, new MessageEmbed() .setColor(util.color.green) .setAuthor(`Moderations for ${user.tag}`, user.avatarURL()) .setDescription('No moderations') ); } await this.multiPageResponse(async ( index) => { const start = index * moderationsPerPage; let end = (index + 1) * moderationsPerPage; if (end > moderations.length) end = moderations.length; const embed = new MessageEmbed() .setColor(util.color.orange) .setAuthor(`Moderations for ${user.tag}`, user.avatarURL()); for (const /** @type {Moderation} */ data of moderations.slice(start, end)) { let text = ''; if (data.action === 'strike') { text += `Strikes: ${data.value}\n`; } else if (data.action === 'pardon') { text += `Pardoned Strikes: ${-data.value}\n`; } if (data.expireTime) { text += `Duration: ${util.secToTime(data.expireTime - data.created)}\n`; } if (data.moderator) { text += `Moderator: <@!${data.moderator}>\n`; } const limit = 6000 / moderationsPerPage - text.length; text += `Reason: ${data.reason.length < limit ? data.reason : data.reason.slice(0, limit - 3) + '...'}`; embed.addField(`${data.action.toUpperCase()} [#${data.id}] - ${(new Date(data.created*1000)).toUTCString()}`, text); } return embed .setAuthor(`Moderation ${start + 1} to ${end} for ${user.tag} | total ${moderations.length}`, user.avatarURL()); }, Math.ceil(moderations.length / moderationsPerPage), 60000, !(this.options.getBoolean('public-reply') ?? false)); } static getOptions() { return [{ name: 'user', type: 'USER', description: 'User', required: true, },{ name: 'public-reply', type: 'BOOLEAN', description: 'Show reply publicly to all other users in this channel', required: false, }]; } parseOptions(args) { return [ { name: 'userID', type: 'STRING', value: util.userMentionToId(args[0]), } ]; } } module.exports = ModerationsCommand;
32.98374
156
0.516884
9971d2991f6e7f52dd6ddc54bdeda79592b28427
2,676
js
JavaScript
openjdk11/test/nashorn/script/assert.js
iootclab/openjdk
b01fc962705eadfa96def6ecff46c44d522e0055
[ "Apache-2.0" ]
2
2018-06-19T05:43:32.000Z
2018-06-23T10:04:56.000Z
openjdk11/test/nashorn/script/assert.js
iootclab/openjdk
b01fc962705eadfa96def6ecff46c44d522e0055
[ "Apache-2.0" ]
null
null
null
openjdk11/test/nashorn/script/assert.js
iootclab/openjdk
b01fc962705eadfa96def6ecff46c44d522e0055
[ "Apache-2.0" ]
null
null
null
/* * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /** * This is not a test - but a framework to run other tests. * * @subtest */ // Assert is TestNG's Assert class Object.defineProperty(this, "Assert", { configurable: true, enumerable: false, writable: true, value: Packages.org.testng.Assert }); // fail function to call TestNG Assert.fail Object.defineProperty(this, "fail", { configurable: true, enumerable: false, writable: true, // 'error' is optional. if present it has to be // an ECMAScript Error object or java Throwable object value: function (message, error) { var throwable = null; if (typeof error != 'undefined') { if (error instanceof java.lang.Throwable) { throwable = error; } else if (error.nashornException instanceof java.lang.Throwable) { throwable = error.nashornException; } } if (throwable != null) { // call the fail version that accepts Throwable argument Assert.fail(message, throwable); } else { // call the fail version that accepts just message Assert.fail(message); } } }); Object.defineProperty(this, "printError", { configurable: true, enumerable: false, writable: true, value: function (e) { var msg = e.message; var str = e.name + ':'; if (e.lineNumber > 0) { str += e.lineNumber + ':'; } if (e.columnNumber > 0) { str += e.columnNumber + ':'; } str += msg.substring(msg.indexOf(' ') + 1); print(str); } });
32.240964
79
0.636024
997240e7c65d18a4e09243661b2effe23e259c89
2,986
js
JavaScript
todomvc/app.js
ustbhuangyi/vue-3.x-demos
e7a2473620572be3fe39b5325e18394e3aaeabf6
[ "MIT" ]
103
2019-10-12T05:45:53.000Z
2021-03-24T10:42:18.000Z
todomvc/app.js
ustbhuangyi/vue-3.x-demos
e7a2473620572be3fe39b5325e18394e3aaeabf6
[ "MIT" ]
4
2019-10-12T05:42:25.000Z
2021-05-10T17:16:26.000Z
todomvc/app.js
ustbhuangyi/vue-3.x-demos
e7a2473620572be3fe39b5325e18394e3aaeabf6
[ "MIT" ]
17
2019-10-12T07:28:26.000Z
2021-05-08T07:21:45.000Z
import { filters, todoStorage, pluralize } from './util' import { compile, h, createApp, onMounted, onUnmounted, reactive, computed, effect, watch } from '@vue/vue' const RootComponent = { render () { return h(TodoComp) } } const TodoComp = { render: compile(document.getElementById('todo-template').innerHTML), setup () { const state = reactive({ todos: todoStorage.fetch(), editedTodo: null, newTodo: '', beforeEditCache: '', visibility: 'all', remaining: computed(() => { return filters.active(state.todos).length }), remainingText: computed(() => { return ` ${pluralize(state.remaining)} left` }), filteredTodos: computed(() => { return filters[state.visibility](state.todos) }), allDone: computed({ get: function () { return state.remaining === 0 }, set: function (value) { state.todos.forEach((todo) => { todo.completed = value }) } }) }) watch(effect(() => { todoStorage.save(state.todos) }), { deep: true }) onMounted(() => { window.addEventListener('hashchange', onHashChange) onHashChange() }) onUnmounted(() => { window.removeEventListener('hashchange', onHashChange) }) function onHashChange () { const visibility = window.location.hash.replace(/#\/?/, '') if (filters[visibility]) { state.visibility = visibility } else { window.location.hash = '' state.visibility = 'all' } } function onNewTodoKeyup (event) { if (event.code === 'Enter') { addTodo() } } function onEditKeyup (event, todo) { if (event.code === 'Enter') { doneEdit(todo) } else if (event.code === 'Escape') { cancelEdit(todo) } } function addTodo () { const value = state.newTodo && state.newTodo.trim() if (!value) { return } state.todos.push({ id: todoStorage.uid++, title: value, completed: false }) state.newTodo = '' } function removeTodo (todo) { state.todos.splice(state.todos.indexOf(todo), 1) } function editTodo (todo) { state.beforeEditCache = todo.title state.editedTodo = todo } function doneEdit (todo) { if (!state.editedTodo) { return } state.editedTodo = null todo.title = todo.title.trim() if (!todo.title) { removeTodo(todo) } } function cancelEdit (todo) { state.editedTodo = null todo.title = state.beforeEditCache } function removeCompleted () { state.todos = filters.active(state.todos) } return { state, onNewTodoKeyup, onEditKeyup, removeTodo, editTodo, doneEdit, removeCompleted } } } createApp().mount(RootComponent, '#app')
21.79562
107
0.550234
9972f16fd9cc0cb32abf89e1f57b5610e339ef02
1,372
js
JavaScript
db/seeds/dev/projects.js
AdamMescher/palette-picker
fabf0041657c3a23a6e8f88feb6d944eb926ec81
[ "MIT" ]
null
null
null
db/seeds/dev/projects.js
AdamMescher/palette-picker
fabf0041657c3a23a6e8f88feb6d944eb926ec81
[ "MIT" ]
30
2017-11-27T21:52:39.000Z
2018-03-06T17:19:44.000Z
db/seeds/dev/projects.js
AdamMescher/palette-picker
fabf0041657c3a23a6e8f88feb6d944eb926ec81
[ "MIT" ]
1
2017-11-27T20:09:29.000Z
2017-11-27T20:09:29.000Z
exports.seed = (knex, Promise) => { return knex('palettes').del() .then(() => knex('projects').del()) .then(() => { return Promise.all([ knex('projects').insert({ name: 'popular palettes' }, 'id') .then(paper => { console.log('CREATED PALETTES'); return knex('palettes').insert([ { project_id: 7, name: 'retro', color_one: '7DBEA5', color_two: 'F1E0B1', color_three: 'EE9D31', color_four: 'F26C1A', color_five: '5A392B' }, { project_id: 7, name: 'cold sunset', color_one: '8F9DB2', color_two: 'B0BAC8', color_three: 'F8DFBD', color_four: 'F3BB9A', color_five: 'CD998B' }, { project_id: 7, name: 'Flat UI', color_one: '2C3E50', color_two: 'E74C3C', color_three: 'ECF0F1', color_four: '3498DB', color_five: '2980B9' } ]) }) .then(() => console.log('Seeding completed')) .catch(error => `Error seeding data: ${error}`) ]); }) .catch(error => console.log(`Error seeding data: ${error}`)); };
29.191489
65
0.425656
9972f5c29308b787a12fb2213cd8c3f917376cec
801
js
JavaScript
js-test-suite/testsuite/157c256fbd42760257568a7c1b2f9567.js
hao-wang/Montage
d1c98ec7dbe20d0449f0d02694930cf1f69a5cea
[ "MIT" ]
16
2020-03-23T12:53:10.000Z
2021-10-11T02:31:50.000Z
js-test-suite/testsuite/157c256fbd42760257568a7c1b2f9567.js
hao-wang/Montage
d1c98ec7dbe20d0449f0d02694930cf1f69a5cea
[ "MIT" ]
null
null
null
js-test-suite/testsuite/157c256fbd42760257568a7c1b2f9567.js
hao-wang/Montage
d1c98ec7dbe20d0449f0d02694930cf1f69a5cea
[ "MIT" ]
1
2020-08-17T14:06:59.000Z
2020-08-17T14:06:59.000Z
load("201224b0d1c296b45befd2285e95dd42.js"); load("19d7bc83becec11ee32c3a85fbc4d93d.js"); function test() { if (getBuildConfiguration()["pointer-byte-size"] == 4) { let big_array = ctypes.int32_t.array(0xfffffff); assertRangeErrorMessage(() => { big_array.array(0xfffffff); }, "array size does not fit in size_t"); } else if (getBuildConfiguration()["pointer-byte-size"] == 8) { let big_array = ctypes.int32_t.array(0xfffffff); assertRangeErrorMessage(() => { big_array.array(0xfffffff); }, "array size does not fit in JavaScript number"); assertRangeErrorMessage(() => { big_array.array(0xfffffffff); }, "array size does not fit in size_t"); } } if (typeof ctypes === "object") test();
40.05
76
0.627965
99735157a711d91b201af5cc3e56d26046f6d801
1,128
js
JavaScript
src/playground/app-template2.js
Git-Grobe/Indecision-app
e49bfeb663dfeec4d59f48c8f21d3a4fd60aa87d
[ "MIT" ]
null
null
null
src/playground/app-template2.js
Git-Grobe/Indecision-app
e49bfeb663dfeec4d59f48c8f21d3a4fd60aa87d
[ "MIT" ]
null
null
null
src/playground/app-template2.js
Git-Grobe/Indecision-app
e49bfeb663dfeec4d59f48c8f21d3a4fd60aa87d
[ "MIT" ]
null
null
null
console.log('App.js is running!!!!!!!!'); // JSX - JavaScript XML const app = { title: 'Some Title', subtitle: 'Some subtitle', options: ['One' , 'Two'] }; const template = ( <div> <h1>{app.title.toUpperCase() + '!'}</h1> {app.subtitle && <p>{app.subtitle + '!'} </p>} <p>{app.options.length > 0 ? 'Here are your options' : 'No options'}</p> <ol> <li>ah</li> <li>no</li> <li>oh</li> <li>ya</li> </ol> </div> ); const userName = 'Scott'; const userAge = 35; const userLocation = 'Durham' const user = { name: 'Scott', age: 35, location: 'Durham' }; function getLocation(location) { if (location) { return <p>Location: {'Mercedes-Benz of ' + location}</p>; } } const template2 = ( <div> <h1>{user.name ? user.name.toUpperCase() + '!' : 'Anonymous'}</h1> {(user.age && user.age >= 18) && <p>Age: {user.age + 1}</p>} {getLocation(user.location)} </div> ); const appRoot = document.getElementById('app'); ReactDOM.render(template, appRoot);
20.509091
80
0.514184
997392be1bfe703e292a9e13efb0bdc09bc75fa5
2,784
js
JavaScript
lib/planner/test-planner.js
leroy-dias/simulato
174e625ed567e0e6cb95abc7349ac78c00813637
[ "Apache-2.0" ]
57
2018-03-23T06:15:11.000Z
2022-03-16T02:57:14.000Z
lib/planner/test-planner.js
leroy-dias/simulato
174e625ed567e0e6cb95abc7349ac78c00813637
[ "Apache-2.0" ]
133
2018-03-14T15:42:23.000Z
2022-02-26T03:48:48.000Z
lib/planner/test-planner.js
leroy-dias/simulato
174e625ed567e0e6cb95abc7349ac78c00813637
[ "Apache-2.0" ]
7
2018-09-06T19:46:35.000Z
2021-02-15T20:28:30.000Z
'use strict'; const Emitter = require('../util/emitter.js'); const config = require('../util/config/config-handler.js'); const plannerEventDispatch = require('./planner-event-dispatch/planner-event-dispatch.js'); let testPlanner; module.exports = testPlanner = { _algorithm: null, generateTests() { testPlanner._algorithm = config.get('plannerAlgorithm'); switch (testPlanner._algorithm) { case 'actionTree': testPlanner._generateActionTree(); break; default: testPlanner._generateStateSpace(); } }, _generateActionTree() { testPlanner.emit('testPlanner.createActionTreePlans', function(error, plans, discoveredActions) { if (error) { throw error; } testPlanner.emit('testPlanner.reduceToMinimumSetOfPlans', plans, testPlanner._algorithm, function(error, finalPlans) { if (error) { throw error; } const testLength = config.get('plannerTestLength'); if (testLength) { testPlanner.emit('offlineReplanning.replan', finalPlans, discoveredActions, testPlanner._algorithm, { testLength, }, ); } else { testPlanner .emit('planner.planningFinished', finalPlans, discoveredActions, testPlanner._algorithm); } }); }); }, _generateStateSpace() { const plans = []; testPlanner.emit('testPlanner.createForwardStateSpaceSearchHeuristicPlans', function(error, plan, done, discoveredActions) { if (error) { throw error; } else if (plan) { plans.push(plan); } else { testPlanner.emit( 'testPlanner.reduceToMinimumSetOfPlans', plans, testPlanner._algorithm, function(error, finalPlans) { if (error) { throw error; } const testLength = config.get('plannerTestLength'); if (testLength) { testPlanner.emit('offlineReplanning.replan', finalPlans, discoveredActions, testPlanner._algorithm, { testLength, }, ); } else { testPlanner .emit('planner.planningFinished', finalPlans, discoveredActions, testPlanner._algorithm); } }); } }); }, }; Emitter.mixIn(testPlanner, plannerEventDispatch);
31.280899
113
0.515445
997431e01107615c3a75c5ce83bcdfd36f80045d
5,986
js
JavaScript
components/Nav/index.js
fu4303/portfolio-temp2
9b52fcad6c346979bafae9c9debe099bfc158b87
[ "MIT" ]
null
null
null
components/Nav/index.js
fu4303/portfolio-temp2
9b52fcad6c346979bafae9c9debe099bfc158b87
[ "MIT" ]
29
2021-04-04T16:18:26.000Z
2021-08-03T10:37:39.000Z
components/Nav/index.js
fu4303/portfolio-temp2
9b52fcad6c346979bafae9c9debe099bfc158b87
[ "MIT" ]
null
null
null
import React from "react"; import styled, { css } from "styled-components"; import { Flex, Box } from "rebass"; import { useLocation } from "@reach/router"; import Link from "../Link"; import Icon from "../Icon"; import { ExternalLink as LinkExternal, Menu, X, Twitter } from "react-feather"; import IsScrolled from "../WithIsScrolled"; import Text from "../Text"; import Heading from "../Heading"; import Layout from "../Layout"; import Logo from "./Logo"; import { createToggle } from "../Toggle"; import MobileOnly from "../MobileOnly"; import DesktopOnly from "../DesktopOnly"; const { Toggle, State, Display } = createToggle("mobile-menu"); const MobileMenu = styled(Flex)` align-items: center; justify-content: center; background: #fff; width: 100%; height: 100%; `; const NavItem = styled(props => { const location = useLocation(); const active = location.pathname.indexOf(props.href) === 0; return ( <Box mr={4} className={props.className}> <Link itemProp="url" href={props.href}> <Text color={active ? "text" : "#666"} fontWeight={active ? "bold" : "normal"} itemProp="name" > {props.title} </Text> </Link> </Box> ); })` &:last-of-type { margin-right: 0; } `; const MobileNavItem = props => ( <Box p={3} onClick={props.onClick}> <Link href={props.href}> <Text color="#333" as="div" fontSize={4} fontWeight="bold"> {props.title} </Text> </Link> </Box> ); const Wrapper = styled(Flex).attrs({ as: "nav" })` position: fixed; top: 0; left: 0; width: 100%; background: ${props => props.theme.colors.background}; z-index: 9; transition: background 250ms ease-in-out, box-shadow 250ms ease-in-out; .no-js & { background: #fff; box-shadow: rgba(0, 0, 0, 0.15) 0px 1px 4px 0px; } @media screen and (max-width: ${props => props.theme.breakpoints[0]}) { background: #fff; box-shadow: rgba(0, 0, 0, 0.15) 0px 1px 4px 0px; } ${props => props.isScrolled && css` background: #fff; box-shadow: rgba(0, 0, 0, 0.15) 0px 1px 4px 0px; `}; `; class Nav extends React.Component<{}> { menu: ?HTMLInputElement; closeMenu = () => { if (this.menu) this.menu.checked = false; }; render() { return ( <IsScrolled> {({ isScrolled }) => ( <> <Wrapper isScrolled={isScrolled} py={3}> <Layout py={1} width={1}> <Flex alignItems="center" justifyContent={["center", "space-between"]} > <Logo /> <DesktopOnly itemScope itemType="http://www.schema.org/SiteNavigationElement" > <NavItem href="https://notes.mxstbr.com" title="Notes" /> <NavItem href="/thoughts" title="Blog" /> <NavItem href="/appearances" title="Appearances" /> <NavItem href="/oss" title="OSS" /> {/* <NavItem href="/audits" title="Audits" /> */} </DesktopOnly> </Flex> </Layout> </Wrapper> <MobileOnly css={{ position: "fixed", top: "21px", right: "16px", zIndex: 10 }} > <Toggle> <Icon> <Menu style={{ verticalAlign: "bottom" }} /> </Icon> </Toggle> </MobileOnly> <MobileOnly> <State ref={elem => (this.menu = elem)} /> <Display css={{ position: "fixed", top: 0, bottom: 0, left: 0, right: 0, zIndex: 11 }} > <Toggle> <Icon css={{ position: "absolute", right: "16px", top: "21px" }} > <X style={{ verticalAlign: "bottom" }} /> </Icon> </Toggle> <MobileMenu flexDirection="column"> <MobileNavItem href="/" title="Home" onClick={this.closeMenu} /> <MobileNavItem href="https://notes.mxstbr.com" onClick={this.closeMenu} title="Notes" /> <MobileNavItem href="/thoughts" onClick={this.closeMenu} title="Blog" /> <MobileNavItem href="/appearances" title="Appearances" onClick={this.closeMenu} /> <MobileNavItem href="/oss" title="OSS" onClick={this.closeMenu} /> {/* <MobileNavItem href="/audits" title="Audits" onClick={this.closeMenu} /> */} <MobileNavItem href="https://twitter.com/mxstbr" onClick={this.closeMenu} title={ <> @mxstbr{" "} <Icon ml={1}> <Twitter size="1em" /> </Icon> </> } /> </MobileMenu> </Display> </MobileOnly> </> )} </IsScrolled> ); } } export default Nav;
28.369668
79
0.42733
99744c017c9e87d54fac4007de3a9aedb40f42f0
289
js
JavaScript
mysite/staticfiles/js/data-table-jspdf.js
Rare-Technology/IF-Financial-Statements
ce2a336366abe7a0554bfd2842a8f2c7676358b4
[ "MIT" ]
null
null
null
mysite/staticfiles/js/data-table-jspdf.js
Rare-Technology/IF-Financial-Statements
ce2a336366abe7a0554bfd2842a8f2c7676358b4
[ "MIT" ]
8
2022-02-04T15:42:31.000Z
2022-02-16T06:27:53.000Z
mysite/staticfiles/js/data-table-jspdf.js
Rare-Technology/IF-Financial-Statements
ce2a336366abe7a0554bfd2842a8f2c7676358b4
[ "MIT" ]
null
null
null
$.fn.dataTable.ext.buttons.jspdf = { text: 'PDF', action: function ( e, dt, node, config ) { // let doc = jspdf.jsPDF('l'); // doc.autoTable({ // html: // }) let id = '#' + dt.context[0].ntable.id; console.log(config.id); } };
24.083333
47
0.463668
9974abba9eb11671d79dd37807d4caeb7abf5145
1,307
js
JavaScript
server.js
vearutop/http-mirror
1375241b281f091d100c320d0d507fe271b7e137
[ "MIT" ]
null
null
null
server.js
vearutop/http-mirror
1375241b281f091d100c320d0d507fe271b7e137
[ "MIT" ]
null
null
null
server.js
vearutop/http-mirror
1375241b281f091d100c320d0d507fe271b7e137
[ "MIT" ]
null
null
null
var port = 1337, server, clientCallback = function (socket) { var headerSent = false, timer, chunkId = 0, showChunks = false; socket.on('data', function (data) { if ((''+data).indexOf('show_chunks') != -1) { showChunks = true; } if (!headerSent) { socket.write('HTTP/1.1 200 OK\r\nContent-Type: text/plain\r\n\r\n'); headerSent = true; } else { ++chunkId; if (showChunks) { socket.write('::chunk_' + chunkId + '::'); } } if (timer) { clearTimeout(timer); } socket.write(data); timer = setTimeout(function(){socket.end();}, 1000); }); }; process.argv.forEach(function (val, index, array) { val = val.split('='); if (val[0] == 'tls') { var options = { pfx: require('fs').readFileSync('server.pfx') }; server = require('tls').createServer(options, clientCallback); } else if (val[0] == 'port') { port = val[1]; } }); if (!server) { server = require('net').createServer(clientCallback); } server.listen(port);
24.203704
84
0.45065
9974d0f013052b88dcc2dffb6c097a10afd401bc
485
js
JavaScript
resources/js/models/Invitation.js
ikoncept/fabriq
49172dc0356771b17fa7960b0532071a875bfb31
[ "MIT" ]
1
2021-10-04T13:48:17.000Z
2021-10-04T13:48:17.000Z
resources/js/models/Invitation.js
ikoncept/fabriq
49172dc0356771b17fa7960b0532071a875bfb31
[ "MIT" ]
1
2021-12-16T15:04:28.000Z
2021-12-16T15:04:28.000Z
resources/js/models/Invitation.js
ikoncept/fabriq
49172dc0356771b17fa7960b0532071a875bfb31
[ "MIT" ]
2
2021-12-14T12:35:33.000Z
2021-12-15T12:34:07.000Z
import axios from 'axios' export default { endpoint: '/api/admin/invitations/', async show(id, payload) { const { data } = await axios.get(this.endpoint + id, payload) return data }, async store (id, payload) { const { data } = await axios.post(this.endpoint + id, payload) return data }, async destroy (id, payload) { const { data } = await axios.delete(this.endpoint + id, payload) return data } }
19.4
72
0.579381
9975ee78168ea5a76a069b55c367557a4e10e6d7
136
js
JavaScript
generators/cli/templates/_minimist.js
ironSource/node-generator-nom
ac0a45c7c45bff1e420e31485d8e735b98d8ca6c
[ "MIT" ]
14
2015-10-07T21:52:51.000Z
2017-06-27T13:12:32.000Z
generators/cli/templates/_minimist.js
ironSource/node-generator-nom
ac0a45c7c45bff1e420e31485d8e735b98d8ca6c
[ "MIT" ]
18
2015-10-19T09:58:11.000Z
2017-12-06T15:51:38.000Z
generators/cli/templates/_minimist.js
ironSource/node-generator-nom
ac0a45c7c45bff1e420e31485d8e735b98d8ca6c
[ "MIT" ]
null
null
null
#!/usr/bin/env node 'use strict'; const <%= camelModuleName %> = require('./') , argv = require('minimist')(process.argv.slice(2))
22.666667
55
0.625
997629e92fc4405f5bfc2a7f7e5ca659916fb0aa
59
js
JavaScript
src/index.js
michaeljsmith/extension-point
e167cc74ed4bb7f7fc7d81174d44925cfdcab7bd
[ "MIT" ]
null
null
null
src/index.js
michaeljsmith/extension-point
e167cc74ed4bb7f7fc7d81174d44925cfdcab7bd
[ "MIT" ]
null
null
null
src/index.js
michaeljsmith/extension-point
e167cc74ed4bb7f7fc7d81174d44925cfdcab7bd
[ "MIT" ]
null
null
null
// @flow exports.OpenObject = require('./OpenObject.js');
14.75
48
0.677966
9976889821290f795f119db4d4e065a090528bcf
12,379
js
JavaScript
server.js
chocolatechimpcookie/cfc_vacantlots
ca292fd93f69008dc04b9516ad661a1e3b83ed42
[ "MIT" ]
null
null
null
server.js
chocolatechimpcookie/cfc_vacantlots
ca292fd93f69008dc04b9516ad661a1e3b83ed42
[ "MIT" ]
1
2018-08-29T14:04:48.000Z
2018-09-05T23:28:26.000Z
server.js
chocolatechimpcookie/cfc_vacantlots
ca292fd93f69008dc04b9516ad661a1e3b83ed42
[ "MIT" ]
2
2018-08-15T23:56:17.000Z
2018-08-29T13:54:01.000Z
const express = require('express') const rp = require('request-promise') const fetch = require('node-fetch') const bodyParser = require('body-parser') const jwt = require('jsonwebtoken') const passport = require('passport') const passportJWT = require('passport-jwt') const ExtractJwt = passportJWT.ExtractJwt const JwtStrategy = passportJWT.Strategy const bcrypt = require('bcryptjs') const CronJob = require('cron').CronJob const { User, AbandonedLot, Bid, Favorite } = require('./models.js') let jwtOptions = {} jwtOptions.jwtFromRequest = ExtractJwt.fromAuthHeader() jwtOptions.secretOrKey = 'tasmanianDevil' const strategy = new JwtStrategy(jwtOptions, (jwt_payload, next) => { //console.log('payload received', jwt_payload) User.findById(jwt_payload.id, (err, user) => { if (user) { next(null, user) } else { next(null, false) } }) }) passport.use(strategy) const app = express() app.use(bodyParser.json()) app.use(bodyParser.urlencoded({ extended: true })) app.use(express.static('public')) //global Lots array filled with lots for sending to user via /map URL Lots = [] LotUpdateTime = 0 const range = (lo, hi) => Array.from({ length: hi - lo }, (_, i) => lo + i) const url_front = 'http://data.ci.newark.nj.us/api/action/datastore_search?offset=' const url_back = '&resource_id=796e2a01-d459-4574-9a48-23805fe0c3e0' //Use the newark api to load the most recent abandoned properties and save them to database. //set up request to newark const fetchAllLots = async () => { try { console.log('requesting data from newark api') //get the total record count so that the full request can be made in parallel const lotBatchCount = parseInt( await rp(url_front + '0' + url_back).then(res => Math.ceil(JSON.parse(res).result.total/100)).catch(err => console.log(err)) ) //fetch urls const lotBatchPromises = range(0, lotBatchCount).map(offset => fetch(url_front + offset * 100 + url_back).then(res => res.json()).catch(err => console.log(err)) ) console.log('starting request') const lotBatches = await Promise.all(lotBatchPromises) return lotBatches } catch (err) { console.log(`Error: ${err}`) } } //start a request to the newark api const lotsRequest = () => { //execute the request fetchAllLots().then(lots => { if (lots.length === 0 || lots.some(set => set === undefined)) { console.log('newark api error, no action taken') } else { console.log('successful request') const records = lots.reduce((allLotsList,lotList) => allLotsList.concat(lotList.result.records),[]) //filter out lots without Long or Lat const usable_records = records.filter(record => record.Longitude && record.Latitude) //gather lots from database to compare to latest newark data AbandonedLot.find({}).exec() .then(lots => { let newLots = usable_records //if lots.length is 0 all lots will be new if (lots.length !== 0) { //filter to see which lots are new let hash = {} lots.forEach(lot => { hash[lot['lotID']] = true }) newLots = usable_records.filter(lot => { return hash[lot['Longitude'] + '' + lot['Latitude']] === undefined }) } console.log(newLots.length + ' new lots being added') const promises = newLots.map(record => { const item = { lotID: record['Longitude'] + '' + record['Latitude'], longitude: Number(record['Longitude']), latitude: Number(record['Latitude']), vitalStreetName: record['Vital Street Name'], vitalHouseNumber: record['Vital House Number'], ownerName: record['Owner Name'], ownerAddress: record['Owner Address'], classDesc: record['Class Desc'], zipcode: record['Zipcode'], netValue: record['NetValue'], lot: record['Lot'], block: record['Block'], cityState: record['City, State'] } const newLot = new AbandonedLot(item) return newLot.save() }) return Promise.all(promises) }) .then((lots) => { console.log('successfully updated database') //reset global lots array if (lots.length > 0) { Lots = [] } }) .catch(err => { console.log(err) }) } }) .catch(err => { console.log(err, 'newark api completely overloaded') }) } // AbandonedLot.remove({}, (err, data) => {}) // User.remove({}, (err, data) => {}) // Bid.remove({}, (err, data) => {}) // lotsRequest() //request lots from newark every 3 hrs const job = new CronJob({ cronTime: '0 */3 * * *', onTick: function() { lotsRequest() }, start: false, timeZone: 'America/New_York' }) job.start() //if lots collection is empty at startup request lots immediately AbandonedLot.count({}, (err, c) => { if (c === 0) { lotsRequest() } }) app.get('/', (req, res) => { res.sendFile(process.cwd() + '/public/index.html') }) //send time of last lot data update to front app.get('/date', (req, res) => { res.status(200).json(LotUpdateTime) }) //send lot data to front app.get('/map', (req, res) => { //if global Lots array isn't empty then no need to do another find, just send it if (Lots.length === 0) { AbandonedLot.find({}).exec() .then(lots => { if (lots) { Lots = lots.map(lot => { let newLot = Object.create(lot) delete newLot['__v'] delete newLot['_id'] return newLot }) LotUpdateTime = Date.now() res.status(200).json(Lots) } else { res.status(500).json('no lot data available') } }) .catch(err => { console.log(err) res.status(500).json('error executing find of lots') }) } else { res.status(200).json(Lots) } }) app.get('/loginstatus', passport.authenticate('jwt', { session: false }), (req, res) => { res.status(200).json({loggedIn: true, username: req.user.username}) }) app.get('/userinfo', passport.authenticate('jwt', { session: false }), (req, res) => { const user = req.user let favorites = null Favorite.find({username: req.user.username}).exec() .then(favs => { favorites = favs return Bid.find({username: req.user.username}).exec() }) .then(bids => { const userInfo = { firstname: user.firstname, lastname: user.lastname, username: user.username, email: user.email, phone: user.phone, bids: bids, favorites: favorites } res.status(200).json(userInfo) }) .catch(err => { console.log(err) res.status(500).json('error executing find on favorites/bids') }) }) app.get('/avgbid/:id', passport.authenticate('jwt', {session: false}), (req, res) => { Bid.find({lotID: req.params.id}).exec() .then(bids => { if (bids.length === 0) { res.status(200).json({bids: 0, avg: null}) } else { userHash = {} const uniqueUserBids = bids.slice().sort((a,b) => b.bidDate - a.bidDate) .filter(bid => userHash[bid.username] === undefined ? userHash[bid.username] = true : false) const avg = uniqueUserBids.reduce((total, bid) => total + bid.amount, 0) / uniqueUserBids.length res.status(200).json({bids: uniqueUserBids.length, avg: avg}) } }) .catch(err => { console.log(err) res.status(500).json('error executing find on bids') }) }) app.post('/register', (req, res) => { let validEmail = req.body.email ? (/^[^@]+@[^@]+\.[a-z]{2,25}/).test(req.body.email) : false if (req.body.firstname && req.body.lastname && req.body.username && req.body.password && validEmail && req.body.phone) { let item = { firstname : req.body.firstname, lastname : req.body.lastname, username : req.body.username, password : req.body.password, email : req.body.email, phone : req.body.phone } User.findOne({ username: req.body.username }, 'username', (err, user) => { if (err) { console.log(err) res.status(500).json({message:err}) } else if (user) { res.status(401).json({message:'username already in use'}) } else { const salt = bcrypt.genSaltSync(10) item.password = bcrypt.hashSync(item.password, salt) const user = new User(item) user.save() res.status(201).json({message:'success'}) } }) } else { res.status(401).json({message:'incomplete registration information'}) } }) app.post('/login', (req, res) => { if(req.body.username && req.body.password){ const username = req.body.username const password = req.body.password User.findOne({ username: username }, (err, user) => { if (err) { console.log(err) } else if (user) { if (bcrypt.compareSync(password, user.password)) { const payload = {id: user._id} const token = jwt.sign(payload, jwtOptions.secretOrKey) res.status(200).json({message: 'ok', token: token}) } else { res.status(401).json({message:'passwords did not match'}) } } else { res.status(401).json({message:'username not found'}) } }) } else { res.status(401).json({message:'incomplete login information'}) } }) app.post('/bid', passport.authenticate('jwt', { session: false }), (req, res) => { //is bid amount valid? if (isNaN(req.body.bid)) { res.status(400).json({message: 'invalid bid amount'}) } else { //is lotID valid? AbandonedLot.findOne({lotID: req.body.lotID}).exec() .then(lot => { if (lot === null) {throw 'lotID not found'} let item = { lotID: req.body.lotID, amount: Number(req.body.bid), username:req.user.username } const lotBid = new Bid(item) return lotBid.save() }) .then(() => { res.status(201).json({message: 'bid saved'}) }) .catch(err => { console.log(err) if (err === 'lotID not found') { res.status(403).json({message: 'lotID not found'}) } else { res.status(500).json({message: 'failed to save, try again'}) } }) } }) app.post('/favorite', passport.authenticate('jwt', { session: false }), (req, res) => { //check if lot already exists as a favorite of user Favorite.find({username: req.user.username}).exec() .then(favs => { if (favs.find(fav => fav.lotID === req.body.lotID) !== undefined) { throw 'already a favorite' } //is lotID valid? return AbandonedLot.findOne({lotID: req.body.lotID}).exec() }) .then(lot => { if (lot === null) {throw 'lotID not found'} let item = { lotID: req.body.lotID, username:req.user.username } const fav = new Favorite(item) return fav.save() }) .then(() => { res.status(201).json({message: 'favorite saved'}) }) .catch(err => { console.log(err) if (err === 'lotID not found') { res.status(403).json({message: 'lotID not found'}) } else if (err === 'already a favorite') { res.status(403).json({message: 'can\'t favorite a lot twice'}) } else { res.status(500).json({message: 'failed to save, try again'}) } }) }) app.delete('/favorite/:id', passport.authenticate('jwt', { session: false }), (req, res) => { //check if lot exists as a favorite of user Favorite.find({username: req.user.username}).exec() .then(favs => { const fav = favs.find(fav => fav.lotID === req.params.id) if (fav === undefined) { throw 'can\'t delete, not a favorite' } Favorite.remove({'_id': fav}).exec() }) .then(() => { res.status(204).json({message: 'successfully removed'}) }) .catch(err => { console.log(err) if (err === 'can\'t delete, not a favorite') { res.status(403).json({message: 'can\'t favorite a lot twice'}) } else { res.status(500).json({message: 'failed to save, try again'}) } }) }) const port = process.env.PORT || 3000; app.listen(port, () => { console.log('Listening on port ' + port) })
27.26652
130
0.584861
997759b5172c10eca6c30a199e334c11fc66b682
578
js
JavaScript
node_modules/sbis3-ws/View/Executor/_Expressions/AttrHelper.js
nikitabelotelov/coffee
63cd862b827337a373301677f02d341d59ce2485
[ "MIT" ]
null
null
null
node_modules/sbis3-ws/View/Executor/_Expressions/AttrHelper.js
nikitabelotelov/coffee
63cd862b827337a373301677f02d341d59ce2485
[ "MIT" ]
null
null
null
node_modules/sbis3-ws/View/Executor/_Expressions/AttrHelper.js
nikitabelotelov/coffee
63cd862b827337a373301677f02d341d59ce2485
[ "MIT" ]
null
null
null
/// <amd-module name="View/Executor/_Expressions/AttrHelper" /> define("View/Executor/_Expressions/AttrHelper", ["require", "exports"], function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function isAttr(string) { return string.indexOf('attr:') === 0; } exports.isAttr = isAttr; function checkAttr(attrs) { for (var key in attrs) { if (isAttr(key)) { return true; } } return false; } exports.checkAttr = checkAttr; });
30.421053
101
0.581315
9977f9d320f8a3d25e873cd273cec4802dd4bfe7
9,190
js
JavaScript
sdk/src/replicated-entity.js
rstento/akkaserverless-javascript-sdk
66a460879e716eaeff765ccd0e3732ad44a1b6c7
[ "Apache-2.0" ]
null
null
null
sdk/src/replicated-entity.js
rstento/akkaserverless-javascript-sdk
66a460879e716eaeff765ccd0e3732ad44a1b6c7
[ "Apache-2.0" ]
null
null
null
sdk/src/replicated-entity.js
rstento/akkaserverless-javascript-sdk
66a460879e716eaeff765ccd0e3732ad44a1b6c7
[ "Apache-2.0" ]
null
null
null
/* * Copyright 2021 Lightbend Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ const fs = require('fs'); const protobufHelper = require('./protobuf-helper'); const grpc = require('@grpc/grpc-js'); const protoLoader = require('@grpc/proto-loader'); const AkkaServerless = require('./akkaserverless'); const replicatedData = require('./replicated-data'); const support = require('./replicated-entity-support'); const replicatedEntityServices = new support.ReplicatedEntityServices(); /** * Options for creating a Replicated Entity. * * @typedef module:akkaserverless.replicatedentity.ReplicatedEntity~options * @property {array<string>} [includeDirs=["."]] The directories to include when looking up imported protobuf files. * @property {module:akkaserverless.replicatedentity.ReplicatedEntity~entityPassivationStrategy} [entityPassivationStrategy] Entity passivation strategy to use. * @property {module:akkaserverless.ReplicatedWriteConsistency} [replicatedWriteConsistency] Write consistency to use for this replicated entity. */ /** * Entity passivation strategy for a replicated entity. * * @typedef module:akkaserverless.replicatedentity.ReplicatedEntity~entityPassivationStrategy * @property {number} [timeout] Passivation timeout (in milliseconds). */ /** * A command handler callback. * * @callback module:akkaserverless.replicatedentity.ReplicatedEntity~commandHandler * @param {Object} command The command message, this will be of the type of the gRPC service call input type. * @param {module:akkaserverless.replicatedentity.ReplicatedEntityCommandContext} context The command context. * @returns {undefined|Object} The message to reply with, it must match the gRPC service call output type for this * command. */ /** * A state set handler callback. * * This is invoked whenever a new state is set on the Replicated Entity, to allow the state to be enriched with domain * specific properties and methods. This may be due to the state being set explicitly from a command handler on the * command context, or implicitly as the default value, or implicitly when a new state is received from the proxy. * * @callback module:akkaserverless.replicatedentity.ReplicatedEntity~onStateSetCallback * @param {module:akkaserverless.replicatedentity.ReplicatedData} state The Replicated Data state that was set. * @param {string} entityId The id of the entity. */ /** * A callback that is invoked to create a default value if the Akka Serverless proxy doesn't send an existing one. * * @callback module:akkaserverless.replicatedentity.ReplicatedEntity~defaultValueCallback * @param {string} entityId The id of the entity. * @returns {Object} The default value to use for this entity. */ // Callback definitions for akkaserverless.replicatedentity.* /** * Generator for default values. * * This is invoked by get when the current map has no Replicated Data defined for the key. * * If this returns a Replicated Data object, it will be added to the map. * * Care should be taken when using this, since it means that the get method can trigger elements to be created. If * using default values, the get method should not be used in queries where an empty value for the Replicated Data * means the value is not present. * * @callback module:akkaserverless.replicatedentity.ReplicatedMap~defaultValueCallback * @param {module:akkaserverless.Serializable} key The key the default value is being generated for. * @returns {undefined|module:akkaserverless.replicatedentity.ReplicatedData} The default value, or undefined if no default value should be returned. */ /** * Callback for handling elements iterated through by {@link module:akkaserverless.replicatedentity.ReplicatedMap#forEach}. * * @callback module:akkaserverless.replicatedentity.ReplicatedMap~forEachCallback * @param {module:akkaserverless.replicatedentity.ReplicatedData} value The Replicated Data value. * @param {module:akkaserverless.Serializable} key The key. * @param {module:akkaserverless.ReplicatedMap} This map. */ /** * Callback for handling elements iterated through by {@link module:akkaserverless.replicatedentity.ReplicatedSet#forEach}. * * @callback module:akkaserverless.replicatedentity.ReplicatedSet~forEachCallback * @param {module:akkaserverless.Serializable} element The element. */ /** * A Replicated Entity. * * @memberOf module:akkaserverless.replicatedentity * @implements module:akkaserverless.Entity */ class ReplicatedEntity { /** * Create a Replicated Entity. * * @constructs * @param {string|string[]} desc The file name of a protobuf descriptor or set of descriptors containing the * Replicated Entity service. * @param {string} serviceName The fully qualified name of the gRPC service that this Replicated Entity implements. * @param {string} entityType The entity type name, used to namespace entities of different Replicated Data * types in the same service. * @param {module:akkaserverless.replicatedentity.ReplicatedEntity~options=} options The options for this entity. */ constructor(desc, serviceName, entityType, options) { /** * @type {module:akkaserverless.replicatedentity.ReplicatedEntity~options} */ this.options = { ...{ includeDirs: ['.'], entityType: entityType, }, ...options, }; if (!entityType) throw Error('EntityType must contain a name'); const allIncludeDirs = protobufHelper.moduleIncludeDirs.concat( this.options.includeDirs, ); this.root = protobufHelper.loadSync(desc, allIncludeDirs); /** * @type {string} */ this.serviceName = serviceName; // Eagerly lookup the service to fail early /** * @type {protobuf.Service} */ this.service = this.root.lookupService(serviceName); const packageDefinition = protoLoader.loadSync(desc, { includeDirs: allIncludeDirs, }); this.grpc = grpc.loadPackageDefinition(packageDefinition); /** * The command handlers. * * The names of the properties must match the names of the service calls specified in the gRPC descriptor for this * Replicated Entity service. * * @type {Object.<string, module:akkaserverless.replicatedentity.ReplicatedEntity~commandHandler>} */ this.commandHandlers = {}; /** * A callback that is invoked whenever the Replicated Data state is set for this Replicated Entity. * * This is invoked whenever a new Replicated Data state is set on the Replicated Entity, to allow the state to be * enriched with domain specific properties and methods. This may be due to the state being set explicitly from a * command handler on the command context, or implicitly as the default value, or implicitly when a new state is * received from the proxy. * * @member {module:akkaserverless.replicatedentity.ReplicatedEntity~onStateSetCallback} module:akkaserverless.replicatedentity.ReplicatedEntity#onStateSet */ this.onStateSet = (state, entityId) => undefined; /** * A callback that is invoked to create a default value if the Akka Serverless proxy doesn't send an existing one. * * @member {module:akkaserverless.replicatedentity.ReplicatedEntity~defaultValueCallback} module:akkaserverless.replicatedentity.ReplicatedEntity#defaultValue */ this.defaultValue = (entityId) => null; } /** * @return {string} replicated entity component type. */ componentType() { return replicatedEntityServices.componentType(); } /** * Lookup a Protobuf message type. * * This is provided as a convenience to lookup protobuf message types for use, for example, as values in sets and * maps. * * @param {string} messageType The fully qualified name of the type to lookup. * @return {protobuf.Type} The protobuf message type. */ lookupType(messageType) { return this.root.lookupType(messageType); } register(allComponents) { replicatedEntityServices.addService(this, allComponents); return replicatedEntityServices; } } module.exports = { ReplicatedEntity: ReplicatedEntity, ReplicatedCounter: replicatedData.ReplicatedCounter, ReplicatedSet: replicatedData.ReplicatedSet, ReplicatedRegister: replicatedData.ReplicatedRegister, ReplicatedMap: replicatedData.ReplicatedMap, ReplicatedCounterMap: replicatedData.ReplicatedCounterMap, ReplicatedRegisterMap: replicatedData.ReplicatedRegisterMap, ReplicatedMultiMap: replicatedData.ReplicatedMultiMap, Vote: replicatedData.Vote, Clocks: replicatedData.Clocks, };
40.307018
162
0.745158
9978cbfe734ebe408e02b5904af01bc33b2cb02e
153
js
JavaScript
documentation/html/search/enumvalues_8.js
akkoyun/Weather_Station
8e54dc8a24f86a88b6f7700004fe63404fc5ad27
[ "MIT" ]
2
2020-10-27T14:20:43.000Z
2020-11-01T15:36:36.000Z
documentation/html/search/enumvalues_8.js
akkoyun/Weather_Station
8e54dc8a24f86a88b6f7700004fe63404fc5ad27
[ "MIT" ]
null
null
null
documentation/html/search/enumvalues_8.js
akkoyun/Weather_Station
8e54dc8a24f86a88b6f7700004fe63404fc5ad27
[ "MIT" ]
2
2020-12-04T13:29:48.000Z
2021-07-11T15:01:12.000Z
var searchData= [ ['unknown_275',['UNKNOWN',['../class_g_e910.html#a4b0d739f002fb90a6ee984e7c555f1b2aed30c9728fa81edaab05436e8b4d7054',1,'GE910']]] ];
30.6
131
0.777778
9978ee8a8ff12d3a6277f3a5fa32c4bf952b9bea
1,908
js
JavaScript
test/core.test.js
lars159/http-server
aa5f6f4a5f371f7e8a4c9bb787db6afdbf6b458b
[ "MIT" ]
7,434
2015-03-17T07:19:32.000Z
2019-07-09T17:28:46.000Z
test/core.test.js
lars159/http-server
aa5f6f4a5f371f7e8a4c9bb787db6afdbf6b458b
[ "MIT" ]
423
2015-03-17T02:02:04.000Z
2019-07-07T20:34:22.000Z
test/core.test.js
lars159/http-server
aa5f6f4a5f371f7e8a4c9bb787db6afdbf6b458b
[ "MIT" ]
1,067
2015-03-17T08:39:38.000Z
2019-07-08T04:34:59.000Z
'use strict'; const test = require('tap').test; const ecstatic = require('../lib/core'); const http = require('http'); const request = require('request'); const path = require('path'); const eol = require('eol'); const root = `${__dirname}/public`; const baseDir = 'base'; require('fs').mkdirSync(`${root}/emptyDir`, {recursive: true}); const cases = require('./fixtures/common-cases'); test('core', (t) => { require('portfinder').getPort((err, port) => { const filenames = Object.keys(cases); const server = http.createServer( ecstatic({ root, gzip: true, baseDir, autoIndex: true, showDir: true, defaultExt: 'html', handleError: true, }) ); server.listen(port, () => { let pending = filenames.length; filenames.forEach((file) => { const uri = `http://localhost:${port}${path.join('/', baseDir, file)}`; const headers = cases[file].headers || {}; request.get({ uri, followRedirect: false, headers, }, (err, res, body) => { if (err) { t.fail(err); } const r = cases[file]; t.equal(res.statusCode, r.code, `status code for \`${file}\``); if (r.type !== undefined) { t.equal( res.headers['content-type'].split(';')[0], r.type, `content-type for \`${file}\`` ); } if (r.body !== undefined) { t.equal(eol.lf(body), r.body, `body for \`${file}\``); } if (r.location !== undefined) { t.equal(path.normalize(res.headers.location), path.join('/', baseDir, r.location), `location for \`${file}\``); } pending -= 1; if (pending === 0) { server.close(); t.end(); } }); }); }); }); });
25.44
123
0.49109
9979295c80cdf54d6649e953260b782e0116e89a
4,063
js
JavaScript
locales/en/messages.js
sebagun/MpInstallmentsCalculator
e9d921f21df1e25781e70251564692425ee7e247
[ "Unlicense" ]
1
2019-12-18T15:57:49.000Z
2019-12-18T15:57:49.000Z
locales/en/messages.js
sebagun/MpInstallmentsCalculator
e9d921f21df1e25781e70251564692425ee7e247
[ "Unlicense" ]
null
null
null
locales/en/messages.js
sebagun/MpInstallmentsCalculator
e9d921f21df1e25781e70251564692425ee7e247
[ "Unlicense" ]
null
null
null
// English translation (en) var msg = new Array(); function getMsg(id, replacements) { var message = msg[id]; if (message && replacements) { for (var key in replacements) { message = message.replace(key, replacements[key]); } } return message; } msg["extension.name"] = "MercadoPago Installments Calculator"; msg["marketplaces.legend"] = "Select the site on which you are going to operate"; msg["sites.legend"] = "Select the country on which you are going to operate"; msg["additionalData.legend"] = "Additional data (optional)"; msg["amountToPay.label"] = "Amount to pay "; msg["amountToPay.converted.alt"] = "Converted to local currency"; msg["amountToPay.converted.title"] = "Converted to local currency using the current conversion ratio of ##RATIO## of MercadoPago."; msg["amountToPay.clear.alt"] = "Clear amount"; msg["amountToPay.clear.title"] = "Clear amount"; msg["amountToPay.help.alt"] = "Help"; msg["amountToPay.help.title"] = "You can fill in the amount to pay to calculate the total amount with fees and the amount per installments"; msg["collectorUser.label"] = "Seller "; msg["collectorUser.submit.alt"] = "Submit seller"; msg["collectorUser.submit.title"] = "Submit seller"; msg["collectorUser.ok.alt"] = "Seller identified"; msg["collectorUser.ok.title"] = "Seller identified"; msg["collectorUser.error.alt"] = "Invalid seller"; msg["collectorUser.error.title"] = "Invalid seller"; msg["collectorUser.error.nickname"] = "The seller's nickname is invalid"; msg["collectorUser.error.email"] = "The seller's e-mail is invalid"; msg["collectorUser.error.id"] = "The seller's ID is invalid"; msg["collectorUser.invalid.nickname"] = "The nickname entered is invalid"; msg["collectorUser.invalid.email"] = "The e-mail entered is invalid, verify the format."; msg["collectorUser.invalid.id"] = "The ID entered is invalid, must be only numbers."; msg["collectorUser.notFound.nickname"] = "The user doesn't exist, check the entered nickname."; msg["collectorUser.notFound.email"] = "The user doesn't exist, check the entered e-mail address."; msg["collectorUser.notFound.id"] = "The user doesn't exist, check the entered ID."; msg["collectorUser.unsupportedSite"] = "The user belongs to an unsupported country."; msg["collectorUser.clear.alt"] = "Clear seller"; msg["collectorUser.clear.title"] = "Clear seller"; msg["collectorUser.help.alt"] = "Help"; msg["collectorUser.help.title"] = "Some sellers (mostly the big ones), have their own personalized promotions. If you know who is your seller, you can fill in to obtain his specific pricings."; msg["collectorUser.dataType.nickname"] = "Nickname"; msg["collectorUser.dataType.email"] = "E-mail"; msg["collectorUser.dataType.id"] = "ID"; msg["cards.legend"] = "Select the card"; msg["pricings.legend"] = "Available pricings"; msg["cardIssuers.legend"] = "Banks with available promotions"; msg["sites.MLA.name"] = "Argentina"; msg["sites.MLB.name"] = "Brazil"; msg["sites.MLC.name"] = "Chile"; msg["sites.MCO.name"] = "Colombia"; msg["sites.MLM.name"] = "Mexico"; msg["sites.MLV.name"] = "Venezuela"; msg["badges.promotion.description"] = "Promotion without interest"; msg["badges.promotionDates.description"] = "Promotion valid from ##SINCE_DATE## to ##DUE_DATE##"; msg["badges.interestDeduction.description"] = "The seller takes care of the costs of financing"; msg["pricings.table.installments"] = "Shares"; msg["pricings.table.installmentRate"] = "Interest"; msg["pricings.table.totalAmount"] = "Total<br />amount"; msg["pricings.table.installmentAmount"] = "Per<br />installment"; msg["pricings.table.extras"] = "Extras"; msg["pricings.table.totalFinancialCost"] = "Total financial cost"; msg["pricings.table.restore"] = "Restore original card pricings"; msg["cardIssuers.none"] = "Currently there are no banks<br />with promotions for this card"; msg["error.ups"] = "Ups... there was an error. Please notify it to me to sebastiangun@gmail.com with the steps to reproduce it. Thanks!"; msg["error.mlapi"] = "The MercadoLibre's API seems to be down. Please try again in a few minutes.";
56.430556
193
0.729264
997936a5f5a0b89bc514a1b2ddd3b3390da95ba6
153
js
JavaScript
src/service/auth-check.api.service.factory.js
Corona-Appointment-Booking-App/admin-app
7263d0d96a2bce457eca93172724f7deeccc38ac
[ "MIT" ]
null
null
null
src/service/auth-check.api.service.factory.js
Corona-Appointment-Booking-App/admin-app
7263d0d96a2bce457eca93172724f7deeccc38ac
[ "MIT" ]
null
null
null
src/service/auth-check.api.service.factory.js
Corona-Appointment-Booking-App/admin-app
7263d0d96a2bce457eca93172724f7deeccc38ac
[ "MIT" ]
null
null
null
import { AuthCheckApiService } from "./auth-check.api.service"; export const createAuthCheckApiService = () => { return new AuthCheckApiService(); };
25.5
63
0.732026
9979a5f6c69a3ba7ff1da2aa0e9691a0339788ea
493
js
JavaScript
src/main/docs/html/class_hook_delivery_manual_state.js
Team302/Training2020
144cb24e5674c857c45fe4544ab42f27e07371f9
[ "MIT" ]
1
2020-09-03T21:28:43.000Z
2020-09-03T21:28:43.000Z
src/main/docs/html/class_hook_delivery_manual_state.js
Team302/training2020
144cb24e5674c857c45fe4544ab42f27e07371f9
[ "MIT" ]
null
null
null
src/main/docs/html/class_hook_delivery_manual_state.js
Team302/training2020
144cb24e5674c857c45fe4544ab42f27e07371f9
[ "MIT" ]
null
null
null
var class_hook_delivery_manual_state = [ [ "HookDeliveryManualState", "class_hook_delivery_manual_state.html#ac92499ba5d136f0400b4fe00be5c6341", null ], [ "HookDeliveryManualState", "class_hook_delivery_manual_state.html#a386e1a2f4249f60adb5c51ceb8b2ab64", null ], [ "~HookDeliveryManualState", "class_hook_delivery_manual_state.html#aefa18ea69b93f7fe760dfb5b7b04e61d", null ], [ "Run", "class_hook_delivery_manual_state.html#a7efa972895fab2797b3ef6a5ff31de6e", null ] ];
70.428571
117
0.809331
9979a69d81362465e5af11ef99634417fb6313e5
2,525
js
JavaScript
frontend/src/resources/views/pages/signup.js
ElkinCp5/MongoGraphic
2ad3aee23447a5a402ca928a865f664384c4517f
[ "MIT" ]
null
null
null
frontend/src/resources/views/pages/signup.js
ElkinCp5/MongoGraphic
2ad3aee23447a5a402ca928a865f664384c4517f
[ "MIT" ]
null
null
null
frontend/src/resources/views/pages/signup.js
ElkinCp5/MongoGraphic
2ad3aee23447a5a402ca928a865f664384c4517f
[ "MIT" ]
null
null
null
import React, { Component } from "react"; import { Link } from "react-router-dom"; import { Button, message, } from "antd"; /* Import Custom Components */ import { layoutStandar as Standar } from "../layouts"; import FormRegiste from "./forms/register/formSignup"; import { Ecolor} from "../../images"; import "./css/login.css"; class Signup extends Component { constructor(props) { super(props); this.state = { isRedirect: false, loanding: false, message: false, success: false, error: false }; this.handleMessage = this.handleMessage.bind(this); this.handleState = this.handleState.bind(this); this.handleRedirectTo = this.handleRedirectTo.bind(this); this.handleLoading = this.handleLoading.bind(this); } componentDidUpdate(){ if(this.state.isRedirect){ window.location.reload(); } } handleState =(state)=>{ this.setState({ isRedirect: state.isRedirect, loanding: state.loanding, message: state.message, success: state.success, error: state.error }) console.log({state: state}); } handleMessage(){ let success = this.state.success, error = this.state.error, messageInfo = this.state.message, loanding = this.state.loanding; if(error && loanding){ message.error(messageInfo); }else if(success && loanding){ message.success(messageInfo); setTimeout(()=>this.handleRedirectTo(), 2500); }; console.log({thisState: this.state}); setTimeout(()=> this.handleLoading(), 3000); } handleRedirectTo(){ this.setState({ isRedirect: true}) } handleLoading(){ this.setState({ loanding: false }); } render() { const { loanding } = this.state return ( <Standar className="login-page"> <div className={loanding ? 'loanding' : ''} /> <div className="card-auth signup"> <div className="logo-auth"> <img src={Ecolor} /> <div className="tabs-auth"> <ul> <li><Link to="/" className="not">Inicio</Link></li> <li><Link to="/signup" className="active">Registrate</Link></li> </ul> </div> </div> <div className="container-auth"> <FormRegiste stateLogin={this.handleState} showMessage={this.handleMessage} /> </div> </div> </Standar> ); } } export default Signup;
26.861702
92
0.581386
9979ab8f03fafed169b40a44b899babee85ea956
119
js
JavaScript
packages/ra-core/src/auth/index.js
kongnakornna/react-admin-demo
b36bc9dd8eb23dad3289f3e3c3e540e92939b6e9
[ "MIT" ]
3
2021-09-06T05:16:11.000Z
2022-03-28T05:34:46.000Z
packages/ra-core/src/auth/index.js
kongnakornna/react-admin-demo
b36bc9dd8eb23dad3289f3e3c3e540e92939b6e9
[ "MIT" ]
3
2022-02-15T05:58:31.000Z
2022-03-08T23:39:38.000Z
packages/ra-core/src/auth/index.js
kongnakornna/react-admin-demo
b36bc9dd8eb23dad3289f3e3c3e540e92939b6e9
[ "MIT" ]
1
2019-12-02T18:04:08.000Z
2019-12-02T18:04:08.000Z
export * from './types'; export Authenticated from './Authenticated'; export WithPermissions from './WithPermissions';
29.75
48
0.764706
997a65f22d74f5e984397a20b06d6ad69ea4b5fc
423
js
JavaScript
api/src/graphql/bubbles.sdl.js
qooqu/redwoodTutorial00
940ff2230216a47add280fbc1fc5d7582a354f29
[ "MIT" ]
null
null
null
api/src/graphql/bubbles.sdl.js
qooqu/redwoodTutorial00
940ff2230216a47add280fbc1fc5d7582a354f29
[ "MIT" ]
null
null
null
api/src/graphql/bubbles.sdl.js
qooqu/redwoodTutorial00
940ff2230216a47add280fbc1fc5d7582a354f29
[ "MIT" ]
null
null
null
export const schema = gql` type Bubble { id: Int! value: Int! } type Query { bubbles: [Bubble!]! bubble(id: Int!): Bubble } input CreateBubbleInput { value: Int! } input UpdateBubbleInput { value: Int } type Mutation { createBubble(input: CreateBubbleInput!): Bubble! updateBubble(id: Int!, input: UpdateBubbleInput!): Bubble! deleteBubble(id: Int!): Bubble! } `
16.269231
62
0.619385
997aefa40b44d8cbba68090f633d441580b87594
24,778
js
JavaScript
csf_tz/public/js/jobcards.min.js
Craftint/CSF_TZ
b5cb2d59d8f4e958ad7d4cb89421cfbec992abc5
[ "MIT" ]
null
null
null
csf_tz/public/js/jobcards.min.js
Craftint/CSF_TZ
b5cb2d59d8f4e958ad7d4cb89421cfbec992abc5
[ "MIT" ]
null
null
null
csf_tz/public/js/jobcards.min.js
Craftint/CSF_TZ
b5cb2d59d8f4e958ad7d4cb89421cfbec992abc5
[ "MIT" ]
null
null
null
(function () { 'use strict'; var evntBus = new Vue(); // var script = { data: function () { return ({ Dialog: false, cardData: "", }); }, watch: {}, methods: { close_dialog: function close_dialog() { this.Dialog = false; }, }, created: function () { var this$1 = this; evntBus.$on("open_card", function (job_card) { this$1.Dialog = true; this$1.cardData = job_card; }); }, }; /* script */ var __vue_script__ = script; /* template */ var __vue_render__ = function() { var _vm = this; var _h = _vm.$createElement; var _c = _vm._self._c || _h; return _vm.Dialog ? _c( "div", { attrs: { justify: "center" } }, [ _c( "v-dialog", { attrs: { "max-width": "1200px" }, model: { value: _vm.Dialog, callback: function($$v) { _vm.Dialog = $$v; }, expression: "Dialog" } }, [ _c( "v-card", [ _c("v-card-title", [ _c("span", { staticClass: "headline indigo--text" }, [ _vm._v(_vm._s(_vm.cardData.operation.name)) ]) ]), _vm._v(" "), _c( "v-row", { staticClass: "mx-3" }, [ _c( "v-col", { attrs: { cols: "5" } }, [ _c("v-img", { attrs: { "max-height": "600", "max-width": "600", src: _vm.cardData.operation.image } }) ], 1 ), _vm._v(" "), _c( "v-col", { attrs: { cols: "4" } }, [ _c( "v-card-text", { staticClass: "pa-0" }, [ _c( "v-list-item", { attrs: { "three-line": "" } }, [ _c( "v-list-item-content", [ _c( "div", { staticClass: "overline mb-4" }, [_vm._v(_vm._s(_vm.cardData.name))] ), _vm._v(" "), _c("v-textarea", { attrs: { label: "Operation Description", "auto-grow": "", outlined: "", rows: "3", "row-height": "25", disabled: "", shaped: "" }, model: { value: _vm.cardData.operation.description, callback: function($$v) { _vm.$set( _vm.cardData.operation, "description", $$v ); }, expression: "cardData.operation.description" } }), _vm._v(" "), _c("v-list-item-subtitle", [ _vm._v( "\n QTY: " + _vm._s(_vm.cardData.for_quantity) + "\n " ) ]), _vm._v(" "), _c("v-list-item-subtitle", [ _vm._v( "\n Production Item: " + _vm._s( _vm.cardData.production_item ) + "\n " ) ]), _vm._v(" "), _c("v-list-item-subtitle", [ _vm._v( "\n Satus: " + _vm._s(_vm.cardData.status) + "\n " ) ]) ], 1 ) ], 1 ) ], 1 ) ], 1 ), _vm._v(" "), _c( "v-col", { attrs: { cols: "3" } }, [ _c("v-img", { attrs: { "max-height": "400", "max-width": "400", src: _vm.cardData.work_order_image } }) ], 1 ) ], 1 ), _vm._v(" "), _c( "v-card-actions", { staticClass: "mx-3" }, [ _c( "v-btn", { attrs: { color: "primary", dark: "" }, on: { click: _vm.close_dialog } }, [_vm._v("Start")] ), _vm._v(" "), _c("v-spacer"), _vm._v(" "), _c( "v-btn", { attrs: { color: "error", dark: "" }, on: { click: _vm.close_dialog } }, [_vm._v("Close")] ) ], 1 ) ], 1 ) ], 1 ) ], 1 ) : _vm._e() }; var __vue_staticRenderFns__ = []; __vue_render__._withStripped = true; /* style */ var __vue_inject_styles__ = undefined; /* scoped */ var __vue_scope_id__ = undefined; /* module identifier */ var __vue_module_identifier__ = undefined; /* functional template */ var __vue_is_functional_template__ = false; /* component normalizer */ function __vue_normalize__( template, style, script, scope, functional, moduleIdentifier, createInjector, createInjectorSSR ) { var component = (typeof script === 'function' ? script.options : script) || {}; // For security concerns, we use only base name in production mode. component.__file = "/opt/bench/bench13/apps/csf_tz/csf_tz/public/js/jobcards/Card.vue"; if (!component.render) { component.render = template.render; component.staticRenderFns = template.staticRenderFns; component._compiled = true; if (functional) { component.functional = true; } } component._scopeId = scope; return component } /* style inject */ /* style inject SSR */ var Card = __vue_normalize__( { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, undefined, undefined ); // var script$1 = { data: function () { return { data: "", }; }, components: { Card: Card, }, methods: { get_data: function get_data() { var vm = this; frappe.call({ method: "csf_tz.csf_tz.page.jobcards.jobcards.get_job_cards", args: {}, async: true, callback: function (r) { if (r.message) { vm.data = r.message; } }, }); }, open_card: function open_card(item) { evntBus.$emit("open_card", item); }, set_status_color: function set_status_color(status){ if (status == "Open") { return "status-Open" } if (status == "Work In Progress") { return "status-Work" } if (status == "Material Transferred") { return "status-Material" } if (status == "On Hold") { return "status-Hold" } if (status == "Submitted") { return "status-Submitted" } } }, created: function () { this.get_data(); }, }; /* script */ var __vue_script__$1 = script$1; /* template */ var __vue_render__$1 = function() { var _vm = this; var _h = _vm.$createElement; var _c = _vm._self._c || _h; return _c("v-app", [ _c( "div", { attrs: { fluid: "" } }, [ _c("H3", [_vm._v(" Working Job Cards")]), _vm._v(" "), _c("Card"), _vm._v(" "), _vm._l(_vm.data, function(item) { return _c("div", { key: item.name }, [ _c( "div", { class: _vm.set_status_color(item.status) }, [ _c( "v-card", { staticClass: "mb-4" }, [ _c( "v-list-item", { attrs: { "three-line": "" } }, [ _c( "v-list-item-content", [ _c("div", { staticClass: "overline mb-4" }, [ _vm._v(_vm._s(item.name)) ]), _vm._v(" "), _c( "v-list-item-title", { staticClass: "headline mb-1" }, [ _vm._v( "\n " + _vm._s(item.operation.name) + "\n " ) ] ), _vm._v(" "), _c("v-list-item-subtitle", [ _vm._v( "\n QTY: " + _vm._s(item.for_quantity) + "\n " ) ]), _vm._v(" "), _c("v-list-item-subtitle", [ _vm._v( "\n Production Item: " + _vm._s(item.production_item) + "\n " ) ]), _vm._v(" "), _c("v-list-item-subtitle", [ _vm._v( "\n Satus: " + _vm._s(item.status) + "\n " ) ]), _vm._v(" "), item.current_time ? _c("v-card-subtitle", [ _vm._v( "Current Time: " + _vm._s(item.current_time / 60) ) ]) : _vm._e() ], 1 ), _vm._v(" "), _c("v-img", { attrs: { "max-height": "150", "max-width": "250", src: item.operation.image } }) ], 1 ), _vm._v(" "), _c( "v-card-actions", [ _c( "v-btn", { attrs: { text: "", color: "primary" }, on: { click: function($event) { return _vm.open_card(item) } } }, [_vm._v("\n open\n ")] ) ], 1 ) ], 1 ) ], 1 ) ]) }) ], 2 ) ]) }; var __vue_staticRenderFns__$1 = []; __vue_render__$1._withStripped = true; /* style */ var __vue_inject_styles__$1 = function (inject) { if (!inject) { return } inject("data-v-5ac4d2fc_0", { source: "\n.navbar-default {\n height: 40px;\n}\ndiv.navbar .container {\n padding-top: 2px;\n}\n.status-Open {\n border-left: 5px solid purple;\n}\n.status-Work {\n border-left: 5px solid lime;\n}\n.status-Material {\n border-left: 5px solid teal;\n}\n.status-Hold {\n border-left: 5px solid #607D8B;\n}\n.status-Submitted {\n border-left: 5px solid #FF5722;\n}\n", map: {"version":3,"sources":["/opt/bench/bench13/apps/csf_tz/csf_tz/public/js/jobcards/JobCards.vue"],"names":[],"mappings":";AAqGA;EACA,YAAA;AACA;AACA;EACA,gBAAA;AACA;AACA;EACA,6BAAA;AACA;AACA;EACA,2BAAA;AACA;AACA;EACA,2BAAA;AACA;AACA;EACA,8BAAA;AACA;AACA;EACA,8BAAA;AACA","file":"JobCards.vue","sourcesContent":["<template>\n <v-app>\n <div fluid>\n <H3> Working Job Cards</H3>\n <Card></Card>\n <div v-for=\"item in data\" :key=\"item.name\">\n <div :class=\"set_status_color(item.status)\">\n <v-card class=\"mb-4\">\n <v-list-item three-line>\n <v-list-item-content>\n <div class=\"overline mb-4\">{{ item.name }}</div>\n <v-list-item-title class=\"headline mb-1\">\n {{ item.operation.name }}\n </v-list-item-title>\n <v-list-item-subtitle>\n QTY: {{ item.for_quantity }}\n </v-list-item-subtitle>\n <v-list-item-subtitle>\n Production Item: {{ item.production_item }}\n </v-list-item-subtitle>\n <v-list-item-subtitle>\n Satus: {{ item.status }}\n </v-list-item-subtitle>\n <v-card-subtitle v-if=\"item.current_time\">Current Time: {{ item.current_time/60 }}</v-card-subtitle>\n </v-list-item-content>\n\n <v-img\n max-height=\"150\"\n max-width=\"250\"\n :src=\"item.operation.image\"\n ></v-img>\n </v-list-item>\n\n <v-card-actions>\n <!-- <v-spacer></v-spacer> -->\n <v-btn text color=\"primary\" @click=\"open_card(item)\">\n open\n </v-btn>\n </v-card-actions>\n </v-card>\n </div>\n </div>\n </div>\n </v-app>\n</template>\n\n<script>\nimport { evntBus } from \"./bus\";\nimport Card from \"./Card.vue\";\n\nexport default {\n data: function () {\n return {\n data: \"\",\n };\n },\n components: {\n Card,\n },\n\n methods: {\n get_data() {\n const vm = this;\n frappe.call({\n method: \"csf_tz.csf_tz.page.jobcards.jobcards.get_job_cards\",\n args: {},\n async: true,\n callback: function (r) {\n if (r.message) {\n vm.data = r.message;\n }\n },\n });\n },\n open_card(item) {\n evntBus.$emit(\"open_card\", item);\n },\n set_status_color(status){\n if (status == \"Open\") {\n return \"status-Open\"\n }\n if (status == \"Work In Progress\") {\n return \"status-Work\"\n }\n if (status == \"Material Transferred\") {\n return \"status-Material\"\n }\n if (status == \"On Hold\") {\n return \"status-Hold\"\n }\n if (status == \"Submitted\") {\n return \"status-Submitted\"\n }\n }\n },\n created: function () {\n this.get_data();\n },\n};\n</script>\n<style>\n.navbar-default {\n height: 40px;\n}\ndiv.navbar .container {\n padding-top: 2px;\n}\n.status-Open {\n border-left: 5px solid purple;\n}\n.status-Work {\n border-left: 5px solid lime;\n}\n.status-Material {\n border-left: 5px solid teal;\n}\n.status-Hold {\n border-left: 5px solid #607D8B;\n}\n.status-Submitted {\n border-left: 5px solid #FF5722;\n}\n</style>"]}, media: undefined }); }; /* scoped */ var __vue_scope_id__$1 = undefined; /* module identifier */ var __vue_module_identifier__$1 = undefined; /* functional template */ var __vue_is_functional_template__$1 = false; /* component normalizer */ function __vue_normalize__$1( template, style, script, scope, functional, moduleIdentifier, createInjector, createInjectorSSR ) { var component = (typeof script === 'function' ? script.options : script) || {}; // For security concerns, we use only base name in production mode. component.__file = "/opt/bench/bench13/apps/csf_tz/csf_tz/public/js/jobcards/JobCards.vue"; if (!component.render) { component.render = template.render; component.staticRenderFns = template.staticRenderFns; component._compiled = true; if (functional) { component.functional = true; } } component._scopeId = scope; { var hook; if (style) { hook = function(context) { style.call(this, createInjector(context)); }; } if (hook !== undefined) { if (component.functional) { // register for functional component in vue file var originalRender = component.render; component.render = function renderWithStyleInjection(h, context) { hook.call(context); return originalRender(h, context) }; } else { // inject component registration as beforeCreate hook var existing = component.beforeCreate; component.beforeCreate = existing ? [].concat(existing, hook) : [hook]; } } } return component } /* style inject */ function __vue_create_injector__() { var head = document.head || document.getElementsByTagName('head')[0]; var styles = __vue_create_injector__.styles || (__vue_create_injector__.styles = {}); var isOldIE = typeof navigator !== 'undefined' && /msie [6-9]\\b/.test(navigator.userAgent.toLowerCase()); return function addStyle(id, css) { if (document.querySelector('style[data-vue-ssr-id~="' + id + '"]')) { return } // SSR styles are present. var group = isOldIE ? css.media || 'default' : id; var style = styles[group] || (styles[group] = { ids: [], parts: [], element: undefined }); if (!style.ids.includes(id)) { var code = css.source; var index = style.ids.length; style.ids.push(id); if (isOldIE) { style.element = style.element || document.querySelector('style[data-group=' + group + ']'); } if (!style.element) { var el = style.element = document.createElement('style'); el.type = 'text/css'; if (css.media) { el.setAttribute('media', css.media); } if (isOldIE) { el.setAttribute('data-group', group); el.setAttribute('data-next-index', '0'); } head.appendChild(el); } if (isOldIE) { index = parseInt(style.element.getAttribute('data-next-index')); style.element.setAttribute('data-next-index', index + 1); } if (style.element.styleSheet) { style.parts.push(code); style.element.styleSheet.cssText = style.parts .filter(Boolean) .join('\n'); } else { var textNode = document.createTextNode(code); var nodes = style.element.childNodes; if (nodes[index]) { style.element.removeChild(nodes[index]); } if (nodes.length) { style.element.insertBefore(textNode, nodes[index]); } else { style.element.appendChild(textNode); } } } } } /* style inject SSR */ var Job_Cards = __vue_normalize__$1( { render: __vue_render__$1, staticRenderFns: __vue_staticRenderFns__$1 }, __vue_inject_styles__$1, __vue_script__$1, __vue_scope_id__$1, __vue_is_functional_template__$1, __vue_module_identifier__$1, __vue_create_injector__, undefined ); frappe.provide('frappe.JobCards'); frappe.JobCards.job_cards = class { constructor(ref) { var parent = ref.parent; this.$parent = $(parent); this.page = parent.page; this.make_body(); } make_body() { this.$EL = this.$parent.find('.layout-main'); this.vue = new Vue({ vuetify: new Vuetify(), el: this.$EL[0], data: { }, render: function (h) { return h(Job_Cards); }, }); } setup_header() { } }; }()); //# sourceMappingURL=jobcards.min.js.map
40.355049
3,864
0.353338
997b1c135b44facd60046bf7b18084a881a5898f
2,570
js
JavaScript
tests/unit/header/controllers/HeaderCtrl.js
thisissoon/thisissoon-frontend
dc5528aba0c1fb48b3374bff9bd37bc5c253de60
[ "MIT" ]
1
2015-02-20T15:29:44.000Z
2015-02-20T15:29:44.000Z
tests/unit/header/controllers/HeaderCtrl.js
thisissoon/thisissoon-frontend
dc5528aba0c1fb48b3374bff9bd37bc5c253de60
[ "MIT" ]
63
2015-01-29T10:00:07.000Z
2016-01-11T14:12:14.000Z
tests/unit/header/controllers/HeaderCtrl.js
thisissoon/thisissoon-frontend
dc5528aba0c1fb48b3374bff9bd37bc5c253de60
[ "MIT" ]
null
null
null
"use strict"; describe("HeaderCtrl", function (){ var scope, rootScope, $httpBackend, _filter , _cache, _env, _thisissoonAPI, _projects; beforeEach(function(){ module("thisissoon.header"); }); beforeEach(inject(function ($rootScope, $injector, $controller) { scope = $rootScope.$new(); rootScope = $rootScope; rootScope.env = {}; $httpBackend = $injector.get("$httpBackend"); _filter = $injector.get("$filter"); _cache = $injector.get("CacheService"); _env = $injector.get("ENV"); _thisissoonAPI = $injector.get("ThisissoonAPI"); _projects = { list: [ { "id": 1, "background_colour": "#000000" }, { "id": 2, "background_colour": "#000000" } ] }; $httpBackend.when("GET", _env.API_ADDRESS + "projects/").respond(_projects); $controller("HeaderCtrl", { $scope: scope, $rootScope: rootScope, $filter: _filter, CacheService: _cache, ThisissoonAPI: _thisissoonAPI }); })); it("should declare variables in scope", function (){ expect(scope.env).toEqual(jasmine.any(Object)); expect(scope.projects).toEqual(jasmine.any(Array)); expect(scope.navStyle).toEqual(jasmine.any(String)); expect(scope.toggleProjects).toEqual(jasmine.any(Function)); }); it("should toggle projectList boolean when calling toggleProjects function", function (){ scope.cache.put("projectList", false); scope.toggleProjects(); expect(scope.cache.get("projectList")).toBe(true); scope.toggleProjects(); expect(scope.cache.get("projectList")).toBe(false); scope.cache.put("projectList", true); scope.toggleProjects(); expect(scope.cache.get("projectList")).toBe(false); }); it("should attach projects to scope on init", function (){ scope.init(); $httpBackend.flush(); expect(scope.projects).toEqual(_projects.list); }); it("should listen for scrollSectionChanged events from snNavbar and update scope", function (){ scope.navStyle = "light"; scope.$broadcast("snNavbar:scrollSectionChanged", { navStyle: "dark" }) expect(scope.navStyle).toEqual("dark"); }); it("should watch project value in cache", function (){ _cache.put("project", { backgroundColor: "#FFFFFF" }); scope.$digest(); expect(scope.navStyle).toEqual("dark"); }); });
32.125
99
0.594163
997b1dbb9bc9cbb11bc2e262f1cbd673680d929a
859
js
JavaScript
app/containers/AddComment/index.js
rafalsep/blog
4aea4696ba1181a6a2c931074340d59243484900
[ "MIT" ]
null
null
null
app/containers/AddComment/index.js
rafalsep/blog
4aea4696ba1181a6a2c931074340d59243484900
[ "MIT" ]
null
null
null
app/containers/AddComment/index.js
rafalsep/blog
4aea4696ba1181a6a2c931074340d59243484900
[ "MIT" ]
null
null
null
import { connect } from 'react-redux'; import { compose } from 'redux'; import { createStructuredSelector } from 'reselect'; import { addCommentAction, login, logout } from './add-comment-actions'; import AddComment from './AddComment'; const mapDispatchToProps = dispatch => ({ addComment: (comment, commentForm) => dispatch(addCommentAction(comment, commentForm)), login: loginProvider => dispatch(login(loginProvider)), logout: () => dispatch(logout()) }); const mapStateToProps = createStructuredSelector({ loggedIn: state => state.getIn(['login', 'user']) !== undefined, user: state => state.getIn(['login', 'user']), loginProvider: state => state.getIn(['login', 'loginProvider']) }); const withConnect = connect( mapStateToProps, mapDispatchToProps ); export default compose(withConnect)(AddComment); export { mapDispatchToProps };
33.038462
89
0.721769
997be4f52e45888f3185574d4387cacf03533118
1,997
js
JavaScript
sacviet/media/scripts/ajax-dynamic-content.js
vikigroup/vbiketours
b833d4689fe0585969e6536e79208e68f898d5a9
[ "Apache-2.0" ]
null
null
null
sacviet/media/scripts/ajax-dynamic-content.js
vikigroup/vbiketours
b833d4689fe0585969e6536e79208e68f898d5a9
[ "Apache-2.0" ]
null
null
null
sacviet/media/scripts/ajax-dynamic-content.js
vikigroup/vbiketours
b833d4689fe0585969e6536e79208e68f898d5a9
[ "Apache-2.0" ]
null
null
null
/********************************************************** Ajax dynamic content Copyright (C) 2007 DTHMLGoodies.com, Alf Magne Kalleland ***********************************************************/ var enableCache = true; var jsCache = new Array(); var dynamicContent_ajaxObjects = new Array(); // Ajax Show Content function ajax_showContent(divId,ajaxIndex,url) { document.getElementById(divId).innerHTML = dynamicContent_ajaxObjects[ajaxIndex].response; if(enableCache) { jsCache[url] = dynamicContent_ajaxObjects[ajaxIndex].response; } dynamicContent_ajaxObjects[ajaxIndex] = false; } // Ajax Load Content function ajax_loadContent(divId,url) { if(document.getElementById(divId)) { // Get Content From Cache if(enableCache && jsCache[url]) { document.getElementById(divId).innerHTML = jsCache[url]; return; } // Recieve content from Server document.getElementById(divId).innerHTML = "<table><tr><td align='right'><img src='images/waiting.gif' /></td><td>Đang tải...</td></tr></table>"; // Add new Ajax Object var ajaxIndex = dynamicContent_ajaxObjects.length; dynamicContent_ajaxObjects[ajaxIndex] = new sack(); if(url.indexOf('?') >= 0) { dynamicContent_ajaxObjects[ajaxIndex].method='GET'; var string = url.substring(url.indexOf('?')); url = url.replace(string,''); string = string.replace('?',''); var items = string.split(/&/g); for(var no=0; no<items.length; no++) { var tokens = items[no].split('='); if(tokens.length==2) { dynamicContent_ajaxObjects[ajaxIndex].setVar(tokens[0],tokens[1]); } } url = url.replace(string,''); } // Specifying which file to get dynamicContent_ajaxObjects[ajaxIndex].requestFile = url; // Specify function that will be executed after file has been found dynamicContent_ajaxObjects[ajaxIndex].onCompletion = function() { ajax_showContent(divId,ajaxIndex,url); }; // Execute AJAX function dynamicContent_ajaxObjects[ajaxIndex].runAJAX(); } }
24.9625
146
0.664497
997be98808f455d7a29286292199a6300dc14f4f
8,847
js
JavaScript
public/component---src-templates-archive-js-3e4a986e198ab08eab8b.js
zbyszrom/travel-blog
18b17c3d5921d5600ee038ae61b1d2bb5f5facd0
[ "MIT" ]
null
null
null
public/component---src-templates-archive-js-3e4a986e198ab08eab8b.js
zbyszrom/travel-blog
18b17c3d5921d5600ee038ae61b1d2bb5f5facd0
[ "MIT" ]
1
2019-10-15T00:00:30.000Z
2019-10-15T00:00:30.000Z
public/component---src-templates-archive-js-3e4a986e198ab08eab8b.js
zbyszrom/travel-blog
18b17c3d5921d5600ee038ae61b1d2bb5f5facd0
[ "MIT" ]
null
null
null
(window.webpackJsonp=window.webpackJsonp||[]).push([[8],{142:function(e,t,a){"use strict";a.r(t),a.d(t,"pageQuery",function(){return g});var n=a(0),i=a.n(n),r=a(153),c=a(155),o=a(156),l=a(161),u=a(159),s=(a(168),a(169),a(167)),d=a.n(s);t.default=function(e){var t=e.data.allContentfulBlog,a=e.pageContext,n=a.currentPage,s=1===n,g=n===a.numPages,m=n-1==1?"/blog":"/blog/"+(n-1),M="/blog/"+(n+1);return i.a.createElement(o.a,null,i.a.createElement(u.a,{title:"Blog",keywords:["travel","travel blog","travel photography"]}),i.a.createElement(l.a,null),i.a.createElement("header",null,i.a.createElement("div",{className:"archive__section"},i.a.createElement("div",{className:"archive__hero",style:{backgroundImage:"url("+d.a+")"}}),i.a.createElement("div",{className:"archive__nav"},i.a.createElement(r.a,{to:"/blog",className:c.window.location.href.indexOf("/blog")>0?"archive__nav--link selected":"archive__nav--link"},"All"),i.a.createElement(r.a,{to:"/category/travel",className:c.window.location.href.indexOf("category/travel")>0?"archive__nav--link selected":"archive__nav--link"},"Travel"),i.a.createElement(r.a,{to:"/category/guide",className:c.window.location.href.indexOf("category/guide")>0?"archive__nav--link selected":"archive__nav--link"},"Guide"),i.a.createElement(r.a,{to:"/category/opinion",className:c.window.location.href.indexOf("category/opinion")>0?"archive__nav--link selected":"archive__nav--link"},"Opinion"),i.a.createElement(r.a,{to:"/category/tech",className:c.window.location.href.indexOf("category/tech")>0?"archive__nav--link selected":"archive__nav--link"},"Tech")))),i.a.createElement("div",{className:"feed"},t.edges.map(function(e){return i.a.createElement("div",{key:e.node.id,className:"card",style:{backgroundImage:"linear-gradient(\n to bottom,\n rgba(10,10,10,0) 0%,\n rgba(10,10,10,0) 50%,\n rgba(10,10,10,0.7) 100%),\n url("+e.node.featuredImage.fluid.src+")"},onClick:function(){return Object(r.c)("/blog/"+e.node.slug)}},e.node.categories.map(function(e){return i.a.createElement("p",{className:"card__category"},e.category)}),i.a.createElement("p",{className:"card__title"},e.node.title))})),i.a.createElement("div",{className:"pagination"},i.a.createElement("div",{className:"pagination__item"},!s&&i.a.createElement(r.a,{to:m,rel:"prev"},i.a.createElement("div",{className:"arrow__back"}))),i.a.createElement("div",{className:"pagination__item"},!g&&i.a.createElement(r.a,{to:M,rel:"next"},i.a.createElement("div",{className:"arrow__next"})))))};var g="3388556588"},153:function(e,t,a){"use strict";a.d(t,"b",function(){return s});var n=a(0),i=a.n(n),r=a(4),c=a.n(r),o=a(32),l=a.n(o);a.d(t,"a",function(){return l.a}),a.d(t,"c",function(){return o.navigate});a(154);var u=i.a.createContext({}),s=function(e){return i.a.createElement(u.Consumer,null,function(t){return e.data||t[e.query]&&t[e.query].data?(e.render||e.children)(e.data?e.data.data:t[e.query].data):i.a.createElement("div",null,"Loading (StaticQuery)")})};s.propTypes={data:c.a.object,query:c.a.string.isRequired,render:c.a.func,children:c.a.func}},154:function(e,t,a){var n;e.exports=(n=a(158))&&n.default||n},155:function(e,t,a){"use strict";var n=a(162),i=n.Nothing,r=n.isNothing,c="undefined"!=typeof window?window:i,o="undefined"!=typeof document?document:i;e.exports.window=c,e.exports.document=o,e.exports.exists=function(e){return!r(e)}},156:function(e,t,a){"use strict";var n=a(157),i=a(0),r=a.n(i),c=a(4),o=a.n(c),l=a(153),u=(a(164),function(e){var t=e.children;return r.a.createElement(l.b,{query:"755544856",render:function(e){return r.a.createElement(r.a.Fragment,null,r.a.createElement("main",null,t))},data:n})});u.propTypes={children:o.a.node.isRequired},t.a=u},157:function(e){e.exports={data:{site:{siteMetadata:{title:"Gatsby Blog Template"}}}}},158:function(e,t,a){"use strict";a.r(t);a(33);var n=a(0),i=a.n(n),r=a(4),c=a.n(r),o=a(54),l=a(2),u=function(e){var t=e.location,a=l.default.getResourcesForPathnameSync(t.pathname);return i.a.createElement(o.a,Object.assign({location:t,pageResources:a},a.json))};u.propTypes={location:c.a.shape({pathname:c.a.string.isRequired}).isRequired},t.default=u},159:function(e,t,a){"use strict";var n=a(160),i=a(0),r=a.n(i),c=a(4),o=a.n(c),l=a(165),u=a.n(l);function s(e){var t=e.description,a=e.lang,i=e.meta,c=e.keywords,o=e.title,l=n.data.site,s=t||l.siteMetadata.description;return r.a.createElement(u.a,{htmlAttributes:{lang:a},title:o,titleTemplate:"%s | "+l.siteMetadata.title,meta:[{name:"description",content:s},{property:"og:title",content:o},{property:"og:description",content:s},{property:"og:type",content:"website"},{name:"twitter:card",content:"summary"},{name:"twitter:creator",content:l.siteMetadata.author},{name:"twitter:title",content:o},{name:"twitter:description",content:s}].concat(c.length>0?{name:"keywords",content:c.join(", ")}:[]).concat(i)})}s.defaultProps={lang:"en",meta:[],keywords:[]},s.propTypes={description:o.a.string,lang:o.a.string,meta:o.a.array,keywords:o.a.arrayOf(o.a.string),title:o.a.string.isRequired},t.a=s},160:function(e){e.exports={data:{site:{siteMetadata:{title:"Gatsby Blog Template",description:"Free course on how to create a blog from scratch using React, Gatsby, Contentful, and Netlify.",author:"Skillthrive"}}}}},161:function(e,t,a){"use strict";var n=a(0),i=a.n(n),r=a(153),c=a(155),o=a(163),l=a.n(o);a(166);t.a=function(){return i.a.createElement("nav",null,i.a.createElement("div",{className:"nav__items"},i.a.createElement("a",{className:"nav__item--left",href:"/"},i.a.createElement("img",{src:l.a,alt:"Traveler Pack Logo",className:"nav__item--logo"})),i.a.createElement(r.a,{className:c.window.location.href.indexOf("contact")>0?"nav__item--link active":"nav__item--link",to:"/contact"},"Contact"),i.a.createElement(r.a,{className:c.window.location.href.indexOf("blog")>0||c.window.location.href.indexOf("category")>0?"nav__item--link active":"nav__item--link",to:"/blog"},"Blog")))}},162:function(e,t,a){"use strict";a.r(t),a.d(t,"Nothing",function(){return i}),a.d(t,"toBool",function(){return r}),a.d(t,"isNothing",function(){return c}),a.d(t,"isSomething",function(){return o}),a.d(t,"serialize",function(){return l}),a.d(t,"deserialize",function(){return u});var n,i=((n=function(){return i}).toString=n.toLocaleString=n[Symbol.toPrimitive]=function(){return""},n.valueOf=function(){return!1},new Proxy(Object.freeze(n),{get:function(e,t){return e.hasOwnProperty(t)?e[t]:i}})),r=function(e){return!(!e||!e.valueOf())},c=function(e){return e===i},o=function(e){return!(e===i||null==e)},l=function(e){return JSON.stringify(e,function(e,t){return t===i?null:t})},u=function(e){return JSON.parse(e,function(e,t){return null===t?i:t})}},163:function(e,t){e.exports="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTkuMC4wLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgdmlld0JveD0iMCAwIDI5NC44NDMgMjk0Ljg0MyIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMjk0Ljg0MyAyOTQuODQzOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSIgd2lkdGg9IjUxMnB4IiBoZWlnaHQ9IjUxMnB4Ij4KPGc+Cgk8cGF0aCBkPSJNMTQ3LjQyMSwwQzY2LjEzMywwLDAsNjYuMTMzLDAsMTQ3LjQyMXM2Ni4xMzMsMTQ3LjQyMSwxNDcuNDIxLDE0Ny40MjFjNDUuNjk3LDAsODguMDYxLTIwLjY3NiwxMTYuMjMtNTYuNzI3ICAgYzIuMDQtMi42MTEsMS41NzctNi4zODItMS4wMzQtOC40MjJjLTIuNjEyLTIuMDQxLTYuMzgyLTEuNTc4LTguNDIyLDEuMDM0Yy0yNS44NzksMzMuMTItNjQuNzk3LDUyLjExNi0xMDYuNzc0LDUyLjExNiAgIEM3Mi43NSwyODIuODQzLDEyLDIyMi4wOTMsMTIsMTQ3LjQyMVM3Mi43NSwxMiwxNDcuNDIxLDEyczEzNS40MjEsNjAuNzUsMTM1LjQyMSwxMzUuNDIxYzAsMy4zMTMsMi42ODcsNiw2LDZzNi0yLjY4Nyw2LTYgICBDMjk0Ljg0Myw2Ni4xMzMsMjI4LjcxLDAsMTQ3LjQyMSwweiIgZmlsbD0iI0ZGRkZGRiIvPgoJPHBhdGggZD0iTTE0NC45OTUsMjM4LjljMC4zOTMsMC4wNzgsMC43ODUsMC4xMTYsMS4xNzMsMC4xMTZjMi4zODYsMCw0LjU5OC0xLjQzLDUuNTQxLTMuNzA1bDYzLjIzNi0xNTIuNjY2ICAgYzAuOTI5LTIuMjQyLDAuNDE1LTQuODIzLTEuMzAxLTYuNTM5cy00LjI5Ni0yLjIyOC02LjUzOS0xLjMwMUw1NC40NCwxMzguMDQyYy0yLjY0NSwxLjA5Ni00LjE0NywzLjkwNy0zLjU4OSw2LjcxNCAgIGMwLjU1OSwyLjgwOCwzLjAyMiw0LjgzLDUuODg1LDQuODNoODMuNDN2ODMuNDNDMTQwLjE2NiwyMzUuODc3LDE0Mi4xODgsMjM4LjM0MSwxNDQuOTk1LDIzOC45eiBNODYuOSwxMzcuNTg1bDExMS40MTUtNDYuMTUgICBsLTQ2LjE1LDExMS40MTZ2LTU5LjI2NmMwLTMuMzEzLTIuNjg3LTYtNi02SDg2Ljl6IiBmaWxsPSIjRkZGRkZGIi8+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPGc+CjwvZz4KPC9zdmc+Cg=="},167:function(e,t,a){e.exports=a.p+"static/general-header-image-949c7e63908216492c2e5e4bbc15423d.jpg"}}]); //# sourceMappingURL=component---src-templates-archive-js-3e4a986e198ab08eab8b.js.map
4,423.5
8,761
0.762179
997d3c43654030fde529e3f19e06929fe7c36070
2,188
js
JavaScript
services/bower/bower.tester.js
Antoine38660/shields
3bbe2482bc52ae1e6ba0cd508fdff7a50987863d
[ "CC0-1.0" ]
2
2018-12-16T22:12:07.000Z
2018-12-16T22:12:37.000Z
services/bower/bower.tester.js
Antoine38660/shields
3bbe2482bc52ae1e6ba0cd508fdff7a50987863d
[ "CC0-1.0" ]
null
null
null
services/bower/bower.tester.js
Antoine38660/shields
3bbe2482bc52ae1e6ba0cd508fdff7a50987863d
[ "CC0-1.0" ]
null
null
null
'use strict' const Joi = require('joi') const ServiceTester = require('../service-tester') const { isVPlusDottedVersionAtLeastOne } = require('../test-validators') const isBowerPrereleaseVersion = Joi.string().regex( /^v\d+(\.\d+)?(\.\d+)?(-?[.\w\d])+?$/ ) const t = (module.exports = new ServiceTester({ id: 'bower', title: 'Bower' })) t.create('licence') .get('/l/bootstrap.json') .expectJSON({ name: 'license', value: 'MIT' }) t.create('custom label for licence') .get('/l/bootstrap.json?label=my licence') .expectJSON({ name: 'my licence', value: 'MIT' }) t.create('version') .get('/v/bootstrap.json') .expectJSONTypes( Joi.object().keys({ name: 'bower', value: isVPlusDottedVersionAtLeastOne, }) ) t.create('custom label for version') .get('/v/bootstrap.json?label=my version') .expectJSONTypes( Joi.object().keys({ name: 'my version', value: isVPlusDottedVersionAtLeastOne, }) ) t.create('pre version') // e.g. bower|v0.2.5-alpha-rc-pre .get('/vpre/bootstrap.json') .expectJSONTypes( Joi.object().keys({ name: 'bower', value: isBowerPrereleaseVersion, }) ) t.create('custom label for pre version') // e.g. pre version|v0.2.5-alpha-rc-pre .get('/vpre/bootstrap.json?label=pre version') .expectJSONTypes( Joi.object().keys({ name: 'pre version', value: isBowerPrereleaseVersion, }) ) t.create('Version for Invaild Package') .get('/v/it-is-a-invalid-package-should-error.json') .expectJSON({ name: 'bower', value: 'invalid' }) t.create('Pre Version for Invaild Package') .get('/vpre/it-is-a-invalid-package-should-error.json') .expectJSON({ name: 'bower', value: 'invalid' }) t.create('licence for Invaild Package') .get('/l/it-is-a-invalid-package-should-error.json') .expectJSON({ name: 'license', value: 'invalid' }) t.create('Version label should be `no releases` if no official version') .get('/v/bootstrap.json') .intercept(nock => nock('https://libraries.io') .get('/api/bower/bootstrap') .reply(200, { latest_stable_release: { name: null } }) ) // or just `{}` .expectJSON({ name: 'bower', value: 'no releases' })
28.415584
80
0.64351
997dc75c33475bfa7a92d9c71a758ef9be2db1de
22,539
js
JavaScript
widgets/widget.admin_debug.js
wltrimbl/MG-RASTv4
b78c4db5988cb3856a5d6a2bafcb53cb740e03be
[ "BSD-2-Clause" ]
7
2015-04-19T09:07:06.000Z
2018-11-03T21:40:55.000Z
widgets/widget.admin_debug.js
wltrimbl/MG-RASTv4
b78c4db5988cb3856a5d6a2bafcb53cb740e03be
[ "BSD-2-Clause" ]
7
2018-04-11T09:41:42.000Z
2021-04-23T15:46:52.000Z
widgets/widget.admin_debug.js
wltrimbl/MG-RASTv4
b78c4db5988cb3856a5d6a2bafcb53cb740e03be
[ "BSD-2-Clause" ]
7
2015-02-06T20:46:38.000Z
2018-04-17T13:44:18.000Z
(function () { var widget = Retina.Widget.extend({ about: { title: "Metagenome Analysis Widget", name: "admin_debug", author: "Tobias Paczian", requires: [ ] } }); // load all required widgets and renderers widget.setup = function () { return [ Retina.load_widget("mgbrowse"), Retina.load_renderer('table') ]; }; widget.actionResult = {}; // main display function called at startup widget.display = function (params) { widget = this; var index = widget.index; jQuery.extend(widget, params); widget.sidebar.parentNode.style.display = "none"; widget.main.className = "span10 offset1"; var html = ""; html += "<h4>User Table</h4><div id='usertable'><img src='Retina/images/waiting.gif'></div><h4>ID Finder</h4><div><div class='input-append'><input type='text' placeholder='enter ID' id='idFinderID'><button class='btn' onclick='Retina.WidgetInstances.admin_debug[1].idFinder();'>find</button><input type='button' value='deobfuscate' class='btn' onclick='document.getElementById(\"idFinderID\").value=Retina.idmap(document.getElementById(\"idFinderID\").value);'></div><div id='idFinderResult'></div></div><h4>Jobs in the Queue</h4><div id='queueMenu'></div><div id='actionResult'></div><div id='queueTable'><img src='Retina/images/waiting.gif'></div><div id='jobDetails'></div>"; // html += "<div><h4>move metagenomes between projects</h4><table><tr><th style='padding-right: 55px;'>Source Project ID</th><td><div class='input-append'><input type='text' id='projectSel'><button class='btn' onclick='Retina.WidgetInstances.admin_debug[1].showProject(document.getElementById(\"projectSel\").value);'>select</button></div></td></tr></table></div><div id='projectSpace'></div>"; html += "<h4>Change Sequence Type</h4><div class='input-append'><input type='text' id='mgid'><button class='btn' onclick='Retina.WidgetInstances.admin_debug[1].checkSequenceType();'>check</button></div><div class='input-append' style='margin-left: 25px;'><select id='seqtype'></select><button class='btn' onclick='Retina.WidgetInstances.admin_debug[1].changeSequenceType(document.getElementById(\"mgid\").value, document.getElementById(\"seqtype\").options[document.getElementById(\"seqtype\").selectedIndex].value);'>set</button></div>"; // set the output area widget.main.innerHTML = html; // load the queue data if (stm.user) { widget.createUserTable(); widget.showQueue(); } else { widget.main.innerHTML = "<p>You need to log in to view this page.</p>"; } }; widget.createUserTable = function () { var widget = Retina.WidgetInstances.admin_debug[1]; if (! widget.hasOwnProperty('user_table')) { widget.user_table = Retina.Renderer.create("table", { target: document.getElementById('usertable'), rows_per_page: 5, filter_autodetect: false, filter: { 0: { "type": "text" }, 1: { "type": "text" }, 2: { "type": "text" }, 3: { "type": "text" }, 4: { "type": "text" } }, invisible_columns: {}, sort_autodetect: true, synchronous: false, headers: stm.authHeader, sort: "lastname", default_sort: "lastname", data_manipulation: Retina.WidgetInstances.admin_debug[1].userTable, navigation_url: RetinaConfig.mgrast_api+'/user?verbosity=minimal', data: { data: [], header: [ "login", "firstname", "lastname", "email", "id", "action" ] } }); } else { widget.user_table.settings.target = document.getElementById('usertable'); } widget.user_table.render(); widget.user_table.update({},widget.user_table.index); }; widget.idFinder = function () { var widget = Retina.WidgetInstances.admin_debug[1]; var id = document.getElementById('idFinderID').value; if (id.length == 0) { alert('you must enter an id'); return; } // mg-id if (id.match(/^mgm\d+\.\d+$/) || id.match(/^\d+\.\d+$/)) { if (! id.match(/^mgm/)) { id = "mgm"+id; } jQuery.ajax({ method: "GET", dataType: "json", headers: stm.authHeader, url:RetinaConfig.mgrast_api+"/metagenome/"+id, success: function (data) { if (data.error) { document.getElementById('idFinderResult').innerHTML = "ID not found"; } else { jQuery.ajax({ method: "GET", dataType: "json", headers: stm.authHeader, mgdata: data, url: RetinaConfig.awe_url+'/job?query&info.userattr.job_id='+data.job_id, success: function (d) { var data = this.mgdata; var html = "<table>"; html += "<tr><td><b>Metagenome</b></td><td>"+data.name+"</td></tr>"; html += "<tr><td style='padding-right: 20px;'><b>metagenome ID</b></td><td>"+data.id+"</td></tr>"; html += "<tr><td><b>job ID</b></td><td>"+data.job_id+"</td></tr>"; if (d.total_count == 1) { html += "<tr><td><b>AWE ID</b></td><td>"+d.data[0].id+"</td></tr>"; html += "<tr><td><b>AWE jid</b></td><td>"+d.data[0].jid+"</td></tr>"; html += "<tr><td><b>AWE user</b></td><td>"+d.data[0].info.user+"</td></tr>"; } else { html += "<tr><td><b>AWE ID</b></td><td>no AWE job found</td></tr>"; } html += "</table>"; document.getElementById('idFinderResult').innerHTML = html; }, error: function (xhr) { Retina.WidgetInstances.login[1].handleAuthFailure(xhr); } }); } }, error: function (xhr) { Retina.WidgetInstances.login[1].handleAuthFailure(xhr); } }); } // job id else if (id.match(/^\d+$/)) { jQuery.ajax({ method: "GET", dataType: "json", headers: stm.authHeader, url: RetinaConfig.awe_url+'/job?query&info.userattr.job_id='+id, success: function (d) { if (d.total_count == 1) { var html = "<table>"; html += "<tr><td><b>Metagenome</b></td><td>"+d.data[0].info.userattr.name+"</td></tr>"; html += "<tr><td style='padding-right: 20px;'><b>metagenome ID</b></td><td>"+d.data[0].info.userattr.id+"</td></tr>"; html += "<tr><td><b>job ID</b></td><td>"+d.data[0].info.userattr.job_id+"</td></tr>"; html += "<tr><td><b>AWE ID</b></td><td>"+d.data[0].id+"</td></tr>"; html += "<tr><td><b>AWE jid</b></td><td>"+d.data[0].jid+"</td></tr>"; html += "<tr><td><b>AWE user</b></td><td>"+d.data[0].info.user+"</td></tr>"; html += "</table>"; document.getElementById('idFinderResult').innerHTML = html; } else { document.getElementById('idFinderResult').innerHTML = "AWE job not found"; } }, error: function (xhr) { Retina.WidgetInstances.login[1].handleAuthFailure(xhr); } }); } // AWE ID else { jQuery.ajax({ method: "GET", dataType: "json", headers: stm.authHeader, url: RetinaConfig.awe_url+'/job/'+id, success: function (data) { if (data.error) { document.getElementById('idFinderResult').innerHTML = "AWE job not found"; } else { data = data.data; var html = "<table>"; html += "<tr><td><b>Metagenome</b></td><td>"+data.info.userattr.name+"</td></tr>"; html += "<tr><td style='padding-right: 20px;'><b>metagenome ID</b></td><td>"+data.info.userattr.id+"</td></tr>"; html += "<tr><td><b>job ID</b></td><td>"+data.info.userattr.job_id+"</td></tr>"; html += "<tr><td><b>AWE ID</b></td><td>"+data.id+"</td></tr>"; html += "<tr><td><b>AWE jid</b></td><td>"+data.jid+"</td></tr>"; html += "<tr><td><b>AWE user</b></td><td>"+data.info.user+"</td></tr>"; html += "</table>"; document.getElementById('idFinderResult').innerHTML = html; } }, error: function (xhr) { Retina.WidgetInstances.login[1].handleAuthFailure(xhr); } }); } }; widget.userTable = function (data) { var result_data = []; stm.DataStore.userTmp = data; for (var i=0; i<data.length; i++) { result_data.push( { "login": data[i].login, "firstname": data[i].firstname, "lastname": data[i].lastname, "email": data[i].email, "id": data[i].id, "action": '<button class="btn btn-mini" onclick="Retina.WidgetInstances.admin_debug[1].impersonateUser(\''+data[i].login+'\');">impersonate</button><button style="margin-left: 10px;" class="btn btn-mini" onclick="Retina.WidgetInstances.admin_debug[1].editUser(\''+data[i].login+'\');">edit</button>' } ); } return result_data; }; widget.editUser = function (login) { var widget = this; var user; for (var i=0; i<stm.DataStore.userTmp.length; i++) { if (stm.DataStore.userTmp[i].login == login) { user = stm.DataStore.userTmp[i]; break; } } var html = [ '\ <div class="modal-header">\ <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>\ <h3>edit user</h3>\ </div>\ <div class="modal-body">\ <h4 style="margin-top: 0px;">'+user.firstname+' '+user.lastname+' ('+user.login+')</h4>' ]; html.push('<table>'); html.push('<tr><td>firstname</td><td><input type="text" value="'+user.firstname+'" id="editFirstname"></td></tr>'); html.push('<tr><td>lastname</td><td><input type="text" value="'+user.lastname+'" id="editLastname"></td></tr>'); html.push('<tr><td>email</td><td><input type="text" value="'+user.email+'" id="editEmail"></td></tr>'); html.push('<tr><td>email 2</td><td><input type="text" value="'+user.email2+'" id="editEmail2"></td></tr>'); html.push('<tr><td>password</td><td><input type="text" value="" id="editPassword"></td></tr>'); html.push('</table>'); html.push('<button class="btn" onclick="Retina.WidgetInstances.admin_debug[1].deActivateUser(\''+user.login+'\', '+(user.active == "1" ? 'true' : 'false')+');jQuery(\'#editUserDiv\').modal(\'hide\');">'+(user.active == "1" ? 'deactivate' : 'activate')+'</button><button class="btn" onclick="Retina.WidgetInstances.admin_debug[1].resetUserPassword(\''+user.login+'\',\''+user.email+'\');jQuery(\'#editUserDiv\').modal(\'hide\');">reset password</button>'); html.push('</div>\ <div class="modal-footer">\ <button class="btn btn-danger pull-left" onclick="jQuery(\'#editUserDiv\').modal(\'hide\')">cancel</button>\ <button class="btn" onclick="Retina.WidgetInstances.admin_debug[1].updateUser(\''+user.id+'\');">submit</button>\ </div>'); var modal; if (! document.getElementById('editUserDiv')) { modal = document.createElement('div'); modal.setAttribute('id', 'editUserDiv'); modal.setAttribute('class', 'modal hide fade'); document.body.appendChild(modal); } else { modal = document.getElementById('editUserDiv'); } modal.innerHTML = html.join(""); jQuery('#editUserDiv').modal('show'); }; widget.updateUser = function (id) { var widget = this; var fd = 'firstname='+document.getElementById('editFirstname').value+'&lastname='+document.getElementById('editLastname').value+'&email='+document.getElementById('editEmail').value+'&email2='+document.getElementById('editEmail2').value; if (document.getElementById('editPassword').value.length) { fd += '&dwp='+document.getElementById('editPassword').value; } jQuery.ajax({ method: "PUT", data: fd, headers: stm.authHeader, url: RetinaConfig.mgrast_api+'/user/'+id, success: function (d) { alert('user updated'); window.location.reload(); }}).fail(function(xhr, error) { alert('updating user failed'); }); jQuery('#editUserDiv').modal('hide'); }; widget.resetUserPassword = function (login, email) { var widget = this; jQuery.ajax({ method: "GET", dataType: "json", headers: stm.authHeader, url: RetinaConfig.mgrast_api+'/user/resetpassword?login='+login+'&email='+email, success: function (d) { alert('new credentials sent to user'); window.location.reload(); }}).fail(function(xhr, error) { alert('reset password failed'); }); }; widget.deActivateUser = function (login, deactivate) { var widget = Retina.WidgetInstances.admin_debug[1]; jQuery.ajax({ method: "GET", dataType: "json", headers: stm.authHeader, url: RetinaConfig.mgrast_api+'/user/deactivate/'+login+'?active='+(deactivate ? "0" : "1"), success: function (d) { alert('user status updated'); window.location.reload(); }}).fail(function(xhr, error) { alert('updating user failed'); }); }; widget.impersonateUser = function (login) { var widget = Retina.WidgetInstances.admin_debug[1]; jQuery.ajax({ method: "GET", dataType: "json", headers: stm.authHeader, url: RetinaConfig.mgrast_api+'/user/impersonate/'+login, success: function (d) { stm.authHeader = { "Authorization": "mgrast "+d.token }; jQuery.cookie(Retina.WidgetInstances.login[1].cookiename, JSON.stringify({ "user": { firstname: d.firstname, lastname: d.lastname, email: d.email, tos: d.tos, id: d.id, login: d.login }, "token": d.token }), { expires: 14 }); window.location = "mgmain.html?mgpage=pipeline"; }}).fail(function(xhr, error) { alert('impersonation failed'); }); }; widget.showQueue = function () { var widget = Retina.WidgetInstances.admin_debug[1]; // create the job table widget.queueTable = Retina.Renderer.create("table", { target: document.getElementById('queueTable'), data: { header: [ "Job ID", "MG-ID", "name", "project", "project ID", "size", "status", "user", "priority", "submitted" ], data: [] }, headers: stm.authHeader, synchronous: false, query_type: "prefix", data_manipulation: Retina.WidgetInstances.admin_debug[1].queueTableDataManipulation, navigation_url: RetinaConfig['mgrast_api'] + "/pipeline?userattr=bp_count&info.pipeline="+RetinaConfig.pipelines.join("&info.pipeline="), minwidths: [ 80, 1, 1, 1, 105, 50, 1, 1, 70, 1 ], rows_per_page: 10, filter_autodetect: false, filter: { 0: { "type": "text" }, 1: { "type": "text" }, 2: { "type": "text" }, 3: { "type": "text" }, 4: { "type": "text" }, 6: { "type": "premade-select", "options": [ { "text": "show all", "value": "in-progress&state=queued&state=pending&state=suspend" }, { "text": "in-progress", "value": "in-progress" }, { "text": "queued", "value": "queued" }, { "text": "pending", "value": "pending" }, { "text": "suspend", "value": "suspend" } ], "searchword": "in-progress&state=queued&state=pending&state=suspend" }, 7: { "type": "text" } }, asynch_column_mapping: { "Job ID": "info.name", "MG-ID": "info.userattr.id", "name": "info.userattr.name", "project": "info.project", "project ID": "info.userattr.project_id", "size": "info.userattr.bp_count", "status": "state", "user": "info.user", "priority": "info.priority", "submitted": "info.submittime" }, invisible_columns: { 2: true, 3: true } }); widget.queueTable.render(); widget.queueTable.update({ query: { 6: { "searchword": "in-progress&state=queued&state=pending&state=suspend", "field": "status" } } }, widget.queueTable.index); // create the job menu var target = document.getElementById('queueMenu'); var html = '\ <div class="input-append input-prepend">\ <span class="add-on">priority</span>\ <input type="text" value="100" id="jobPriorityField" class="span3">\ <button class="btn" onclick="Retina.WidgetInstances.admin_debug[1].setPriority(\'table\');">set</button>\ </div>'; target.innerHTML = html; }; widget.setPriority = function (what) { var widget = Retina.WidgetInstances.admin_debug[1]; var url = "?action=priority&level=" + document.getElementById('jobPriorityField').value; if (what == "table") { what = widget.currentIDs; } var promises = []; for (var i=0; i<what.length; i++) { var promise = jQuery.Deferred(); promises.push(promise); jQuery.ajax({ method: "GET", dataType: "json", headers: stm.authHeader, prom: promise, jid: what[i], url: RetinaConfig.mgrast_api+'/pipeline/'+what[i]+url, success: function (data) { Retina.WidgetInstances.admin_debug[1].actionResult[this.jid] = 'priority-success'; this.prom.resolve(); }}).fail(function(xhr, error) { Retina.WidgetInstances.admin_debug[1].actionResult[this.jid] = 'priority-error'; this.prom.resolve(); }); } jQuery.when.apply(this, promises).then(function() { Retina.WidgetInstances.admin_debug[1].showActionResults(); }); }; widget.showActionResults = function () { var widget = Retina.WidgetInstances.admin_debug[1]; var prioSuccess = []; var prioError = []; for (var i in widget.actionResult) { if (widget.actionResult.hasOwnProperty(i)) { if (widget.actionResult[i] == "priority-success") { prioSuccess.push(i); } else if (widget.actionResult[i] == "priority-error") { prioError.push(i); } } } var html = ""; if (prioSuccess.length) { html += '<div class="alert alert-success"><button type="button" class="close" data-dismiss="alert">&times;</button><strong>success - </strong>job priorities set for jobs '+prioSuccess.join(", ")+'</div>'; } if (prioError.length) { html += '<div class="alert alert-error"><button type="button" class="close" data-dismiss="alert">&times;</button><strong>error - </strong>failed to set job priorities for jobs '+prioError.join(", ")+'</div>'; } document.getElementById('actionResult').innerHTML = html; Retina.WidgetInstances.admin_debug[1].actionResult = {}; widget.queueTable.settings.navigation_callback({}, widget.queueTable.index); }; widget.showJobDetails = function (user, id) { var widget = Retina.WidgetInstances.admin_debug[1]; window.open("mgmain.html?mgpage=pipeline&admin=1&user="+user+"&job="+id); }; widget.deleteProject = function(id) { var widget = this; var fd = new FormData(); fd.append('id', id); jQuery.ajax({ method: "POST", contentType: false, processData: false, data: fd, crossDomain: true, headers: stm.authHeader, url: RetinaConfig.mgrast_api+'/project/delete', success: function (data) { if (data.hasOwnProperty('OK')) { alert('project deleted'); document.getElementById('projectSel').value = ""; document.getElementById('projectSpace').innerHTML = ""; } else { alert(data.ERROR); } }, error: function (data) { document.getElementById('projectSpace').innerHTML = "<div class='alert alert-error'>deleting project failed</div>"; }}); }; widget.createProject = function () { var widget = this; var name = prompt('select project name'); var user = 'paczian'; var fd = new FormData(); fd.append('user', user); fd.append('name', name); jQuery.ajax({ method: "POST", contentType: false, processData: false, data: fd, crossDomain: true, headers: stm.authHeader, url: RetinaConfig.mgrast_api+'/project/create', success: function (data) { document.getElementById('project_b').value = data.project; }, error: function (data) { document.getElementById('projectSpace').innerHTML = "<div class='alert alert-error'>creating project failed</div>"; }}); }; widget.checkSequenceType = function () { var widget = Retina.WidgetInstances.admin_debug[1]; var mgid = document.getElementById('mgid').value; jQuery.ajax({ method: "GET", dataType: "json", headers: stm.authHeader, url: RetinaConfig.mgrast_api+'/metagenome/'+mgid, success: function (data) { var types = [ "Amplicon", "MT", "WGS", "Unknown", "Metabarcode" ]; var html = ""; for (var i=0; i<types.length; i++) { var sel = ""; if (types[i] == data.sequence_type) { sel = " selected=selected"; } html += "<option"+sel+">"+types[i]+"</option>"; } document.getElementById('seqtype').innerHTML = html; }}); }; widget.changeSequenceType = function (mgid, type) { var widget = Retina.WidgetInstances.admin_debug[1]; jQuery.ajax({ method: "GET", dataType: "json", headers: stm.authHeader, url: RetinaConfig.mgrast_api+'/metagenome/'+mgid+"/changesequencetype/"+type, success: function (data) { alert('sequence type changed.'); }}); }; // widget.moveMetagenomes = function (pid) { // var widget = Retina.WidgetInstances.admin_debug[1]; // var mgs = []; // var sel = document.getElementById('project_a').options; // for (var i=0; i<sel.length; i++) { // if (sel[i].selected) { // mgs.push("move="+sel[i].text); // } // } // var pid_b = document.getElementById('project_b').value; // if (pid_b.match(/^\d$/)) { // pid_b = "mgp" + pid_b; // } // jQuery.ajax({ // method: "GET", // dataType: "json", // headers: stm.authHeader, // url: RetinaConfig.mgrast_api+'/project/'+pid+"/movemetagenomes?target="+pid_b+"&"+mgs.join("&"), // success: function (data) { // Retina.WidgetInstances.admin_debug[1].showProject(pid); // document.getElementById('project_message_space').innerHTML = "<div class='alert alert-success'>metagenomes moved successfully</div>"; // }, // error: function (data) { // document.getElementById('projectSpace').innerHTML = "<div class='alert alert-error'>moving metagenomes failed, is the target ID valid?</div>"; // }}); // }; widget.queueTableDataManipulation = function (data) { var result_data = []; widget.currentIDs = []; for (var i=0; i<data.length; i++) { widget.currentIDs.push(data[i].info.userattr.id); result_data.push( { "Job ID": "<a onclick='window.open(\""+RetinaConfig['awe_url']+"/monitor/index.html?page=monitor&jobdetail="+data[i].id+"\")' style='cursor: pointer;'>"+data[i].info.name+"</a>", "MG-ID": "<a onclick='Retina.WidgetInstances.admin_debug[1].showJobDetails(\""+data[i].info.user+"\", \""+data[i].info.userattr.job_id+"\");' style='cursor: pointer;'>"+data[i].info.userattr.id+"</a>", "name": data[i].info.userattr.name+"</a>", "project": data[i].info.project, "project ID": data[i].info.userattr.project_id, "size": data[i].info.userattr.bp_count ? parseInt(data[i].info.userattr.bp_count).baseSize() : "-", "status": data[i].state, "user": data[i].info.user, "priority": data[i].info.priority, "submitted": data[i].info.submittime } ); } return result_data; }; })();
37.316225
679
0.616221
997df900a070fd9a99d5b5dccb30470ea9514a52
2,292
js
JavaScript
app.js
JakeScudder/node-mysql
10d5000b416a7dd463385473c7c2856452140038
[ "MIT" ]
null
null
null
app.js
JakeScudder/node-mysql
10d5000b416a7dd463385473c7c2856452140038
[ "MIT" ]
null
null
null
app.js
JakeScudder/node-mysql
10d5000b416a7dd463385473c7c2856452140038
[ "MIT" ]
null
null
null
const express = require('express'); const mysql = require('mysql'); // Create connection const db = mysql.createConnection({ host : 'localhost', user : 'jake', password : '123456', database : 'nodemysql2' }); // Connect db.connect((err) => { if(err) { throw err; } console.log('MySql Connected...'); }); const app = express(); //Create DB app.get('/createdb', (req, res) => { let sql = 'CREATE DATABASE nodemysql2' db.query(sql, (err, result) => { if(err) throw err; console.log(result); res.send('database created...'); }) }) app.get('/createpoststable', (req, res) => { let sql = 'CREATE TABLE posts(id int AUTO_INCREMENT, title VARCHAR(255), body VARCHAR(255), PRIMARY KEY(id))'; db.query(sql, (err, result) => { if(err) throw err; console.log(result); res.send('Posts table created'); }) }) //Insert post 1 app.get('/addpost2', (req, res) => { let post = { title: 'Post Two', body: 'This is post number two'} let sql = 'INSERT INTO posts SET ?'; let query = db.query(sql, post, (err, result) => { if(err) throw err; console.log(result); res.send('Post 2 created'); }); }) //Select Posts app.get('/getposts', (req, res) => { let sql = 'SELECT * FROM posts'; let query = db.query(sql, (err, result) => { if(err) throw err; console.log(result); res.send('Posts fetched...'); }); }) //Select single post app.get('/getpost/:id', (req, res) => { let sql = `SELECT * FROM posts WHERE id = ${req.params.id}`; let query = db.query(sql, (err, result) => { if(err) throw err; console.log(result); res.send('Post fetched...'); }); }) //Update post app.get('/updatepost/:id', (req, res) => { let newTitle = 'Updated Title'; let sql = `UPDATE posts SET title = '${newTitle}' WHERE id = ${req.params.id}`; let query = db.query(sql, (err, result) => { if(err) throw err; console.log(result); res.send('Post updated...'); }); }) //Delete post app.get('/deletepost/:id', (req, res) => { let sql = `DELETE FROM posts WHERE id = ${req.params.id}`; let query = db.query(sql, (err, result) => { if(err) throw err; console.log(result); res.send('Post deleted...'); }); }) app.listen('3000', () => { console.log('Server started on port 3000'); });
23.151515
112
0.59075
997e807c70244bb5220de438286205822bc7818b
17,927
js
JavaScript
post-cartoon-v/post.js
spite/sketch
0d4d75b35a8ec9b1c6c02d4dd9d0626070686a35
[ "MIT" ]
170
2020-10-03T20:41:57.000Z
2022-03-09T02:36:38.000Z
post-cartoon-v/post.js
w0lramD/sketch
0d4d75b35a8ec9b1c6c02d4dd9d0626070686a35
[ "MIT" ]
1
2020-11-09T06:47:48.000Z
2020-11-10T00:30:28.000Z
post-cartoon-v/post.js
w0lramD/sketch
0d4d75b35a8ec9b1c6c02d4dd9d0626070686a35
[ "MIT" ]
11
2020-10-06T23:04:54.000Z
2022-02-07T19:10:04.000Z
import { Color, DoubleSide, MeshNormalMaterial, RawShaderMaterial, TextureLoader, RepeatWrapping, HalfFloatType, RGBAFormat, UnsignedByteType, Vector2, } from "../third_party/three.module.js"; import { ShaderPass } from "../js/ShaderPass.js"; import { ShaderPingPongPass } from "../js/ShaderPingPongPass.js"; import { getFBO } from "../js/FBO.js"; import { shader as orthoVs } from "../shaders/ortho-vs.js"; import { shader as sobel } from "../shaders/sobel.js"; import { shader as aastep } from "../shaders/aastep.js"; import { shader as luma } from "../shaders/luma.js"; import { generateParams as generatePaperParams } from "../js/paper.js"; import { shader as darken } from "../shaders/blend-darken.js"; import { shader as screen } from "../shaders/blend-screen.js"; import { blur5 } from "../shaders/fast-separable-gaussian-blur.js"; import { Material as ColorMaterial, generateParams as generateColorParams, } from "./ColorMaterial.js"; const normalMat = new MeshNormalMaterial({ side: DoubleSide }); const colorMat = new ColorMaterial({ side: DoubleSide }); const loader = new TextureLoader(); const noiseTexture = loader.load("../assets/noise1.png"); noiseTexture.wrapS = noiseTexture.wrapT = RepeatWrapping; const blurFragmentShader = `#version 300 es precision highp float; uniform sampler2D inputTexture; uniform vec2 direction; ${blur5} in vec2 vUv; out vec4 fragColor; void main() { vec2 size = vec2(textureSize(inputTexture, 0)); fragColor = blur5(inputTexture, vUv, size, direction); } `; const componentFragmentShader = `#version 300 es precision highp float; uniform sampler2D colorTexture; uniform vec3 component; uniform float cyan; uniform float magenta; uniform float yellow; uniform float black; in vec2 vUv; out vec4 fragColor; vec4 RGBtoCMYK (vec3 rgb) { vec4 cmyk; cmyk.xyz = 1.- rgb; cmyk.w = min(cmyk.x, min(cmyk.y, cmyk.z)); return cmyk; } void main() { vec4 color = texture(colorTexture, vUv); vec4 cmyk = RGBtoCMYK(color.rgb); cmyk *= vec4(cyan, magenta, yellow, black); fragColor = cmyk; } `; const fragmentShader = `#version 300 es precision highp float; uniform sampler2D colorTexture; uniform sampler2D shadeTexture; uniform sampler2D normalTexture; uniform sampler2D paperTexture; uniform sampler2D componentTexture; uniform sampler2D noiseTexture; uniform vec3 darkInk; uniform vec3 brightInk; uniform float scale; uniform float thickness; uniform float noisiness; uniform float angle; uniform float contour; uniform float border; uniform float fill; uniform float stroke; uniform float darkIntensity; uniform float brightIntensity; out vec4 fragColor; in vec2 vUv; ${sobel} ${luma} ${aastep} ${darken} ${screen} #define TAU 6.28318530718 #define LEVELS 5 #define fLEVELS float(LEVELS) vec4 sampleSrc(in sampler2D src, in vec2 uv) { vec4 color = texture(src, uv); return color; } vec4 sampleStep(in sampler2D src, in vec2 uv, in float level) { vec4 l = sampleSrc(src, uv); l = round(l*fLEVELS) / fLEVELS; return vec4(l.x>level?1.:0., l.y>level?1.:0., l.z>level?1.:0., l.w>level?1.:0.); } vec4 findBorder(in sampler2D src, in vec2 uv, in vec2 resolution, in float level){ float x = thickness / resolution.x; float y = thickness / resolution.y; vec4 horizEdge = vec4(0.); horizEdge -= sampleStep(src, vec2( uv.x - x, uv.y - y ), level ) * 1.0; horizEdge -= sampleStep(src, vec2( uv.x - x, uv.y ), level ) * 2.0; horizEdge -= sampleStep(src, vec2( uv.x - x, uv.y + y ), level ) * 1.0; horizEdge += sampleStep(src, vec2( uv.x + x, uv.y - y ), level ) * 1.0; horizEdge += sampleStep(src, vec2( uv.x + x, uv.y ), level ) * 2.0; horizEdge += sampleStep(src, vec2( uv.x + x, uv.y + y ), level ) * 1.0; vec4 vertEdge = vec4(0.); vertEdge -= sampleStep(src, vec2( uv.x - x, uv.y - y ), level ) * 1.0; vertEdge -= sampleStep(src, vec2( uv.x , uv.y - y ), level ) * 2.0; vertEdge -= sampleStep(src, vec2( uv.x + x, uv.y - y ), level ) * 1.0; vertEdge += sampleStep(src, vec2( uv.x - x, uv.y + y ), level ) * 1.0; vertEdge += sampleStep(src, vec2( uv.x , uv.y + y ), level ) * 2.0; vertEdge += sampleStep(src, vec2( uv.x + x, uv.y + y ), level ) * 1.0; vec4 edge = sqrt((horizEdge * horizEdge) + (vertEdge * vertEdge)); return edge; } float simplex(in vec3 v) { return 2. * texture(noiseTexture, v.xy/32.).r - 1.; } float fbm3(vec3 v) { float result = simplex(v); result += simplex(v * 2.) / 2.; result += simplex(v * 4.) / 4.; result /= (1. + 1./2. + 1./4.); return result; } float fbm5(vec3 v) { float result = simplex(v); result += simplex(v * 2.) / 2.; result += simplex(v * 4.) / 4.; result += simplex(v * 8.) / 8.; result += simplex(v * 16.) / 16.; result /= (1. + 1./2. + 1./4. + 1./8. + 1./16.); return result; } mat2 rot(in float a) { a = a * TAU / 360.; float s = sin(a); float c = cos(a); mat2 rot = mat2(c, -s, s, c); return rot; } float doHatch(in float l, in float r, in float a, in vec2 uv) { if(l>r) { return 1.; } float ra = angle + a + mix(0., 3.2 * TAU, l); float s = sin(ra); float c = cos(ra); mat2 rot = mat2(c, -s, s, c); uv = rot * uv; float e = thickness; float threshold = mix(2., 40., l); float v = abs(mod(uv.y+r*threshold, threshold)); if (v < e) { v = 0.; } else { v = 1.; } return v; } vec3 CMYKtoRGB (vec4 cmyk) { float c = cmyk.x; float m = cmyk.y; float y = cmyk.z; float k = cmyk.w; float invK = 1.0 - k; float r = 1.0 - min(1.0, c * invK + k); float g = 1.0 - min(1.0, m * invK + k); float b = 1.0 - min(1.0, y * invK + k); return clamp(vec3(r, g, b), 0.0, 1.0); } float lines( in float l, in vec2 fragCoord, in vec2 resolution, in float thickness){ vec2 center = vec2(resolution.x/2., resolution.y/2.); vec2 uv = fragCoord.xy * resolution; float c = (.5 + .5 * sin(uv.x*.5)); float f = (c+thickness)*l; float e = 1. * length(vec2(dFdx(fragCoord.x), dFdy(fragCoord.y))); f = smoothstep(.5-e, .5+e, f); return f; } #define TAU 6.28318530718 void main() { vec2 size = vec2(textureSize(colorTexture, 0)); vec4 col = vec4(0.); vec4 borders = vec4(0.); for(int i=0; i<LEVELS; i++) { float f = float(i) / fLEVELS; float ss = scale * mix(1., 4., f); vec2 offset = noisiness * vec2(fbm3(vec3(ss*vUv,1.)), fbm3(vec3(ss*vUv.yx,1.))); vec2 uv = vUv + offset; vec4 b = findBorder(componentTexture, uv, size, f); borders += b; vec4 c = sampleStep(componentTexture, uv, f); col += c / fLEVELS; } float shadeCol = 0.; float shadeBorder = 0.; int SHADELEVES = 3; for(int i=0; i<SHADELEVES; i++) { float f = float(i) / float(SHADELEVES); float ss = scale * mix(1., 4., f); vec2 offset = noisiness * vec2(fbm3(vec3(ss*vUv,1.)), fbm3(vec3(ss*vUv.yx,1.))); vec2 uv = vUv + offset; vec4 b = findBorder(shadeTexture, uv, size, f); shadeBorder += luma(b.rgb); vec4 c = sampleStep(shadeTexture, uv, f); shadeCol += luma(c.rgb) / float(SHADELEVES); } float ss = scale * 5.; vec2 offset = noisiness * vec2(fbm3(vec3(ss*vUv,1.)), fbm3(vec3(ss*vUv.yx,1.))); vec2 uv = vUv + offset; vec4 cc = 1.-texture(componentTexture,uv); cc = round(cc*fLEVELS)/fLEVELS; vec4 hatch = vec4( doHatch(cc.x, .75, 75., uv * size), doHatch(cc.y, .75, 15., uv * size), doHatch(cc.z, .75, 0., uv * size), doHatch(cc.w, .75, 45., uv * size) ); mat2 r = rot(45.); float shadeL = luma(texture(shadeTexture, uv).rgb); float shadeHatch = lines(1.5*shadeL, r*vUv, size, 1.); float whiteHatch = lines(shadeL/2., r*vUv, size, 1.); float normalEdge = length(sobel(normalTexture, uv, size, contour)); normalEdge = aastep(.5, normalEdge); float k = col.w; col.w = 0.; vec3 rgb = CMYKtoRGB(col).rgb; vec4 paper = texture(paperTexture, .00025 * vUv*size); fragColor.rgb = blendDarken(paper.rgb, rgb, fill); fragColor.rgb = blendDarken(fragColor.rgb, darkInk/255., fill * k); fragColor.rgb = blendDarken(fragColor.rgb, darkInk/255., normalEdge); fragColor.rgb = blendDarken(fragColor.rgb, CMYKtoRGB(borders).rgb,border * .5); fragColor.rgb = blendDarken(fragColor.rgb, darkInk/255., border * .1 * (1.-borders.w)); fragColor.rgb = blendDarken(fragColor.rgb, CMYKtoRGB(1.-vec4(hatch.xyz,1.)), stroke); fragColor.rgb = blendDarken(fragColor.rgb, darkInk/255., stroke*(1.-hatch.w)); float shade = 1.-(shadeCol - shadeBorder*(1.-1.5*shadeCol)); shade = clamp(shade-.5, 0., 1.); fragColor.rgb = blendDarken(fragColor.rgb, darkInk/255., border*.25 * shade); fragColor.rgb = blendDarken(fragColor.rgb, darkInk/255., darkIntensity * (1.-shadeHatch)); fragColor.rgb = blendScreen(fragColor.rgb, brightInk/255., brightIntensity * whiteHatch); fragColor.a = 1.; } `; class Post { constructor(renderer) { this.renderer = renderer; this.colorFBO = getFBO(1, 1); this.shadeFBO = getFBO(1, 1); this.normalFBO = getFBO(1, 1); this.params = { roughness: 0.2, metalness: 0.1, colorScale: 0.07, colorOffset: 0.25, colorWidth: 0.5, scale: 0.32, angle: 0, thickness: 0.7, noisiness: 0.003, contour: 2, blur: 2, border: 0.5, fill: 1, stroke: 1, cyan: 1, magenta: 0.7, yellow: 0.6, black: 0.1, darkIntensity: 0.75, brightIntensity: 1, darkInk: new Color(30, 30, 30), brightInk: new Color(230, 230, 230), }; const shader = new RawShaderMaterial({ uniforms: { paperTexture: { value: null }, colorTexture: { value: this.colorFBO.texture }, shadeTexture: { value: this.shadeFBO.texture }, componentTexture: { value: null }, normalTexture: { value: this.normalFBO.texture }, noiseTexture: { value: noiseTexture }, darkInk: { value: this.params.darkInk }, brightInk: { value: this.params.brightInk }, scale: { value: this.params.scale }, thickness: { value: this.params.thickness }, contour: { value: this.params.contour }, border: { value: this.params.border }, blur: { value: this.params.blur }, stroke: { value: this.params.stroke }, fill: { value: this.params.fill }, darkIntensity: { value: this.params.darkIntensity }, brightIntensity: { value: this.params.brightIntensity }, noisiness: { value: this.params.noisiness }, angle: { value: this.params.angle }, }, vertexShader: orthoVs, fragmentShader, }); const blurShader = new RawShaderMaterial({ uniforms: { inputTexture: { value: this.colorFBO.texture }, direction: { value: new Vector2() }, }, vertexShader: orthoVs, fragmentShader: blurFragmentShader, }); this.blurPass = new ShaderPingPongPass(renderer, blurShader, { format: RGBAFormat, type: UnsignedByteType, }); this.blurShadePass = new ShaderPingPongPass(renderer, blurShader, { format: RGBAFormat, type: UnsignedByteType, }); this.renderPass = new ShaderPass(renderer, shader); const componentShader = new RawShaderMaterial({ uniforms: { colorTexture: { value: null }, cyan: { value: this.params.cyan }, magenta: { value: this.params.magenta }, yellow: { value: this.params.yellow }, black: { value: this.params.black }, }, vertexShader: orthoVs, fragmentShader: componentFragmentShader, }); this.componentPass = new ShaderPass(renderer, componentShader, { type: HalfFloatType, format: RGBAFormat, }); shader.uniforms.componentTexture.value = this.componentPass.fbo.texture; } setSize(w, h) { this.normalFBO.setSize(w, h); this.colorFBO.setSize(w, h); this.shadeFBO.setSize(w, h); this.renderPass.setSize(w, h); this.componentPass.setSize(w, h); this.blurPass.setSize(w, h); this.blurShadePass.setSize(w, h); } render(scene, camera) { this.renderer.setRenderTarget(this.shadeFBO); this.renderer.render(scene, camera); this.renderer.setRenderTarget(null); scene.overrideMaterial = colorMat; this.renderer.setRenderTarget(this.colorFBO); this.renderer.render(scene, camera); this.renderer.setRenderTarget(null); scene.overrideMaterial = null; scene.overrideMaterial = normalMat; this.renderer.setRenderTarget(this.normalFBO); this.renderer.render(scene, camera); this.renderer.setRenderTarget(null); scene.overrideMaterial = null; this.blurPass.shader.uniforms.inputTexture.value = this.colorFBO.texture; for (let i = 0; i < 6; i++) { if (i < this.params.blur) { var d = (i + 1) * 2; this.blurPass.shader.uniforms.direction.value.set(d, 0); this.blurPass.render(); this.blurPass.shader.uniforms.inputTexture.value = this.blurPass.fbos[ this.blurPass.currentFBO ].texture; this.blurPass.shader.uniforms.direction.value.set(0, d); this.blurPass.render(); this.blurPass.shader.uniforms.inputTexture.value = this.blurPass.fbos[ this.blurPass.currentFBO ].texture; } } this.componentPass.shader.uniforms.colorTexture.value = this.blurPass.shader.uniforms.inputTexture.value = this.blurPass.fbos[ this.blurPass.currentFBO ].texture; this.blurShadePass.shader.uniforms.inputTexture.value = this.shadeFBO.texture; for (let i = 0; i < 6; i++) { if (i < this.params.blur) { var d = (i + 1) * 2; this.blurShadePass.shader.uniforms.direction.value.set(d, 0); this.blurShadePass.render(); this.blurShadePass.shader.uniforms.inputTexture.value = this.blurShadePass.fbos[ this.blurShadePass.currentFBO ].texture; this.blurShadePass.shader.uniforms.direction.value.set(0, d); this.blurShadePass.render(); this.blurShadePass.shader.uniforms.inputTexture.value = this.blurShadePass.fbos[ this.blurShadePass.currentFBO ].texture; } } this.renderPass.shader.uniforms.shadeTexture.value = this.blurShadePass.shader.uniforms.inputTexture.value = this.blurShadePass.fbos[ this.blurShadePass.currentFBO ].texture; this.componentPass.render(); this.renderPass.render(true); } generateParams(gui) { const controllers = {}; controllers["colorScale"] = gui .add(this.params, "colorScale", 0.01, 1) .onChange(async (v) => { colorMat.uniforms.scale.value = v; }); controllers["colorOffset"] = gui .add(this.params, "colorOffset", 0.0, 1) .onChange(async (v) => { colorMat.uniforms.offset.value = v; }); controllers["colorWidth"] = gui .add(this.params, "colorWidth", 0.0, 1) .onChange(async (v) => { colorMat.uniforms.width.value = v; }); controllers["scale"] = gui .add(this.params, "scale", 0.1, 1) .onChange(async (v) => { this.renderPass.shader.uniforms.scale.value = v; }); controllers["thickness"] = gui .add(this.params, "thickness", 0.5, 5) .onChange(async (v) => { this.renderPass.shader.uniforms.thickness.value = v; }); controllers["blur"] = gui.add(this.params, "blur", 0, 7); controllers["contour"] = gui .add(this.params, "contour", 0, 5) .onChange(async (v) => { this.renderPass.shader.uniforms.contour.value = v; }); controllers["border"] = gui .add(this.params, "border", 0, 1) .onChange(async (v) => { this.renderPass.shader.uniforms.border.value = v; }); controllers["stroke"] = gui .add(this.params, "stroke", 0, 1) .onChange(async (v) => { this.renderPass.shader.uniforms.stroke.value = v; }); controllers["fill"] = gui .add(this.params, "fill", 0, 1) .onChange(async (v) => { this.renderPass.shader.uniforms.fill.value = v; }); controllers["noisiness"] = gui .add(this.params, "noisiness", 0, 0.02) .onChange(async (v) => { this.renderPass.shader.uniforms.noisiness.value = v; }); controllers["angle"] = gui .add(this.params, "angle", 0, Math.PI) .onChange(async (v) => { this.renderPass.shader.uniforms.angle.value = v; }); controllers["cyan"] = gui .add(this.params, "cyan", 0, 1) .onChange(async (v) => { this.componentPass.shader.uniforms.cyan.value = v; }); controllers["magenta"] = gui .add(this.params, "magenta", 0, 1) .onChange(async (v) => { this.componentPass.shader.uniforms.magenta.value = v; }); controllers["yellow"] = gui .add(this.params, "yellow", 0, 1) .onChange(async (v) => { this.componentPass.shader.uniforms.yellow.value = v; }); controllers["black"] = gui .add(this.params, "black", 0, 1) .onChange(async (v) => { this.componentPass.shader.uniforms.black.value = v; }); controllers["darkIntensity"] = gui .add(this.params, "darkIntensity", 0, 1) .onChange(async (v) => { this.renderPass.shader.uniforms.darkIntensity.value = v; }); controllers["darkInk"] = gui .addColor(this.params, "darkInk") .onChange(async (v) => { this.renderPass.shader.uniforms.darkInk.value.copy(v); }); controllers["brightIntensity"] = gui .add(this.params, "brightIntensity", 0, 1) .onChange(async (v) => { this.renderPass.shader.uniforms.brightIntensity.value = v; }); controllers["brightInk"] = gui .addColor(this.params, "brightInk") .onChange(async (v) => { this.renderPass.shader.uniforms.brightInk.value.copy(v); }); controllers["paper"] = generatePaperParams(gui, this.renderPass.shader); return controllers; } } export { Post };
30.749571
137
0.626876
997f0093c52eb76f4ce49890300060e89ebd3885
1,207
js
JavaScript
src/components/parts/DatabaseList.js
KaitlinJKelley/stock-up-client
e96a3f6548b49b3f4f1de0b21b49223adb7d0dfe
[ "OML" ]
null
null
null
src/components/parts/DatabaseList.js
KaitlinJKelley/stock-up-client
e96a3f6548b49b3f4f1de0b21b49223adb7d0dfe
[ "OML" ]
31
2021-06-07T20:49:10.000Z
2021-08-20T16:44:45.000Z
src/components/parts/DatabaseList.js
KaitlinJKelley/stock-up-client
e96a3f6548b49b3f4f1de0b21b49223adb7d0dfe
[ "OML" ]
2
2021-06-23T07:22:21.000Z
2021-06-24T16:22:56.000Z
import React, { useContext, useEffect } from 'react' import { useHistory } from 'react-router' import {DatabaseContext} from './DatabaseProvider' import Button from 'react-bootstrap/Button' import ListGroup from 'react-bootstrap/ListGroup' import { Link } from 'react-router-dom' export const DatabaseList = () => { const history = useHistory() const { getDatabase, database } = useContext(DatabaseContext) console.log(database) useEffect(() => { getDatabase() },[]) return(<> <h1>All Parts</h1> <Button variant='success' onClick={() => history.push('/database/new')}>Add new part</Button> {database.map(part => ['sm'].map((breakpoint, idx) => ( <ListGroup horizontal={breakpoint} className='database' key={idx}> <ListGroup.Item>{part.name}</ListGroup.Item> <ListGroup.Item>{part.part_number}</ListGroup.Item> <ListGroup.Item>{part.vendor.name}</ListGroup.Item> {/* Passes part object to InventoryForm */} <Link to={{pathname: '/inventory/new', state: {passPart: part}}} variant='success'>Add to inventory</Link> </ListGroup> )) )} </>) }
36.575758
118
0.61889
997fe0a1529a5a1d90102416d5ed6f5254ee2b92
1,074
js
JavaScript
app/sagas/playback.saga.js
bakery/openmic
a8bb97566ddba0fb7d02964ea6610c5a4344a8f6
[ "MIT" ]
5
2016-09-14T17:07:58.000Z
2018-05-01T15:34:40.000Z
app/sagas/playback.saga.js
tomjal/openmic
5742eec5582ab132e8aee13cbf66a1e319ccafa1
[ "MIT" ]
null
null
null
app/sagas/playback.saga.js
tomjal/openmic
5742eec5582ab132e8aee13cbf66a1e319ccafa1
[ "MIT" ]
1
2018-07-12T11:06:43.000Z
2018-07-12T11:06:43.000Z
/* eslint-disable no-constant-condition */ import { takeEvery } from 'redux-saga'; import { apply, put } from 'redux-saga/effects'; import { PLAY_AUDIO, PAUSE_AUDIO, AUDIO_PLAYBACK_COMPLETE, } from 'MarkerOverlay/constants'; import Playback from 'playback'; const thePlayer = new Playback(); let currentlyPlayingMarker = null; function* doPlay(action) { if (action.type === PLAY_AUDIO) { if (thePlayer.isPlaying() && currentlyPlayingMarker) { yield put({ type: AUDIO_PLAYBACK_COMPLETE, payload: { marker: currentlyPlayingMarker, }, }); } currentlyPlayingMarker = action.payload.marker; yield apply(thePlayer, thePlayer.play, [action.payload.marker.sound]); yield put({ type: AUDIO_PLAYBACK_COMPLETE, payload: { marker: action.payload.marker, }, }); currentlyPlayingMarker = null; } if (action.type === PAUSE_AUDIO) { yield apply(thePlayer, thePlayer.pause); } } export function* playback() { yield* takeEvery([PLAY_AUDIO, PAUSE_AUDIO], doPlay); }
23.347826
74
0.663873
99801cbc4d6d81e3e1db8ed89849b0ccd29b4d37
751
js
JavaScript
back/src/tests/film_queries.test.js
BeataStultica/MoviePlaza-1
00a4e6e0a98a4a2585ebcf4b1cbb03b07b4eb0d1
[ "BSL-1.0" ]
null
null
null
back/src/tests/film_queries.test.js
BeataStultica/MoviePlaza-1
00a4e6e0a98a4a2585ebcf4b1cbb03b07b4eb0d1
[ "BSL-1.0" ]
2
2021-05-20T01:47:36.000Z
2021-09-21T12:28:25.000Z
back/src/tests/film_queries.test.js
BeataStultica/MoviePlaza-1
00a4e6e0a98a4a2585ebcf4b1cbb03b07b4eb0d1
[ "BSL-1.0" ]
null
null
null
process.env.NODE_ENV = 'test'; const db = require('../queries/pool'); const { getFilms } = require('../queries/film_queries'); const { getLastFilms } = require('../queries/newfilms_queries'); describe('GET film', () => { test('GET film', async (done) => { const film = await getFilms(1, db); expect(film).toHaveProperty('genres'); expect(film).toHaveProperty('comments'); expect(film.filmname).toEqual('Семейка Аддамс'); expect(film.genres).toContain('Комедия'); expect(film.comments[0]).toHaveProperty('comments'); done(); }); test('GET new films', async (done) => { const films = await getLastFilms(db); expect(films.length).toEqual(6); done(); }); });
35.761905
64
0.601864
99803956c72c067048c40d716e1adb3556c0bbe3
3,754
js
JavaScript
packages/homelessness/src/components/Definition/DefinitionPieChart.js
jaronheard/civic
4a8da0a2b97dad1c67df60c78419a285abbb3393
[ "MIT" ]
62
2017-10-12T18:45:12.000Z
2021-04-03T09:26:24.000Z
packages/homelessness/src/components/Definition/DefinitionPieChart.js
toder34/civic
d6ea67d75cff418f6200d4ee5899dbd8c54d069e
[ "MIT" ]
730
2017-10-13T00:00:43.000Z
2022-03-31T14:37:15.000Z
packages/homelessness/src/components/Definition/DefinitionPieChart.js
toder34/civic
d6ea67d75cff418f6200d4ee5899dbd8c54d069e
[ "MIT" ]
41
2017-10-22T18:38:12.000Z
2021-04-06T14:16:52.000Z
import React from "react"; import PropTypes from "prop-types"; import { css } from "emotion"; import { HalfDonutChart } from "../Reuseable"; const containerClass = css` color: #726371; font-weight: bold; display: flex; flex-direction: column; justify-content: center; align-items: center; margin-bottom: 35px; `; const yearsContainerClass = css` display: flex; justify-content: space-between; `; const listItemClass = css` display: inline; padding: 10px; color: #aaa4ab; flex: inherit; `; const linkClass = css` display: inline-block; padding: 5px; font-size: 1.3em; border: 0; font-family: inherit; &:hover { color: black; cursor: pointer; } `; const linkActiveClass = css` font-weight: bold; color: black; border-bottom: 3px solid black; `; const findPercentage = (val, arr) => { const total = arr.reduce((acc, cur) => acc + cur.value, 0); return (val / total) * 100; }; const getUniqueYears = arr => arr .reduce((acc, curr) => { if (acc.indexOf(curr.year) === -1) { acc.push(curr.year); } return acc; }, []) .sort(); const getKeyByValue = (obj, val) => Object.keys(obj).find(key => obj[key] === val); const pieLabel = options => { if (!options.payload.label) { return null; } return ( <Text {...options} x={options.cx} y={options.cy - 20} fontSize={34} fill={"black"} style={{ fontWeight: "bold" }} textAnchor={"middle"} alignmentBaseline="middle" className="recharts-pie-label-text" > {`${options.payload.value.toFixed(1)}%`} </Text> ); }; class DefinitionPieChart extends React.Component { constructor(props) { super(props); this.state = { year: 2015, activeValue: props.initialValue }; this.updateCategory = this.updateCategory.bind(this); this.cleanData = this.cleanData.bind(this); } cleanData(data) { return data .filter(item => item.year === this.state.year) .map((item, idx, arr) => ({ ...item, name: this.props.categories[item.name], value: findPercentage(item.value, arr), rawCount: item.value, rawTotal: arr.reduce((acc, cur) => acc + cur.value, 0) })); } updateCategory(val) { if (val !== this.state.activeValue) { this.setState({ activeValue: val }); } } render() { return ( <div> <div> {this.props.data.length > 0 && React.cloneElement(this.props.content[this.state.activeValue], { year: this.state.year, data: this.cleanData(this.props.data).filter( item => item.name === this.state.activeValue )[0] })} </div> <div className={containerClass}> <div className={yearsContainerClass}> <ul> {getUniqueYears(this.props.data).map(item => { const active = item === this.state.year ? linkActiveClass : ""; return ( <li className={listItemClass} key={item}> <a className={`${linkClass} ${active}`} onClick={() => this.setState({ year: item })} > {item} </a> </li> ); })} </ul> </div> </div> <HalfDonutChart dataSets={this.cleanData(this.props.data)} /> </div> ); } } DefinitionPieChart.propTypes = { colors: PropTypes.array, categories: PropTypes.object, initialValue: PropTypes.string, data: PropTypes.array, content: PropTypes.object }; export default DefinitionPieChart;
22.890244
79
0.552744
998049fd9d93479e9fabee30a516db2e82c0ca9a
2,842
js
JavaScript
test/js/unit/About.js
DamavandiKamali/TinCanJS
8733f14ddcaeea77a0579505300bc8f38921a6b1
[ "Apache-2.0" ]
127
2015-02-18T13:16:00.000Z
2022-01-14T20:25:47.000Z
test/js/unit/About.js
DamavandiKamali/TinCanJS
8733f14ddcaeea77a0579505300bc8f38921a6b1
[ "Apache-2.0" ]
70
2015-01-01T14:46:26.000Z
2021-01-27T04:15:07.000Z
test/js/unit/About.js
DamavandiKamali/TinCanJS
8733f14ddcaeea77a0579505300bc8f38921a6b1
[ "Apache-2.0" ]
71
2015-01-09T13:20:29.000Z
2022-03-23T19:35:31.000Z
/*! Copyright 2014 Rustici Software Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ (function () { var session = null, commonVersions = [ ".95", "1.0", "1.1" ] ; QUnit.module("About Statics"); test( "About.fromJSON", function () { var raw = {}, string, result ; result = TinCan.About.fromJSON(JSON.stringify(raw)); ok(result instanceof TinCan.About, "returns TinCan.About"); } ); QUnit.module("About Instance"); test( "about Object", function () { var obj = new TinCan.About (), nullProps = [ "version" ], i ; ok(obj instanceof TinCan.About, "object is TinCan.About"); for (i = 0; i < nullProps.length; i += 1) { ok(obj.hasOwnProperty(nullProps[i]), "object has property: " + nullProps[i]); strictEqual(obj[nullProps[i]], null, "object property initial value: " + nullProps[i]); } strictEqual(obj.LOG_SRC, "About", "object property LOG_SRC initial value"); } ); test( "about variants", function () { var set = [ { name: "basic properties: expected string type array", cfg: { version: commonVersions }, checkProps: { version: commonVersions } } ], i, obj, result ; for (i = 0; i < set.length; i += 1) { row = set[i]; obj = new TinCan.About (row.cfg); ok(obj instanceof TinCan.About, "object is TinCan.About (" + row.name + ")"); if (typeof row.checkProps !== "undefined") { for (key in row.checkProps) { deepEqual(obj[key], row.checkProps[key], "object property initial value: " + key + " (" + row.name + ")"); } } } } ); }());
29.604167
130
0.466573
9980c6eaee279f635a0a109c6d455c9729de2d16
601
js
JavaScript
scripts/init.js
cadavre/TileBoard
0693b44e4fe541d1c0bbb9a7b32b400e56053266
[ "MIT" ]
null
null
null
scripts/init.js
cadavre/TileBoard
0693b44e4fe541d1c0bbb9a7b32b400e56053266
[ "MIT" ]
null
null
null
scripts/init.js
cadavre/TileBoard
0693b44e4fe541d1c0bbb9a7b32b400e56053266
[ "MIT" ]
null
null
null
var App = angular.module('App', ['hmTouchEvents', 'colorpicker', 'angularjs-gauge']); App.config(function ($sceProvider) { $sceProvider.enabled(false); }); App.config(function ($locationProvider) { $locationProvider.html5Mode({ enabled: true, requireBase: false }); }); if (!window.CONFIG) { var error = 'Please make sure you have "config.js" file and it\'s a valid javascript!\n' + 'If you running TileBoard for the first time, please rename "config.example.js" to "config.js"'; alert(error); } var Api = new HApi(CONFIG.wsUrl, CONFIG.authToken);
27.318182
104
0.658902
53fec8b11516c4abfcafab979b8bb06305f4476b
4,634
js
JavaScript
public/admin/bundle/src_app_statistics_statistics_module_ts-es5.js
andchir/shopker
c0dce0651139732e9586ae8a634e4f77d85b17a4
[ "MIT" ]
6
2021-01-21T11:02:10.000Z
2021-11-29T17:41:20.000Z
public/admin/bundle/src_app_statistics_statistics_module_ts-es5.js
andchir/shopker
c0dce0651139732e9586ae8a634e4f77d85b17a4
[ "MIT" ]
22
2021-03-08T22:39:47.000Z
2022-03-26T22:21:04.000Z
public/admin/bundle/src_app_statistics_statistics_module_ts-es5.js
andchir/shopker
c0dce0651139732e9586ae8a634e4f77d85b17a4
[ "MIT" ]
5
2022-01-14T22:04:01.000Z
2022-03-25T01:52:16.000Z
!function(){"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var n=0;n<e.length;n++){var a=e[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(t,a.key,a)}}function n(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}(self.webpackChunkshk_app=self.webpackChunkshk_app||[]).push([["src_app_statistics_statistics_module_ts"],{75590:function(e,a,i){i.r(a),i.d(a,{StatisticsModule:function(){return S}});var r,s=i(38583),o=i(16964),c=i(5727),u=i(91841),h=i(25917),g=i(5304),l=i(37716),d=((r=function(){function e(n){t(this,e),this.http=n,this.headers=new u.WM({"Content-Type":"application/json","X-Requested-With":"XMLHttpRequest"}),this.requestUrl="/admin/statistics",this.chartLineOptions={responsive:!0,maintainAspectRatio:!1}}return n(e,[{key:"setRequestUrl",value:function(t){this.requestUrl=t}},{key:"getRequestUrl",value:function(){return this.requestUrl}},{key:"getParams",value:function(t){var e=new u.LE;for(var n in t)!t.hasOwnProperty(n)||void 0===t[n]||(e=e.append(n,t[n]));return e}},{key:"getStatisticsOrders",value:function(t,e){var n=this.getParams(e),a=this.getRequestUrl()+"/orders";return this.http.get(a,{params:n,headers:this.headers}).pipe((0,g.K)(this.handleError()))}},{key:"handleError",value:function(){var t=arguments.length>1?arguments[1]:void 0;return function(e){if(e.error)throw e.error;return(0,h.of)(t)}}}]),e}()).\u0275fac=function(t){return new(t||r)(l.LFG(u.eN))},r.\u0275prov=l.Yz7({token:r,factory:r.\u0275fac}),r),f=i(73844),p=i(83667),v=i(3679),y=i(95047),m=i(64654),D=i(29790),k=[{path:"",component:function(){var e=function(){function e(n,a){t(this,e),this.dataService=n,this.appSettings=a,this.type="year",this.loading=!1,this.dateFormat="dd.mm.yy",this.firstDayOfWeek=0,this.rangeDates=[new Date,new Date],this.rangeDates[0].setMonth(this.rangeDates[1].getMonth()-1),this.locale=this.appSettings.settings.locale,this.yearRangeString=[this.rangeDates[1].getFullYear()-5,this.rangeDates[1].getFullYear()].join(":"),"en"!==this.locale&&(this.firstDayOfWeek=1)}return n(e,[{key:"ngOnInit",value:function(){this.getData()}},{key:"getData",value:function(){var t=this;!this.rangeDates[0]||!this.rangeDates[1]||(this.loading=!0,this.dataService.getStatisticsOrders(this.type,{dateFrom:this.getDateString(this.rangeDates[0]),dateTo:this.getDateString(this.rangeDates[1])}).subscribe(function(e){t.data=e,t.loading=!1},function(e){t.loading=!1}))}},{key:"getDateString",value:function(t){var e=String(t.getFullYear());return e+="-"+("0"+(t.getMonth()+1)).slice(-2),e+="-"+("0"+t.getDate()).slice(-2)}}]),e}();return e.title="STATISTICS",e.\u0275fac=function(t){return new(t||e)(l.Y36(d),l.Y36(f.d))},e.\u0275cmp=l.Xpm({type:e,selectors:[["app-statistics"]],features:[l._Bn([d])],decls:17,vars:19,consts:[[1,"card"],[1,"card-body"],[1,"icon-bar-graph-2"],[1,"min-height400"],[1,"d-inline-block","me-2"],[3,"ngModel","selectionMode","showIcon","monthNavigator","yearNavigator","yearRange","dateFormat","firstDayOfWeek","ngModelChange","onSelect"],["type","button",1,"btn","btn-secondary","ms-md-2",3,"ngbTooltip","click"],[1,"icon-reload"],["type","line",3,"data","height","responsive"]],template:function(t,e){1&t&&(l.TgZ(0,"div",0),l.TgZ(1,"div",1),l.TgZ(2,"h3"),l._UZ(3,"i",2),l._uU(4),l.ALo(5,"translate"),l.qZA(),l._UZ(6,"hr"),l.TgZ(7,"div",3),l.TgZ(8,"div"),l.TgZ(9,"div",4),l.TgZ(10,"p-calendar",5),l.NdJ("ngModelChange",function(t){return e.rangeDates=t})("onSelect",function(){return e.getData()}),l.qZA(),l.qZA(),l.TgZ(11,"button",6),l.NdJ("click",function(){return e.getData()}),l.ALo(12,"translate"),l._UZ(13,"i",7),l.qZA(),l.qZA(),l._UZ(14,"hr"),l.TgZ(15,"div"),l._UZ(16,"p-chart",8),l.qZA(),l.qZA(),l.qZA(),l.qZA()),2&t&&(l.xp6(4),l.hij(" ",l.lcZ(5,15,"STATISTICS")," "),l.xp6(3),l.ekj("loading",e.loading),l.xp6(3),l.Q6J("ngModel",e.rangeDates)("selectionMode","range")("showIcon",!0)("monthNavigator",!0)("yearNavigator",!0)("yearRange",e.yearRangeString)("dateFormat",e.dateFormat)("firstDayOfWeek",e.firstDayOfWeek),l.xp6(1),l.s9C("ngbTooltip",l.lcZ(12,17,"REFRESH")),l.xp6(5),l.Q6J("data",e.data)("height","400px")("responsive",!0))},directives:[p.f,v.JJ,v.On,y._L,m.C],pipes:[D.X$],styles:[""]}),e}()}],Z=function(){var e=function e(){t(this,e)};return e.\u0275fac=function(t){return new(t||e)},e.\u0275mod=l.oAB({type:e}),e.\u0275inj=l.cJS({imports:[[c.Bz.forChild(k)],c.Bz]}),e}(),S=function(){var e=function e(){t(this,e)};return e.\u0275fac=function(t){return new(t||e)},e.\u0275mod=l.oAB({type:e}),e.\u0275inj=l.cJS({imports:[[s.ez,o.m,Z]]}),e}()}}])}();
4,634
4,634
0.685801
53ff1f302c59cc1e84fa6020bcdbfcdb200df144
3,188
js
JavaScript
test/gulp.js
rumps/core
7ca7c17ff2dfd81cf5b53ed3eacc74082c733bd2
[ "MIT" ]
null
null
null
test/gulp.js
rumps/core
7ca7c17ff2dfd81cf5b53ed3eacc74082c733bd2
[ "MIT" ]
1
2015-01-09T15:32:37.000Z
2015-01-15T05:26:04.000Z
test/gulp.js
rumps/core
7ca7c17ff2dfd81cf5b53ed3eacc74082c733bd2
[ "MIT" ]
1
2015-02-24T12:30:51.000Z
2015-02-24T12:30:51.000Z
import gulp from 'gulp' import timeout from 'timeout-then' import configs from '../src/configs' import rump from '../src' import {exists, mkdir} from 'mz/fs' import {spy} from 'sinon' import {stripColor} from 'chalk' describe('tasks', function() { this.timeout(0) beforeEach(() => { rump.configure({clean: true, paths: {destination: {root: 'tmp'}}}) configs.watch = false }) it('are added and defined', () => { const callback = spy() rump.on('gulp:main', callback) rump.addGulpTasks({prefix: 'spec'}) callback.should.be.calledOnce() gulp.tasks['spec:build'].should.be.ok() gulp.tasks['spec:build:prod'].should.be.ok() gulp.tasks['spec:clean'].should.be.ok() gulp.tasks['spec:clean:safe'].should.be.ok() gulp.tasks['spec:prod:setup'].should.be.ok() gulp.tasks['spec:info'].should.be.ok() gulp.tasks['spec:info:core'].should.be.ok() gulp.tasks['spec:info:prod'].should.be.ok() gulp.tasks['spec:lint'].should.be.ok() gulp.tasks['spec:lint:watch'].should.be.ok() gulp.tasks['spec:test'].should.be.ok() gulp.tasks['spec:test:watch'].should.be.ok() gulp.tasks['spec:watch'].should.be.ok() gulp.tasks['spec:watch:setup'].should.be.ok() gulp.tasks['spec:watch:prod'].should.be.ok() }) it('displays correct information in info task', () => { const logs = [], {log} = console console.log = newLog gulp.start('spec:info') console.log = log logs.should.eql([ '', '--- Core v0.8.1', 'Environment is development', 'tmp will be cleaned', '', ]) logs.length = 0 console.log = newLog rump.reconfigure({clean: false}) gulp.start('spec:info') console.log = log logs.should.eql([ '', '--- Core v0.8.1', 'Environment is development', '', ]) logs.length = 0 console.log = newLog gulp.start('spec:info:prod') console.log = log logs.should.eql([ '', '--- Core v0.8.1', 'Environment is production', '', ]) function newLog(...args) { logs.push(stripColor(args.join(' '))) } }) it('handles watch', () => { configs.watch.should.be.false() rump.configs.watch.should.be.false() gulp.start('spec:watch:setup') configs.watch.should.be.true() rump.configs.watch.should.be.true() }) it('cleans build directory', async() => { let tmpExists if(!await exists('tmp')) { await mkdir('tmp') } tmpExists = await exists('tmp') tmpExists.should.be.true() gulp.start('spec:clean:safe') await timeout(1000) tmpExists = await exists('tmp') tmpExists.should.be.false() await mkdir('tmp') rump.reconfigure({clean: false}) gulp.start('spec:clean:safe') await timeout(1000) tmpExists = await exists('tmp') tmpExists.should.be.true() gulp.start('spec:clean') await timeout(1000) tmpExists = await exists('tmp') tmpExists.should.be.false() }) it('handles production', () => { rump.configs.main.environment.should.equal('development') gulp.start('spec:prod:setup') rump.configs.main.environment.should.equal('production') }) })
26.789916
70
0.607905
53ff7674e41bd096919ae6202abcd36c05c2d92a
32,591
js
JavaScript
src/pages/index.js
Suleman3015/my-hello-world-starter
c909e4cb5d041f7bc009bb8435bb695ae61dafdf
[ "RSA-MD" ]
null
null
null
src/pages/index.js
Suleman3015/my-hello-world-starter
c909e4cb5d041f7bc009bb8435bb695ae61dafdf
[ "RSA-MD" ]
null
null
null
src/pages/index.js
Suleman3015/my-hello-world-starter
c909e4cb5d041f7bc009bb8435bb695ae61dafdf
[ "RSA-MD" ]
null
null
null
import React from "react" import '../../node_modules/bootstrap/dist/css/bootstrap.min.css' export default function Home() { return ( <div> <section className="pt-4 pt-md-11"> <div className="container"> <div className="row align-items-center"> <div className="col-12 col-md-5 col-lg-6 order-md-2"> {/* Image */} <img src="assets/img/illustrations/illustration-2.png" className="img-fluid mw-md-150 mw-lg-130 mb-6 mb-md-0" alt="..." data-aos="fade-up" data-aos-delay={100} /> </div> <div className="col-12 col-md-7 col-lg-6 order-md-1" data-aos="fade-up"> {/* Heading */} <h1 className="display-3 text-center text-md-left"> Welcome to <span className="text-primary">Landkit</span>. <br /> Develop anything. </h1> {/* Text */} <p className="lead text-center text-md-left text-muted mb-6 mb-lg-8"> Build a beautiful, modern website with flexible Bootstrap components built from scratch. </p> {/* Buttons */} <div className="text-center text-md-left"> <a href="overview.html" className="btn btn-primary shadow lift mr-1" > View all pages{" "} <i className="fe fe-arrow-right d-none d-md-inline ml-3" /> </a> <a href="docs/index.html" className="btn btn-primary-soft lift"> Documentation </a> </div> </div> </div>{" "} {/* / .row */} </div>{" "} {/* / .container */} </section> {/* FEATURES */} <section className="py-8 py-md-11 border-bottom"> <div className="container"> <div className="row"> <div className="col-12 col-md-4" data-aos="fade-up"> {/* Icon */} <div className="icon text-primary mb-3"> {"{"} {"{"}&gt; general/settings-1{"}"} {"}"} </div> {/* Heading */} <h3>Built for developers</h3> {/* Text */} <p className="text-muted mb-6 mb-md-0"> Landkit is built to make your life easier. Variables, build tooling, documentation, and reusable components. </p> </div> <div className="col-12 col-md-4" data-aos="fade-up" data-aos-delay={50}> {/* Icon */} <div className="icon text-primary mb-3"> {"{"} {"{"}&gt; layout/layout-arrange{"}"} {"}"} </div> {/* Heading */} <h3>Designed to be modern</h3> {/* Text */} <p className="text-muted mb-6 mb-md-0"> Designed with the latest design trends in mind. Landkit feels modern, minimal, and beautiful. </p> </div> <div className="col-12 col-md-4" data-aos="fade-up" data-aos-delay={100} > {/* Icon */} <div className="icon text-primary mb-3"> {"{"} {"{"}&gt; code/code{"}"} {"}"} </div> {/* Heading */} <h3>Documentation for everything</h3> {/* Text */} <p className="text-muted mb-0"> We've written extensive documentation for components and tools, so you never have to reverse engineer anything. </p> </div> </div>{" "} {/* / .row */} </div>{" "} {/* / .container */} </section> {/* BRANDS */} <section className="py-6 py-md-8 border-bottom"> <div className="container"> <div className="row align-items-center justify-content-center"> <div className="col-6 col-sm-4 col-md-2 mb-4 mb-md-0"> {/* Brand */} <div className="img-fluid text-gray-600 mb-2 mb-md-0 svg-shim"> {"{"} {"{"}&gt; logotype/airbnb{"}"} {"}"} </div> </div> <div className="col-6 col-sm-4 col-md-2 mb-4 mb-md-0"> {/* Brand */} <div className="img-fluid text-gray-600 mb-2 mb-md-0 svg-shim"> {"{"} {"{"}&gt; logotype/coinbase{"}"} {"}"} </div> </div> <div className="col-6 col-sm-4 col-md-2 mb-4 mb-md-0"> {/* Brand */} <div className="img-fluid text-gray-600 mb-2 mb-md-0 svg-shim"> {"{"} {"{"}&gt; logotype/dribbble{"}"} {"}"} </div> </div> <div className="col-6 col-sm-4 col-md-2 mb-4 mb-md-0"> {/* Brand */} <div className="img-fluid text-gray-600 mb-2 mb-md-0 svg-shim"> {"{"} {"{"}&gt; logotype/instagram{"}"} {"}"} </div> </div> <div className="col-6 col-sm-4 col-md-2 mb-4 mb-md-0"> {/* Brand */} <div className="img-fluid text-gray-600 mb-2 mb-md-0 svg-shim"> {"{"} {"{"}&gt; logotype/netflix{"}"} {"}"} </div> </div> <div className="col-6 col-sm-4 col-md-2 mb-4 mb-md-0"> {/* Brand */} <div className="img-fluid text-gray-600 mb-2 mb-md-0 svg-shim"> {"{"} {"{"}&gt; logotype/pinterest{"}"} {"}"} </div> </div> </div>{" "} {/* / .row */} </div>{" "} {/* / .container */} </section> {/* ABOUT */} <section className="pt-8 pt-md-11 bg-gradient-light"> <div className="container"> <div className="row align-items-center justify-content-between mb-8 mb-md-11"> <div className="col-12 col-md-6 order-md-2" data-aos="fade-left"> {/* Heading */} <h2> The most useful resource <br /> <span className="text-success"> ever created for{" "} <span data-typed='{"strings": ["developers.", "founders.", "designers."]}' /> </span> </h2> {/* Text */} <p className="font-size-lg text-muted mb-6"> Using Landkit to build your site means never worrying about designing another page or cross browser compatibility. Our ever-growing library of components and pre-designed layouts will make your life easier. </p> {/* List */} <div className="row"> <div className="col-12 col-lg-6"> {/* Item */} <div className="d-flex"> {/* Check */} <div className="badge badge-rounded-circle bg-success-soft mt-1 mr-4"> <i className="fe fe-check" /> </div> {/* Text */} <p className="text-success">Lifetime updates</p> </div> {/* Item */} <div className="d-flex"> {/* Check */} <div className="badge badge-rounded-circle bg-success-soft mt-1 mr-4"> <i className="fe fe-check" /> </div> <p className="text-success mb-lg-0">Tons of assets</p> </div> </div> <div className="col-12 col-lg-6 mb-6 mb-md-0"> {/* Item */} <div className="d-flex"> {/* Check */} <span className="badge badge-rounded-circle bg-success-soft mt-1 mr-4"> <i className="fe fe-check" /> </span> {/* Text */} <p className="text-success">Tech support</p> </div> {/* Item */} <div className="d-flex"> {/* Check */} <div className="badge badge-rounded-circle bg-success-soft mr-1 mr-4"> <i className="fe fe-check" /> </div> {/* Text */} <p className="text-success mb-0">Integration ready</p> </div> </div> </div>{" "} {/* / .row */} </div> <div className="col-12 col-md-6 col-lg-5 order-md-1" data-aos="fade-right" > {/* Card */} <div className="card shadow-light-lg lift lift-lg"> {/* Image */} <img src="assets/img/photos/photo-2.jpg" alt="..." className="card-img-top" /> {/* Shape */} <div className="position-relative"> <div className="shape shape-bottom shape-fluid-x svg-shim text-white"> {"{"} {"{"}&gt; curves/curve-1{"}"} {"}"} </div> </div> {/* Body */} <div className="card-body"> {/* Form */} <form> <div className="form-label-group"> <input type="text" className="form-control form-control-flush" id="cardName" placeholder="Name" /> <label htmlFor="cardName">Name</label> </div> <div className="form-label-group"> <input type="email" className="form-control form-control-flush" id="cardEmail" placeholder="Email" /> <label htmlFor="cardEmail">Email</label> </div> <div className="form-label-group"> <input type="password" className="form-control form-control-flush" id="cardPassword" placeholder="Password" /> <label htmlFor="cardPassword">Password</label> </div> <div className="mt-6"> <button className="btn btn-block btn-success lift" type="submit" > Download a sample </button> </div> </form> </div> </div> </div> </div>{" "} {/* / .row */} <div className="row align-items-center"> <div className="col-12 col-md-7 col-lg-6" data-aos="fade-right"> {/* Heading */} <h2> We have lots of experience <br /> <span className="text-primary">building Bootstrap themes</span>. </h2> {/* Text */} <p className="font-size-lg text-muted mb-6"> We've built well over a dozen Bootstrap themes and sold tens of thousands of copies. </p> {/* List */} <div className="d-flex"> {/* Icon */} <div className="icon text-primary"> {"{"} {"{"}&gt; media/repeat{"}"} {"}"} </div> <div className="ml-5"> {/* Heading */} <h4 className="mb-1">Bootstrap users since the beginning</h4> {/* Text */} <p className="text-muted mb-6"> We've been developing with Bootstrap since it was publicly released in 2011. </p> </div> </div> <div className="d-flex"> {/* Icon */} <div className="icon text-primary"> {"{"} {"{"}&gt; code/code{"}"} {"}"} </div> <div className="ml-5"> {/* Heading */} <h4 className="mb-1">Deep understanding of Bootstrap</h4> {/* Text */} <p className="text-muted mb-6 mb-md-0"> We've watched Bootstrap grow up over the years and understand it better than almost anyone. </p> </div> </div> </div> <div className="col-12 col-md-5 col-lg-6"> <div className="w-md-150 w-lg-130 position-relative" data-aos="fade-left" > {/* Shape */} <div className="shape shape-fluid-y shape-blur-4 svg-shim text-gray-200"> {"{"} {"{"}&gt; blurs/blur-4{"}"} {"}"} </div> {/* Image */} <div className="img-skewed img-skewed-left"> {/* Image */} <img src="assets/img/screenshots/desktop/dashkit.jpg" className="screenshot img-fluid img-skewed-item" alt="..." /> </div> </div> </div> </div>{" "} {/* / .row */} </div>{" "} {/* / .container */} </section> {/* TESTIMONIALS */} <section className="pt-10 pt-md-12"> <div className="container"> <div className="row justify-content-center"> <div className="col-12 col-md-10 col-lg-8 text-center"> {/* Heading */} <h2>Our customers are our biggest fans.</h2> {/* Text */} <p className="font-size-lg text-muted mb-7 mb-md-9"> We don't like to brag, but we don't mind letting our customers do it for us. Here are a few nice things folks have said about our themes over the years. </p> </div> </div>{" "} {/* / .row */} <div className="row"> <div className="col-12"> {/* Card */} <div className="card card-row shadow-light-lg mb-6"> <div className="row gx-0"> <div className="col-12 col-md-6"> {/* Slider */} <div className="card-img-slider" data-flickity='{"fade": true, "imagesLoaded": true, "pageDots": false, "prevNextButtons": false, "asNavFor": "#blogSlider", "draggable": false}' > <a className="card-img-left w-100 bg-cover" style={{ backgroundImage: "url(assets/img/photos/photo-1.jpg)" }} href="#!" > {/* Image (placeholder) */} <img src="assets/img/photos/photo-1.jpg" alt="..." className="img-fluid d-md-none invisible" /> </a> <a className="card-img-left w-100 bg-cover" style={{ backgroundImage: "url(assets/img/photos/photo-26.jpg)" }} href="#!" > {/* Image (placeholder) */} <img src="assets/img/photos/photo-26.jpg" alt="..." className="img-fluid d-md-none invisible" /> </a> </div> {/* Shape */} <div className="shape shape-right shape-fluid-y svg-shim text-white d-none d-md-block"> {"{"} {"{"}&gt; curves/curve-4{"}"} {"}"} </div> </div> <div className="col-12 col-md-6 position-md-static"> {/* Slider */} <div className="position-md-static" data-flickity='{"wrapAround": true, "pageDots": false, "adaptiveHeight": true}' id="blogSlider" > <div className="w-100"> {/* Body */} <div className="card-body"> <blockquote className="blockquote text-center mb-0"> {/* Brand */} <div className="row justify-content-center mb-5 mb-md-7"> <div className="col-6 col-sm-4 col-md-7 col-lg-5"> {/* Logo */} <div className="img-fluid svg-shim" style={{ color: "#FF5A5F" }} > {"{"} {"{"}&gt; logotype/airbnb{"}"} {"}"} </div> </div> </div>{" "} {/* / .row */} {/* Text */} <p className="mb-5 mb-md-7"> “Landkit is hands down the most useful front end Bootstrap theme I've ever used. I can't wait to use it again for my next project.” </p> {/* Footer */} <footer className="blockquote-footer"> <span className="h6 text-uppercase"> Dave Gamache </span> </footer> </blockquote> </div> </div> <div className="w-100"> {/* Body */} <div className="card-body"> <blockquote className="blockquote text-center mb-0"> {/* Brand */} <div className="row justify-content-center mb-5 mb-md-7"> <div className="col-6 col-sm-4 col-md-7 col-lg-5"> {/* Logo */} <div className="img-fluid svg-shim" style={{ color: "#3F5D87" }} > {"{"} {"{"}&gt; logotype/instagram{"}"} {"}"} </div> </div> </div>{" "} {/* / .row */} {/* Text */} <p className="mb-5 mb-md-7"> “I've never used a theme as versatile and flexible as Landkit. It's my go to for building landing sites on almost any project.” </p> {/* Footer */} <footer className="blockquote-footer"> <span className="h6 text-uppercase">Russ D'Sa</span> </footer> </blockquote> </div> </div> </div> </div> </div>{" "} {/* / .row */} </div> </div> </div>{" "} {/* / .row */} </div>{" "} {/* / .container */} </section> {/* SHAPE */} <div className="position-relative mt-n8"> <div className="shape shape-bottom shape-fluid-x svg-shim text-gray-200"> {"{"} {"{"}&gt; curves/curve-3{"}"} {"}"} </div> </div> {/* STATS */} <section className="pt-12 pt-md-13 bg-gray-200"> <div className="container"> <div className="row align-items-center"> <div className="col-12 col-md-5 col-lg-6 order-md-2"> {/* Image */} <img src="assets/img/illustrations/illustration-8.png" alt="..." className="img-fluid mb-6 mb-md-0" /> </div> <div className="col-12 col-md-7 col-lg-6 order-md-1"> {/* Heading */} <h2> Stay focused on your business. <br /> <span className="text-primary">Let us handle the design</span>. </h2> {/* Text */} <p className="font-size-lg text-gray-700 mb-6"> You have a business to run. Stop worring about cross-browser bugs, designing new pages, keeping your components up to date. Let us do that for you. </p> {/* Stats */} <div className="d-flex"> <div className="pr-5"> <h3 className="mb-0"> <span data-countup='{"startVal": 0}' data-to={100} data-aos data-aos-id="countup:in" /> % </h3> <p className="text-gray-700 mb-0">Satisfaction</p> </div> <div className="border-left border-gray-300" /> <div className="px-5"> <h3 className="mb-0"> <span data-countup='{"startVal": 0}' data-to={24} data-aos data-aos-id="countup:in" /> / <span data-countup='{"startVal": 0}' data-to={7} data-aos data-aos-id="countup:in" /> </h3> <p className="text-gray-700 mb-0">Support</p> </div> <div className="border-left border-gray-300" /> <div className="pl-5"> <h3 className="mb-0"> <span data-countup='{"startVal": 0}' data-to={100} data-aos data-aos-id="countup:in" /> k+ </h3> <p className="text-gray-700 mb-0">Sales</p> </div> </div> </div> </div>{" "} {/* / .row */} </div>{" "} {/* / .container */} </section> {/* PRICING */} <section className="pt-9 pt-md-12 bg-gray-200"> <div className="container"> <div className="row justify-content-center"> <div className="col-12 col-md-10 col-lg-8 text-center"> {/* Heading */} <h1>Fair, simple pricing for all.</h1> {/* Text */} <p className="lead text-gray-700"> All types of businesses need access to development resources, so we give you the option to decide how much you need to use. </p> {/* Form */} <form className="d-flex align-items-center justify-content-center mb-7 mb-md-9"> {/* Label */} <span className="text-muted">Annual</span> {/* Switch */} <div className="form-check form-switch mx-3"> <input className="form-check-input" type="checkbox" id="billingSwitch" data-toggle="price" data-target=".price" /> </div> {/* Label */} <span className="text-muted">Monthly</span> </form> </div> </div>{" "} {/* / .row */} <div className="row align-items-center gx-0"> <div className="col-12 col-md-6"> {/* Card */} <div className="card rounded-lg shadow-lg mb-6 mb-md-0" style={{ zIndex: 1 }} data-aos="fade-up" > {/* Body */} <div className="card-body py-6 py-md-8"> <div className="row justify-content-center"> <div className="col-12 col-xl-9"> {/* Badge */} <div className="text-center mb-5"> <span className="badge rounded-pill bg-primary-soft"> <span className="h6 font-weight-bold text-uppercase"> Standard </span> </span> </div> {/* Price */} <div className="d-flex justify-content-center"> <span className="h2 mb-0 mt-2">$</span> <span className="price display-2 mb-0" data-annual={29} data-monthly={49} > 29 </span> <span className="h2 align-self-end mb-1">/mo</span> </div> {/* Text */} <p className="text-center text-muted mb-6 mb-md-8"> per seat </p> {/* Features */} <div className="d-flex"> {/* Check */} <div className="badge badge-rounded-circle bg-success-soft mt-1 mr-4"> <i className="fe fe-check" /> </div> {/* Text */} <p>Rich, responsive landing pages</p> </div> <div className="d-flex"> {/* Check */} <div className="badge badge-rounded-circle bg-success-soft mt-1 mr-4"> <i className="fe fe-check" /> </div> {/* Text */} <p>100+ styled components</p> </div> <div className="d-flex"> {/* Check */} <div className="badge badge-rounded-circle bg-success-soft mt-1 mr-4"> <i className="fe fe-check" /> </div> {/* Text */} <p>Flexible, simple license</p> </div> <div className="d-flex"> {/* Check */} <div className="badge badge-rounded-circle bg-success-soft mt-1 mr-4"> <i className="fe fe-check" /> </div> {/* Text */} <p>Speedy build tooling</p> </div> <div className="d-flex"> {/* Check */} <div className="badge badge-rounded-circle bg-success-soft mt-1 mr-4"> <i className="fe fe-check" /> </div> {/* Text */} <p className="mb-0">6 months free support included</p> </div> </div> </div>{" "} {/* / .row */} </div> {/* Button */} <a href="#!" className="card-btn btn btn-block btn-lg btn-primary"> Get it now </a> </div> </div> <div className="col-12 col-md-6 ml-md-n3"> {/* Card */} <div className="card rounded-lg shadow-lg" data-aos="fade-up" data-aos-delay={200} > {/* Body */} <div className="card-body py-6 py-md-8"> <div className="row justify-content-center"> <div className="col-12 col-xl-10"> {/* Badge */} <p className="text-center mb-8 mb-md-11"> <span className="badge rounded-pill bg-primary-soft"> <span className="h6 font-weight-bold text-uppercase"> Enterprise </span> </span> </p> {/* Text */} <p className="lead text-center text-muted mb-0 mb-md-10"> We offer variable pricing with discounts for larger organizations. Get in touch with us and we’ll figure out something that works for everyone. </p> </div> </div>{" "} {/* / .row */} </div> {/* Button */} <a href="#!" className="card-btn btn btn-block btn-lg btn-light bg-gray-300 text-gray-700" > Contact us </a> </div> </div> </div>{" "} {/* / .row */} </div>{" "} {/* / .container */} </section> {/* SHAPE */} <div className="position-relative mt-n15"> <div className="shape shape-bottom shape-fluid-x svg-shim text-dark"> {"{"} {"{"}&gt; curves/curve-1{"}"} {"}"} </div> </div> {/* FAQ */} <section className="pt-15 bg-dark"> <div className="container pt-8 pt-md-11"> <div className="row"> <div className="col-12 col-md-6"> {/* Item */} <div className="d-flex"> {/* Badge */} <div className="badge badge-lg badge-rounded-circle bg-success"> <span>?</span> </div> <div className="ml-5"> {/* Heading */} <h4 className="text-white">Can I use Landkit for my clients?</h4> {/* Text */} <p className="text-muted mb-6 mb-md-8"> Absolutely. The Bootstrap Themes license allows you to build a website for personal use or for a client. </p> </div> </div> {/* Item */} <div className="d-flex"> {/* Badge */} <div className="badge badge-lg badge-rounded-circle bg-success"> <span>?</span> </div> <div className="ml-5"> {/* Heading */} <h4 className="text-white">Do I get free updates?</h4> {/* Text */} <p className="text-muted mb-6 mb-md-0"> Yes. We update all of our themes with each Bootstrap update, plus are constantly adding new components, pages, and features to our themes. </p> </div> </div> </div> <div className="col-12 col-md-6"> {/* Item */} <div className="d-flex"> {/* Badge */} <div className="badge badge-lg badge-rounded-circle bg-success"> <span>?</span> </div> <div className="ml-5"> {/* Heading */} <h4 className="text-white">Is there a money back guarantee?</h4> {/* Text */} <p className="text-muted mb-6 mb-md-8"> Yup! Bootstrap Themes come with a satisfaction guarantee. Submit a return and get your money back. </p> </div> </div> {/* Item */} <div className="d-flex"> {/* Badge */} <div className="badge badge-lg badge-rounded-circle bg-success"> <span>?</span> </div> <div className="ml-5"> {/* Heading */} <h4 className="text-white"> Does it work with Rails? React? Laravel? </h4> {/* Text */} <p className="text-muted mb-6 mb-md-0"> Yes. Landkit has basic CSS/JS files you can include. If you want to enable deeper customization, you can integrate it into your assets pipeline or build processes. </p> </div> </div> </div> </div>{" "} {/* / .row */} </div>{" "} {/* / .container */} </section> {/* CTA */} <section className="py-8 py-md-11 bg-dark"> <div className="container"> <div className="row justify-content-center"> <div className="col-12 col-md-10 col-lg-8 text-center"> {/* Badge */} <span className="badge rounded-pill bg-gray-700-soft mb-4"> <span className="h6 font-weight-bold text-uppercase"> Get started </span> </span> {/* Heading */} <h1 className="display-4 text-white"> Get Landkit and save your time. </h1> {/* Text */} <p className="font-size-lg text-muted mb-6 mb-md-8"> Stop wasting time trying to do it the "right way" and build a site from scratch. Landkit is faster, easier, and you still have complete control. </p> {/* Button */} <a href="https://themes.getbootstrap.com/product/landkit/" target="_blank" className="btn btn-success lift" > Buy it now <i className="fe fe-arrow-right" /> </a> </div> </div>{" "} {/* / .row */} </div>{" "} {/* / .container */} </section> </div> ) }
36.536996
162
0.412507
99003a64af704017bbad3cacda780dace869b16b
733
js
JavaScript
site/pages/components/Button/example-2-icon.js
UncaughtError/Shineout
29aa16f42046f7808f480ebadbb0565e92952a7b
[ "MIT" ]
5
2018-08-07T08:04:16.000Z
2018-08-07T08:18:26.000Z
site/pages/components/Button/example-2-icon.js
sheinsight/Shineout
a227495151eab9674831fa901daa5e9e4171f6b7
[ "MIT" ]
null
null
null
site/pages/components/Button/example-2-icon.js
sheinsight/Shineout
a227495151eab9674831fa901daa5e9e4171f6b7
[ "MIT" ]
1
2018-08-07T08:07:59.000Z
2018-08-07T08:07:59.000Z
/** * cn - 图标 * -- shineout 并不提供内置的图标, 所以需要图标可以在内容中自行加入 * en - Icon * -- shineout does not provide built-in icons, you can add it to the content by yourself. */ import React from 'react' import { Button } from 'shineout' import FontAwesome from '../Icon/FontAwesome' export default function() { return ( <div> <Button type="primary"> <FontAwesome name="home" style={{ marginInlineEnd: 4 }} /> left </Button> <Button type="primary"> right <FontAwesome name="home" style={{ marginInlineStart: 4 }} /> </Button> <Button type="primary"> ce <FontAwesome name="home" style={{ margin: '0 4px' }} /> ter </Button> </div> ) }
24.433333
93
0.575716
99006cc3f30c0a891ab8b2c2076160c61ff82eb6
5,022
js
JavaScript
node_modules/parcel-bundler/lib/utils/installPackage.js
MNGoldman/Rock-Paper-Scissors
f1546c850e0c11d012b541855568d2e63f2c0883
[ "MIT" ]
1,318
2019-07-11T10:34:39.000Z
2022-03-29T15:05:19.000Z
node_modules/parcel-bundler/lib/utils/installPackage.js
MNGoldman/Rock-Paper-Scissors
f1546c850e0c11d012b541855568d2e63f2c0883
[ "MIT" ]
387
2019-09-05T16:33:09.000Z
2022-03-31T10:43:39.000Z
react/react-setup/node_modules/parcel-bundler/lib/utils/installPackage.js
akslucky619/Projects
321d9b6a435f6e07b70bf2f692a6117c3bab46b5
[ "MIT" ]
66
2019-11-11T15:33:12.000Z
2022-03-01T07:55:55.000Z
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray")); var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")); const config = require('./config'); const _require = require('@parcel/utils'), promisify = _require.promisify; const resolve = promisify(require('resolve')); const commandExists = require('command-exists'); const logger = require('@parcel/logger'); const pipeSpawn = require('./pipeSpawn'); const PromiseQueue = require('./PromiseQueue'); const path = require('path'); const fs = require('@parcel/fs'); const WorkerFarm = require('@parcel/workers'); const YARN_LOCK = 'yarn.lock'; function install(_x, _x2) { return _install.apply(this, arguments); } function _install() { _install = (0, _asyncToGenerator2.default)(function* (modules, filepath, options = {}) { let _options$installPeers = options.installPeers, installPeers = _options$installPeers === void 0 ? true : _options$installPeers, _options$saveDev = options.saveDev, saveDev = _options$saveDev === void 0 ? true : _options$saveDev, packageManager = options.packageManager; if (typeof modules === 'string') { modules = [modules]; } logger.progress(`Installing ${modules.join(', ')}...`); let packageLocation = yield config.resolve(filepath, ['package.json']); let cwd = packageLocation ? path.dirname(packageLocation) : process.cwd(); if (!packageManager) { packageManager = yield determinePackageManager(filepath); } let commandToUse = packageManager === 'npm' ? 'install' : 'add'; let args = [commandToUse, ...modules]; if (saveDev) { args.push('-D'); } else if (packageManager === 'npm') { args.push('--save'); } // npm doesn't auto-create a package.json when installing, // so create an empty one if needed. if (packageManager === 'npm' && !packageLocation) { yield fs.writeFile(path.join(cwd, 'package.json'), '{}'); } try { yield pipeSpawn(packageManager, args, { cwd }); } catch (err) { throw new Error(`Failed to install ${modules.join(', ')}.`); } if (installPeers) { yield Promise.all(modules.map(m => installPeerDependencies(filepath, m, options))); } }); return _install.apply(this, arguments); } function installPeerDependencies(_x3, _x4, _x5) { return _installPeerDependencies.apply(this, arguments); } function _installPeerDependencies() { _installPeerDependencies = (0, _asyncToGenerator2.default)(function* (filepath, name, options) { let basedir = path.dirname(filepath); const _ref2 = yield resolve(name, { basedir }), _ref3 = (0, _slicedToArray2.default)(_ref2, 1), resolved = _ref3[0]; const pkg = yield config.load(resolved, ['package.json']); const peers = pkg.peerDependencies || {}; const modules = []; for (const peer in peers) { modules.push(`${peer}@${peers[peer]}`); } if (modules.length) { yield install(modules, filepath, Object.assign({}, options, { installPeers: false })); } }); return _installPeerDependencies.apply(this, arguments); } function determinePackageManager(_x6) { return _determinePackageManager.apply(this, arguments); } function _determinePackageManager() { _determinePackageManager = (0, _asyncToGenerator2.default)(function* (filepath) { const yarnLockFile = yield config.resolve(filepath, [YARN_LOCK]); /** * no yarn.lock => use npm * yarn.lock => Use yarn, fallback to npm */ if (!yarnLockFile) { return 'npm'; } const hasYarn = yield checkForYarnCommand(); if (hasYarn) { return 'yarn'; } return 'npm'; }); return _determinePackageManager.apply(this, arguments); } let hasYarn = null; function checkForYarnCommand() { return _checkForYarnCommand.apply(this, arguments); } function _checkForYarnCommand() { _checkForYarnCommand = (0, _asyncToGenerator2.default)(function* () { if (hasYarn != null) { return hasYarn; } try { hasYarn = yield commandExists('yarn'); } catch (err) { hasYarn = false; } return hasYarn; }); return _checkForYarnCommand.apply(this, arguments); } let queue = new PromiseQueue(install, { maxConcurrent: 1, retry: false }); module.exports = /*#__PURE__*/ function () { var _ref = (0, _asyncToGenerator2.default)(function* (...args) { // Ensure that this function is always called on the master process so we // don't call multiple installs in parallel. if (WorkerFarm.isWorker()) { yield WorkerFarm.callMaster({ location: __filename, args }); return; } queue.add(...args); return queue.run(); }); return function () { return _ref.apply(this, arguments); }; }();
26.020725
100
0.653126
99008fb45a5a1d8d0a3fc1a732752eceb5d03e3d
1,309
js
JavaScript
robam/src/script/js/homedata.js
f12china/ROBAM
2f8c408b87bcec0d246c964350189343d098c1df
[ "MIT" ]
1
2019-07-05T07:31:13.000Z
2019-07-05T07:31:13.000Z
robam/src/script/js/homedata.js
f12china/ROBAM
2f8c408b87bcec0d246c964350189343d098c1df
[ "MIT" ]
1
2021-05-10T00:21:40.000Z
2021-05-10T00:21:40.000Z
robam/src/script/js/homedata.js
f12china/ROBAM
2f8c408b87bcec0d246c964350189343d098c1df
[ "MIT" ]
null
null
null
(function($) { $.ajax({ type: "get", url: "http://10.31.158.51/items1905xsc/ROBAM/robam/php/homedata.php", dataType: "json", success: function(product) { let htmlstr = ''; // console.log(product); $(product).each(function(i, e) { console.log(e) // let pic = JSON.parse(e.pic) htmlstr += ` <div class="charu"> <li class="productTab "> <a href="./details.html?id=${e.id}" target="_blank"> <div class="pic fl "><img class="lazy" data-original="${e.pic}"></div> <div class="con fr "> <h2>${e.title}</h2> <p>${e.donation}</p> <div class="money "> 特惠价:¥<span class="yuan ">${e.price}</span></div> <div class="more ">立即购买</div> </div> </a> </li> </div> ` }); $('.wel-limit-list').html(htmlstr); $(function() { $("img.lazy").lazyload({ effect: "fadeIn" }); }); } }); })(jQuery);
33.564103
97
0.355233
99009d11656db820cd97f14a2f0a6d2fbfef8f82
170
js
JavaScript
evaluate-news-article/src/client/__test__/testHandleSubmit.spec.js
omartarek206/udacity-projects-starter-kit
2e5aa9e9488ab7e86c9100c106299de08e13abdd
[ "MIT" ]
null
null
null
evaluate-news-article/src/client/__test__/testHandleSubmit.spec.js
omartarek206/udacity-projects-starter-kit
2e5aa9e9488ab7e86c9100c106299de08e13abdd
[ "MIT" ]
null
null
null
evaluate-news-article/src/client/__test__/testHandleSubmit.spec.js
omartarek206/udacity-projects-starter-kit
2e5aa9e9488ab7e86c9100c106299de08e13abdd
[ "MIT" ]
null
null
null
// to solve ReferenceError: regeneratorRuntime is not defined import 'babel-polyfill' describe('Client Test', () => { // TODO: add your test cases to test client })
24.285714
61
0.705882
9901bbd26ccdd44ac69f25736373a4fda576db9e
1,194
js
JavaScript
dataStructure/array/array.test.js
edsonha/kata-for-fun
8269cb6ec9bc5b481c829f24e7da929122d32261
[ "MIT" ]
null
null
null
dataStructure/array/array.test.js
edsonha/kata-for-fun
8269cb6ec9bc5b481c829f24e7da929122d32261
[ "MIT" ]
null
null
null
dataStructure/array/array.test.js
edsonha/kata-for-fun
8269cb6ec9bc5b481c829f24e7da929122d32261
[ "MIT" ]
null
null
null
const NewArray = require("./array"); beforeEach(() => { return (myArray = new NewArray()); }); describe("Array", () => { describe("Push", () => { it("should add item into an array when pushed", () => { expect(myArray.push("hi")).toEqual({ "0": "hi" }); }); it("should add another item into an array when pushed", () => { myArray.push("hi"); expect(myArray.push("there")).toEqual({ "0": "hi", "1": "there" }); }); }); describe("Pop", () => { it("should pop the last item", () => { myArray.push("hi"); myArray.push("there"); myArray.push("hello"); expect(myArray.pop()).toEqual("hello"); expect(myArray).toEqual({ length: 2, data: { "0": "hi", "1": "there" } }); expect(myArray.pop()).toEqual("there"); expect(myArray).toEqual({ length: 1, data: { "0": "hi" } }); }); }); describe("Delete", () => { it("should delete item at indicated index", () => { myArray.push("hi"); myArray.push("hello"); myArray.push("there"); expect(myArray.deleteAtIndex(1)).toEqual("hello"); expect(myArray).toEqual({ length: 2, data: { "0": "hi", "1": "there" } }); }); }); });
29.121951
80
0.521776
99022d1ade0da1f11a0e9173e7c96faa98613092
410
js
JavaScript
lib/middleware/messages/member/support-message.js
DoSomething/slothie
b789fa139b7c8c2c50fb99585110d784a9c6a84c
[ "MIT" ]
2
2017-09-07T21:45:52.000Z
2018-03-13T15:39:26.000Z
lib/middleware/messages/member/support-message.js
DoSomething/gamb
b789fa139b7c8c2c50fb99585110d784a9c6a84c
[ "MIT" ]
419
2016-08-10T14:56:37.000Z
2022-02-27T11:22:24.000Z
lib/middleware/messages/member/support-message.js
DoSomething/slothie
b789fa139b7c8c2c50fb99585110d784a9c6a84c
[ "MIT" ]
1
2020-01-11T04:03:57.000Z
2020-01-11T04:03:57.000Z
'use strict'; const helpers = require('../../../helpers'); module.exports = function postMessageToSupport() { return (req, res, next) => { if (!req.conversation.isSupportTopic()) { return next(); } return req.conversation.postMessageToSupport(req, req.inboundMessage) .then(() => helpers.replies.noReply(req, res)) .catch(err => helpers.sendErrorResponse(res, err)); }; };
25.625
73
0.641463
99024ef7cbb636b500058bb3b94bfad15eecdaf2
5,578
js
JavaScript
implementation-contributed/v8/mjsunit/es6/block-const-assign-sloppy.js
katemihalikova/test262
aaf4402b4ca9923012e61830fba588bf7ceb6027
[ "BSD-3-Clause" ]
20,995
2015-01-01T05:12:40.000Z
2022-03-31T21:39:18.000Z
implementation-contributed/v8/mjsunit/es6/block-const-assign-sloppy.js
katemihalikova/test262
aaf4402b4ca9923012e61830fba588bf7ceb6027
[ "BSD-3-Clause" ]
9,469
2015-01-30T05:33:07.000Z
2022-03-31T16:17:21.000Z
implementation-contributed/v8/mjsunit/es6/block-const-assign-sloppy.js
katemihalikova/test262
aaf4402b4ca9923012e61830fba588bf7ceb6027
[ "BSD-3-Clause" ]
4,523
2015-01-01T15:12:34.000Z
2022-03-28T06:23:41.000Z
// Copyright 2011 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided // with the distribution. // * Neither the name of Google Inc. nor the names of its // contributors may be used to endorse or promote products derived // from this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Test that we throw early syntax errors in harmony mode // when using an immutable binding in an assigment or with // prefix/postfix decrement/increment operators. const decls = [ // Const declaration. function(use) { return "const c = 1; " + use + ";" }, TypeError, function(use) { return "const x = 0, c = 1; " + use + ";" }, TypeError, function(use) { return "const c = 1, x = (" + use + ");" }, TypeError, function(use) { return use + "; const c = 1;" }, ReferenceError, function(use) { return use + "; const x = 0, c = 1;" }, ReferenceError, function(use) { return "const x = (" + use + "), c = 1;" }, ReferenceError, function(use) { return "const c = (" + use + ");" }, ReferenceError, // Function expression. function(use) { return "(function c() { " + use + "; })();"; }, TypeError, // TODO(rossberg): Once we have default parameters, test using 'c' there. // Class expression. function(use) { return "new class c { constructor() { " + use + " } };"; }, TypeError, function(use) { return "(new class c { m() { " + use + " } }).m();"; }, TypeError, function(use) { return "(new class c { get a() { " + use + " } }).a;"; }, TypeError, function(use) { return "(new class c { set a(x) { " + use + " } }).a = 0;"; }, TypeError, function(use) { return "(class c { static m() { " + use + " } }).s();"; }, TypeError, function(use) { return "(class c extends (" + use + ") {});"; }, ReferenceError, function(use) { return "(class c { [" + use + "]() {} });"; }, ReferenceError, function(use) { return "(class c { get [" + use + "]() {} });"; }, ReferenceError, function(use) { return "(class c { set [" + use + "](x) {} });"; }, ReferenceError, function(use) { return "(class c { static [" + use + "]() {} });"; }, ReferenceError, // For loop. function(use) { return "for (const c = 0; " + use + ";) {}" }, TypeError, function(use) { return "for (const x = 0, c = 0; " + use + ";) {}" }, TypeError, function(use) { return "for (const c = 0; ; " + use + ") {}" }, TypeError, function(use) { return "for (const x = 0, c = 0; ; " + use + ") {}" }, TypeError, function(use) { return "for (const c = 0; ;) { " + use + "; }" }, TypeError, function(use) { return "for (const x = 0, c = 0; ;) { " + use + "; }" }, TypeError, function(use) { return "for (const c in {a: 1}) { " + use + "; }" }, TypeError, function(use) { return "for (const c of [1]) { " + use + "; }" }, TypeError, function(use) { return "for (const x = (" + use + "), c = 0; ;) {}" }, ReferenceError, function(use) { return "for (const c = (" + use + "); ;) {}" }, ReferenceError, ] let uses = [ 'c = 1', 'c += 1', '++c', 'c--', ]; let declcontexts = [ function(decl) { return decl; }, function(decl) { return "eval(\'" + decl + "\')"; }, function(decl) { return "{ " + decl + " }"; }, function(decl) { return "(function() { " + decl + " })()"; }, ]; let usecontexts = [ function(use) { return use; }, function(use) { return "eval(\"" + use + "\")"; }, function(use) { return "(function() { " + use + " })()"; }, function(use) { return "(function() { eval(\"" + use + "\"); })()"; }, function(use) { return "eval(\"(function() { " + use + "; })\")()"; }, ]; function Test(program, error) { program = "'use strict'; " + program; try { print(program, " // throw " + error.name); eval(program); } catch (e) { assertInstanceof(e, error); if (e === TypeError) { assertTrue(e.toString().indexOf("Assignment to constant variable") >= 0); } return; } assertUnreachable(); } for (var d = 0; d < decls.length; d += 2) { for (var u = 0; u < uses.length; ++u) { for (var o = 0; o < declcontexts.length; ++o) { for (var i = 0; i < usecontexts.length; ++i) { Test(declcontexts[o](decls[d](usecontexts[i](uses[u]))), decls[d + 1]); } } } }
35.528662
79
0.582646
9902e743a5ba8c60787173dc6ffe403e349df4c4
2,413
js
JavaScript
lib/web/genericl10n.js
wambaloo/pdfjs-dist
dd1f8ae3b989a07331cf868f3d2e05fb76c2436e
[ "Apache-2.0" ]
4
2019-02-04T20:57:36.000Z
2022-02-02T21:41:01.000Z
lib/web/genericl10n.js
wambaloo/pdfjs-dist
dd1f8ae3b989a07331cf868f3d2e05fb76c2436e
[ "Apache-2.0" ]
381
2018-10-19T13:52:02.000Z
2022-03-29T17:53:50.000Z
.atom/packages/pdf-view/node_modules/pdfjs-dist/lib/web/genericl10n.js
hill-a/atom-config
88b25344f83072d52a79989eb58746f2c7324180
[ "MIT" ]
1
2021-09-21T10:17:50.000Z
2021-09-21T10:17:50.000Z
/* Copyright 2017 Mozilla Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.GenericL10n = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); require('../external/webL10n/l10n'); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var webL10n = document.webL10n; var GenericL10n = function () { function GenericL10n(lang) { _classCallCheck(this, GenericL10n); this._lang = lang; this._ready = new Promise(function (resolve, reject) { webL10n.setLanguage(lang, function () { resolve(webL10n); }); }); } _createClass(GenericL10n, [{ key: 'getDirection', value: function getDirection() { return this._ready.then(function (l10n) { return l10n.getDirection(); }); } }, { key: 'get', value: function get(property, args, fallback) { return this._ready.then(function (l10n) { return l10n.get(property, args, fallback); }); } }, { key: 'translate', value: function translate(element) { return this._ready.then(function (l10n) { return l10n.translate(element); }); } }]); return GenericL10n; }(); exports.GenericL10n = GenericL10n;
35.485294
564
0.69167
99032701d6055bbcaf2f23accffeafafc96495c1
6,664
js
JavaScript
unityGame/Assets/Features/Challenges/FinPartieControl.js
AnasNeumann/twins
3f15a7a5fae18de09b89e8ef70191df543b4eb05
[ "Apache-2.0" ]
1
2022-02-02T16:14:49.000Z
2022-02-02T16:14:49.000Z
unityGame/Assets/Features/Challenges/FinPartieControl.js
AnasNeumann/twins
3f15a7a5fae18de09b89e8ef70191df543b4eb05
[ "Apache-2.0" ]
null
null
null
unityGame/Assets/Features/Challenges/FinPartieControl.js
AnasNeumann/twins
3f15a7a5fae18de09b89e8ef70191df543b4eb05
[ "Apache-2.0" ]
null
null
null
/* la classe qui controle d'un fin de partie de jeu quand la fille et le garcon on atteind le village de l'ouest */ class FinPartieControl extends MonoBehaviour { //______________________________________________________________________________________________________________________________________________________________ // VARIABLES DE CLASSES ET D'OBJETS //______________________________________________________________________________________________________________________________________________________________ public var finPartie : boolean = false ; // est-ce que la partie doit se finir ? public var pseudoUn : String ; // le pseudo du premier joueur public var pseudoDeux : String ; // le pseudo du segond joueur public var score : int ; // le score à enregistrer en base ou localement public var messageScore : String ; // le message de score sous forme Mintues::Secondes à afficher private var test : boolean = false ; // variable de control pour éxéuter une seule fois le passage au niveau "Bravo" /* les tailles et positions pour l'affichage du score qui vient d'être fait */ private var _positionX : float ; // la position en x private var _positionY : float ; // la position en Y public var remoteIp : String ; // l'ip du serveur qui a lancé la partie private var _widthScreen : float ; // la proportion en largeur private var _heightScreen : float ; // la proportion en hauteur public var skinToUse : GUISkin ; // le styleà utilisé private var _tailleX : float ; // la taille du GUI en x private var _tailleY : float ; // la taille du GUI en Y //_____________________________________________________________________________________________________________________________________________________________ // FONCTIONS DE BASE ET PREDEFINIES //_____________________________________________________________________________________________________________________________________________________________ /* fonction calculée lors de l'appel du script donc tout au début même avant Start */ function Awake() { DontDestroyOnLoad(this); // Ne pas détruire ce composant car il doit y avoir réseaux meme après avoir chargé un niveau } /* fonction executée lors du calcul de la toute 1e image donc juste après Awake */ function Start () { this._widthScreen = parseFloat(Screen.width)/1366 ; // on trouve le rapport en hauteur this._heightScreen = parseFloat(Screen.height)/638 ; // on trouve le rapport en largeur if(_widthScreen>_heightScreen) { _tailleX = 0.75*217*_widthScreen ; // on resize en largeur _tailleY = 0.75*60*_widthScreen ; // on resize en longeur _positionX = (parseFloat(Screen.width)/2); _positionY = (parseFloat(Screen.height)/2)+(155*_heightScreen*0.5); } else { _tailleX = 0.75*217*_heightScreen ; // on resize en largeur _tailleY = 0.75*60*_heightScreen ; // on resize en longeur _positionX = (parseFloat(Screen.width)/2); _positionY = (parseFloat(Screen.height)/2)+(155*_heightScreen*0.5); } skinToUse.label.fontSize = 0.70*_tailleY; } /* fonction qui affiche le menu à l'écran grace à la caméra */ function OnGUI() { if(this.test) // si la partie est finie { GUI.Label(new Rect(_positionX,_positionY,_tailleX,_tailleY),this.messageScore,skinToUse.label); } } /* fonction calculée quand le garcon entre dans le collider de ce gameObject */ function OnTriggerEnter (hit : Collider) { if (hit.gameObject.tag=="warrior" && hit.GetComponent(NetworkView).isMine == true) // si je suis le frère { networkView.RPC("finPartieRPC", RPCMode.AllBuffered); //on envoi la fin de la partie en RPC } } /* fonction éxécutée à chaque calcul d'une nouvelle Frame 24->60 fois par secondes */ function Update() { if(finPartie) // si la partie doit se finir { passageBravo(); // on passe au prochain niveau } } //_____________________________________________________________________________________________________________________________________________________________ // AUTRES FONCTIONS ET RPC //_____________________________________________________________________________________________________________________________________________________________ @RPC public function finPartieRPC() { this.finPartie = true ; // la partie est finie } /* fonction qui fait le changement de niveau vers bravo */ public function passageBravo() { if(!test) // si on n'a pas encore éxcuté les instructions suivantes. { this.test = true ; // on ne le refera plus this.pseudoUn = GameObject.FindGameObjectWithTag("warrior").name; // on trouve le nom du premier joueur pour la base de données this.pseudoDeux = GameObject.FindGameObjectWithTag("fary").name; // on trouve le nom du segond joueur pour la base de donées this.score = GameObject.Find("cameraFairy").GetComponent(CalculTime).getTimeScore(); // on trouve le score pour la base de donnée this.messageScore = GameObject.Find("cameraFairy").GetComponent(CalculTime).getMessageEcran(); // on trouve le message de score pour la fenetre bravo EnregistrementLocal(); // on enregistre automatiquement le score dans les scores local. Network.RemoveRPCs(this.networkView.viewID); // on supprime les appel sur cette identifiant yield WaitForSeconds(1); GameObject.Find("connexionNetwork").GetComponent(Network_ServerConnexion).QuitterNetwork(); // on quitte la partie Application.LoadLevel("Bravo") ; // on passe au menu bravo this.GetComponent(NetworkView).enabled=false; } } /* fonction qui sert à faire l'enregistrement en local du score */ public function EnregistrementLocal() { UserPref.setBestScore(this.score);//meilleur score local; } /* fonction qui appel la classe d'accès au données AddScore pour enregistrer le score en base de données */ public function EnregistrementDataBase() { UserPref.setBestScore(this.score);//meilleur score local; this.GetComponent(AddScore).addScore(this.score,this.pseudoUn,this.pseudoDeux); // de tout les joueurs } //_____________________________________________________________________________________________________________________________________________________________ //_____________________________________________________________________________________________________________________________________________________________ }
52.0625
160
0.739046
990491ccb8f6129013a073a64d07fb3b3b273156
176
js
JavaScript
management-webclient/src/constants/permissions.js
jitendrac/Veniqa
d8425899df428ed0531cfa1f934598c4d70663a9
[ "MIT" ]
null
null
null
management-webclient/src/constants/permissions.js
jitendrac/Veniqa
d8425899df428ed0531cfa1f934598c4d70663a9
[ "MIT" ]
null
null
null
management-webclient/src/constants/permissions.js
jitendrac/Veniqa
d8425899df428ed0531cfa1f934598c4d70663a9
[ "MIT" ]
null
null
null
export default { SUPERADMIN: 'SUPERADMIN', ORDER_VIEW: 'ORDER_VIEW', ORDER_MANAGE: 'ORDER_MANAGE', CATALOG_VIEW: 'CATALOG_VIEW', CATALOG_MANAGE: 'CATALOG_MANAGE', };
22
35
0.732955
99050305acd6431fa927bcfe81fdebc3c8964870
611
js
JavaScript
Instructor-Activities/05-Ins_TypeDefs-Resolvers/schemas/resolvers.js
jj77847/Book-Search-Engine
86544969253fbc6f6789e1d5f624e1b1f059fb63
[ "MIT" ]
16
2021-06-09T16:18:54.000Z
2022-02-01T21:12:47.000Z
Instructor-Activities/05-Ins_TypeDefs-Resolvers/schemas/resolvers.js
jj77847/Book-Search-Engine
86544969253fbc6f6789e1d5f624e1b1f059fb63
[ "MIT" ]
null
null
null
Instructor-Activities/05-Ins_TypeDefs-Resolvers/schemas/resolvers.js
jj77847/Book-Search-Engine
86544969253fbc6f6789e1d5f624e1b1f059fb63
[ "MIT" ]
19
2021-09-13T18:00:37.000Z
2022-03-25T16:36:43.000Z
const { School, Class, Professor } = require('../models'); const resolvers = { Query: { schools: async () => { // Populate the classes and professor subdocuments when querying for schools return await School.find({}).populate('classes').populate({ path: 'classes', populate: 'professor' }); }, classes: async () => { // Populate the professor subdocument when querying for classes return await Class.find({}).populate('professor'); }, professors: async () => { return await Professor.find({}); } } }; module.exports = resolvers;
26.565217
82
0.602291
990526a4950fac64d1583d0f980caf9d6b5b0ffb
2,351
js
JavaScript
express-admin-master/test/utils/sql.js
patrickjmcd/BBQpi
6add0cbbfcb60c845bace3bc20146365de8a213b
[ "MIT" ]
null
null
null
express-admin-master/test/utils/sql.js
patrickjmcd/BBQpi
6add0cbbfcb60c845bace3bc20146365de8a213b
[ "MIT" ]
null
null
null
express-admin-master/test/utils/sql.js
patrickjmcd/BBQpi
6add0cbbfcb60c845bace3bc20146365de8a213b
[ "MIT" ]
null
null
null
var sql = require('../../lib/utils/sql'); describe('sql', function () { before(function () { sql.client.mysql = true; }); it('fullName', function (done) { sql.fullName('table', 'id') .should.equal('`table`.`id`'); done(); }); it('fullNames', function (done) { var columns = ['id', 'name', 'notes']; sql.fullNames('table', columns).join() .should.equal('`table`.`id`,`table`.`name`,`table`.`notes`'); done(); }); it('cast', function (done) { var columns = ['firstname', 'lastname']; columns = sql.fullNames('table', columns); sql.cast(columns).join() .should.equal('CAST(`table`.`firstname` AS CHAR),'+ 'CAST(`table`.`lastname` AS CHAR)'); done(); }); it('concat', function (done) { var columns = ['firstname', 'lastname']; columns = sql.fullNames('table', columns); columns = sql.cast(columns); sql.concat(columns, 'name') .should.equal("CONCAT_WS(' ',CAST(`table`.`firstname` AS CHAR),"+ "CAST(`table`.`lastname` AS CHAR)) AS `name`"); done(); }); it('group', function (done) { var columns = ['firstname', 'lastname']; columns = sql.fullNames('table', columns); columns = sql.cast(columns); sql.group(columns, 'name') .should.equal("GROUP_CONCAT(DISTINCT CONCAT_WS(' ',CAST(`table`.`firstname` AS CHAR),"+ "CAST(`table`.`lastname` AS CHAR))) AS `name`"); done(); }); it('groupby', function (done) { sql.groupby(sql.fullName('table', 'column')) .should.equal(' GROUP BY `table`.`column` '); done(); }); it('order', function (done) { sql.order('table', {column1: 'asc', column2: 'desc'}).join() .should.equal('`table`.`column1` asc,`table`.`column2` desc'); done(); }); it('joins', function (done) { sql.joins('table', 'fk', 'refTable', 'pk') .should.equal(' LEFT JOIN `refTable` ON `table`.`fk` = `refTable`.`pk`'); done(); }); it('pk', function (done) { sql.pk('table', 'pk') .should.equal('`table`.`pk` AS __pk'); done(); }); });
29.759494
99
0.49128
9905c7997330704676b38eb8983f0ffecba29b03
1,285
js
JavaScript
test/specs/collections/Breadcrumb/Breadcrumb-test.js
traverse/Semantic-UI-React
0ec84c9598d73be1e6a8ba86e919ed1aeb4b8836
[ "MIT" ]
null
null
null
test/specs/collections/Breadcrumb/Breadcrumb-test.js
traverse/Semantic-UI-React
0ec84c9598d73be1e6a8ba86e919ed1aeb4b8836
[ "MIT" ]
null
null
null
test/specs/collections/Breadcrumb/Breadcrumb-test.js
traverse/Semantic-UI-React
0ec84c9598d73be1e6a8ba86e919ed1aeb4b8836
[ "MIT" ]
null
null
null
import React from 'react' import Breadcrumb from 'src/collections/Breadcrumb/Breadcrumb' import BreadcrumbDivider from 'src/collections/Breadcrumb/BreadcrumbDivider' import BreadcrumbSection from 'src/collections/Breadcrumb/BreadcrumbSection' import * as common from 'test/specs/commonTests' describe('Breadcrumb', () => { common.isConformant(Breadcrumb) common.hasSubComponents(Breadcrumb, [BreadcrumbDivider, BreadcrumbSection]) common.hasUIClassName(Breadcrumb) common.rendersChildren(Breadcrumb, { rendersContent: false, }) it('renders a <div /> element', () => { shallow(<Breadcrumb />).should.have.tagName('div') }) const sections = [ { key: 'home', content: 'Home', link: true }, { key: 't-shirt', content: 'T-Shirt', href: 'google.com' }, ] it('renders children with `sections` prop', () => { const wrapper = shallow(<Breadcrumb sections={sections} />) wrapper.should.have.exactly(1).descendants(BreadcrumbDivider) wrapper.should.have.exactly(2).descendants(BreadcrumbSection) }) it('renders defined divider with `divider` prop', () => { const wrapper = mount(<Breadcrumb sections={sections} divider='>' />) const divider = wrapper.find(BreadcrumbDivider).first() divider.should.contain.text('>') }) })
32.948718
77
0.709728
9905e2e117ae79cff774a8a3ee973b5bc3cf402d
441
js
JavaScript
crates/swc_ecma_minifier/tests/fixture/projects/underscore/6/output.mangleOnly.js
ArturAralin/swc
c1493dd4f471433c0e300af9f0395b7bae6848e1
[ "Apache-2.0" ]
null
null
null
crates/swc_ecma_minifier/tests/fixture/projects/underscore/6/output.mangleOnly.js
ArturAralin/swc
c1493dd4f471433c0e300af9f0395b7bae6848e1
[ "Apache-2.0" ]
null
null
null
crates/swc_ecma_minifier/tests/fixture/projects/underscore/6/output.mangleOnly.js
ArturAralin/swc
c1493dd4f471433c0e300af9f0395b7bae6848e1
[ "Apache-2.0" ]
null
null
null
_.indexOf = function(a, b, c) { if (a == null) return -1; var d = 0, e = a.length; if (c) { if (typeof c == "number") { d = c < 0 ? Math.max(0, e + c) : c; } else { d = _.sortedIndex(a, b); return a[d] === b ? d : -1; } } if (nativeIndexOf && a.indexOf === nativeIndexOf) return a.indexOf(b, c); for(; d < e; d++)if (a[d] === b) return d; return -1; };
27.5625
77
0.419501
99060afd0058309fab91af0ff37af38396ff62c8
236
js
JavaScript
middleware/localSession.js
renatokano/dh-projeto-integrador-super-pets
7501a89d8f0e62ba47ecd9cf8ffe42df75056b85
[ "MIT" ]
1
2020-03-11T10:38:06.000Z
2020-03-11T10:38:06.000Z
middleware/localSession.js
renatokano/dh-projeto-integrador-super-pets
7501a89d8f0e62ba47ecd9cf8ffe42df75056b85
[ "MIT" ]
138
2020-03-11T10:24:44.000Z
2020-07-01T05:17:21.000Z
middleware/localSession.js
renatokano/dh-projeto-integrador-super-pets
7501a89d8f0e62ba47ecd9cf8ffe42df75056b85
[ "MIT" ]
1
2020-04-06T08:49:21.000Z
2020-04-06T08:49:21.000Z
module.exports = (req, res, next) => { if(req.session.client) { res.locals.user_session = req.session.client; } if(req.session.professional) { res.locals.professional_session = req.session.professional; } next(); }
26.222222
65
0.665254
99064d7e758a4900a7e2b7e566ac758c93260c75
1,830
js
JavaScript
server/app.js
Divyathali/node-mysql-express-crud
38dd42d12206513b7bc42ce481f6311b128d7809
[ "MIT" ]
null
null
null
server/app.js
Divyathali/node-mysql-express-crud
38dd42d12206513b7bc42ce481f6311b128d7809
[ "MIT" ]
null
null
null
server/app.js
Divyathali/node-mysql-express-crud
38dd42d12206513b7bc42ce481f6311b128d7809
[ "MIT" ]
null
null
null
const express = require('express'); const app = express(); const cors = require('cors'); const dotenv = require('dotenv'); dotenv.config(); const dbService = require('./dbService'); app.use(cors()); app.use(express.json()); app.use(express.urlencoded({ extended : false })); // create app.post('/insert', (request, response) => { const { name } = request.body; const db = dbService.getDbServiceInstance(); const result = db.insertNewName(name); result .then(data => response.json({ data: data})) .catch(err => console.log(err)); }); // read app.get('/getAll', (request, response) => { const db = dbService.getDbServiceInstance(); const result = db.getAllData(); result .then(data => response.json({data : data})) .catch(err => console.log(err)); }) // update app.patch('/update', (request, response) => { const { id, name } = request.body; const db = dbService.getDbServiceInstance(); const result = db.updateNameById(id, name); result .then(data => response.json({success : data})) .catch(err => console.log(err)); }); // delete app.delete('/delete/:id', (request, response) => { const { id } = request.params; const db = dbService.getDbServiceInstance(); const result = db.deleteRowById(id); result .then(data => response.json({success : data})) .catch(err => console.log(err)); }); app.get('/search/:name', (request, response) => { const { name } = request.params; const db = dbService.getDbServiceInstance(); const result = db.searchByName(name); result .then(data => response.json({data : data})) .catch(err => console.log(err)); }) app.listen(process.env.PORT, () => console.log('app is running'));
25.416667
66
0.596721
9906a2cf34c776d076b961a43d5cf470b50dd4d4
1,326
js
JavaScript
node_modules/ng2-select/select/select-item.js
Antonio-MendozaMed/OrganiTekne
5f4137a836c879a68b36454d5602707fc7a0f31e
[ "RSA-MD", "OML" ]
null
null
null
node_modules/ng2-select/select/select-item.js
Antonio-MendozaMed/OrganiTekne
5f4137a836c879a68b36454d5602707fc7a0f31e
[ "RSA-MD", "OML" ]
4
2021-05-11T19:50:39.000Z
2022-02-27T08:05:15.000Z
node_modules/ng2-select/select/select-item.js
Antonio-MendozaMed/OrganiTekne
5f4137a836c879a68b36454d5602707fc7a0f31e
[ "RSA-MD", "OML" ]
null
null
null
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var SelectItem = (function () { function SelectItem(source) { var _this = this; if (typeof source === 'string') { this.id = this.text = source; } if (typeof source === 'object') { this.id = source.id || source.text; this.text = source.text; if (source.children && source.text) { this.children = source.children.map(function (c) { var r = new SelectItem(c); r.parent = _this; return r; }); this.text = source.text; } } } SelectItem.prototype.fillChildrenHash = function (optionsMap, startIndex) { var i = startIndex; this.children.map(function (child) { optionsMap.set(child.id, i++); }); return i; }; SelectItem.prototype.hasChildren = function () { return this.children && this.children.length > 0; }; SelectItem.prototype.getSimilar = function () { var r = new SelectItem(false); r.id = this.id; r.text = this.text; r.parent = this.parent; return r; }; return SelectItem; }()); exports.SelectItem = SelectItem;
31.571429
79
0.519608
99072840e9ce13d8c79134a8d6ade3561fd6ea5b
1,223
js
JavaScript
vapixEvents/main.js
CamStreamer/CamScripterApp_examples
d61c4b5eda2fb0180a1a0fbb99530e2abd442a47
[ "MIT" ]
1
2021-09-10T11:56:07.000Z
2021-09-10T11:56:07.000Z
vapixEvents/main.js
CamStreamer/CamScripterApp_examples
d61c4b5eda2fb0180a1a0fbb99530e2abd442a47
[ "MIT" ]
28
2021-06-15T09:24:47.000Z
2021-09-20T10:37:37.000Z
vapixEvents/main.js
CamStreamer/CamScripterApp_examples
d61c4b5eda2fb0180a1a0fbb99530e2abd442a47
[ "MIT" ]
null
null
null
const fs = require('fs'); const CameraVapix = require('camstreamerlib/CameraVapix'); var cv = new CameraVapix({ 'protocol': 'http', 'ip': '127.0.0.1', 'port': 80, 'auth': 'root:pass', }); function getEventDeclarations() { cv.getEventDeclarations().then(function(declarations) { console.log(declarations); }, function(err) { console.log(err); }); } function subscribeEvents() { cv.on('eventsConnect', function() { console.log('Events connected') }); cv.on('eventsDisconnect', function(err) { console.log('Events disconnected: ' + err) }); cv.on('tnsaxis:CameraApplicationPlatform/VMD/Camera1Profile1/.', function(event) { try { var simpleItem = event['tt:MetadataStream']['tt:Event'] [0]['wsnt:NotificationMessage'] [0]['wsnt:Message'] [0]['tt:Message'] [0]['tt:Data'] [0]['tt:SimpleItem']; for (var i = 0; i < simpleItem.length; i++) { if (simpleItem[i]['$'].Name == 'active') { console.log(simpleItem[i]['$']); break; } } } catch (err) { console.log('Invalid event data: ' + err); } }); cv.eventsConnect(); } //getEventDeclarations(); subscribeEvents();
27.177778
90
0.584628
990817684a358d8ccaaed1b49479ce654cdcf8c6
30
js
JavaScript
lib-esm/openfl/utils/clearTimeout.js
delahee/openfl
d164a5e7dec83ff5fbb08ccda932abdb46d08e53
[ "MIT" ]
22
2017-12-08T22:10:46.000Z
2021-12-26T07:23:40.000Z
lib-esm/openfl/utils/clearTimeout.js
jgranick/openfl
6f64c42bed8860ad980f41dba9bdb328bda9da30
[ "MIT" ]
12
2017-12-08T23:37:17.000Z
2017-12-31T02:01:01.000Z
lib-esm/openfl/utils/clearTimeout.js
jgranick/openfl
6f64c42bed8860ad980f41dba9bdb328bda9da30
[ "MIT" ]
4
2017-12-10T10:13:35.000Z
2022-03-16T10:48:55.000Z
export default clearTimeout;
10
28
0.833333
9908267356757307899aaa225772ecee95805b0d
8,014
js
JavaScript
spec/suites/core/EventsSpec.js
kristerkari/Leaflet
e47ca1178c53b1f13e38f072f2bb518e1f93e9b1
[ "BSD-2-Clause" ]
1
2021-09-03T00:11:34.000Z
2021-09-03T00:11:34.000Z
spec/suites/core/EventsSpec.js
kristerkari/Leaflet
e47ca1178c53b1f13e38f072f2bb518e1f93e9b1
[ "BSD-2-Clause" ]
null
null
null
spec/suites/core/EventsSpec.js
kristerkari/Leaflet
e47ca1178c53b1f13e38f072f2bb518e1f93e9b1
[ "BSD-2-Clause" ]
null
null
null
describe('Events', function() { var Klass; beforeEach(function() { Klass = L.Class.extend({ includes: L.Mixin.Events }); }); describe('#fireEvent', function() { it('fires all listeners added through #addEventListener', function() { var obj = new Klass(), spy1 = sinon.spy(), spy2 = sinon.spy(), spy3 = sinon.spy(), spy4 = sinon.spy(), spy5 = sinon.spy(); spy6 = sinon.spy(); obj.addEventListener('test', spy1); obj.addEventListener('test', spy2); obj.addEventListener('other', spy3); obj.addEventListener({ test: spy4, other: spy5 }); obj.addEventListener({'test other': spy6 }); expect(spy1.called).to.be(false); expect(spy2.called).to.be(false); expect(spy3.called).to.be(false); expect(spy4.called).to.be(false); expect(spy5.called).to.be(false); expect(spy6.called).to.be(false); obj.fireEvent('test'); expect(spy1.called).to.be(true); expect(spy2.called).to.be(true); expect(spy3.called).to.be(false); expect(spy4.called).to.be(true); expect(spy5.called).to.be(false); expect(spy6.called).to.be(true); expect(spy6.callCount).to.be(1); }); it('provides event object to listeners and executes them in the right context', function() { var obj = new Klass(), obj2 = new Klass(), obj3 = new Klass(), obj4 = new Klass(), foo = {}; function listener1(e) { expect(e.type).to.eql('test'); expect(e.target).to.eql(obj); expect(this).to.eql(obj); expect(e.baz).to.eql(1); } function listener2(e) { expect(e.type).to.eql('test'); expect(e.target).to.eql(obj2); expect(this).to.eql(foo); expect(e.baz).to.eql(2); } function listener3(e) { expect(e.type).to.eql('test'); expect(e.target).to.eql(obj3); expect(this).to.eql(obj3); expect(e.baz).to.eql(3); } function listener4(e) { expect(e.type).to.eql('test'); expect(e.target).to.eql(obj4); expect(this).to.eql(foo); expect(e.baz).to.eql(4); } obj.addEventListener('test', listener1); obj2.addEventListener('test', listener2, foo); obj3.addEventListener({ test: listener3 }); obj4.addEventListener({ test: listener4 }, foo); obj.fireEvent('test', {baz: 1}); obj2.fireEvent('test', {baz: 2}); obj3.fireEvent('test', {baz: 3}); obj4.fireEvent('test', {baz: 4}); }); it('calls no listeners removed through #removeEventListener', function() { var obj = new Klass(), spy = sinon.spy(), spy2 = sinon.spy(), spy3 = sinon.spy(), spy4 = sinon.spy(), spy5 = sinon.spy(); obj.addEventListener('test', spy); obj.removeEventListener('test', spy); obj.fireEvent('test'); expect(spy.called).to.be(false); obj.addEventListener('test2', spy2); obj.addEventListener('test2', spy3); obj.removeEventListener('test2'); obj.fireEvent('test2'); expect(spy2.called).to.be(false); expect(spy3.called).to.be(false); obj.addEventListener('test3', spy4); obj.addEventListener('test4', spy5); obj.removeEventListener({ test3: spy4, test4: spy5 }); obj.fireEvent('test3'); obj.fireEvent('test4'); expect(spy4.called).to.be(false); expect(spy5.called).to.be(false); }); // added due to context-sensitive removeListener optimization it('fires multiple listeners with the same context with id', function () { var obj = new Klass(), spy1 = sinon.spy(), spy2 = sinon.spy(), foo = {}; L.Util.stamp(foo); obj.addEventListener('test', spy1, foo); obj.addEventListener('test', spy2, foo); obj.fireEvent('test'); expect(spy1.called).to.be(true); expect(spy2.called).to.be(true); }); it('removes listeners with stamped contexts', function () { var obj = new Klass(), spy1 = sinon.spy(), spy2 = sinon.spy(), foo = {}; L.Util.stamp(foo); obj.addEventListener('test', spy1, foo); obj.addEventListener('test', spy2, foo); obj.removeEventListener('test', spy1, foo); obj.fireEvent('test'); expect(spy1.called).to.be(false); expect(spy2.called).to.be(true); }); it('removes listeners with a stamp originally added without one', function() { var obj = new Klass(), spy1 = sinon.spy(), spy2 = sinon.spy(), foo = {}; obj.addEventListener('test', spy1, foo); L.Util.stamp(foo); obj.addEventListener('test', spy2, foo); obj.removeEventListener('test', spy1, foo); obj.removeEventListener('test', spy2, foo); obj.fireEvent('test'); expect(spy1.called).to.be(false); expect(spy2.called).to.be(false); }); it('doesnt lose track of listeners when removing non existent ones', function () { var obj = new Klass(), spy = sinon.spy(), spy2 = sinon.spy(), foo = {}, foo2 = {}; L.Util.stamp(foo); L.Util.stamp(foo2); obj.addEventListener('test', spy, foo2); obj.removeEventListener('test', spy, foo); // Decrements test_idx to 0, even though event listener isn't registered with foo's _leaflet_id obj.removeEventListener('test', spy, foo2); // Doesn't get removed obj.addEventListener('test', spy2, foo); obj.fireEvent('test'); expect(spy.called).to.be(false); }); }); describe('#on, #off & #fire', function() { it('works like #addEventListener && #removeEventListener', function() { var obj = new Klass(), spy = sinon.spy(); obj.on('test', spy); obj.fire('test'); expect(spy.called).to.be(true); obj.off('test', spy); obj.fireEvent('test'); expect(spy.callCount).to.be.lessThan(2); }); it('does not override existing methods with the same name', function() { var spy1 = sinon.spy(), spy2 = sinon.spy(), spy3 = sinon.spy(); var Klass2 = L.Class.extend({ includes: L.Mixin.Events, on: spy1, off: spy2, fire: spy3 }); var obj = new Klass2(); obj.on(); expect(spy1.called).to.be(true); obj.off(); expect(spy2.called).to.be(true); obj.fire(); expect(spy3.called).to.be(true); }); }); describe("#clearEventListeners", function() { it("clears all registered listeners on an object", function() { var spy = sinon.spy(), obj = new Klass() otherObj = new Klass(); obj.on('test', spy, obj); obj.on('testTwo', spy); obj.on('test', spy, otherObj); obj.off(); obj.fire('test'); expect(spy.called).to.be(false); }); }); describe('#once', function() { it('removes event listeners after first trigger', function() { var obj = new Klass(), spy = sinon.spy(); obj.once('test', spy, obj); obj.fire('test'); expect(spy.called).to.be(true); obj.fire('test'); expect(spy.callCount).to.be.lessThan(2); }); it('works with an object hash', function() { var obj = new Klass(), spy = sinon.spy(), otherSpy = sinon.spy(); obj.once({ 'test': spy, otherTest: otherSpy }, obj); obj.fire('test'); obj.fire('otherTest'); expect(spy.called).to.be(true); expect(otherSpy.called).to.be(true); obj.fire('test'); obj.fire('otherTest'); expect(spy.callCount).to.be.lessThan(2); expect(otherSpy.callCount).to.be.lessThan(2); }); it("doesn't call listeners to events that have been removed", function () { var obj = new Klass(), spy = sinon.spy(); obj.once('test', spy, obj); obj.off('test', spy, obj); obj.fire('test'); expect(spy.called).to.be(false); }); it('works if called from a context that doesnt implement #Events', function() { var obj = new Klass(), spy = sinon.spy(), foo = {}; obj.once('test', spy, foo); obj.fire('test'); expect(spy.called).to.be(true); }); }); });
24.358663
142
0.58585
99085ce5f64e6d38785e2fca5765fbba4196c06f
431
js
JavaScript
client/src/components/chatrooms/Messages/index.js
EricGip/PersonalBoilerPlate
2d1e020d0c634f374b76ef405c88b62a3e748212
[ "MIT" ]
null
null
null
client/src/components/chatrooms/Messages/index.js
EricGip/PersonalBoilerPlate
2d1e020d0c634f374b76ef405c88b62a3e748212
[ "MIT" ]
null
null
null
client/src/components/chatrooms/Messages/index.js
EricGip/PersonalBoilerPlate
2d1e020d0c634f374b76ef405c88b62a3e748212
[ "MIT" ]
null
null
null
// MESSAGES import React from 'react'; import ScrollToBottom from 'react-scroll-to-bottom'; import Message from './Message'; // ScrollToBottom scrolls to most recent messages (npm package) // const Messages = ({ messages, name }) => ( <ScrollToBottom className="messages"> {messages.map((message, i) => <div key={i}><Message message={message} name={name} /></div>)} </ScrollToBottom> ); export default Messages;
28.733333
100
0.684455
9908aa5cd652590a496bfff73c44bad23320e0d6
7,003
js
JavaScript
Javascript/md4.js
Forward2015/Download
3378eb3d08587d74456d7c1542f52dafc6818c1d
[ "MIT" ]
1
2020-04-15T19:23:30.000Z
2020-04-15T19:23:30.000Z
Javascript/md4.js
Forward2015/Download
3378eb3d08587d74456d7c1542f52dafc6818c1d
[ "MIT" ]
null
null
null
Javascript/md4.js
Forward2015/Download
3378eb3d08587d74456d7c1542f52dafc6818c1d
[ "MIT" ]
2
2018-08-02T09:51:06.000Z
2020-04-15T19:23:33.000Z
/* * A JavaScript implementation of the RSA Data Security, Inc. MD4 Message * Digest Algorithm, as defined in RFC 1320. * Version 2.1 Copyright (C) Jerrad Pierce, Paul Johnston 1999 - 2002. * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet * Distributed under the BSD License * See http://pajhome.org.uk/crypt/md5 for more info. */ /* * Configurable variables. You may need to tweak these to be compatible with * the server-side, but the defaults work in most cases. */ var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */ var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */ var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */ /* * These are the functions you'll usually want to call */ function hex_md4(s){ return binl2hex(core_md4(str2binl(s), s.length * chrsz));} function b64_md4(s){ return binl2b64(core_md4(str2binl(s), s.length * chrsz));} function str_md4(s){ return binl2str(core_md4(str2binl(s), s.length * chrsz));} function hex_hmac_md4(key, data) { return binl2hex(core_hmac_md4(key, data)); } function b64_hmac_md4(key, data) { return binl2b64(core_hmac_md4(key, data)); } function str_hmac_md4(key, data) { return binl2str(core_hmac_md4(key, data)); } /* * Perform a simple self-test to see if the VM is working */ function md4_vm_test() { return hex_md4("abc") == "a448017aaf21d8525fc10ae87aa6729d"; } /* * Calculate the MD4 of an array of little-endian words, and a bit length */ function core_md4(x, len) { /* append padding */ x[len >> 5] |= 0x80 << (len % 32); x[(((len + 64) >>> 9) << 4) + 14] = len; var a = 1732584193; var b = -271733879; var c = -1732584194; var d = 271733878; for(var i = 0; i < x.length; i += 16) { var olda = a; var oldb = b; var oldc = c; var oldd = d; a = md4_ff(a, b, c, d, x[i+ 0], 3 ); d = md4_ff(d, a, b, c, x[i+ 1], 7 ); c = md4_ff(c, d, a, b, x[i+ 2], 11); b = md4_ff(b, c, d, a, x[i+ 3], 19); a = md4_ff(a, b, c, d, x[i+ 4], 3 ); d = md4_ff(d, a, b, c, x[i+ 5], 7 ); c = md4_ff(c, d, a, b, x[i+ 6], 11); b = md4_ff(b, c, d, a, x[i+ 7], 19); a = md4_ff(a, b, c, d, x[i+ 8], 3 ); d = md4_ff(d, a, b, c, x[i+ 9], 7 ); c = md4_ff(c, d, a, b, x[i+10], 11); b = md4_ff(b, c, d, a, x[i+11], 19); a = md4_ff(a, b, c, d, x[i+12], 3 ); d = md4_ff(d, a, b, c, x[i+13], 7 ); c = md4_ff(c, d, a, b, x[i+14], 11); b = md4_ff(b, c, d, a, x[i+15], 19); a = md4_gg(a, b, c, d, x[i+ 0], 3 ); d = md4_gg(d, a, b, c, x[i+ 4], 5 ); c = md4_gg(c, d, a, b, x[i+ 8], 9 ); b = md4_gg(b, c, d, a, x[i+12], 13); a = md4_gg(a, b, c, d, x[i+ 1], 3 ); d = md4_gg(d, a, b, c, x[i+ 5], 5 ); c = md4_gg(c, d, a, b, x[i+ 9], 9 ); b = md4_gg(b, c, d, a, x[i+13], 13); a = md4_gg(a, b, c, d, x[i+ 2], 3 ); d = md4_gg(d, a, b, c, x[i+ 6], 5 ); c = md4_gg(c, d, a, b, x[i+10], 9 ); b = md4_gg(b, c, d, a, x[i+14], 13); a = md4_gg(a, b, c, d, x[i+ 3], 3 ); d = md4_gg(d, a, b, c, x[i+ 7], 5 ); c = md4_gg(c, d, a, b, x[i+11], 9 ); b = md4_gg(b, c, d, a, x[i+15], 13); a = md4_hh(a, b, c, d, x[i+ 0], 3 ); d = md4_hh(d, a, b, c, x[i+ 8], 9 ); c = md4_hh(c, d, a, b, x[i+ 4], 11); b = md4_hh(b, c, d, a, x[i+12], 15); a = md4_hh(a, b, c, d, x[i+ 2], 3 ); d = md4_hh(d, a, b, c, x[i+10], 9 ); c = md4_hh(c, d, a, b, x[i+ 6], 11); b = md4_hh(b, c, d, a, x[i+14], 15); a = md4_hh(a, b, c, d, x[i+ 1], 3 ); d = md4_hh(d, a, b, c, x[i+ 9], 9 ); c = md4_hh(c, d, a, b, x[i+ 5], 11); b = md4_hh(b, c, d, a, x[i+13], 15); a = md4_hh(a, b, c, d, x[i+ 3], 3 ); d = md4_hh(d, a, b, c, x[i+11], 9 ); c = md4_hh(c, d, a, b, x[i+ 7], 11); b = md4_hh(b, c, d, a, x[i+15], 15); a = safe_add(a, olda); b = safe_add(b, oldb); c = safe_add(c, oldc); d = safe_add(d, oldd); } return Array(a, b, c, d); } /* * These functions implement the basic operation for each round of the * algorithm. */ function md4_cmn(q, a, b, x, s, t) { return safe_add(rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b); } function md4_ff(a, b, c, d, x, s) { return md4_cmn((b & c) | ((~b) & d), a, 0, x, s, 0); } function md4_gg(a, b, c, d, x, s) { return md4_cmn((b & c) | (b & d) | (c & d), a, 0, x, s, 1518500249); } function md4_hh(a, b, c, d, x, s) { return md4_cmn(b ^ c ^ d, a, 0, x, s, 1859775393); } /* * Calculate the HMAC-MD4, of a key and some data */ function core_hmac_md4(key, data) { var bkey = str2binl(key); if(bkey.length > 16) bkey = core_md4(bkey, key.length * chrsz); var ipad = Array(16), opad = Array(16); for(var i = 0; i < 16; i++) { ipad[i] = bkey[i] ^ 0x36363636; opad[i] = bkey[i] ^ 0x5C5C5C5C; } var hash = core_md4(ipad.concat(str2binl(data)), 512 + data.length * chrsz); return core_md4(opad.concat(hash), 512 + 128); } /* * Add integers, wrapping at 2^32. This uses 16-bit operations internally * to work around bugs in some JS interpreters. */ function safe_add(x, y) { var lsw = (x & 0xFFFF) + (y & 0xFFFF); var msw = (x >> 16) + (y >> 16) + (lsw >> 16); return (msw << 16) | (lsw & 0xFFFF); } /* * Bitwise rotate a 32-bit number to the left. */ function rol(num, cnt) { return (num << cnt) | (num >>> (32 - cnt)); } /* * Convert a string to an array of little-endian words * If chrsz is ASCII, characters >255 have their hi-byte silently ignored. */ function str2binl(str) { var bin = Array(); var mask = (1 << chrsz) - 1; for(var i = 0; i < str.length * chrsz; i += chrsz) bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32); return bin; } /* * Convert an array of little-endian words to a string */ function binl2str(bin) { var str = ""; var mask = (1 << chrsz) - 1; for(var i = 0; i < bin.length * 32; i += chrsz) str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask); return str; } /* * Convert an array of little-endian words to a hex string. */ function binl2hex(binarray) { var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef"; var str = ""; for(var i = 0; i < binarray.length * 4; i++) { str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) + hex_tab.charAt((binarray[i>>2] >> ((i%4)*8 )) & 0xF); } return str; } /* * Convert an array of little-endian words to a base-64 string */ function binl2b64(binarray) { var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; var str = ""; for(var i = 0; i < binarray.length * 4; i += 3) { var triplet = (((binarray[i >> 2] >> 8 * ( i %4)) & 0xFF) << 16) | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 ) | ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF); for(var j = 0; j < 4; j++) { if(i * 8 + j * 6 > binarray.length * 32) str += b64pad; else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F); } } return str; }
29.548523
79
0.539197
9908f774fdf51661cec0da6553964ac12c7f3a45
477
js
JavaScript
server.js
KaiJack1/Tech-Crazy
a7bb825886c59ad71a4a997f8f0653fb41ae7b76
[ "Apache-2.0" ]
null
null
null
server.js
KaiJack1/Tech-Crazy
a7bb825886c59ad71a4a997f8f0653fb41ae7b76
[ "Apache-2.0" ]
null
null
null
server.js
KaiJack1/Tech-Crazy
a7bb825886c59ad71a4a997f8f0653fb41ae7b76
[ "Apache-2.0" ]
null
null
null
//Importing dependencies const path = require('path'); const express = require('express'); const session = require('express-session'); const exphbs = require('express-handlebars'); const routes = require('./controllers'); const helpers = require('./utils/helpers'); const sequelize = require('./config/connection'); const SequelizeStore = require('connect-session-sequelize')(session.Store); //Connecting to server const app = express(); const PORT = process.env.PORT || 3001;
36.692308
75
0.740042
990916a6d6cd7022b86cbd969a3c15a57b8c6e64
789
js
JavaScript
src/components/icons/ReviewIcon.js
brdtheo/rawg-app
ed5df0e58449d2bac75950686d263beb10f90ca1
[ "MIT" ]
3
2021-08-25T05:29:04.000Z
2021-11-16T11:35:19.000Z
src/components/icons/ReviewIcon.js
brdtheo/rawg-app
ed5df0e58449d2bac75950686d263beb10f90ca1
[ "MIT" ]
null
null
null
src/components/icons/ReviewIcon.js
brdtheo/rawg-app
ed5df0e58449d2bac75950686d263beb10f90ca1
[ "MIT" ]
null
null
null
import React from 'react' import Svg, { Path } from 'react-native-svg' import { View } from 'react-native' import { tailwind } from '../../../tailwind' const ReviewIcon = ({ size }) => { return ( <View style={{ ...tailwind('flex self-center'), width: size, height: size, }} > <Svg class="SVGInline-svg discover-sidebar__icon-svg" viewBox="0 0 21 18" xmlns="http://www.w3.org/2000/svg" > <Path d="M10.5 0C4.7 0 0 3.62 0 8.086c0 2.19 1.132 4.18 2.97 5.635-.106 1.485-.463 3.3-1.497 4.279 2.058 0 4.161-1.29 5.49-2.3 1.106.304 2.295.471 3.537.471 5.8 0 10.5-3.617 10.5-8.085C21 3.619 16.3 0 10.5 0z" fill="#FFF" /> </Svg> </View> ) } export default ReviewIcon
26.3
213
0.542459
99091b4fa3b3e0780af567aa7d48193c32da2e3e
4,004
js
JavaScript
node_modules/axe-core/lib/commons/text/accessible-text-virtual.js
connorjclark/lighthouse-ci-action
4473f0669f709df3f4b9346546014045da49bf72
[ "MIT" ]
1
2021-10-10T12:44:02.000Z
2021-10-10T12:44:02.000Z
node_modules/axe-core/lib/commons/text/accessible-text-virtual.js
connorjclark/lighthouse-ci-action
4473f0669f709df3f4b9346546014045da49bf72
[ "MIT" ]
9
2021-05-11T03:30:25.000Z
2022-03-02T07:24:59.000Z
node_modules/axe-core/lib/commons/text/accessible-text-virtual.js
connorjclark/lighthouse-ci-action
4473f0669f709df3f4b9346546014045da49bf72
[ "MIT" ]
1
2020-02-17T23:22:39.000Z
2020-02-17T23:22:39.000Z
/* global text, dom, aria, axe */ /** * Finds virtual node and calls accessibleTextVirtual() * IMPORTANT: This method requires the composed tree at axe._tree * * @param {HTMLElement} element The HTMLElement * @param {Object} context * @property {Bool} inControlContext * @property {Bool} inLabelledByContext * @return {string} */ text.accessibleText = function accessibleText(element, context) { const virtualNode = axe.utils.getNodeFromTree(element); // throws an exception on purpose if axe._tree not correct return text.accessibleTextVirtual(virtualNode, context); }; /** * Finds virtual node and calls accessibleTextVirtual() * IMPORTANT: This method requires the composed tree at axe._tree * * @param {HTMLElement} element The HTMLElement * @param {Object} context * @property {Bool} inControlContext * @property {Bool} inLabelledByContext * @return {string} */ text.accessibleTextVirtual = function accessibleTextVirtual( virtualNode, context = {} ) { const { actualNode } = virtualNode; context = prepareContext(virtualNode, context); // Step 2A, check visibility if (shouldIgnoreHidden(virtualNode, context)) { return ''; } const computationSteps = [ aria.arialabelledbyText, // Step 2B.1 aria.arialabelText, // Step 2C text.nativeTextAlternative, // Step 2D text.formControlValue, // Step 2E text.subtreeText, // Step 2F + Step 2H textNodeContent, // Step 2G (order with 2H does not matter) text.titleText // Step 2I ]; // Find the first step that returns a non-empty string let accName = computationSteps.reduce((accName, step) => { if (accName !== '') { // yes, whitespace only a11y names halt the algorithm return accName; } return step(virtualNode, context); }, ''); if (context.startNode === virtualNode) { accName = text.sanitize(accName); } if (context.debug) { axe.log(accName || '{empty-value}', actualNode, context); } return accName; }; /** * Return the textContent of a node * @param {VirtualNode} element * @return {String} textContent value */ function textNodeContent({ actualNode }) { if (actualNode.nodeType !== 3) { return ''; } return actualNode.textContent; } /** * Check if the * @param {VirtualNode} element * @param {Object} context * @property {VirtualNode[]} processed * @return {Boolean} */ function shouldIgnoreHidden({ actualNode }, context) { if ( // If the parent isn't ignored, the text node should not be either actualNode.nodeType !== 1 || // If the target of aria-labelledby is hidden, ignore all descendents context.includeHidden ) { return false; } return !dom.isVisible(actualNode, true); } /** * Apply defaults to the context * @param {VirtualNode} element * @param {Object} context * @return {Object} context object with defaults applied */ function prepareContext(virtualNode, context) { const { actualNode } = virtualNode; if (!context.startNode) { context = { startNode: virtualNode, ...context }; } /** * When `aria-labelledby` directly references a `hidden` element * the element needs to be included in the accessible name. * * When a descendent of the `aria-labelledby` reference is `hidden` * the element should not be included in the accessible name. * * This is done by setting `includeHidden` for the `aria-labelledby` reference. */ if ( actualNode.nodeType === 1 && context.inLabelledByContext && context.includeHidden === undefined ) { context = { includeHidden: !dom.isVisible(actualNode, true), ...context }; } return context; } /** * Check if the node is processed with this context before * @param {VirtualNode} element * @param {Object} context * @property {VirtualNode[]} processed * @return {Boolean} */ text.accessibleTextVirtual.alreadyProcessed = function alreadyProcessed( virtualnode, context ) { context.processed = context.processed || []; if (context.processed.includes(virtualnode)) { return true; } context.processed.push(virtualnode); return false; };
26.169935
115
0.706793
99092929c6612ac35b6e0e046f3eafc020052858
67
js
JavaScript
client/src/components/CustomCard/index.js
marianafcosta/SINF1920
d7e7d6faa8861bfaad01c47e630bc247f0e85df8
[ "MIT" ]
null
null
null
client/src/components/CustomCard/index.js
marianafcosta/SINF1920
d7e7d6faa8861bfaad01c47e630bc247f0e85df8
[ "MIT" ]
null
null
null
client/src/components/CustomCard/index.js
marianafcosta/SINF1920
d7e7d6faa8861bfaad01c47e630bc247f0e85df8
[ "MIT" ]
4
2020-08-17T17:01:00.000Z
2021-09-27T23:11:37.000Z
import CustomCard from './CustomCard'; export default CustomCard;
16.75
38
0.791045