Skip to content

Instantly share code, notes, and snippets.

View 1Rhino's full-sized avatar

1rhino 1Rhino

View GitHub Profile
@1Rhino
1Rhino / web-fonts-asset-pipeline.md
Created May 25, 2018 07:53 — forked from anotheruiguy/web-fonts-asset-pipeline.md
Custom Web Fonts and the Rails Asset Pipeline

Web fonts are pretty much all the rage. Using a CDN for font libraries, like TypeKit or Google Fonts, will be a great solution for many projects. For others, this is not an option. Especially when you are creating a custom icon library for your project.

Rails and the asset pipeline are great tools, but Rails has yet to get caught up in the custom web font craze.

As with all things Rails, there is more then one way to skin this cat. There is the recommended way, and then there are the other ways.

The recommended way

Here I will show how to update your Rails project so that you can use the asset pipeline appropriately and resource your files using the common Rails convention.

  1. UserApi.js
import axios from "axios"

export default {
  getAllExtraCompanies: function (cb, errorCB) {
    let url = '/api/backend/extra_companies'
    this._sendRequestToDelivery(url, {}, 'get', cb, errorCB)
  },
@1Rhino
1Rhino / cloudSettings
Last active June 12, 2018 10:12
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-06-12T10:12:01.675Z","extensionVersion":"v2.9.2"}
@1Rhino
1Rhino / cloudSettings
Created March 21, 2018 16:41
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-03-21T16:41:04.629Z","extensionVersion":"v2.9.0"}
@1Rhino
1Rhino / cloudSettings
Created December 24, 2017 07:38
Visual Studio Code Settings Sync Gist
{"lastUpload":"2017-12-24T07:38:53.099Z","extensionVersion":"v2.8.7"}
@1Rhino
1Rhino / cloudSettings
Last active December 20, 2017 02:10
Visual Studio Code Settings Sync Gist
{"lastUpload":"2017-12-20T02:10:36.078Z","extensionVersion":"v2.8.7"}
@1Rhino
1Rhino / cloudSettings
Last active May 15, 2018 08:37
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-05-15T08:37:57.340Z","extensionVersion":"v2.9.2"}
module TaxServices
class ItemPrice
def initialize(total_price, has_tax, has_service_tax)
@total_price = total_price
@service_tax_rate = has_tax ? Settings.tax.service_tax_rate : 0
@tax_rate = has_service_tax ? Settings.tax.tax_rate : 0
end
def perform
OpenStruct(
@1Rhino
1Rhino / deploy.rb
Created April 10, 2017 03:16 — forked from stas/deploy.rb
Mina Deploy Task (Rails + Puma + Delay Job + rbenv)
require 'mina/bundler'
require 'mina/rails'
require 'mina/git'
require 'mina/rbenv' # for rbenv support. (http://rbenv.org)
# require 'mina/rvm' # for rvm support. (http://rvm.io)
# Basic settings:
# domain - The hostname to SSH to.
# deploy_to - Path to deploy into.
# repository - Git repo to clone from. (needed by mina/git)
@1Rhino
1Rhino / gist:82d112edacef7f0630693675c551bdbc
Created March 16, 2017 09:42 — forked from jgorset/gist:1747655
How Sprockets works with JST and EJS templates
// This document distills the magic that happens when you create a file with the ".jst"
// and ".ejs" extensions anywhere on your asset path in Ruby on Rails, courtesy of the
// Sprockets library (https://github.com/sstephenson/sprockets).
//
// For the purpose of this example, imagine that you have created a template for
// messages in `app/assets/javascripts/backbone/templates/messages/message.jst.ejs`
// with the following contents:
//
// <h1><%= user.full_name %></h1>
// <p><%= body %></p>