This gist will collect all issues we solved with Rails 5.2 and Webpacker
# Last few parameters(--skip-* part) is only my habbit not actully required
$ rails new --webpack=stimulus --database=postgresql --skip-coffee --skip-test
/** | |
* Delete an image from the S3 Bucket | |
* | |
* @author Daveyon Mayne <@MirMayne> | |
* @date July 14th 2019 | |
*/ | |
const AWS = require('aws-sdk'); | |
const deletePhoto = async (avatar_url) => { |
/** | |
* This gist was inspired from https://gist.github.com/homam/8646090 which I wanted to work when uploading an image from | |
* a base64 string. | |
* Updated to use Promise (bluebird) | |
* Web: https://mayneweb.com | |
* | |
* @param {string} base64 Data | |
* @return {string} Image url | |
*/ | |
const imageUpload = async (base64) => { |
# app/jobs/example_job.rb | |
class ExampleJob < ActiveJob::Base | |
queue_as :default | |
rescue_from(ActiveRecord::RecordNotFound) do | |
retry_job wait: 1.minute, queue: :default | |
end | |
def perform(param_1, param_2) |
class MyJob < ActiveJob::Base | |
queue_as :urgent | |
rescue_from(NoResultsError) do | |
retry_job wait: 5.minutes, queue: :default | |
end | |
def perform(*args) | |
MyService.call(*args) | |
end |
class Node: | |
def __init__(self, val): | |
self.val = val | |
self.left_child = None | |
self.right_child = None | |
# def get(self): | |
# return self.val | |
# def set(self, val): |
version: '2' | |
services: | |
elasticsearch: | |
build: | |
context: elasticsearch/ | |
args: | |
ELK_VERSION: $ELK_VERSION | |
volumes: |
input { | |
tcp { | |
port => 5000 | |
} | |
} | |
filter { | |
grok { | |
match => { | |
"message" => "%{SYSLOG5424PRI:pri}%{NUMBER:rfc_version} %{TIMESTAMP_ISO8601:timestamp} d.%{UUID:drain_id} %{WORD:app} %{USERNAME:dyno} - - %{GREEDYDATA:message}" |
alias k='clear' | |
alias ll='ls -al' | |
alias fs='foreman start -f Procfile.dev' | |
alias gcd='git checkout develop' | |
alias gcp='git checkout -' | |
alias grd='git rebase develop' | |
alias gam='git commit --amend --no-edit' | |
alias gpf='git push -f' | |
alias gcb='git checkout -b' | |
alias gp='git pull origin' |
require 'observer' | |
class CoffeeShop | |
include Observable | |
attr_reader :customers | |
def initialize(name, capacity) | |
@name = name | |
@capacity = capacity | |
@customers = [] |