To set this up you will need to download this gist. Change into the directory this gist is in then;
rails new your_app_name --database=postgresql -m ./template.rb
--- | |
BUNDLE_PATH: "vendor/bundle" |
# frozen_string_literal: true | |
require "json" | |
require "nokogiri" | |
module Types | |
class BaseType | |
def to_hash | |
hash = {} |
import React, { useEffect, useState } from 'react'; | |
import { createClient } from 'grpc-web-client'; | |
import { DataService } from './generated/data_pb_service'; | |
const DataClient = createClient(DataService); | |
function DataFetching({ url }) { | |
const [data, setData] = useState(null); | |
const [loading, setLoading] = useState(true); | |
const [error, setError] = useState(null); |
#!/usr/bin/env bash | |
### Usage | |
# Ensure your shell has access to your github account and rubygems account. | |
# Install github cli. In mac do; | |
# ```sh | |
# brew install gh |
Description: | |
Generator for Model, Migration, View, Controller and Relationships. | |
Example: | |
bin/rails generate peparizer some_model_in_plural [options] | |
--search_fields ':field1, :field2' # only two fields | |
This will create: | |
search service | |
controller |
Steps to deploy a Node.js app to Digital Ocean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt
If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a
I will be using the root user, but would suggest creating a new user
module AlbumConcern | |
private | |
def set_album | |
@album = Album.find(params[:id]) | |
end | |
def filter_albums(albums) | |
filter = params[:filter] | |
return albums unless filter |
$ sudo apt-get install gnupg2 -y $ sudo gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
$ git clone https://github.com/rbenv/rbenv.git ~/.rbenv $ cd ~/.rbenv/ $ sudo src/configure $ sudo ./configure $ sudo make
# Store input numbers | |
num1 = input('Enter first number: ') | |
num2 = input('Enter second number: ') | |
# Add two numbers | |
summ = float(num1) + float(num2) | |
# Subtract two numbers | |
diff = float(num1) - float(num2) |