This file contains hidden or 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
| import { Controller } from "stimulus"; | |
| import { get } from "@rails/request.js"; | |
| import { PageSnapshot } from "@hotwired/turbo"; | |
| export default class extends Controller { | |
| static values = { hoverTime: Number }; | |
| connect() { | |
| this.element.addEventListener("mouseover", this.prefetch.bind(this)); | |
| this.element.addEventListener("touchstart", this.prefetch.bind(this)); | |
| } |
This file contains hidden or 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
| // DISCLAIMER : You can now probably use `data-turbo-action="advance"` on your frame to perform what this controller is aiming to do | |
| // https://turbo.hotwired.dev/handbook/frames#promoting-a-frame-navigation-to-a-page-visit | |
| // Note that you probably want to disable turbo cache as well for those page to make popstate work properly | |
| import { navigator } from '@hotwired/turbo' | |
| import { Controller } from '@hotwired/stimulus' | |
| import { useMutation } from 'stimulus-use' | |
| export default class extends Controller { | |
| connect (): void { |
This file contains hidden or 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
| :plain | |
| var existingModal = document.querySelector("[data-controller='modal']"); | |
| if (existingModal) { | |
| document.body.removeChild(existingModal); | |
| } | |
| document.body.insertAdjacentHTML("beforeend", "#{j render partial: template.to_s, locals: local_assigns }"); |
This file contains hidden or 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
| #!/bin/sh | |
| # Set up the Heroku scheduler to run this command every hour. See example setup at https://goo.gl/nMCSH3 | |
| # | |
| # Requires env vars to be set in Heroku with `heroku config:set`: | |
| # - HEROKU_APP_NAME: this is just the app name in Heroku, i.e. `heroku apps` will list all apps you have access to | |
| # - HEROKU_CLI_USER: Once Heroku CLI is authenticated (https://goo.gl/Qypr4x), check `cat .netrc` (or `_netrc` on Windows), | |
| # look for `login` under `machine api.heroku.com` | |
| # - HEROKU_CLI_TOKEN: As above, but use the `password` field | |
| # |
This file contains hidden or 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
| # NOTICE: to get Nginx+Unicorn best-practices configuration see the gist https://gist.github.com/3052776 | |
| $ cd /usr/src | |
| $ wget http://nginx.org/download/nginx-1.2.1.tar.gz | |
| $ tar xzvf ./nginx-1.2.1.tar.gz && rm -f ./nginx-1.2.1.tar.gz | |
| $ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gz | |
| $ tar xzvf pcre-8.30.tar.gz && rm -f ./pcre-8.30.tar.gz | |
| $ wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz |