Skip to content

Instantly share code, notes, and snippets.

View awojtczyk's full-sized avatar
🐨

Andrzej Wojtczyk awojtczyk

🐨
View GitHub Profile
@awojtczyk
awojtczyk / search-form.js
Created December 15, 2017 10:08
Shopify ajax search
$(function() {
var currentAjaxRequest = null;
var searchForms = $('form[action="/search"]').css('position', 'relative').each(function() {
var input = $(this).find('input[name="q"]');
input.attr('autocomplete', 'off').bind('keyup change', function() {
var term = $(this).val();
var form = $(this).closest('form');
var searchURL = '/search?type=product&q=*' + term + '*';
var resultsList = $('.search-results');
resultsList.perfectScrollbar({
@awojtczyk
awojtczyk / search.json.liquid
Created December 15, 2017 09:50
search.json.liquid
{% layout none %}
{% capture results %}
{% for item in search.results %}
{% assign product = item %}
{
"title" : {{ product.title | json }},
"url" : {{ product.url | within: product.collections.last | json }},
"thumbnail": {{ product.featured_image.src | product_img_url: 'thumb' | json }}
}
{% unless forloop.last %},{% endunless %}
@awojtczyk
awojtczyk / learning.md
Created March 8, 2017 16:43 — forked from sibelius/learning.md
Learning Path React Native

Basics

  • Learn how to start a new react native project
  • Run it on ios simulator, on android emulator, on a real iPhone device and on a real Android device, with and without debugging enabled.
  • Learn how to upgrade a react native project
  • Learn how to add a package to the project
  • Learn how to add a package that has a native dependency (https://github.com/airbnb/react-native-maps, https://github.com/evollu/react-native-fcm) - DO NOT USE COCOAPODS
  • Learn how to use fetch to get data from your backend

Learn Navigation

// Allow SVG
add_filter( 'wp_check_filetype_and_ext', function($data, $file, $filename, $mimes) {
global $wp_version;
if ( $wp_version !== '4.7.1' ) {
return $data;
}
$filetype = wp_check_filetype( $filename, $mimes );
DELETE FROM wp_posts WHERE
ID IN
(
SELECT element_id FROM wp_icl_translations WHERE element_type = 'post_attachment' AND language_code != 'en'
)
DELETE FROM wp_postmeta WHERE
meta_key= '_thumbnail_id' AND meta_value IN
(
SELECT element_id FROM wp_icl_translations WHERE element_type = 'post_attachment' AND language_code != 'en'
function cc_mime_types($mimes) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter('upload_mimes', 'cc_mime_types');
ionic start MyFirstApp sidemenu --v2
cd MyFirstApp
ionic g page Login
ionic g page Signup
ionic g page List
ionic g provider Data
ionic g provider ChecklistModel
ionic platform add ios
ionic platform add android
ionic plugin add https://github.com/litehelpers/Cordova-sqlite-storage
@awojtczyk
awojtczyk / Placeholders fix..js
Created September 13, 2016 20:59
jQuery / javaScript placeholders fix
$('input:text, textarea').each(function(){
var $this = $(this);
$this.data('placeholder', $this.attr('placeholder'))
.focus(function(){$this.removeAttr('placeholder');})
.blur(function(){$this.attr('placeholder', $this.data('placeholder'));
});
});
@awojtczyk
awojtczyk / ElasticHeader.ts
Created September 13, 2016 20:58
Elastic Header Ionic2
import {Directive, ElementRef} from 'angular2/core';
import {Subject} from "rxjs/Subject";
import {Content, IonicApp} from "ionic-angular/index";
/*
* WIP mashup of
* http://www.joshmorony.com/how-to-create-a-directive-in-ionic-2-parallax-header/
* and ionic2 infinite scroll techniques to access properties
* and http://codepen.io/kaemak/pen/mHyKa
* to get desired behaviour on scroll up/down
@awojtczyk
awojtczyk / Ionic Http Requests.js
Created September 13, 2016 20:58
Ionic2 Http requests
import {Injectable, EventEmitter} from 'angular2/core';
import {Http, Headers, RequestOptions, RequestOptionsArgs, Response, RequestMethod, Request, Connection, ConnectionBackend} from 'angular2/http';
import * as Rx from 'rxjs';
export enum Action { QueryStart, QueryStop };
@Injectable()
export class AuthHttp {
process: EventEmitter<any> = new EventEmitter<any>();