Skip to content

Instantly share code, notes, and snippets.

# credit
# https://www.abstractapi.com/guides/how-to-validate-an-email-address-in-ruby
# valid
"mymail@myserver.com" =~ URI::MailTo::EMAIL_REGEXP
# invalid
"wrong" =~ URI::MailTo::EMAIL_REGEXP
@xofred
xofred / GitConfigHttpProxy.md
Created October 27, 2020 03:23 — forked from evantoli/GitConfigHttpProxy.md
Configure Git to use a proxy

Configure Git to use a proxy

In Brief

You may need to configure a proxy server if you're having trouble cloning or fetching from a remote repository or getting an error like unable to access '...' Couldn't resolve host '...'.

Consider something like:

@xofred
xofred / force_bot.rb
Last active September 1, 2020 07:55
Auto generate factory_bot model definition on legacy project
# Solve https://github.com/thoughtbot/factory_bot_rails/issues/63
# Original credit https://stackoverflow.com/a/50319158/2180787
# If you use Rails and see the following error:
# Could not find generator 'factory_bot:model'. Maybe you meant 'test_unit:model', 'active_record:model' or 'rspec:model'
# Run `rails generate --help` for more options.
#
# Make sure factory_bot_rails is in the Gemfile relative enviroment group, such as development, test
#
#group :development, :test do
@xofred
xofred / surge.conf
Created May 15, 2017 05:15 — forked from blackgear/surge.conf
Surge config for new user
[General]
loglevel = warning
bypass-system = true
skip-proxy = 192.168.0.0/16,10.0.0.0/8,172.16.0.0/12,localhost,*.local,*.lan
bypass-tun = 192.168.0.0/16,10.0.0.0/8,172.16.0.0/12
dns-server = 114.114.114.114,114.114.115.115
[Proxy]
PROXY = custom,服务器地址,服务器端口,加密方式,密码,模块地址,tcp-fast-open=true