Skip to content

Instantly share code, notes, and snippets.

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

Salaheddin AbuEin sabuein

🏠
Working from home
View GitHub Profile
@WebReflection
WebReflection / esx.md
Last active May 6, 2024 08:49
Proposal: an ESX for JS implementation
// Core assets
let coreAssets = [];
// On install, cache core assets
self.addEventListener('install', function (event) {
// Cache core assets
event.waitUntil(caches.open('app').then(function (cache) {
for (let asset of coreAssets) {
cache.add(new Request(asset));
@jsnelders
jsnelders / wordpress_export_to_json.php
Last active May 6, 2024 16:35
Export all core WordPress data (posts, pages, attachments, comments, tags, categories and users) to a JSON formatted file.
<?php
/**
* Plugin Name: WordPress Export to JSON
* Plugin URI: https://jsnelders.com/
* Description: Export all WordPress posts, pages, comments, tags, commments and users to a JSON file.
* Author: Jason Snelders
* Author URI: http://jsnelders.com
* Version: 2020-01-30.1
**/
@harrisonmalone
harrisonmalone / _form-validation.md
Last active July 4, 2023 22:23
form validation and events lecture for m0119

Lecture ✍️

JS Events

So far we have mostly been using HTML buttons to trigger JS functions, but this is only one event we can use to trigger logic from our JS files. In previous tasks we set up what is called an event listener to detect when the button was clicked. We passed a callback as a function that gets called when event is triggered. Being able to pass functions as parameters - the same way as we can with variables - is one of the major strengths of the JS language.

Event-based programming can be a little tricky to wrap your head around, especially as a beginner. Up until now you have probably been mainly programming in a sequential or imperative way - each line is executed one after another. When we introduce event listeners and callbacks we are determining the functionality we want to happen but we are not actually in control of when this functionality happens - functions aren't called until the button is actually clicked by the user.

Let's create a Coder Academy webapp that allows users t

@PatrickDinh
PatrickDinh / SqlTableToHtml.md
Last active March 14, 2023 23:39
Convert SQL Server table to HTML

For our reporting services, we need to convert a lot SQL tables to HTML. This is the SP that can convert any table to HTML based on a SP created by Ian Atkin (ian.atkin@ict.ox.ac.uk) The original post can be found here

The modified version supports converting tables having NULL cells & better styling

create PROCEDURE [dbo].[SqlTableToHtml] (
@TABLENAME  NVARCHAR(500),
@OUTPUT   NVARCHAR(MAX) OUTPUT,
@TBL_STYLE NVARCHAR(1024) = '',
@TD_STYLE NVARCHAR(1024) = '',
@maxbeatty
maxbeatty / select_country_by_continent.html
Created September 30, 2011 23:21
HTML Select Country by Continent
<label for="addressCountry">Country</label>
<select name="addressCountry">
<option></option>
<optgroup label="North America">
<option value="US">United States</option>
<option value="UM">United States Minor Outlying Islands</option>
<option value="CA">Canada</option>
<option value="MX">Mexico</option>
<option value="AI">Anguilla</option>
<option value="AG">Antigua and Barbuda</option>