Vastermonster http://vastermonster.com/blog is Paul Thrasher's personal blog. This is my space to write and post whatever I'm into at the moment. I will mostly post about php code, design, strange videos, internet chaos, simplicity and cleverness — fairly in-often. Wed, 23 Feb 2011 19:59:05 +0000 en hourly 1 http://wordpress.org/?v=3.1.1 Symfony Performancehttp://vastermonster.com/blog/symfony-performance http://vastermonster.com/blog/symfony-performance#comments Thu, 21 Oct 2010 22:46:22 +0000 Paul http://vastermonster.com/blog/?p=148 Symfony Performance

]]>
http://js-kit.com/rss/vastermonster.com/blog/p=148 0
Turning a string into a question in PHPhttp://vastermonster.com/blog/turning-a-string-into-a-question-in-php http://vastermonster.com/blog/turning-a-string-into-a-question-in-php#comments Tue, 06 Apr 2010 05:55:29 +0000 Paul http://vastermonster.com/blog/?p=141 In our Dogster Answers product, we reformat all of the question strings to look more like questions. The titles come in looking sometimes ridiculous so this helps give them consistent formatting in a list of other questions. This solution gives some leeway in input but should remove most types of trailing punctuation and replace it with a question mark.

]]>
http://js-kit.com/rss/vastermonster.com/blog/p=141 0
Quake3′s Fast InvSqrt()http://vastermonster.com/blog/quake3s-fast-invsqrt http://vastermonster.com/blog/quake3s-fast-invsqrt#comments Thu, 19 Nov 2009 00:18:42 +0000 Paul http://vastermonster.com/blog/?p=133

via beyond3d

]]>
http://js-kit.com/rss/vastermonster.com/blog/p=133 0
textorize-server — Easy textorize images via HTML image tags in PHPhttp://vastermonster.com/blog/textorize-server%e2%80%94easy-textorize-images-via-html-image-tags-in-php http://vastermonster.com/blog/textorize-server%e2%80%94easy-textorize-images-via-html-image-tags-in-php#comments Tue, 20 Oct 2009 06:25:02 +0000 Paul http://vastermonster.com/blog/?p=122 textorize-server allows you to build textorize images via simple HTML image tags. textorize creates crisp subpixel rendered text images via RubyCocoa in the command-line. textorize is an awesome bit of software but it can be a pain to generate all the images you need. textorize-server makes it super easy.

Here’s how to use it

<img src="/textorize-server/img.php?m=just_a_test&f=arial&s=20&c=000000&g=ffffff"
alt="just_a_test">

Just add a simple IMG tag in your HTML and textorize-server will give you this beautifully subpixel-rendered bit of text:

textorize-server test image

Installation
To run textorize-server, you’ll need to install textorize on your Mac like so:

$ gem sources -a http://gems.github.com
$ sudo gem install madrobby-textorize

Then clone textorize-server into your project’s docroot like so:

$ cd <your project's web root>
$ git clone git://github.com/thrashr888/textorize-server.git textorize-server
$ chmod 777 textorize/cache

textorize-server is hosted at GitHub (http://github.com/thrashr888/textorize-server). There you’ll find more thorough documentation about textorize-server.

]]>
http://js-kit.com/rss/vastermonster.com/blog/p=122 0
Anatomy — An HTML Frameworkhttp://vastermonster.com/blog/anatomy%e2%80%94an-html-framework http://vastermonster.com/blog/anatomy%e2%80%94an-html-framework#comments Tue, 20 Oct 2009 05:37:31 +0000 Paul http://vastermonster.com/blog/?p=116 Anatomy is an HTML glue framework that gives you basic HTML, JavaScript and CSS to get a new website going. Anatomy is built for designers that may not yet know the best way to build an HTML layout, as well as developers that are constantly starting new projects. Anatomy includes the most popular JS and CSS frameworks so can just pick one and get started.

Getting started is easy

  1. download the files
  2. remove the unused frameworks
  3. start adding your content.

Anatomy features include

  • XHTML 1.0 Transitional or HTML5 (experimental)
  • Smart defaults including jQuery, 960 and Google Ajax API
  • Layout basics: header with nav bar, content and footer DIVs as well as 2 and 3 column layouts
  • CSS Frameworks (960, Blueprint, YUI, meyerweb reset, Dropdown Menu)
  • JS Frameworks (jQuery, Prototype + Scriptaculous, MooTools, Dojo, YUI, Ext)
  • Google Analytics tags
  • Text to be replaced is marked by “REPLACE”

Installation

To use Anatomy, you can download Anatomy at GitHub or clone the repo like so:

$> git clone git://github.com/thrashr888/Anatomy.git

