Skip to content

Instantly share code, notes, and snippets.

Avatar

Ryan Nutt RyanNutt

View GitHub Profile
@jchamb
jchamb / gist:fdf7d12b0191cb852056
Last active Aug 8, 2020
Woocommerce Free Downloads without checkout
View gist:fdf7d12b0191cb852056
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' );
View fake_smtp.py
#!/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):
@gbertb
gbertb / font-awesome.js
Created Mar 12, 2014
How to load Font Awesome asynchronously
View font-awesome.js
<!--
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';
@coolaj86
coolaj86 / email to text.md
Last active May 6, 2018
List of free email to text services
View email to text.md
@makeusabrew
makeusabrew / bootbox-setDefaults-v4.js
Last active May 7, 2018
Bootbox v4.0.0 defaults
View bootbox-setDefaults-v4.js
bootbox.setDefaults({
/**
* @optional String
* @default: en
* which locale settings to use to translate the three
* standard button labels: OK, CONFIRM, CANCEL
*/
locale: "fr",
/**
@nviet
nviet / php character map generator
Created Apr 10, 2013
Generates a character map contains selected characters in a TrueType font to an image
View php character map generator
<?php
/**
* PHP Character Map Generator
*
* Generates a character map contains selected characters in a TrueType font
* to an image. Require PHP 5 or higher with GD extension enabled
*
* Example:
* <code>
* <?php
View Evernote Demo.py
# A simple Evernote API demo script that lists all notebooks in the user's
# account and creates a simple test note in the default notebook.
#
# Before running this sample, you must fill in your Evernote developer token!
#
# This sample is part of the Evernote SDK and has been modified slightly for
# Pythonista, to take advantage of the clipboard and PIL modules.
# If there is an image in the clipboard when the script is run, it is attached
# to the sample note.
@mbreit
mbreit / font-awesome.css.sass
Last active Sep 18, 2018
Using Font Awesome with SASS and mixins for adding icons to semantic HTML
View font-awesome.css.sass
$fontawesome_path: "." !default
@font-face
font-family: 'FontAwesome'
src: font-url('#{$fontawesome_path}/fontawesome-webfont.eot')
src: font-url('#{$fontawesome_path}/fontawesome-webfont.eot?#iefix') format("embedded-opentype"), font-url('#{$fontawesome_path}/fontawesome-webfont.woff') format("woff"), font-url('#{$fontawesome_path}/fontawesome-webfont.ttf') format("truetype")
font-weight: normal
font-style: normal
@mixin icon($icon)
@ozh
ozh / gist:4131243
Created Nov 22, 2012
Create dot files/directories (ie .file) on Windows
View gist:4131243

#How to create a .file or .folder on Windows

There are several ways

1. Rename

  • Create file.txt
  • Rename to .file., the last dot will be dropped, you'll have .file

Works the same with a file or a directory.

@mikejolley
mikejolley / gist:2044101
Last active May 4, 2020
WooCommerce - Show number of items in cart and total
View gist:2044101
<a class="cart-contents" href="<?php echo wc_get_cart_url(); ?>" title="<?php _e( 'View your shopping cart' ); ?>"><?php echo sprintf ( _n( '%d item', '%d items', WC()->cart->get_cart_contents_count() ), WC()->cart->get_cart_contents_count() ); ?> - <?php echo WC()->cart->get_cart_total(); ?></a>
You can’t perform that action at this time.