type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
ArrowFunction
() => { const grid = [ 'jefblpepre', 'camdcimgtc', 'oivokprjsm', 'pbwasqroua', 'rixilelhrs', 'wolcqlirpc', 'screeaumgr', 'alxhpburyi', 'jalaycalmp', 'clojurermt', ] const expectedResults = { clojure: { start: [10, 1], end: [10, 7], }, elixir: { start: [5, 6], end: [5, 1], }, ecmascript: { start: [1, 10], end: [10, 10], }, rust: { start: [5, 9], end: [2, 9], }, java: { start: [1, 1], end: [4, 4], }, } const wordSearch = new WordSearch(grid) expect( wordSearch.find(['clojure', 'elixir', 'ecmascript', 'rust', 'java']) ).toEqual(expectedResults) }
ErikSchierboom/exercism
typescript/word-search/word-search.test.ts
TypeScript
ArrowFunction
() => { const grid = [ 'jefblpepre', 'camdcimgtc', 'oivokprjsm', 'pbwasqroua', 'rixilelhrs', 'wolcqlirpc', 'screeaumgr', 'alxhpburyi', 'jalaycalmp', 'clojurermt', ] const expectedResults = { clojure: { start: [10, 1], end: [10, 7], }, elixir: { start: [5, 6], end: [5, 1], }, ecmascript: { start: [1, 10], end: [10, 10], }, rust: { start: [5, 9], end: [2, 9], }, java: { start: [1, 1], end: [4, 4], }, lua: { start: [9, 8], end: [7, 6], }, } const wordSearch = new WordSearch(grid) expect( wordSearch.find([ 'clojure', 'elixir', 'ecmascript', 'rust', 'java', 'lua', ]) ).toEqual(expectedResults) }
ErikSchierboom/exercism
typescript/word-search/word-search.test.ts
TypeScript
ArrowFunction
() => { const grid = [ 'jefblpepre', 'camdcimgtc', 'oivokprjsm', 'pbwasqroua', 'rixilelhrs', 'wolcqlirpc', 'screeaumgr', 'alxhpburyi', 'jalaycalmp', 'clojurermt', ] const expectedResults = { clojure: { start: [10, 1], end: [10, 7], }, elixir: { start: [5, 6], end: [5, 1], }, ecmascript: { start: [1, 10], end: [10, 10], }, rust: { start: [5, 9], end: [2, 9], }, java: { start: [1, 1], end: [4, 4], }, lua: { start: [9, 8], end: [7, 6], }, lisp: { start: [6, 3], end: [3, 6], }, } const wordSearch = new WordSearch(grid) expect( wordSearch.find([ 'clojure', 'elixir', 'ecmascript', 'rust', 'java', 'lua', 'lisp', ]) ).toEqual(expectedResults) }
ErikSchierboom/exercism
typescript/word-search/word-search.test.ts
TypeScript
ArrowFunction
() => { const grid = [ 'jefblpepre', 'camdcimgtc', 'oivokprjsm', 'pbwasqroua', 'rixilelhrs', 'wolcqlirpc', 'screeaumgr', 'alxhpburyi', 'jalaycalmp', 'clojurermt', ] const expectedResults = { clojure: { start: [10, 1], end: [10, 7], }, elixir: { start: [5, 6], end: [5, 1], }, ecmascript: { start: [1, 10], end: [10, 10], }, rust: { start: [5, 9], end: [2, 9], }, java: { start: [1, 1], end: [4, 4], }, lua: { start: [9, 8], end: [7, 6], }, lisp: { start: [6, 3], end: [3, 6], }, ruby: { start: [6, 8], end: [9, 5], }, } const wordSearch = new WordSearch(grid) expect( wordSearch.find([ 'clojure', 'elixir', 'ecmascript', 'rust', 'java', 'lua', 'lisp', 'ruby', ]) ).toEqual(expectedResults) }
ErikSchierboom/exercism
typescript/word-search/word-search.test.ts
TypeScript
ArrowFunction
data => { this.students = data }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
ArrowFunction
error => console.log(error)
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
ArrowFunction
data => { this.ids = data }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
ArrowFunction
data => { this.skills = data, this.sort(this.skills) }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
ArrowFunction
data => { this.proffskills = data, this.sort(this.proffskills) }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
ArrowFunction
data => { this.languages = data, this.sortLang(this.languages) }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
ArrowFunction
data => { for (let i = 0; i < data.length; i++) { this.skillFk.push(data[i]); } this.checkSkillDupes(this.checkedSkill); }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
ArrowFunction
data => { for (let i = 0; i < data.length; i++) { this.profskillFk.push(data[i]); } this.checkProfDupes(this.checkedProf); }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
ArrowFunction
data => { for (let i = 0; i < data.length; i++) { this.languageFk.push(data[i]); } this.checkLangDupes(this.checkedLang); }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
ArrowFunction
data => { this.students[i] = data[0] }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
ArrowFunction
data => { this.students[k] = data[0], console.log(data), k++ }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
ArrowFunction
data => { this.download(data[0].id) }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
ArrowFunction
data => { const pos = this.students.map(elem => elem.id).indexOf(student.id); this.students.splice(pos, 1); this.toast.setMessage('item deleted successfully.', 'success'); }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
ArrowFunction
elem => elem.id
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
ArrowFunction
error => console.error
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
ArrowFunction
data => { this.studentjes += data, console.log(data) }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
ArrowFunction
error => { console.log("gelukt") }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
MethodDeclaration
ngOnInit() { this.getStudents(); this.getStudentsIds(); this.getSkills(); this.getLanguages(); this.getProffskills(); }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
MethodDeclaration
//Get all students -> add to students[] getStudents() { this.studentService.getStudentsMysql().subscribe( data => { this.students = data }, error => console.log(error) ) }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
MethodDeclaration
//Get all the ids of the students -> add to ids[] getStudentsIds() { this.studentService.getStudentsIdsMysql().subscribe( data => { this.ids = data }, error => console.log(error) ) }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
MethodDeclaration
//get all distinct skills of all students -> add to skills[] //sort them alphabetically getSkills() { this.skillService.getSkillsDistinct().subscribe( data => { this.skills = data, this.sort(this.skills) }, error => console.log(error) ) }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
MethodDeclaration
//get all disctinct professional skills of all students -> add to proffskills[] getProffskills() { this.professionalService.getProfessionalDistinct().subscribe( data => { this.proffskills = data, this.sort(this.proffskills) }, error => console.log(error) ) }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
MethodDeclaration
//get all distinct languages -> add them to languages[] getLanguages() { this.languageService.getLanguagesDistinct().subscribe( data => { this.languages = data, this.sortLang(this.languages) }, error => console.log(error) ) }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
MethodDeclaration
//sort array on skills alphabetically sort(array) { array.sort(function (name1, name2) { if (name1.skill < name2.skill) { return -1; } else if (name1.skill > name2.skill) { return 1; } else { return 0; } }); }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
MethodDeclaration
//sort array on language type alphabetically sortLang(array) { array.sort(function (name1, name2) { if (name1.type < name2.type) { return -1; } else if (name1.type > name2.type) { return 1; } else { return 0; } }); }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
MethodDeclaration
sortGradYear() { if (this.clickGrad == 0) { this.students.sort(function (name1, name2) { if (name1.gradYear < name2.gradYear) { return -1; } else if (name1.gradYear > name2.gradYear) { return 1; } else { return 0; } }); this.clickGrad = 1; } else { this.students.sort(function (name1, name2) { if (name1.gradYear > name2.gradYear) { return -1; } else if (name1.gradYear < name2.gradYear) { return 1; } else { return 0; } }); this.clickGrad = 0; } }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
MethodDeclaration
sortName() { if (this.clickName == 0) { this.students.sort(function (name1, name2) { if (name1.name < name2.name) { return -1; } else if (name1.name > name2.name) { return 1; } else { return 0; } }); this.clickName = 1; } else { this.students.sort(function (name1, name2) { if (name1.name > name2.name) { return -1; } else if (name1.name < name2.name) { return 1; } else { return 0; } }); this.clickName = 0; } }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
MethodDeclaration
sortDegree() { if (this.clickDegree == 0) { this.students.sort(function (name1, name2) { if (name1.degree < name2.degree) { return -1; } else if (name1.degree > name2.degree) { return 1; } else { return 0; } }); this.clickDegree = 1; } else { this.students.sort(function (name1, name2) { if (name1.degree > name2.degree) { return -1; } else if (name1.degree < name2.degree) { return 1; } else { return 0; } }); this.clickDegree = 0; } }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
MethodDeclaration
inputSkillCheck(e, skill) { if (e.target.checked) { this.checkedSkill++; this.skillsChecked[this.skillsChecked.length] = skill; if (skill != "") { this.skillService.getFkbySkill(skill).subscribe( data => { for (let i = 0; i < data.length; i++) { this.skillFk.push(data[i]); } this.checkSkillDupes(this.checkedSkill); }, error => console.log(error) ) } } else { this.checkedSkill--; for (let i = 0; i < this.skillsChecked.length; i++) { if (this.skillsChecked[i] == skill) { this.skillsChecked.splice(i, 1); } } for (let i = 0; i < this.skillFk.length; i++) { if (this.skillFk[i].skill.toLowerCase() == skill.toLowerCase()) { this.skillFk.splice(i, 1); i--; } } this.checkSkillDupes(this.checkedSkill); } }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
MethodDeclaration
checkSkillDupes(checked) { this.nieuwelijstSkillsFk = []; if (checked > 1) { let number = 0; for (let i = 0; i < this.skillFk.length; i++) { let random = this.skillFk[i]; for (let j = 0; j < this.skillFk.length; j++) { if (this.skillFk[j].student_fk == random.student_fk) { number++; } if (number == checked) { if (this.nieuwelijstSkillsFk.length == 0) { this.nieuwelijstSkillsFk.push(random); } for (let k = 0; j < this.nieuwelijstSkillsFk.length; k++) { if (this.nieuwelijstSkillsFk[k] == random.student_fk) { break; } else { this.nieuwelijstSkillsFk.push(random); } } } if (j == (this.skillFk.length - 1)) { number = 0; } } } } else { this.nieuwelijstSkillsFk = this.skillFk; } }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
MethodDeclaration
inputProfskillCheck(e, skill) { if (e.target.checked) { this.checkedProf++; this.profSkillsChecked[this.profSkillsChecked.length] = skill; if (skill != "") { this.professionalService.getFkbySkill(skill).subscribe( data => { for (let i = 0; i < data.length; i++) { this.profskillFk.push(data[i]); } this.checkProfDupes(this.checkedProf); }, error => console.log(error) ) } } else { this.checkedProf--; for (let i = 0; i < this.profSkillsChecked.length; i++) { if (this.profSkillsChecked[i] == skill) { this.profSkillsChecked.splice(i, 1); } } for (let i = 0; i < this.profskillFk.length; i++) { if (this.profskillFk[i].skill.toLowerCase() == skill.toLowerCase()) { this.profskillFk.splice(i, 1); i--; } } this.checkProfDupes(this.checkedProf); } }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
MethodDeclaration
checkProfDupes(checked) { this.nieuwelijstProfskillsFk = []; if (checked > 1) { let number = 0; for (let i = 0; i < this.profskillFk.length; i++) { let random = this.profskillFk[i]; for (let j = 0; j < this.profskillFk.length; j++) { if (this.profskillFk[j].student_fk == random.student_fk) { number++; } if (number == checked) { if (this.nieuwelijstProfskillsFk.length == 0) { this.nieuwelijstProfskillsFk.push(random); } for (let k = 0; j < this.nieuwelijstProfskillsFk.length; k++) { if (this.nieuwelijstProfskillsFk[k] == random.student_fk) { break; } else { this.nieuwelijstProfskillsFk.push(random); } } } if (j == (this.profskillFk.length - 1)) { number = 0; } } } } else { this.nieuwelijstProfskillsFk = this.profskillFk; } }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
MethodDeclaration
inputLangugageCheck(e, type) { if (e.target.checked) { this.checkedLang++; this.languageChecked[this.languageChecked.length] = type; if (type != "") { this.languageService.getFkbyLang(type).subscribe( data => { for (let i = 0; i < data.length; i++) { this.languageFk.push(data[i]); } this.checkLangDupes(this.checkedLang); }, error => console.log(error) ) } } else { this.checkedLang--; for (let i = 0; i < this.languageChecked.length; i++) { if (this.languageChecked[i] == type) { this.languageChecked.splice(i, 1); } } for (let i = 0; i < this.languageFk.length; i++) { if (this.languageFk[i].type.toLowerCase() == type.toLowerCase()) { this.languageFk.splice(i, 1); i--; } } this.checkLangDupes(this.checkedLang); } }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
MethodDeclaration
checkLangDupes(checked) { this.nieuwelijstLangFk = []; if (checked > 1) { let number = 0; for (let i = 0; i < this.languageFk.length; i++) { let random = this.languageFk[i]; for (let j = 0; j < this.languageFk.length; j++) { if (this.languageFk[j].student_fk == random.student_fk) { number++; } if (number == checked) { if (this.nieuwelijstLangFk.length == 0) { this.nieuwelijstLangFk.push(random); } for (let k = 0; j < this.nieuwelijstLangFk.length; k++) { if (this.nieuwelijstLangFk[k] == random.student_fk) { break; } else { this.nieuwelijstLangFk.push(random); } } } if (j == (this.languageFk.length - 1)) { number = 0; } } } } else { this.nieuwelijstLangFk = this.languageFk; } }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
MethodDeclaration
//This method gives all the students back with the checked conditions. advancedSearch() { //ADVANCED SEARCH if (this.nieuwelijstLangFk.length > 0 && this.nieuwelijstSkillsFk.length == 0 && this.nieuwelijstProfskillsFk.length == 0) { this.students = []; for (let i = 0; i < this.nieuwelijstLangFk.length; i++) { this.studentService.getStudentByIdMysql(this.nieuwelijstLangFk[i].student_fk).subscribe( data => { this.students[i] = data[0] }, error => console.log(error) ) } } else if (this.nieuwelijstSkillsFk.length > 0 && this.nieuwelijstLangFk.length == 0 && this.nieuwelijstProfskillsFk.length == 0) { this.students = []; for (let i = 0; i < this.nieuwelijstSkillsFk.length; i++) { this.studentService.getStudentByIdMysql(this.nieuwelijstSkillsFk[i].student_fk).subscribe( data => { this.students[i] = data[0] }, error => console.log(error) ) } } else if (this.nieuwelijstProfskillsFk.length > 0 && this.nieuwelijstLangFk.length == 0 && this.nieuwelijstSkillsFk.length == 0) { this.students = []; for (let i = 0; i < this.nieuwelijstProfskillsFk.length; i++) { this.studentService.getStudentByIdMysql(this.nieuwelijstProfskillsFk[i].student_fk).subscribe( data => { this.students[i] = data[0] }, error => console.log(error) ) } } else if (this.nieuwelijstSkillsFk.length > 0 && this.nieuwelijstLangFk.length > 0 && this.nieuwelijstProfskillsFk.length == 0) { this.students = []; let k = 0; for (let i = 0; i < this.nieuwelijstSkillsFk.length; i++) { let double = this.nieuwelijstSkillsFk[i].student_fk; for (let j = 0; j < this.nieuwelijstLangFk.length; j++) { if (double == this.nieuwelijstLangFk[j].student_fk) { this.studentService.getStudentByIdMysql(double).subscribe( data => { this.students[k] = data[0], console.log(data), k++ }, error => console.log(error) ) } } } } else if (this.nieuwelijstSkillsFk.length > 0 && this.nieuwelijstLangFk.length == 0 && this.nieuwelijstProfskillsFk.length > 0) { this.students = []; let k = 0; for (let i = 0; i < this.nieuwelijstSkillsFk.length; i++) { let double = this.nieuwelijstSkillsFk[i].student_fk; for (let j = 0; j < this.nieuwelijstProfskillsFk.length; j++) { if (double == this.nieuwelijstProfskillsFk[j].student_fk) { this.studentService.getStudentByIdMysql(double).subscribe( data => { this.students[k] = data[0], console.log(data), k++ }, error => console.log(error) ) } } } } else if (this.nieuwelijstSkillsFk.length == 0 && this.nieuwelijstLangFk.length > 0 && this.nieuwelijstProfskillsFk.length > 0) { this.students = []; let k = 0; for (let i = 0; i < this.nieuwelijstLangFk.length; i++) { let double = this.nieuwelijstLangFk[i].student_fk; for (let j = 0; j < this.nieuwelijstProfskillsFk.length; j++) { if (double == this.nieuwelijstProfskillsFk[j].student_fk) { this.studentService.getStudentByIdMysql(double).subscribe( data => { this.students[k] = data[0], console.log(data), k++ }, error => console.log(error) ) } } } } else if (this.nieuwelijstSkillsFk.length > 0 && this.nieuwelijstLangFk.length > 0 && this.nieuwelijstProfskillsFk.length > 0) { this.students = []; let k = 0; for (let i = 0; i < this.nieuwelijstLangFk.length; i++) { let double = this.nieuwelijstLangFk[i].student_fk; for (let j = 0; j < this.nieuwelijstProfskillsFk.length; j++) { if (double == this.nieuwelijstProfskillsFk[j].student_fk) { for (let m = 0; m < this.nieuwelijstSkillsFk.length; m++) { if (double == this.nieuwelijstSkillsFk[m].student_fk) { this.studentService.getStudentByIdMysql(double).subscribe( data => { this.students[k] = data[0], console.log(data), k++ }, error => console.log(error) ) } } } } } } else { alert("no students found") } }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
MethodDeclaration
clear() { window.location.reload(); }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
MethodDeclaration
//Download the cv in searchBox downloadCv(student) { if (student.cvChecked == true) { this.cvsService.getCvsByFk(student.id).subscribe( data => { this.download(data[0].id) }, error => console.log(error) ) window.open(`/api/download/25`); } else { alert("This students hasn't yet uploaded a CV.") } }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
MethodDeclaration
download(id) { this.refresh.next() if (id) { // window.open(`/api/download/${id}`); } }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
MethodDeclaration
deleteStudent(student) { this.userService.deleteWholeUser(student).subscribe( data => { const pos = this.students.map(elem => elem.id).indexOf(student.id); this.students.splice(pos, 1); this.toast.setMessage('item deleted successfully.', 'success'); }, error => console.error ); }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
MethodDeclaration
innerjoin() { for (let id of this.ids) { this.http.get(`/api/innerjoin/${id.id}`).subscribe( data => { this.studentjes += data, console.log(data) }, error => { console.log("gelukt") } ) } }
louisdb94/IndustriaApp
client/app/student/student-list/student-list.component.ts
TypeScript
ClassDeclaration
class IndexPage extends React.Component { render() { return ( <MainLayout title="Evgeny Mironenko | Software Engineer" description="Personal website by Evgeny Mironenko Senior Software Engineer. Java, Kotlin, Spring, React, TypeScript. Currently based in Tallinn, Estonia." keywords="Evgeny, Mironenko, Evgeny Mironenko, Software Engineer, Software Developer, Java, Kotlin, Typescript, React" isRoot={true}> <div className="d-flex flex-column main-layout"> <Navbar/> <div className="container-fluid container"> <main> <section className="mb-3"> <div> <h1><Typist messages={["Evgeny Mironenko"]}/></h1> <p className="lead">Software Engineer & Proud Geek</p> <p>Currently based in Tallinn, Estonia</p> </div> </section> <ContactData contacts={contacts} email="[email protected]"/> <div className="separator my-5"/> <h2>Tech I like to work with</h2> <Badges skills={skills}/> </main> </div> </div> </MainLayout> ); } }
miron4dev/miron4dev.com
src/pages/index.tsx
TypeScript
MethodDeclaration
render() { return ( <MainLayout title="Evgeny Mironenko | Software Engineer" description="Personal website by Evgeny Mironenko Senior Software Engineer. Java, Kotlin, Spring, React, TypeScript. Currently based in Tallinn, Estonia." keywords="Evgeny, Mironenko, Evgeny Mironenko, Software Engineer, Software Developer, Java, Kotlin, Typescript, React" isRoot={true}> <div className="d-flex flex-column main-layout"> <Navbar/> <div className="container-fluid container"> <main> <section className="mb-3"> <div> <h1><Typist messages={["Evgeny Mironenko"]}/></h1> <p className="lead">Software Engineer & Proud Geek</p> <p>Currently based in Tallinn, Estonia</p> </div> </section> <ContactData contacts={contacts} email="[email protected]"/> <div className="separator my-5"/> <h2>Tech I like to work with</h2> <Badges skills={skills}/> </main> </div> </div> </MainLayout> ); }
miron4dev/miron4dev.com
src/pages/index.tsx
TypeScript
FunctionDeclaration
/** Removes definitions with empty def and combine glosses with same lang. */ export function cleanDefinitions(defs: Definition[]): Definition[] { const nonempty = defs.filter((d) => d.text.length); const langs = [...new Set(nonempty.map((d) => d.language))]; return langs.map((language) => newDefinition( nonempty .filter((d) => d.language === language) .map((d) => d.text) .join(sep), language ) ); }
jmgrady/TheCombine
src/types/wordUtilities.ts
TypeScript
FunctionDeclaration
/** Removes glosses with empty def and combine glosses with same lang. */ export function cleanGlosses(glosses: Gloss[]): Gloss[] { const nonempty = glosses.filter((g) => g.def.length); const langs = [...new Set(nonempty.map((g) => g.language))]; return langs.map((language) => newGloss( nonempty .filter((g) => g.language === language) .map((g) => g.def) .join(sep), language ) ); }
jmgrady/TheCombine
src/types/wordUtilities.ts
TypeScript
FunctionDeclaration
/** * For sorting flags alphabetically by their text, * where a flag with .active=false is alphabetically last. */ export function compareFlags(a: Flag, b: Flag): number { return a.active && b.active ? a.text.localeCompare(b.text) : a.active ? -1 : b.active ? 1 : 0; }
jmgrady/TheCombine
src/types/wordUtilities.ts
TypeScript
FunctionDeclaration
/** * Returns the text of the first gloss of a sense. * In the case that the array of glosses is empty, returns an empty string. */ export function firstGlossText(sense: Sense): string { return sense.glosses[0]?.def ?? ""; }
jmgrady/TheCombine
src/types/wordUtilities.ts
TypeScript
FunctionDeclaration
/** * Given a word-array, return a string-array with any language code found in * a definition or gloss of any sense. */ export function getAnalysisLangsFromWords(words: Word[]): string[] { return reduceMultiType<Word, string[]>(words, [], wordReducer); }
jmgrady/TheCombine
src/types/wordUtilities.ts
TypeScript
FunctionDeclaration
function reduceMultiType<A, B>( toReduce: A[], initial: B, reducer: (accumulator: B, currentItem: A) => B ): B { let accumulated = initial; toReduce.forEach((item) => (accumulated = reducer(accumulated, item))); return accumulated; }
jmgrady/TheCombine
src/types/wordUtilities.ts
TypeScript
FunctionDeclaration
function wordReducer(accumulator: string[], word: Word): string[] { const newLangs = word.senses .flatMap((s) => [...s.definitions, ...s.glosses]) .map((dg) => dg.language); return [...new Set([...accumulator, ...newLangs])]; }
jmgrady/TheCombine
src/types/wordUtilities.ts
TypeScript
ArrowFunction
(d) => d.text.length
jmgrady/TheCombine
src/types/wordUtilities.ts
TypeScript
ArrowFunction
(d) => d.language
jmgrady/TheCombine
src/types/wordUtilities.ts
TypeScript
ArrowFunction
(language) => newDefinition( nonempty .filter((d) => d.language === language) .map((d) => d.text) .join(sep), language )
jmgrady/TheCombine
src/types/wordUtilities.ts
TypeScript
ArrowFunction
(d) => d.language === language
jmgrady/TheCombine
src/types/wordUtilities.ts
TypeScript
ArrowFunction
(d) => d.text
jmgrady/TheCombine
src/types/wordUtilities.ts
TypeScript
ArrowFunction
(g) => g.def.length
jmgrady/TheCombine
src/types/wordUtilities.ts
TypeScript
ArrowFunction
(g) => g.language
jmgrady/TheCombine
src/types/wordUtilities.ts
TypeScript
ArrowFunction
(language) => newGloss( nonempty .filter((g) => g.language === language) .map((g) => g.def) .join(sep), language )
jmgrady/TheCombine
src/types/wordUtilities.ts
TypeScript
ArrowFunction
(g) => g.language === language
jmgrady/TheCombine
src/types/wordUtilities.ts
TypeScript
ArrowFunction
(g) => g.def
jmgrady/TheCombine
src/types/wordUtilities.ts
TypeScript
ArrowFunction
(item) => (accumulated = reducer(accumulated, item))
jmgrady/TheCombine
src/types/wordUtilities.ts
TypeScript
ArrowFunction
(s) => [...s.definitions, ...s.glosses]
jmgrady/TheCombine
src/types/wordUtilities.ts
TypeScript
ArrowFunction
(dg) => dg.language
jmgrady/TheCombine
src/types/wordUtilities.ts
TypeScript
ClassDeclaration
export class Event extends Deletable { public getType(): number; public getValue<T>(key: number): T; public getComponent(): APL.Component; public resolve(); public resolveWithArg(arg: number); public resolveWithRect(x: number, y: number, width: number, height: number): void; public addTerminateCallback(callback: () => void); public isPending(): boolean; public isTerminated(): boolean; public isResolved(): boolean; }
alexa/apl-client-library
apl-client-js/@types/apl-html/lib/dts/Event.d.ts
TypeScript
MethodDeclaration
public getType(): number;
alexa/apl-client-library
apl-client-js/@types/apl-html/lib/dts/Event.d.ts
TypeScript
MethodDeclaration
public getValue<T>(key: number): T;
alexa/apl-client-library
apl-client-js/@types/apl-html/lib/dts/Event.d.ts
TypeScript
MethodDeclaration
public getComponent(): APL.Component;
alexa/apl-client-library
apl-client-js/@types/apl-html/lib/dts/Event.d.ts
TypeScript
MethodDeclaration
public resolve();
alexa/apl-client-library
apl-client-js/@types/apl-html/lib/dts/Event.d.ts
TypeScript
MethodDeclaration
public resolveWithArg(arg: number);
alexa/apl-client-library
apl-client-js/@types/apl-html/lib/dts/Event.d.ts
TypeScript
MethodDeclaration
public resolveWithRect(x: number, y: number, width: number, height: number): void;
alexa/apl-client-library
apl-client-js/@types/apl-html/lib/dts/Event.d.ts
TypeScript
MethodDeclaration
public addTerminateCallback(callback: () => void);
alexa/apl-client-library
apl-client-js/@types/apl-html/lib/dts/Event.d.ts
TypeScript
MethodDeclaration
public isPending(): boolean;
alexa/apl-client-library
apl-client-js/@types/apl-html/lib/dts/Event.d.ts
TypeScript
MethodDeclaration
public isTerminated(): boolean;
alexa/apl-client-library
apl-client-js/@types/apl-html/lib/dts/Event.d.ts
TypeScript
MethodDeclaration
public isResolved(): boolean;
alexa/apl-client-library
apl-client-js/@types/apl-html/lib/dts/Event.d.ts
TypeScript
ClassDeclaration
export default class GuildService { async getGuildById(id: string): Promise<ServerModel> { return await Server.findOne({ id }, {}, { upsert: true }) as ServerModel; } async findByGuildIdAndUpdate(id: string, details: UpdateQuery<ServerModel>) { return await Server.findOneAndUpdate({ id }, details, { new: true }); } }
c43721/payload-neo
src/api/services/GuildService.ts
TypeScript
MethodDeclaration
async getGuildById(id: string): Promise<ServerModel> { return await Server.findOne({ id }, {}, { upsert: true }) as ServerModel; }
c43721/payload-neo
src/api/services/GuildService.ts
TypeScript
MethodDeclaration
async findByGuildIdAndUpdate(id: string, details: UpdateQuery<ServerModel>) { return await Server.findOneAndUpdate({ id }, details, { new: true }); }
c43721/payload-neo
src/api/services/GuildService.ts
TypeScript
ArrowFunction
(err, ast) => { if (err) { this.error = err; this.correct.emit(false); } else { this.error = ''; this.correct.emit(true); } this.saveChanges(); }
call-me-adas/adam-cms
src/app/shared/components/editor/editor.component.ts
TypeScript
ClassDeclaration
@Component({ selector: 'app-editor', templateUrl: './editor.component.html', styleUrls: ['./editor.component.scss'], encapsulation: ViewEncapsulation.None }) export class EditorComponent implements OnInit { @ViewChild('textAreaElement') textAreaElement: ElementRef; htmlFormat = ''; error = ''; showEditor = true; @Input() content: string; @Output() correct = new EventEmitter(); @Output() editor = new EventEmitter(); lastState; nextState; ngOnInit(): void { this.htmlFormat = this.content; this.lastState = this.content; this.nextState = this.content; } insertElement(el, classes) { this.lastState = this.htmlFormat; const a = this.htmlFormat; const b = '<' + el + ' class=' + classes.join(',') + '>'; const b2 = '</' + el + '>'; const posStart = this.textAreaElement.nativeElement.selectionStart; const posEnd = this.textAreaElement.nativeElement.selectionEnd; if (posStart === posEnd) { this.htmlFormat = [a.slice(0, posStart), b, b2, a.slice(posStart)].join(''); } else { this.htmlFormat = [a.slice(0, posStart), b, a.slice(posStart, posEnd), b2, a.slice(posEnd)].join(''); } this.nextState = this.htmlFormat; this.saveChanges(); } insertImage(classes) { const src = prompt('Give src'); const a = this.htmlFormat; const posStart = this.textAreaElement.nativeElement.selectionStart; this.htmlFormat = [a.slice(0, posStart), '\n<img class=' + classes.join(',') + ' src=\'', src, '\' />' , a.slice(posStart)].join(''); this.saveChanges(); } insertLink(classes) { const src = prompt('Give src'); const a = this.htmlFormat; const posStart = this.textAreaElement.nativeElement.selectionStart; this.htmlFormat = [a.slice(0, posStart), '\n<a target="_blank" class=' + classes.join(',') + ' href=\'', src, '\'>' + 'Link</a>' , a.slice(posStart)].join(''); this.saveChanges(); } insertVideo(classes) { const src = prompt('Give src'); const a = this.htmlFormat; const posStart = this.textAreaElement.nativeElement.selectionStart; this.htmlFormat = [a.slice(0, posStart), '\n<div class=' + classes.join(',') + '>', '<iframe width="560" height="349" src="http://www.youtube.com/embed/' + this.youtube_parser(src) + '?rel=0&hd=1" ' + 'frameborder="0" allowfullscreen></iframe>', '</div>', a.slice(posStart)].join(''); this.saveChanges(); } insertList(el, classes) { const a = this.htmlFormat; const posStart = this.textAreaElement.nativeElement.selectionStart; this.htmlFormat = [a.slice(0, posStart), '\n<' + el + ' class=' + classes.join(',') + '>\n', '<li>Item 1</li>' , '\n</' + el + '>', a.slice(posStart)].join(''); this.saveChanges(); } insertColumns(count, classes) { const a = this.htmlFormat; const posStart = this.textAreaElement.nativeElement.selectionStart; this.htmlFormat = [a.slice(0, posStart), '\n<div class=' + classes.join(',') + '>\n', '<div class="column"></div>\n'.repeat(count) , '</div>', a.slice(posStart)].join(''); this.saveChanges(); } undo() { this.nextState = this.htmlFormat; this.htmlFormat = this.lastState; this.saveChanges(); } redo() { this.lastState = this.htmlFormat; this.htmlFormat = this.nextState; this.saveChanges(); } typeTextarea(event) { HtmlValidator(this.htmlFormat, (err, ast) => { if (err) { this.error = err; this.correct.emit(false); } else { this.error = ''; this.correct.emit(true); } this.saveChanges(); }); } saveChanges() { this.editor.emit(this.htmlFormat); } youtube_parser(url) { const regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/; const match = url.match(regExp); return (match && match[7].length === 11) ? match[7] : false; } }
call-me-adas/adam-cms
src/app/shared/components/editor/editor.component.ts
TypeScript
MethodDeclaration
ngOnInit(): void { this.htmlFormat = this.content; this.lastState = this.content; this.nextState = this.content; }
call-me-adas/adam-cms
src/app/shared/components/editor/editor.component.ts
TypeScript
MethodDeclaration
insertElement(el, classes) { this.lastState = this.htmlFormat; const a = this.htmlFormat; const b = '<' + el + ' class=' + classes.join(',') + '>'; const b2 = '</' + el + '>'; const posStart = this.textAreaElement.nativeElement.selectionStart; const posEnd = this.textAreaElement.nativeElement.selectionEnd; if (posStart === posEnd) { this.htmlFormat = [a.slice(0, posStart), b, b2, a.slice(posStart)].join(''); } else { this.htmlFormat = [a.slice(0, posStart), b, a.slice(posStart, posEnd), b2, a.slice(posEnd)].join(''); } this.nextState = this.htmlFormat; this.saveChanges(); }
call-me-adas/adam-cms
src/app/shared/components/editor/editor.component.ts
TypeScript
MethodDeclaration
insertImage(classes) { const src = prompt('Give src'); const a = this.htmlFormat; const posStart = this.textAreaElement.nativeElement.selectionStart; this.htmlFormat = [a.slice(0, posStart), '\n<img class=' + classes.join(',') + ' src=\'', src, '\' />' , a.slice(posStart)].join(''); this.saveChanges(); }
call-me-adas/adam-cms
src/app/shared/components/editor/editor.component.ts
TypeScript
MethodDeclaration
insertLink(classes) { const src = prompt('Give src'); const a = this.htmlFormat; const posStart = this.textAreaElement.nativeElement.selectionStart; this.htmlFormat = [a.slice(0, posStart), '\n<a target="_blank" class=' + classes.join(',') + ' href=\'', src, '\'>' + 'Link</a>' , a.slice(posStart)].join(''); this.saveChanges(); }
call-me-adas/adam-cms
src/app/shared/components/editor/editor.component.ts
TypeScript
MethodDeclaration
insertVideo(classes) { const src = prompt('Give src'); const a = this.htmlFormat; const posStart = this.textAreaElement.nativeElement.selectionStart; this.htmlFormat = [a.slice(0, posStart), '\n<div class=' + classes.join(',') + '>', '<iframe width="560" height="349" src="http://www.youtube.com/embed/' + this.youtube_parser(src) + '?rel=0&hd=1" ' + 'frameborder="0" allowfullscreen></iframe>', '</div>', a.slice(posStart)].join(''); this.saveChanges(); }
call-me-adas/adam-cms
src/app/shared/components/editor/editor.component.ts
TypeScript
MethodDeclaration
insertList(el, classes) { const a = this.htmlFormat; const posStart = this.textAreaElement.nativeElement.selectionStart; this.htmlFormat = [a.slice(0, posStart), '\n<' + el + ' class=' + classes.join(',') + '>\n', '<li>Item 1</li>' , '\n</' + el + '>', a.slice(posStart)].join(''); this.saveChanges(); }
call-me-adas/adam-cms
src/app/shared/components/editor/editor.component.ts
TypeScript
MethodDeclaration
insertColumns(count, classes) { const a = this.htmlFormat; const posStart = this.textAreaElement.nativeElement.selectionStart; this.htmlFormat = [a.slice(0, posStart), '\n<div class=' + classes.join(',') + '>\n', '<div class="column"></div>\n'.repeat(count) , '</div>', a.slice(posStart)].join(''); this.saveChanges(); }
call-me-adas/adam-cms
src/app/shared/components/editor/editor.component.ts
TypeScript
MethodDeclaration
undo() { this.nextState = this.htmlFormat; this.htmlFormat = this.lastState; this.saveChanges(); }
call-me-adas/adam-cms
src/app/shared/components/editor/editor.component.ts
TypeScript
MethodDeclaration
redo() { this.lastState = this.htmlFormat; this.htmlFormat = this.nextState; this.saveChanges(); }
call-me-adas/adam-cms
src/app/shared/components/editor/editor.component.ts
TypeScript
MethodDeclaration
typeTextarea(event) { HtmlValidator(this.htmlFormat, (err, ast) => { if (err) { this.error = err; this.correct.emit(false); } else { this.error = ''; this.correct.emit(true); } this.saveChanges(); }); }
call-me-adas/adam-cms
src/app/shared/components/editor/editor.component.ts
TypeScript
MethodDeclaration
saveChanges() { this.editor.emit(this.htmlFormat); }
call-me-adas/adam-cms
src/app/shared/components/editor/editor.component.ts
TypeScript
MethodDeclaration
youtube_parser(url) { const regExp = /^.*((youtu.be\/)|(v\/)|(\/u\/\w\/)|(embed\/)|(watch\?))\??v?=?([^#\&\?]*).*/; const match = url.match(regExp); return (match && match[7].length === 11) ? match[7] : false; }
call-me-adas/adam-cms
src/app/shared/components/editor/editor.component.ts
TypeScript
ClassDeclaration
@Injectable({ providedIn: 'root' }) export class TimerService { private time: string; constructor() { } setTime(startDate: number) { const result = Date.now() - startDate; const hours = Math.floor((result % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); const minutes = Math.floor((result % (1000 * 60 * 60)) / (1000 * 60)); const seconds = Math.floor((result % (1000 * 60)) / 1000); this.time = `${hours}:${minutes}:${seconds}`; } getTime(): string { localStorage.setItem('time', this.time.toString()); return this.time; } }
Jonedi/QUIZ-APP
src/app/services/timer.service.ts
TypeScript
MethodDeclaration
setTime(startDate: number) { const result = Date.now() - startDate; const hours = Math.floor((result % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); const minutes = Math.floor((result % (1000 * 60 * 60)) / (1000 * 60)); const seconds = Math.floor((result % (1000 * 60)) / 1000); this.time = `${hours}:${minutes}:${seconds}`; }
Jonedi/QUIZ-APP
src/app/services/timer.service.ts
TypeScript
MethodDeclaration
getTime(): string { localStorage.setItem('time', this.time.toString()); return this.time; }
Jonedi/QUIZ-APP
src/app/services/timer.service.ts
TypeScript
ArrowFunction
() => { let component: ArticlesViewComponent; let fixture: ComponentFixture<ArticlesViewComponent>; beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ArticlesViewComponent] }).compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent(ArticlesViewComponent); component = fixture.componentInstance; fixture.detectChanges(); }); it('should create', () => { expect(component).toBeTruthy(); }); }
Mikearaya/safeway_hybrid_app
myworkspace/apps/ilo-admin/src/app/features/articles/articles-view/articles-view.component.spec.ts
TypeScript
ArrowFunction
() => { TestBed.configureTestingModule({ declarations: [ArticlesViewComponent] }).compileComponents(); }
Mikearaya/safeway_hybrid_app
myworkspace/apps/ilo-admin/src/app/features/articles/articles-view/articles-view.component.spec.ts
TypeScript
ArrowFunction
() => { fixture = TestBed.createComponent(ArticlesViewComponent); component = fixture.componentInstance; fixture.detectChanges(); }
Mikearaya/safeway_hybrid_app
myworkspace/apps/ilo-admin/src/app/features/articles/articles-view/articles-view.component.spec.ts
TypeScript