Skip to content

Instantly share code, notes, and snippets.

View andredelgado's full-sized avatar

André Delgado andredelgado

  • Stratio
  • Coimbra, Portugal
View GitHub Profile
@andredelgado
andredelgado / location.js
Created November 5, 2014 17:40
get location
var lat = 0;
var longi = 0;
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
console.log("Geolocation is not supported by this browser.");
}
// Small screens
@media only screen { } /* Define mobile styles */
@media only screen and (max-width: 40em) { } /* max-width 640px, mobile-only styles, use when QAing mobile issues */
// Medium screens
@media only screen and (min-width: 40.063em) { } /* min-width 641px, medium screens */
@media only screen and (min-width: 40.063em) and (max-width: 64em) { } /* min-width 641px and max-width 1024px, use when QAing tablet-only issues */
function setCookie(cookie_name, cookie_value, expire_days) {
var date = new Date();
date.setTime(date.getTime() + (expire_days*24*60*60*1000));
var expires = "expires="+date.toUTCString();
document.cookie = cookie_name + "=" + cookie_value + "; " + expires;
}
function getCookie(cookie_name) {
var name = cookie_name + "=";
var ca = document.cookie.split(';');
@andredelgado
andredelgado / footer.php
Created August 25, 2014 19:09
wordpress skeleton theme code
@andredelgado
andredelgado / index.php
Created August 25, 2014 19:02
wordpress loop
<?php get_header(); ?>
<!-- #### THE LOOP #### -->
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<h2><?php the_title(); ?></h2>
<span class="author">Written by <?php the_author(); ?></span>
<span class="date">on <?php the_time('F jS, Y'); ?></span>
<?php the_content('(Read More...)'); ?>
<?php endwhile; else : ?>
<p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
@andredelgado
andredelgado / footer.php
Last active August 29, 2015 14:05
wordpress basic theme structure
@andredelgado
andredelgado / index.php
Last active August 29, 2015 14:05
Basic structure of Wordpress Theme's
<!DOCYTPE html>
<html>
<head>
<title>Wodpress for Dummys</title>
<link rel="stylesheet" href="<?php echo get_stylesheet_uri(); ?>" type="text/css" media="screen" />
</head>
<body>
<p>My first wordpress theme! YEY!</p>
</body>
</html>
$(function() {
var newBg = ['wp-content/themes/movein3Theme/img/slider1.jpg', 'wp-content/themes/movein3Theme/img/slider2.jpg', 'wp-content/themes/movein3Theme/img/slider3.jpg'];
var i = -1;
var rotateBg = setInterval(function(){
if(i==3)
i = 1;
else
i++;
$('#slider').css({backgroundImage : 'url(' + newBg[i] + ')'});
}, 5000);