Skip to content

Instantly share code, notes, and snippets.

View DevCabin's full-sized avatar

George Featherstone DevCabin

View GitHub Profile
@Abban
Abban / WordPress Theme Customizer Sample.php
Created June 21, 2012 21:09
WordPress Theme Customizer Sample
<?php
function themename_customize_register($wp_customize){
$wp_customize->add_section('themename_color_scheme', array(
'title' => __('Color Scheme', 'themename'),
'priority' => 120,
));
// =============================
@carolineschnapp
carolineschnapp / gist:5397337
Last active January 20, 2023 10:11
Sample JavaScript file added with ScriptTag resource. This sample file is meant to teach best practices. Your app will load jQuery if it's not defined. Your app will load jQuery if jQuery is defined but is too old, e.g. < 1.7.
/* Sample JavaScript file added with ScriptTag resource.
This sample file is meant to teach best practices.
Your app will load jQuery if it's not defined.
Your app will load jQuery if jQuery is defined but is too old, e.g. < 1.7.
Your app does not change the definition of $ or jQuery outside the app.
Example: if a Shopify theme uses jQuery 1.4.2, both of these statements run in the console will still return '1.4.2'
once the app is installed, even if the app uses jQuery 1.9.1:
jQuery.fn.jquery => "1.4.2"
$.fn.jquery -> "1.4.2"
*/
@carolineschnapp
carolineschnapp / gist:9122054
Last active October 25, 2024 16:31
Order form to use in a page or collection template.
{% comment %}
Source: https://gist.github.com/carolineschnapp/9122054
If you are not on a collection page, do define which collection to use in the order form.
Use the following assign statement, replace 'your-collection-handle-here' with your collection handle.
{% assign collection = collections.your-collection-handle-here %}
Use the assign statement outside of this comment block at the top of your template.
{% endcomment %}
{% paginate collection.products by 100 %}
@chriswallace
chriswallace / theme-fonts.php
Last active April 28, 2017 21:46
Typecase theme support declaration for WordPress themes.
<?php
/**
* Declares support for font families within your WordPress theme.
*
* By adding this code to your theme, it notifies the Typecase plugin
* that your theme allows for custom font locations that can be modified via
* the Customizer.
*/
add_theme_support( 'typecase', array(
{
"vars": {
"@gray-base": "#000",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
"@gray-light": "lighten(@gray-base, 46.7%)",
"@gray-lighter": "lighten(@gray-base, 93.5%)",
"@brand-primary": "darken(#428bca, 6.5%)",
"@brand-success": "#5cb85c",
@robgolbeck
robgolbeck / WordPress Sample Theme Customizer
Last active April 28, 2017 21:46
WordPress Sample Theme Customizer
<?php
// Sample Theme Customizer Options for WordPress
// This example allows you to upload your logo, add your contact info, and add your social media links.
// Reference: https://codex.wordpress.org/Theme_Customization_API
// See also: http://themefoundation.com/wordpress-theme-customizer/
// Add the following to functions.php (or put it in a separate file - e.g. theme-customizer.php - and call it from functions.php)
new theme_customizer();
class theme_customizer
@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.

var Pixi = require("pixi.js")
var Afloop = require("afloop")
var Keyb = require("keyb")
var WIDTH = 230
var HEIGHT = 130
var STAR_COUNT = 30
var renderer = Pixi.autoDetectRenderer(WIDTH, HEIGHT)
renderer.backgroundColor = 0x222222
class App extends React.PureComponent {
constructor(props) {
super(props);
this.state = {
counter: 0,
showWindowPortal: false,
};
this.toggleWindowPortal = this.toggleWindowPortal.bind(this);
@thecreazy
thecreazy / chiccocoin.js
Created January 24, 2018 10:36
Gist used for the blockchain article on medium
const Blockchain = require('./blockchain')
const { validationResult } = require('express-validator/check')
class Chiccocoin {
constructor () {
this.blockchain = new Blockchain()
this.getChain = this.getChain.bind(this)
this.mine = this.mine.bind(this)
this.newTransaction = this.newTransaction.bind(this)
}