Skip to content

Instantly share code, notes, and snippets.

View WaKeMaTTa's full-sized avatar
✔️
Verified

Mohamed Ziata WaKeMaTTa

✔️
Verified
View GitHub Profile
# Use TDD principles to build out name functionality for a Person.
# Here are the requirements:
# - Add a method to return the full name as a string. A full name includes
# first, middle, and last name. If the middle name is missing, there shouldn't
# have extra spaces.
# - Add a method to return a full name with a middle initial. If the middle name
# is missing, there shouldn't be extra spaces or a period.
# - Add a method to return all initials. If the middle name is missing, the
# initials should only have two characters.
#
# .github/workflows/03-pull-phrase-to-github.yml
name: "Locales : Phrase pull on main branch"
on:
workflow_dispatch: # This will allow us to execute this github workflow manually whenever we want.
schedule:
- cron: '0 7 * * 1,2,3,4,5'
jobs:
build:
name: "Phrase : Sync Phrase with Github (main branch)"
# .phrase.yml
phrase:
access_token: YOUR_ACCESS_TOKEN
project_id: YOUR_PROJECT_ID
push:
sources:
- file: ./config/locales/<locale_name>.yml
params:
file_format: yml
@WaKeMaTTa
WaKeMaTTa / 01-create-phrase-branch.yml
Last active September 9, 2022 13:35
This GitHub Workflow it will be executed when a new Git branch is created and it has changes inside config/locales.  And his job is to creates and push copy changes in a new phrase.com branch.
# .github/workflows/01-create-phrase-branch.yml
name: "Locales : Create or Update phrase.com (branch)"
on:
push:
branches-ignore:
- main
- staging
- 'auto-phrase-sync-*'
paths:
@WaKeMaTTa
WaKeMaTTa / 02-merge-phrase-branch-in-to-phrase-main.yml
Last active September 9, 2022 13:35
This GitHub Workflow it will be executed when a GitHub Pull Request is merged in main git branch and it has changes inside config/locales. And his job is to creates and push copy changes in a phrase.com (main). If it fails, it sends a Slack message to the developers team.
# .github/workflows/02-merge-phrase-branch-in-to-phrase-main.yml
name: "Locales : Replicate git merge in phrase.com"
on:
pull_request:
branches:
- main
types:
- closed
paths:
#!/usr/bin/env ruby
require 'yaml'
if Gem::Version.new(Psych::LIBYAML_VERSION) < Gem::Version.new('0.2.5')
warn "Your libyaml library is outdated: please upgrade to >= 0.2.5.\n" \
"The generated YAML will include output trailing spaces for empty scalar nodes, whereas " \
"Phrase doesn't include them."
end
# Method to "deep sort" keys in a Hash (i.e. recursively), the way that Phrase would do.
@WaKeMaTTa
WaKeMaTTa / rails_7_trailing_slash_test.rb
Created February 9, 2022 13:30
Rails 7 - with_options trailing_slash: true
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
# Activate the gem you are reporting the issue against.
@WaKeMaTTa
WaKeMaTTa / rails_6_trailing_slash_test.rb
Created February 9, 2022 13:28
Rails 6 - with_options trailing_slash: true
# frozen_string_literal: true
require "bundler/inline"
gemfile(true) do
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
# Activate the gem you are reporting the issue against.
require "benchmark"
include Benchmark
n = 100_000_000
def while_loop(n = 100_000_000)
i = 0
s = 0
while i <= n
@WaKeMaTTa
WaKeMaTTa / Gemfile
Created October 17, 2016 12:07 — forked from remino/Gemfile
kramdown-rails: Use Kramdown (Markdown) in Rails 4
# Gemfile
gem 'kramdown'