Skip to content

Instantly share code, notes, and snippets.

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

Mahade Walid walidmahade

🏠
Working from home
View GitHub Profile
@walidmahade
walidmahade / deploy-react-app.yaml
Last active February 22, 2024 04:29
Github actions example - Deploy react app using SFTP
# Optional - The name of the workflow, appears in the "Actions" tab of the GitHub repository. If this field is omitted, the name of the workflow file will be used instead.
name: deploy-app-to-production
# Optional - The name for workflow runs generated from the workflow.
# This example uses an expression with the `github` context to display the username."
# See full list of available context objects: https://docs.github.com/en/actions/learn-github-actions/contexts
run-name: ${{ github.actor }} is deploying to cpanel
# The trigger for this workflow
# you can target multiple branches by adding one branch per line
@walidmahade
walidmahade / settings.json
Created February 4, 2023 10:19
VS Code color customizations for default dark+ theme.
"workbench.colorCustomizations": {
"badge.background": "#0c0c0c",
"menu.background": "#0c0c0c",
"sideBar.dropBackground": "#0c0c0c",
"sideBar.background": "#0c0c0c",
"sideBar.border": "#2a2a2a",
"editorGroupHeader.tabsBackground": "#0c0c0c",
"editorGroupHeader.noTabsBackground": "#0c0c0c",
"editor.background": "#0c0c0c",
"editorGroup.background": "#0c0c0c",
@walidmahade
walidmahade / vanilla-api.md
Created January 13, 2022 14:55 — forked from dexit/vanilla-api.md
Building a Simple Web API with Vanilla PHP
@walidmahade
walidmahade / wc-min-pass-chars-req.php
Created October 31, 2020 12:24 — forked from rynaldos-zz/wc-min-pass-chars-req.php
[WooCommerce 3.0] Require minimum password length for account registration, password update, and password resets
add_action('woocommerce_process_registration_errors', 'validatePasswordReg', 10, 2 );
function validatePasswordReg( $errors, $user ) {
// change value here to set minimum required password chars
if(strlen($_POST['password']) < 15 ) {
$errors->add( 'woocommerce_password_error', __( 'Password must be at least 15 characters long.' ) );
}
// adding ability to set maximum allowed password chars -- uncomment the following two (2) lines to enable that
//elseif (strlen($_POST['password']) > 16 )
//$errors->add( 'woocommerce_password_error', __( 'Password must be shorter than 16 characters.' ) );
let a = 10; // save 10 inside varialbe 'a'
let x = 0; // // save 0 inside varialbe 'x'
while(x < a) { // condition is - as long as value of 'x' is less than value of 'a', we will run the following code
console.log( x ); // print current value of 'x' to the console
x = x + 1 // then, add 1 to current value of 'x'
}
/*
That loop will run 11 times and print -
function print_my_name() {
// code to execure
console.log("Mahade");
}
function multiply_by_two(your_number) {
// code to execure
console.log( your_number * 2 ); // multiply given number with two, then print in console
}
if ( condition is true ) {
// do something
} else {
// do something else
}
@walidmahade
walidmahade / variables.js
Last active October 23, 2020 17:28
Introduction to computer programming.
// set a value
let a = "Earth is round";
let x = 18;
// get a value
alert(a); // "Earth is round"
alert(x); // 18
<div>Coming Soon</div>
"{"videos":[{"id":1,"name":"ES2015 Arrow Functions","description":"<p>ES2015 (aka ES6) has some great ways to make your code easier to write and understand. In this episode, we cover two different ways that you can make your code clearer by removing the 'function' keyword.</p>","thumbnail":"https://vue-screencasts.s3.us-east-2.amazonaws.com/images/video-thumbnails/Thumbnail+-+Arrow+Function.png","videoUrl":"https://vue-screencasts.s3.us-east-2.amazonaws.com/video-files/38-+es2015-+functions+minus+'function'.mp4"},{"id":2,"name":"ES2015 Template Strings","description":"<p>Template strings are an incredibly useful new feature in ES2015... and you can use them in your Ember apps today!</p>\n <p>Here are 3 cool things that template strings enable.</p>","thumbnail":"https://vue-screencasts.s3.us-east-2.amazonaws.com/images/video-thumbnails/Thumbnail+-+Template+Strings.png"},{"id":3,"name":"ES2015 Modules","description":"<p>Before modules, javascript code loading was a mess. Now it's pretty a