Skip to content

Instantly share code, notes, and snippets.

View mostafa6765's full-sized avatar
👨‍💻
code

Mostafa Kamal mostafa6765

👨‍💻
code
View GitHub Profile
@mostafa6765
mostafa6765 / vscode_shortcuts.md
Created April 10, 2023 12:03 — forked from bradtraversy/vscode_shortcuts.md
Helpful shortcuts for VSCode

VSCode Shortcuts

List of helpful shortcuts for faster coding

If you have any other helpful shortcuts, feel free to add in the comments of this gist :)

Official List of all commands

@mostafa6765
mostafa6765 / fetch-api-examples.md
Created June 22, 2021 12:28 — forked from justsml/fetch-api-examples.md
JavaScript Fetch API Examples
@mostafa6765
mostafa6765 / class_decorator.ts
Created April 15, 2021 16:50 — forked from remojansen/class_decorator.ts
TypeScript Decorators Examples
function logClass(target: any) {
// save a reference to the original constructor
var original = target;
// a utility function to generate instances of a class
function construct(constructor, args) {
var c : any = function () {
return constructor.apply(this, args);
}
@mostafa6765
mostafa6765 / node_nginx_ssl.md
Created September 24, 2020 10:50 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@mostafa6765
mostafa6765 / 1_phpunit-api.md
Created September 27, 2019 05:24 — forked from loonies/1_phpunit-api.md
PHPUnit Cheat Sheet

PHPUnit API reference

  • version 3.6

TODO

Check those constraints:

$this->anything()
@mostafa6765
mostafa6765 / cross-origin-local-storage.js
Created August 23, 2019 19:08 — forked from buren/cross-origin-local-storage.js
Cross origin local storage sharing example (using an iframe and postMessage)
const CrossOriginLocalStorage = function(currentWindow, iframe, allowedOrigins, onMessage) {
this.allowedOrigins = allowedOrigins;
let childWindow;
// some browser (don't remember which one) throw exception when you try to access
// contentWindow for the first time, it works when you do that second time
try {
childWindow = iframe.contentWindow;
} catch(e) {
childWindow = iframe.contentWindow;
(function($) {
$(document).ready(function($) {
//hash link click
$('a[href*="#"]').on('click', function(e) {
e.preventDefault();
//console.log('hash clicked'); //uncomment this link to understand if click is working
@mostafa6765
mostafa6765 / Laravel Cache Clear
Created July 10, 2019 09:21 — forked from Merazsohel/Laravel Cache Clear
Laravel Cache Clear
Route::get('artisan/command/{key?}', array(function($key = null)
{
Artisan::call('config:clear');
if($key == "cache-clear")
{
try
{
echo '<br>php artisan cache:clear...';
Artisan::call('cache:clear');
@mostafa6765
mostafa6765 / AlertSpec.js
Created October 19, 2018 21:09 — forked from martinlindhe/Alert.vue
jasmine + karma for vue test
describe("Alert component", function() {
var c = require('./../../../resources/assets/js/components/Alert.vue');
it('should have data', function () {
expect(typeof c.data).toBe('function');
});
it('should be visible', function () {
var defaultData = c.data();
@mostafa6765
mostafa6765 / socket--client.js
Last active September 15, 2018 12:43 — forked from crtr0/client.js
A simple example of setting-up dynamic "rooms" for socket.io clients to join
// set-up a connection between the client and the server
var socket = io.connect();
// let's assume that the client page, once rendered, knows what room it wants to join
var room = "abc123";
socket.on('connect', function() {
// Connected, let's sign-up for to receive messages for this room
socket.emit('room', room);
});