Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

João Marcos joaomarcos96

🎯
Focusing
View GitHub Profile
@leandronsp
leandronsp / cractor.rb
Created Jan 17, 2022
A dead simple Actor in Ruby, simulating the same API for Ractors
View cractor.rb
class Cractor
def initialize(*args, &block)
@inbox = Queue.new
@outbox = Queue.new
Thread.new do
result = yield(self, *args)
self.yield(result)
end
@joaomarcos96
joaomarcos96 / arch_faster_rubocop_vscode.md
Last active Feb 8, 2021
Faster RuboCop for VSCode in Arch Linux
View arch_faster_rubocop_vscode.md
@joaomarcos96
joaomarcos96 / pre-push.sh
Last active Feb 8, 2021
git pre-push hook to confirm push force or delete on any branch
View pre-push.sh
#!/bin/sh
current_branch=$(git rev-parse --abbrev-ref HEAD)
push_command=$(ps -ocommand= -p $PPID)
is_destructive='force|delete|\-f'
confirm_destructive_action(){
read -p 'Are you sure you want to push to "'$current_branch'" ? (y/n): ' -n 1 -r < /dev/tty
@joaomarcos96
joaomarcos96 / ExportOptions.plist
Last active Mar 19, 2021
iOS automated deploy
View ExportOptions.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>destination</key>
<string>upload</string>
<key>method</key>
<string>app-store</string>
<key>teamID</key>
<string>MyTeamID</string> <!-- your team ID, something like "AB12C345DE" -->
View arch_ruby_2.3_install.md

Installing Ruby 2.3.x in Arch Linux

Have openssl-1.0 and gcc installed

sudo pacman -S --needed openssl-1.0 gcc

Install Ruby 2.3.x with gcc and openssl path defined

@rponte
rponte / using-uuid-as-pk.md
Last active Apr 29, 2022
Não use UUID como PK nas tabelas do seu banco de dados
View using-uuid-as-pk.md

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

View resoursable.rb
# frozen_string_literal: true
module Resourceable
extend ActiveSupport::Concern
included do
before_action :set_resource, only: %i[show edit update destroy]
before_action :authorize_resource
helper_method :resource
@serradura
serradura / observers.rb
Last active Apr 21, 2022
Simple observer (pub/sub) in Ruby
View observers.rb
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'u-test'
gem 'activerecord', require: 'active_record'
gem 'sqlite3'
end
@lukaselmer
lukaselmer / ExportOptions.plist
Created Jan 11, 2020
Create a Flutter .apk and .ipa file to upload it to Firebase App Distribution
View ExportOptions.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key>
<string>ad-hoc</string>
<key>uploadBitcode</key>
<false/>
<key>uploadSymbols</key>
<true/>
View scrollbar_display_always.dart
import 'package:flutter/material.dart';
/// able to show scrollbar always with following example
/// available with changes from this branch https://github.com/onatcipli/flutter/tree/scrollbar_display_always
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();