Skip to content

Instantly share code, notes, and snippets.

@iammart
iammart / fix-wordpress-permissions.sh
Created June 28, 2017 14:55 — forked from Adirael/fix-wordpress-permissions.sh
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory
@iammart
iammart / scripts.sh
Last active May 26, 2017 09:30
cPanel Mail
#
# Delete email older than %%
#
$ find /home/%ACCOUNT%/mail/%MAILBOX%/new -type f -mtime +30 -delete
$ find /home/%ACCOUNT%/mail/%MAILBOX%/cur -type f -mtime +30 -delete
#
# Fix quotas
# https://forums.cpanel.net/threads/how-to-reset-mail-quota.105325/#post-691898
#
  • Pagination
  • Filters
  • Order By
  • Limit
  • Validation
  • Ajax Controller
  • Assets
  • RSS
@iammart
iammart / protips.js
Created May 26, 2016 07:13 — forked from nolanlawson/protips.js
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
@iammart
iammart / regex.whitespace
Created February 11, 2016 10:20
Atom - Remove whitespace
^(?:[\t ]*(?:\r?\n|\r))+
@iammart
iammart / export.sql
Created December 15, 2015 16:07
Export table from mysqldump
sed -n -e '/DROP TABLE.*%TABLE%/,/UNLOCK TABLES/p' %DATABASE-DUMP%.sql > %EXPORT%.sql
@iammart
iammart / vsftp
Created November 11, 2015 09:51
Centos
# Add user
adduser -s /bin/false -d %PATH% %USER%
# Set user password
passwd %USER%
# Add permissions to ACL
setfacl -R -d -m "u:%USER%:rwx" %PATH%
setfacl -R -m "u:%USER%:rwx" %PATH%
@iammart
iammart / gist:1fe85fe380beba64cb42
Created October 15, 2015 13:36 — forked from getify/gist:7ae82fdc2e86bf66bcba
List of ES6 books either out or in progress...
@iammart
iammart / simplifymultifilearray.php
Last active September 23, 2015 10:29
Simplify multiple file array
<?php
function simplifyMultiFileArray($files = array()){
$sFiles = array();
if(is_array($files) && count($files) > 0){
foreach($files as $key => $file){
foreach($file as $index => $attr){
$sFiles[$index][$key] = $attr;
}
}
@iammart
iammart / guide.mkd
Created July 29, 2015 08:18
ESLint Guide

5-step quick start guide to ESLint

Contents:

  • Install and configure
  • Make ESLint enforce your preferred coding style
  • Sport more errors with extra plugins
  • Never forget to run ESLint: Make it automatic
  • Get instant feedback by adding ESLint to your editor