background preloader

Code

Facebook Twitter

Mit

Programming. Javascript. Art. Computer. Ruby. Latex. Generative. Gnome. Nonsense. Bash. Translation. Terrain. Conditional Tags. Languages: English • Français • Italiano • 日本語 • Türkçe • Português do Brasil • 中文(简体) • (Add your language) Introduction The Conditional Tags can be used in your Template files to change what content is displayed and how that content is displayed on a particular page depending on what conditions that page matches. For example, you might want to display a snippet of text above the series of posts, but only on the main page of your blog.

With the is_home() Conditional Tag, that task is made easy. Note the close relation these tags have to WordPress Template Hierarchy. Warning: You can only use conditional query tags after the posts_selection action hook in WordPress (the wp action hook is the first one through which you can use these conditionals). However: if you have a reference to the query object (for example, from within the parse_query or pre_get_posts hooks), you can use the WP_Query conditional methods (eg: $query->is_search()) The Conditions For ... The Main Page is_home() is_admin() ! Atari 800XL/XE handmade by toxi. Ryan's Guide to MetaBalls (aka Blobs) Scheme Shell. Textmate regexp manual. 20.1 Introduction A regular expression is a domain specific language for matching text. Naively we could write a small program to match text, but this is error-prone, tedious and not very portable or flexible. Instead we use regular expressions which describe the match as a string which (in a simple case) consists of the character types to match and quantifiers for how many times we want to have the character type matched.

For example normal letters and digits match literally. The basic quantifiers are the asterisk (*) to specify that the match should happen zero or more times, plus (+) for one or more times, or a range can be given as {min,max}. This alone gives us capabilities like finding words (\w+) or finding an image tag with an alt argument (<img. Matching longer text sequences is one thing, but often we are interested in the subset of the match. So to change the alt argument text we could search for (<img.

Note that in the examples above .* is used. 20.1.1 External Resources Example: Guide-things-you-shouldnt-be-doing-in-rails. Edit Posted by kev Wed, 30 Aug 2006 05:32:00 GMT Koz recently checked code into core that kicks and screams all the way home if you’re using deprecated methods or instance variables. In honor of this I’ve decided to give you a list of things I still see over and over in Rails code that you really shouldn’t be doing anymore. Really. Trust me on this. Update: There’s been enough controversy over this article that I’ve responded. Accessing Instance Variables You Didn’t Create It’s time to stop using the instance variables for params, flash, session, request, response and all of their formerly preceded by an @ friends.

Rabble (who you’ll hear more from later) also suggests that you not intermix usages of flash[:notice] with flash['notice'] and the like. Using Deprecated Finders find_all and find_first have been deprecated over a year now. Getting Ahead of Yourself Stop trying to write “neato ajax driven thingies” before you understand how to write it properly without ajax. Fallin’ off the wagon. Cellular Automaton. Regular Expression Matching Can Be Simple And Fast. Russ Coxrsc@swtch.com January 2007 Introduction This is a tale of two approaches to regular expression matching. One of them is in widespread use in the standard interpreters for many languages, including Perl. The other is used only in a few places, notably most implementations of awk and grep. Let's use superscripts to denote string repetition, so that a? Notice that Perl requires over sixty seconds to match a 29-character string. It may be hard to believe the graphs: perhaps you've used Perl, and it never seemed like regular expression matching was particularly slow.

Historically, regular expressions are one of computer science's shining examples of how using good theory leads to good programs. Today, regular expressions have also become a shining example of how ignoring good theory leads to bad programs. This article reviews the good theory: regular expressions, finite automata, and a regular expression search algorithm invented by Ken Thompson in the mid-1960s. Regular Expressions. Ambient Occlusion Fields. Janne Kontkanen, Samuli Laine in ACM Siggraph 2005 Symposium on Interactive 3D Graphics and Games We present a novel real-time technique for computing inter-object ambient occlusion. For each occluding object, we precompute a field in the surrounding space that encodes an approximation of the occlusion caused by the object.

This volumetric information is then used at run-time in a fragment program for quickly determining the shadow cast on the receiving objects. According to our results, both the computational and storage requirements are low enough for the technique to be directly applicable to computer games running on the current graphics hardware. Downloads Janne Kontkanen, 14.2.2005. How to Design Programs: An Introduction to Computing and Programming.