Skip to content

Instantly share code, notes, and snippets.

View iamkevingreen's full-sized avatar
💭
🍝 🍝 🍝 🍝 🍝 🍝

Kevin Green iamkevingreen

💭
🍝 🍝 🍝 🍝 🍝 🍝
View GitHub Profile
...
<fieldType name="string" class="solr.StrField" omitNorms="true">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StandardFilterFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.PorterStemFilterFactory"/>
<filter class="solr.EdgeNGramFilterFactory" minGramSize="2" maxGramSize="15" side="front"/>
</analyzer>
@iamkevingreen
iamkevingreen / new_gist_file
Created June 10, 2013 16:13
PNG fallback for SVG background images
var svgSupport = (window.SVGSVGElement) ? true : false;
if (svgSupport == false || $.browser.msie == true) {
$('.svg').each(function(){
var svgBI = $(this).css('background-image');
if (svgBI.indexOf("svg") > -1){
pngBI = svgBI.replace('svg', 'png');
$(this).css('background-image',pngBI);
};
})
@iamkevingreen
iamkevingreen / new_gist_file
Created June 13, 2013 01:26
Featured image of Parent page
<?php global $post;
if (isset($post)) {
//get the ancestors
$familyTree = get_ancestors($post->ID,'page');
array_unshift( $familyTree, $post->ID ); //add the current page to the begining of the list
//loop through the family tree until you find a result or exhaust the array
$featuredImage = '';
foreach ( $familyTree as $family_postid ) {
@iamkevingreen
iamkevingreen / new_gist_file
Created July 11, 2013 15:26
Placeholder FIX for IE (js)
(function($) {
$.fn.placeholder = function() {
if(typeof document.createElement("input").placeholder == 'undefined') {
$('[placeholder]').focus(function() {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
input.removeClass('placeholder');
}
}).blur(function() {
@iamkevingreen
iamkevingreen / new_gist_file
Created August 16, 2013 18:14
SVG Fallbacks
<svg width="96" height="96">
<image xlink:href="svg.svg" src="svg.png" width="96" height="96"/>
</svg>
And here the magic: browsers which support SVG will read the code as:
<svg width="96" height="96">
<image xlink:href="svg.svg" width="96" height="96"/>
</svg>
ignoring src attribute and will show SVG image.
@iamkevingreen
iamkevingreen / htaccess gzip
Created October 9, 2013 15:13
Gzip htaccess
# 480 weeks
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Cache-Control "max-age=290304000, public"
</FilesMatch>
# 2 DAYS
<FilesMatch "\.(xml|txt)$">
Header set Cache-Control "max-age=172800, public, must-revalidate"
</FilesMatch>
/**
* Shopify Client API
*/
var Shopify = {}
var API = Shopify.API = function ShopifyAPI(options) {
this.config = {
shop: options.shop,
let scrollPosition = 0;
let setPosition = () => {
if (window.pageYOffset !== undefined) {
scrollPosition = window.pageYOffset;
} else {
scrollPosition = (document.documentElement || document.body.parentNode || document.body).scrollTop;
}
};
window.addEventListener('scroll', handleScrolling);
let handleScrolling = () => {
Parallax.init(imageFloatTwo, -4.3);
Parallax.init(imageFloatThree, -2);
Parallax.init(earnedImageTwo, -7);
Parallax.init(earnedImageThree, -13);
Parallax.init(sparkText, -13);
Parallax.init(heroText, -13);
Parallax.init(imageFloatOne, -6);
}