Skip to content

Instantly share code, notes, and snippets.

View lexico4real's full-sized avatar
🎯
Focusing

Oluyinka Abubakar lexico4real

🎯
Focusing
View GitHub Profile
class Vampire {
constructor(name, yearConverted) {
this.name = name;
this.yearConverted = yearConverted;
this.offspring = [];
this.creator = null;
}
/** Simple tree methods **/
@lexico4real
lexico4real / NameGenerator.cs
Created December 16, 2021 15:31 — forked from chgeuer/NameGenerator.cs
Name generator
class Program
{
static void Main(string[] args)
{
var random = new Random();
var firstnames = female;
for (int i = 0; i < 100; i++)
{
if (random.Next()%2 == 0) firstnames = male;
@lexico4real
lexico4real / Binary Search (Array)
Created December 17, 2021 21:32 — forked from MrAwesomeness/Binary Search (Array)
Khan Academy Binary Search Challenge
/* Returns either the index of the location in the array,
or -1 if the array did not contain the targetValue */
var doSearch = function(array, targetValue) {
var min = 0;
var max = array.length - 1;
var guess;
var i = 1;
while (max >= min){
guess = Math.floor((max + min)/2);
let React = require('react');
const App = props => <div id="app"><Notification {...props.notification}/></div>
let map = { success: 'success', message: 'info', caution: 'warning', error: 'danger' }
class Notification extends React.Component {
render() {
let props = this.props;
let type = map[props.type] || 'info';
@lexico4real
lexico4real / highlighter.css
Created January 7, 2022 10:09 — forked from mrrena/highlighter.css
Javascript Syntax Highlighter
/* mrrena theme <mrrena.blogspot.com> */
pre.code {
background-color: #1e2029;
padding: 4px;
color: #fff;
font-family: monospace, consolas, "courier new";
color: #fff;
font-size: 12px;
margin: 1.0em 40px;
overflow-x: auto;
@lexico4real
lexico4real / refactorLibrary.js
Created January 15, 2022 00:53 — forked from lynchseb/refactorLibrary.js
Refactored Music Library
const library = {
tracks: {
t01: {
id: "t01",
name: "Code Monkey",
artist: "Jonathan Coulton",
album: "Thing a Week Three"
},
t02: {
id: "t02",
@lexico4real
lexico4real / library.js
Created January 15, 2022 00:54 — forked from lynchseb/library.js
Music Library
const library = {
tracks: {
t01: {
id: "t01",
name: "Code Monkey",
artist: "Jonathan Coulton",
album: "Thing a Week Three"
},
t02: {
id: "t02",
@lexico4real
lexico4real / live-search.js
Created January 26, 2022 07:25 — forked from jorgepedret/live-search.js
live search
bind_searchbar: function() {
var cooq = this,
input = $("#search"),
results = [],
results_element = '.live-search-results',
current_element = null,
show_search_help = null,
hide_search_help = null;
@lexico4real
lexico4real / nameInverter.js
Created February 9, 2022 18:33 — forked from timbolaj/nameInverter.js
Inverts name
//helper function, checks if parameter only contains honorifics
const checkIfOnlyHonorific = function(name, honorific) {
return honorific.includes(name);
};
//helper function, checks if parameter is empty
const isEmpty = function(name) {
return name === '';
};
//helper function, gives name in lastName, FirstName
@lexico4real
lexico4real / findWaldo - Ex1
Created March 10, 2022 19:18 — forked from yuzhakova/findWaldo - Ex1
findWaldo - Functions As Objects
// pass results via callback functions
// callback function, argument index
// The second argument/parameter is expected to be a (callback) function
// expected output "Found Waldo at index 2!"
const findWaldo = function(names, found) {
for (let i = 0; i < names.length; i++) {
// let name = names[i];
if (names[i] === "Waldo") {
found(i); // execute callback