Skip to content

Instantly share code, notes, and snippets.

View heshamelmasry77's full-sized avatar
🦆
Coding

Hesham El Masry heshamelmasry77

🦆
Coding
View GitHub Profile
@heshamelmasry77
heshamelmasry77 / async-await.js
Created March 27, 2018 07:45 — forked from wesbos/async-await.js
Simple Async/Await Example
// 🔥 Node 7.6 has async/await! Here is a quick run down on how async/await works
const axios = require('axios'); // promised based requests - like fetch()
function getCoffee() {
return new Promise(resolve => {
setTimeout(() => resolve('☕'), 2000); // it takes 2 seconds to make coffee
});
}
* Downloaded or downloading
=============================
**http://kickass.to/infiniteskills-learning-jquery-mobile-working-files-t7967156.html
**http://kickass.to/lynda-bootstrap-3-advanced-web-development-2013-eng-t8167587.html
**http://kickass.to/lynda-css-advanced-typographic-techniques-t7928210.html
**http://kickass.to/lynda-html5-projects-interactive-charts-2013-eng-t8167670.html
**http://kickass.to/vtc-html5-css3-responsive-web-design-course-t7922533.html
*http://kickass.to/10gen-m101js-mongodb-for-node-js-developers-2013-eng-t8165205.html
*http://kickass.to/cbt-nuggets-amazon-web-services-aws-foundations-t7839734.html
@heshamelmasry77
heshamelmasry77 / deleting-item-from-object-in-an-array.js
Last active April 26, 2018 12:29
deleting item from object in an array
// we have an array of objects, we want to find one object using only the id property
var apps = [{id:34,name:'My App',another:'thing'},{id:37,name:'My New App',another:'things'}];
var wantedItem = apps.find(function(app) {
return app.id === 37;
});
//remove item
delete wantedItem.name;
@heshamelmasry77
heshamelmasry77 / splice-object-array.js
Created May 8, 2018 10:49 — forked from scottopolis/splice-object-array.js
Remove object from array of objects in Javascript
// source: http://stackoverflow.com/questions/16491758/remove-objects-from-array-by-object-property
// we have an array of objects, we want to remove one object using only the id property
var apps = [{id:34,name:'My App',another:'thing'},{id:37,name:'My New App',another:'things'}];
// get index of object with id:37
var removeIndex = apps.map(function(item) { return item.id; }).indexOf(37);
// remove object
apps.splice(removeIndex, 1);
running yarn cache clean...
03/06 09:51 PM (10m)
(build/server.js)
running yarn cache clean...
03/06 09:51 PM (10m)
(build/next.config.js)
yarn cache v1.13.0
03/06 09:51 PM (10m)
(build/next.config.js)
warning package.json: No license field
@heshamelmasry77
heshamelmasry77 / gist:bbc18ccf3eb57c4d06227835d235e19c
Last active May 21, 2019 14:24
godady ssl confid digital ocean
Type Name Value TTL Actions
A mydomain.xyz ``` ip address ``` 600 seconds Edit
CNAME www @ 1 Hour Edit
CNAME _domainconnect _domainconnect.gd.domaincontrol.com 1 Hour Edit
NS @ ns11.domaincontrol.com 1 Hour
NS @ ns12.domaincontrol.com 1 Hour
SOA @ Primary nameserver: ns11.domaincontrol.com. 1 Hour
@heshamelmasry77
heshamelmasry77 / nextjs-hoc-authorization.js
Created May 14, 2020 18:23 — forked from whoisryosuke/nextjs-hoc-authorization.js
ReactJS - NextJS - A HOC for wrapping NextJS pages in an authentication check. Checks for getInitialProps on the child component and runs it, so you still get SSR from the page. Also includes a user agent for Material UI.
import React, {Component} from 'react'
import Router from 'next/router'
import AuthService from './AuthService'
export default function withAuth(AuthComponent) {
const Auth = new AuthService('http://localhost')
return class Authenticated extends Component {
static async getInitialProps(ctx) {
// Ensures material-ui renders the correct css prefixes server-side
@heshamelmasry77
heshamelmasry77 / nextjs-hoc-authorization.js
Created May 14, 2020 18:23 — forked from whoisryosuke/nextjs-hoc-authorization.js
ReactJS - NextJS - A HOC for wrapping NextJS pages in an authentication check. Checks for getInitialProps on the child component and runs it, so you still get SSR from the page. Also includes a user agent for Material UI.
import React, {Component} from 'react'
import Router from 'next/router'
import AuthService from './AuthService'
export default function withAuth(AuthComponent) {
const Auth = new AuthService('http://localhost')
return class Authenticated extends Component {
static async getInitialProps(ctx) {
// Ensures material-ui renders the correct css prefixes server-side
@heshamelmasry77
heshamelmasry77 / nextjs-hoc-authorization.js
Created May 14, 2020 18:23 — forked from whoisryosuke/nextjs-hoc-authorization.js
ReactJS - NextJS - A HOC for wrapping NextJS pages in an authentication check. Checks for getInitialProps on the child component and runs it, so you still get SSR from the page. Also includes a user agent for Material UI.
import React, {Component} from 'react'
import Router from 'next/router'
import AuthService from './AuthService'
export default function withAuth(AuthComponent) {
const Auth = new AuthService('http://localhost')
return class Authenticated extends Component {
static async getInitialProps(ctx) {
// Ensures material-ui renders the correct css prefixes server-side
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="https://cdn.jsdelivr.net/gh/alpinejs/alpine@v2.x.x/dist/alpine.min.js" defer></script>
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
</head>
<body>