Skip to content

Instantly share code, notes, and snippets.

View goranseric's full-sized avatar

Goran Šerić goranseric

View GitHub Profile
@goranseric
goranseric / restapi.txt
Created October 16, 2016 12:03 — forked from chrismccoy/restapi.txt
WordPress REST API Resources
A list of all of the filters available in the WP REST API v2
https://gist.github.com/BraadMartin/cd90bcfeca80e1f8f558
Laravel package for the Wordpress JSON REST API
https://github.com/Cyber-Duck/laravel-wp-api
Building a WordPress-Powered Front End With the WP REST API and AngularJS: Bootstrapping, Routing, and Services
http://code.tutsplus.com/series/building-a-wordpress-powered-front-end-with-the-wp-rest-api-and-angularjs--cms-1032
Combine Posts from Multiple Sites using the REST API
@goranseric
goranseric / css-injection.html
Created October 20, 2016 08:32 — forked from xero/css-injection.html
css style injection via jQuery. basically calling body/head append with a style tag and your own css will add a new tag and your styles to the bottom of the page/head and override any existing ones. why is this useful? imagine embedding a single js file into the page and defining your own styles (think widget for a client), or loading css via aj…
<!DOCTYPE html>
<html>
<head>
<title>css injection | xero.nu</title>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<style type="text/css">
body{
font: normal 12pt "Times New Roman", serif;
background: #ccc;
color: #000066;

#Description This AppleScript will automatically sync using a predefined Favorite and all enabled Skip Rules. I use this with Codekit to autosync files when they are processed.

##Instructions

  1. Line 2 needs to be updated with the name of the Favorite in question.
  2. For best results, set the local/remote paths directly in your favorite. If you don't, you'll need to update lines 7 and 8.

##Codekit Instructions

@goranseric
goranseric / gforms_styles.css
Created November 10, 2016 22:45 — forked from JasonHoffmann/gforms_styles.css
gravityforms-bootstrap4
.btn > .caret, .gform_button > .caret,
.dropup > .btn > .caret,
.dropup > .gform_button > .caret {
border-top-color: #000 !important;
}
.gform_fields {
padding-left: 0;
list-style: none;
margin-left: -15px;
@goranseric
goranseric / Gravity Forms Reset Styles
Created November 18, 2016 10:35 — forked from chuckreynolds/Gravity Forms Reset Styles
Gravity Forms SCSS reset styles for easy style editing and management
///////////////////////////////////////////////
////// GRAVITY FORMS RESET STYLES //////
///////////////////////////////////////////////
// These styles are made in mind to be used with SCSS or LESS
// If you use these styles, you must go to the Gravity Forms settings in the WordPress back end and set Output CSS to No.
////----- Core Containers
.gform_heading,
.gform_body,
@goranseric
goranseric / local-dev-remote-images.php
Created November 18, 2016 10:59 — forked from chuckreynolds/local-dev-remote-images.php
WordPress local dev environment plugin and config to use images from a live server instead of looking on local url path
<?php
/*
* Plugin Name: Local Dev Remote Images
* Description: this will allow a local dev environment to call all images in uploads from a remote server
* Version: 0.1
* License: GPL
* Author: @chuckreynolds
* Author URI: https://chuckreynolds.us
*/
@goranseric
goranseric / all_fields_extra_options.php
Created December 1, 2016 08:23
The Gravity Forms {all_fields} merge tag in notifications includes all fields which had data entered, it doesn't include HTML fields, Section Break descriptions, nor does it allow you to omit fields from the notification. By adding the following code to your themes functions.php file you will gain the ability to include HTML fields, and Section …
/**
* to exclude field from notification add 'exclude[ID]' option to {all_fields} tag
* 'include[ID]' option includes HTML field / Section Break field description / Signature image in notification
* see http://www.gravityhelp.com/documentation/page/Merge_Tags for a list of standard options
* example: {all_fields:exclude[2,3]}
* example: {all_fields:include[6]}
* example: {all_fields:include[6],exclude[2,3]}
*/
add_filter( 'gform_merge_tag_filter', 'all_fields_extra_options', 11, 5 );
function all_fields_extra_options( $value, $merge_tag, $options, $field, $raw_value ) {
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Updated: 2010/12/05
// License: MIT
//
// Copyright (c) 2010-2013 Diego Perini (http://www.iport.it)
//
// Permission is hereby granted, free of charge, to any person
@goranseric
goranseric / urlValidationWithRegex.php
Created December 23, 2016 12:34 — forked from akmandev/urlValidationWithRegex.php
Perfect URL Validation with Regex
<?php
// Regex Pattern By Diego Perini (https://gist.github.com/dperini/729294)
$url = 'http://github.com';
if(!preg_match('_^(?:(?:https?|ftp)://)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\x{00a1}-\x{ffff}0-9]+-?)*[a-z\x{00a1}-\x{ffff}0-9]+)(?:\.(?:[a-z\x{00a1}-\x{ffff}0-9]+-?)*[a-z\x{00a1}-\x{ffff}0-9]+)*(?:\.(?:[a-z\x{00a1}-\x{ffff}]{2,})))(?::\d{2,5})?(?:/[^\s]*)?$_iuS',$url){
echo $url. ' is NOT a valid URL';
}else{
echo $url. ' is a valid URL';
@goranseric
goranseric / movegfjstofooter.php
Created December 31, 2016 18:35 — forked from eriteric/movegfjstofooter.php
Load gravity forms JS in footer
// GF method: http://www.gravityhelp.com/documentation/gravity-forms/extending-gravity-forms/hooks/filters/gform_init_scripts_footer/
add_filter( 'gform_init_scripts_footer', '__return_true' );
// solution to move remaining JS from https://bjornjohansen.no/load-gravity-forms-js-in-footer
add_filter( 'gform_cdata_open', 'wrap_gform_cdata_open' );
function wrap_gform_cdata_open( $content = '' ) {
$content = 'document.addEventListener( "DOMContentLoaded", function() { ';
return $content;
}
add_filter( 'gform_cdata_close', 'wrap_gform_cdata_close' );