Skip to content

Instantly share code, notes, and snippets.

View stracker-phil's full-sized avatar

Philipp Stracker stracker-phil

View GitHub Profile
@byevhen2
byevhen2 / Build both .js and .min.js with webpack.md
Last active October 22, 2022 11:58
How to build both minified and uncompressed bundle with Webpack

Q: How to build both minified and uncompressed bundle with Webpack?

A1: Use plugin UglifyJsPlugin (before webpack 4)

let webpack = require("webpack");

module.exports = {
    entry: {
        'bundle': './entry.js',
 'bundle.min': './entry.js'
@rheinardkorf
rheinardkorf / loading-wp-editor-instance.php
Created April 18, 2016 00:55
Example of loading WP Editor scripts outside of normal context. No need for dummy editor hackery.
<?php
// Hook in the editor's `enqueue_scripts` function
add_action( 'some_footer_action', array( '_WP_Editors', 'enqueue_scripts' ) );
// Some function that's going to render in the page footer
function some_footer_render_function() {
do_action( 'some_footer_action' );
}
@trslater
trslater / custom-registration.php
Last active May 12, 2020 13:47
Custom Registration Plugin
<?php
/*
Plugin Name: Custom Registration
Description: Updates user rating based on number of posts.
Version: 1.1
Author: Tristan Slater w/ Agbonghama Collins
Author URI: http://kanso.ca
*/
@andresbravog
andresbravog / User.sublime-keymap
Created March 8, 2014 12:27
Theme and colorscheme keybind toggle
[
{
"keys": ["super+k", "super+c", "super+l"],
"command": "toggle_color_scheme",
"args":{
"options": [
{
"color_scheme": "Packages/User/Flatland Monokai (SL).tmTheme" ,
"theme": "Spacegray.sublime-theme"
},
@elclanrs
elclanrs / email-confirmation.php
Last active July 26, 2022 00:11
Simple e-mail confirmation plugin for WordPress.
<?php
/**
* Plugin Name: Email Confirmation
* Description: Send an email to the user with confirmation code and store form data in database until user confirms.
* Author: Cedric Ruiz
*/
class EmailConfirmation
{
const PREFIX = 'email-confirmation-';
@xi4oh4o
xi4oh4o / auto_restart_webserver.sh
Last active September 1, 2021 19:10
Auto restart phpfpm on 502 & 504 Error also save logs
#!/bin/bash
MY_URL="http://moefou.org" #change you website
RESULT_502=`curl -I $MY_URL|grep "HTTP/1.1 502"`
RESULT_504=`curl -I $MY_URL|grep "HTTP/1.1 504"`
if [ -n "$RESULT_502" ]; then
killall php-fpm;php-fpm
date>>/data/logs/web_error.log;echo "502 Bad Gateway">>/data/logs/web_error.log
elif [ -n "$RESULT_504" ]; then
killall php-fpm;php-fpm
date>>/data/logs/web_error.log;echo "504 Gateway Time-out">>/data/logs/web_error.log