Skip to content

Instantly share code, notes, and snippets.

@stevenyap
stevenyap / Font_linking.md
Created May 5, 2014 08:25
Font Linking for SASS in Rails

How to make web fonts work on Heroku

Add the fonts path to your production.rb and development.rb

# Add the font path
config.assets.paths << Rails.root.join('app', 'assets', 'fonts')

# Include font files to Assets
config.assets.precompile &lt;&lt; /\.(?:svg|eot|woff|ttf)$/
@stevenyap
stevenyap / Heroku_Staging.md
Last active June 11, 2019 16:09
Staging workflow on Heroku

This describes the workflow to use Heroku as a staging environment. It assumes you already have an existing heroku app in production.

# rename your git remote heroku to something else like production
git remote rename heroku production

# so now you will push as: git push production master

# create the staging app
heroku apps:create staging-appname
@stevenyap
stevenyap / RakeTask.md
Created April 30, 2014 06:49
RakeTask - Use your own rake task to automate frequent manual tasks

This file is placed in /lib/tasks and it doesn't matter what is the filename but it must end in .rake eg. some_name.rake

namespace :db do
  desc 'Export database into db/seeds.rb'
  task :export do
    backup_file = 'db/seeds-bkup.rb'
    seed_file = 'db/seeds.rb'

    puts '*** Exporting database into db/seeds.rb ***'
@stevenyap
stevenyap / JQuery OOP.md
Created April 21, 2014 13:43
OOP in jQuery
(function($) {
  // create a class in jQuery scope
  $.landingVideo = function(options) {
    // define a self to be used as the main var
    // using 'this' breaks in event passing
    var self = {

      options: $.extend({
        video_player_id: '',
@stevenyap
stevenyap / SASS Debug.md
Created March 5, 2014 02:42
Debugging SASS in Rails 4

Debug SASS in rails

You need to see the SASS references instead of the generated CSS. Do the following to see it.
Install the following:

group :development do
  gem 'sass-rails-source-maps'
  gem 'sass', '>= 3.3.0.rc.6'
end
@stevenyap
stevenyap / Jasmine.md
Created February 27, 2014 03:57
Jasmine - JS Testing Framework
@stevenyap
stevenyap / HTML5.md
Created February 25, 2014 12:31
HTML5
@stevenyap
stevenyap / GenyMotion Android Emulator.md
Created February 25, 2014 11:20
GenyMotion Android Emulator - Setup an android environment on Mac using VirtualBox
@stevenyap
stevenyap / Capistrano 3.md
Created February 21, 2014 08:52
Capistrano 3 Setup

This guide explains the way to setup a production server using Capistrano.

Setup Capistrano on LOCAL

  • Capistrano is a development gem which assist the developer to run commands on the production server (something like a Heroku toolbelt)
  • Hence, it is installed and configured on developer's computer
# Gemfile

# Use Capistrano for deployment
@stevenyap
stevenyap / Apache.md
Created February 21, 2014 08:51
Apache Configuration and more

Subdomain setup

# Note that you may want to uncomment NameVirtualHost *:80 in /etc/httpd/conf/httpd.conf to unset warnings for conflicted *:80

Listen 801
Listen 802
Listen 803
Listen 804