Skip to content

Instantly share code, notes, and snippets.

@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/
@irazasyed
irazasyed / ampps-mysql-fix.md
Last active October 4, 2024 00:27
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.

@mattclements
mattclements / function.php
Last active October 29, 2024 22:04
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;
}
@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) => {
@lynt-smitka
lynt-smitka / .htaccess
Last active August 12, 2024 09:18
Block hidden files except .well-known - Apache .htaccess + Nginx
RewriteRule "(^|/)\.(?!well-known\/)" - [F]
@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

@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",
@erikkinding
erikkinding / kafka-local-docker-compose.yaml
Last active April 1, 2025 12:53
Docker compose for local Kafka setup with kafka-ui
# This setup allows you to both connect from within the docker-compose context as well as from services running on your local
# machine but not as part of the docker-compose setup. Any client connecting to the broker from the outside can connect to
# localhost:9092 while services running as part of the docker-compose connect to broker:9093.
#
# To access kafka-ui: http://localhost:7777
#
# I hope this helps someone out there! :)
version: '3'
networks: