Skip to content

Instantly share code, notes, and snippets.

@winston
winston / T-Shirt Sizing.md
Last active June 3, 2021 14:20
RDRC T-Shirt Sizing

What is your T-shirt size?

Get your Half Chest size:

  • Get one of your T-shirts and lay it flat on a table.
  • Measure the distance (in cm) across the chest from side to side immediately below the armpit.

Tadaaa! That's your Half Chest measurement.

  • Men's XS (Half Chest: 47cm, Length 67cm)
@winston
winston / Procfile
Created November 20, 2015 04:14
Heroku + Rails + Sidekiq 4.0 Config
web: bundle exec puma -C config/puma.rb -p $PORT
worker: bundle exec sidekiq -e $RAILS_ENV -q default -q mailers
# By default, sidekiq only operates on the `default` queue
# So if you do `Mailer.new(...).deliver_later`, those are queued to the `mailers` queue
# Hence you need to explicitly tell Sidekiq to operate on `mailers` queue too
# You can also put this into sidekiq.yml
@winston
winston / jd-jgc-marketing.txt
Last active December 23, 2016 06:04
Marketing and Events Intern
Jolly Good Code is a boutique software consultancy that specialises in
Agile software engineering practices and Ruby/Ruby on Rails.
Founded in 2014, Jolly Good Code is a nimble practice that can help startups
build the right product right, with high code quality and speed.
At the same time time, Jolly Good Code also provides Agile consulting services
and Ruby/Ruby on Rails training as public or corporate workshops.
Jolly Good Code is also supporting RedDotRubyConf - an annual Ruby conference

Pushing Your Code to GitHub

Create a "New Repository" on GitHub

Follow the steps on GitHub's Documentation to create a new repository.

Once you are have a new empty repository, come back here.

Protecting Your Secrets

@winston
winston / user_authentication.md
Last active March 4, 2016 14:11
User Authentication

User Authentication

User Authentication is an important part of most web applications.

There are gems that can provide awesome authentication functionality out of the box, like Devise and Clearance.

However, it's also a good exercise in learning to implement our own authentication and understand the concepts for building out such a functionality.

@winston
winston / 1-country_select.md
Last active March 4, 2016 11:52
Rails Recipes

Country Select

Currently, we see a text field for country_code when creating a gram.

Let's replace that with a select dropdown with actual country names.

1. Install Gem

Add to your Gemfile, and run bundle install in your terminal after that.

Image Upload Part 2

In part 1, we learned how to set up a simple image upload using Carrierwave and Cloudinary.

Although we are able to upload an image, but it lacks image manipulation functionalities, i.e. cropping.

Let's improve our image upload to allow for cropping!

Usually, this involves JavaScript and fortunately, Cloudinary has a JavaScript library which we could use!

@winston
winston / controller.rb
Created January 22, 2012 09:11
GoogleVisualr Gem - DataTabel with Roles Example
# http://code.google.com/apis/chart/interactive/docs/roles.html
def roles
data_table = GoogleVisualr::DataTable.new
data_table.new_column('string', 'Month')
data_table.new_column('number', 'Sales')
# Columns with role definition
data_table.new_column('number' , nil, nil, 'interval')
data_table.new_column('number' , nil, nil, 'interval')
data_table.new_column('string' , nil, nil, 'annotation')
@winston
winston / controller.rb
Created July 30, 2012 16:16
GoogleVisualr Gem - Bubble Chart Creation Example
# http://code.google.com/apis/chart/interactive/docs/gallery/bubblechart.html
def bubble_chart
data_table = GoogleVisualr::DataTable.new
data_table.new_column('string', 'ID')
data_table.new_column('number', 'Life Expectancy')
data_table.new_column('number', 'Fertility Rate')
data_table.new_column('string', 'Region')
data_table.new_column('number', 'Population')
data_table.add_rows( [
@winston
winston / controller.rb
Created July 30, 2012 15:55
GoogleVisualr Gem - Stepped Area Chart Creation Example
# http://code.google.com/apis/chart/interactive/docs/gallery/steppedareachart.html#Example
def stepped_area_chart
data_table = GoogleVisualr::DataTable.new
data_table.new_column('string' , 'Director (Year)')
data_table.new_column('number' , 'Rotten Tomatoes')
data_table.new_column('number' , 'IMDB')
data_table.add_rows( [
['Alfred Hitchcock (1935)', 8.4, 7.9],
['Ralph Thomas (1959)', 6.9, 6.5],