Skip to content

Instantly share code, notes, and snippets.

@getadeo
getadeo / ract-dropzone-image.js
Created June 29, 2023 15:26 — forked from schabluk/ract-dropzone-image.js
React-Dropzone get image width, height and base64 data
onDrop = (acceptedFiles, rejectedFiles) => {
const file = acceptedFiles.find(f => f)
const i = new Image()
i.onload = () => {
let reader = new FileReader()
reader.readAsDataURL(file)
reader.onload = () => {
console.log({
src: file.preview,
@getadeo
getadeo / sidekiq_monitoring
Created November 26, 2022 07:25 — forked from ngsmrk/sidekiq_monitoring
Sidekiq queue checking via rails console
stats = Sidekiq::Stats.new
stats.queues
stats.enqueued
stats.processed
stats.failed
@getadeo
getadeo / install_ffmpeg_ubuntu.sh
Created January 10, 2020 02:35 — forked from xdamman/install_ffmpeg_ubuntu.sh
Install latest ffmpeg on ubuntu 12.04 or 14.04
#!/bin/bash
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04
# Inspired from https://gist.github.com/faleev/3435377
# Remove any existing packages:
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev
# Get the dependencies (Ubuntu Server or headless users):
sudo apt-get update
On Mac OSX
copy selected part: visually select text(type v or V in normal mode) and type :w !pbcopy
copy the whole file :%w !pbcopy
paste from the clipboard :r !pbpaste
class User < ActiveRecord::Base
# keep the default scope first (if any)
default_scope { where(active: true) }
# constants come up next
COLORS = %w(red green blue)
@getadeo
getadeo / rails http status codes
Created September 25, 2019 03:53 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@getadeo
getadeo / 01_ror_tutorial_exercise_answers.md
Created August 5, 2019 02:48
Ruby on Rails Tutorial Exercise Answers

Ruby on Rails Tutorial Exercise Answers

Chapter 1

Section 1.1.1

  1. https://rubygems.org hosts the Ruby gem for Ruby on Rails.
  2. The current stable version number of Rails is 5.1.4, with 5.2.0.beta2 being the overall latest version.
  3. As of this writing, Ruby on Rails has been downloaded 118,011,892 across all versions.
git filter-branch --tree-filter 'rm -rf node_modules' --prune-empty HEAD
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d
echo node_modules/ >> .gitignore
git add .gitignore
git commit -m 'Removing node_modules from git history'
git gc
git push origin master --force
@getadeo
getadeo / README.md
Created May 29, 2018 01:17 — forked from mmailhos/AWS Architect Associate - Reminder.md
AWS Architect Associate - Reminder

AWS Architect Associate - Reminder

EC2

General purpose SSD have a maximum of 10.000 IOPS.

It is possible to detach non-root volume from running EC2 instance.

An EC2 placement group is used to determin how far are instances placed between each other. In cluster mode, they will be placed to reduce the latency inside a single AZ. In spread mode, they will be placed on different underlying hardware (and potentially in different AZ).

call "9263262904", {:callerID => 'sip:21588734@sip.tropo.net'}
ask "Who would you like to call? Just say Joe or John", {
:choices => "Joe, John",
:mode => "speech",
:recognizer => "en-PH",
:minConfidence => 0.6,
:onChoice => lambda { |event| say "You said" + event.value},
:onBadChoice => lambda { |event| say "I'm sorry, I didn't understand what you said."},
:onTimeout => lambda { |event| say "I'm sorry, I didn't hear anything"},
:onHangup => lambda { |event| log "Caller disconnected"}