Skip to content

Instantly share code, notes, and snippets.

View hellotunmbi's full-sized avatar

Olutunmbi Banto hellotunmbi

View GitHub Profile
@ohansemmanuel
ohansemmanuel / static-data.js
Created May 18, 2018 14:00
Static data generation for Skypey.
const shortid = require("shortid"); // shortid.generate() returns a unique "short" id
const txtgen = require("txtgen"); // txtgen.sentence() returns random "readable" sentences
const faker = require("faker"); // faker is used for generating random fake data.
const _ = require("lodash"); // lodash is a utility lib for Javascript
const users = generateUsers(10);
export const contacts = _.mapKeys(users, "user_id");
export const getMessages = messagesPerUser => {
let messages = {};
_.forEach(users, user => {
#!/bin/bash
hostname=$(hostname -s)
cd ~/Library/Application\ Support/com.bohemiancoding.sketch3/
rm .license && touch .license && echo '{"meta":{"generated_at":"'$(date)'","sign":"==","device_name":"'$hostname "("$(id -un)')"},"payload":{"status":"ok","application":"sketch3","type":"license","udid":"c2d8c1dd037f919d57124de1037eeb22efad6bd1","expiration":"9999999999"}}' >> .license
echo '127.0.0.1 backend.bohemiancoding.com' | sudo tee -a /etc/hosts
@hellotunmbi
hellotunmbi / mongo_on_mac_yosemite_10.10.4.md
Created November 3, 2017 10:25 — forked from isramv/mongo_on_mac_yosemite_10.10.4.md
How to install mongodb on Mac Yosemite 10.10.4

how to install Mongo db on Mac Yosemite 10.10.4

I will be following the official documentation here but they take some things for granted, many users could get frustrated and confused that's why I created this gist.

I have downloaded the mongo files in my root user directory for example: /Users/israel/mongodb therefore if you want to do the same first enter cd in your terminal.

then enter pwd command in your terminal and you should be able to se something similar to /Users/<yourmacuser>

If the previous is correct you may want to proceed and open the terminal then download the tar:

@hellotunmbi
hellotunmbi / learning_resources.md
Last active May 31, 2017 13:28 — forked from nathansmith/web-design-development-learning-resources.md
Resources for learning web design & front-end development
@up1
up1 / async.js
Last active May 1, 2024 12:52
NodeJS with Async/Await
var fetch = require('node-fetch')
async function getDataFromAPI() {
let response = await fetch("https://api.github.com/users/up1")
let data = await response.json()
console.log(JSON.stringify(data, null, "\t"))
}
getDataFromAPI()
@magician11
magician11 / write-to-firebase.js
Last active June 28, 2022 10:24
Writing data to Firebase from Node.js
const admin = require('firebase-admin');
admin.initializeApp({
credential: admin.credential.cert('./movies-387bf-firebase-adminsdk-4hoi8-c52699119b.json'),
databaseURL: 'https://movies-387bf.firebaseio.com',
});
// Get a database reference to our blog
const db = admin.database();
@joepie91
joepie91 / express-server-side-rendering.md
Last active July 3, 2024 03:16
Rendering pages server-side with Express (and Pug)

Terminology

  • View: Also called a "template", a file that contains markup (like HTML) and optionally additional instructions on how to generate snippets of HTML, such as text interpolation, loops, conditionals, includes, and so on.
  • View engine: Also called a "template library" or "templater", ie. a library that implements view functionality, and potentially also a custom language for specifying it (like Pug does).
  • HTML templater: A template library that's designed specifically for generating HTML. It understands document structure and thus can provide useful advanced tools like mixins, as well as more secure output escaping (since it can determine the right escaping approach from the context in which a value is used), but it also means that the templater is not useful for anything other than HTML.
  • String-based templater: A template library that implements templating logic, but that has no understanding of the content it is generating - it simply concatenates together strings, potenti
#!/bin/bash
hostname=$(hostname -s)
cd ~/Library/Application\ Support/com.bohemiancoding.sketch3/
rm .license && touch .license && echo '{"meta":{"generated_at":"'$(date)'","sign":"==","device_name":"'$hostname "("$(id -un)')"},"payload":{"status":"ok","application":"sketch3","type":"license","udid":"c2d8c1dd037f919d57124de1037eeb22efad6bd1","expiration":"9999999999"}}' >> .license
echo '127.0.0.1 backend.bohemiancoding.com' | sudo tee -a /etc/hosts
@lalkmim
lalkmim / codility_solutions.txt
Last active April 25, 2024 21:47
Codility Solutions in JavaScript
Lesson 1 - Iterations
- BinaryGap - https://codility.com/demo/results/trainingU2FQPQ-7Y4/
Lesson 2 - Arrays
- OddOccurrencesInArray - https://codility.com/demo/results/trainingFN5RVT-XQ4/
- CyclicRotation - https://codility.com/demo/results/trainingSH2W5R-RP5/
Lesson 3 - Time Complexity
- FrogJmp - https://codility.com/demo/results/training6KKWUD-BXJ/
- PermMissingElem - https://codility.com/demo/results/training58W4YJ-VHA/
@segebee
segebee / gist:7dde9de8e70a207e6e19
Created June 22, 2015 17:30
Nigeria States and Local Government Areas JSON - codingsavvy.com
[{"state":{"name":"Abia State","id":1,"locals":[{"name":"Aba South","id":1},{"name":"Arochukwu","id":2},{"name":"Bende","id":3},{"name":"Ikwuano","id":4},{"name":"Isiala Ngwa North","id":5},{"name":"Isiala Ngwa South","id":6},{"name":"Isuikwuato","id":7},{"name":"Obi Ngwa","id":8},{"name":"Ohafia","id":9},{"name":"Osisioma","id":10},{"name":"Ugwunagbo","id":11},{"name":"Ukwa East","id":12},{"name":"Ukwa West","id":13},{"name":"Umuahia North","id":14},{"name":"Umuahia South","id":15},{"name":"Umu Nneochi","id":16}]}},{"state":{"name":"Adamawa State","id":2,"locals":[{"name":"Fufure","id":1},{"name":"Ganye","id":2},{"name":"Gayuk","id":3},{"name":"Gombi","id":4},{"name":"Grie","id":5},{"name":"Hong","id":6},{"name":"Jada","id":7},{"name":"Lamurde","id":8},{"name":"Madagali","id":9},{"name":"Maiha","id":10},{"name":"Mayo Belwa","id":11},{"name":"Michika","id":12},{"name":"Mubi North","id":13},{"name":"Mubi South","id":14},{"name":"Numan","id":15},{"name":"Shelleng","id":16},{"name":"Song","id":17},{"name":"Toung