Skip to content

Instantly share code, notes, and snippets.

☕️

Brian Hague bhague1281

☕️
Block or report user

Report or block bhague1281

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Gemfile
gem 'bootstrap-sass'
gem 'jekyll-bootstrap-sass'
View concur-style-example.scss
---
# this is front matter here, so Jekyll can parse this file
# appropriately
---
@import "main";
View concur-main-example.scss
@import "colors"
$font-family-base: "Helvetica Neue", "Segoe UI", Arial, sans-serif;
@import "components/navbar";
@import "pages/blog";
@import "bootstrap";
html {
View concur-navbar-example.scss
// bootstrap overrides
$navbar-default-bg: $off-black;
$navbar-height: 70px;
$navbar-border-radius: 0;
$navbar-default-link-color: $white;
$navbar-default-link-hover-color: $concur-blue;
$navbar-default-link-active-color: $navbar-default-link-color;
// eliminate margin between navbar and page content
nav.navbar {
View cachedPokemonCall-3.js
const request = require('request');
const NodeCache = require('node-cache');
const API_ENDPOINT = 'http://pokeapi.co/api/v2/pokemon/';
const cache = new NodeCache();
// accepts an endpoint (string) to query
// accepts a callback function to be called when the query is finished
function callEndpoint(endpoint, callback) {
request(endpoint, (error, response, body) => {
// if unsuccessful, pass the error to the callback function
View cachedPokemonCall-2.js
const request = require('request');
const NodeCache = require('node-cache');
const API_ENDPOINT = 'http://pokeapi.co/api/v2/pokemon/';
const cache = new NodeCache();
// try getting data from the cache first
cache.get(API_ENDPOINT, (err, data) => {
// return early if there's an error or data is available
if (err) return console.log(err);
View cachedPokemonCall.js
const request = require('request');
const NodeCache = require('node-cache');
const API_ENDPOINT = 'http://pokeapi.co/api/v2/pokemon/';
const cache = new NodeCache();
// try getting data from the cache first
cache.get('my-pokemon', (err, data) => {
// return early if there's an error or data is available
if (err) return console.log(err);
View cacheExample.js
const NodeCache = require('node-cache');
const cache = new NodeCache();
let data = { results: [] };
// using the cache module to add an object to the cache
cache.set('my-pokemon', data, (err, success) => {
// success will be true if successful
});
View pokemonCall.js
const request = require('request');
const API_ENDPOINT = 'http://pokeapi.co/api/v2/pokemon/';
request(API_ENDPOINT, (error, response, body) => {
console.log(body);
// {
// "count": 811,
// "previous": null,
// "results": [
// {
You can’t perform that action at this time.