Skip to content

Instantly share code, notes, and snippets.

View lyquix-owner's full-sized avatar

Lyquix lyquix-owner

View GitHub Profile
@lyquix-owner
lyquix-owner / js-grid-boxes.html
Last active August 10, 2016 03:58
Places an ordered list of box elements of any size in a grid of specific dimensions.
<!DOCTYPE html>
<html lang="en">
<!-- test this at https://jsfiddle.net/lyquix/j3sss39o/ -->
<head>
<meta charset="utf-8">
<style>
.grid {
border: 1px solid #000;
position: relative;
}
@lyquix-owner
lyquix-owner / .htaccess
Created June 3, 2016 20:56
Redirect domain to www subdomain
# Redirect domain to www #
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.example.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
@lyquix-owner
lyquix-owner / .htaccess
Created June 3, 2016 20:57
Redirect any URL in domain to a page in another domain
# Redirect domain to page in another domain #
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.spanish.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/spanish [R=301,L]
@lyquix-owner
lyquix-owner / .htaccess
Created June 3, 2016 20:58
Evaluate multiple conditions that execute the same redirect rule
# Redirect multiple domains to another domain #
RewriteEngine On
RewriteCond %{HTTP_HOST} ^espanol.com$ [OR,NC]
RewriteCond %{HTTP_HOST} ^deutsch.com$ [OR,NC]
RewriteCond %{HTTP_HOST} ^suomi.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/international [R=301,L]
@lyquix-owner
lyquix-owner / .htaccess
Last active August 10, 2016 03:58
Force SSL to a whole domain
# Force domain to SSL #
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
@lyquix-owner
lyquix-owner / .htaccess
Created June 3, 2016 21:00
Force directory to use SSL
# Force directory to SSL #
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} ^/phpmyadmin/?
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
@lyquix-owner
lyquix-owner / .htaccess
Last active February 13, 2017 20:33
Redirect domain to www and force SSL
# Redirect domain to www and force SSL #
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.example.com$ [OR,NC]
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
@lyquix-owner
lyquix-owner / .htaccess
Created June 3, 2016 21:02
Maintenance redirect: temporarily redirect all pages to a maintenance page, except for images, css, js, and except specific IP address
# Maintenance Redirect
RewriteEngine On
RewriteCond %{REMOTE_ADDR} !^123\.45\.67\.89$
RewriteCond %{REQUEST_URI} !.*\.(css|jpg|jpeg|gif|png|svg|js) [NC]
RewriteCond %{REQUEST_URI} !/maintenance.html$
RewriteRule .* /maintenance.html [R=503,L]
@lyquix-owner
lyquix-owner / equalheightrows.js
Last active September 1, 2016 13:04
Equal Height Row: method for setting equal height for elements aligned in the same row
/*
equalHeightRows
Provides a method for setting equal height for elements in the same row
Requires jQuery
Add class equalheightrow to elements that you want affected by this script
On document ready run equalHeightRows.init(), optionally pass custom settings
@lyquix-owner
lyquix-owner / getbrowser.js
Last active September 10, 2023 04:24
getBrowser: function that returns the name, version and type of browser based on browser user agent
// returns the browser name, type and version, and sets body classes
// detects major browsers: IE, Edge, Firefox, Chrome, Safari, Opera, Android
// based on: https://github.com/ded/bowser
// list of user agen strings: http://www.webapps-online.com/online-tools/user-agent-strings/dv
function getBrowser(){
var ua = navigator.userAgent, browser;
// helper functions to deal with common regex
function getFirstMatch(regex) {
var match = ua.match(regex);