Skip to content

Instantly share code, notes, and snippets.

View lordspace's full-sized avatar

Svetoslav Marinov lordspace

View GitHub Profile
@nerandell
nerandell / code-review-checklist.md
Last active November 15, 2024 11:25
PHP Code Review Guidelines

Make sure these boxes are checked before submitting/approving the PR

General

  • The code works
  • The code is easy to understand
  • Follows coding conventions
  • Names are simple and if possible short
  • Names are spelt correctly
  • Names contain units where applicable
  • There are no usages of magic numbers
@bappi-d-great
bappi-d-great / code.php
Created August 11, 2015 10:41
Remove role and assign subscriber role to the user or membership cancel
<?php
add_action( 'ms_model_event', 'my_event_handler', 10, 2 );
/**
* Handles an event and process the correct communication if required.
*
* @param MS_Model_Event $event The event that is processed.
* @param mixed $data The data passed to the event handler.
*/
@renarsvilnis
renarsvilnis / server-setup-guide-warp.md
Last active December 11, 2022 21:48
Guide for configuring server for apache, php, ssh etc..

DEV SERVER SETUP


A reference for setting up Linux/Ubuntu server for LAMP, Node.js laboratory.

May be helpful for others, hence this git. If it contains errors, please push them.

This assumes

@codeablehq
codeablehq / backup.sh
Last active July 3, 2017 07:07
A script that creates a backup of your WordPress site and uploads it to Dropbox
#!/bin/bash
# For this script to work, save it somewhere in the executable path, like /usr/local/sbin/backup.sh
# make it executable: chmod +x /usr/local/sbin/backup.sh
# then add it to cron: crontab -e
# and add the line below, which will run backup 3am each day, then upload to Dropbox
# 0 3 * * * /usr/local/sbin/backup.sh > /dev/null 2>&1
# You also need WP CLI installed: http://wp-cli.org/
@proudlygeek
proudlygeek / commands-channel.go
Last active March 31, 2024 03:31
Golang Commands in Goroutines
package main
import (
"fmt"
"log"
"os/exec"
"runtime"
)
type Worker struct {
@xeoncross
xeoncross / record.php
Last active December 15, 2015 10:39
Record audio from flash to MP3 using PHP
<?php
// https://code.google.com/p/wami-recorder/
# Save the audio to a URL-accessible directory for playback.
parse_str($_SERVER['QUERY_STRING'], $params);
$name = isset($params['name']) ? $params['name'] : 'output.wav';
$content = file_get_contents('php://input');
$fh = fopen($name, 'w') or die("can't open file");
fwrite($fh, $content);
fclose($fh);
@jchristopher
jchristopher / class-iti-cap-limiter.php
Created March 7, 2012 23:34
[WordPress] Prevents the creation of full Administrators by client accounts
<?php
/**
* Prevents the creation of full Administrators by client accounts
* Forked from JPB_User_Caps (unable to locate origin)
*
* @return void
* @author Jonathan Christopher
*/
if( is_admin() )
@johnpbloch
johnpbloch / disable-plugins-when-doing-local-dev.php
Created February 11, 2012 20:12 — forked from markjaquith/disable-plugins-when-doing-local-dev.php
Disables specified WordPress plugins when doing local development
<?php
/*
Plugin Name: Disable plugins when doing local dev
Description: If the WP_LOCAL_DEV constant is true, disables plugins that you specify
Version: 0.1
License: GPL version 2 or any later version
Author: Mark Jaquith
Author URI: http://coveredwebservices.com/
*/
@jrom
jrom / nginx.conf
Created February 7, 2012 17:14
nginx hack for multiple conditions
if ($request_uri = /) {
set $test A;
}
if ($host ~* teambox.com) {
set $test "${test}B";
}
if ($http_cookie !~* "auth_token") {
set $test "${test}C";
@hakre
hakre / dl-file.php
Created January 2, 2012 21:41
Wordpress login to download uploaded files
<?php
/*
* dl-file.php
*
* Protect uploaded files with login.
*
* @link http://wordpress.stackexchange.com/questions/37144/protect-wordpress-uploads-if-user-is-not-logged-in
*
* @author hakre <http://hakre.wordpress.com/>
* @license GPL-3.0+