Skip to content

Instantly share code, notes, and snippets.

View yurivictor's full-sized avatar

Yuri Victor yurivictor

View GitHub Profile
@yurivictor
yurivictor / get_photos.py
Created April 6, 2012 01:40
Downloads and saves images from web sites
import requests
images = ['http://url.to/image.jpg', 'http://url.to/image.jpg']
def get_photos():
# Iterates through the list of images
for image in images:
# Gets the image from the url
@yurivictor
yurivictor / ona12.php
Created March 21, 2012 20:34
ONA12 random session sorter
<?php
$json_url = 'ona12.json';
$json_string = file_get_contents($json_url);
$json_decoded = json_decode($json_string, true);
$items = $json_decoded;
$items_random = shuffle($items);
$i = 1;
echo '<h1>ONA12 sessions sorted randomly</h1>';
echo '<a class="large button nice" href="http://www.reddit.com/r/digitaljournalism">Full list</a>';
echo '<ul>';
@yurivictor
yurivictor / tabs.html
Created February 28, 2012 17:16
Simple jquery sliding tabs
<style>
.tabs { border-bottom: 1px solid #d4d4d4; padding-left: 0; }
.tabs a { background: #eee; border: 1px solid #d4d4d4; color: #6a6a6a; display: block; float: left; line-height: 36px; margin-bottom: -1px; padding: 0 10px; text-decoration: none; }
.tabs li { list-style: none; }
.tabs .active { background: #fff; border-bottom: 0; color: #2c2c2c; font-weight: 700; padding-bottom: 1px; }
.hide { display: none; }
.clearfix:before, .clearfix:after { content: "\0020"; display: block; height: 0; overflow: hidden; }
.clearfix:after { clear: both; }
.clearfix { zoom: 1; }
</style>
@yurivictor
yurivictor / get_meta_tags.py
Created February 2, 2012 07:57
Python gets meta information from a link
import re, requests
def get_meta_tags(url):
meta = {}
response = requests.get(url)
html = response.content
search = re.findall("name=\"([^\"]*)\" content=\"([^\"]*)\"", html)
for i in search:
meta[i[0]] = i[1]
return meta