Skip to content

Instantly share code, notes, and snippets.

View Maxondria's full-sized avatar
🏠
Working from home

Maxon Tayebwa Maxondria

🏠
Working from home
View GitHub Profile
// keeping the same pattern
export default await new Promise(async $export => {
// export the module
$export({my: 'module'});
});
// dropping the Promise all together
export default await (async () => {
// await async dependencies
// export the module
@Maxondria
Maxondria / mac-setup-redis.md
Created September 7, 2021 13:09 — forked from tomysmile/mac-setup-redis.md
Brew install Redis on Mac

type below:

brew update
brew install redis

To have launchd start redis now and restart at login:

brew services start redis
@Maxondria
Maxondria / es6-compose.md
Created October 2, 2020 09:26 — forked from JamieMason/es6-compose.md
ES6 JavaScript compose function

ES6 JavaScript Compose Function

Definition

const compose = (...fns) =>
  fns.reduceRight((prevFn, nextFn) =>
    (...args) => nextFn(prevFn(...args)),
    value => value
 );
// create a bookmark and use this code as the URL, you can now toggle the css on/off
// thanks+credit: https://dev.to/gajus/my-favorite-css-hack-32g3
javascript: (function() {
var domStyle = document.createElement("style");
domStyle.append(
'* { color:#0f0!important;outline:solid #f00 1px!important; background-color: rgba(255,0,0,.2) !important; }\
* * { background-color: rgba(0,255,0,.2) !important; }\
* * * { background-color: rgba(0,0,255,.2) !important; }\
* * * * { background-color: rgba(255,0,255,.2) !important; }\
* * * * * { background-color: rgba(0,255,255,.2) !important; }\
// inherit-compose.js
// Inheritance vs Composition
//INHERITANCE
// Character > Human > Sam
// Character > Robot > x73
// Character > Cyborg > Dolph
const Character = {
talk: function(...msg){
/**
* Creating objects with Classes
* Versus objects with prototypes
* Since JavaScript is not a Class-based language
* what is happening behind the class syntax?
*/
let PersonC = class {
constructor(nm, id) {
this.name = nm;
@Maxondria
Maxondria / generators.md
Created May 8, 2020 06:11 — forked from learncodeacademy/generators.md
What are Javascript Generators?

##what are generators##

  • They're pausable functions, pausable iterable functions, to be more precise
  • They're defined with the *
  • every time you yield a value, the function pauses until .next(modifiedYieldValue) is called
var myGen = function*() {
  var one = yield 1;
  var two = yield 2;
  var three = yield 3;
 console.log(one, two, three);
@Maxondria
Maxondria / consoleColors.js
Created May 1, 2020 11:02 — forked from abritinthebay/consoleColors.js
The various escape codes you can use to color output to StdOut from Node JS
// Colors reference
// You can use the following as so:
// console.log(colorCode, data);
// console.log(`${colorCode}some colorful text string${resetCode} rest of string in normal color`);
//
// ... and so on.
export const reset = "\x1b[0m"
export const bright = "\x1b[1m"
export const dim = "\x1b[2m"
@Maxondria
Maxondria / LICENSE
Created February 21, 2020 11:40 — forked from bennylope/LICENSE
Django manage.py file that loads environment variables from a .env file per Honcho/Foreman
Copyright the authors of Honcho and/or Ben Lopatin
Licensed for reuse, modification, and distribution under the terms of the MIT license