This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# If you haven't played around with WordPress much and you're trying to find out what | |
# exactly this "category object" thing that's referenced in many places is. You might | |
# look for a category table in the database for some clues, but there isn't one. That's | |
# because WordPress uses "terms" to handle both categories and tags, each of which are | |
# "taxonomies". Looking in those tables will give you want you want, or you could just | |
# print a category object. | |
# | |
# More info: http://codex.wordpress.org/WordPress_Taxonomy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Quick hack to stretch the .srt subtitles to match the one of your video. | |
# Check the time of the first and last sentence in your video file, then | |
# use this tool to convert the .srt file into one matching your video with: | |
# | |
# tclsh srt.tcl file.srt <your start time> <your end time> > output.srt | |
# | |
# Example: | |
# | |
# tclsh srt.tcl my.srt 00:00:24,000 00:44:15,000 > ~/Desktop/new.srt | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Converts an ArrayBuffer directly to base64, without any intermediate 'convert to string then | |
// use window.btoa' step. According to my tests, this appears to be a faster approach: | |
// http://jsperf.com/encoding-xhr-image-data/5 | |
/* | |
MIT LICENSE | |
Copyright 2011 Jon Leighton | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example: | |
# | |
# class Page < ActiveRecord::Base | |
# include Positioned | |
# end | |
module Positioned | |
def self.included model_class | |
model_class.class_eval do | |
before_save :set_position |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref | |
<?php | |
/** | |
* WordPress Query Comprehensive Reference | |
* Compiled by luetkemj - luetkemj.github.io | |
* | |
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters | |
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set rnu | |
au BufEnter * :set rnu | |
au BufLeave * :set nu | |
au WinEnter * :set rnu | |
au WinLeave * :set nu | |
au InsertEnter * :set nu | |
au InsertLeave * :set rnu | |
au FocusLost * :set nu | |
au FocusGained * :set rnu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get first paragraph from a WordPress post. Use inside the Loop. | |
* | |
* @return string | |
*/ | |
function get_first_paragraph(){ | |
global $post; | |
$str = wpautop( get_the_content() ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Compliant with Twitter's Developer Display Requirements: | |
https://dev.twitter.com/terms/display-requirements | |
*/ | |
var linkify_result = function (tweet /* tweet object from the results array */) { | |
var subs = [], | |
last_offset = 0, | |
new_tweet = '', | |
entity, | |
replace = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Builds epub book out of Paul Graham's essays: http://paulgraham.com/articles.html | |
Author: Ola Sitarska <[email protected]> | |
Copyright: Licensed under the GPL-3 (http://www.gnu.org/licenses/gpl-3.0.html) | |
This script requires python-epub-library: http://code.google.com/p/python-epub-builder/ | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# Ruby script to download a number of files | |
# from individual URLs via HTTP/HTTPS/FTP | |
# specified in an external file. | |
# | |
# Author: Tobias Preuss | |
# Revision: 2013-04-18 16:26 +0100 UTC | |
# License: Creative Commons Attribution-ShareAlike 3.0 Unported |
OlderNewer