Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View lastk's full-sized avatar

Rafael Oliveira lastk

  • Salvador-Ba, Brazil
View GitHub Profile
@lastk
lastk / must-watch-talks.txt
Created July 4, 2017 14:56 — forked from leandrocp/must-watch-talks.md
must-watch talks
Rich Hickey
https://confreaks.tv/videos/railsconf2012-keynote-simplicity-matters
https://confreaks.tv/videos/jaxconf2012-keynote-the-value-of-values
Dave Thomas
https://confreaks.tv/videos/elixirconf2014-opening-keynote-think-different
https://confreaks.tv/videos/lonestarruby2013-elixir-power-of-erlang-joy-of-ruby
Robert Martin
https://confreaks.tv/videos/rubymidwest2011-keynote-architecture-the-lost-years
@lastk
lastk / getting-started.md
Created August 14, 2018 11:37 — forked from joepie91/getting-started.md
Getting started with Node.js

"How do I get started with Node?" is a commonly heard question in #Node.js. This gist is an attempt to compile some of the answers to that question. It's a perpetual work-in-progress.

And if this list didn't quite answer your questions, I'm available for tutoring and code review! A donation is also welcome :)

Setting expectations

Before you get started learning about JavaScript and Node.js, there's one very important article you need to read: Teach Yourself Programming in Ten Years.

Understand that it's going to take time to learn Node.js, just like it would take time to learn any other specialized topic - and that you're not going to learn effectively just by reading things, or following tutorials or courses. _Get out there and build things!

@lastk
lastk / using-uuid-as-pk.md
Created December 29, 2020 23:14 — forked from rponte/using-uuid-as-pk.md
Não use UUID como PK nas tabelas do seu banco de dados

Pretende usar UUID como PK em vez de Int/BigInt no seu banco de dados? Pense novamente...

TL;TD

Não use UUID como PK nas tabelas do seu banco de dados.

Um pouco mais de detalhes

@lastk
lastk / reboot_mysql_database.php
Created December 12, 2020 01:34 — forked from jasondavis/reboot_mysql_database.php
Start / Stop / Reboot MySQL Database server using SSH with PHP
<?php
// Start / Stop / Reboot MySQL Database server using SSH with PHP
// Requires the library from phpseclib.sourceforge.net / https://github.com/phpseclib/phpseclib
// Server user login data
$ssh_user = '';
$ssh_password = '';
$ssh_server_ip = '';
?>
<!DOCTYPE html>
@lastk
lastk / service-objects.md
Created November 10, 2020 16:54 — forked from blaix/service-objects.md
Martin Fowler on Service Objects via the Ruby Rogues Parley mailing list

On Tue, Mar 12, 2013 at 1:26 PM, Martin Fowler martinfowlercom@gmail.com wrote:

The term pops up in some different places, so it's hard to know what it means without some context. In PoEAA I use the pattern Service Layer to represent a domain-oriented layer of behaviors that provide an API for the domain layer. This may or may not sit on top of a Domain Model. In DDD Eric Evans uses the term Service Object to refer to objects that represent processes (as opposed to Entities and Values). DDD Service Objects are often useful to factor out behavior that would otherwise bloat Entities, it's also a useful step to patterns like Strategy and Command.

It sounds like the DDD sense is the sense I'm encountering most often. I really need to read that book.

The conceptual problem I run into in a lot of codebases is that rather than representing a process, the "service objects" represent "a thing that does the process". Which sounds like a nitpicky difference, but it seems to have a real impact on how people us

@lastk
lastk / pg_pub_sub.rb
Created August 20, 2020 20:01 — forked from chsh/pg_pub_sub.rb
PostgreSQL LISTEN/NOTIFY example for ruby
#
# A:
# pubsub = PgPubSub.new('channelname')
# pubsub.subscribe do |data|
# puts "data: #{data} is coming!"
# end
#
# B:
# pubsub = PgPubSub.new('channelname')
# pubsub.publish("hello world")
@lastk
lastk / Gemfile
Created June 25, 2020 15:46 — forked from dhh/Gemfile
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@lastk
lastk / spacemacs-cheshe.md
Created May 14, 2019 15:29 — forked from robphoenix/spacemacs-cheshe.md
Spacemacs Cheat Sheet

Useful Spacemacs commands

  • SPC q q - quit
  • SPC w / - split window vertically
  • SPC w - - split window horizontally
  • SPC 1 - switch to window 1
  • SPC 2 - switch to window 2
  • SPC w c - delete current window
  • SPC TAB - switch to previous buffer
  • SPC b b - switch buffers
@lastk
lastk / osx_setup.md
Last active April 5, 2019 13:59 — forked from mcls/osx_setup.md
Setup mac for ruby dev
@lastk
lastk / reproduce.rb
Created April 3, 2019 16:50 — forked from albb0920/reproduce.rb
Unnecessary & slow query executed when using scope as condition
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails', '5.2.0' # use correct rails version