This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function checkCredentials(params) { | |
if ( | |
params.username.toLowerCase() !== 'admin' || | |
params.password !== '12345' | |
) { | |
return false | |
} | |
return true | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var lastScrollTop = 0; | |
$(window).on('scroll', function() { | |
st = $(this).scrollTop(); | |
if(st < lastScrollTop) { | |
console.log('up 1'); | |
} | |
else { | |
console.log('down 1'); | |
// getImages(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const {defaults} = require('jest-config'); | |
module.exports = { | |
// ... | |
moduleFileExtensions: [...defaults.moduleFileExtensions, 'ts', 'tsx'], | |
setupFiles: ["./js/all-browsers/urls.js", "./tests/jest.jquery.js"], | |
rootDir: '../', | |
// ... | |
}; | |
/// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
iconClick = () => { | |
if (this.state.showMenu === 'none') { | |
this.showMenu(); | |
document.addEventListener('click', this.iconClickOutside); | |
} else if (this.state.showMenu === 'flex') { | |
this.hideMenu(); | |
document.removeEventListener('click', this.iconClickOutside); | |
} | |
} | |
iconClickOutside = (e) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
componentDidMount() { | |
const elem = ReactDOM.findDOMNode(this.elementToFire); | |
elem.addEventListener('scroll', this.fireOnScroll, true); | |
} | |
componentWillUnmount() { | |
const elem = ReactDOM.findDOMNode(this.elementToFire); | |
elem.removeEventListener('scroll', this.fireOnScroll, true); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import _ from "lodash"; | |
import React from "react"; | |
import { connect } from "react-redux"; | |
import Header from "./Header.jsx"; | |
import NavigationBar from "./NavigationBar.jsx"; | |
import TabContainer from "./TabContainer.jsx"; | |
import { getFavIcon, getDomain } from "../../tools/utils.js"; | |
import { INJECT_SLIDER_SELECTORS } from '../../tools/const.js'; | |
import Settings from './Routes/Settings.jsx'; | |
import UpdatePopUp from './Routes/UpdatePopUp.jsx'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isColorRed(date) { | |
return moment.unix(date).isBefore(moment().add(1, 'days'), 'day'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function formatNumber(num) { | |
return Number(num).toFixed(2).toString().replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1 ').replace('.', ',').replace('.00', ''); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const arrayToSort = [1,9,2,8,3,7,4,6,5]; | |
const sort = array => { | |
if (array.length < 2) return array; | |
const [pivot, ...restItems] = array; | |
const less = [...restItems].filter(item => item < pivot); | |
const greater = [...restItems].filter(item => item > pivot); | |
console.log('test'); | |
return sort(less).concat(pivot).concat(sort(greater)); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cloneObject = obj => { | |
const clone = {}; | |
for(let i in obj) { | |
if(obj[i] != null && typeof(obj[i]) === "object") { | |
clone[i] = this.cloneObject(obj[i]); | |
} else { | |
clone[i] = obj[i]; | |
} | |
} | |
return clone; |