Skip to content

Instantly share code, notes, and snippets.

View schalkburger's full-sized avatar
💪
eat sleep code repeat

Schalk Burger schalkburger

💪
eat sleep code repeat
View GitHub Profile
@schalkburger
schalkburger / header-image-seo.html
Created February 16, 2015 13:56
Best SEO for header image
<h1>
<a href="http://stackoverflow.com">
<img src="logo.png" alt="Stack Overflow" title="Click to return to Stack Overflow homepage" />
</a>
</h1>
@schalkburger
schalkburger / subtle-transition.css
Created February 16, 2015 14:01
Subtle CSS transition effect
.subtle-transition {
-webkit-transition: all 0.3s ease-out; /* Chrome 1-25, Safari 3.2+ */
-moz-transition: all 0.3s ease-out; /* Firefox 4-15 */
-o-transition: all 0.3s ease-out; /* Opera 10.50–12.00 */
transition: all 0.3s ease-out;
}
@schalkburger
schalkburger / wordpress-open-graph-meta.php
Created February 16, 2015 14:07
Wordpress Open Graph Meta tags
<meta property="og:url" content="<?php the_permalink() ?>"/>
<meta property="og:title" content="<?php single_post_title(''); ?>" />
<meta property="og:description" content="<?php echo strip_tags(get_the_excerpt($post->ID)); ?>" />
<meta property="og:type" content="article" />
<meta property="og:image" content="<?php // Get the thumbnail image with size of 1200 x 630
$src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array(1200,630), false, '' ); echo $src[0]; ?>" /> // Set
@schalkburger
schalkburger / sample-table.html
Created February 16, 2015 14:12
Sample table
<table class="table">
<thead>
<tr>
<th>#</th>
<th>First Name</th>
<th>Last Name</th>
<th>Username</th>
</tr>
</thead>
<tbody>
@schalkburger
schalkburger / replace-css.js
Created February 16, 2015 14:14
JavaScript replace CSS style
javascript:$('link').remove();$('head').append($('<link rel="stylesheet" type="text/css" href="//www.schalkburger.za.net/other.css"/>'));void 0
@schalkburger
schalkburger / rel-external-new-tab.js
Created February 16, 2015 14:29
Open rel="external" links in new tab or window
$('a[rel^="external"],a[rel$="external"]').attr({target:"_blank",title:"Opens in a new tab or window"}).append('');
@schalkburger
schalkburger / p-has-img.js
Created February 16, 2015 14:30
Find paragraphs that has an image with jQuery
$("p:has(img)");
@schalkburger
schalkburger / display-source.php
Created February 16, 2015 14:33
Display source code of a website
<?php
$lines = file('http://google.com/');
foreach ($lines as $line_num => $line) {
echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br>\n";
}?>
@schalkburger
schalkburger / ip-address-geo.php
Created February 17, 2015 08:05
IP address and Geotargeting lookup with hostip.info
<?php
$url = "http://api.hostip.info/get_html.php";
$contents = file_get_contents($url);
$values = preg_split("[\n|\r]",$contents);
$count = count($values);
for($i = 0; $i < $count; $i++) {
if($i != $count-1) {
echo $values[$i] . "\n";
}
}
@schalkburger
schalkburger / button-split-testing.php
Created February 17, 2015 08:08
Button or link split testing with rand()
<?php
$buttons = array(
'<a href="#">Link 1</a>',
'<a href="#">Link 2</a>');
srand(time());
$random = (rand()%2);
echo ("$buttons[$random]");
?>