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
// CakePHP Block Helper | |
// Ever wanted a clean way to capture a block of HTML in your CakePHP view and use it later in your layout just like CakePHP uses $content_for_layout? | |
// I use Rails all the time and take content_for for granted. I recently started a CakePHP project and noticed the absence of a simple content_for method to capture a block of HTML. | |
// For this example we are creating a helper named $cake, a controller named 'main', and using a layout named 'app'. | |
// HELPER: |
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
// CakePHP Block Helper | |
// Ever wanted a clean way to capture a block of HTML in your CakePHP view and use it later in your layout just like CakePHP uses $content_for_layout? | |
// I use Rails all the time and take content_for for granted. I recently started a CakePHP project and noticed the absence of a simple content_for method to capture a block of HTML. | |
// For this example we are creating a helper named $cake, a controller named 'main', and using a layout named 'app'. | |
// HELPER: |
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
// CakePHP Enkoder | |
// USAGE: | |
// Uses the same syntax as $html->link($title, $url, $htmlAttributes, $confirmMessage, $escapeTitle) | |
<?=$enkode->mailto('Email Me', 'user@example.com', array('subject'=>'Hello world!'))?> | |
// HELPER: | |
// app/views/helpers/enkode.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
# Install Passenger with RVM / Ruby 1.9.1 | |
rvm 1.9.1 ; gem install passenger ; which passenger-install-nginx-module | |
# Install Apache module | |
rvmsudo passenger-install-apache2-module | |
# Restart Apache | |
sudo /usr/sbin/apachectl restart | |
# If needed (when --default doesn't stick) |
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
(From @wayneeseguin) | |
This example shows how to setup an environment running Rails 3 beta under 1.9.1 with a 'rails3' gem set. | |
∴ rvm update --head | |
# ((Open a new shell)) | |
# If you do not already have the ruby interpreter installed, install it: | |
∴ rvm install 1.9.1 | |
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
// # I've assumed you've downloaded and installed the Flash CS4/CS5 Project Panel update at: http://www.gskinner.com/blog/archives/2010/07/project_panel_u.html | |
// # 1. Create this file in: /Users/{you}/Library/Application Support/Adobe/Flash CS4/en/Configuration/Commands | |
// # 2. Then go to Flash => Keyboard Shortcuts... | |
// # 3. Create your shortcut under the Commands menu, I use 'Cmd+Opt+P' | |
function call_method(p_panelName, p_function, p_param){ | |
l = fl.swfPanels.length; | |
if (l == 0) return 'false'; | |
for (i=0; i<l; i++){ |
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
# Ok, I'm creating a paired down version of Has_Many_Polymorphs in Rails 3 and making use of Arel. A great way to learn! | |
# Super simple setup: | |
class Content < ActiveRecord::Base | |
polly :parents => :posts, :children => [:images, :paragraphs, :quotes] | |
end | |
class Post < ActiveRecord::Base | |
end |
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
# So you have a collection of records you want to display in rows of 3. | |
# Use Enumerable's each_slice method: | |
<%= content_tag :div, :class => :thumbs do %> | |
<% @thumbs.each_slice(3) do |slice| %> | |
<%= content_tag :div, :class => :thumbs_row do %> | |
<% slice.each do |thumb| %> | |
<%= render 'thumb' %> | |
<% end %> |
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
// One of the biggest problems with Internet Explorer 6 and 7 is the lack of display:inline-block support. | |
// I use inline-block all the time. It's very handy. I'm ready to bug test in IE and of course, the main CSS problems | |
// are with inline-block. | |
// Using Compass you can remove that pain. Compass has cross-browser support for inline-block. | |
// Enjoy. | |
@import "compass/css3/inline-block"; | |
ul{ |
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
# A minimally beautiful command prompt: | |
# user: directory (branch): | |
# Place this in ~/.bashrc | |
export PS1="\u: \W"'$(__git_ps1 " (%s)")'": " | |
# Place this is /etc/profile to ensure Terminal sources ~/.bashrc when it launches | |
[ -r $HOME/.bashrc ] && source $HOME/.bashrc |
OlderNewer