Skip to content

Instantly share code, notes, and snippets.

View umkasanki's full-sized avatar

Oleg Tishkin umkasanki

View GitHub Profile
@umkasanki
umkasanki / low-search-ajax.js
Created April 12, 2016 15:21 — forked from low/low-search-ajax.js
Using Low Search for ExpressionEngine with Ajax. Change any of the three variables on top to suit your needs. Tested with jQuery 1.9.0.
(function($){
$(function(){
var $form = $('#search'), // Search form
$target = $('#results'), // Results container
rp = 'search/ajax-results'; // Template for results only
// Function to execute on success
var success = function(data, status, xhr) {
$target.html(data);
};
@umkasanki
umkasanki / check-size-and-orientation.js
Created January 16, 2017 11:28 — forked from addisonhall/check-size-and-orientation.js
Get screen width, height, and orientation
// ----------------------------------------------
// Detect screen orientation
// ----------------------------------------------
var deviceOrientation = ''; // Declare globally to use throughout
function detectOrientation () {
var windowWidth = $(window).height();
var windowHeight = $(window).width();
if (windowWidth > windowHeight) {
deviceOrientation = 'landscape';
} else {
@umkasanki
umkasanki / detect-orientation.js
Created January 16, 2017 11:30 — forked from addisonhall/detect-orientation.js
Detect screen orientation (landscape or portrait)
// Declare globally to use throughout
var deviceOrientation = '';
// ----------------------------------------------------
// Detect screen orientation
// ----------------------------------------------------
function detectOrientation() {
var height = $(window).height();
var width = $(window).width();
if(width > height) {
@umkasanki
umkasanki / gzip-compression
Created January 16, 2017 11:30 — forked from addisonhall/gzip-compression
Gzip configuration that works for now...
# gzip compression -- make it faster!
SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/x-javascript application/x-httpd-php
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip
Header append Vary User-Agent env=!dont-vary
@umkasanki
umkasanki / import.php
Created March 7, 2017 11:54 — forked from lukeholder/import.php
Basic example to import Products and their variants into Craft Commerce
<?php
namespace Craft;
// This file could be placed into your public_html folder and visited to import a cheese product.
$craft = require '../craft/app/bootstrap.php';
$craft->plugins->loadPlugins();
$newProduct = new Commerce_ProductModel();
@umkasanki
umkasanki / templating.md
Created April 5, 2017 11:06 — forked from brandonkelly/templating.md
Templating in EE vs. Craft
@umkasanki
umkasanki / css
Last active May 2, 2017 13:33
Example Base Styles
body, form {
margin: 0;
padding: 0;
}
a {
color: #039;
}
a:hover {
@umkasanki
umkasanki / preparse srcset
Created February 23, 2018 05:44
Предварительная нарезка и сжатие изображений с сохранением путей в json.
{% spaceless %}
{% set srcsets = [] %}
{% for image in entry.images %}
{% set imgSize = max(image.width, image.height) %}
{% set transformedImages = craft.imager.transformImage(image, [
{ width: imgSize >= 1200 ? 1200 : imgSize, jpegQuality: 90 },
{ width: imgSize >= 1000 ? 1000 : imgSize, jpegQuality: 90 },
{ width: 600 },
@umkasanki
umkasanki / elementPosition.js
Last active March 9, 2018 08:44
jQuery offset of element in relation to viewport
photo = $('#photo')
offset = photo.offset()
photoViewportOffsetTop = offset.top - $(document).scrollTop()
photoViewportOffsetLeft = offset.left - $(document).scrollLeft()
@umkasanki
umkasanki / delete-heroku-apps.sh
Created April 12, 2018 05:39 — forked from naaman/delete-heroku-apps.sh
Delete all heroku apps from bash terminal -- no script file required
for app in $(heroku apps); do heroku apps:destroy --app $app --confirm $app; done