Skip to content

Instantly share code, notes, and snippets.

@unusorin
unusorin / MultiCurl.class.php
Created September 19, 2012 13:03
MultiCurl class PHP
<?php
/**
* MultiCurl class library is a PHP solution for work with MULTI CURL extension.
* It provides to execute some parallel HTTP requests with limit of downloaded
* size. Example: start 100 downloads with 2 parallel sessions, and get only
* first 100 Kb per session.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@malarkey
malarkey / Contract Killer 3.md
Last active May 24, 2024 23:38
The latest version of my ‘killer contract’ for web designers and developers

When times get tough and people get nasty, you’ll need more than a killer smile. You’ll need a killer contract.

Used by 1000s of designers and developers Clarify what’s expected on both sides Helps build great relationships between you and your clients Plain and simple, no legal jargon Customisable to suit your business Used on countless web projects since 2008

…………………………

@supercleanse
supercleanse / custom_signup.php
Created February 5, 2013 05:23
Shows how to add custom variables to a memberpress signup form.
<?php
/*
Plugin Name: MemberPress Custom Membership Signup
Plugin URI: http://memberpress.com
Description: Adds some custom fields to the MemberPress signup process
Version: 1.0.0
Author: MemberPress
Author URI: http://memberpress.com
Text Domain: memberpress
*/
@timoleinio
timoleinio / maintenance.php
Created July 3, 2013 20:18
WordPress maintenance.php example
<?php
// Return http response 503 service unavailable. This is important for SEO too!
$protocol = $_SERVER["SERVER_PROTOCOL"];
if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol ) $protocol = 'HTTP/1.0';
header( "$protocol 503 Service Unavailable", true, 503 );
header( 'Content-Type: text/html; charset=utf-8' );
header( 'Retry-After: 600' ); // 10 minutes
?>
<!DOCTYPE html>
<html>
@MikeRogers0
MikeRogers0 / backup-to-s3.sh
Last active May 19, 2020 15:33
A method of backing up your website to Amazon S3.
#!/bin/bash
## Email Variables
EMAILDATE=`date --date="today" +%y-%m-%d`
EMAIL="you@yourdomain.com"
SUBJECT="[servername] Backup Script Started! - "$EMAILDATE
EMAILMESSAGE="/tmp/emailmessage1.txt"
echo "Just to let you know that the backup script has started."> $EMAILMESSAGE
/bin/mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE
@supercleanse
supercleanse / product_access_urls.php
Created October 10, 2013 20:15
List MemberPress product access urls in a page template.
<?php
if(MeprUtils::is_user_logged_in())
{
$user = MeprUtils::get_currentuserinfo();
$products = $user->active_product_subscriptions('products');
foreach($products as $product) {
if( !empty( $product->access_url ) ) {
?>
<a href="<?php echo $product->access_url; ?>"><?php echo $product->post_title; ?></a><br/>
@jparrill
jparrill / hostname_servers
Created October 14, 2013 06:16
Names for servers
Hostnames!
You have to set up a bunch of machines, and suddenly have a mental block as to what to call them all?
Well, here's some good hostnames to get you going.
The idea is to come up with some kind of category, so that people have something to remember all the names by. Some categories: Geographical (countries, cities, parks, rivers, lakes, streets), entertainment (flintsones, simpsons, disney films, celebrities), companies (hotels, airports, local shops, restarants), astronomy (planets, comets, space missions), literature (mythology, philosophers, writers of particular generes, languages), political (presidents, judges, congressmen, terminology), science (units of measure, anatomy, instruments, scientists), industry (tools, machines, inventions, inventors), computers (terminology, programming languages, number systems).
Some hostnames I've seen, used, or expect to use..
(Not responsible for typos; do your own spell checks!)
@LaboratorioEfe5
LaboratorioEfe5 / Show WP Theme Bookmarklet
Last active August 14, 2017 12:29
Bookmarklet para mostrar los datos relativos al theme actual si la página está construida con el CMS WordPress.
javascript:(function(){var links=document.getElementsByTagName("link");var neededElements=[];var reg=/\/wp-content\/themes\/(.)+\/style\.css/;var themeStyle="";for(var i=0,length=links.length;i<length;i++)if(links[i].rel.indexOf("stylesheet")>=0)if(links[i].href.match(reg))themeStyle=links[i].href;if(themeStyle===""){alert("Vaya parece que la web actual no est\u00e1 construida con WordPress");return false;}var txtFile=new XMLHttpRequest;txtFile.open("GET",themeStyle,true);txtFile.onreadystatechange=function(){if(txtFile.readyState===4)if(txtFile.status===200){allText=txtFile.responseText;themeName=allText.match(/theme name:(.)+/i)||{};themeURI=allText.match(/theme URI:(.)+/i)||{};description=allText.match(/Description:(.)+/i)||{};author=allText.match(/Author:(.)+/i)||{};authorURI=allText.match(/Author URI:(.)+/i)||{};version=allText.match(/Version:(.)+/i)||{};tags=allText.match(/Tags:(.)+/i)||{};alert(themeName[0]+"\n"+themeURI[0]+"\n"+description[0]+"\n"+author[0]+"\n"+authorURI[0]+"\n"+version[0]+"\n"+tags[
@supercleanse
supercleanse / auto_enroll.php
Last active October 11, 2022 04:14
Automatically create a lifetime transaction for a specific product each time a user registers.
<?php
if(is_plugin_active('memberpress/memberpress.php')) {
add_action( 'user_register', 'mp_auto_enroll' );
//add_action( 'gform_user_registered', 'mp_auto_enroll', 10, 4 );
function mp_auto_enroll($user_id, $user_config=array(), $entry='', $user_pass='') {
$txn = new MeprTransaction();
$txn->user_id = $user_id;
@supercleanse
supercleanse / mp_custom_account_nav.php
Created January 28, 2014 03:30
Add custom tabs to the MemberPress Account Page
<?php
add_action('mepr_account_nav', 'custom_account_nav', 10, 1);
function custom_account_nav($user) {
$mepr_options = MeprOptions::fetch();
$whaa_url = $mepr_options->account_page_url('action=whaa');
?>
<span class="mepr-nav-item custom-whaa">
<a href="<?php echo $whaa_url; ?>" id="mepr-account-whaa"><?php _e('Whaa', 'memberpress'); ?></a>
</span>