Skip to content

Instantly share code, notes, and snippets.

View akmur's full-sized avatar

Alessandro Muraro akmur

View GitHub Profile
@akmur
akmur / Tablet Resolutions Regex
Created August 8, 2017 13:16
Tablet Resolutions Regex
^([7-9][0-9][0-9]|[0-1][0-0][0-5][0-9])x([1-8][0-9][0-9]|[1-9][0-9][0-9][0-9])$
the first three groups of numbers are for 768 numbers, assuming you are not interested in mobiles for example
@akmur
akmur / geolocation.js
Created March 14, 2017 16:50
Geolocation Module
/* global document google */
/**
* This file contains code for the maps found in the website.
* It takes care of converting an address to a location by using google's geocode code.
*
* @summary Map Loader
*/
const mapLoader = (function(){
@akmur
akmur / swipe.js
Created March 2, 2017 13:52 — forked from wiesys/swipe.js
A simple swipe detection on vanilla js
var touchstartX = 0;
var touchstartY = 0;
var touchendX = 0;
var touchendY = 0;
var gesuredZone = document.getElementById('gesuredZone');
gesuredZone.addEventListener('touchstart', function(event) {
touchstartX = event.changedTouches[0].pageX;
touchstartY = event.changedTouches[0].pageY;
@akmur
akmur / stickyheader.js
Last active April 9, 2016 11:21
Sticky Header script
var App = (function () {
// Sticky Header
var stickyHeader = function (navElement) { // needs the ID of the element
this.nav = document.getElementById(navElement);
this.siteBody = document.getElementsByTagName("body")[0];
this.stuck = false;
this.stickPoint = this.getDistance();
};
@akmur
akmur / package.json
Created March 5, 2016 22:46 — forked from addyosmani/package.json
npm run-scripts boilerplate
{
"name": "my-app",
"version": "1.0.0",
"description": "My test app",
"main": "src/js/index.js",
"scripts": {
"jshint:dist": "jshint src/js/*.js'",
"jshint": "npm run jshint:dist",
"jscs": "jscs src/*.js",
"browserify": "browserify -s Validating -o ./dist/js/build.js ./lib/index.js",
@akmur
akmur / cookie-policy-checker.js
Last active August 29, 2015 14:22
Cookie Policy Checker
if( function_exists('acf_add_options_page') ) {
acf_add_options_page(array(
'page_title' => 'Options',
'menu_title' => 'Options',
'menu_slug' => 'options',
'capability' => 'edit_posts',
'redirect' => false
));
<ul>
<li class="share-text">Share this>/li>
<li class="share-tw"><a href="http://twitter.com/share?text=[title]"><span></span></a></li>
<li class="share-fb"><a href="http://www.facebook.com/sharer.php?u=/node/[nid]&p=[title]"><span></span></a></li>
<li class="share-pinterest"><a href="http://pinterest.com/pin/create/button/?url=/node/[nid]&description=[title]"><span></span></a></li>
</ul>
@akmur
akmur / social_manual_sharing.php
Last active August 29, 2015 14:11
Social Manual Sharing, goes in functions.php
function output_social_links() {
global $post;
$permalink = get_permalink($post->ID);
$title = get_the_title();
$content = '
<section class="sharing"
<ul>
<li>
<a href="http://www.facebook.com/share.php?u=' . urlencode($permalink) . '&title=' . urlencode($title) . '" class="icon-share_facebook_30x30 social-fb" target="_blank">FB</a>
</li>
@akmur
akmur / .gitignore
Last active August 29, 2015 14:08 — forked from salcode/.gitignore
# -----------------------------------------------------------------
# .gitignore for WordPress
# -----------------------------------------------------------------
# ignore everything in the root except the "wp-content" directory.
/*
!wp-content/
# ignore all files starting with .
.*