Skip to content

Instantly share code, notes, and snippets.

View MiguelQueiroz's full-sized avatar
🏠
Working from home

Miguel Queiroz MiguelQueiroz

🏠
Working from home
View GitHub Profile
@MiguelQueiroz
MiguelQueiroz / ObjectKeys
Created June 27, 2014 10:19
Object.keys functionality for Javascript
Object.keys = Object.keys || function(o) {
var result = [];
for(var name in o) {
if (o.hasOwnProperty(name))
result.push(name);
}
return result;
};
@MiguelQueiroz
MiguelQueiroz / toogleattribute
Created June 27, 2014 10:19
Toogle Attribute switcher for Jquery
function toggleAttr(what,attr,on_v,off_v){
what.attr(attr)==on_v?what.attr(attr,off_v):what.attr(attr,on_v);
}
function replaceAccents(s)
{
var map_char={ 'À':'A', 'Á':'A', 'Â':'A', 'Ã':'A', 'Ä':'Ae', 'Å':'A', 'Æ':'A', 'Ă':'A',
'à':'a', 'á':'a', 'â':'a', 'ã':'a', 'ä':'ae', 'å':'a', 'ă':'a', 'æ':'ae','þ':'b', 'Þ':'B',
'Ç':'C', 'ç':'c','È':'E', 'É':'E', 'Ê':'E', 'Ë':'E','è':'e', 'é':'e', 'ê':'e', 'ë':'e',
'Ğ':'G', 'ğ':'g',
'Ì':'I', 'Í':'I', 'Î':'I', 'Ï':'I', 'İ':'I', 'ı':'i', 'ì':'i', 'í':'i', 'î':'i', 'ï':'i',
'Ñ':'N','Ò':'O', 'Ó':'O', 'Ô':'O', 'Õ':'O', 'Ö':'Oe', 'Ø':'O', 'ö':'oe', 'ø':'o',
<div id="c_cookie_alert_div" style="color:red;background-color: rgba(216, 209, 209, 0.63);color: white;/* width: 100%; */margin: -8px 20%;/* padding: 9px; */font-size: small; cursor:default; text-align: center;font-family: tahoma, verdana;">
By using our website you are accepting to store cookies information which help us to deliver you a better experience. You can clear this website cookies on your browser settings <span style="cursor:pointer;" onclick="c_cookie_alert_div_r()">[X]</span>
</div>
<script>function c_cookie_alert_div_r(){document.getElementById("c_cookie_alert_div").innerHTML="";}</script>
@MiguelQueiroz
MiguelQueiroz / mini_pic_slide.js
Last active December 31, 2015 10:28
This jQuery plugin, will extend img capabilities, by creating a slide gallery effect based on a comma separated src of images. Just simple call it and you are ready to go.
//Miguel Queiroz - 2013
// A call to the jQuery lib is required.
//Converts a img element into a gallery, transitioning between pictures when loaded. Based on a string src.
/// Like: $("#img_div").pic_slide("img1.jpg, img2.png, img3...");
(function($){
$.fn.pic_slide=function(src,path){
return this.each(function(){
var span_go="";
if(src.split(",").length<2){ $(this).attr("src",""); $(this).attr("src",src).load(function(e){$(this).fadeTo(1200,1);}); return;} //case single item