Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@nviet
nviet / php character map generator
Created April 10, 2013 11:49
Generates a character map contains selected characters in a TrueType font to an image
<?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
@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",
/**
@RyanNutt
RyanNutt / Jeroo.java
Last active September 3, 2018 22:11
Mockup of a Jeroo class file. See https://compsci.rocks/jeroo-demo-class-file/
public class Jeroo {
private int row;
private int column;
private int flowers;
public Jeroo() {}
public Jeroo(int flowers) {}
public Jeroo(int row, int col) {}
public Jeroo(int row, int col, int flowers) {}
@omz
omz / Evernote Demo.py
Created February 27, 2013 15:08
Evernote Demo
# 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.
#!/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):
@mbreit
mbreit / font-awesome.css.sass
Last active March 29, 2021 04:52
Using Font Awesome with SASS and mixins for adding icons to semantic HTML
$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)
@mikejolley
mikejolley / gist:2044101
Last active May 18, 2021 17:02
WooCommerce - Show number of items in cart and total
<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>
@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';
@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) {
@coolaj86
coolaj86 / email to text.md
Last active March 28, 2022 21:22
List of free email to text services