Skip to content

Instantly share code, notes, and snippets.

@makeusabrew
makeusabrew / bootbox-setDefaults-v4.js
Last active May 7, 2018 01:05
Bootbox v4.0.0 defaults
bootbox.setDefaults({
/**
* @optional String
* @default: en
* which locale settings to use to translate the three
* standard button labels: OK, CONFIRM, CANCEL
*/
locale: "fr",
/**
@coolaj86
coolaj86 / email to text.md
Last active March 28, 2022 21:22
List of free email to text services
@gbertb
gbertb / font-awesome.js
Created March 12, 2014 06:40
How to load Font Awesome asynchronously
<!--
How to load Font Awesome asynchronously
Use: Just put this script on the bottom/footer of your web
-->
<script type="text/javascript">
(function() {
var css = document.createElement('link');
css.href = '//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css';
#!/usr/bin/env python
"""A noddy fake smtp server."""
import smtpd
import asyncore
class FakeSMTPServer(smtpd.SMTPServer):
"""A Fake smtp server"""
def __init__(*args, **kwargs):
@jchamb
jchamb / gist:fdf7d12b0191cb852056
Last active July 25, 2023 16:59
Woocommerce Free Downloads without checkout
function direct_free_downloads_button($button)
{
global $product;
if( $product->is_downloadable() AND $product->get_price() == 0 )
{
$files = $product->get_files();
$files = array_keys($files);
$download_url = home_url('?download_file='.$product->id.'&key='.$files[0].'&free=1' );
@xadim
xadim / Date interval into Human Readable Time
Created April 2, 2015 21:54
Simple snippet PHP function that turns Date interval into Human Readable Time
/**
* Format an interval to show all existing components. Human Readable Time
* If the interval doesn't have a time component (years, months, etc)
* That component won't be displayed.
*
* @param DateInterval $interval The interval
*
* @return string Formatted interval string.
*/
function format_interval(DateInterval $interval) {
<?
/////////////////////
// slack2html
// by @levelsio
/////////////////////
//
/////////////////////
// WHAT DOES THIS DO?
/////////////////////
//
@nickcernis
nickcernis / mailchimp-popup-for-wordpress.md
Last active July 28, 2022 14:49
MailChimp Popup Script that works with WordPress sites

MailChimp's default popup scripts can break on WordPress sites that use jQuery/jQuery UI unless you include their embed code as the final elements before the closing body tag.

Including them in this way isn't always possible or easy with WordPress.

The code below is an alternative implementation of the loader that forces MailChimp's popup scripts to appear below all other scripts upon page load.

To use it, modify the baseUrl, uuid, and lid attributes with the ones from the original popup script that MailChimp supplies.

@MikeNGarrett
MikeNGarrett / wp-config.php
Last active April 26, 2024 10:15
All those damned wp-config constants you can never remember.
<?php
// PHP memory limit for this site
define( 'WP_MEMORY_LIMIT', '128M' );
define( 'WP_MAX_MEMORY_LIMIT', '256M' ); // Increase admin-side memory limit.
// Database
define( 'WP_ALLOW_REPAIR', true ); // Allow WordPress to automatically repair your database.
define( 'DO_NOT_UPGRADE_GLOBAL_TABLES', true ); // Don't make database upgrades on global tables (like users)
// Explicitely setting url
@petertwise
petertwise / wp-cli-oneclick-install.sh
Last active January 2, 2024 20:17
Customized wordpress install script with WP CLI
#!/bin/bash
# Install Wordpress with Square Candy default using WP CLI
read -p 'Site URL (example.com): ' url
read -p 'Site Title: ' title
read -p 'WP Admin username: ' admin_user
read -sp 'WP Admin password: ' admin_password
read -p '
WP Admin email: ' admin_email
read -p 'Database name: ' dbname
read -p 'Database user: ' dbuser