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
# .github/workflows/test.yml | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main |
The set
lines
- These lines deliberately cause your script to fail. Wait, what? Believe me, this is a good thing.
- With these settings, certain common errors will cause the script to immediately fail, explicitly and loudly. Otherwise, you can get hidden bugs that are discovered only when they blow up in production.
set -euxo pipefail
is short for:
set -e
set -u
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
/** | |
* Sleep, delay, pause or wait in Javascript | |
* @link https://www.sitepoint.com/delay-sleep-pause-wait/ | |
* @param {Number} timeout Number in miliseconds | |
* @return {Promise} | |
*/ | |
export const sleep = timeout => new Promise(resolve => setTimeout(resolve, timeout)) |
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 { defineAsyncComponent } from 'vue' | |
const Content = defineAsyncComponent(() => import('./component-content.js')) | |
export default { | |
name: 'App', | |
components: { Content }, | |
template: /*html*/` | |
<Content /> | |
` |
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/bash | |
# see also | |
# - Google's Shell Style Guide: https://google.github.io/styleguide/shell.xml | |
# - ShellCheck: https://github.com/koalaman/shellcheck | |
# src: | |
# - http://hackaday.com/2017/07/21/linux-fu-better-bash-scripting | |
# - https://dev.to/thiht/shell-scripts-matter |
https://cloud.digitalocean.com/account/api/tokens
sudo apt-get install s3cmd
https://docs.digitalocean.com/products/spaces/resources/s3cmd/
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
require 'singleton' | |
class SimpleLogger | |
include Singleton | |
attr_accessor :level | |
ERROR=1 | |
WARNING=2 | |
INFO=3 |
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
module Authenticable | |
# Devise methods overwrite | |
def current_user | |
@current_user ||= User.find_by(authentication_token: request.headers['Authorization']) | |
end | |
def authenticate_with_token! | |
render json: { errors: "Not authenticated" }, | |
status: :unauthorized unless user_signed_in? |
NewerOlder