I recently read up quite some articles on microframworks and I liked the idea to try out Cuba instead of the regular Sinatra for a change. Here is what I ended up with.
First of all my Gemfile:
source "https://rubygems.org"
ruby "2.0.0"
// JavaScript | |
let hidePage = () => { | |
let payload = { | |
object_type: 'page', | |
object_id: 123, | |
namespace: 'seo', | |
key: 'hidden', | |
value: 1, | |
value_type: 'number_integer' | |
}; |
// app/javascript/shopify_app/shopify_app.js | |
import { getSessionToken } from "@shopify/app-bridge-utils"; | |
import $ from "jquery"; | |
const SESSION_TOKEN_REFRESH_INTERVAL = 2000; // Request a new token every 2s | |
async function retrieveToken(app) { | |
window.sessionToken = await getSessionToken(app); | |
} |
Since I did not want to constantly re-invent the wheel I will write down my choices for putting together my Cuba template.
rbenv local 2.2.3
or somesuchGemfile.lock
to git
tooroutes
and config
directories, want to put stuff in thereCuba
route in routes/default.rb
#Goal Deploy your Rails App super easily with Dokku on Digital Ocean cheap cheap!
##Notes
Procfile
with the command to start up your application serverLogentries
(not in this guide)AppSignal
or New Relic
(not in this guide)# Ways to execute a shell script in Ruby | |
# Example Script - Joseph Pecoraro | |
cmd = "echo 'hi'" # Sample string that can be used | |
# 1. Kernel#` - commonly called backticks - `cmd` | |
# This is like many other languages, including bash, PHP, and Perl | |
# Returns the result of the shell command | |
# Docs: http://ruby-doc.org/core/classes/Kernel.html#M001111 |
# First install tmux | |
brew install tmux | |
# For mouse support (for switching panes and windows) | |
# Only needed if you are using Terminal.app (iTerm has mouse support) | |
Install http://www.culater.net/software/SIMBL/SIMBL.php | |
Then install https://bitheap.org/mouseterm/ | |
# More on mouse support http://floriancrouzat.net/2010/07/run-tmux-with-mouse-support-in-mac-os-x-terminal-app/ |
set nocompatible " be iMproved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" alternatively, pass a path where Vundle should install plugins | |
"call vundle#begin('~/some/path/here') | |
" let Vundle manage Vundle, required |
unbind C-b | |
set -g prefix C-s | |
# $Id: h-boetes.conf,v 1.2 2009-10-25 21:45:26 nicm Exp $ | |
# | |
# From Han Boetes. | |
set -g default-command zsh | |
set -g status-right "#(uptime|awk '{print $11}') #(date)" |