Skip to content

Instantly share code, notes, and snippets.

View rotimi-best's full-sized avatar
👨‍💻
Inventing the future

Rotimi Best rotimi-best

👨‍💻
Inventing the future
View GitHub Profile
@rotimi-best
rotimi-best / default-value-argument-as-function.js
Last active November 15, 2019 15:06
Basic simple to understand how to pass a default value for a required functional argument
const { log } = console;
const run = (a) => `${a} - Run`
const dance = b => `${b} - Dance`
const defaultAction = c => `${c} - Can do all things :)`
const human = (action = defaultAction) => action('A human can')
@rotimi-best
rotimi-best / merge.md
Last active June 4, 2024 08:10
How to merge one folder within two branches in git

git - How to merge one folder within two branches

In my project folder I have 2 folders client and server, I only want get the changes in my server folder from master to prod branch

  1. git checkout prod - Go to the branch with the oldest changes
  2. git merge --no-commit --no-ff master - Merge with the branch with the latest changes. Read More
  3. git reset -- client* - Unstage any changes from client folder, I only want to server folder. Read More
  4. git checkout -- client* - Remove any changes from client folder, I only want to server folder.
  5. git clean -n - View all unstaged files. Read More
  6. git clean -fd - Remove all unstaged folder, if you dont want to remove all then you should add those with git add and then run this command. Read More
@oak-wildwood
oak-wildwood / CalendlyEmbedReact.js
Last active September 13, 2022 00:08
Calendly Embed React component
import React from 'react';
class CalendlyEmbed extends React.Component {
calendlyScriptSrc = 'https://assets.calendly.com/assets/external/widget.js'
buildCalendlyUrl = (account, eventName) =>
`https://calendly.com/${account}/${eventName}`
componentDidMount() {
const head = document.querySelector('head')
const script = document.createElement('script')
@rotimi-best
rotimi-best / ICO.html
Last active February 20, 2022 20:02
ICO Landing Page
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/flexboxgrid/6.3.1/flexboxgrid.min.css">
<!-- HEADER WITH NAVIGATION BAR -->
<header id="main-header">
<div class="container">
<div class="row">
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4">
<h1><a href="#">LeviClan</a></h1>
@rotimi-best
rotimi-best / countries.js
Last active February 14, 2019 06:54
Nodejs Array of Countries
const countries = ["Afghanistan", "Aland Islands", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Barbuda", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Trty.", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Caicos Islands", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", "Congo, Democratic Republic of the", "Cook Islands", "Costa Rica", "Cote d'Ivoire", "Croatia", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Islands (Malvinas)", "Faro
@rotimi-best
rotimi-best / epubtopdf.md
Last active January 1, 2019 21:46
A todo for creating a file converting telegram bot.

Todos - Conversion bot - Epub to pdf

  • Get the document

Check if file is epub else reject file

Document {

  _fileId: 'BQADBAADigMAAlO0OFN7fDAlnFZSHQI',
@danmakenoise
danmakenoise / test.js
Last active February 29, 2024 20:23
Unit Testing Children of React Context API Consumers with Enzyme
// Component.js
const Component = props => (
<MyContext.Consumer>
{(context) => (
<Foo
bar={props.bar}
baz={context.baz}
/>
)}
</MyContext.Consumer>
@zcaceres
zcaceres / Include-in-Sequelize.md
Last active July 27, 2024 13:21
using Include in sequelize

'Include' in Sequelize: The One Confusing Query That You Should Memorize

When querying your database in Sequelize, you'll often want data associated with a particular model which isn't in the model's table directly. This data is usually typically associated through join tables (e.g. a 'hasMany' or 'belongsToMany' association), or a foreign key (e.g. a 'hasOne' or 'belongsTo' association).

When you query, you'll receive just the rows you've looked for. With eager loading, you'll also get any associated data. For some reason, I can never remember the proper way to do eager loading when writing my Sequelize queries. I've seen others struggle with the same thing.

Eager loading is confusing because the 'include' that is uses has unfamiliar fields is set in an array rather than just an object.

So let's go through the one query that's worth memorizing to handle your eager loading.

The Basic Query

@revolunet
revolunet / python-es6-comparison.md
Last active November 2, 2024 12:22
# Python VS JavaScript ES6 syntax comparison

Python VS ES6 syntax comparison

Python syntax here : 2.7 - online REPL

Javascript ES6 via Babel transpilation - online REPL

Imports

import math
@rachelhyman
rachelhyman / gist:b1f109155c9dafffe618
Last active October 17, 2024 06:32
Github README anchor links

To create anchor links that jump down to different sections of a README (as in an interactive table of contents), first create a heading:
#Real Cool Heading

The anchor link for that heading is the lowercase heading name with dashes where there are spaces. You can always get the anchor name by visiting the README on Github.com and clicking on the anchor that appears when you hover to the left of the heading. Copy everything starting at the #:
#real-cool-heading

Wherever you want to link to your Real Cool Heading section, put your desired text in brackets, followed by the anchor link in parentheses:
[Go to Real Cool Heading section](#real-cool-heading)