The main difference between the two pages is the method of sending messages. Recieving messages is the same in both.
Send messages to iframe using iframeEl.contentWindow.postMessage
Recieve messages using window.addEventListener('message')
require 'sequel' | |
DB ||= Sequel.connect ENV['DATABASE_URL'] | |
class Resource < Sequel::Model | |
include Sequel.inflections | |
def after_save | |
db.notify channel | |
end |
require 'capistrano/setup' | |
require 'capistrano/deploy' | |
require 'capistrano/rvm' | |
require 'capistrano/bundler' | |
# Loads custom tasks from `lib/capistrano/tasks' if you have any defined. | |
Dir.glob('lib/capistrano/tasks/*.cap').each { |r| import r } |
#!/bin/sh | |
### BEGIN INIT INFO | |
# Provides: unicorn | |
# Required-Start: $all | |
# Required-Stop: $network $local_fs $syslog | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: starts the unicorn instances | |
# Description: starts the unicorn server instances using start-stop-daemon | |
# |
# Tested on OSX Yosemite 10.10.4 | |
# there is also an updated version (work in progress) for El Capitan here https://gist.github.com/guycalledseven/31ffe35eca056838b06b | |
# XXX TODO | |
# should I disable com.google.Keystone.Agent ?? | |
# http://applehelpwriter.com/2014/07/13/how-to-remove-googles-secret-update-software-from-your-mac/ | |
# Stop DS_Store file creation on network connections | |
# restart Finder afterwards |
# This class shows uses version 0.28.7 of the ruby google-api-client gem circa April 2019 | |
# to query the Google Play subscription API. | |
# | |
# If using an older version of the google-api-client gem (ie. version 0.8.x), instead refer to: | |
# https://gist.github.com/jkotchoff/e60fdf048ec443272045/e3e2c867633900d9d6f53de2de13aa0a0a16bb03 | |
# | |
# Sample usage: | |
# | |
# package_name = 'com.stocklight.stocklightapp' | |
# product_id = 'com.stocklight.stocklight.standardsubscription' |
<script id="if_equals_example" type="text/x-handlebars-template"> | |
{{#if_equals objectType 'message'}} | |
<div class="message"> | |
Message | |
</div> | |
{{else}} | |
{{/if_equals}} | |
</script> |
class PostsController < ActionController::Base | |
def create | |
Post.create(post_params) | |
end | |
def update | |
Post.find(params[:id]).update_attributes!(post_params) | |
end | |
private |
#!/bin/bash | |
usage() { | |
cat << EOF | |
Usage: $0 [OPTION]... COMMAND | |
Execute the given command in a way that works safely with cron. This should | |
typically be used inside of a cron job definition like so: | |
* * * * * $(which "$0") [OPTION]... COMMAND | |
Arguments: |