Skip to content

Instantly share code, notes, and snippets.

<h2>Fullsize Images Tests</h2>
<h3>Captioned (Unlinked)</h3>
[caption id="attachment_2127" align="alignnone" width="1024"]<img class="size-full wp-image-2127" title="Red flower" alt="" src="http://wpthemetestdata.files.wordpress.com/2008/09/test-image-landscape-900.jpg" width="1024" height="685" /> Full - None[/caption]
[caption id="attachment_2127" align="alignleft" width="1024"]<img class="size-full wp-image-2127" title="Red flower" alt="" src="http://wpthemetestdata.files.wordpress.com/2008/09/test-image-landscape-900.jpg" width="1024" height="685" /> Full - Left[/caption]
[caption id="attachment_2127" align="aligncenter" width="1024"]<img class="size-full wp-image-2127" title="Red flower" alt="" src="http://wpthemetestdata.files.wordpress.com/2008/09/test-image-landscape-900.jpg" width="1024" height="685" /> Full - Center[/caption]
[caption id="attachment_2127" align="alignright" width="1024"]<img class="size-full wp-image-2127" title="Red flower" alt="" src="http://wpthemetestdata.files.wordpress.com/
@Mins
Mins / mysql_secure.sh
Last active February 16, 2024 00:03
Automating mysql_secure_installation
#!/bin/bash
aptitude -y install expect
// Not required in actual script
MYSQL_ROOT_PASSWORD=abcd1234
SECURE_MYSQL=$(expect -c "
set timeout 10
@markjaquith
markjaquith / wp-combos.rb
Last active December 10, 2015 16:48
Makes a list of allowed WordPress configurations. Plan to use this to make a vagrant box that has all of them, for testing purposes.
#!/usr/bin/ruby
multisitism = [
:single_site,
:multisite_subdirs,
:multisite_subdomains
]
permalinks = [
:default_permalinks,
@nb
nb / class-query-iterator.php
Created November 12, 2012 15:34
WordPress Chunk Query Iterators
<?php
/**
* Iterates over results of a query, split into many queries via LIMIT and OFFSET
*/
class QueryIterator implements Iterator {
var $limit = 500;
var $query = '';
var $global_index = 0;
@tristanbes
tristanbes / example.sh
Created November 9, 2012 15:53
Install Graphite on Debian Server
# Installing graphite dependencies
apt-get install -y python2.6 python-pip python-cairo python-django python-django-tagging
apt-get install -y libapache2-mod-wsgi python-twisted python-memcache python-pysqlite2 python-simplejson
pip install whisper
pip install carbon
pip install graphite-web
# Setup a vhost by grabbing the example the graphite team released on their repo.
# In this file, you'll provide the url used to access to your Graphite dashboard
wget https://raw.github.com/tmm1/graphite/master/examples/example-graphite-vhost.conf -O /etc/apache2/sites-available/graphite
@janogarcia
janogarcia / php_valid_twitter_hashtag_regex.php
Created October 24, 2012 15:01
PHP Twitter Hashtag Validation Regex
<?php
/**
* PHP Regex to validate a Twitter hashtag
*
* Useful for validating a text input (an HTML form in your CMS or custom application) that must be a valid Twitter hashtag.
* Valid examples: #a, #_, #_1, #_a, #1a, #áéìôü, #123hàsh_täg446
* Invalid examples: #1, ##hashtag, #hash-tag, #hash.tag, #hash tag, #hashtag!, (any hashtag that is more than 140 characters long, hash symbol included)
*
* Regex explanation:
* First, the lookahead assertion (?=.{2,140}$) checks the minimum and max length, as explained here http://stackoverflow.com/a/4223213/1441613
@simX
simX / hidpi.txt
Created July 28, 2012 04:58
Enable HiDPI mode in Mountain Lion w/o Quartz Debug
sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool YES;
sudo defaults delete /Library/Preferences/com.apple.windowserver DisplayResolutionDisabled;
// by the way, you need to logout and log back in for this to take effect. Or at least that's what
// Quartz Debug says. Who knows, maybe it's lying?
// P.S. Go to [Apple menu --> System Preferences --> Displays --> Display --> Scaled] after logging
// back in, and you'll see a bunch of "HiDPI" resolutions in the list to choose from.
@jeremyfelt
jeremyfelt / gist:3094244
Created July 11, 2012 22:42
Local YUI JS Lint Check
js_lint_check() {
local DEVENV=$PWD
local YUICOM="/path/to/yuicompressor/jar/"
cd $YUICOM
java -jar yuicompressor-2.4.7.jar -v $DEVENV/$1 -o $DEVENV/$2
cd $DEVENV
}
@jeremyfelt
jeremyfelt / gist:3006286
Created June 27, 2012 19:35
Rsync repo to repo
repo_to_repo() {
local DEVENV="/directory/to/where/both/repos/are/stored/"
rsync -rv --delete --exclude='.svn' $DEVENV$1/* $DEVENV$2
cd $DEVENV$2
svn status | grep '^!' | awk '{print $2}' | xargs svn rm
svn status | grep '^?' | awk '{print $2}' | xargs svn add
}
@jboner
jboner / latency.txt
Last active May 6, 2024 07:06
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD