Skip to content

Instantly share code, notes, and snippets.

@illucent
illucent / wp_plugin_ajax.php
Created December 10, 2015 09:43 — forked from iwek/wp_plugin_ajax.php
Ajax in Wordpress
<?php
/**
* @package Quick Contact
* @version 0.1
*/
/*
Plugin Name: Quick Contact
Plugin URI: http://techslides.com/
Description: Quick Contact WordPress Plugin to make an Ajax form submission, store it in the database, and show it in a Admin backend page.
Version: 0.1
@illucent
illucent / wp_body_class.php
Created December 8, 2015 08:54 — forked from mohsinrasool/wp_body_class.php
Add Page slug to the body_class function
// Add to the body_class function
function condensed_body_class($classes) {
global $post;
// add a class for the name of the page - later might want to remove the auto generated pageid class which isn't very useful
if( is_page()) {
$pn = $post->post_name;
$classes[] = "page-".$pn;
}
@illucent
illucent / Add Pinterest Button to all Images in the_content()
Created December 7, 2015 19:36 — forked from cabans/Add Pinterest Button to all Images in the_content()
Wordpress - Function to wrap all images and adds Pinterest button
// Wraps image with container and add link to share src from all <img> in the content
function gear_pinterest_in_content_images($content) {
$dom = new DOMDocument('UTF-8');
@$dom->loadHTML( utf8_decode($content) ); // Decode to simple ISO to avoid accent errors
$dom->preserveWhiteSpace = false;
$images = $dom->getElementsByTagName('img');
if( count($images) > 0 ) {
foreach ($images as $image) {
<?php
/*
* Template Name: AJAX Page
*
* This page template responds to the request type by serving only the content for an AJAX request
* and the content wrapped in the parent layout for a normal request. This allows for loading the
* content via AJAX and the History API without the need for hash-bang URLs.
*/
$url = rtrim($_SERVER['REQUEST_URI'],"/");
@illucent
illucent / wp-add-inline-style.php
Created December 7, 2015 17:27
`wp_add_inline_style` example
<?php
add_action( 'admin_enqueue_scripts', 'prefix_admin_enqueue_scripts' );
/**
* Print inline admin style.
*/
function prefix_admin_enqueue_scripts() {
wp_add_inline_style( 'wp-admin', '#adminmenu {
transform: translateZ(0);
}' );
}
@illucent
illucent / font_variables.scss
Created December 2, 2015 15:37 — forked from jacrook/font_variables.scss
Sass Css Font Stack Variables
//////////////////////////////////////////////////////////////
// Font Variables (http://cssfontstack.com/)
//////////////////////////////////////////////////////////////
//
// Serif font-stacks
//
$baskerville-font-stack: "Big Caslon", "Book Antiqua", "Palatino Linotype", Georgia, serif !default;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env python
import os
import sys
from os import listdir
from os.path import isfile, join
from time import sleep
(*
File: OmniFocus_Due_List.scpt
Revision: 1.0
Revised: 2015-07-01
Summary: Create taskpaper list of tasks due +/- 7d from current date.
-----------------------------------------------------------
Script based on Justin Lancy (@veritrope) from Veritrope.com
@illucent
illucent / BibleDraft.py
Created November 26, 2015 19:50 — forked from pfcbenjamin/BibleDraft.py
BibleDraft.py
'''
!/usr/bin/env python
All Scripture generated by this script is from The Holy Bible, English Standard Version. Copyright &copy;2001 by <a href="http://www.crosswaybibles.org">Crossway Bibles</a>, a publishing ministry of Good News Publishers. Used by permission. All rights reserved. Text provided by the <a href="http://www.gnpcb.org/esv/share/services/">Crossway Bibles Web Service</a>.
A lot of this code is from Christian Wyglendowski found at http://www.esvapi.org/api#verse
Adapted for Drafts & Pythonista on iOS by @pfcbenjamin. More info at http://sweetnessoffreedom.wordpress.com/projects
'''
import sys
import console
import webbrowser