Skip to content

Instantly share code, notes, and snippets.

@winston
winston / jd-jgc-marketing.txt
Last active Dec 23, 2016
Marketing and Events Intern
View jd-jgc-marketing.txt
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
View github.md

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

View 3-image_upload-part-2.md

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 / user_authentication.md
Last active Mar 4, 2016
User Authentication
View user_authentication.md

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.

View 1-country_select.md

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.

@winston
winston / Procfile
Created Nov 20, 2015
Heroku + Rails + Sidekiq 4.0 Config
View Procfile
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 / Gemfile
Last active Sep 28, 2015
For enabling SQLite3 in Rails
View Gemfile
gem "sqlite3"
View gist:c82124ae560e57f7f865
# Dump locally
pg_dump DATABASE --no-owner --no-acl -f db.sql
# Reset Heroku
staging pg:reset
# Import to Heroku
staging pg:psql < db.sql
@winston
winston / T-Shirt Sizing.md
Last active Jun 3, 2021
RDRC T-Shirt Sizing
View T-Shirt Sizing.md

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 / controller.rb
Created Jul 30, 2012
GoogleVisualr Gem - Bubble Chart Creation Example
View controller.rb
# 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( [