Skip to content

Instantly share code, notes, and snippets.

@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

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 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.

@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 / Gemfile
Last active September 28, 2015 15:10
For enabling SQLite3 in Rails
gem "sqlite3"
@winston
winston / gist:c82124ae560e57f7f865
Created March 25, 2015 09:42
From Local to Heroku
# 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 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 / 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( [