Skip to content

Instantly share code, notes, and snippets.

View harrypujols's full-sized avatar
👷‍♂️
Working from home

Harry Pujols harrypujols

👷‍♂️
Working from home
View GitHub Profile
@harrypujols
harrypujols / hide-phone.js
Last active October 10, 2015 03:47
Hide my phone from bots
$(function() {
var p = 'tel';
var h = '1';
var o = '212'
var n = '555'
var e = '1973';
//activates the link if it's clicked from a phone
if( navigator.userAgent.match(/Android/i) ||
navigator.userAgent.match(/webOS/i) ||
navigator.userAgent.match(/iPhone/i) ||
@harrypujols
harrypujols / hide-email.js
Last active October 10, 2015 03:47
Hide my e-mail from bots
$(function() {
var m = 'mail';
var a = 'to';
var i = '@site.com';
var l = 'foo';
$('li.email').replaceWith('<li><a href='+m+a+':'+l+i+'?subject=Hello%20from%20'+i+'>E-mail</a></li>');
});
@harrypujols
harrypujols / WordPress Theme Customizer Sample.php
Created September 17, 2012 06:50 — forked from Abban/WordPress Theme Customizer Sample.php
WordPress Theme Customizer Sample
<?php
function themename_customize_register($wp_customize){
$wp_customize->add_section('themename_color_scheme', array(
'title' => __('Color Scheme', 'themename'),
'priority' => 120,
));
// =============================
@harrypujols
harrypujols / remove-attr.js
Last active October 12, 2015 01:47
Remove title attribute from image tag
var imgs = document.getElementsByTagName('img');
for (var i = 0; i < imgs.length; i++) {
imgs[i].removeAttribute('title');
}
@harrypujols
harrypujols / blink.css
Created September 11, 2013 22:50
Blinking animation
@harrypujols
harrypujols / geturlvar.js
Last active August 3, 2021 15:21
Get the variable of an URL with JavaScript
/* lets assume in this example that the URL is www.foo.com?name=bar */
function getUrlVars() {
let vars = [], hash;
let hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++) {
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
@harrypujols
harrypujols / share-buttons.html
Last active December 22, 2015 22:39
These links behave same as social media sharing buttons, with sampleurl.com as the variable
<!-- facebook -->
<a href="https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fsampleurl.com%2F"></a>
<!-- twitter -->
<a href="https://twitter.com/intent/tweet?url=http%3A%2F%2Fsampleurl.com%2F&text=Sample&nbsp;URL"></a>
<!-- google plus -->
<a href="https://plus.google.com/share?url=http%3A%2F%2Fsampleurl.com%2F"></a>
<!-- linkedin -->
<a href="http://www.linkedin.com/shareArticle?mini=true&url=http%3A%2F%2Fsampleurl.com%2F&title=sampleURL"></a>
@harrypujols
harrypujols / _icons.scss
Last active December 27, 2015 04:29
An icon font in Compass font-face syntax
// this syntax needs Compass
@include font-face("foo", font-files("foo.woff", "foo.ttf", "foo.svg#foo"), "foo.eot", normal, normal);
[class^="foo-"], [class*="foo-"] {
font-family: 'foo';
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
@harrypujols
harrypujols / google-search-form.html
Last active December 27, 2015 14:49
Google search form
<form method="get" action="http://www.google.com/search">
<input type="text" name="q" placeholder="Search">
<input type="submit" value="Google Search" class="sprite-search">
<input type="checkbox" name="sitesearch" value="samplesite.com" checked >
</form>
// calling the sprites -- needs compass to run
// make sure the first part of the call matches the name of the folder
// inside the img folder where the separate sprite images will be located
$foo-layout: smart; // this is called as <folder>-layout - same goes with the following lines
$foo-spacing: 10px; // this doesn't seen to work when the layout is set as smart, but doesn't hurt to have it here
$foo-sprite-dimensions: true; // this will automatically add the dimensions of every image in the sprite
@import "foo/*.png"; // calls all the pngs in the folder called 'image' inside the img folder
@include all-foo-sprites; // it will add all the images in the sprite as classes in the compiled css
[class*="foo-"] {
display: inline-block;