Skip to content

Instantly share code, notes, and snippets.

View gemmadlou's full-sized avatar

Gemma Black gemmadlou

View GitHub Profile
@gemmadlou
gemmadlou / styles.css
Created January 15, 2016 08:25 — forked from pburtchaell/styles.css
VH and VW units can cause issues on iOS devices. To overcome this, create media queries that target the width, height, and orientation of iOS devices.
/**
* VH and VW units can cause issues on iOS devices: http://caniuse.com/#feat=viewport-units
*
* To overcome this, create media queries that target the width, height, and orientation of iOS devices.
* It isn't optimal, but there is really no other way to solve the problem. In this example, I am fixing
* the height of element `.foo` —which is a full width and height cover image.
*
* iOS Resolution Quick Reference: http://www.iosres.com/
*/
<?php
function free_and_premium() {
vc_map( array(
"name" => __("Premium", "js_composer"),
"base" => "premium",
"content_element" => true,
"category" => "content>",
"show_settings_on_create" => false,
"params" => array(
// add params same as with any other content element
@gemmadlou
gemmadlou / getCache.js
Created June 18, 2016 09:04 — forked from contolini/getCache.js
Memoization of jQuery's $.getJSON() to use localStorage for caching.
var getCache = function(url) {
var supportsLocalStorage = 'localStorage' in window;
// Both functions return a promise, so no matter which function
// gets called inside getCache, you get the same API.
function getJSON(url) {
var promise = $.getJSON(url);
@gemmadlou
gemmadlou / acf-field-registration-example.php
Created September 5, 2016 09:47 — forked from mgburns/acf-field-registration-example.php
Example programmatic registration of Advanced Custom Fields fields
<?php
/**
* Example programmatic registration of Advanced Custom Fields fields
*
* @see http://www.advancedcustomfields.com/resources/register-fields-via-php/
*/
function register_custom_acf_fields() {
if ( function_exists( 'acf_add_local_field_group' ) ) {
@gemmadlou
gemmadlou / gulpfile.js
Created September 12, 2016 13:12 — forked from sagalbot/gulpfile.js
Laravel Elixir + Vueify + Hot Reload. This will get you up and running with Browserify HMR + Vueify + BrowserSync in no time.
var elixir = require('laravel-elixir');
var gutil = require('gulp-util');
// If 'gulp watch' is run
if (gutil.env._.indexOf('watch') > -1) {
// Enable watchify for faster builds
elixir.config.js.browserify.watchify.enabled = true
@gemmadlou
gemmadlou / custom-tinymce-0.php
Created October 18, 2016 16:03 — forked from chrisvanpatten/custom-tinymce-0.php
Register custom style formats to TinyMCE in WordPress
<?php
/**
* custom_tinymce
*/
function vpm_custom_tinymce( $settings ) {
// Define our custom formats
$style_formats = array(
array(
@gemmadlou
gemmadlou / sass-lint.yml
Created October 20, 2016 10:03 — forked from DanielHudson/sass-lint.yml
Sass linting options
# sass-lint config generated by make-sass-lint-config v0.1.2
#
# The following scss-lint Linters are not yet supported by sass-lint:
# DisableLinterReason, ElsePlacement, PropertyCount, SelectorDepth
# SpaceAroundOperator, TrailingWhitespace, UnnecessaryParentReference, Compass::*
#
# The following settings/values are unsupported by sass-lint:
# Linter Indentation, option "allow_non_nested_indentation"
# Linter Indentation, option "character"
# Linter NestingDepth, option "ignore_parent_selectors"
@gemmadlou
gemmadlou / oembed-filter.php
Created October 20, 2016 15:38 — forked from martinjohnyoung/oembed-filter.php
Add a wrapper around oembed objects in WordPress. Should be added to your theme's functions.php
<?php
function funkshun_responsive_videos($html, $url, $attr, $post_id) {
return '<div class="video-wrapper">' . $html . '</div>';
}
add_filter('embed_oembed_html', 'funkshun_responsive_videos', 99, 4);
?>
@gemmadlou
gemmadlou / test.php
Created October 27, 2016 09:56 — forked from mikedfunk/test.php
phpdoc and psr-2 class example
<?php
/**
* Description
*
* @package RacingJunk
* @copyright 2014 Internet Brands, Inc. All Rights Reserved.
*/
namespace InternetBrands\RacingJunk;
/**
@gemmadlou
gemmadlou / swipe.js
Created August 26, 2017 17:07 — forked from SleepWalker/swipe.js
A simple swipe detection on vanilla js
var touchstartX = 0;
var touchstartY = 0;
var touchendX = 0;
var touchendY = 0;
var gesuredZone = document.getElementById('gesuredZone');
gesuredZone.addEventListener('touchstart', function(event) {
touchstartX = event.screenX;
touchstartY = event.screenY;