Skip to content

Instantly share code, notes, and snippets.

Avatar
🐨

Wojtczyk awojtczyk

🐨
  • Wrocław
View GitHub Profile
@awojtczyk
awojtczyk / search-form.js
Created Dec 15, 2017
Shopify ajax search
View search-form.js
$(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({
View 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 Mar 8, 2017 — forked from sibelius/learning.md
Learning Path React Native
View learning.md

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

View SVG upload wordpress 4.7.1.php
// 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 );
View WPML Remove duplicated media
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'
View SVG wordpress.txt
function cc_mime_types($mimes) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter('upload_mimes', 'cc_mime_types');
View Ionic2 Basic start
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 Sep 13, 2016
jQuery / javaScript placeholders fix
View Placeholders fix..js
$('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 Sep 13, 2016
Elastic Header Ionic2
View ElasticHeader.ts
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
View Ionic Http Requests.js
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>();
You can’t perform that action at this time.