Ruby on Rails 3 – Reload lib directory for each request

I couldn’t get any of the above to work for me so I dug in the Rails code a bit and came up with this: New file: config/initializers/reload_lib.rb if Rails.env == “development” lib_reloader = ActiveSupport::FileUpdateChecker.new(Dir[“lib/**/*”]) do Rails.application.reload_routes! # or do something better here end # For Rails 5.1+ ActiveSupport::Reloader.to_prepare do lib_reloader.execute_if_updated end # For Rails … Read more

vue.js auto reload / refresh data with timer

No need to re-invent the wheel, window.setInterval() does the job pretty well Vue.component(‘events’, { template: ‘#events-template’, data () { return { list: [], timer: ” } }, created () { this.fetchEventsList(); this.timer = setInterval(this.fetchEventsList, 300000); }, methods: { fetchEventsList () { this.$http.get(‘events’, (events) => { this.list = events; }).bind(this); }, cancelAutoUpdate () { clearInterval(this.timer); } … Read more

A better way to restart/reload Gunicorn (via Upstart) after ‘git pull’ing my Django projects

You can tell Gunicorn to reload gracefully using the HUP signal like so: kill -HUP <pid> (see the FAQ for details) I use Supervisor to control my Gunicorn server, which allows me to use this (slightly hacky) way of reloading Gunicorn after a deploy: supervisorctl status gunicorn | sed “s/.*[pid ]\([0-9]\+\)\,.*/\1/” | xargs kill -HUP … Read more

Refresh (reload) a page once using jQuery?

Alright, I think I got what you’re asking for. Try this if(window.top==window) { // You’re not in a frame, so you reload the site. window.setTimeout(‘location.reload()’, 3000); //Reloads after three seconds } else { //You’re inside a frame, so you stop reloading. } If it is once, then just do $(‘#div-id’).triggerevent(function(){ $(‘#div-id’).html(newContent); }); If it is … Read more

Rails Console: reload! not reflecting changes in model files? What could be possible reason?

reload! only reloads the latest code in the console environment. It does not re-initialize existing objects. This means if you have already instantiated any objects, their attributes would not be updated – including newly introduced validations. However, if you create a new object, its attributes (and also validations) will reflect the reloaded code. more here

Is there an easy way to reload css without reloading the page?

Possibly not applicable for your situation, but here’s the jQuery function I use for reloading external stylesheets: /** * Forces a reload of all stylesheets by appending a unique query string * to each stylesheet URL. */ function reloadStylesheets() { var queryString = ‘?reload=’ + new Date().getTime(); $(‘link[rel=”stylesheet”]’).each(function () { this.href = this.href.replace(/\?.*|$/, queryString); }); … Read more