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 / custom-domain-localhost-xampp
Created July 19, 2018 19:20 — forked from oozman/custom-domain-localhost-xampp
How to add a custom domain name on your localhost using XAMPP. Codes are based on Windows, but Step 2 onwards are pretty much applicable on other operating system.
Step 1:
Go to: C:\Windows\System32\Drivers\etc\hosts
And add this to the bottom of the file:
=============
127.0.0.1 your.domain.com
=============
Step 2:
Go to [your XAMPP directory]/apache/conf/httpd-xampp.conf
<v-form
method="post"
route="{{ route('login') }}"
:data="{ email: '', password: ''}"
sync="user"
{{--@success="mySuccessMethod"--}}
{{--@error="myErrorMethod"--}}
>
<template slot-scope="{data, methods}">
@{{ data.form }}
@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);
});
@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 / 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');
(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 / 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;
@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-&gt;anything()
@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 / 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);
}