Skip to content

Instantly share code, notes, and snippets.

@brianburridge
brianburridge / ruby_ftp_example.rb
Last active August 30, 2019 14:46 — forked from 3dd13/ruby_ftp_example.rb
Sample code of using Ruby Net::FTP library. Login to FTP server, list out files, check directory existence, upload files
require 'net/ftp'
CONTENT_SERVER_DOMAIN_NAME = "one-of-the-ftp-server.thought-sauce.com.hk"
CONTENT_SERVER_FTP_LOGIN = "saucy-ftp-server-login"
CONTENT_SERVER_FTP_PASSWORD = "saucy-ftp-server-password"
# LOGIN and LIST available files at default home directory
Net::FTP.open(ENV['CONTENT_SERVER_DOMAIN_NAME'], ENV['CONTENT_SERVER_FTP_LOGIN'], ENV['CONTENT_SERVER_FTP_PASSWORD']) do |ftp|
ftp.login
jQuery(function ($) {
var show_error, stripeResponseHandler;
$(function() {
var $form = $('#new_chapter_payment');
$form.submit(function(event) {
// Disable the submit button to prevent repeated clicks:
$form.find('.submit').prop('disabled', true);
$form.find('.submit').prop('value', 'Submitting Payment...');
// Request a token from Stripe:
@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: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 / 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:8d2755a73dd5b4f0332b
Created December 10, 2014 19:47
Export local db to JSON
namespace :json do
desc "Export all data to JSON files"
task :export => :environment do
Rails.application.eager_load!
ActiveRecord::Base.descendants.each do |model|
file = File.open(File.join(Rails.root, "db", "export", "#{model.table_name}.json"), 'w')
file.write model.all.to_json
file.close
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: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: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 / wordpressxml2jekyll.rb
Last active June 23, 2023 15:38 — forked from rzhw/wordpressxml2jekyll.rb
Convert Wordpress xml export to Jekyll format using Markdown
#!/usr/bin/env ruby
# Input: WordPress XML export file.
# Outputs: a series of Markdown files ready to be included in a Jekyll site,
# and comments.yml which contains all approved comments with metadata which
# can be used for a Disqus import.
# Changes from the original gist: http://gist.github.com/268428
# 1. Handles titles containing special characters. Those have to be YAML escaped
# 2. Use the original permalinks in wordpress.