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
<% params.reject {|k,v| !(k.to_s =~ /^fb_/)}.each_pair do | name, value | %> | |
<input type="hidden" name="<%= name %>" value="<%= value %>"> | |
<% 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
# app_helper | |
def callback_attribute | |
if request.env['PATH_INFO'] | |
" callbackurl='#{link_to_app(request.env['PATH_INFO'])}?_method=GET' " | |
end | |
end | |
# in the view | |
<fb:comments xid="m_story_<%= @first.id %>_comments" canpost="true" candelete="false" showform="true" numposts="5" publish_feed="false" simple="true" reverse="true" returnurl="<%= link_to_app "item/#{@first.id}" %>" <%= callback_attribute %>> | |
<fb:title> <%= @first.couple_name %></fb:title> |
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
# app_helper | |
def callback_attribute | |
%{ callbackurl="#{url_for(request.path) + "?_method=GET&" + request.query_string}" } | |
end | |
# in the view | |
<fb:comments xid="m_story_<%= @first.id %>_comments" canpost="true" candelete="false" showform="true" numposts="5" publish_feed="false" simple="true" reverse="true" returnurl="<%= link_to_app "item/#{@first.id}" %>" <%= callback_attribute %>> | |
<fb:title> <%= @first.couple_name %></fb:title> | |
</fb:comments> |
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
require 'tzinfo' | |
TZInfo::Country.get('US').zone_identifiers |
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
var attachment = { | |
name: "Name (shows as linked text)", | |
href: '<%= link_to_app("models/#{@model.id}") %>', | |
description: "Relatively short description", | |
media:[ | |
{ type: 'image', | |
src: '<%= @model.amazon_public_url %>', | |
href: '<%= link_to_app("models/#{@model.id}") %>' | |
} | |
] |
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
module DataMapper | |
module Resource | |
def to_hash | |
h = {} | |
self.class.properties.collect {|p| p.name}.each do | property | | |
h[property.to_sym] = self[property] | |
end | |
h | |
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
# vim solution to the problem we have with actionscript files (windows-related?) | |
# which causes problems in some programs, including git diff | |
# substitute ^M characters when editing a polluted file | |
# The first ^M below is the string, and should be entered by typing Ctrl-V followed by Ctrl-M | |
# The first ^M below is a linebreak, and should be entered by typing Ctrl-V followed by Enter | |
:%s/^M/^M/g | |
# them remove the BOM | |
:set nobomb |
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
/* experimental CSS disclosure indicators */ | |
/* FIXME: need to be able to center this vertically */ | |
ul.disclosure li::after, | |
li.disclosure::after { | |
-webkit-transform: rotate(45deg); | |
content: " "; | |
display: block; | |
width: 6px; | |
height: 6px; | |
float: right; |
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
# add to .bash_profile or somesuch | |
hg_branch() { | |
hg branch 2> /dev/null | awk '{print "(hg:"$1")"}' | |
} | |
git_branch() { | |
git branch 2> /dev/null | head -1 | awk '{print "(git:"$2$3")"}' | |
} | |
export PS1='\[\033[38m\]\u@\h\[\033[01;32m\] \w \[\033[31m\]$(hg_branch)$(git_branch)\[\033[37m\] $\[\033[00m\] ' |
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
'some string here'.gsub(/\b\w/){$&.upcase} |
OlderNewer