Skip to content

Instantly share code, notes, and snippets.

View yurivictor's full-sized avatar

Yuri Victor yurivictor

View GitHub Profile
@yurivictor
yurivictor / coldyuri.py
Last active January 2, 2016 11:49
It's cold, am I in the office yet?
import json
import requests
API = 'https://api.forecast.io/forecast/'
KEY = 'c67cec34041e316f293bec1e1f5081dd'
def get_current_conditions( latitude, longitude ):
url = API + KEY + '/' + latitude + ',' + longitude
request = requests.get( url )
data = request.content
@yurivictor
yurivictor / gist:8284794
Created January 6, 2014 15:51
Proper tweet encoding for WordPress headlines
<a data-social-name="twitter" href="javascript:void( 0 )" onclick="window.open( 'http://www.twitter.com/intent/tweet?text=<?php echo htmlspecialchars( urlencode( html_entity_decode( get_the_title(), ENT_COMPAT, 'UTF-8' ) ), ENT_COMPAT, 'UTF-8' ); ?>&url=<?php echo get_permalink() ?>','','width=550, height=350, scrollbars=no' )">Twitter</a>
<?php
/*
Plugin Name: Color Rotator
Description: Change the color scheme every time you login
Author: Aaron Jorbin
Version: 1.0
Author URI: http://aaron.jorb.in/
License: GPLv2 or later
*/
@yurivictor
yurivictor / scrape_medium.py
Last active September 30, 2018 13:28
Scrape your @Medium post links into HTML list, if you want to add them to your site, or whatever
import requests
from pyquery import PyQuery as pq
USERNAME = 'ev' # change to your username
def get_medium_posts():
url = 'http://medium.com/@' + USERNAME + '/latest'
request = requests.get( url )
html = request.content
@yurivictor
yurivictor / areyouanumber.js
Last active December 29, 2015 08:39
AreYouANumber
function AreYouANumber( n ) {
return n === n + 0;
}
@yurivictor
yurivictor / get_video_info.php
Last active July 7, 2017 07:28
Get video information from url and convert to array
<?php
/**
* Get video information and convert to array
* @param string $url, the url of the video
* @uses wp_remote_get()
* @return array $video, information about the video
*/
function get_video( $url ) {
$video = array();
@yurivictor
yurivictor / interviewees.csv
Created September 9, 2013 20:10
Riptide interviewees
We can make this file beautiful and searchable if this error is corrected: It looks like row 10 should actually have 2 columns, instead of 3 in line 9.
Ken Richieri,
Chloe Sladden,
Nicholas Negroponte,
Chris Schroeder,
Julius Genachowski,
Marty Baron,
Om Malik,
Michael Sippey,
John Harris,
Arthur Sulzberger, Jr.,
@yurivictor
yurivictor / riptide_interviewees.py
Last active December 22, 2015 16:39
Get the names of riptide interviewees
# Result: https://gist.github.com/yurivictor/6500840
import requests
from pyquery import PyQuery as pq
URL = 'http://www.niemanlab.org/riptide/'
def get_names():
request = requests.get( URL )
html = request.content
@yurivictor
yurivictor / hexagon.html
Last active December 22, 2015 09:59
CSS Hexagon
<style>
.hexagon {
height: 150px;
overflow: hidden;
transform: rotate(120deg);
width: 300px;
-webkit-transform: rotate(120deg);
-moz-transform: rotate(120deg);
-o-transform: rotate(120deg);
@yurivictor
yurivictor / Preferences.sublime-settings
Last active December 21, 2015 14:29
Sublime user settings
{
"bold_folder_labels": true,
"caret_style": "phase",
"close_windows_when_empty": true,
"color_scheme": "Packages/Theme - Flatland/Flatland Dark.tmTheme",
"draw_indent_guides": true,
"draw_white_space": "selection",
"file_exclude_patterns":
[
".DS_Store",