Skip to content

Instantly share code, notes, and snippets.

@OsitaDNU
OsitaDNU / h_index.ts
Last active October 25, 2023 07:35
h-index Calculator (TypeScript)
// Example
// Calculates a h-index number from an array of random citations per research publication
// The number of research publications (e.g. journal articles)
let publications = 10;
// Maximum number of citations per publication
let maxCitation = 100;
// Generates an array of random citations per research publication
@Suleman-Elahi
Suleman-Elahi / mxroute_email_accounts.py
Last active March 31, 2025 04:44
A script to bulk create email accounts on MXroute via API. Sleep is not really necessary so can turn off. Use the users.csv file to create the CSV file with information of user to be created, quota must be given in MB. Just replace your username, password, server URL and good to go.
import requests
import csv
import time
server_login = 'YourUserName'
server_pass = 'YourPassword/LoginKey'
endpoint_url = 'AddSevrerURLHereWithPort' + '/CMD_EMAIL_POP' #Change the first part to he URL of the server you recoeved after sign up.
headers={"Content-Type": "application/x-www-form-urlencoded",}
@bradtraversy
bradtraversy / laravel_xampp_setup.md
Created April 22, 2022 01:16
Laravel Xampp setup on Mac and Windows

Laravel Xampp Setup (Windows & Mac)

Install Xampp

Install Xampp from https://www.apachefriends.org/index.html

  • Run the Xampp installer and open the Xampp control panel
  • Make sure that you enable the Apache and MySQL services
  • On mac you need to click "Start" on the Home tab, "Enable" on the Network tab and "Mount" on the Location Tab. Click "Explore" on the location tab to open your Xampp/Lampp folder

Install Composer

@digitalchild
digitalchild / functions.php
Created April 23, 2021 04:32
Add Theme support for Woocommerce Product gallery Lightbox, zoom and slider
<?php // Do not include this if already open! Code goes in theme functions.php.
add_action( 'after_setup_theme', 'add_wc_gallery_lightbox', 100 );
function add_wc_gallery_lightbox() {
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
}
@rolandstarke
rolandstarke / laravel setup.sh
Last active January 25, 2025 20:13
Server setup bash script for Laravel
# Ubuntu 20 LTS Server Setup for Laravel
# Login as root user
sudo su -
# Update list of available packages
apt update
@BenSampo
BenSampo / deploy.sh
Last active April 2, 2025 09:01
Laravel deploy script
# Change to the project directory
cd $FORGE_SITE_PATH
# Turn on maintenance mode
php artisan down || true
# Pull the latest changes from the git repository
# git reset --hard
# git clean -df
git pull origin $FORGE_SITE_BRANCH
@mtx-z
mtx-z / wp-bootstrap4.4-pagination.php
Last active January 16, 2025 16:15
Wordpress 5.4 Bootstrap 4.4 pagination (with custom WP_Query() and global $wp_query support) (UPDATED for Bootstrap 5: https://gist.github.com/mtx-z/af85d3abd4c19a84a9713e69956e1507)
<?php
/**
* @param WP_Query|null $wp_query
* @param bool $echo
* @param array $params
*
* @return string|null
*
* UPDATE for Bootstrap 5.0: https://gist.github.com/mtx-z/af85d3abd4c19a84a9713e69956e1507
*
@braginteractive
braginteractive / gulpfile.js
Created April 18, 2017 18:40
Gulp file for WordPress Theme
// Load all the modules from package.json
var gulp = require( 'gulp' ),
plumber = require( 'gulp-plumber' ),
autoprefixer = require('gulp-autoprefixer'),
watch = require( 'gulp-watch' ),
jshint = require( 'gulp-jshint' ),
stylish = require( 'jshint-stylish' ),
uglify = require( 'gulp-uglify' ),
rename = require( 'gulp-rename' ),
notify = require( 'gulp-notify' ),
@Yousha
Yousha / .gitignore
Last active April 3, 2025 09:29
.gitignore for PHP developers.
##### Windows
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
@mgburns
mgburns / acf-field-registration-example.php
Created September 1, 2015 13:14
Example programmatic registration of Advanced Custom Fields fields
<?php
/**
* Example programmatic registration of Advanced Custom Fields fields
*
* @see http://www.advancedcustomfields.com/resources/register-fields-via-php/
*/
function register_custom_acf_fields() {
if ( function_exists( 'acf_add_local_field_group' ) ) {