Skip to content

Instantly share code, notes, and snippets.

// only run this when NOT locally (i.e.: http://project.dev)
if ( window.location.href.indexOf('.dev') 1== false ) {
// do something
}
@yurigoytacaz
yurigoytacaz / ismobile.js
Created May 23, 2014 16:51
check if is mobile
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
@yurigoytacaz
yurigoytacaz / causeRepaint.js
Created May 23, 2014 16:54
cause repaints to update element using vw/vh on window resize
causeRepaintsOn = $('element');
$(window).resize(function() {
causeRepaintsOn.css('z-index', 1);
});
@yurigoytacaz
yurigoytacaz / detectIE.js
Created May 23, 2014 16:56
nice function to detect IE
function detectIE(){
var ua = window.navigator.userAgent;
var msie = /MSIE/.test( ua );
var trident = /Trident/.test( ua );
if( msie > 0 ){
// IE 10 or older => return version number
var msiePosition = ua.indexOf('MSIE ')+5;
return parseInt( ua.replace(/.*MSIE ([0-9]+).*/,'$1') ); // Return only the version
}
function isLocal(){
return window.location.href.indexOf('.dev') > -1;
}
// not local (prod)
if ( !isLocal() ) {
}
/*
.background {
position: fixed;
width: 100%;
height: 100%;
z-index: -1;
}
<div class="background">
<img class="img" src="bg.jpg" alt="">
@yurigoytacaz
yurigoytacaz / keypress.js
Last active December 5, 2017 18:23
key press
$(document).keydown(function(e) {
var code = (e.keyCode ? e.keyCode : e.which);
switch(code) {
case 37: // left
//e.preventDefault();
break;
case 38: // top
break;
@yurigoytacaz
yurigoytacaz / estados-cidades.json
Created December 2, 2015 20:30 — forked from letanure/estados-cidades.json
JSON estados cidades
{
"estados": [
{
"sigla": "AC",
"nome": "Acre",
"cidades": [
"Acrelândia",
"Assis Brasil",
"Brasiléia",
"Bujari",
@yurigoytacaz
yurigoytacaz / killadobe.sh
Created February 28, 2021 17:11 — forked from CyberPunkCodes/killadobe.sh
Mac Bash script to kill Adobe Create Cloud and other processes that Adobe forces on us.
#!/bin/bash
echo "\n\n--- Killing Stupid Adobe Auto Load Crap ---\n\n"
launchctl unload -w /Library/LaunchAgents/com.adobe.AdobeCreativeCloud.plist
launchctl unload -w /Library/LaunchAgents/com.adobe.AAM.Updater-1.0.plist
echo "\n\n--- Done! ---\n\n"
@yurigoytacaz
yurigoytacaz / youtubeID.js
Created December 19, 2023 19:58 — forked from takien/youtubeID.js
Get YouTube ID from various YouTube URL using JavaScript
/**
* Get YouTube ID from various YouTube URL
* @author: takien
* @url: http://takien.com
* For PHP YouTube parser, go here http://takien.com/864
*/
function YouTubeGetID(url){
var ID = '';
url = url.replace(/(>|<)/gi,'').split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/);