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 / 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
@umkasanki
umkasanki / gist:60ce5890213a417f044f44934ec2ed35
Created August 31, 2018 15:28 — forked from devraj/gist:ca0048d136a61bc0de95
Google Maps v3 Custom retina marker from a sprite sheet with 2x and 3x support
var hqLocation = new google.maps.LatLng(-35.107231, 147.369983);
var mapOptions = {
zoom: 17,
minZoom: 17,
maxZoom: 17,
center: hqLocation,
scrollwheel: false,
disableDefaultUI: true,
keyboardShortcuts: false,
@umkasanki
umkasanki / _base.twig
Created September 3, 2018 06:13 — forked from wesrice/_base.twig
Sample Modular Templating for Craft CMS - Inspired by principles from https://smacss.com/.
<!DOCTYPE html>
<head>
{# Base #}
{% includeCssFile 'layouts/base/css/base.css' %}
{% includeJsFile 'layouts/base/js/base.js' %}
{# Header #}
{% includeCssFile 'modules/header/css/header.css' %}
{% includeJsFile 'modules/header/js/header.js' %}
@umkasanki
umkasanki / url-segment.js
Created September 11, 2018 11:45 — forked from jserrao/url-segment.js
Get Last Segment of a URL in Javascript
var pageURL = window.location.href;
var lastURLSegment = pageURL.substr(pageURL.lastIndexOf('/') + 1);
console.log(lastURLSegment);