SSH into Root
$ ssh [email protected]
Change Root Password
class Api::RegistrationsController < Api::BaseController | |
respond_to :json | |
def create | |
user = User.new(params[:user]) | |
if user.save | |
render :json=> user.as_json(:auth_token=>user.authentication_token, :email=>user.email), :status=>201 | |
return | |
else |
SSH into Root
$ ssh [email protected]
Change Root Password
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.
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.
# see https://github.com/thomasjbradley/signature-pad for more details | |
instructions = JSON.load(data).map { |h| "line #{h['mx']},#{h['my']} #{h['lx']},#{h['ly']}" } * ' ' | |
system "convert -size 198x55 xc:transparent -stroke blue -draw '#{instructions}' signature.png" |
require 'mina/bundler' | |
require 'mina/rails' | |
require 'mina/git' | |
require 'mina/rbenv' | |
set :repository, '[email protected]:sanjayprajapati/your-app.git' | |
set :user, 'deploy' | |
set :deploy_to, '/home/deploy/your-app-name' | |
set :branch, 'develop' | |
set :domain, YOUR_SERVER_IP |
2.5.1 :006 > Ahoy::Visit.first | |
Ahoy::Visit Load (1.1ms) SELECT "ahoy_visits".* FROM "ahoy_visits" ORDER BY "ahoy_visits"."id" DESC LIMIT $1 [["LIMIT", 1]] | |
=> #<Ahoy::Visit id: 1, visit_token: "d1dec227-ecd8-4052-bd45-ba7f5ac162b8", visitor_token: "76afdd83-5dc8-43a6-8dc8-21bf43ae247b", | |
user_id: nil, ip: "127.0.0.1", user_agent: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36...", referrer: nil, | |
referring_domain: nil, landing_page: "http://localhost:3000/", browser: "Chrome", os: "GNU/Linux", device_type: "Desktop", | |
country: nil, region: nil, city: nil, utm_source: nil, utm_medium: nil, utm_term: nil, utm_content: nil, utm_campaign: nil, | |
started_at: "2018-06-03 14:23:49"> |
class Ahoy::Store < Ahoy::DatabaseStore | |
def track_visit(data) | |
data[:accept_language] = request.headers["Accept-Language"] | |
super(data) | |
end | |
def track_event(data) | |
data[:properties] = { key: 'value' } | |
super(data) |
class ApplicationMailbox < ActionMailbox::Base | |
# Any of the recipients of the mail (whether to, cc, bcc) are matched against the regexp. | |
routing /^replies@/i => :replies | |
# Any of the recipients of the mail (whether to, cc, bcc) needs to be an exact match for the string. | |
routing "[email protected]" => :help | |
# Any inbound_email that has not been already matched will be sent to the BackstopMailbox. | |
routing :all => :backstop | |
end |
class ApplicationMailbox < ActionMailbox::Base | |
routing ->(inbound_email) { with_sku?(inbound_email) } => :price_finder | |
def self.with_sku?(inbound_email) | |
inbound_email.mail.subject.include?('SKU') || inbound_email.mail.body.include?('SKU') | |
end | |
end | |
class PriceFinderMailbox < ApplicationMailbox |
module Spree | |
class TaxonHeaderImage < Asset | |
include Rails.application.config.use_paperclip ? Configuration::Paperclip : Configuration::ActiveStorage | |
include Rails.application.routes.url_helpers | |
def styles | |
self.class.styles.map do |_, size| | |
width, height = size[/(\d+)x(\d+)/].split('x') | |
{ |