This file contains 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
FROM bitnami/git:latest | |
RUN apt-get update | |
RUN apt-get install -y --no-install-recommends --no-install-suggests less neovim | |
RUN echo "alias ll='ls -lah --color'" >> ~/.bashrc | |
WORKDIR /pizzaplace | |
CMD "bash" |
This file contains 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
# Export your extention list and your settings from VSCode | |
code --list-extensions | tee ~/vscode-extensions.txt | |
cp ~/Library/Application\ Support/Code/User/settings.json ~/vscode-settings.json | |
cp ~/Library/Application\ Support/Code/User/keybindings.json ~/vscode-keybindings.json | |
cp -r ~/Library/Application\ Support/Code/User/snippets ~/vscode-usersnippets | |
# Uninstall VSCode (may vary if you haven't installed through brew) | |
brew cask uninstall --force visual-studio-code | |
# Install VSCodium | |
brew cask install vscodium |
This file contains 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
root = true | |
[*] | |
charset = utf-8 | |
end_of_line = lf | |
insert_final_newline = true | |
trim_trailing_whitespace = true | |
indent_style = space | |
indent_size = 2 |
This file contains 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 'benchmark' | |
# ------------------------------------------------------------------------------ | |
# Add 2 collections together and sort the result | |
def add_and_sort(left, right) | |
(left + right).sort { |a, b| b[:updated_at] <=> a[:updated_at] } | |
end | |
# ------------------------------------------------------------------------------ | |
# Merge 2 previously ordered collections together |
This file contains 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 Pipe | |
def self.unwrap | |
self | |
end | |
def self._unwrap(context, input, ops) | |
ops.inject(input) { |value, op| context.send(op, value) } | |
end | |
def initialize(context, input) |
This file contains 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 'benchmark' | |
require 'active_support/core_ext/module/delegation' | |
# 6! = 720 | |
METHODS = %w[a b c d e f].permutation.map(&:join) | |
class Decoratee | |
METHODS.each do |m| | |
define_method m do | |
m |
This file contains 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
// So, I have this JSON bellow and I want a subset of the fields to be mapped onto an existing entities: | |
// Book Entity | |
public class Book { | |
private String title; | |
private List<String> authors; | |
private String publisher; | |
private List<String> categories; | |
private List<Identifier> industryIdentifiers; | |
} |
This file contains 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 Module | |
# ============================================================================= | |
def module_attr_reader opts | |
Array(opts).each do |m_name, default_value| | |
class_eval(<<-RUBY, __FILE__, __LINE__) | |
@@#{m_name} = default_value unless defined? @@#{m_name} | |
def self.#{m_name}; @@#{m_name}; end | |
RUBY | |
end | |
end |
This file contains 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 Hash | |
def self.infinite | |
self.new{|h, k| h[k] = self.new(&h.default_proc)} | |
end | |
def self.recursive max = nil | |
if max && max.kind_of?(Fixnum) | |
self.new{|h,k| h[k] = self.recursive(max-1) if max > 1} | |
else | |
infinite |