Skip to content

Instantly share code, notes, and snippets.

View vmunhoz's full-sized avatar
💭
Learning NLP 📄

Vinicius Munhoz vmunhoz

💭
Learning NLP 📄
View GitHub Profile
@vmunhoz
vmunhoz / new_gist_file
Created August 7, 2013 12:56
Full height collumn
.main {
position:relative;
margin-left:20%;
}
.sub {
position:absolute;
top:0;
bottom:0;
width:20%;
@vmunhoz
vmunhoz / new_gist_file
Created August 5, 2013 05:13
Using DOM objects PHP
<?php
$doc = new DOMDocument();
$doc->loadHTML('<img src="http://example.com/img/image.jpg" ... />');
$imageTags = $doc->getElementsByTagName('img');
foreach($imageTags as $tag) {
echo $tag->getAttribute('src');
}
?>
@vmunhoz
vmunhoz / new_gist_file
Created August 5, 2013 05:06
Retrieve images from wordpress post
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php
$szPostContent = $post->post_content;
$szSearchPattern = '~<img [^\>]*\ />~';
// Run preg_match_all to grab all the images and save the results in $aPics
preg_match_all( $szSearchPattern, $szPostContent, $aPics );