Skip to content

Instantly share code, notes, and snippets.

@zubair1024
zubair1024 / ecosystem.json
Created December 8, 2019 14:06
Running PM2 as a window service
{
"apps": [
{
"name": "web",
"script": "C:\\ws\\engineer\\titan-web\\app.js",
"args": [],
"cwd": "C:\\ws\\engineer\\titan-web",
"merge_logs": true,
"instances": 1,
"exec_mode": "cluster_mode",
@Ryanb58
Ryanb58 / profile.md
Last active January 25, 2024 14:23
How to profile a Node.JS application and Visualize/debug the results.

Profile your node app:

node --prof-process app.js

Visualize the data by opening chrome and going too:

chrome://tracing

@lynt-smitka
lynt-smitka / .htaccess
Last active July 6, 2024 01:04
Block hidden files except .well-known - Apache .htaccess + Nginx
RewriteRule "(^|/)\.(?!well-known\/)" - [F]
@freak4pc
freak4pc / IsraeliID.Validator.js
Last active June 17, 2024 16:19
Israeli ID Validator (Javascript)
function isValidIsraeliID(id) {
var id = String(id).trim();
if (id.length > 9 || id.length < 5 || isNaN(id)) return false;
// Pad string with zeros up to 9 digits
id = id.length < 9 ? ("00000000" + id).slice(-9) : id;
return Array
.from(id, Number)
.reduce((counter, digit, i) => {
@mattclements
mattclements / function.php
Last active July 2, 2024 15:32
Wordpress Disable Comments (add to function.php)
<?php
add_action('admin_init', function () {
// Redirect any user trying to access comments page
global $pagenow;
if ($pagenow === 'edit-comments.php') {
wp_redirect(admin_url());
exit;
}
@irazasyed
irazasyed / ampps-mysql-fix.md
Last active April 27, 2024 07:41
AMPPS MySQL not working, Solution!

AMPPS MySQL not working, Solution!

  1. Open Ampps Application -> MySQL Tab -> Configuration.

  2. In [mysqld] section, add the following line: innodb_force_recovery = 1

  3. Save the file and try starting MySQL

  4. Remove that line which you just added and Save.

@ScottPhillips
ScottPhillips / .htaccess
Created February 2, 2012 04:30
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/