Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍💻
Focusing

Olúwásetèmi Oluwasetemi

👨‍💻
Focusing
View GitHub Profile
@Oluwasetemi
Oluwasetemi / contentful.js
Created Oct 12, 2020
A list of the REST data source I implemented using Apollo REST Data source
View contentful.js
/* eslint-disable camelcase */
/* eslint-disable class-methods-use-this */
const { RESTDataSource } = require('apollo-datasource-rest');
class ContentfulAPI extends RESTDataSource {
constructor() {
super();
this.baseURL = `https://cdn.contentful.com/spaces/${
process.env.CONTENTFUL_SPACE_ID
}`;
View findaword.js
function processData(input) {
var input = input.split('\n');
var n = parseInt(input[0]);
var sentences = input.slice(1, n + 1);
let t = parseInt(input[n+1]);
var words = input.slice(n+2);
if (words.length === t) {
console.log(processSentences(words, sentences).join('\n'))
};
@Oluwasetemi
Oluwasetemi / hello_world.js
Last active May 30, 2020
Update the Hello World JS
View hello_world.js
// function HelloWorld(name) {
// // const this = {};
// this.name = name;
// // return this
// }
class HelloWorld {
constructor(name) {
this.name = name.toUpperCase();
}
@Oluwasetemi
Oluwasetemi / hello_world.js
Last active May 31, 2020
Hello World Examples updated
View hello_world.js
class HelloWorld {
constructor(name) {
this.name = name.toUpperCase();
}
sayHi() {
console.log(`Hello ${this.name}!`)
};
}
View anotherExample.js
const { GraphQLClient } = require('graphql-request');
const client = new GraphQLClient('https://api.github.com/graphql', {
headers: { Authorization: 'token XXXX' }
});
(async () => {
try {
const query = `
{ viewer { name repositories(isFork: true, first: 10) { edges { node { createdAt name databaseId } cursor } totalCount pageInfo { endCursor startCursor hasNextPage hasPreviousPage } } } }
View App.js
import React, { Suspense, useState } from "react";
import { unstable_createResource as createResource } from "react-cache";
import {
Combobox,
ComboboxInput,
ComboboxList,
ComboboxOption
} from "./Combobox2.js";
function App({ tabIndex, navigate }) {
View html.md

HTML

Table of Content

  1. HTML Introduction
  2. HTML Basics
  3. HTML Attributes
  4. HTML Advanced
  5. HTML Entities
  6. CSS in HTML - Cascading Style Sheets
@Oluwasetemi
Oluwasetemi / pyramid.js
Last active Jul 30, 2018
Pascal triangle
View pyramid.js
const pyramid = n => {
const oddNumberArray = Array.from({ length: n * 2 })
.map((v, i) => i + 1)
.filter(v => {
if (v % 2 !== 0) return v
})
let oddStringArray = numberToString(oddNumberArray)
oddStringArray.map(v => console.log(pad(v, (n * 2) - 1)))
}
View index.js
#!/usr/bin/env node
console.log('hello from npx')
View FizzBuzz.js
function fizzBuzz(amount) {
// let arr = []
// for (let i = 0; i <= amount; i++) {
// arr.push(i)
// }
return Array.from({ length: amount + 1 })
.map((v, i)=> i)
.filter((v => v !== 0))
.map(v => {
if (v % 3 === 0 && v % 5 === 0) {
You can’t perform that action at this time.