- Install Docker for Mac
- https://store.docker.com/editions/community/docker-ce-desktop-mac
- once installed enable kubernetes from preferences and select kubernetes as the default orchestrator
- on the advanced section, increase your cpu and memory to about 2 CPU and 2gb of RAM, for now.
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
const audio = new AudioContext(), | |
sound = audio.createMediaStreamSource(stream), | |
analyser = audio.createAnalyser(); | |
analyser.minDecibels = -60; | |
// microphone -> filter -> destination. | |
sound.connect(analyser); | |
analyser.connect(audio.destination); | |
const frequencyData = new Uint8Array(analyser.frequencyBinCount).slice(0, 32), | |
spectrum = document.querySelector('#spectrum'); |
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
class PostFixCalculator | |
attr_accessor :list, :original_list | |
def initialize(list) | |
@original_list = list | |
@list = list.split(' ') | |
end | |
def evaluation |
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
class PascalTriangle | |
attr_accessor :height | |
def initialize(height) | |
@height = height.to_i | |
end | |
def self.next_row(current_row) | |
([0] + current_row).zip(current_row + [0]).map{ |a| a.inject(:+) } |
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
# Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. | |
# y = mx + b (Equation of a straight line) | |
class Plot | |
attr_accessor :coordinates | |
def initialize(points=[]) | |
@coordinates = points |
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
class Example < ActiveRecord::Base | |
include Filterable | |
filterable scopes: %i(search bar) | |
scope :foo, ->(q) { where(foo: q) } | |
scope :bar, ->(q) { where(bar: q) } | |
end |
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
# frozen_string_literal: true | |
class CsvSerializer | |
attr_accessor :data | |
def initialize(serializer) | |
@serializer = serializer | |
@data = serializer&.serializable_hash&.dig(:data) || [] | |
end |
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
class ApiConstraint | |
def initialize(options) | |
@version = options[:version] | |
@default = options[:default] | |
end | |
def matches?(request) | |
@default || request.headers.fetch(:accept).include?("version=#{version}") | |
end | |
end |
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
# Pundit | |
# Friendly ID | |
# FastJSON | |
module ActsAsResource | |
extend ActiveSupport::Concern | |
included do | |
include Pundit |
OlderNewer