Skip to content

Instantly share code, notes, and snippets.

@brianburridge
brianburridge / gist:cea197b441060dd56216
Created July 10, 2014 16:48
poorly formatted code example
</li>
<li>
<span>Taxes and Fees</span>
<span class="infoIcn" data-toggle="tooltip" data-html="true" title="Spot Price: $4310.00<br>Processing: $<%%=total_p_fee.toFixed(2)%><br>Cancellation Protection: $<%%= total_p_fee.toFixed(2) %><br>Sales Tax: $241.36">
<span class="glyphicon glyphicon-info-sign"></span>
</span>
<!--add class editInputBox to show input-->
<span class="price processing_fee_block">
<input type="text" name="order[total_processing_fee]" value="<%%= total_p_fee.toFixed(2) %>">
<span>$ <span class="value"><%%= total_p_fee.toFixed(2) %></span></span>
@brianburridge
brianburridge / gist:0184a6fa2f1095e5e01c
Last active August 29, 2015 14:05
How to pull specific flash messages for display in different parts of the page instead of grouping all flashes together in one place.
<%- # Show all flash messages in one place -%>
<% if flash.present? %>
<div id="myModal" class="reveal-modal">
<%- flash.each do |key, value| -%>
<div class="<%= key %>_flash"><%= raw value %></div>
<%- end -%>
<a class="close-reveal-modal">&#215;</a>
</div>
<% end %>
@brianburridge
brianburridge / gist:fe44e9ff3c45eb808708
Last active August 29, 2015 14:05
BlooP function: Two-to-the-three-to-the...
DEFINE PROCEDURE: "TWO-TO-THE-THREE-TO-THE" [N]:
BLOCK 0: BEGIN
CELL(0) <= 1;
LOOP N TIMES:
BLOCK 1: BEGIN
CELL(0) <= 3 X CELL(0);
BLOCK 1: END;
CELL(1) <= 1;
@brianburridge
brianburridge / gist:096537cc15146cb765fa
Last active August 29, 2015 14:18
Getting Started with Ruby on Rails

Getting Started with Ruby on Rails

To get into Ruby on Rails web development, there are some tools and basic skills you will need.

Why use a Mac?

The Mac, in my opinion, is the preferred platform of choice for Ruby on Rails developers. If you attend any Ruby conference you will see the majority of attendees use a Mac, probably around 90%. The others will be primarily Linux users. There may be some scattered Windows users, but the Windows platform is not an easy one to use as a Ruby developer.

The Mac operating system runs on top of Unix, which makes it an ideal system for Rails developers to use, since so much of the software we need is Unix based. It also provides a stable, rich UI platform for some very helpful applications. Installation has been made very simple compared to other platforms.

@brianburridge
brianburridge / gist:81bd2e4f85d70c0f0a55
Last active August 29, 2015 14:18
Building Dynamic Apps with Ruby on Rails: Contact Manager

Creating a Contact Manager with Ruby on Rails

Generate an "empty" Rails app with the default stack

rails new contact_manager

Create a model

@brianburridge
brianburridge / DemoDayPresentingTips.md
Last active August 29, 2015 14:18
Demo Day Presenting Tips

Demo Day Presenting Tips

  • Make sure your device is charged before you go up to present.
  • Share the mission statement of your project before you get into the demo. Why did you come up with this idea? Make it engaging.
  • As you're presenting, don't highlight any faults of your application or things left unfinished.
  • Don't read directly from your slides or notes.
  • Don't have huge blocks of text on your slides. Bullet points are better than paragraphs of text.
  • Close all other apps and tabs except the ones you plan to use.
  • Test your app with CMD +/-. They can greatly effect the look of your app. You do not want to do this for the first time during the demo!
  • Remember, your browser doesn't need to be full screen, and will probably look best if it isn't. Clean your desktop up and use a plain color background. Change your Mac desktop navbar to disappear until you hover over it. This will give you a nice clean desktop to use with a smaller browser window sized to what looks best for your app.
@brianburridge
brianburridge / gist:934644
Created April 21, 2011 14:34
Clear default text when user selects the input field
$('input[data-default]').select(function () {
if ($(this).val() == $(this).attr('data-default')) {
$(this).val('');
}
});
$('input[data-default]').click(function () {
if ($(this).val() == $(this).attr('data-default')) {
$(this).val('');
}
@brianburridge
brianburridge / config.ru
Created May 23, 2011 18:57
Rack mounting with Rails app
require "config/environment"
require 'api'
rails_app = Rack::Builder.new do
use Rails::Rack::LogTailer
use Rails::Rack::Static
run ActionController::Dispatcher.new
end
run Rack::Cascade.new([
@brianburridge
brianburridge / global_settings.rb
Created June 30, 2011 13:31
An easy and flexible way to set global variables for a Rails app using Ostruct.
require "ostruct"
case RAILS_ENV
when "staging"
google_maps_key = 'staging google maps key'
support_email = 'support@email.com'
ssl_subdomain = 'secure'
original_subdomain = 'www'
when "production"
google_maps_key = 'production google maps key'
@brianburridge
brianburridge / gist:2219745
Created March 27, 2012 20:00
Using html_safe and collect to create links to a post's tags
<%= post.tags.collect{|tag| link_to tag.name, forum_index_path(:tags => tag.name)}.join(' ').html_safe %>