Skip to content

Instantly share code, notes, and snippets.

View yurivictor's full-sized avatar

Yuri Victor yurivictor

View GitHub Profile
@yurivictor
yurivictor / high.php
Created May 10, 2013 17:01
Prints out syntax highlighted version of code
<?php
$uri = str_replace( '%20', ' ', $_SERVER['REQUEST_URI'] );
highlight_file( $_SERVER['DOCUMENT_ROOT'] . preg_replace( '/\.phps$/', '.php', $uri ) );
@yurivictor
yurivictor / header.php
Created May 15, 2013 22:14
header scripts
<?php
/**
* Hook actions in that run on every page-load
*
* @uses add_action()
*/
private function add_actions() {
add_action( 'wp_enqueue_scripts', 'enqueue_scripts' );
}
@yurivictor
yurivictor / style.css
Created May 25, 2013 20:35
New Washington Post stylesheet
/**
* Theme Name: WaPo Blogs
* Theme URI: http://www.washingtonpost.com
* Author: The Washington Post
* Description: WaPo Blog Theme
* Version: 0.1
* License: GNU General Public License
* License URI: license.txt
**/
@yurivictor
yurivictor / .functions
Created June 18, 2013 16:28
Additional bash functions
# Search WordPress
# usage wpgrep 'function the_content'
jsgrep() { # search development scripts
find . \( -name "*.dev.js" -print \) | xargs grep -n "$1"
}
cssgrep() { # search development css files
find . \( -name "*.dev.css" -print \) | xargs grep -n "$1"
}
phpgrep() { # search php files
find . \( -name "*.php" -print \) | xargs grep -n "$1"
@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",
@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 / 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 / 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 / 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 / areyouanumber.js
Last active December 29, 2015 08:39
AreYouANumber
function AreYouANumber( n ) {
return n === n + 0;
}