This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This file lives in app/assets/javascripts/ | |
//It has to be required in app/assets/javascripts/application.js, not shown here | |
// | |
//It uses browser timezones to correct the client's display of dates and times in three areas of a Sharetribe site. | |
//By not changing the database, these times will always be UTC in the backend. Indeed, their values remain UTC for the client, | |
//though the display of the times in the DOM is modified. | |
const timeRegex = /((1[0-2]|0?[1-9]):([0-5][0-9]) ?([AaPp][Mm]))/g; | |
const daysOfWeekRegex = /(Sun|Mon|Tue|Wed|Thu|Fri|Sat)/g; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const crypto = require("crypto") | |
// The `generateKeyPairSync` method accepts two arguments: | |
// 1. The type ok keys we want, which in this case is "rsa" | |
// 2. An object with the properties of the key | |
const { publicKey, privateKey } = crypto.generateKeyPairSync("rsa", { | |
// The standard secure default length for RSA keys is 2048 bits | |
modulusLength: 2048, | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let isRefreshing = false; | |
let refreshSubscribers = []; | |
const instance = axios.create({ | |
baseURL: Config.API_URL, | |
}); | |
instance.interceptors.response.use(response => { | |
return response; | |
}, error => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :jobs do | |
#bundle exec rake delayed_job:monit RAILS_ENV=demo | |
desc "Monitor delayed_job processes." | |
task :monit => :environment do | |
@server_name = `uname -n`.split("\n").first | |
@application_name = Rails.application.class.parent_name | |
delayed_job_found = Hash.new | |
def do_alert(msg) |