Skip to content

Instantly share code, notes, and snippets.

<div id="FI_col2">
<div id="rotatingFeaturedItems">
<div id="fic1" class="fiBox">
<div style="text-align: center; margin-top: 10px">
<a href="stretchStudy/"><img src="images/layout/v2/featured/StretchStudyLogo-125.png" alt="USATF Stretch Study Logo" width="125" height="65" /></a>
<div style="margin-top: 0.1em"><a href="stretchStudy/">Participate in the study</a></div>
</div>
</div>
<div id="fic2" class="fiBox">
TZip::ClassMethods.find_by_zipcode('02760')
# => works
ActiveSupport::TimeZone.send(:extend, TZip::ClassMethods)
ActiveSupport::TimeZone.find_by_zipcode('02760')
# => doesn't work
#!/usr/local/bin/macruby
framework 'calendarstore'
range = Time.local(Time.now.year, Time.now.mon, Time.now.day)..(Time.local(Time.now.year, Time.now.mon, Time.now.day) + (31 * 3600 * 24))
events = CalCalendarStore.defaultCalendarStore.eventsWithPredicate(CalCalendarStore.eventPredicateWithStartDate(NSDate.dateWithString(range.begin.to_s), endDate:NSDate.dateWithString(range.end.to_s), calendars:CalCalendarStore.defaultCalendarStore.calendars))[0,7]
events.each_with_index do |event, i|
event.startDate, output = Time.at(event.startDate.timeIntervalSince1970), Array.new
if (!events[i-1] || (event.startDate.day != Time.at(events[i-1].startDate.timeIntervalSince1970).day))
def index
@programs = @camp.programs.order('name')
# some of these could be scoped out to make the controller cleaner if the queries are going to show up in other places
# eg
# scope :minage, lambda { |age| where(min_age >= ?, age) }
# @programs = @programs.minage(params[:min_age]) if params[:min_age]
@programs = @programs.where('min_age >= ?', params[:min_age]) if params[:min_age]
@programs = @programs.where('max_age <= ?', params[:max_age]) if params[:max_age]
# In erb view
<% title('Title text') # as helper %>
<%= content_for :title %>
<% content_for(:subtitle) { 'Subtitle text' } %>
<%= content_for :subtitle %>
<% content_for(:copy) { 'Copy text' } %>
<%= yield :copy %>
# Result
Title text
Subtitle text
# command
ruby extension.rb {query}
# extension.rb
_osa1 = 'tell application \"Finder\" to set insertionLocation to insertion location as alias'
_osa2 = 'return POSIX path of insertionLocation'
activeFinderPath = (`osascript -e "#{_osa1}" -e "#{_osa2}"`).strip
filename = 'untitled'
extension = 'txt'
{
"color_scheme": "Packages/Theme - Aqua/Color Schemes/Espresso Aqua.tmTheme",
"bold_folder_labels": true,
"create_window_at_startup": false,
"open_files_in_new_window": false,
"draw_white_space": "all",
"fade_fold_buttons": true,
"font_face": "SourceCodePro-Regular",
"font_size": 12.0,
"ignored_packages":
@farski
farski / gist:4176584
Created November 30, 2012 15:53
Sublime Text 2 user settings
{
"color_scheme": "Packages/Theme - Aqua/Color Schemes/Espresso Aqua.tmTheme",
"bold_folder_labels": true,
"create_window_at_startup": false,
"open_files_in_new_window": false,
"draw_white_space": "all",
"fade_fold_buttons": true,
"font_face": "SourceCodePro-Regular",
"font_size": 12.0,
"ignored_packages":
{
"color_scheme": "Packages/Theme - Aqua/Color Schemes/Espresso Aqua.tmTheme",
"bold_folder_labels": true,
"create_window_at_startup": false,
"open_files_in_new_window": false,
"draw_white_space": "all",
"fade_fold_buttons": true,
"font_face": "SourceCodePro-Regular",
"font_size": 12.0,
"ignored_packages":
echo "|============================================================================================|"
echo "| |"
echo "| Loading autoexec.cfg |"
echo "| Settings config |"
sensitivity "1.1"
volume 0.50