Skip to content

Instantly share code, notes, and snippets.

View ndrean's full-sized avatar
🏠
Working from home

Neven DREAN ndrean

🏠
Working from home
View GitHub Profile
@ndrean
ndrean / RAILS_CHEATSHEET.md
Created December 22, 2019 21:50 — forked from mdang/RAILS_CHEATSHEET.md
Ruby on Rails Cheatsheet

Ruby on Rails Cheatsheet

Architecture

Create a new application

Install the Rails gem if you haven't done so before

@ndrean
ndrean / contact-form.md
Created May 26, 2020 17:07 — forked from stevecondylios/contact-form.md
Tutorial: Create and Deploy a Contact Form to Production in Ruby on Rails 5

Create a Contact Form in Rails 5

This is a complete, step-by-step tutorial showing how to create a fully functional contact form in production in rails 5. Rather than reinvent things, the following borrows from the best available documentation and tutorials (most notably, this tutorial on making a contact form in development). The finished contact form can be viewed here.

This tutorial uses:

  • heroku for deployment,
  • gmail for the mailer, and
  • github for version control

It would be a good idea to create a new gmail account to use for your mailer now, if you haven't already. If you haven't yet got a heroku account and installed the heroku CLI, it would be easiest to do so now.

@ndrean
ndrean / nginx.conf
Created November 12, 2020 23:39 — forked from tompave/nginx.conf
commented nginx.conf for Ruby on Rails
# A commented nginx configuration file for Ruby on Rails
#
# Author: Tommaso Pavese
# tommaso@pavese.me
# http://tommaso.pavese.me
#
# License: http://www.wtfpl.net/
#
#
# Tested with:
@ndrean
ndrean / countContainers.sh
Created November 20, 2020 01:50 — forked from ggtools/countContainers.sh
A simple script to count the containers on a Docker host.
#!/bin/bash
function countContainers() {
docker ps -q $1 | wc -l
}
function countCrashedContainers() {
docker ps -a | grep -v -F 'Exited (0)' | grep -c -F 'Exited ('
}
@ndrean
ndrean / introrx.md
Created December 5, 2020 18:02 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@ndrean
ndrean / my_k8s_things.md
Last active August 21, 2021 16:48
k8 manifests for Rails, Postgres, Redis, AcitonCable standalone, Nginx in front passing websockets
Test
@ndrean
ndrean / mac-setup-redis.md
Created November 4, 2021 13:32 — forked from tomysmile/mac-setup-redis.md
Brew install Redis on Mac

type below:

brew update
brew install redis

To have launchd start redis now and restart at login:

brew services start redis
@ndrean
ndrean / javascript-proxy-as-rest-client.js
Created February 8, 2022 22:49 — forked from DavidWells/javascript-proxy-as-rest-client.js
Using a javascript proxy as low code REST client
/* Using a JavaScript proxy for a super low code REST client */
// via https://dev.to/dipsaus9/javascript-lets-create-aproxy-19hg
// also see https://towardsdatascience.com/why-to-use-javascript-proxy-5cdc69d943e3
// also see https://github.com/fastify/manifetch
// also see https://github.com/flash-oss/allserver
const createApi = (url) => {
return new Proxy({}, {
get(target, key) {
return async function(id = "") {
const response = await fetch(`${url}/${key}/${id}`)
@ndrean
ndrean / readParseSerializeSaveXML.js
Last active July 2, 2023 18:44
Open file from browser, XML parse it, serialize it and save to disk
<body>
<input id="input" type="file" accept=".gpx" />;
<script type="module" src="/main.js"></script>
</body>
let newHandle;
input.addEventListener("change", async (e) => {