Anatomy HTML Framework is hosted at GitHub (http://github.com/thrashr888/Anatomy). There you’ll find more thorough documentation about Anatomy.

]]>
http://js-kit.com/rss/vastermonster.com/blog/p=116 0
Asset Compression with YUI Compressor, Minify and OptiPNGhttp://vastermonster.com/blog/asset-compression http://vastermonster.com/blog/asset-compression#comments Fri, 07 Aug 2009 00:27:21 +0000 Paul http://vastermonster.com/blog/?p=108 One of the best ways to speed up rendering of your website is to compress all your assets: JavaScript, CSS and images. Yahoo! has all but perfected this. The best way of compressing these files is using Yahoo!’s YUI Compressor. Here’s how.

Get the YUI Compressor

YUI Compressor can be found at Yahoo! here:

Once downloaded, you can run the compressor via command-line. Java is required.

$ java -jar yuicompressor-x.y.z.jar
$ java -jar yuicompressor-x.y.z.jar myfile.js -o myfile-min.js

The YUI Compressor Ruby Gem

You can also use a ruby gem to install and run the compressor. Compressing files is a little more difficult, check the documentation to learn how.

http://github.com/sstephenson/ruby-yui-compressor/tree/master

$ sudo gem install -r yui-compressor
$ irb -rubygems
>> require "yui/compressor"
compressor = YUI::JavaScriptCompressor.new
compressor.compress('var JS = "goes here";')

There are a few options for compressing and serving assets on the fly. Gzip compression via Apache is common and usually turned on by default on your server. In addition to that, I use Minify. It takes some time to setup but it’s worth it.

Minify PHP

The documentation is pretty clear, so I won’t copy it here. Either way, you’ve got smaller files. Running the command manually gives you a lot more control over how it works and where the files end up. But setting up a Minify “server” lets you compress all your files without worrying about missing anything. They both work great.

Image Compression with OptiPNG

Recently we’ve started compressing our images as well. Images are probably the most common asset format found on your webpage so it’s important to get them downloaded smoothly. I haven’t found a great tool for this yet but once again, Yahoo! provides. These tools provide lossless compression, which means you won’t see any visual difference in the file, only in the final file size. Most of the tools I’ve found work best on png files, which is a great format to work with since it provides 24 bit alpha channels (better transparency) unlike gif or jpgs.

  • Yahoo! Smush-It: http://developer.yahoo.com/yslow/smushit/
    Smush it does not yet have a public tool or API, but they’re working on it. It does a great job on png files. To compress the files, you have to place them on the internet and give the tool the urls. A better workaround is to use the tool via YSlow in Firebug.
  • OptiPNG: http://optipng.sourceforge.net/
    OptiPNG has great compression, a command-line tool and a GUI wrapper for OS X. The only downside is that it only works on png files. The GUI wrapper gives you a drag and drop tool for compressing your files.

How have you been compressing your files?

]]>
http://js-kit.com/rss/vastermonster.com/blog/p=108 0
Injecting error messages into Symfony 1.1 Formshttp://vastermonster.com/blog/injecting-error-messages-into-symfony-1-1-forms http://vastermonster.com/blog/injecting-error-messages-into-symfony-1-1-forms#comments Wed, 15 Jul 2009 06:47:30 +0000 Paul http://vastermonster.com/blog/?p=71 Symfony 1.1 does a great job handling forms and form validation but say you have a few external forces checking the validity of the user submitted data, such as Paypal. Paypal would love to return it’s own error messages (thank you very much!) and tie it to a particular form field (say, the credit_card field).

Place this method into symfony_project/lib/form/BaseFormPropel.class.php

And use it like so:

You can find more of my Symfony snippets on GitHub.

]]>
http://js-kit.com/rss/vastermonster.com/blog/p=71 0
My Portfolio on Flickrhttp://vastermonster.com/blog/my-portfolio-on-flickr http://vastermonster.com/blog/my-portfolio-on-flickr#comments Wed, 15 Jul 2009 05:44:48 +0000 Paul http://vastermonster.com/blog/?p=68

My Portfolio Pieces on Flickr

]]>
http://js-kit.com/rss/vastermonster.com/blog/p=68 0
Frostihttp://vastermonster.com/blog/frosti http://vastermonster.com/blog/frosti#comments Wed, 15 Jul 2009 05:38:54 +0000 Paul http://vastermonster.com/blog/?p=64

Bjork – Frosti
I made this.

]]>
http://js-kit.com/rss/vastermonster.com/blog/p=64 0
Legendary Fisthttp://vastermonster.com/blog/legendary-fist http://vastermonster.com/blog/legendary-fist#comments Wed, 15 Jul 2009 05:32:32 +0000 Paul http://vastermonster.com/blog/?p=60

Legendary Fist – my Chinese martial arts comedy – On YouTube

]]>
http://js-kit.com/rss/vastermonster.com/blog/p=60 0