Skip to content

Instantly share code, notes, and snippets.

View owldesign's full-sized avatar
🔥
making stuff

Vadim Goncharov owldesign

🔥
making stuff
View GitHub Profile
@owldesign
owldesign / mobile_detection.js
Created October 30, 2019 23:27
Mobile Detection in Javascript
// detect if mobile browser. regex -> http://detectmobilebrowsers.com
var isMobile = (function(a){return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|iko
@owldesign
owldesign / gist:cbdee7fff6db64b18d948ee8cc639161
Created June 20, 2019 03:42
Force open app when Apple says app is damaged and need to move to trash
sudo xattr -rd com.apple.quarantine /Applications/AppNameHere.app
@owldesign
owldesign / gist:864c0127e18918ad64402744080af4ec
Created September 27, 2018 15:55
Craft CMS 3 Sending Mail through a plugin
use craft\mail\Message;
/**
* @param $html
* @param $subject
* @param null $mail
* @param array $attachments
* @return bool
*/
private function sendMail($html, $subject, $mail = null, array $attachments = array()): bool
@owldesign
owldesign / states_hash.json
Created April 4, 2017 21:36 — forked from mshafrir/states_hash.json
US states in JSON form
{
"AL": "Alabama",
"AK": "Alaska",
"AS": "American Samoa",
"AZ": "Arizona",
"AR": "Arkansas",
"CA": "California",
"CO": "Colorado",
"CT": "Connecticut",
"DE": "Delaware",
@owldesign
owldesign / Check IE10
Created March 14, 2016 21:19
Web Detection Tools
<!--[if !IE]><!--><script>if(/*@cc_on!@*/false){document.documentElement.className+=' ie10';}</script><!--<![endif]-->
@owldesign
owldesign / inputplaceholder
Created January 6, 2016 22:44
IE9 Placeholder Fallback
//IE9 placeholder fallback
//credits http://www.hagenburger.net/BLOG/HTML5-Input-Placeholder-Fix-With-jQuery.html
if(!Modernizr.input.placeholder){
$('[placeholder]').focus(function() {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
input.val('');
}
}).blur(function() {
var input = $(this);
@owldesign
owldesign / gist:6600712
Created September 17, 2013 21:12
Coffee Script Cookies
#######################################################
# Chocolate Chip Cookies setter+getter
#######################################################
createCookie = (name, value, expires, path, domain) ->
cookie = name + "=" + escape(value) + ";"
if expires
if expires instanceof Date
expires = new Date() if isNaN(expires.getTime())
else
expires = new Date(new Date().getTime() + parseInt(expires) * 1000 * 60 * 60 * 24)
@owldesign
owldesign / gist:5154692
Created March 13, 2013 18:14
Fetch Manage
{
"files":
{
"fancybox": "https://raw.github.com/cdnjs/cdnjs/master/ajax/libs/fancybox/2.1.4/jquery.fancybox.pack.js",
"font-awesome": "https://raw.github.com/FortAwesome/Font-Awesome/master/css/font-awesome.min.css",
"html5shiv": "https://raw.github.com/aFarkas/html5shiv/master/dist/html5shiv.js",
"jquery": "http://code.jquery.com/jquery.min.js",
"jquery1.8": "http://code.jquery.com/jquery-1.8.3.min.js",
"modernizr": "https://raw.github.com/cdnjs/cdnjs/master/ajax/libs/modernizr/2.6.2/modernizr.min.js",
"moments": "https://raw.github.com/timrwood/moment/develop/min/moment.min.js",
@owldesign
owldesign / samplecode.twig
Created November 17, 2015 01:57
Frontend Sample Code
{% if entry.selectForm != '0' %}
{% set form = craft.formBuilder2.getFormById(entry.selectForm) %}
{{ form |raw }}
{% endif %}
@owldesign
owldesign / gist:74bf0c13cfa59e1c3bbd
Created June 18, 2015 18:52
HTML5 Page Structure
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Your Website</title>
</head>
<body>