Skip to content

Instantly share code, notes, and snippets.

View siamkreative's full-sized avatar

Julien Vernet siamkreative

View GitHub Profile
@siamkreative
siamkreative / bs-cf7.less
Last active August 29, 2015 14:08
Contact Form 7 & Bootstrap 3
/*
==========================================================================
Import Bootstrap Stuff
==========================================================================
*/
/* Core variables and mixins */
@import "less/variables.less";
@import "less/mixins/vendor-prefixes.less";
@import "less/mixins/alerts.less";
@siamkreative
siamkreative / cf7-horizontal-form.html
Last active July 14, 2020 23:58
Contact Form 7 Horizontal Form
<div class="form-horizontal">
<div class="form-group"><label class="control-label col-md-3">Full Name</label><div class="col-md-9">[text* your-name class:form-control]</div></div>
<div class="form-group"><label class="control-label col-md-3">Email Address</label><div class="col-md-9">[email* your-email class:form-control]</div></div>
<div class="form-group"><label class="control-label col-md-3">Subject</label><div class="col-md-9">[text your-subject class:form-control]</div></div>
<div class="form-group"><label class="control-label col-md-3">Message</label><div class="col-md-9">[textarea your-message x5 class:form-control]</div></div>
<div class="form-group"><div class="col-md-offset-3 col-md-9">[submit class:btn class:btn-primary "Send"]</div></div>
</div>
@siamkreative
siamkreative / cf7-form-no-label.html
Created November 3, 2014 08:08
Contact Form 7 Form without Labels
<div class="row">
<div class="col-md-6 form-group"><label class="sr-only">Full Name</label>[text* your-name class:form-control placeholder "Full Name"]</div>
<div class="col-md-6 form-group"><label class="sr-only">Email Address</label>[email* your-email class:form-control placeholder "Email Address"]</div>
</div>
<div class="form-group"><label class="sr-only">Subject</label>[text your-subject class:form-control placeholder "Subject"]</div>
<div class="form-group"><label class="sr-only">Message</label>[textarea your-message x5 class:form-control placeholder "message"]</div>
<div class="form-group">[submit class:btn class:btn-primary "Send"]</div>
@siamkreative
siamkreative / tinyMCE-check.js
Created November 28, 2014 09:12
A simple script to check whether TinyMCE is active and visible in WordPress Dashboard
jQuery(document).ready(function ($) {
'use strict';
/*
References
http://codeblow.com/questions/method-to-check-whether-tinymce-is-active-in-wordpress/
https://wordpress.org/support/topic/tinymceactiveeditorgetcontentcontent-does-not-work-with-tinymce-advanced
*/
@siamkreative
siamkreative / edd-ajax-custom.js
Created January 27, 2015 02:57
EDD AJAX: Using Easy Digital Downloads with AJAX (on the Front-End)
$('.buy-now').on('click', function (event) {
event.preventDefault();
var el = $(this),
item_download = el.attr('data-id'),
current_page = el.attr('data-current'),
item_price_id = false;
$.ajax({
type: 'POST',
@siamkreative
siamkreative / wpadminbar.js
Created February 17, 2015 07:44
Update Javascript Variable if WordPress Admin Bar is enabled
jQuery(document).ready(function ($) {
// The long version
var scrollOffset;
if ($('body').hasClass('admin-bar')) {
scrollOffset = 64;
} else {
scrollOffset = 32;
}
@siamkreative
siamkreative / eurozone.json
Created April 2, 2015 08:32
Eurozone JSON data from http://en.wikipedia.org/wiki/Eurozone (crawled on 2015-04-02)
[
{
"State": "Austria",
"Adopted": "1999-01-01[15]",
"PreviousCurrency": "Schilling",
"ISO": "AT"
},
{
"State": "Belgium",
"Adopted": "1999-01-01[15]",
@siamkreative
siamkreative / google-analytics-redirect.html
Created September 29, 2015 10:05
Tracking QR Codes with Google Analytics
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Interstitial Tracking Page</title>
<!-- Google Analytics | https://developers.google.com/analytics/devguides/collection/analyticsjs/advanced?hl=en -->
<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
@siamkreative
siamkreative / french-regions-departments.json
Last active November 26, 2021 02:31
Regions & Departments of France (JSON format). Régions et Départements de France (format JSON). Inspired from https://en.wikipedia.org/wiki/Regions_of_France & https://en.wikipedia.org/wiki/Departments_of_France
{
"regions": {
"alsace": [67, 68],
"aquitaine": [40, 47, 33, 24, 64],
"auvergne": [43, 3, 15, 63],
"basse-normandie": [14, 61, 50],
"bourgogne": [21, 58, 71, 89],
"bretagne": [29, 35, 22, 56],
"centre": [45, 37, 41, 28, 36, 18],
"champagne-ardenne": [10, 8, 52, 51],
<?php
/* Strip out un-supported HTML tags */
$content = strip_tags($content, '<strong><em><del><li><code><pre>');
/* Properly format message */
$content = str_replace(array('<strong>', '</strong>'), array('*', '*'), $content);
$content = str_replace(array('<em>', '</em>'), array('_', '_'), $content);
$content = str_replace(array('<del>', '</del>'), array('~', '~'), $content);
$content = str_replace(array('<li>', '</li>'), array('•', ''), $content);